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