FileDocCategorySizeDatePackage
LaunchShortcut.javaAPI DocAndroid 1.5 API3036Wed May 06 22:41:10 BST 2009com.android.ide.eclipse.adt.launch

LaunchShortcut

public class LaunchShortcut extends Object implements org.eclipse.debug.ui.ILaunchShortcut
Launch shortcut to launch debug/run configuration directly.

Fields Summary
Constructors Summary
Methods Summary
public voidlaunch(org.eclipse.jface.viewers.ISelection selection, java.lang.String mode)

        if (selection instanceof IStructuredSelection) {

            // get the object and the project from it
            IStructuredSelection structSelect = (IStructuredSelection)selection;
            Object o = structSelect.getFirstElement();

            // get the first (and normally only) element
            if (o instanceof IAdaptable) {
                IResource r = (IResource)((IAdaptable)o).getAdapter(IResource.class);

                // get the project from the resource
                if (r != null) {
                    IProject project = r.getProject();

                    if (project != null)  {
                        // and launch
                        launch(project, mode);
                    }
                }
            }
        }
    
public voidlaunch(org.eclipse.ui.IEditorPart editor, java.lang.String mode)

        // since we force the shortcut to only work on selection in the
        // package explorer, this will never be called.
    
private voidlaunch(org.eclipse.core.resources.IProject project, java.lang.String mode)
Launch a config for the specified project.

param
project The project to launch
param
mode The launch mode ("debug", "run" or "profile")

        // get an existing or new launch configuration
        ILaunchConfiguration config = AndroidLaunchController.getLaunchConfig(project);

        if (config != null) {
            // and launch!
            DebugUITools.launch(config, mode);
        }