plugins/org.symbian.tools.wrttools.product/src/org/symbian/tools/wrttools/product/actions/DebugAction.java
changeset 487 356e57403778
equal deleted inserted replaced
486:f0031abe2cd6 487:356e57403778
       
     1 /**
       
     2  * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of the License "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Symbian Foundation - initial contribution.
       
    11  * Contributors:
       
    12  * Description:
       
    13  * Overview:
       
    14  * Details:
       
    15  * Platforms/Drives/Compatibility:
       
    16  * Assumptions/Requirement/Pre-requisites:
       
    17  * Failures and causes:
       
    18  */
       
    19 package org.symbian.tools.wrttools.product.actions;
       
    20 
       
    21 import org.eclipse.core.resources.IProject;
       
    22 import org.eclipse.core.resources.ResourcesPlugin;
       
    23 import org.eclipse.debug.internal.ui.actions.DebugLastAction;
       
    24 import org.eclipse.jface.action.IAction;
       
    25 import org.eclipse.jface.dialogs.MessageDialog;
       
    26 import org.symbian.tools.tmw.core.TMWCore;
       
    27 
       
    28 @SuppressWarnings("restriction")
       
    29 public class DebugAction extends DebugLastAction {
       
    30     @Override
       
    31     public void run(IAction action) {
       
    32         boolean hasTmwProjects = false;
       
    33         IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
       
    34         for (IProject project : projects) {
       
    35             if (project.isAccessible() && TMWCore.create(project) != null) {
       
    36                 hasTmwProjects = true;
       
    37                 break;
       
    38             }
       
    39         }
       
    40         if (hasTmwProjects) {
       
    41             super.run(action);
       
    42         } else {
       
    43             MessageDialog.openInformation(getShell(), "Cannot launch debugger",
       
    44                     "There are no open projects in your workspace");
       
    45         }
       
    46     }
       
    47 }