plugins/org.symbian.tools.tmw.debug/src/org/symbian/tools/tmw/debug/ui/actions/DebugAction.java
changeset 472 bd9f2d7c64a6
parent 471 06589bf52fa7
child 485 df4f55e8569e
equal deleted inserted replaced
471:06589bf52fa7 472:bd9f2d7c64a6
    21 import org.eclipse.core.resources.IProject;
    21 import org.eclipse.core.resources.IProject;
    22 import org.eclipse.core.resources.ResourcesPlugin;
    22 import org.eclipse.core.resources.ResourcesPlugin;
    23 import org.eclipse.debug.internal.ui.actions.DebugLastAction;
    23 import org.eclipse.debug.internal.ui.actions.DebugLastAction;
    24 import org.eclipse.jface.action.IAction;
    24 import org.eclipse.jface.action.IAction;
    25 import org.eclipse.jface.dialogs.MessageDialog;
    25 import org.eclipse.jface.dialogs.MessageDialog;
    26 import org.symbian.tools.wrttools.util.ProjectUtils;
    26 import org.symbian.tools.tmw.core.TMWCore;
    27 
    27 
    28 @SuppressWarnings("restriction")
    28 @SuppressWarnings("restriction")
    29 public class DebugAction extends DebugLastAction {
    29 public class DebugAction extends DebugLastAction {
    30     @Override
    30     @Override
    31     public void run(IAction action) {
    31     public void run(IAction action) {
    32         boolean hasWrtProjects = false;
    32         boolean hasWrtProjects = false;
    33         IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
    33         IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
    34         for (IProject project : projects) {
    34         for (IProject project : projects) {
    35             if (project.isAccessible() && ProjectUtils.hasWrtNature(project)) {
    35             if (project.isAccessible() && TMWCore.create(project) != null) {
    36                 hasWrtProjects = true;
    36                 hasWrtProjects = true;
    37                 break;
    37                 break;
    38             }
    38             }
    39         }
    39         }
    40         if (hasWrtProjects) {
    40         if (hasWrtProjects) {
    41         super.run(action);
    41             super.run(action);
    42         } else {
    42         } else {
    43             MessageDialog.openInformation(getShell(), "Cannot launch debugger",
    43             MessageDialog.openInformation(getShell(), "Cannot launch debugger",
    44                     "There are no open projects in your workspace");
    44                     "There are no open projects in your workspace");
    45         }
    45         }
    46     }
    46     }