Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 58480 Details for
Bug 74480
[launching] Simplify the launch experience for less technical users of Eclipse
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
new hotness
74480_14.patch (text/plain), 104.25 KB, created by
Michael Rennie
on 2007-02-07 14:56:02 EST
(
hide
)
Description:
new hotness
Filename:
MIME Type:
Creator:
Michael Rennie
Created:
2007-02-07 14:56:02 EST
Size:
104.25 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.debug.core >Index: core/org/eclipse/debug/internal/core/LaunchManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java,v >retrieving revision 1.187 >diff -u -r1.187 LaunchManager.java >--- core/org/eclipse/debug/internal/core/LaunchManager.java 25 Jan 2007 15:49:36 -0000 1.187 >+++ core/org/eclipse/debug/internal/core/LaunchManager.java 7 Feb 2007 19:39:24 -0000 >@@ -2415,20 +2415,22 @@ > * CONTEXTLAUNCHING > */ > public ILaunchConfiguration getDefaultConfiguration(IResource resource) throws CoreException { >- IProject project = resource.getProject(); >- if (project != null) { >- org.osgi.service.prefs.Preferences projectNode = getProjectNode(resource); >- String configValue = projectNode.get(DEFAULT_CONFIGURATION, null); >- if (configValue != null) { >- // shared config >- IFile file = project.getFile(Path.fromPortableString(configValue)); >- return getLaunchConfiguration(file); >- } else { >- org.osgi.service.prefs.Preferences instanceNode = getInstanceNode(resource); >- configValue = instanceNode.get(DEFAULT_CONFIGURATION, null); >+ if(resource != null) { >+ IProject project = resource.getProject(); >+ if (project != null) { >+ org.osgi.service.prefs.Preferences projectNode = getProjectNode(resource); >+ String configValue = projectNode.get(DEFAULT_CONFIGURATION, null); > if (configValue != null) { >- // local config >- return getLaunchConfiguration(configValue); >+ // shared config >+ IFile file = project.getFile(Path.fromPortableString(configValue)); >+ return getLaunchConfiguration(file); >+ } else { >+ org.osgi.service.prefs.Preferences instanceNode = getInstanceNode(resource); >+ configValue = instanceNode.get(DEFAULT_CONFIGURATION, null); >+ if (configValue != null) { >+ // local config >+ return getLaunchConfiguration(configValue); >+ } > } > } > } >Index: core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java,v >retrieving revision 1.68 >diff -u -r1.68 LaunchConfigurationWorkingCopy.java >--- core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java 25 Jan 2007 15:49:36 -0000 1.68 >+++ core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java 7 Feb 2007 19:39:23 -0000 >@@ -176,8 +176,13 @@ > if (getParent() != null) { > // save to parent working copy > LaunchConfigurationWorkingCopy wc = (LaunchConfigurationWorkingCopy) getParent(); >- wc.setName(getName()); >- wc.copyFrom(this); >+ if(fRenamed) { >+ wc.rename(getName()); >+ } >+ else { >+ wc.setName(getName()); >+ } >+ wc.setAttributes(getInfo().getAttributes()); > return wc; > } > else { >#P org.eclipse.jdt.debug.ui >Index: ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaMainTab.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaMainTab.java,v >retrieving revision 1.48 >diff -u -r1.48 JavaMainTab.java >--- ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaMainTab.java 7 Feb 2007 16:57:53 -0000 1.48 >+++ ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaMainTab.java 7 Feb 2007 19:39:24 -0000 >@@ -154,8 +154,8 @@ > elements = new IJavaElement[]{}; > } > int constraints = IJavaSearchScope.SOURCES; >+ constraints |= IJavaSearchScope.APPLICATION_LIBRARIES; > if (fSearchExternalJarsCheckButton.getSelection()) { >- constraints |= IJavaSearchScope.APPLICATION_LIBRARIES; > constraints |= IJavaSearchScope.SYSTEM_LIBRARIES; > } > IJavaSearchScope searchScope = SearchEngine.createJavaSearchScope(elements, constraints); >Index: ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaApplicationLaunchShortcut.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaApplicationLaunchShortcut.java,v >retrieving revision 1.31 >diff -u -r1.31 JavaApplicationLaunchShortcut.java >--- ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaApplicationLaunchShortcut.java 25 Jan 2007 15:55:18 -0000 1.31 >+++ ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaApplicationLaunchShortcut.java 7 Feb 2007 19:39:24 -0000 >@@ -92,7 +92,9 @@ > try { > IJavaElement[] javaElements = getJavaElements(elements); > MainMethodSearchEngine engine = new MainMethodSearchEngine(); >- IJavaSearchScope scope = SearchEngine.createJavaSearchScope(javaElements, false); >+ int constraints = IJavaSearchScope.SOURCES; >+ constraints |= IJavaSearchScope.APPLICATION_LIBRARIES; >+ IJavaSearchScope scope = SearchEngine.createJavaSearchScope(javaElements, constraints); > return engine.searchMainMethods(context, scope, true); > } catch (InvocationTargetException e) { > throw (CoreException)e.getTargetException(); >#P org.eclipse.debug.ui >Index: ui/org/eclipse/debug/internal/ui/contextlaunching/ProfileContextLaunchingAction.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/contextlaunching/ProfileContextLaunchingAction.java >diff -N ui/org/eclipse/debug/internal/ui/contextlaunching/ProfileContextLaunchingAction.java >--- ui/org/eclipse/debug/internal/ui/contextlaunching/ProfileContextLaunchingAction.java 26 Jan 2007 14:39:51 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,36 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2007 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- *******************************************************************************/ >-package org.eclipse.debug.internal.ui.contextlaunching; >- >-import org.eclipse.debug.core.ILaunchManager; >- >-/** >- * Specialization of <code>ContextLaunchingAction</code> for profile mode >- * >- * @see ContextLaunchingAction >- * @see ILaunchManager >- * @see RunContextLaunchingAction >- * @see DebugContextLaunchingAction >- * >- * @since 3.3 >- * EXPERIMENTAL >- * CONTEXTLAUNCHING >- */ >-public class ProfileContextLaunchingAction extends ContextLaunchingAction { >- >- /** >- * Constructor >- */ >- public ProfileContextLaunchingAction() { >- super(ILaunchManager.PROFILE_MODE); >- } >- >-} >Index: ui/org/eclipse/debug/internal/ui/contextlaunching/ContextLaunchingAction.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/contextlaunching/ContextLaunchingAction.java >diff -N ui/org/eclipse/debug/internal/ui/contextlaunching/ContextLaunchingAction.java >--- ui/org/eclipse/debug/internal/ui/contextlaunching/ContextLaunchingAction.java 26 Jan 2007 14:39:50 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,76 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2007 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- *******************************************************************************/ >-package org.eclipse.debug.internal.ui.contextlaunching; >- >-import org.eclipse.jface.action.IAction; >-import org.eclipse.jface.viewers.ISelection; >-import org.eclipse.swt.widgets.Event; >-import org.eclipse.ui.IActionDelegate2; >- >-/** >- * A universal context launching action for popup menus. >- * This action gets its immediate context from what was right-clicked >- * on to present the action. >- * >- * @see ContextRunner >- * @see IActionDelegate2 >- * @see RunContextLaunchingAction >- * @see DebugContextLaunchingAction >- * @see ProfileContextLaunchingAction >- * >- * @since 3.3 >- * EXPERIMENTAL >- * CONTEXTLAUNCHING >- */ >-public class ContextLaunchingAction implements IActionDelegate2 { >- >- /** >- * the mode the action is created on >- */ >- private String fMode = null; >- >- /** >- * Constructor >- * @param mode >- */ >- public ContextLaunchingAction(String mode) { >- fMode = mode; >- } >- >- /** >- * @see org.eclipse.ui.IActionDelegate2#dispose() >- */ >- public void dispose() {} >- >- /** >- * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction) >- */ >- public void init(IAction action) {} >- >- /** >- * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction, org.eclipse.swt.widgets.Event) >- */ >- public void runWithEvent(IAction action, Event event) { >- ContextRunner.getDefault().launch(fMode); >- } >- >- /** >- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) >- */ >- public void run(IAction action) { >- //not called >- } >- >- /** >- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) >- */ >- public void selectionChanged(IAction action, ISelection selection) {} >-} >Index: ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.java,v >retrieving revision 1.1 >diff -u -r1.1 ContextMessages.java >--- ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.java 25 Jan 2007 15:55:14 -0000 1.1 >+++ ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.java 7 Feb 2007 19:39:26 -0000 >@@ -10,17 +10,14 @@ > */ > public class ContextMessages extends NLS { > private static final String BUNDLE_NAME = "org.eclipse.debug.internal.ui.contextlaunching.ContextMessages"; //$NON-NLS-1$ >- > public static String ContextRunner_0; >- public static String ContextRunner_1; >- public static String ContextRunner_2; >- public static String ContextRunner_3; >- public static String ContextRunner_4; > public static String ContextRunner_5; > public static String ContextRunner_6; >- > public static String ContextRunner_7; >+ public static String ContextRunner_8; >+ public static String ContextRunner_9; > public static String OpenLaunchDialogAction_0; >+ public static String OpenLaunchDialogAction_1; > static { > // initialize resource bundle > NLS.initializeMessages(BUNDLE_NAME, ContextMessages.class); >Index: ui/org/eclipse/debug/internal/ui/contextlaunching/ContextLaunchingToolbarAction.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/contextlaunching/ContextLaunchingToolbarAction.java >diff -N ui/org/eclipse/debug/internal/ui/contextlaunching/ContextLaunchingToolbarAction.java >--- ui/org/eclipse/debug/internal/ui/contextlaunching/ContextLaunchingToolbarAction.java 26 Jan 2007 14:39:51 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,82 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2007 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- *******************************************************************************/ >-package org.eclipse.debug.internal.ui.contextlaunching; >- >-import org.eclipse.debug.internal.ui.DebugUIPlugin; >-import org.eclipse.debug.internal.ui.launchConfigurations.LaunchGroupExtension; >-import org.eclipse.jface.action.Action; >-import org.eclipse.jface.action.IAction; >-import org.eclipse.jface.viewers.ISelection; >-import org.eclipse.swt.widgets.Event; >-import org.eclipse.ui.IWorkbenchWindow; >-import org.eclipse.ui.IWorkbenchWindowActionDelegate; >- >-/** >- * A wrapper class for a context launching toolbar action >- * >- * @see ContextRunner >- * @see ContextLaunchingAction >- * @see Action >- * @see IWorkbenchWindowActionDelegate >- * >- * @since 3.3 >- * EXPERIMENTAL >- * CONTEXTLAUNCHING >- */ >-public class ContextLaunchingToolbarAction extends Action implements IWorkbenchWindowActionDelegate { >- >- /** >- * The mode this action applies to >- */ >- private String fMode = null; >- >- /** >- * Constructor >- * @param id >- */ >- public ContextLaunchingToolbarAction(String id) { >- LaunchGroupExtension extension = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(id); >- if (extension != null) { >- fMode = extension.getMode(); >- setText(extension.getLabel()); >- setImageDescriptor(extension.getImageDescriptor()); >- } >- } >- >- /** >- * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose() >- */ >- public void dispose() {} >- >- /** >- * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow) >- */ >- public void init(IWorkbenchWindow window) {} >- >- /** >- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) >- */ >- public void selectionChanged(IAction action, ISelection selection) {} >- >- /** >- * @see org.eclipse.jface.action.Action#runWithEvent(org.eclipse.swt.widgets.Event) >- */ >- public void runWithEvent(Event event) { >- ContextRunner.getDefault().launch(fMode); >- } >- >- /** >- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) >- */ >- public void run(IAction action) { >- //do nothing >- } >-} >Index: ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.properties,v >retrieving revision 1.4 >diff -u -r1.4 ContextMessages.properties >--- ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.properties 26 Jan 2007 14:53:07 -0000 1.4 >+++ ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.properties 7 Feb 2007 19:39:26 -0000 >@@ -1,9 +1,8 @@ > ContextRunner_0=Unable To Launch >-ContextRunner_1=There is no way to launch the currently selected context, would you like to {0} the last thing you launched? >-ContextRunner_2=&Always perform this action >-ContextRunner_3=Not Runnable >-ContextRunner_4={0} is not runnable, would you like to check its'' parent project for a way to run it? > ContextRunner_5=Cannot Launch >-ContextRunner_6=Neither the selected resource or its' associated project are launchable. >+ContextRunner_6=The selected resource is not launchable. > ContextRunner_7=The current context cannot be launched, and there are no recent launches. >-OpenLaunchDialogAction_0=Open {0} Dialog >+ContextRunner_8=&Select a configuration to launch: >+ContextRunner_9=Select Configuration >+OpenLaunchDialogAction_0=Open {0} Dialog... >+OpenLaunchDialogAction_1=&Open {0} Dialog... >Index: ui/org/eclipse/debug/internal/ui/contextlaunching/ContextRunner.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contextlaunching/ContextRunner.java,v >retrieving revision 1.3 >diff -u -r1.3 ContextRunner.java >--- ui/org/eclipse/debug/internal/ui/contextlaunching/ContextRunner.java 26 Jan 2007 14:39:50 -0000 1.3 >+++ ui/org/eclipse/debug/internal/ui/contextlaunching/ContextRunner.java 7 Feb 2007 19:39:26 -0000 >@@ -10,25 +10,19 @@ > *******************************************************************************/ > package org.eclipse.debug.internal.ui.contextlaunching; > >-import java.util.ArrayList; >-import java.util.Iterator; >+import java.util.HashSet; > import java.util.List; > >-import org.eclipse.core.expressions.EvaluationContext; >-import org.eclipse.core.expressions.IEvaluationContext; >-import org.eclipse.core.resources.IFile; >-import org.eclipse.core.resources.IProject; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IAdaptable; > import org.eclipse.debug.core.DebugPlugin; >-import org.eclipse.debug.core.ILaunch; > import org.eclipse.debug.core.ILaunchConfiguration; >-import org.eclipse.debug.core.ILaunchListener; >-import org.eclipse.debug.core.ILaunchMode; > import org.eclipse.debug.internal.core.LaunchManager; > import org.eclipse.debug.internal.ui.DebugUIPlugin; >+import org.eclipse.debug.internal.ui.DefaultLabelProvider; > import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; >+import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager; > import org.eclipse.debug.internal.ui.launchConfigurations.LaunchHistory; > import org.eclipse.debug.internal.ui.launchConfigurations.LaunchShortcutExtension; > import org.eclipse.debug.internal.ui.launchConfigurations.LaunchShortcutSelectionDialog; >@@ -36,21 +30,19 @@ > import org.eclipse.debug.ui.ILaunchGroup; > import org.eclipse.jface.dialogs.IDialogConstants; > import org.eclipse.jface.dialogs.MessageDialog; >-import org.eclipse.jface.dialogs.MessageDialogWithToggle; > import org.eclipse.jface.text.ITextSelection; >+import org.eclipse.jface.viewers.ArrayContentProvider; > import org.eclipse.jface.viewers.ISelection; > import org.eclipse.jface.viewers.ISelectionProvider; > import org.eclipse.jface.viewers.IStructuredSelection; > import org.eclipse.jface.viewers.StructuredSelection; > import org.eclipse.jface.window.Window; > import org.eclipse.ui.IEditorPart; >-import org.eclipse.ui.IFileEditorInput; > import org.eclipse.ui.IWorkbenchPage; > import org.eclipse.ui.IWorkbenchPart; > import org.eclipse.ui.IWorkbenchPartSite; > import org.eclipse.ui.IWorkbenchWindow; >- >-import com.ibm.icu.text.MessageFormat; >+import org.eclipse.ui.dialogs.ListDialog; > > /** > * Static runner for context launching to provide the base capability of context >@@ -65,8 +57,11 @@ > * EXPERIMENTAL > * CONTEXTLAUNCHING > */ >-public class ContextRunner implements ILaunchListener { >+public final class ContextRunner { > >+ /** >+ * The singleton instance of the context runner >+ */ > private static ContextRunner fgInstance = null; > > /** >@@ -79,14 +74,6 @@ > } > return fgInstance; > } >- >- /** >- * The underlying resource that is derived from the object context of the >- * run(Object, String) method >- */ >- private IResource fBackingResource = null; >- private boolean fMakeResourceDefault = false; >- private boolean fMakeProjectDefault = false; > > /** > * Performs the context launching given the object context and the mode to launch in. >@@ -94,51 +81,25 @@ > */ > public void launch(String mode) { > try { >+ //1. resolve resource > Object context = getCurrentContext(); >- ILaunchConfiguration config = isSharedConfig(context); >- if(config != null) { >- DebugUITools.launch(config, mode); >- return; >- } >- config = isSharedConfigEditorInput(context); >- if(config != null) { >- DebugUITools.launch(config, mode); >- return; >- } >- if(context instanceof IAdaptable) { >- IAdaptable adapt = (IAdaptable) context; >- //try to get the ILaunchConfiguration adapter first >- config = (ILaunchConfiguration) adapt.getAdapter(ILaunchConfiguration.class); >- if(config != null) { >- DebugUITools.launch(config, mode); >- return; >- } >- else { >- //try to get the resource adapter from the context >- IResource resource = (IResource) adapt.getAdapter(IResource.class); >+ ILaunchConfiguration config = null; >+ if(context != null) { >+ if(context instanceof IAdaptable) { >+ IResource resource = (IResource) ((IAdaptable)context).getAdapter(IResource.class); > if(resource != null) { >- fBackingResource = resource; >- config = getLaunchManager().getDefaultConfiguration(resource); >- if(config != null && config.exists()) { >- //the default config is available >- DebugUITools.launch(config, mode); >- return; >- } >- else { >- //there is no default config >- getLaunchManager().setDefaultConfiguration(resource, null); >- selectAndLaunch(fBackingResource, mode); >- return; >- } >- } >- else { >- handleUnknownContext(mode); >+ selectAndLaunch(resource, mode); >+ return; > } > } > } >- else { >- handleUnknownContext(mode); >+ //2. launch last if no resource >+ config = getLastLaunch(mode); >+ if(config != null) { >+ DebugUITools.launch(config, mode); >+ return; > } >+ > } > catch(CoreException ce) {DebugUIPlugin.log(ce);} > } >@@ -152,27 +113,6 @@ > if(config == null) { > MessageDialog.openInformation(DebugUIPlugin.getShell(), ContextMessages.ContextRunner_0, ContextMessages.ContextRunner_7); > } >- else { >- String prompt = DebugUIPlugin.getDefault().getPreferenceStore().getString(IInternalDebugUIConstants.PREF_ALWAYS_RUN_LAST_LAUNCH); >- if(MessageDialogWithToggle.PROMPT.equals(prompt)) { >- ILaunchMode lmode = getLaunchManager().getLaunchMode(mode); >- MessageDialogWithToggle mdwt = MessageDialogWithToggle.openYesNoQuestion(DebugUIPlugin.getShell(), ContextMessages.ContextRunner_0, >- MessageFormat.format(ContextMessages.ContextRunner_1, new String[] {DebugUIPlugin.removeAccelerators(lmode.getLabel().toLowerCase())}), ContextMessages.ContextRunner_2, >- false, null, null); >- int ret = mdwt.getReturnCode(); >- boolean checked = mdwt.getToggleState(); >- if(ret == IDialogConstants.YES_ID) { >- //get launch history for the given mode and do it >- DebugUITools.launch(config, mode); >- if(checked) { >- DebugUIPlugin.getDefault().getPreferenceStore().putValue(IInternalDebugUIConstants.PREF_ALWAYS_RUN_LAST_LAUNCH, MessageDialogWithToggle.ALWAYS); >- } >- } >- } >- else if(MessageDialogWithToggle.ALWAYS.equals(prompt)) { >- DebugUITools.launch(config, mode); >- } >- } > } > > /** >@@ -192,19 +132,6 @@ > } > > /** >- * This method return if the editor input is from a shared java launch configuration file or not >- * @param receiver the editor input to examine >- * @return true if the editor input is from a shared launch configuration file, false otherwise. >- */ >- public ILaunchConfiguration isSharedConfigEditorInput(Object receiver) { >- if(receiver instanceof IFileEditorInput) { >- IFileEditorInput input = (IFileEditorInput) receiver; >- return isSharedConfig(input.getFile()); >- } >- return null; >- } >- >- /** > * Returns the launch group that corresponds to the specified mode > * @param mode the mode to find the launch group > * @return the launch group that corresponds to the specified mode >@@ -221,28 +148,6 @@ > } > > /** >- * Returns the shared config from the selected resource or <code>null</code> if the selected resources is not a shared config >- * @param receiver >- * @return the shared config from the selected resource or <code>null</code> if the selected resources is not a shared config >- */ >- public ILaunchConfiguration isSharedConfig(Object receiver) { >- if(receiver instanceof IFile) { >- IFile file = (IFile) receiver; >- String ext = file.getFileExtension(); >- if(ext == null) { >- return null; >- } >- if(ext.equals("launch")) { //$NON-NLS-1$ >- ILaunchConfiguration config = DebugPlugin.getDefault().getLaunchManager().getLaunchConfiguration(file); >- if(config != null && config.exists()) { >- return config; >- } >- } >- } >- return null; >- } >- >- /** > * Prompts the user to select a way of launching the current resource, where a 'way' > * is defined as a launch shortcut, and returns if a launch took place > * @param adapt the adaptable type the specified resource was derived from >@@ -251,88 +156,99 @@ > * @throws CoreException > */ > protected boolean selectAndLaunch(IResource resource, String mode) throws CoreException { >- boolean launched = false; >- if(launchDefault(resource, mode)) { >- return true; >- } >- List exts = getLaunchShortcuts(resource); >- if(exts.size() == 1) { >- //just launch it and set it as the default >- LaunchShortcutExtension ext = (LaunchShortcutExtension) exts.get(0); >- ext.launch(new StructuredSelection(resource), mode); >+ List configs = getLaunchConfigurationManager().getApplicableLaunchConfigurations(resource); >+ int csize = configs.size(); >+ List exts = getLaunchConfigurationManager().getLaunchShortcuts(resource); >+ int esize = exts.size(); >+ if(csize == 1) { >+ DebugUITools.launch((ILaunchConfiguration) configs.get(0), mode); > return true; > } >- else if(exts.size() < 1) { >- //prompt to try the parent containers >- String prompt = DebugUIPlugin.getDefault().getPreferenceStore().getString(IInternalDebugUIConstants.PREF_ALWAYS_RUN_PROJECT_CONFIGURATION); >- if(MessageDialogWithToggle.ALWAYS.equals(prompt)) { >- //go ahead and check >- selectAndLaunch(resource.getProject(), mode); >- } >- else if(MessageDialogWithToggle.PROMPT.equals(prompt)) { >- MessageDialogWithToggle mdwt = MessageDialogWithToggle.openYesNoQuestion(DebugUIPlugin.getShell(), ContextMessages.ContextRunner_3, >- MessageFormat.format(ContextMessages.ContextRunner_4, new String[] {fBackingResource.getName()}), >- ContextMessages.ContextRunner_2, false, null, null); >- int ret = mdwt.getReturnCode(); >- boolean checked = mdwt.getToggleState(); >- if(ret == IDialogConstants.YES_ID) { >- if(checked) { >- DebugUIPlugin.getDefault().getPreferenceStore().putValue(IInternalDebugUIConstants.PREF_ALWAYS_RUN_PROJECT_CONFIGURATION, MessageDialogWithToggle.ALWAYS); >- } >- selectAndLaunch(resource.getProject(), mode); >- } >+ if(csize < 1) { >+ if(esize == 1) { >+ LaunchShortcutExtension ext = (LaunchShortcutExtension) exts.get(0); >+ ext.launch(new StructuredSelection(resource), mode); >+ return true; > } >- return false; >- } >- else { >- boolean project = resource instanceof IProject; >- if(exts.isEmpty()) { >+ if(esize > 1) { >+ return showShortcutSelectionDialog(resource, mode); >+ } >+ if(esize < 1) { >+ //TODO check project?? should we prompt? > MessageDialog.openError(DebugUIPlugin.getShell(), ContextMessages.ContextRunner_5, ContextMessages.ContextRunner_6); > } >- else { >- LaunchShortcutSelectionDialog dialog = new LaunchShortcutSelectionDialog(resource, mode, !project, project); >- if (dialog.open() == Window.OK) { >- Object[] result = dialog.getResult(); >- if(result.length > 0) { >- fMakeProjectDefault = dialog.makeProjectDefault(); >- fMakeResourceDefault = dialog.makeDefault(); >- if(fMakeProjectDefault || fMakeResourceDefault) { >- getLaunchManager().addLaunchListener(this); >- } >- LaunchShortcutExtension method = (LaunchShortcutExtension) result[0]; >- if(method != null) { >- method.launch(new StructuredSelection(resource), mode); >- } >- } >+ } >+ else if(csize > 1){ >+ if(!launchMRU(configs, mode)) { >+ return showConfigurationSelectionDialog(configs, mode); >+ } >+ } >+ return false; >+ } >+ >+ /** >+ * Launches the first occurance of any one of the configurations in the provided list, if they are found in the launch history >+ * for the corresponding launch group >+ * @param configurations >+ * @param mode >+ * @return true if something launched, false otherwise >+ */ >+ protected boolean launchMRU(List configurations, String mode) { >+ ILaunchGroup group = resolveLaunchGroup(mode); >+ if(group != null) { >+ LaunchHistory history = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchHistory(group.getIdentifier()); >+ HashSet set = new HashSet(configurations); >+ ILaunchConfiguration[] configarray = history.getHistory(); >+ for(int i = 0; i < configarray.length; i++) { >+ if(set.contains(configarray[i])) { >+ DebugUITools.launch(configarray[i], mode); >+ return true; > } > } > } >- return launched; >+ return false; > } > > /** >- * Creates a listing of the launch shortcut extensions that are applicable to the underlying resource >- * @param resource the underlying resource >- * @return a listing of applicable launch shortcuts >- * @throws CoreException >+ * Presents the user with a dialog to pick the launch configuration to launch >+ * @param configurations the listing of applicable configurations to present >+ * @param mode the mode >+ * @return true if something was launched, false otherwise >+ */ >+ protected boolean showConfigurationSelectionDialog(List configurations, String mode) { >+ ListDialog lsd = new ListDialog(DebugUIPlugin.getShell()); >+ lsd.setContentProvider(new ArrayContentProvider()); >+ lsd.setLabelProvider(new DefaultLabelProvider()); >+ lsd.setMessage(ContextMessages.ContextRunner_8); >+ lsd.setTitle(ContextMessages.ContextRunner_9); >+ lsd.setInput(configurations); >+ if(lsd.open() == IDialogConstants.OK_ID) { >+ ILaunchConfiguration config = (ILaunchConfiguration) lsd.getResult()[0]; >+ DebugUITools.launch(config, mode); >+ return true; >+ } >+ return false; >+ } >+ >+ /** >+ * Presents a selection dialog to the user to pick a launch shortcut >+ * @param resource the resource context >+ * @param mode the mode >+ * @return true if something was launched, false otherwise > */ >- public List getLaunchShortcuts(IResource resource) throws CoreException { >- List list = new ArrayList(); >- List sc = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchShortcuts(); >- List ctxt = new ArrayList(); >- ctxt.add(resource); >- IEvaluationContext context = new EvaluationContext(null, ctxt); >- context.addVariable("selection", ctxt); //$NON-NLS-1$ >- LaunchShortcutExtension ext = null; >- for(Iterator iter = sc.iterator(); iter.hasNext();) { >- ext = (LaunchShortcutExtension) iter.next(); >- if(ext.evalEnablementExpression(context, ext.getContextualLaunchEnablementExpression())) { >- if(!list.contains(ext)) { >- list.add(ext); >+ protected boolean showShortcutSelectionDialog(IResource resource, String mode) { >+ LaunchShortcutSelectionDialog dialog = new LaunchShortcutSelectionDialog(resource, mode); >+ if (dialog.open() == Window.OK) { >+ Object[] result = dialog.getResult(); >+ if(result.length > 0) { >+ LaunchShortcutExtension method = (LaunchShortcutExtension) result[0]; >+ if(method != null) { >+ method.launch(new StructuredSelection(resource), mode); >+ return true; > } > } > } >- return list; >+ return false; > } > > /** >@@ -342,6 +258,7 @@ > * <li>IEditorInput</li> > * <li>Object where <i>object</i> is the first element in the selection obtained from the > * selection provider of the currently selected workbench part</li> >+ * <li><code>null</code>, if the current context is unknown</li> > * </ol> > * @return the currently selected context to consider for launching, or <code>null</code>. > * >@@ -373,10 +290,8 @@ > else if(sel instanceof ITextSelection) { > return part; > } >- return sel; > } > else { >- //default to returning the part, which can be further queried for adapters > return part; > } > } >@@ -395,28 +310,22 @@ > */ > public String getContextName() { > Object o = getCurrentContext(); >- ILaunchConfiguration config = isSharedConfig(o); >+ ILaunchConfiguration config = getLaunchConfigurationManager().isSharedConfig(o); > if(config != null) { > return config.getName(); > } > else { >- config = isSharedConfigEditorInput(o); >- if(config != null) { >- return config.getName(); >- } >- else { >- if(o instanceof IAdaptable) { >- IAdaptable adapt = (IAdaptable) o; >- Object a = adapt.getAdapter(ILaunchConfiguration.class); >+ if(o instanceof IAdaptable) { >+ IAdaptable adapt = (IAdaptable) o; >+ Object a = adapt.getAdapter(ILaunchConfiguration.class); >+ if(a != null) { >+ return ((ILaunchConfiguration) a).getName(); >+ } >+ else { >+ a = adapt.getAdapter(IResource.class); > if(a != null) { >- return ((ILaunchConfiguration) a).getName(); >- } >- else { >- a = adapt.getAdapter(IResource.class); >- if(a != null) { >- IResource res = (IResource) a; >- return (res.isAccessible() ? res.getName() : ""); //$NON-NLS-1$ >- } >+ IResource res = (IResource) a; >+ return (res.isAccessible() ? res.getName() : ""); //$NON-NLS-1$ > } > } > } >@@ -428,7 +337,7 @@ > * Returns if context launching is enabled > * @return if context launching is enabled > */ >- public static boolean isContextLaunchEnabled() { >+ public boolean isContextLaunchEnabled() { > return DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH); > } > >@@ -441,52 +350,10 @@ > } > > /** >- * @see org.eclipse.debug.core.ILaunchListener#launchAdded(org.eclipse.debug.core.ILaunch) >- */ >- public void launchAdded(ILaunch launch) { >- if(fBackingResource != null) { >- try { >- if(fMakeResourceDefault) { >- getLaunchManager().setDefaultConfiguration(fBackingResource, launch.getLaunchConfiguration()); >- } >- if(fMakeProjectDefault) { >- getLaunchManager().setDefaultConfiguration(fBackingResource.getProject(), launch.getLaunchConfiguration()); >- } >- getLaunchManager().removeLaunchListener(this); >- fMakeProjectDefault = false; >- fMakeResourceDefault = false; >- } >- catch(CoreException ce) {DebugUIPlugin.log(ce);} >- } >- } >- >- /** >- * Handles launching the default launch configuration for the specified resource, if there is no default >- * this method delegates to the <code>handleUnknownContext</code> method to figure out what to do >- * @param res the resource to find the default configuration for >- * @param mode the mode to launch it in >- * @return true if the method launched something false otherwise >- * @throws CoreException >+ * Returns the launch configuration manager >+ * @return the launch configuration manager > */ >- protected boolean launchDefault(IResource res, String mode) throws CoreException { >- ILaunchConfiguration config = getLaunchManager().getDefaultConfiguration(res); >- if(config != null && config.exists()) { >- DebugUITools.launch(config, mode); >- return true; >- } >- else { >- return false; >- } >+ protected LaunchConfigurationManager getLaunchConfigurationManager() { >+ return DebugUIPlugin.getDefault().getLaunchConfigurationManager(); > } >- >- /** >- * @see org.eclipse.debug.core.ILaunchListener#launchChanged(org.eclipse.debug.core.ILaunch) >- */ >- public void launchChanged(ILaunch launch) {} >- >- /** >- * @see org.eclipse.debug.core.ILaunchListener#launchRemoved(org.eclipse.debug.core.ILaunch) >- */ >- public void launchRemoved(ILaunch launch) {} >- > } >Index: ui/org/eclipse/debug/internal/ui/contextlaunching/RunContextLaunchingAction.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/contextlaunching/RunContextLaunchingAction.java >diff -N ui/org/eclipse/debug/internal/ui/contextlaunching/RunContextLaunchingAction.java >--- ui/org/eclipse/debug/internal/ui/contextlaunching/RunContextLaunchingAction.java 26 Jan 2007 14:39:51 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,36 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2007 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- *******************************************************************************/ >-package org.eclipse.debug.internal.ui.contextlaunching; >- >-import org.eclipse.debug.core.ILaunchManager; >- >-/** >- * Specialization of <code>ContextLaunchingAction</code> for run mode >- * >- * @see ContextLaunchingAction >- * @see ILaunchManager >- * @see DebugContextLaunchingAction >- * @see ProfileContextLaunchingAction >- * >- * @since 3.3 >- * EXPERIMENTAL >- * CONTEXTLAUNCHING >- */ >-public class RunContextLaunchingAction extends ContextLaunchingAction { >- >- /** >- * Constructor >- */ >- public RunContextLaunchingAction() { >- super(ILaunchManager.RUN_MODE); >- } >- >-} >Index: ui/org/eclipse/debug/internal/ui/contextlaunching/DebugContextLaunchingAction.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/contextlaunching/DebugContextLaunchingAction.java >diff -N ui/org/eclipse/debug/internal/ui/contextlaunching/DebugContextLaunchingAction.java >--- ui/org/eclipse/debug/internal/ui/contextlaunching/DebugContextLaunchingAction.java 26 Jan 2007 14:39:51 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,35 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2007 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- *******************************************************************************/ >-package org.eclipse.debug.internal.ui.contextlaunching; >- >-import org.eclipse.debug.core.ILaunchManager; >- >-/** >- * Specialization of <code>ContextLaunchingAction</code> for debug mode >- * >- * @see ContextLaunchingAction >- * @see ILaunchManager >- * @see RunContextLaunchingAction >- * @see ProfileContextLaunchingAction >- * >- * @since 3.3 >- * EXPERIMENTAL >- * CONTEXTLAUNCHING >- */ >-public class DebugContextLaunchingAction extends ContextLaunchingAction { >- >- /** >- * Constructor >- */ >- public DebugContextLaunchingAction() { >- super(ILaunchManager.DEBUG_MODE); >- } >-} >Index: ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties,v >retrieving revision 1.115 >diff -u -r1.115 ActionMessages.properties >--- ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties 20 Dec 2006 20:00:05 -0000 1.115 >+++ ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties 7 Feb 2007 19:39:26 -0000 >@@ -127,6 +127,7 @@ > ModifyWatchpointAction_0=Error > ModifyWatchpointAction_1=Failed to modify watchpoint > LaunchShortcutsAction_1=(none applicable) >+LaunchConfigurationAction_0=&{0} {1} > FindDialog_1=&Specify an element to select (? = any character, * = any String): > FindDialog_3=Find > FindAction_0=&Find... >@@ -165,3 +166,4 @@ > ConfigureColumnsAction_0=Select &Columns... > ConfigureColumnsAction_1=Select the &columns to display: > ConfigureColumnsAction_2=Select Columns >+ContextualLaunchAction_0={0} (default) >Index: ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java,v >retrieving revision 1.30 >diff -u -r1.30 ActionMessages.java >--- ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java 6 Jan 2007 16:35:12 -0000 1.30 >+++ ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java 7 Feb 2007 19:39:26 -0000 >@@ -38,6 +38,8 @@ > public static String ConfigureColumnsAction_0; > public static String ConfigureColumnsAction_1; > public static String ConfigureColumnsAction_2; >+ >+ public static String ContextualLaunchAction_0; > > public static String CopyToClipboardActionDelegate_Problem_Copying_to_Clipboard_1; > public static String CopyToClipboardActionDelegate_There_was_a_problem_when_accessing_the_system_clipboard__Retry__2; >@@ -56,6 +58,8 @@ > public static String EnableBreakpointAction_Enabling_breakpoints_3; > public static String EnableBreakpointAction_Exceptions_occurred_enabling_the_breakpoint_s___4; > >+ public static String LaunchConfigurationAction_0; >+ > public static String OpenBreakpointMarkerAction__Go_to_File_1; > public static String OpenBreakpointMarkerAction_Exceptions_occurred_attempting_to_open_the_editor_for_the_breakpoint_resource_2; > public static String OpenBreakpointMarkerAction_Go_to_Breakpoint_1; >Index: ui/org/eclipse/debug/internal/ui/actions/LaunchShortcutAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchShortcutAction.java,v >retrieving revision 1.11 >diff -u -r1.11 LaunchShortcutAction.java >--- ui/org/eclipse/debug/internal/ui/actions/LaunchShortcutAction.java 8 May 2006 20:07:19 -0000 1.11 >+++ ui/org/eclipse/debug/internal/ui/actions/LaunchShortcutAction.java 7 Feb 2007 19:39:26 -0000 >@@ -45,8 +45,6 @@ > updateEnablement(); > } > >- >- > /** > * Runs with either the active editor or workbench selection. > * >Index: ui/org/eclipse/debug/internal/ui/actions/LaunchablePropertyTester.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/LaunchablePropertyTester.java,v >retrieving revision 1.5 >diff -u -r1.5 LaunchablePropertyTester.java >--- ui/org/eclipse/debug/internal/ui/actions/LaunchablePropertyTester.java 29 Jan 2007 17:12:01 -0000 1.5 >+++ ui/org/eclipse/debug/internal/ui/actions/LaunchablePropertyTester.java 7 Feb 2007 19:39:26 -0000 >@@ -17,7 +17,7 @@ > import org.eclipse.core.runtime.Platform; > import org.eclipse.debug.internal.ui.DebugUIPlugin; > import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; >-import org.eclipse.debug.internal.ui.contextlaunching.ContextRunner; >+import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager; > import org.eclipse.debug.ui.actions.ILaunchable; > > /** >@@ -34,29 +34,30 @@ > return Platform.getAdapterManager().hasAdapter(receiver, ILaunchable.class.getName()); > } > } >- if("resource".equals(property)) { //$NON-NLS-1$ >- IResource res = getResource(receiver); >- if(res != null) { >- return res.isAccessible(); >- } >- } > if("contextlaunch".equals(property)) { //$NON-NLS-1$ >- return DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH); >- } >- if("contextlaunchable".equals(property)) { //$NON-NLS-1$ >- try { >- IResource res = getResource(receiver); >- if(res != null) { >- return ContextRunner.getDefault().getLaunchShortcuts(getResource(receiver)).size() > 0 && ContextRunner.getDefault().isSharedConfig(receiver) == null; >- } >- return false; >- } >- catch (CoreException e) {return false;} >+ if(DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH)) { >+ try { >+ IResource res = getResource(receiver); >+ if(res != null) { >+ return res.isAccessible() && getLaunchConfiguraitonManager().getLaunchShortcuts(getResource(receiver)).size() > 0 && getLaunchConfiguraitonManager().isSharedConfig(receiver) == null; >+ } >+ return false; >+ } >+ catch (CoreException e) {return false;} >+ } > } > return false; > } > > /** >+ * Returns the launch configuration manager >+ * @return the launch configuration manager >+ */ >+ protected LaunchConfigurationManager getLaunchConfiguraitonManager() { >+ return DebugUIPlugin.getDefault().getLaunchConfigurationManager(); >+ } >+ >+ /** > * Returns the resource this property page is open on. > * > * @return resource >Index: ui/org/eclipse/debug/internal/ui/actions/SharedLaunchConfigAction.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/actions/SharedLaunchConfigAction.java >diff -N ui/org/eclipse/debug/internal/ui/actions/SharedLaunchConfigAction.java >--- ui/org/eclipse/debug/internal/ui/actions/SharedLaunchConfigAction.java 22 Jun 2006 15:11:49 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,55 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2006 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- *******************************************************************************/ >-package org.eclipse.debug.internal.ui.actions; >- >-import org.eclipse.debug.core.ILaunchConfiguration; >-import org.eclipse.debug.ui.DebugUITools; >-import org.eclipse.jface.action.Action; >-import org.eclipse.jface.resource.ImageDescriptor; >- >-/** >- * This class provides an action warpper for adding shared launch configuration actions to the context menu >- * of the Run->... menu item >- * >- * @since 3.3 >- */ >-public class SharedLaunchConfigAction extends Action { >- >- private ILaunchConfiguration fConfig; >- private String fMode; >- >- /** >- * Consturtor >- * @param text the text for the action >- * @param image the image for the action >- */ >- public SharedLaunchConfigAction(ILaunchConfiguration config, String mode, ImageDescriptor image) { >- super(config.getName(), image); >- fConfig = config; >- fMode = mode; >- } >- >- /** >- * Allows access to the launch configuration associated with the action >- * @return the associated launch configuration >- */ >- public ILaunchConfiguration getLaunchConfiguration() { >- return fConfig; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.jface.action.Action#run() >- */ >- public void run() { >- DebugUITools.launch(fConfig, fMode); >- } >- >-} >Index: ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java,v >retrieving revision 1.1 >diff -u -r1.1 RunDebugPropertiesPage.java >--- ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java 25 Jan 2007 15:55:15 -0000 1.1 >+++ ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java 7 Feb 2007 19:39:26 -0000 >@@ -10,7 +10,6 @@ > *******************************************************************************/ > package org.eclipse.debug.internal.ui.preferences; > >-import java.util.ArrayList; > import java.util.Arrays; > import java.util.Collections; > import java.util.Comparator; >@@ -22,7 +21,6 @@ > import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IAdaptable; >-import org.eclipse.core.runtime.IPath; > import org.eclipse.debug.core.DebugPlugin; > import org.eclipse.debug.core.ILaunchConfiguration; > import org.eclipse.debug.core.ILaunchConfigurationType; >@@ -33,8 +31,8 @@ > import org.eclipse.debug.internal.ui.IDebugHelpContextIds; > import org.eclipse.debug.internal.ui.SWTUtil; > import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationComparator; >-import org.eclipse.debug.ui.DebugUITools; > import org.eclipse.debug.ui.IDebugUIConstants; >+import org.eclipse.jface.dialogs.IDialogConstants; > import org.eclipse.jface.viewers.ArrayContentProvider; > import org.eclipse.jface.viewers.CheckStateChangedEvent; > import org.eclipse.jface.viewers.CheckboxTableViewer; >@@ -84,6 +82,11 @@ > private Set fOriginalCandidates; > > /** >+ * Holds configurations that need to be saved when the page closes >+ */ >+ private Set fChangedConfigurations = new HashSet(); >+ >+ /** > * List of the applicable launch config types for the backing resource > */ > private List fTypeCandidates = null; >@@ -207,6 +210,21 @@ > } > > /** >+ * @see org.eclipse.jface.dialogs.DialogPage#dispose() >+ */ >+ public void dispose() { >+ if(fOriginalCandidates != null) { >+ fOriginalCandidates.clear(); >+ fOriginalCandidates = null; >+ } >+ if(fChangedConfigurations != null) { >+ fChangedConfigurations.clear(); >+ fChangedConfigurations = null; >+ } >+ super.dispose(); >+ } >+ >+ /** > * Returns the viewer displaying possible default configurations. > * > * @return viewer >@@ -253,72 +271,18 @@ > protected Set collectConfigCandidates(IResource resource) { > if(fOriginalCandidates == null) { > fOriginalCandidates = new HashSet(); >- IPath resourcePath = resource.getFullPath(); > try { >- List types = collectTypeCandidates(); >- List configs = new ArrayList(); >- ILaunchConfiguration[] configurations = getLaunchManager().getLaunchConfigurations(); >- for(int i = 0; i < configurations.length; i++) { >- if(types.contains(configurations[i].getType())) { >- if(configurations[i].isMigrationCandidate()) { >- configurations[i].migrate(); >- } >- configs.add(configurations[i]); >- } >- } >- ILaunchConfiguration configuration = null; >- IResource[] resources = null; >- for (Iterator iter = configs.iterator(); iter.hasNext();) { >- configuration = (ILaunchConfiguration) iter.next(); >- if(acceptConfiguration(configuration)) { >- if(configuration.contentsEqual(getLaunchManager().getDefaultConfiguration(resource))) { >- fOriginalCandidates.add(configuration.getWorkingCopy()); >- } >- else { >- resources = configuration.getMappedResources(); >- if (resources != null) { >- for (int j = 0; j < resources.length; j++) { >- if (resource.equals(resources[j]) || resourcePath.isPrefixOf(resources[j].getFullPath())) { >- fOriginalCandidates.add(configuration.getWorkingCopy()); >- break; >- } >- } >- } >- else { >- //in the event the config has no mapping >- fOriginalCandidates.add(configuration.getWorkingCopy()); >- } >- } >- } >+ List configs = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getApplicableLaunchConfigurations(resource); >+ for(Iterator iter = configs.iterator(); iter.hasNext();) { >+ fOriginalCandidates.add(((ILaunchConfiguration)iter.next()).getWorkingCopy()); > } >- } catch (CoreException e) { >- fOriginalCandidates.clear(); >- DebugPlugin.log(e); > } >+ catch(CoreException ce) {DebugUIPlugin.log(ce);} > } > return fOriginalCandidates; > } > >- /** >- * Returns if the specified configuration should be considered as a potential candidate >- * @param config >- * @return if the specified configuration should be considered as a potential candidate >- * @throws CoreException >- */ >- private boolean acceptConfiguration(ILaunchConfiguration config) throws CoreException { >- if(config != null && !DebugUITools.isPrivate(config)) { >- if(!"org.eclipse.ui.externaltools".equals(config.getType().getCategory())) { //$NON-NLS-1$ >- return true; >- } >- else { >- IResource[] res = config.getMappedResources(); >- if(res != null) { >- return true; >- } >- } >- } >- return false; >- } >+ > > /** > * Returns the resource this property page is open on. >@@ -365,15 +329,13 @@ > } > } > //add >- iter = fOriginalCandidates.iterator(); >+ iter = fChangedConfigurations.iterator(); > while (iter.hasNext()) { > ILaunchConfigurationWorkingCopy currentConfig = (ILaunchConfigurationWorkingCopy) iter.next(); >- if (currentConfig.isDirty()){ >- try{ >- currentConfig.doSave(); >- } catch (CoreException e) { >- DebugPlugin.logMessage("Problem saving changes to configuration " + currentConfig.getName(), e); //$NON-NLS-1$ >- } >+ try{ >+ currentConfig.doSave(); >+ } catch (CoreException e) { >+ DebugPlugin.logMessage("Problem saving changes to configuration " + currentConfig.getName(), e); //$NON-NLS-1$ > } > } > >@@ -397,12 +359,12 @@ > private Set getConfigurationNames() { > Set names = new HashSet(); > Iterator iter = fOriginalCandidates.iterator(); >- Object o = null; > while (iter.hasNext()) { >- o = iter.next(); >- if(o instanceof ILaunchConfiguration) { >- names.add(((ILaunchConfiguration)o).getName()); >- } >+ names.add(((ILaunchConfiguration)iter.next()).getName()); >+ } >+ iter = fChangedConfigurations.iterator(); >+ while (iter.hasNext()) { >+ names.add(((ILaunchConfiguration)iter.next()).getName()); > } > return names; > } >@@ -426,8 +388,8 @@ > ILaunchConfigurationWorkingCopy copy = configuration.copy( > ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).generateUniqueLaunchConfigurationNameFrom(configuration.getName(), getConfigurationNames())); > copy.setAttributes(configuration.getAttributes()); >- fOriginalCandidates.add(copy); >- fViewer.refresh(); >+ fChangedConfigurations.add(copy); >+ fViewer.add(copy); > fViewer.setSelection(new StructuredSelection(copy)); > } catch (CoreException e) { > setErrorMessage(e.getMessage()); >@@ -444,9 +406,9 @@ > ILaunchConfiguration[] configurations = getSelectedConfigurations(); > for (int i = 0; i < configurations.length; i++) { > fDeletedConfigurations.add(configurations[i]); >- fOriginalCandidates.remove(configurations[i]); >+ fChangedConfigurations.remove(configurations[i]); >+ fViewer.remove(configurations[i]); > } >- fViewer.refresh(); > if (indices[0] < table.getItemCount()) { > fViewer.setSelection(new StructuredSelection(table.getItem(indices[0]).getData())); > } else if (table.getItemCount() > 0) { >@@ -458,8 +420,11 @@ > * Edit the selection > */ > private void handleEdit() { >- edit(getSelectedConfigurations()[0]); >- fViewer.refresh(); >+ ILaunchConfigurationWorkingCopy config = getSelectedConfigurations()[0]; >+ if(edit(config) == IDialogConstants.OK_ID) { >+ fChangedConfigurations.add(config); >+ fViewer.refresh(); >+ } > } > > /** >@@ -493,8 +458,8 @@ > ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()). > generateUniqueLaunchConfigurationNameFrom("New_configuration", getConfigurationNames())); //$NON-NLS-1$ > if (edit(wc) == Window.OK) { >- fOriginalCandidates.add(wc); >- fViewer.refresh(); >+ fChangedConfigurations.add(wc); >+ fViewer.add(wc); > fViewer.setSelection(new StructuredSelection(wc)); > } > } catch (CoreException e) { >Index: ui/org/eclipse/debug/internal/ui/preferences/ContextLaunchingPreferencePage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ContextLaunchingPreferencePage.java,v >retrieving revision 1.1 >diff -u -r1.1 ContextLaunchingPreferencePage.java >--- ui/org/eclipse/debug/internal/ui/preferences/ContextLaunchingPreferencePage.java 25 Jan 2007 15:55:15 -0000 1.1 >+++ ui/org/eclipse/debug/internal/ui/preferences/ContextLaunchingPreferencePage.java 7 Feb 2007 19:39:26 -0000 >@@ -17,11 +17,9 @@ > import org.eclipse.debug.internal.ui.IDebugHelpContextIds; > import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; > import org.eclipse.debug.internal.ui.SWTUtil; >-import org.eclipse.jface.dialogs.MessageDialogWithToggle; > import org.eclipse.jface.preference.BooleanFieldEditor; > import org.eclipse.jface.preference.FieldEditor; > import org.eclipse.jface.preference.PreferencePage; >-import org.eclipse.jface.preference.RadioGroupFieldEditor; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Control; >@@ -69,17 +67,6 @@ > //use contextual launch > FieldEditor edit = new BooleanFieldEditor(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH, DebugPreferencesMessages.ContextualLaunchPreferencePage_1, comp); > fFieldEditors.add(edit); >- >- edit = new RadioGroupFieldEditor(IInternalDebugUIConstants.PREF_ALWAYS_RUN_LAST_LAUNCH, DebugPreferencesMessages.ContextLaunchingPreferencePage_0, 3, >- new String[][] {{DebugPreferencesMessages.LaunchingPreferencePage_3, MessageDialogWithToggle.ALWAYS}, >- {DebugPreferencesMessages.LaunchingPreferencePage_5, MessageDialogWithToggle.PROMPT}}, >- comp, true); >- fFieldEditors.add(edit); >- edit = new RadioGroupFieldEditor(IInternalDebugUIConstants.PREF_ALWAYS_RUN_PROJECT_CONFIGURATION, DebugPreferencesMessages.ContextLaunchingPreferencePage_1, 3, >- new String[][] {{DebugPreferencesMessages.LaunchingPreferencePage_7, MessageDialogWithToggle.ALWAYS}, >- {DebugPreferencesMessages.LaunchingPreferencePage_9, MessageDialogWithToggle.PROMPT}}, >- comp, true); >- fFieldEditors.add(edit); > //init the field editors > FieldEditor editor; > for(int i = 0; i < fFieldEditors.size(); i++) { >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java,v >retrieving revision 1.77 >diff -u -r1.77 LaunchConfigurationManager.java >--- ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java 25 Jan 2007 15:55:14 -0000 1.77 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java 7 Feb 2007 19:39:26 -0000 >@@ -34,7 +34,7 @@ > > import org.eclipse.core.expressions.EvaluationContext; > import org.eclipse.core.expressions.IEvaluationContext; >-import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.IFile; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.resources.ISaveContext; > import org.eclipse.core.resources.ISaveParticipant; >@@ -43,10 +43,7 @@ > import org.eclipse.core.runtime.IConfigurationElement; > import org.eclipse.core.runtime.IExtensionPoint; > import org.eclipse.core.runtime.IPath; >-import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Platform; >-import org.eclipse.core.runtime.Status; >-import org.eclipse.core.runtime.preferences.InstanceScope; > import org.eclipse.debug.core.DebugException; > import org.eclipse.debug.core.DebugPlugin; > import org.eclipse.debug.core.ILaunch; >@@ -63,6 +60,7 @@ > import org.eclipse.debug.internal.ui.DebugUIPlugin; > import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; > import org.eclipse.debug.internal.ui.ILaunchHistoryChangedListener; >+import org.eclipse.debug.ui.DebugUITools; > import org.eclipse.debug.ui.IDebugUIConstants; > import org.eclipse.debug.ui.ILaunchConfigurationTab; > import org.eclipse.debug.ui.ILaunchGroup; >@@ -70,11 +68,10 @@ > import org.eclipse.swt.SWT; > import org.eclipse.swt.graphics.Image; > import org.eclipse.swt.widgets.Display; >+import org.eclipse.ui.IFileEditorInput; > import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.activities.IWorkbenchActivitySupport; > import org.eclipse.ui.activities.WorkbenchActivityHelper; >-import org.osgi.service.prefs.BackingStoreException; >-import org.osgi.service.prefs.Preferences; > import org.w3c.dom.Document; > import org.w3c.dom.Element; > import org.w3c.dom.Node; >@@ -600,13 +597,58 @@ > } > > /** >+ * Returns the list of launch shortcuts that have been filtered to conform to current workbench activities >+ * @return a workbench activity filtered list of launch shortcuts, or an empty list, never <code>null</code> >+ * @since 3.3 >+ */ >+ public List getActivityFilteredLaunchShortcuts() { >+ List shortcuts = new ArrayList(); >+ List sc = getLaunchShortcuts(); >+ LaunchShortcutExtension ext = null; >+ for(Iterator iter = sc.iterator(); iter.hasNext();) { >+ ext = (LaunchShortcutExtension) iter.next(); >+ if(!WorkbenchActivityHelper.filterItem(ext)) { >+ if(!shortcuts.contains(ext)) { >+ shortcuts.add(ext); >+ } >+ } >+ } >+ return shortcuts; >+ } >+ >+ /** >+ * Creates a listing of the launch shortcut extensions that are applicable to the underlying resource >+ * @param resource the underlying resource >+ * @return a listing of applicable launch shortcuts or an empty list, never <code>null</code> >+ * @throws CoreException >+ * @since 3.3 >+ */ >+ public List getLaunchShortcuts(IResource resource) throws CoreException { >+ List list = new ArrayList(); >+ List sc = getLaunchShortcuts(); >+ List ctxt = new ArrayList(); >+ ctxt.add(resource); >+ IEvaluationContext context = new EvaluationContext(null, ctxt); >+ context.addVariable("selection", ctxt); //$NON-NLS-1$ >+ LaunchShortcutExtension ext = null; >+ for(Iterator iter = sc.iterator(); iter.hasNext();) { >+ ext = (LaunchShortcutExtension) iter.next(); >+ if(ext.evalEnablementExpression(context, ext.getContextualLaunchEnablementExpression()) && !WorkbenchActivityHelper.filterItem(ext)) { >+ if(!list.contains(ext)) { >+ list.add(ext); >+ } >+ } >+ } >+ return list; >+ } >+ >+ /** > * Returns a listing of all of the <code>ILaunchConfigurationType</code>s that apply to the currently > * specified <code>IResource</code>. > * > * @param resource the resource context > * @return a listing of applicable <code>ILaunchConfigurationType</code>s, or an empty list, never <code>null</code> > * @since 3.3 >- * EXPERIMENTAL > * CONTEXTLAUNCHING > */ > public List getApplicableConfigurationTypes(IResource resource) { >@@ -641,6 +683,81 @@ > } > > /** >+ * Returns a list of the <code>ILaunchConfiguration</code>s that apply to the specified <code>IResource</code> >+ * @param resource the resource >+ * @return a listing of applicable <code>ILaunchConfiguration</code>s for the specified <code>IResource</code> or an empty >+ * list if none, never <code>null</code> >+ * @since 3.3 >+ */ >+ public List getApplicableLaunchConfigurations(IResource resource) { >+ ArrayList list = new ArrayList(); >+ IPath resourcePath = resource.getFullPath(); >+ try { >+ List types = getApplicableConfigurationTypes(resource); >+ List configs = new ArrayList(); >+ ILaunchConfiguration[] configurations = getLaunchManager().getLaunchConfigurations(); >+ for(int i = 0; i < configurations.length; i++) { >+ if(types.contains(configurations[i].getType())) { >+ if(configurations[i].isMigrationCandidate()) { >+ configurations[i].migrate(); >+ } >+ configs.add(configurations[i]); >+ } >+ } >+ ILaunchConfiguration configuration = null; >+ IResource[] resources = null; >+ for (Iterator iter = configs.iterator(); iter.hasNext();) { >+ configuration = (ILaunchConfiguration) iter.next(); >+ if(acceptConfiguration(configuration)) { >+ if(configuration.contentsEqual(getLaunchManager().getDefaultConfiguration(resource))) { >+ list.add(configuration); >+ } >+ else { >+ resources = configuration.getMappedResources(); >+ if (resources != null) { >+ for (int j = 0; j < resources.length; j++) { >+ if (resource.equals(resources[j]) || resourcePath.isPrefixOf(resources[j].getFullPath())) { >+ list.add(configuration); >+ break; >+ } >+ } >+ } >+ else { >+ //in the event the config has no mapping >+ list.add(configuration); >+ } >+ } >+ } >+ } >+ } catch (CoreException e) { >+ list.clear(); >+ DebugPlugin.log(e); >+ } >+ return list; >+ } >+ >+ /** >+ * Returns if the specified configuration should be considered as a potential candidate >+ * @param config >+ * @return if the specified configuration should be considered as a potential candidate >+ * @throws CoreException >+ */ >+ private boolean acceptConfiguration(ILaunchConfiguration config) throws CoreException { >+ if(config != null && !DebugUITools.isPrivate(config)) { >+ if(!"org.eclipse.ui.externaltools".equals(config.getType().getCategory())) { //$NON-NLS-1$ >+ return true; >+ } >+ else { >+ IResource[] res = config.getMappedResources(); >+ if(res != null) { >+ return true; >+ } >+ } >+ } >+ return false; >+ } >+ >+ /** > * Returns a listing of all applicable <code>LaunchShortcutExtension</code>s for the given > * launch configuration type id. > * @param typeid the id of the launch configuration >@@ -738,9 +855,6 @@ > * or <code>null</code> > * > * @since 3.3 >- * >- * EXPERIMENTAL >- * CONTEXTLAUNCHING > */ > public LaunchShortcutExtension getLaunchShortcut(String id) { > loadLaunchShortcuts(); >@@ -755,6 +869,33 @@ > } > > /** >+ * Returns the shared config from the selected resource or <code>null</code> if the selected resources is not a shared config >+ * @param receiver the object to test if it is a shared launch configuration >+ * @return the shared config from the selected resource or <code>null</code> if the selected resources is not a shared config >+ * @since 3.3 >+ */ >+ public ILaunchConfiguration isSharedConfig(Object receiver) { >+ if(receiver instanceof IFile) { >+ IFile file = (IFile) receiver; >+ String ext = file.getFileExtension(); >+ if(ext == null) { >+ return null; >+ } >+ if(ext.equals("launch")) { //$NON-NLS-1$ >+ ILaunchConfiguration config = DebugPlugin.getDefault().getLaunchManager().getLaunchConfiguration(file); >+ if(config != null && config.exists()) { >+ return config; >+ } >+ } >+ } >+ else if(receiver instanceof IFileEditorInput) { >+ IFileEditorInput input = (IFileEditorInput) receiver; >+ return isSharedConfig(input.getFile()); >+ } >+ return null; >+ } >+ >+ /** > * Returns the image used to display an error in the given tab > */ > public Image getErrorTabImage(ILaunchConfigurationTab tab) { >@@ -815,6 +956,15 @@ > } > > /** >+ * Returns the singleton instance of the launch manager >+ * @return the singleton instance of the launch manager >+ * @since 3.3 >+ */ >+ private LaunchManager getLaunchManager() { >+ return (LaunchManager) DebugPlugin.getDefault().getLaunchManager(); >+ } >+ >+ /** > * Restore launch history > */ > private void loadLaunchHistories() { >@@ -835,76 +985,6 @@ > } > > /** >- * This method allows a default launch shortcut to be specified for the given resource. This sets >- * a default way of <i>how</i> something should be launched, not what specific <code>ILaunchConfiguration</code> >- * will do the launching. Passing in <code>null</code> for a shortcut will remove the attribute. >- * >- * @see {@link ILaunchManager#setDefaultConfiguration(IResource, ILaunchConfiguration)} >- * @param resource the resource to map the specified launch shortcut to >- * @param shortcut the shortcut to map >- * >- * @since 3.3 >- * >- * EXPERIMENTAL >- * CONTEXTLAUNCHING >- */ >- public void setDefaultLaunchShortcut(IResource resource, LaunchShortcutExtension shortcut) throws CoreException { >- IProject project = resource.getProject(); >- if (project == null) { >- throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), >- DebugPlugin.INTERNAL_ERROR, "Illegal argument: can only set default launch shortcut on and within projects.", null)); //$NON-NLS-1$ (internal error) >- } >- Preferences node = getInstanceNode(resource); >- if(shortcut != null) { >- node.put(IConfigurationElementConstants.DEFAULT_LAUNCH_SHORTCUT, shortcut.getId()); >- } >- else { >- node.remove(IConfigurationElementConstants.DEFAULT_LAUNCH_SHORTCUT); >- } >- try { >- node.flush(); >- } >- catch (BackingStoreException e) {DebugUIPlugin.log(e);} >- } >- >- /** >- * This method allows access to the default <code>LaunchShortcutExtension</code> for >- * the specified <code>IResource</code>. >- * >- * @see {@link ILaunchManager#getDefaultConfiguration(IResource)} >- * @param resource the resource >- * @return the corresponding <code>LaunchShortcutExtension</code> for the given <code>IResource</code>, >- * or <code>null</code> if there is not one. >- * >- * @since 3.3 >- * >- * EXPERIMENTAL >- * CONTEXTLAUNCHING >- */ >- public LaunchShortcutExtension getDefaultLaunchShortcut(IResource resource) { >- IProject project = resource.getProject(); >- if (project != null) { >- Preferences node = getInstanceNode(resource); >- String id = node.get(IConfigurationElementConstants.DEFAULT_LAUNCH_SHORTCUT, null); >- if(id != null) { >- return getLaunchShortcut(id); >- } >- } >- return null; >- } >- >- /** >- * Returns the node for instance project preferences >- * @param resource the resource to get the node for >- * @return the instance node for debug UI >- */ >- private org.osgi.service.prefs.Preferences getInstanceNode(IResource resource) { >- org.osgi.service.prefs.Preferences node = Platform.getPreferencesService().getRootNode(); >- node = node.node(InstanceScope.SCOPE).node(DebugUIPlugin.getUniqueIdentifier()); >- return node.node(resource.getFullPath().makeRelative().toString()); >- } >- >- /** > * Returns the default launch group for the given mode. > * > * @param mode >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutSelectionDialog.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutSelectionDialog.java,v >retrieving revision 1.1 >diff -u -r1.1 LaunchShortcutSelectionDialog.java >--- ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutSelectionDialog.java 25 Jan 2007 15:55:14 -0000 1.1 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutSelectionDialog.java 7 Feb 2007 19:39:26 -0000 >@@ -20,17 +20,12 @@ > import org.eclipse.debug.internal.ui.DebugUIPlugin; > import org.eclipse.debug.internal.ui.DefaultLabelProvider; > import org.eclipse.debug.internal.ui.IDebugHelpContextIds; >-import org.eclipse.debug.internal.ui.SWTUtil; >-import org.eclipse.debug.internal.ui.contextlaunching.ContextRunner; > import org.eclipse.debug.ui.IDebugUIConstants; > import org.eclipse.jface.dialogs.IDialogSettings; > import org.eclipse.jface.viewers.ArrayContentProvider; > import org.eclipse.jface.viewers.ISelectionChangedListener; > import org.eclipse.jface.viewers.SelectionChangedEvent; > import org.eclipse.swt.SWT; >-import org.eclipse.swt.events.SelectionEvent; >-import org.eclipse.swt.events.SelectionListener; >-import org.eclipse.swt.widgets.Button; > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Control; > import org.eclipse.ui.PlatformUI; >@@ -57,10 +52,6 @@ > */ > private String fMode = null; > private IResource fResource = null; >- private boolean fChecked = false; >- private boolean fProject = false; >- private boolean fShowProject = false; >- private boolean fShowResource = false; > > /** > * Constructor >@@ -68,13 +59,11 @@ > * @param resource > * @param mode > */ >- public LaunchShortcutSelectionDialog(IResource resource, String mode, boolean showresource, boolean showproject) { >+ public LaunchShortcutSelectionDialog(IResource resource, String mode) { > super(DebugUIPlugin.getShell()); > setShellStyle(getShellStyle() | SWT.RESIZE); > fResource = resource; > fMode = mode; >- fShowProject = showproject; >- fShowResource = showresource; > ILaunchMode lmode = DebugPlugin.getDefault().getLaunchManager().getLaunchMode(fMode); > String modename = fMode; > if (lmode != null) { >@@ -127,47 +116,10 @@ > protected Control createDialogArea(Composite container) { > Composite comp = (Composite) super.createDialogArea(container); > try { >- List input = new ArrayList(ContextRunner.getDefault().getLaunchShortcuts(fResource)); >- Button butt = null; >- if(!input.isEmpty()) { >- if(fShowResource) { >- butt = SWTUtil.createCheckButton(comp, MessageFormat.format(LaunchConfigurationsMessages.LaunchShortcutSelectionDialog_2, new String[] {fResource.getName()}), null, fChecked); >- butt.addSelectionListener(new SelectionListener() { >- public void widgetDefaultSelected(SelectionEvent e) {} >- public void widgetSelected(SelectionEvent e) { >- fChecked = ((Button)e.getSource()).getSelection(); >- } >- }); >- } >- if(fShowProject) { >- butt = SWTUtil.createCheckButton(comp, MessageFormat.format(LaunchConfigurationsMessages.LaunchShortcutSelectionDialog_3, new String[] {fResource.getProject().getName()}), null, false); >- butt.addSelectionListener(new SelectionListener() { >- public void widgetDefaultSelected(SelectionEvent e) {} >- public void widgetSelected(SelectionEvent e) { >- fProject = ((Button)e.getSource()).getSelection(); >- } >- }); >- } >- } >+ List input = new ArrayList(DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchShortcuts(fResource)); > getTableViewer().setInput(input); > } > catch(CoreException ce) {DebugUIPlugin.log(ce);} > return comp; > } >- >- /** >- * Returns if the launched config from the selected shortcut should be made the default for the underlying resource >- * @return if the launched config should be made the default >- */ >- public boolean makeDefault() { >- return fChecked; >- } >- >- /** >- * Returns if the launched config from the selected shortcut should be made the default for the underlying resources' associated project >- * @return if the launched config from the selected shortcut should be made the default for the underlying resources' associated project >- */ >- public boolean makeProjectDefault() { >- return fProject; >- } > } >Index: ui/org/eclipse/debug/ui/actions/ContextualLaunchAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ContextualLaunchAction.java,v >retrieving revision 1.21 >diff -u -r1.21 ContextualLaunchAction.java >--- ui/org/eclipse/debug/ui/actions/ContextualLaunchAction.java 25 Jan 2007 15:55:14 -0000 1.21 >+++ ui/org/eclipse/debug/ui/actions/ContextualLaunchAction.java 7 Feb 2007 19:39:27 -0000 >@@ -20,15 +20,16 @@ > import org.eclipse.core.expressions.EvaluationContext; > import org.eclipse.core.expressions.Expression; > import org.eclipse.core.expressions.IEvaluationContext; >-import org.eclipse.core.resources.IFile; >+import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IAdaptable; > import org.eclipse.debug.core.DebugPlugin; > import org.eclipse.debug.core.ILaunchConfiguration; > import org.eclipse.debug.core.ILaunchManager; > import org.eclipse.debug.internal.ui.DebugUIPlugin; >+import org.eclipse.debug.internal.ui.actions.ActionMessages; >+import org.eclipse.debug.internal.ui.actions.LaunchConfigurationAction; > import org.eclipse.debug.internal.ui.actions.LaunchShortcutAction; >-import org.eclipse.debug.internal.ui.actions.SharedLaunchConfigAction; >-import org.eclipse.debug.internal.ui.contextlaunching.ContextRunner; > import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager; > import org.eclipse.debug.internal.ui.launchConfigurations.LaunchShortcutExtension; > import org.eclipse.debug.ui.DebugUITools; >@@ -44,12 +45,13 @@ > import org.eclipse.swt.widgets.Control; > import org.eclipse.swt.widgets.Menu; > import org.eclipse.swt.widgets.MenuItem; >-import org.eclipse.ui.IFileEditorInput; > import org.eclipse.ui.IObjectActionDelegate; > import org.eclipse.ui.IWorkbenchPart; > import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.activities.WorkbenchActivityHelper; > >+import com.ibm.icu.text.MessageFormat; >+ > /** > * An action delegate that builds a context menu with applicable launch shortcuts > * for a specific launch mode. >@@ -130,12 +132,15 @@ > menu.addMenuListener(new MenuAdapter() { > public void menuShown(MenuEvent e) { > if (fFillMenu) { >- Menu m = (Menu)e.widget; >- MenuItem[] items = m.getItems(); >- for (int i=0; i < items.length; i++) { >- items[i].dispose(); >+ try { >+ Menu m = (Menu)e.widget; >+ MenuItem[] items = m.getItems(); >+ for (int i=0; i < items.length; i++) { >+ items[i].dispose(); >+ } >+ fillMenu(m); > } >- fillMenu(m); >+ catch(CoreException ce) {} > fFillMenu = false; > } > } >@@ -179,46 +184,45 @@ > } > > /** >- * Prepares a SharedLaunchConfigAction and adds it to the current menu >- * @param file the file to get the launch configuration from >- * @param image the image for the action >- * @param menu the menu to add the new action to. >- * @since 3.3 >+ * Returns the resource this menu is open on. >+ * >+ * @return resource > */ >- private void prepareSharedConfigAction(IFile file, Menu menu) { >- ILaunchConfiguration config = getLaunchManager().getLaunchConfiguration(file); >- try { >- if(config != null && config.exists() && config.supportsMode(fMode)) { >- IAction action = new SharedLaunchConfigAction(config, fMode, DebugUITools.getDefaultImageDescriptor(config)); >- ActionContributionItem item= new ActionContributionItem(action); >- item.fill(menu, -1); >- } >- } catch (CoreException e) { >- } >+ protected IResource getResource(Object element) { >+ IResource resource = null; >+ if (element instanceof IResource) { >+ resource = (IResource) element; >+ } else if (element instanceof IAdaptable) { >+ resource = (IResource) ((IAdaptable)element).getAdapter(IResource.class); >+ } >+ return resource; > } > > /** > * Fills the menu with applicable launch shortcuts > * @param menu The menu to fill > */ >- protected void fillMenu(Menu menu) { >+ protected void fillMenu(Menu menu) throws CoreException { > if (fSelection == null) { > return; > } > IEvaluationContext context = createContext(); >- //add in any selected shared configs before the rest of the items to launch as >- //feature fix for > //CONTEXTLAUNCHING >- if(!fSelection.isEmpty()) { >- Object obj = fSelection.getFirstElement(); >- if(ContextRunner.getDefault().isSharedConfig(obj) != null) { >- prepareSharedConfigAction((IFile)obj, menu); >- new MenuItem(menu, SWT.SEPARATOR); >- } >- else if(ContextRunner.getDefault().isSharedConfigEditorInput(obj) != null) { >- prepareSharedConfigAction(((IFileEditorInput) obj).getFile(), menu); >- new MenuItem(menu, SWT.SEPARATOR); >- } >+ Object obj = fSelection.getFirstElement(); >+ int accelerator = 1; >+ ILaunchConfiguration config = getLaunchManager().getDefaultConfiguration(getResource(obj)); >+ if(config != null && config.exists() && config.supportsMode(fMode)) { >+ IAction action = new LaunchConfigurationAction(config, fMode, MessageFormat.format(ActionMessages.ContextualLaunchAction_0, new String[] {config.getName()}), DebugUITools.getDefaultImageDescriptor(config), accelerator++); >+ ActionContributionItem item = new ActionContributionItem(action); >+ item.fill(menu, -1); >+ new MenuItem(menu, SWT.SEPARATOR); >+ } >+ config = getLaunchConfigurationManager().isSharedConfig(obj); >+ if(config != null && config.exists() && config.supportsMode(fMode)) { >+ IAction action = new LaunchConfigurationAction(config, fMode, config.getName(), DebugUITools.getDefaultImageDescriptor(config), accelerator++); >+ ActionContributionItem item = new ActionContributionItem(action); >+ item.fill(menu, -1); >+ new MenuItem(menu, SWT.SEPARATOR); > } > List allShortCuts = getLaunchConfigurationManager().getLaunchShortcuts(); > Iterator iter = allShortCuts.iterator(); >@@ -233,7 +237,7 @@ > catch (CoreException e) {DebugUIPlugin.log(e);} > } > iter = filteredShortCuts.iterator(); >- int accelerator = 1; >+ > List categories = new ArrayList(); > while (iter.hasNext()) { > LaunchShortcutExtension ext = (LaunchShortcutExtension) iter.next(); >Index: ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java,v >retrieving revision 1.31 >diff -u -r1.31 AbstractLaunchHistoryAction.java >--- ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java 5 Feb 2007 17:50:35 -0000 1.31 >+++ ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java 7 Feb 2007 19:39:27 -0000 >@@ -186,7 +186,7 @@ > String launchName= configuration.getName(); > String label = null; > //CONTEXTLAUNCHING >- if(ContextRunner.isContextLaunchEnabled() && !getLaunchGroupIdentifier().equals("org.eclipse.ui.externaltools.launchGroup")) { //$NON-NLS-1$ >+ if(ContextRunner.getDefault().isContextLaunchEnabled() && !getLaunchGroupIdentifier().equals("org.eclipse.ui.externaltools.launchGroup")) { //$NON-NLS-1$ > launchName = ContextRunner.getDefault().getContextName(); > } > String mode = getMode(); >@@ -342,7 +342,7 @@ > if (fAction == null) { > initialize(action); > } >- if(ContextRunner.isContextLaunchEnabled()) { >+ if(ContextRunner.getDefault().isContextLaunchEnabled()) { > updateTooltip(); > } > } >Index: ui/org/eclipse/debug/ui/actions/OpenLaunchDialogAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/OpenLaunchDialogAction.java,v >retrieving revision 1.14 >diff -u -r1.14 OpenLaunchDialogAction.java >--- ui/org/eclipse/debug/ui/actions/OpenLaunchDialogAction.java 25 Jan 2007 15:55:14 -0000 1.14 >+++ ui/org/eclipse/debug/ui/actions/OpenLaunchDialogAction.java 7 Feb 2007 19:39:27 -0000 >@@ -18,13 +18,11 @@ > import org.eclipse.debug.internal.ui.IDebugHelpContextIds; > import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; > import org.eclipse.debug.internal.ui.contextlaunching.ContextMessages; >-import org.eclipse.debug.internal.ui.contextlaunching.ContextRunner; > import org.eclipse.debug.internal.ui.launchConfigurations.LaunchGroupExtension; > import org.eclipse.debug.internal.ui.launchConfigurations.LaunchHistory; > import org.eclipse.debug.ui.DebugUITools; > import org.eclipse.jface.action.Action; > import org.eclipse.jface.action.IAction; >-import org.eclipse.jface.util.IPropertyChangeListener; > import org.eclipse.jface.util.PropertyChangeEvent; > import org.eclipse.jface.viewers.ISelection; > import org.eclipse.jface.viewers.IStructuredSelection; >@@ -46,7 +44,7 @@ > * </p> > * @since 2.1 > */ >-public class OpenLaunchDialogAction extends Action implements IPropertyChangeListener, IActionDelegate2, IWorkbenchWindowActionDelegate { >+public class OpenLaunchDialogAction extends Action implements IActionDelegate2, IWorkbenchWindowActionDelegate { > > /** > * Launch group identifier >@@ -102,16 +100,13 @@ > /** > * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose() > */ >- public void dispose() { >- DebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this); >- } >+ public void dispose() {} > > /* (non-Javadoc) > * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction) > */ > public void init(IAction action) { > fBackingAction = action; >- DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this); > PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.OPEN_LAUNCH_CONFIGURATION_ACTION); > updateActionState(); > } >@@ -125,16 +120,15 @@ > LaunchGroupExtension extension = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(fIdentifier); > if(fBackingAction == null) { > //there is no backing action, like a toolbar action delegate >- if(ContextRunner.isContextLaunchEnabled() && !"org.eclipse.ui.externaltools.launchGroup".equals(fIdentifier)) { //$NON-NLS-1$ >- setText(MessageFormat.format(ContextMessages.OpenLaunchDialogAction_0, new String[] {extension.getLabel()})); >- setImageDescriptor(null); >- } >- else { >- setText(extension.getLabel() + "..."); //$NON-NLS-1$ >- setImageDescriptor(extension.getImageDescriptor()); >- } >+ setText(MessageFormat.format(ContextMessages.OpenLaunchDialogAction_0, new String[] {extension.getLabel()})); >+ setImageDescriptor(extension.getImageDescriptor()); > setEnabled(existsConfigTypesForMode()); > } >+ else { >+ fBackingAction.setText(MessageFormat.format(ContextMessages.OpenLaunchDialogAction_1, new String[] {DebugUIPlugin.removeAccelerators(extension.getLabel())})); >+ fBackingAction.setImageDescriptor(extension.getImageDescriptor()); >+ fBackingAction.setEnabled(existsConfigTypesForMode()); >+ } > } > > /** >Index: ui/org/eclipse/debug/ui/actions/LaunchShortcutsAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchShortcutsAction.java,v >retrieving revision 1.15 >diff -u -r1.15 LaunchShortcutsAction.java >--- ui/org/eclipse/debug/ui/actions/LaunchShortcutsAction.java 22 Jan 2007 16:27:07 -0000 1.15 >+++ ui/org/eclipse/debug/ui/actions/LaunchShortcutsAction.java 7 Feb 2007 19:39:27 -0000 >@@ -20,15 +20,21 @@ > import org.eclipse.core.expressions.EvaluationContext; > import org.eclipse.core.expressions.Expression; > import org.eclipse.core.expressions.IEvaluationContext; >+import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IAdaptable; > import org.eclipse.debug.core.DebugPlugin; >+import org.eclipse.debug.core.ILaunchConfiguration; > import org.eclipse.debug.core.ILaunchConfigurationType; > import org.eclipse.debug.core.ILaunchMode; > import org.eclipse.debug.internal.ui.DebugUIPlugin; > import org.eclipse.debug.internal.ui.actions.ActionMessages; >+import org.eclipse.debug.internal.ui.actions.LaunchConfigurationAction; > import org.eclipse.debug.internal.ui.actions.LaunchShortcutAction; >+import org.eclipse.debug.internal.ui.contextlaunching.ContextRunner; > import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager; > import org.eclipse.debug.internal.ui.launchConfigurations.LaunchShortcutExtension; >+import org.eclipse.debug.ui.DebugUITools; > import org.eclipse.debug.ui.ILaunchGroup; > import org.eclipse.jface.action.Action; > import org.eclipse.jface.action.ActionContributionItem; >@@ -37,6 +43,7 @@ > import org.eclipse.jface.viewers.ISelection; > import org.eclipse.jface.viewers.ISelectionProvider; > import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.swt.SWT; > import org.eclipse.swt.events.MenuAdapter; > import org.eclipse.swt.events.MenuEvent; > import org.eclipse.swt.widgets.Control; >@@ -51,6 +58,8 @@ > import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.activities.WorkbenchActivityHelper; > >+import com.ibm.icu.text.MessageFormat; >+ > /** > * A cascading sub-menu that shows all launch shortcuts pertinent to a > * selection. This action is similar to <code>ContextualLaunchAction</code> >@@ -168,14 +177,45 @@ > } > > /** >+ * Returns the resource this menu is open on. >+ * >+ * @return resource >+ */ >+ protected IResource getResource(Object element) { >+ IResource resource = null; >+ if (element instanceof IResource) { >+ resource = (IResource) element; >+ } else if (element instanceof IAdaptable) { >+ resource = (IResource) ((IAdaptable)element).getAdapter(IResource.class); >+ } >+ return resource; >+ } >+ >+ /** > * Fills the flyout menu > */ > private void fillMenu() { >+ try { >+ Object selection = ContextRunner.getDefault().getCurrentContext(); >+ int accelerator = 1; >+ ILaunchConfiguration config = DebugPlugin.getDefault().getLaunchManager().getDefaultConfiguration(getResource(selection)); >+ if(config != null && config.exists() && config.supportsMode(getMode())) { >+ IAction action = new LaunchConfigurationAction(config, getMode(), MessageFormat.format(ActionMessages.ContextualLaunchAction_0, new String[] {config.getName()}), DebugUITools.getDefaultImageDescriptor(config), accelerator++); >+ ActionContributionItem item = new ActionContributionItem(action); >+ item.fill(fCreatedMenu, -1); >+ new MenuItem(fCreatedMenu, SWT.SEPARATOR); >+ } >+ config = getLaunchConfigurationManager().isSharedConfig(selection); >+ if(config != null && config.exists() && config.supportsMode(getMode())) { >+ IAction action = new LaunchConfigurationAction(config, getMode(), config.getName(), DebugUITools.getDefaultImageDescriptor(config), accelerator++); >+ ActionContributionItem item = new ActionContributionItem(action); >+ item.fill(fCreatedMenu, -1); >+ new MenuItem(fCreatedMenu, SWT.SEPARATOR); >+ } >+ } >+ catch(CoreException ce) {DebugUIPlugin.log(ce);} > IEvaluationContext context = createContext(); >- // gather all shortcuts and run their filters so that we only run the >- // filters one time for each shortcut. Running filters can be expensive. >- // Also, only *LOADED* plug-ins get their filters run. >- List /* <LaunchShortcutExtension> */ allShortCuts = getLaunchConfigurationManager().getLaunchShortcuts(fGroup.getCategory()); >+ List allShortCuts = getLaunchConfigurationManager().getLaunchShortcuts(fGroup.getCategory()); > Iterator iter = allShortCuts.iterator(); > List filteredShortCuts = new ArrayList(10); > while (iter.hasNext()) { >Index: ui/org/eclipse/debug/ui/actions/AbstractLaunchToolbarAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchToolbarAction.java,v >retrieving revision 1.15 >diff -u -r1.15 AbstractLaunchToolbarAction.java >--- ui/org/eclipse/debug/ui/actions/AbstractLaunchToolbarAction.java 25 Jan 2007 17:01:00 -0000 1.15 >+++ ui/org/eclipse/debug/ui/actions/AbstractLaunchToolbarAction.java 7 Feb 2007 19:39:27 -0000 >@@ -13,7 +13,6 @@ > > import org.eclipse.debug.core.ILaunchConfiguration; > import org.eclipse.debug.internal.ui.DebugUIPlugin; >-import org.eclipse.debug.internal.ui.contextlaunching.ContextLaunchingToolbarAction; > import org.eclipse.debug.internal.ui.contextlaunching.ContextRunner; > import org.eclipse.debug.internal.ui.launchConfigurations.OrganizeFavoritesAction; > import org.eclipse.debug.ui.DebugUITools; >@@ -51,20 +50,11 @@ > */ > protected void fillMenu(Menu menu) { > super.fillMenu(menu); >- > // Separator between history and common actions > if (menu.getItemCount() > 0) { > addSeparator(menu); > } >- //CONTEXTLAUNCHING >- if(!getLaunchGroupIdentifier().equals("org.eclipse.ui.externaltools.launchGroup")) { //$NON-NLS-1$ >- if(ContextRunner.isContextLaunchEnabled()) { >- addToMenu(menu, new ContextLaunchingToolbarAction(getLaunchGroupIdentifier()), -1); >- } >- else { >- addToMenu(menu, new LaunchShortcutsAction(getLaunchGroupIdentifier()), -1); >- } >- } >+ addToMenu(menu, new LaunchShortcutsAction(getLaunchGroupIdentifier()), -1); > addToMenu(menu, getOpenDialogAction(), -1); > addToMenu(menu, new OrganizeFavoritesAction(getLaunchGroupIdentifier()), -1); > } >@@ -83,8 +73,7 @@ > * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) > */ > public void run(IAction action) { >- //CONTEXTLAUNCHING >- if(ContextRunner.isContextLaunchEnabled() && !getLaunchGroupIdentifier().equals("org.eclipse.ui.externaltools.launchGroup")) { //$NON-NLS-1$ >+ if(ContextRunner.getDefault().isContextLaunchEnabled()) { > ContextRunner.getDefault().launch(getMode()); > } > else { >Index: ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java,v >retrieving revision 1.40 >diff -u -r1.40 DebugUIPreferenceInitializer.java >--- ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java 25 Jan 2007 15:55:14 -0000 1.40 >+++ ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java 7 Feb 2007 19:39:26 -0000 >@@ -51,8 +51,6 @@ > > //contextual launching preference page > prefs.setDefault(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH, false); >- prefs.setDefault(IInternalDebugUIConstants.PREF_ALWAYS_RUN_LAST_LAUNCH, MessageDialogWithToggle.PROMPT); >- prefs.setDefault(IInternalDebugUIConstants.PREF_ALWAYS_RUN_PROJECT_CONFIGURATION, MessageDialogWithToggle.PROMPT); > > //View Management preference page > prefs.setDefault(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES, IDebugUIConstants.ID_DEBUG_PERSPECTIVE); >Index: ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java,v >retrieving revision 1.93 >diff -u -r1.93 IInternalDebugUIConstants.java >--- ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java 25 Jan 2007 15:55:14 -0000 1.93 >+++ ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java 7 Feb 2007 19:39:26 -0000 >@@ -211,24 +211,6 @@ > public static final String PREF_USE_CONTEXTUAL_LAUNCH= IDebugUIConstants.PLUGIN_ID + ".UseContextualLaunch"; //$NON-NLS-1$ > > /** >- * always/never/prompt preference indicating the action for the event when there is no context to launch during context launching >- * >- * @since 3.3 >- * >- * CONTEXTLAUNCHING >- */ >- public static final String PREF_ALWAYS_RUN_LAST_LAUNCH = IDebugUIConstants.PLUGIN_ID + ".AlwaysRunLastLaunch"; //$NON-NLS-1$ >- >- /** >- * always/never/prompt preference indicating the action to take when an un-runnable file is the context >- * >- * @since 3.3 >- * >- * CONTEXTLAUNCHING >- */ >- public static final String PREF_ALWAYS_RUN_PROJECT_CONFIGURATION = IDebugUIConstants.PLUGIN_ID + ".ALwaysRunProjectConfiguration"; //$NON-NLS-1$ >- >- /** > * String preference controlling whether editors are saved before launching. > * Valid values are either "always", "never", or "prompt". > * If "always" or "never", launching will save editors (or not) automatically. >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/plugin.xml,v >retrieving revision 1.390 >diff -u -r1.390 plugin.xml >--- plugin.xml 25 Jan 2007 15:55:14 -0000 1.390 >+++ plugin.xml 7 Feb 2007 19:39:26 -0000 >@@ -883,12 +883,7 @@ > id="org.eclipse.debug.ui.contextualLaunch.profile.submenu"> > </action> > <enablement> >- <and> >- <test property="org.eclipse.debug.ui.launchable" value="profile"/> >- <not> >- <test property="org.eclipse.debug.ui.contextlaunch" /> >- </not> >- </and> >+ <test property="org.eclipse.debug.ui.launchable" value="profile"/> > </enablement> > </objectContribution> > <objectContribution >@@ -903,12 +898,7 @@ > id="org.eclipse.debug.ui.contextualLaunch.debug.submenu"> > </action> > <enablement> >- <and> >- <test property="org.eclipse.debug.ui.launchable" value="debug"/> >- <not> >- <test property="org.eclipse.debug.ui.contextlaunch" /> >- </not> >- </and> >+ <test property="org.eclipse.debug.ui.launchable" value="debug"/> > </enablement> > </objectContribution> > <objectContribution >@@ -923,83 +913,10 @@ > id="org.eclipse.debug.ui.contextualLaunch.run.submenu"> > </action> > <enablement> >- <and> > <test property="org.eclipse.debug.ui.launchable" value="run"/> >- <not> >- <test property="org.eclipse.debug.ui.contextlaunch" /> >- </not> >- </and> > </enablement> > </objectContribution> >- <objectContribution >- id="org.eclipse.debug.ui.contextlaunch.debugas" >- objectClass="org.eclipse.core.runtime.IAdaptable"> >- <action >- class="org.eclipse.debug.internal.ui.contextlaunching.DebugContextLaunchingAction" >- enablesFor="1" >- icon="icons/full/etool16/debug_exc.gif" >- id="org.eclipse.debug.ui.contextlaunch.debugas" >- label="%ContextLaunchingDebugMenu.name" >- menubarPath="additions" >- tooltip="%ContextLaunchingDebugMenu.tooltip"> >- </action> >- <enablement> >- <and> >- <test >- property="org.eclipse.debug.ui.resource" >- /> >- <test >- property="org.eclipse.debug.ui.contextlaunch" >- /> >- <test property="org.eclipse.debug.ui.launchable" value="debug"/> >- </and> >- </enablement> >- </objectContribution> >- <objectContribution >- id="org.eclipse.debug.ui.contextlaunch.profileas" >- objectClass="org.eclipse.core.runtime.IAdaptable"> >- <action >- class="org.eclipse.debug.internal.ui.contextlaunching.ProfileContextLaunchingAction" >- enablesFor="1" >- icon="icons/full/etool16/profile_exc.gif" >- id="org.eclipse.debug.ui.contextlaunch.profileas" >- label="%ContextLaunchingProfileMenu.name" >- menubarPath="additions" >- tooltip="%ContextLaunchingProfileMenu.tooltip"> >- </action> >- <enablement> >- <and> >- <test >- property="org.eclipse.debug.ui.resource" >- /> >- <test property="org.eclipse.debug.ui.contextlaunch" /> >- <test property="org.eclipse.debug.ui.launchable" value="profile"/> >- </and> >- </enablement> >- </objectContribution> > <!-- console additions --> >- <objectContribution >- id="org.eclipse.debug.ui.contextlaunch.runas" >- objectClass="org.eclipse.core.runtime.IAdaptable"> >- <action >- class="org.eclipse.debug.internal.ui.contextlaunching.RunContextLaunchingAction" >- enablesFor="1" >- icon="icons/full/etool16/run_exc.gif" >- id="org.eclipse.debug.ui.contextlaunch.runas" >- label="%ContextLaunchingRunMenu.name" >- menubarPath="additions" >- tooltip="%ContextLaunchingRunMenu.tooltip"> >- </action> >- <enablement> >- <and> >- <test property="org.eclipse.debug.ui.contextlaunch" /> >- <test >- property="org.eclipse.debug.ui.resource" >- /> >- <test property="org.eclipse.debug.ui.launchable" value="run"/> >- </and> >- </enablement> >- </objectContribution> > <viewerContribution > targetID="org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu" > id="org.eclipse.debug.ui.processConsoleContextMenu"> >@@ -1499,13 +1416,6 @@ > <test > property="org.eclipse.debug.ui.contextlaunch" > /> >- <test >- property="org.eclipse.debug.ui.contextlaunchable" >- > >- </test> >- <test >- property="org.eclipse.debug.ui.resource"> >- </test> > </and> > </enabledWhen> > </page> >@@ -2147,7 +2057,7 @@ > </propertyTester> > <propertyTester > namespace="org.eclipse.debug.ui" >- properties="launchable, resource, contextlaunch, contextlaunchable" >+ properties="launchable, contextlaunch" > type="java.lang.Object" > class="org.eclipse.debug.internal.ui.actions.LaunchablePropertyTester" > id="org.eclipse.debug.ui.propertyTesters.launchable"> >Index: ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneManager.java,v >retrieving revision 1.4 >diff -u -r1.4 DetailPaneManager.java >--- ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneManager.java 6 Feb 2007 15:50:24 -0000 1.4 >+++ ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneManager.java 7 Feb 2007 19:39:26 -0000 >@@ -195,7 +195,7 @@ > * @return an evaluatable expression or <code>null</code> > */ > private Expression getEnablementExpression(){ >- // all of this stuff is optional, so...tedius testing is required >+ // all of this stuff is optional, so...tedious testing is required > if (fEnablementExpression == null) { > try{ > IConfigurationElement[] elements = fConfigElement.getChildren(ExpressionTagNames.ENABLEMENT); >Index: ui/org/eclipse/debug/internal/ui/actions/LaunchConfigurationAction.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/actions/LaunchConfigurationAction.java >diff -N ui/org/eclipse/debug/internal/ui/actions/LaunchConfigurationAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/actions/LaunchConfigurationAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,57 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.debug.internal.ui.actions; >+ >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.debug.ui.DebugUITools; >+import org.eclipse.jface.action.Action; >+import org.eclipse.jface.resource.ImageDescriptor; >+ >+import com.ibm.icu.text.MessageFormat; >+ >+/** >+ * This class provides an action wrapper for adding launch configuration actions to the context menu >+ * of the Run->... menu item >+ * >+ * @since 3.3 >+ */ >+public class LaunchConfigurationAction extends Action { >+ >+ private ILaunchConfiguration fConfig; >+ private String fMode; >+ >+ /** >+ * Constructor >+ * @param text the text for the action >+ * @param image the image for the action >+ */ >+ public LaunchConfigurationAction(ILaunchConfiguration config, String mode, String text, ImageDescriptor image, int accelerator) { >+ super(MessageFormat.format(ActionMessages.LaunchConfigurationAction_0, new String[] {Integer.toString(accelerator), text}), image); >+ fConfig = config; >+ fMode = mode; >+ } >+ >+ /** >+ * Allows access to the launch configuration associated with the action >+ * @return the associated launch configuration >+ */ >+ public ILaunchConfiguration getLaunchConfiguration() { >+ return fConfig; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.action.Action#run() >+ */ >+ public void run() { >+ DebugUITools.launch(fConfig, fMode); >+ } >+ >+} >#P org.eclipse.jdt.debug.tests >Index: tests/org/eclipse/jdt/debug/tests/launching/LaunchShortcutTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LaunchShortcutTests.java,v >retrieving revision 1.2 >diff -u -r1.2 LaunchShortcutTests.java >--- tests/org/eclipse/jdt/debug/tests/launching/LaunchShortcutTests.java 3 Jan 2007 22:37:42 -0000 1.2 >+++ tests/org/eclipse/jdt/debug/tests/launching/LaunchShortcutTests.java 7 Feb 2007 19:39:29 -0000 >@@ -10,11 +10,8 @@ > *******************************************************************************/ > package org.eclipse.jdt.debug.tests.launching; > >-import org.eclipse.core.resources.IProject; >-import org.eclipse.core.runtime.CoreException; > import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager; > import org.eclipse.debug.internal.ui.launchConfigurations.LaunchShortcutExtension; >-import org.eclipse.jdt.core.IJavaProject; > import org.eclipse.jdt.debug.tests.AbstractDebugTest; > > /** >@@ -99,30 +96,4 @@ > assertNotNull("launch configuration manager cannot be null", lcm); > assertTrue("there should be 2 or more shortcuts", lcm.getApplicableLaunchShortcuts("org.eclipse.jdt.launching.localJavaApplication").size() >= 2); > } >- >- /** >- * test that a default launch shortcut can be set, persisted and retrieved >- */ >- public void testSetDefaultLaunchShortcut() { >- LaunchConfigurationManager lcm = getLaunchConfigurationManager(); >- assertNotNull("the launch configuration manager should not be null", lcm); >- LaunchShortcutExtension ext = getJavaApplicationLaunchShortcut(); >- assertNotNull("the java launch shortcut should not be null", ext); >- IJavaProject jproject = getJavaProject(); >- assertNotNull("the java project should not be null", jproject); >- IProject project = jproject.getProject(); >- assertNotNull("the project should not be null", project); >- try { >- assertNull("there should be no default launch shortcut for the test project", lcm.getDefaultLaunchShortcut(project)); >- lcm.setDefaultLaunchShortcut(project, ext); >- ext = lcm.getDefaultLaunchShortcut(project); >- assertNotNull("the default launch shortcut should be the java app shortcut", ext); >- lcm.setDefaultLaunchShortcut(project, null); >- ext = lcm.getDefaultLaunchShortcut(project); >- assertNull("there should be no default launch shortcut for the test project", ext); >- } >- catch (CoreException e) { >- fail(); >- } >- } > } >Index: tests/org/eclipse/jdt/debug/tests/performance/PerfContextualLaunchMenu.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/performance/PerfContextualLaunchMenu.java,v >retrieving revision 1.6 >diff -u -r1.6 PerfContextualLaunchMenu.java >--- tests/org/eclipse/jdt/debug/tests/performance/PerfContextualLaunchMenu.java 9 Jan 2007 04:51:00 -0000 1.6 >+++ tests/org/eclipse/jdt/debug/tests/performance/PerfContextualLaunchMenu.java 7 Feb 2007 19:39:29 -0000 >@@ -10,6 +10,7 @@ > *******************************************************************************/ > package org.eclipse.jdt.debug.tests.performance; > >+import org.eclipse.core.runtime.CoreException; > import org.eclipse.debug.core.ILaunchManager; > import org.eclipse.debug.internal.ui.DebugUIPlugin; > import org.eclipse.debug.ui.actions.ContextualLaunchAction; >@@ -90,7 +91,10 @@ > } > > void showMenu(Menu menu) { >- fillMenu(menu); >+ try { >+ fillMenu(menu); >+ } >+ catch(CoreException ce) {} > } > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 74480
:
53335
|
54442
|
54503
|
55420
|
56341
|
56426
|
56666
|
56675
|
56736
|
56804
|
56849
|
56854
|
57047
|
57181
|
57350
|
58480
|
58788
|
58895