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 56854 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]
Work in progress 6
74480WorkInProgress6.txt (text/plain), 128.22 KB, created by
Curtis Windatt
on 2007-01-12 17:49:00 EST
(
hide
)
Description:
Work in progress 6
Filename:
MIME Type:
Creator:
Curtis Windatt
Created:
2007-01-12 17:49:00 EST
Size:
128.22 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.debug.tests >Index: tests/org/eclipse/jdt/debug/tests/launching/LaunchConfigurationTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LaunchConfigurationTests.java,v >retrieving revision 1.4 >diff -u -r1.4 LaunchConfigurationTests.java >--- tests/org/eclipse/jdt/debug/tests/launching/LaunchConfigurationTests.java 3 Jan 2007 22:37:42 -0000 1.4 >+++ tests/org/eclipse/jdt/debug/tests/launching/LaunchConfigurationTests.java 12 Jan 2007 22:29:16 -0000 >@@ -738,7 +738,7 @@ > > // get a working copy > wc = handle.getWorkingCopy(); >- ILaunchConfigurationWorkingCopy nested = wc.getNestedWorkingCopy(); >+ ILaunchConfigurationWorkingCopy nested = wc.getWorkingCopy(); > > // verify nested is same as original > assertEquals("String1 should be String1", nested.getAttribute("String1", "Missing"), "String1"); >#P org.eclipse.jdt.debug.ui >#P org.eclipse.debug.core >Index: core/org/eclipse/debug/core/ILaunchConfiguration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfiguration.java,v >retrieving revision 1.50 >diff -u -r1.50 ILaunchConfiguration.java >--- core/org/eclipse/debug/core/ILaunchConfiguration.java 8 Dec 2006 20:09:32 -0000 1.50 >+++ core/org/eclipse/debug/core/ILaunchConfiguration.java 12 Jan 2007 22:29:19 -0000 >@@ -374,17 +374,22 @@ > > /** > * Returns a working copy of this launch configuration. >+ * If the this method is called on a working copy, a nested working >+ * copy is created (a working copy of a working copy). > * Changes to the working copy will be applied to this >- * launch configuration when saved. The working copy will >- * refer to this launch configuration as its original >- * launch configuration. >+ * launch configuration when saved, or to the parent working copy. >+ * The working copy will refer to this launch configuration as its original >+ * launch configuration, or the working copy it was created from. > * <p> > * When a working copy (B) is created from a working copy (A), the newly > * created working copy (B) is initialized with the attributes from > * the first working copy (A). Whenever a working copy is saved, it is written >- * back to the original non-working copy configuration. >+ * back to the working copy from which it was created: in this example working >+ * copy B will write back to working copy A, and A will write back to the >+ * original launch configuration. > * </p> >- * @return a working copy of this launch configuration >+ * @return a working copy of this launch configuration, or a nested working copy if called >+ * on an instance of <code>ILaunchConfigurationWorkingCopy</code> > * @exception CoreException if this method fails. Reasons include: > * <ul> > * <li>An exception occurs while initializing the contents of the >@@ -396,7 +401,7 @@ > > /** > * Returns whether this launch configuration is stored >- * locally with the workspace. This is a handle-only method. >+ * locally within the workspace. This is a handle-only method. > * > * @return whether this launch configuration is stored > * locally with the workspace >Index: core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java,v >retrieving revision 1.23 >diff -u -r1.23 ILaunchConfigurationWorkingCopy.java >--- core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java 3 Jan 2007 17:52:52 -0000 1.23 >+++ core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java 12 Jan 2007 22:29:19 -0000 >@@ -111,10 +111,10 @@ > > /** > * Returns the original launch configuration this working copy >- * was created from, or <code>null</code> if this is a new >+ * was created from or <code>null</code> if this is a new > * working copy created from a launch configuration type. > * >- * @return the original launch configuration, or <code>null</code> >+ * @return the original launch configuration, working copy, or <code>null</code> > */ > public ILaunchConfiguration getOriginal(); > >@@ -254,31 +254,6 @@ > public void removeModes(Set modes); > > /** >- * Returns a working copy of this working copy. Changes to the working copy will >- * be applied to this working copy when saved. The working copy will >- * refer to this launch configuration as its parent. Changes are only >- * saved to the underlying original configuration when the root working >- * copy is saved. >- * >- * @return a working copy of this working copy >- * @exception CoreException if this method fails. Reasons include: >- * <ul> >- * <li>An exception occurs while initializing the contents of the >- * working copy from this configuration's underlying storage.</li> >- * </ul> >- * @see ILaunchConfigurationWorkingCopy#getOriginal() >- * @see ILaunchConfigurationWorkingCopy#getParent() >- * @since 3.3 >- * <p> >- * <strong>EXPERIMENTAL</strong>. This method has been added as >- * part of a work in progress. There is no guarantee that this API will >- * remain unchanged during the 3.3 release cycle. Please do not use this API >- * without consulting with the Platform/Debug team. >- * </p> >- */ >- public ILaunchConfigurationWorkingCopy getNestedWorkingCopy() throws CoreException; >- >- /** > * Returns the parent of this working copy or <code>null</code> if this working > * copy is not a nested copy of another working copy. > * >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.183 >diff -u -r1.183 LaunchManager.java >--- core/org/eclipse/debug/internal/core/LaunchManager.java 4 Jan 2007 17:55:06 -0000 1.183 >+++ core/org/eclipse/debug/internal/core/LaunchManager.java 12 Jan 2007 22:29:21 -0000 >@@ -2437,7 +2437,7 @@ > } > return null; > } >- >+ > /* (non-Javadoc) > * @see org.eclipse.debug.core.ILaunchManager#setDefaultConfiguration(org.eclipse.core.resources.IResource, org.eclipse.debug.core.ILaunchConfiguration) > */ >@@ -2454,32 +2454,30 @@ > } > } > >- // remove previous settings, if any >+ // get preference nodes > org.osgi.service.prefs.Preferences projectNode = getProjectNode(resource); >- projectNode.remove(DEFAULT_CONFIGURATION); >- flush(projectNode); > org.osgi.service.prefs.Preferences instanceNode = getInstanceNode(resource); >- instanceNode.remove(DEFAULT_CONFIGURATION); >- flush(instanceNode); >- > if (configuration != null) { >- org.osgi.service.prefs.Preferences node = null; >- String configurationValue = null; > if (configuration.isLocal()) { > // for local configurations, use workspace (instance) scope preferences >- node = instanceNode; > if (!configuration.isWorkingCopy()) { >- configurationValue = configuration.getMemento(); >+ instanceNode.put(DEFAULT_CONFIGURATION, configuration.getMemento()); >+ projectNode.remove(DEFAULT_CONFIGURATION); > } >+ > } else { > // for shared configurations, use project scope preferences >- node = projectNode; >- configurationValue = configuration.getFile().getProjectRelativePath().toPortableString(); >+ projectNode.put(DEFAULT_CONFIGURATION, configuration.getFile().getProjectRelativePath().toPortableString()); >+ instanceNode.remove(DEFAULT_CONFIGURATION); > } >- node.put(DEFAULT_CONFIGURATION, configurationValue); >- flush(node); > } >- >+ else { >+ //remove nodes because the default has been un-set >+ projectNode.remove(DEFAULT_CONFIGURATION); >+ instanceNode.remove(DEFAULT_CONFIGURATION); >+ } >+ flush(projectNode); >+ flush(instanceNode); > } > > /** >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.66 >diff -u -r1.66 LaunchConfigurationWorkingCopy.java >--- core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java 3 Jan 2007 17:52:52 -0000 1.66 >+++ core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java 12 Jan 2007 22:29:19 -0000 >@@ -55,6 +55,12 @@ > private LaunchConfiguration fOriginal; > > /** >+ * Handle to a parent working copy >+ * @since 3.3 >+ */ >+ private LaunchConfigurationWorkingCopy fParent = null; >+ >+ /** > * Working copy of attributes. > */ > private LaunchConfigurationInfo fInfo; >@@ -87,12 +93,6 @@ > private IContainer fContainer; > > /** >- * Parent working copy. >- * @since 3.3 >- */ >- private LaunchConfigurationWorkingCopy fParent = null; >- >- /** > * Constructs a working copy of the specified launch > * configuration. > * >@@ -173,42 +173,39 @@ > * @see ILaunchConfigurationWorkingCopy#doSave() > */ > public synchronized ILaunchConfiguration doSave() throws CoreException { >- if (fParent == null) { >- if (isDirty()) { >- boolean useRunnable= true; >- if (isLocal()) { >- if (isMoved()) { >- // If this config was moved from a shared location, saving >- // it will delete the original from the workspace. Use runnable. >- useRunnable= !isNew() && !getOriginal().isLocal(); >- } else { >- useRunnable= false; >- } >- } >- >- if (useRunnable) { >- IWorkspaceRunnable wr = new IWorkspaceRunnable() { >- public void run(IProgressMonitor pm) throws CoreException { >- doSave0(); >- } >- }; >- >- ResourcesPlugin.getWorkspace().run(wr, null, 0, null); >+ if (getParent() != null) { >+ // save to parent working copy >+ LaunchConfigurationWorkingCopy wc = (LaunchConfigurationWorkingCopy) getParent(); >+ wc.setName(getName()); >+ wc.copyFrom(this); >+ return wc; >+ } >+ else { >+ boolean useRunnable= true; >+ if (isLocal()) { >+ if (isMoved()) { >+ // If this config was moved from a shared location, saving >+ // it will delete the original from the workspace. Use runnable. >+ useRunnable= !isNew() && !getOriginal().isLocal(); > } else { >- //file is persisted in the metadata not the workspace >- doSave0(); >+ useRunnable= false; > } >- >- getLaunchManager().setMovedFromTo(null, null); > } >- >- return new LaunchConfiguration(getLocation()); >- } else { >- // save to parent working copy >- fParent.setName(getName()); >- fParent.copyFrom(this); >- return fParent; >+ if (useRunnable) { >+ IWorkspaceRunnable wr = new IWorkspaceRunnable() { >+ public void run(IProgressMonitor pm) throws CoreException { >+ doSave0(); >+ } >+ }; >+ >+ ResourcesPlugin.getWorkspace().run(wr, null, 0, null); >+ } else { >+ //file is persisted in the metadata not the workspace >+ doSave0(); >+ } >+ getLaunchManager().setMovedFromTo(null, null); > } >+ return new LaunchConfiguration(getLocation()); > } > > >@@ -364,7 +361,20 @@ > * @see ILaunchConfigurationWorkingCopy#getOriginal() > */ > public ILaunchConfiguration getOriginal() { >- return fOriginal; >+ ILaunchConfiguration config = fOriginal; >+ ILaunchConfigurationWorkingCopy parent = fParent; >+ while(parent != null) { >+ config = parent.getOriginal(); >+ parent = parent.getParent(); >+ } >+ return config; >+ } >+ >+ /** >+ * @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#getParent() >+ */ >+ public ILaunchConfigurationWorkingCopy getParent() { >+ return fParent; > } > > /** >@@ -670,25 +680,7 @@ > * @see org.eclipse.debug.internal.core.LaunchConfiguration#getWorkingCopy() > */ > public ILaunchConfigurationWorkingCopy getWorkingCopy() throws CoreException { >- if (fParent == null) { >- return super.getWorkingCopy(); >- } else { >- return getNestedWorkingCopy(); >- } >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#getNestedWorkingCopy() >- */ >- public ILaunchConfigurationWorkingCopy getNestedWorkingCopy() throws CoreException { > return new LaunchConfigurationWorkingCopy(this); > } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#getParent() >- */ >- public ILaunchConfigurationWorkingCopy getParent() { >- return fParent; >- } > } > >#P org.eclipse.debug.ui >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/plugin.xml,v >retrieving revision 1.387 >diff -u -r1.387 plugin.xml >--- plugin.xml 9 Jan 2007 18:18:11 -0000 1.387 >+++ plugin.xml 12 Jan 2007 22:29:24 -0000 >@@ -155,6 +155,15 @@ > id="org.eclipse.debug.ui.launchDelegatesKeywords"> > </keywordReference> > </page> >+ <page >+ category="org.eclipse.debug.ui.DebugPreferencePage" >+ class="org.eclipse.debug.internal.ui.preferences.ContextLaunchingPreferencePage" >+ id="org.eclipse.debug.ui.contextualLaunchingPage" >+ name="%ContextualLaunchingPrefPage.name"> >+ <keywordReference >+ id="org.eclipse.debug.ui.contextLaunching"> >+ </keywordReference> >+ </page> > </extension> > <extension point="org.eclipse.ui.actionSets"> > <actionSet >@@ -382,12 +391,12 @@ > menubarPath="org.eclipse.ui.run/runGroup"> > </action> > <action >- label="%RunWithConfigurationAction.label" >- style="pulldown" >- helpContextId="run_with_configuration_action_context" > class="org.eclipse.debug.internal.ui.actions.RunAsAction" >+ helpContextId="run_with_configuration_action_context" >+ id="org.eclipse.debug.internal.ui.actions.RunWithConfigurationAction" >+ label="%RunWithConfigurationAction.label" > menubarPath="org.eclipse.ui.run/runGroup" >- id="org.eclipse.debug.internal.ui.actions.RunWithConfigurationAction"> >+ style="pulldown"> > </action> > <action > label="%RunHistoryMenuAction.label" >@@ -874,7 +883,12 @@ > id="org.eclipse.debug.ui.contextualLaunch.profile.submenu"> > </action> > <enablement> >- <test property="org.eclipse.debug.ui.launchable" value="profile"/> >+ <and> >+ <test property="org.eclipse.debug.ui.launchable" value="profile"/> >+ <not> >+ <test property="org.eclipse.debug.ui.contextlaunch" /> >+ </not> >+ </and> > </enablement> > </objectContribution> > <objectContribution >@@ -889,7 +903,12 @@ > id="org.eclipse.debug.ui.contextualLaunch.debug.submenu"> > </action> > <enablement> >- <test property="org.eclipse.debug.ui.launchable" value="debug"/> >+ <and> >+ <test property="org.eclipse.debug.ui.launchable" value="debug"/> >+ <not> >+ <test property="org.eclipse.debug.ui.contextlaunch" /> >+ </not> >+ </and> > </enablement> > </objectContribution> > <objectContribution >@@ -904,10 +923,75 @@ > id="org.eclipse.debug.ui.contextualLaunch.run.submenu"> > </action> > <enablement> >- <test property="org.eclipse.debug.ui.launchable" value="run"/> >+ <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"> >@@ -1394,6 +1478,23 @@ > </or> > </enabledWhen> > </page> >+ <page >+ class="org.eclipse.debug.internal.ui.preferences.DefaultLaunchConfigurationsPropertiesPage" >+ id="org.eclipse.debug.ui.properties.defaultLaunchConfigurations" >+ name="%DefaultLaunchConfigurationsPropPage.name" >+ > >+ <enabledWhen> >+ <and> >+ <adapt >+ type="org.eclipse.core.resources.IResource"> >+ </adapt> >+ <test property="org.eclipse.debug.ui.contextlaunch" /> >+ <test >+ property="org.eclipse.debug.ui.resource"> >+ </test> >+ </and> >+ </enabledWhen> >+ </page> > </extension> > <!-- commands and their bindings > NOTE: >@@ -2032,7 +2133,7 @@ > </propertyTester> > <propertyTester > namespace="org.eclipse.debug.ui" >- properties="launchable" >+ properties="launchable, resource" > type="java.lang.Object" > class="org.eclipse.debug.internal.ui.actions.LaunchablePropertyTester" > id="org.eclipse.debug.ui.propertyTesters.launchable"> >@@ -2050,6 +2151,13 @@ > properties="getModelIdentifier,isTerminatedOrDisconnected" > type="org.eclipse.core.runtime.IAdaptable"> > </propertyTester> >+ <propertyTester >+ class="org.eclipse.debug.internal.ui.preferences.ContextLaunchingPropertyTester" >+ id="org.eclipse.debug.ui.contextlaunching.IAdaptableTester" >+ namespace="org.eclipse.debug.ui" >+ properties="contextlaunch" >+ type="org.eclipse.core.runtime.IAdaptable"> >+ </propertyTester> > </extension> > <!-- Context extensions --> > <extension >@@ -2235,6 +2343,10 @@ > id="org.eclipse.debug.ui.launchDelegatesKeywords" > label="%preferenceKeywords.launchDelegates"> > </keyword> >+ <keyword >+ id="org.eclipse.debug.ui.contextLaunching" >+ label="%preferenceKeywords.contextLaunching"> >+ </keyword> > </extension> > <extension > point="org.eclipse.ui.importWizards"> >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/plugin.properties,v >retrieving revision 1.224 >diff -u -r1.224 plugin.properties >--- plugin.properties 9 Jan 2007 18:18:11 -0000 1.224 >+++ plugin.properties 12 Jan 2007 22:29:22 -0000 >@@ -27,6 +27,19 @@ > BreakpointOrganizersName=Breakpoint Organizers > VariableValueEditorsName=Variable Value Editors > >+ContextLaunchingRunMenu.name=&Run >+ContextLaunchingRunMenu.tooltip=Run the selected item >+ >+ContextLaunchingDebugMenu.name=&Debug >+ContextLaunchingDebugMenu.tooltip=Debug the selected item >+ >+ContextLaunchingProfileMenu.name=&Profile >+ContextLaunchingProfileMenu.tooltip=Profile the selected item >+ >+ContextualLaunchingPrefPage.name=Contextual Launching >+ >+DefaultLaunchConfigurationsPropPage.name=Default Launch Configurations >+ > BreakpointActionSet.label=Breakpoints > CollapseAll.label=Collapse All > CollapseAll.tooltip= Collapse All >@@ -328,6 +341,7 @@ > preferenceKeywords.viewManagement=views > preferenceKeywords.perspective=perspectives switching assign automatic run debug > preferenceKeywords.launchConfigurations=filters launch migration configurations run debug >+preferenceKeywords.contextLaunching=run debug profile launch contextual delegate configuration execute > preferenceKeywords.launchDelegates=launch delegate duplicate run debug profile mode configuration launchers launcher modes > > exportBreakpoints.label=E&xport Breakpoints... >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.38 >diff -u -r1.38 DebugUIPreferenceInitializer.java >--- ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java 18 Dec 2006 18:43:27 -0000 1.38 >+++ ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java 12 Jan 2007 22:29:24 -0000 >@@ -26,9 +26,7 @@ > super(); > } > >- /* >- * (non-Javadoc) >- * >+ /** > * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() > */ > public void initializeDefaultPreferences() { >@@ -51,6 +49,9 @@ > prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_ALL_BREAKPOINTS, true); > prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_BREAKPOINTS_FROM_CONTAINER, true); > >+ //contextual launching preference page >+ prefs.setDefault(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH, false); >+ > //View Management preference page > prefs.setDefault(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES, IDebugUIConstants.ID_DEBUG_PERSPECTIVE); > prefs.setDefault(IInternalDebugUIConstants.PREF_TRACK_VIEWS, true); >@@ -111,10 +112,12 @@ > prefs.setDefault(IDebugUIConstants.PREF_DEFAULT_EBCDIC_CODE_PAGE, > IDebugPreferenceConstants.DEFAULT_EBCDIC_CP); > >- if (MemoryViewUtil.isLinuxGTK()) >+ if (MemoryViewUtil.isLinuxGTK()) { > prefs.setDefault(IDebugPreferenceConstants.PREF_DYNAMIC_LOAD_MEM, false); >- else >+ } >+ else { > prefs.setDefault(IDebugPreferenceConstants.PREF_DYNAMIC_LOAD_MEM, true); >+ } > > prefs.setDefault(IDebugPreferenceConstants.PREF_TABLE_RENDERING_PAGE_SIZE, IDebugPreferenceConstants.DEFAULT_PAGE_SIZE); > prefs.setDefault(IDebugPreferenceConstants.PREF_RESET_MEMORY_BLOCK, IDebugPreferenceConstants.RESET_VISIBLE); >Index: ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java,v >retrieving revision 1.62 >diff -u -r1.62 IDebugHelpContextIds.java >--- ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java 7 Dec 2006 18:33:34 -0000 1.62 >+++ ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java 12 Jan 2007 22:29:24 -0000 >@@ -86,6 +86,7 @@ > public static final String LAUNCH_CONFIGURATION_PREFERENCE_PAGE = PREFIX + "launch_configuration_preference_page_context"; //$NON-NLS-1$ > public static final String VIEW_MANAGEMENT_PREFERENCE_PAGE = PREFIX + "view_management_preference_page_context"; //$NON-NLS-1$ > public static final String LAUNCH_DELEGATES_PREFERENCE_PAGE = PREFIX + "launch_delegate_preference_page_context"; //$NON-NLS-1$ >+ public static final String CONTEXTUAL_LAUNCHING_PREFERENCE_PAGE = PREFIX + "contextual_launch_preference_page"; //$NON-NLS-1$ > > // Dialogs > public static final String LAUNCH_CONFIGURATION_DIALOG = PREFIX + "launch_configuration_dialog"; //$NON-NLS-1$ >@@ -111,10 +112,12 @@ > public static final String DELETE_ASSOCIATED_LAUNCH_CONFIGS_DIALOG = PREFIX + "delete_associated_launch_configs_dialog"; //$NON-NLS-1$ > public static final String SELECT_LAUNCH_MODES_DIALOG = PREFIX + "select_launch_modes_dialog"; //$NON-NLS-1$ > public static final String SELECT_LAUNCHERS_DIALOG = PREFIX + "select_launchers_dialog"; //$NON-NLS-1$ >+ public static final String SELECT_LAUNCH_METHOD_DIALOG = PREFIX + "select_launch_method_dialog"; //$NON-NLS-1$ > > // Property pages > public static final String PROCESS_PROPERTY_PAGE = PREFIX + "process_property_page_context"; //$NON-NLS-1$ > public static final String PROCESS_PAGE_RUN_AT = PREFIX + "process_page_run_at_time_widget"; //$NON-NLS-1$ >+ public static final String DEFAULT_LAUNCHCONFIGURATION_PROPERTY_PAGE = PREFIX + "default_launchconfiguration_property_page"; //$NON-NLS-1$ > > // Launch configuration dialog pages > public static final String LAUNCH_CONFIGURATION_DIALOG_COMMON_TAB = PREFIX + "launch_configuration_dialog_common_tab"; //$NON-NLS-1$ >@@ -131,9 +134,5 @@ > > //Editor > public static final String NO_SOURCE_EDITOR = PREFIX + "debugger_editor_no_source_common";//$NON-NLS-1$ >- >- >- >- > } > >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.92 >diff -u -r1.92 IInternalDebugUIConstants.java >--- ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java 18 Dec 2006 18:43:27 -0000 1.92 >+++ ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java 12 Jan 2007 22:29:25 -0000 >@@ -131,7 +131,7 @@ > public static final String IMG_ADD_SRC_DIR_WIZ = "IMG_ADD_SRC_DIRECTORY"; //$NON-NLS-1$ > public static final String IMG_EDIT_SRC_DIR_WIZ = "IMG_EDIT_SRC_DIRECTORY"; //$NON-NLS-1$ > >- // internal preferenes >+ // internal preferences > /** > * XML for perspective settings - see PerspectiveManager. > * @since 3.0 >@@ -145,14 +145,14 @@ > public static final String EMPTY_STRING = ""; //$NON-NLS-1$ > > /** >- * Preference for enabling/disabling launch configuration filtering based on project accessibilty status >+ * Preference for enabling/disabling launch configuration filtering based on project accessibility status > * > * @since 3.2 > */ > public static final String PREF_FILTER_LAUNCH_CLOSED = IDebugUIConstants.PLUGIN_ID + ".PREF_FILTER_LAUNCH_CLOSED"; //$NON-NLS-1$ > > /** >- * Preference for enabling/disabling launch configuraiton filtering based on project context >+ * Preference for enabling/disabling launch configuration filtering based on project context > * > * @since 3.2 > */ >@@ -202,6 +202,14 @@ > public static final String DETAIL_PANE_FONT= "org.eclipse.debug.ui.DetailPaneFont"; //$NON-NLS-1$ > > /** >+ * Boolean preference indicating if contextual launch options should be visible >+ * to the user rather than the "run as" menu. >+ * >+ * @since 3.3 >+ */ >+ public static final String PREF_USE_CONTEXTUAL_LAUNCH= IDebugUIConstants.PLUGIN_ID + ".UseContextualLaunch"; //$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. >@@ -212,7 +220,7 @@ > public static final String PREF_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH = IDebugUIConstants.PLUGIN_ID + ".save_dirty_editors_before_launch"; //$NON-NLS-1$ > > /** >- * Preference specifiying that all launches should be DEBUG_MODE if breakpoints exist in the workspace >+ * Preference specifying that all launches should be DEBUG_MODE if breakpoints exist in the workspace > * @since 3.0 > */ > public static final String PREF_RELAUNCH_IN_DEBUG_MODE = IDebugUIConstants.PLUGIN_ID + ".relaunch_in_debug_mode"; //$NON-NLS-1$ >Index: ui/org/eclipse/debug/internal/ui/DefaultLabelProvider.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DefaultLabelProvider.java,v >retrieving revision 1.49 >diff -u -r1.49 DefaultLabelProvider.java >--- ui/org/eclipse/debug/internal/ui/DefaultLabelProvider.java 20 Dec 2006 17:13:37 -0000 1.49 >+++ ui/org/eclipse/debug/internal/ui/DefaultLabelProvider.java 12 Jan 2007 22:29:24 -0000 >@@ -39,6 +39,7 @@ > import org.eclipse.debug.core.model.IVariable; > import org.eclipse.debug.core.model.IWatchExpression; > import org.eclipse.debug.core.model.IWatchpoint; >+import org.eclipse.debug.internal.ui.launchConfigurations.LaunchShortcutExtension; > import org.eclipse.debug.internal.ui.views.variables.IndexedVariablePartition; > import org.eclipse.debug.ui.IDebugUIConstants; > import org.eclipse.jface.resource.ImageDescriptor; >@@ -69,6 +70,9 @@ > } > return null; > } >+ if(element instanceof LaunchShortcutExtension) { >+ return ((LaunchShortcutExtension)element).getImageDescriptor().createImage(); >+ } > return DebugPluginImages.getImage(key); > } > >@@ -155,7 +159,7 @@ > DebugUIPlugin.log(e); > return null; > } >- } >+ } > } > return null; > } >@@ -206,6 +210,8 @@ > name = delegate.getContributorName(); > } > label.append(name); >+ } else if(element instanceof LaunchShortcutExtension) { >+ label.append(((LaunchShortcutExtension)element).getLabel()); > } else if (element instanceof String) { > label.append(element); > } else { >Index: ui/org/eclipse/debug/internal/ui/actions/AbstractDebugActionDelegate.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AbstractDebugActionDelegate.java,v >retrieving revision 1.47 >diff -u -r1.47 AbstractDebugActionDelegate.java >--- ui/org/eclipse/debug/internal/ui/actions/AbstractDebugActionDelegate.java 6 Jan 2007 16:35:12 -0000 1.47 >+++ ui/org/eclipse/debug/internal/ui/actions/AbstractDebugActionDelegate.java 12 Jan 2007 22:29:25 -0000 >@@ -32,8 +32,8 @@ > * This class is an abstract implementation of common features for a debug <code>IViewActionDelegate</code> > * > * This class is intended to be extended by clients >- * @see {@link IViewActionDelegate} >- * @see {@link IActionDelegate2} >+ * @see implemented interface {@link IViewActionDelegate} >+ * @see implemented interface {@link IActionDelegate2} > */ > public abstract class AbstractDebugActionDelegate implements IViewActionDelegate, IActionDelegate2 { > >@@ -48,7 +48,7 @@ > private IViewPart fViewPart; > > /** >- * Cache of the most recent seletion >+ * Cache of the most recent selection > */ > private IStructuredSelection fSelection = StructuredSelection.EMPTY; > >@@ -58,7 +58,7 @@ > private boolean fInitialized = false; > > /** >- * It's crucial that delegate actions have a zero-arg constructor so that >+ * It's crucial that delegate actions have a zero-argument constructor so that > * they can be reflected into existence when referenced in an action set > * in the plugin's plugin.xml file. > */ >@@ -257,7 +257,7 @@ > } > > /** >- * Sets the initialized state of this aciton to the specified boolean value >+ * Sets the initialized state of this action to the specified boolean value > * @param initialized the value to set the initialized state to > */ > protected void setInitialized(boolean initialized) { >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.3 >diff -u -r1.3 LaunchablePropertyTester.java >--- ui/org/eclipse/debug/internal/ui/actions/LaunchablePropertyTester.java 24 Feb 2005 06:55:33 -0000 1.3 >+++ ui/org/eclipse/debug/internal/ui/actions/LaunchablePropertyTester.java 12 Jan 2007 22:29:25 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2005 IBM Corporation and others. >+ * Copyright (c) 2000, 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 >@@ -11,6 +11,8 @@ > package org.eclipse.debug.internal.ui.actions; > > import org.eclipse.core.expressions.PropertyTester; >+import org.eclipse.core.resources.IResource; >+import org.eclipse.core.runtime.IAdaptable; > import org.eclipse.core.runtime.Platform; > import org.eclipse.debug.internal.ui.DebugUIPlugin; > import org.eclipse.debug.ui.actions.ILaunchable; >@@ -20,16 +22,33 @@ > */ > public class LaunchablePropertyTester extends PropertyTester { > >- /* (non-Javadoc) >+ /** > * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object) > */ > public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { >- if (property.equals("launchable")) { //$NON-NLS-1$ >- if (DebugUIPlugin.getDefault().getLaunchConfigurationManager().launchModeAvailable((String)expectedValue)) { >- return Platform.getAdapterManager().hasAdapter(receiver, ILaunchable.class.getName()); >- } >+ if ("launchable".equals(property)) { //$NON-NLS-1$ >+ if (DebugUIPlugin.getDefault().getLaunchConfigurationManager().launchModeAvailable((String)expectedValue)) { >+ return Platform.getAdapterManager().hasAdapter(receiver, ILaunchable.class.getName()); >+ } >+ } >+ else if("resource".equals(property)) { //$NON-NLS-1$ >+ return getResource(receiver) != null; > } > return false; > } > >+ /** >+ * Returns the resource this property page 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; >+ } > } >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.14 >diff -u -r1.14 LaunchShortcutsAction.java >--- ui/org/eclipse/debug/ui/actions/LaunchShortcutsAction.java 30 Aug 2006 15:46:13 -0000 1.14 >+++ ui/org/eclipse/debug/ui/actions/LaunchShortcutsAction.java 12 Jan 2007 22:29:28 -0000 >@@ -25,8 +25,10 @@ > 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.IInternalDebugUIConstants; > import org.eclipse.debug.internal.ui.actions.ActionMessages; > 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.ILaunchGroup; >@@ -34,14 +36,18 @@ > import org.eclipse.jface.action.ActionContributionItem; > import org.eclipse.jface.action.IAction; > import org.eclipse.jface.action.IMenuCreator; >+import org.eclipse.jface.util.IPropertyChangeListener; >+import org.eclipse.jface.util.PropertyChangeEvent; > import org.eclipse.jface.viewers.ISelection; > import org.eclipse.jface.viewers.ISelectionProvider; > import org.eclipse.jface.viewers.IStructuredSelection; > import org.eclipse.swt.events.MenuAdapter; > import org.eclipse.swt.events.MenuEvent; > import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Event; > import org.eclipse.swt.widgets.Menu; > import org.eclipse.swt.widgets.MenuItem; >+import org.eclipse.ui.IActionDelegate2; > import org.eclipse.ui.IEditorPart; > import org.eclipse.ui.IWorkbenchPage; > import org.eclipse.ui.IWorkbenchPart; >@@ -61,7 +67,7 @@ > * </p> > * @since 3.1 > */ >-public class LaunchShortcutsAction extends Action implements IMenuCreator, IWorkbenchWindowPulldownDelegate2 { >+public class LaunchShortcutsAction extends Action implements IMenuCreator, IActionDelegate2, IWorkbenchWindowPulldownDelegate2, IPropertyChangeListener { > > /** > * Cascading menu >@@ -74,9 +80,9 @@ > private ILaunchGroup fGroup; > > /** >- * Whether this actions enablement has been initialized >+ * Stores the proxy action to this delegate, if one exists. > */ >- private boolean fInitialized = false; >+ private IAction fAction; > > /** > * Creates a cascading menu action to populate with shortcuts in the given >@@ -86,9 +92,17 @@ > */ > public LaunchShortcutsAction(String launchGroupIdentifier) { > super(); >+ DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this); > fGroup = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(launchGroupIdentifier); >- ILaunchMode mode = DebugPlugin.getDefault().getLaunchManager().getLaunchMode(fGroup.getMode()); >- setText(mode.getLaunchAsLabel()); >+ if (DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH) >+ && !"org.eclipse.ui.externaltools.launchGroup".equals(fGroup.getIdentifier())){ //$NON-NLS-1$ >+ setText(fGroup.getLabel()); >+ setImageDescriptor(fGroup.getImageDescriptor()); >+ } else { >+ ILaunchMode mode = DebugPlugin.getDefault().getLaunchManager().getLaunchMode(fGroup.getMode()); >+ setText(mode.getLaunchAsLabel()); >+ setImageDescriptor(null); >+ } > setMenuCreator(this); > setEnabled(existsConfigTypesForMode()); > } >@@ -102,11 +116,27 @@ > return fGroup; > } > >- /** >- * @see IAction#run() >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.action.Action#run() > */ > public void run() { >- //do nothing, this action just creates a cascading menu. >+ if (DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH)){ >+ ContextRunner.getDefault().run(fGroup.getMode()); >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction, org.eclipse.swt.widgets.Event) >+ */ >+ public void runWithEvent(IAction action, Event event) { >+ run(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) >+ */ >+ public void run(IAction action) { >+ run(); > } > > /** >@@ -129,12 +159,20 @@ > * @see IMenuCreator#getMenu(Menu) > */ > public Menu getMenu(Menu parent) { >- if (getCreatedMenu() != null) { >- getCreatedMenu().dispose(); >- } >- setCreatedMenu(new Menu(parent)); >- initMenu(); >- return getCreatedMenu(); >+ if (DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH)){ >+ if (getCreatedMenu() != null) { >+ getCreatedMenu().dispose(); >+ } >+ setCreatedMenu(null); >+ return null; >+ } else { >+ if (getCreatedMenu() != null) { >+ getCreatedMenu().dispose(); >+ } >+ setCreatedMenu(new Menu(parent)); >+ initMenu(); >+ return getCreatedMenu(); >+ } > } > > /** >@@ -296,29 +334,53 @@ > return DebugUIPlugin.getDefault().getLaunchConfigurationManager(); > } > >- /** >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction) >+ */ >+ public void init(IAction action) { >+ fAction = action; >+ refresh(); >+ } >+ >+ /* (non-Javadoc) > * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow) > */ > public void init(IWorkbenchWindow window) { > } >- >+ > /** >- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) >+ * Refreshes the enablement, text and image of the proxy action to this delegate if one exists. > */ >- public void run(IAction action) { >- // do nothing - this is just a menu >+ private void refresh(){ >+ if (fAction != null){ >+ fAction.setEnabled(existsConfigTypesForMode()); >+ if (DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH) >+ && !"org.eclipse.ui.externaltools.launchGroup".equals(fGroup.getIdentifier())){ //$NON-NLS-1$ >+ fAction.setText(fGroup.getLabel()); >+ fAction.setImageDescriptor(fGroup.getImageDescriptor()); >+ } else { >+ ILaunchMode mode = DebugPlugin.getDefault().getLaunchManager().getLaunchMode(fGroup.getMode()); >+ fAction.setText(mode.getLaunchAsLabel()); >+ fAction.setImageDescriptor(null); >+ } >+ } > } > > /** > * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) > */ > public void selectionChanged(IAction action, ISelection selection) { >- if (!fInitialized) { >- action.setEnabled(existsConfigTypesForMode()); >- fInitialized = true; >- } > } >- >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) >+ */ >+ public void propertyChange(PropertyChangeEvent event) { >+ if (IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH.equals(event.getProperty())){ >+ refresh(); >+ } >+ } >+ > /** > * Return whether there are any registered launch configuration types for > * the mode of this action. >@@ -336,5 +398,6 @@ > } > return false; > } >+ > } > >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.13 >diff -u -r1.13 AbstractLaunchToolbarAction.java >--- ui/org/eclipse/debug/ui/actions/AbstractLaunchToolbarAction.java 8 Apr 2005 16:08:20 -0000 1.13 >+++ ui/org/eclipse/debug/ui/actions/AbstractLaunchToolbarAction.java 12 Jan 2007 22:29:28 -0000 >@@ -13,6 +13,8 @@ > > 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; > import org.eclipse.jface.action.IAction; >@@ -54,8 +56,14 @@ > if (menu.getItemCount() > 0) { > addSeparator(menu); > } >- >- addToMenu(menu, new LaunchShortcutsAction(getLaunchGroupIdentifier()), -1); >+ 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, getOpenDialogAction(), -1); > addToMenu(menu, new OrganizeFavoritesAction(getLaunchGroupIdentifier()), -1); > } >@@ -67,18 +75,23 @@ > protected IAction getOpenDialogAction() { > return new OpenLaunchDialogAction(getLaunchGroupIdentifier()); > } >- >+ > /** > * Launch the last launch, or open the launch config dialog if none. > * > * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) > */ > public void run(IAction action) { >- ILaunchConfiguration configuration = getLastLaunch(); >- if (configuration == null) { >- DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUIPlugin.getShell(), new StructuredSelection(), getLaunchGroupIdentifier()); >- } else { >- DebugUITools.launch(configuration, getMode()); >+ if(ContextRunner.isContextLaunchEnabled()) { >+ ContextRunner.getDefault().run(getMode()); >+ } >+ else { >+ ILaunchConfiguration configuration = getLastLaunch(); >+ if (configuration == null) { >+ DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUIPlugin.getShell(), new StructuredSelection(), getLaunchGroupIdentifier()); >+ } else { >+ DebugUITools.launch(configuration, getMode()); >+ } > } > } > } >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.20 >diff -u -r1.20 ContextualLaunchAction.java >--- ui/org/eclipse/debug/ui/actions/ContextualLaunchAction.java 30 Aug 2006 15:46:13 -0000 1.20 >+++ ui/org/eclipse/debug/ui/actions/ContextualLaunchAction.java 12 Jan 2007 22:29:28 -0000 >@@ -53,7 +53,7 @@ > * An action delegate that builds a context menu with applicable launch shortcuts > * for a specific launch mode. > * <p> >- * This class can be subclassed and contributed as an object contribution pop-up >+ * This class can be sub-classed and contributed as an object contribution pop-up > * menu extension action. When invoked, it becomes a sub-menu that dynamically > * builds a list of applicable launch shortcuts for the current selection. > * Each launch shortcut may have optional information to support a context menu action. >@@ -171,7 +171,7 @@ > /** > * This method is used to determine if the selected object is in fact a shared launch > * configuration that can be launched >- * @return true if the item is a shared ocnfig , false otherwise >+ * @return true if the item is a shared config , false otherwise > * @since 3.3 > */ > private boolean isSharedConfig(Object receiver) { >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.13 >diff -u -r1.13 OpenLaunchDialogAction.java >--- ui/org/eclipse/debug/ui/actions/OpenLaunchDialogAction.java 24 Feb 2005 06:43:48 -0000 1.13 >+++ ui/org/eclipse/debug/ui/actions/OpenLaunchDialogAction.java 12 Jan 2007 22:29:29 -0000 >@@ -16,15 +16,21 @@ > import org.eclipse.debug.core.ILaunchConfigurationType; > import org.eclipse.debug.internal.ui.DebugUIPlugin; > 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.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; > import org.eclipse.jface.viewers.StructuredSelection; > import org.eclipse.jface.window.Window; >+import org.eclipse.swt.widgets.Event; >+import org.eclipse.ui.IActionDelegate2; > import org.eclipse.ui.IWorkbenchWindow; > import org.eclipse.ui.IWorkbenchWindowActionDelegate; > import org.eclipse.ui.PlatformUI; >@@ -37,7 +43,7 @@ > * </p> > * @since 2.1 > */ >-public class OpenLaunchDialogAction extends Action implements IWorkbenchWindowActionDelegate { >+public class OpenLaunchDialogAction extends Action implements IPropertyChangeListener, IActionDelegate2, IWorkbenchWindowActionDelegate { > > /** > * Launch group identifier >@@ -57,10 +63,18 @@ > */ > public OpenLaunchDialogAction(String identifier) { > fIdentifier = identifier; >+ DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this); > LaunchGroupExtension extension = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(identifier); > if (extension != null) { >- setText(extension.getLabel() + "..."); //$NON-NLS-1$ >- setImageDescriptor(extension.getImageDescriptor()); >+ if(DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH) >+ && !"org.eclipse.ui.externaltools.launchGroup".equals(identifier)) { //$NON-NLS-1$ >+ setText(ContextMessages.OpenLaunchDialogAction_0); >+ setImageDescriptor(extension.getImageDescriptor()); >+ } >+ else { >+ setText(extension.getLabel() + "..."); //$NON-NLS-1$ >+ setImageDescriptor(extension.getImageDescriptor()); >+ } > } > PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.OPEN_LAUNCH_CONFIGURATION_ACTION); > } >@@ -80,45 +94,76 @@ > int result = DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUIPlugin.getShell(), selection, fIdentifier); > notifyResult(result == Window.OK); > } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction, org.eclipse.swt.widgets.Event) >+ */ >+ public void runWithEvent(IAction action, Event event) { >+ run(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) >+ */ >+ public void run(IAction action) { >+ run(); >+ } >+ > /** > * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose() > */ > public void dispose() { > } > >- /** >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction) >+ */ >+ public void init(IAction action) { >+ fAction = action; >+ refresh(); >+ } >+ >+ /* (non-Javadoc) > * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow) > */ > public void init(IWorkbenchWindow window) { > } >- >+ > /** >- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) >+ * Refreshes the enablement, text and image of the proxy action to this delegate if one exists. > */ >- public void run(IAction action) { >- run(); >+ private void refresh(){ >+ if (fAction != null){ >+ fAction.setEnabled(existsConfigTypesForMode()); >+ LaunchGroupExtension extension = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(fIdentifier); >+ if(DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH) >+ && !"org.eclipse.ui.externaltools.launchGroup".equals(fIdentifier)) { //$NON-NLS-1$ >+ fAction.setText(ContextMessages.OpenLaunchDialogAction_0); >+ fAction.setImageDescriptor(extension.getImageDescriptor()); >+ } >+ else { >+ fAction.setText(extension.getLabel() + "..."); //$NON-NLS-1$ >+ fAction.setImageDescriptor(extension.getImageDescriptor()); >+ } >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) >+ */ >+ public void propertyChange(PropertyChangeEvent event) { >+ if (IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH.equals(event.getProperty())){ >+ refresh(); >+ } > } >- >+ > /** > * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) > */ > public void selectionChanged(IAction action, ISelection selection) { >- if (fAction == null) { >- initialize(action); >- } > } > > /** >- * Set the enabled state of the underlying action based on whether there are any >- * registered launch configuration types that understand how to launch in the >- * mode of this action. >- */ >- private void initialize(IAction action) { >- fAction = action; >- action.setEnabled(existsConfigTypesForMode()); >- } >- >- /** > * Return whether there are any registered launch configuration types for > * the mode of this action. > * >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.28 >diff -u -r1.28 AbstractLaunchHistoryAction.java >--- ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java 28 Nov 2006 22:04:22 -0000 1.28 >+++ ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java 12 Jan 2007 22:29:28 -0000 >@@ -21,6 +21,7 @@ > import org.eclipse.debug.internal.ui.DebugUIPlugin; > import org.eclipse.debug.internal.ui.ILaunchHistoryChangedListener; > import org.eclipse.debug.internal.ui.actions.ActionMessages; >+import org.eclipse.debug.internal.ui.contextlaunching.ContextRunner; > import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager; > import org.eclipse.debug.internal.ui.launchConfigurations.LaunchHistory; > import org.eclipse.jface.action.ActionContributionItem; >@@ -183,18 +184,21 @@ > */ > protected String getToolTip(ILaunchConfiguration configuration) { > String launchName= configuration.getName(); >- String mode= getMode(); >- String label; >+ String label = null; >+ if(ContextRunner.isContextLaunchEnabled()) { >+ launchName = ContextRunner.getDefault().getContextName(); >+ } >+ String mode = getMode(); > if (mode.equals(ILaunchManager.RUN_MODE)) { >- label= ActionMessages.AbstractLaunchHistoryAction_1; >+ label = ActionMessages.AbstractLaunchHistoryAction_1; > } else if (mode.equals(ILaunchManager.DEBUG_MODE)){ >- label= ActionMessages.AbstractLaunchHistoryAction_2; >+ label = ActionMessages.AbstractLaunchHistoryAction_2; > } else if (mode.equals(ILaunchManager.PROFILE_MODE)){ >- label= ActionMessages.AbstractLaunchHistoryAction_3; >+ label = ActionMessages.AbstractLaunchHistoryAction_3; > } else { >- label= ActionMessages.AbstractLaunchHistoryAction_4; >+ label = ActionMessages.AbstractLaunchHistoryAction_4; > } >- return MessageFormat.format(ActionMessages.AbstractLaunchHistoryAction_0, new String[] {label, launchName}); >+ return MessageFormat.format(ActionMessages.AbstractLaunchHistoryAction_0, new String[] {label, launchName}); > } > > /** >@@ -337,6 +341,9 @@ > if (fAction == null) { > initialize(action); > } >+ if(ContextRunner.isContextLaunchEnabled()) { >+ updateTooltip(); >+ } > } > > /** >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties,v >retrieving revision 1.168 >diff -u -r1.168 LaunchConfigurationsMessages.properties >--- ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties 4 Jan 2007 16:03:19 -0000 1.168 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties 12 Jan 2007 22:29:27 -0000 >@@ -102,6 +102,9 @@ > PerspectiveManager_Unable_to_switch_perpsectives_as_specified_by_launch___0__4=Unable to open perspectives as specified by launch: {0} > PerspectiveManager_Unable_to_switch_to_perspective___0__2=Unable to open perspective: {0} > LaunchShortcutExtension_Error_4=Error >+LaunchShortcutSelectionDialog_0={0} As... >+LaunchShortcutSelectionDialog_1=&Select how to {0} {1}: >+LaunchShortcutSelectionDialog_2=&Make generated launch configuration the default for [{0}] > LaunchShortcutExtension_Unable_to_use_launch_shortcut_5=Unable to use launch shortcut > > LaunchConfigurationPropertiesDialog_Edit_launch_configuration_properties_1=Edit launch configuration properties >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java,v >retrieving revision 1.48 >diff -u -r1.48 LaunchConfigurationsMessages.java >--- ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java 4 Jan 2007 16:03:19 -0000 1.48 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java 12 Jan 2007 22:29:27 -0000 >@@ -106,6 +106,12 @@ > public static String LaunchConfigurationTabGroupViewer_13; > > public static String LaunchConfigurationView_0; >+ >+ public static String LaunchShortcutSelectionDialog_0; >+ >+ public static String LaunchShortcutSelectionDialog_1; >+ >+ public static String LaunchShortcutSelectionDialog_2; > public static String PerspectiveManager_Error_1; > public static String PerspectiveManager_Unable_to_switch_perpsectives_as_specified_by_launch___0__4; > public static String PerspectiveManager_Unable_to_switch_to_perspective___0__2; >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java,v >retrieving revision 1.80 >diff -u -r1.80 LaunchConfigurationTabGroupViewer.java >--- ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java 5 Jan 2007 22:36:12 -0000 1.80 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java 12 Jan 2007 22:29:26 -0000 >@@ -360,7 +360,7 @@ > > /** > * Creates some help text for the tab group launch types >- * @param parent thep arent composite >+ * @param parent the parent composite > * @since 3.2 > */ > private void createGettingStarted(Composite parent) { >@@ -492,7 +492,14 @@ > ILaunchConfigurationTab[] tabs = getTabs(); > if (tabs != null) { > // update the working copy from the active tab >+ boolean newwc = !getWorkingCopy().isDirty(); > getActiveTab().performApply(getWorkingCopy()); >+ if(getOriginal() instanceof ILaunchConfigurationWorkingCopy && newwc) { >+ try { >+ getWorkingCopy().doSave(); >+ } >+ catch (CoreException e) {DebugUIPlugin.log(e);} >+ } > updateButtons(); > // update error ticks > CTabItem item = null; >@@ -948,6 +955,9 @@ > if (workingCopy == null) { > return false; > } >+ if(workingCopy.getParent() != null) { >+ return !workingCopy.getParent().contentsEqual(workingCopy); >+ } > // Working copy hasn't been saved > if (workingCopy.getOriginal() == null) { > return true; >@@ -1354,8 +1364,8 @@ > try { > if(fTabGroup != null) { > fTabGroup.initializeFrom(fOriginal); >- fWorkingCopy = fOriginal.getWorkingCopy(); > fNameWidget.setText(fOriginal.getName()); >+ fWorkingCopy = fOriginal.getWorkingCopy(); > refreshStatus(); > } > } >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java,v >retrieving revision 1.193 >diff -u -r1.193 LaunchConfigurationsDialog.java >--- ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java 5 Jan 2007 16:27:23 -0000 1.193 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java 12 Jan 2007 22:29:27 -0000 >@@ -851,7 +851,10 @@ > * @return the shell title > */ > protected String getShellTitle() { >- String title = DebugUIPlugin.removeAccelerators(getLaunchGroup().getLabel()); >+ String title = null; >+ if(getLaunchGroup() != null) { >+ title = DebugUIPlugin.removeAccelerators(getLaunchGroup().getLabel()); >+ } > if (title == null) { > title = LaunchConfigurationsMessages.LaunchConfigurationDialog_Launch_Configurations_18; > } >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.76 >diff -u -r1.76 LaunchConfigurationManager.java >--- ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java 3 Jan 2007 22:37:57 -0000 1.76 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationManager.java 12 Jan 2007 22:29:26 -0000 >@@ -32,6 +32,8 @@ > import javax.xml.parsers.ParserConfigurationException; > import javax.xml.transform.TransformerException; > >+import org.eclipse.core.expressions.EvaluationContext; >+import org.eclipse.core.expressions.IEvaluationContext; > import org.eclipse.core.resources.IProject; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.resources.ISaveContext; >@@ -56,6 +58,7 @@ > import org.eclipse.debug.core.ILaunchManager; > import org.eclipse.debug.core.ILaunchMode; > import org.eclipse.debug.internal.core.IConfigurationElementConstants; >+import org.eclipse.debug.internal.core.LaunchManager; > import org.eclipse.debug.internal.ui.DebugPluginImages; > import org.eclipse.debug.internal.ui.DebugUIPlugin; > import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; >@@ -594,11 +597,48 @@ > } > return fLaunchShortcuts; > } >+ >+ /** >+ * 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 >+ */ >+ public List getApplicableConfigurationTypes(IResource resource) { >+ List types = new ArrayList(); >+ try { >+ List exts = getLaunchShortcuts(); >+ LaunchShortcutExtension ext = null; >+ List list = new ArrayList(); >+ list.add(resource); >+ IEvaluationContext context = new EvaluationContext(null, list); >+ context.addVariable("selection", list); //$NON-NLS-1$ >+ HashSet set = new HashSet(); >+ for(Iterator iter = exts.iterator(); iter.hasNext();) { >+ ext = (LaunchShortcutExtension) iter.next(); >+ if(ext.evalEnablementExpression(context, ext.getContextualLaunchEnablementExpression())) { >+ set.addAll(ext.getAssociatedConfigurationTypes()); >+ } >+ } >+ LaunchManager lm = (LaunchManager) DebugPlugin.getDefault().getLaunchManager(); >+ ILaunchConfigurationType type = null; >+ for(Iterator iter = set.iterator(); iter.hasNext();) { >+ type = lm.getLaunchConfigurationType((String)iter.next()); >+ if(type != null && !"org.eclipse.ui.externaltools".equals(type.getCategory()) && !types.contains(type)) { //$NON-NLS-1$ >+ types.add(type); >+ } >+ } >+ } >+ catch(CoreException ce) {DebugUIPlugin.log(ce);} >+ return types; >+ } > > /** > * Returns a listing of all applicable <code>LaunchShortcutExtension</code>s for the given > * launch configuration type id. >- * @param typeid the id of the launch configuraiton >+ * @param typeid the id of the launch configuration > * @return a listing of <code>LaunchShortcutExtension</code>s that are associated with the specified launch configuration > * type id or an empty list, never <code>null</code> > * >Index: ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties,v >retrieving revision 1.97 >diff -u -r1.97 DebugPreferencesMessages.properties >--- ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties 5 Jan 2007 15:34:10 -0000 1.97 >+++ ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties 12 Jan 2007 22:29:28 -0000 >@@ -16,6 +16,8 @@ > ConsolePreferencePage_Standard_In__4=Standard &In text color: > ConsolePreferencePage_Standard_Out__2=Standard &Out text color: > ConsolePreferencePage_Wrap_text_1=Fixed &width console >+ContextualLaunchPreferencePage_0=This page is used to edit contextual launching options (EXPERIMENTAL). >+ContextualLaunchPreferencePage_1=&Enable contextual launching. > ConsolePreferencePage_Console_width=&Maximum character width: > ConsolePreferencePage_Limit_console_output_1=&Limit console output > ConsolePreferencePage_Console_buffer_size__characters___2=Console &buffer size (characters): >@@ -127,3 +129,16 @@ > LaunchDelegatesPreferencePage_4=Launcher Description > LaunchPerspectivePreferencePage_0=There is no perspective information available to change. > LaunchPerspectivePreferencePage_1=The selected types/launchers do not have any common mode sets. >+DefaultLaunchConfigurationsPropertiesPage_0=This page allows you to select a default way to launch the currently selected resource. >+DefaultLaunchConfigurationsPropertiesPage_1=&Select default configuration for {0}: >+DefaultLaunchConfigurationsPropertiesPage_2=&New... >+DefaultLaunchConfigurationsPropertiesPage_3=Create new launch configuration >+DefaultLaunchConfigurationsPropertiesPage_4=Du&plicate >+DefaultLaunchConfigurationsPropertiesPage_5=Duplicate selected launch configuration >+DefaultLaunchConfigurationsPropertiesPage_6=&Edit... >+DefaultLaunchConfigurationsPropertiesPage_7=Edit selected launch configuration >+DefaultLaunchConfigurationsPropertiesPage_8=De&lete >+DefaultLaunchConfigurationsPropertiesPage_9=Delete selected launch configuration >+DefaultLaunchConfigurationsPropertiesPage_10=Configuration must be located in project {0} >+DefaultLaunchConfigurationsPropertiesPage_11=Select Configuration Type >+DefaultLaunchConfigurationsPropertiesPage_12=&Select the configuration type to create: >Index: ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java,v >retrieving revision 1.25 >diff -u -r1.25 DebugPreferencesMessages.java >--- ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java 20 Dec 2006 20:00:05 -0000 1.25 >+++ ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java 12 Jan 2007 22:29:28 -0000 >@@ -32,6 +32,10 @@ > public static String ConsolePreferencePage_12; > public static String ConsolePreferencePage_13; > >+ public static String ContextualLaunchPreferencePage_0; >+ >+ public static String ContextualLaunchPreferencePage_1; >+ > public static String DebugPreferencePage_1; > public static String DebugPreferencePage_2; > >@@ -51,6 +55,32 @@ > public static String DebugPreferencePage_26; > public static String DebugPreferencePage_27; > >+ public static String DefaultLaunchConfigurationsPropertiesPage_0; >+ >+ public static String DefaultLaunchConfigurationsPropertiesPage_1; >+ >+ public static String DefaultLaunchConfigurationsPropertiesPage_10; >+ >+ public static String DefaultLaunchConfigurationsPropertiesPage_11; >+ >+ public static String DefaultLaunchConfigurationsPropertiesPage_12; >+ >+ public static String DefaultLaunchConfigurationsPropertiesPage_2; >+ >+ public static String DefaultLaunchConfigurationsPropertiesPage_3; >+ >+ public static String DefaultLaunchConfigurationsPropertiesPage_4; >+ >+ public static String DefaultLaunchConfigurationsPropertiesPage_5; >+ >+ public static String DefaultLaunchConfigurationsPropertiesPage_6; >+ >+ public static String DefaultLaunchConfigurationsPropertiesPage_7; >+ >+ public static String DefaultLaunchConfigurationsPropertiesPage_8; >+ >+ public static String DefaultLaunchConfigurationsPropertiesPage_9; >+ > public static String LaunchDelegatesPreferencePage_0; > > public static String LaunchDelegatesPreferencePage_1; >Index: ui/org/eclipse/debug/internal/ui/preferences/ContextLaunchingPropertyTester.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/preferences/ContextLaunchingPropertyTester.java >diff -N ui/org/eclipse/debug/internal/ui/preferences/ContextLaunchingPropertyTester.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/preferences/ContextLaunchingPropertyTester.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,34 @@ >+/******************************************************************************* >+ * 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.preferences; >+ >+import org.eclipse.core.expressions.PropertyTester; >+import org.eclipse.debug.internal.ui.DebugUIPlugin; >+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; >+ >+/** >+ * Tests properties for enabling/disabling popup menu object contributions >+ * @since 3.3 >+ * >+ * EXPERIMENTAL >+ */ >+public class ContextLaunchingPropertyTester extends PropertyTester { >+ >+ /** >+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object) >+ */ >+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { >+ if("contextlaunch".equals(property)) { //$NON-NLS-1$ >+ return DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH); >+ } >+ return false; >+ } >+} >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 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/contextlaunching/ContextLaunchingAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,75 @@ >+/******************************************************************************* >+ * 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.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 {@link ContextRunner} >+ * @see {@link IActionDelegate2} >+ * @see {@link RunContextLaunchingAction} >+ * @see {@link DebugContextLaunchingAction} >+ * @see {@link ProfileContextLaunchingAction} >+ * >+ * @since 3.3 >+ * EXPERIMENTAL >+ */ >+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().run(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/ContextRunner.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/contextlaunching/ContextRunner.java >diff -N ui/org/eclipse/debug/internal/ui/contextlaunching/ContextRunner.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/contextlaunching/ContextRunner.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,259 @@ >+package org.eclipse.debug.internal.ui.contextlaunching; >+ >+import java.util.ArrayList; >+import java.util.Iterator; >+import java.util.List; >+ >+import org.eclipse.core.expressions.EvaluationContext; >+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.ILaunch; >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.debug.core.ILaunchListener; >+import org.eclipse.debug.internal.core.LaunchManager; >+import org.eclipse.debug.internal.ui.DebugUIPlugin; >+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; >+import org.eclipse.debug.internal.ui.launchConfigurations.LaunchShortcutExtension; >+import org.eclipse.debug.internal.ui.launchConfigurations.LaunchShortcutSelectionDialog; >+import org.eclipse.debug.ui.DebugUITools; >+import org.eclipse.debug.ui.IDebugUIConstants; >+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.IEditorInput; >+import org.eclipse.ui.IEditorPart; >+import org.eclipse.ui.IWorkbenchPage; >+import org.eclipse.ui.IWorkbenchPart; >+import org.eclipse.ui.IWorkbenchPartSite; >+import org.eclipse.ui.IWorkbenchWindow; >+ >+/** >+ * Static runner for context launching to provide the base capability of context >+ * launching to more than one form of action (drop down, toolbar, view, etc) >+ * >+ * @see {@link ContextLaunchingAction} >+ * @see {@link ContextLaunchingToolbarAction} >+ * @see {@link ILaunchListener} >+ * @see {@link org.eclipse.debug.core.ILaunchManager} >+ * >+ * @since 3.3 >+ * EXPERIMENTAL >+ */ >+public class ContextRunner implements ILaunchListener { >+ >+ private static ContextRunner fgInstance = null; >+ >+ /** >+ * Returns the singleton instance of <code>ContextRunner</code> >+ * @return the singleton instance of <code>ContextRunner</code> >+ */ >+ public static ContextRunner getDefault() { >+ if(fgInstance == null) { >+ fgInstance = new ContextRunner(); >+ } >+ return fgInstance; >+ } >+ >+ /** >+ * The underlying resource that is derived from the object context of the >+ * run(Object, String) method >+ */ >+ private IResource fBackingResource = null; >+ >+ /** >+ * Performs the context launching given the object context and the mode to launch in >+ * @param mode the mode to launch in >+ */ >+ public void run(String mode) { >+ try { >+ Object context = getCurrentContext(); >+ boolean launched = false; >+ if(context instanceof IAdaptable) { >+ IAdaptable adapt = (IAdaptable) context; >+ IResource resource = (IResource) adapt.getAdapter(IResource.class); >+ if(resource != null) { >+ fBackingResource = resource; >+ ILaunchConfiguration config = getLaunchManager().getDefaultConfiguration(resource); >+ if(config != null) { >+ if(config.exists()) { >+ DebugUITools.launch(config, mode); >+ launched = true; >+ } >+ else { >+ getLaunchManager().setDefaultConfiguration(resource, null); >+ selectAndLaunch(adapt, mode); >+ launched = true; >+ } >+ } >+ else { >+ selectAndLaunch(adapt, mode); >+ launched = true; >+ } >+ } >+ } >+ if(!launched) { >+ DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUIPlugin.getShell(), new StructuredSelection(), IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP, null); >+ } >+ } >+ catch(CoreException ce) {DebugUIPlugin.log(ce);} >+ } >+ >+ /** >+ * Prompts the user to select a way of launching the current resource, where a 'way' >+ * is defined as a launch shortcut >+ * @param adapt the adaptable type the specified resource was derived from >+ * @param resource >+ * @return the 'way' to launch the selected resource >+ * @throws CoreException >+ */ >+ protected void selectAndLaunch(IAdaptable adapt, String mode) throws CoreException { >+ LaunchShortcutSelectionDialog dialog = new LaunchShortcutSelectionDialog(getLaunchShortcuts(fBackingResource), fBackingResource, mode); >+ if (dialog.open() == Window.OK) { >+ Object[] result = dialog.getResult(); >+ if(result.length > 0) { >+ if(dialog.makeDefault()) { >+ getLaunchManager().addLaunchListener(this); >+ } >+ LaunchShortcutExtension method = (LaunchShortcutExtension) result[0]; >+ if(method != null) { >+ if(adapt instanceof IEditorInput) { >+ IWorkbenchWindow window = DebugUIPlugin.getActiveWorkbenchWindow(); >+ if(window != null) { >+ IEditorPart epart = window.getActivePage().getActiveEditor(); >+ method.launch(epart, mode); >+ } >+ } >+ else { >+ method.launch(new StructuredSelection(adapt), mode); >+ } >+ } >+ } >+ } >+ } >+ >+ /** >+ * 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 >+ */ >+ protected 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); >+ } >+ } >+ } >+ return list; >+ } >+ >+ /** >+ * Returns the current context to be considered for launching. >+ * The returned object will be one of: >+ * <ol> >+ * <li>{@link IEditorInput}<li> >+ * <li>{@link Object}, where <i>object</i> is the first element in the selection obtained from the >+ * selection provider of the currently selected workbench part</li> >+ * </ol> >+ * @return the currently selected context to consider for launching, or <code>null</code>. >+ * >+ */ >+ public Object getCurrentContext() { >+ IWorkbenchWindow window = DebugUIPlugin.getActiveWorkbenchWindow(); >+ if(window != null) { >+ IWorkbenchPage page = window.getActivePage(); >+ if(page!= null) { >+ IWorkbenchPart part = page.getActivePart(); >+ if(part != null) { >+ if(part instanceof IEditorPart) { >+ return ((IEditorPart)part).getEditorInput(); >+ } >+ IWorkbenchPartSite site = part.getSite(); >+ if(site != null) { >+ ISelectionProvider provider = site.getSelectionProvider(); >+ if(provider != null) { >+ ISelection sel = provider.getSelection(); >+ if(sel instanceof IStructuredSelection) { >+ return ((IStructuredSelection)sel).getFirstElement(); >+ } >+ return sel; >+ } >+ } >+ } >+ } >+ >+ } >+ return null; >+ } >+ >+ /** >+ * Returns the name of the currently selected context, or the empty string. >+ * This method can return null in the event the contributor of the selected context returns <code>null</code> >+ * as the resource name. >+ * @return the name of the currently selected context or the empty string. >+ */ >+ public String getContextName() { >+ Object o = getCurrentContext(); >+ if(o instanceof IAdaptable) { >+ IResource resource = (IResource) ((IAdaptable) o).getAdapter(IResource.class); >+ if(resource != null) { >+ return resource.getName(); >+ } >+ } >+ return ""; //$NON-NLS-1$ >+ } >+ >+ /** >+ * Returns if context launching is enabled >+ * @return if context launching is enabled >+ */ >+ public static boolean isContextLaunchEnabled() { >+ return DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH); >+ } >+ >+ /** >+ * Returns the launch manager >+ * @return the launch manager >+ */ >+ protected LaunchManager getLaunchManager() { >+ return (LaunchManager) DebugPlugin.getDefault().getLaunchManager(); >+ } >+ >+ /** >+ * @see org.eclipse.debug.core.ILaunchListener#launchAdded(org.eclipse.debug.core.ILaunch) >+ */ >+ public void launchAdded(ILaunch launch) { >+ if(fBackingResource != null) { >+ try { >+ getLaunchManager().setDefaultConfiguration(fBackingResource, launch.getLaunchConfiguration()); >+ getLaunchManager().removeLaunchListener(this); >+ } >+ catch(CoreException ce) {DebugUIPlugin.log(ce);} >+ } >+ } >+ >+ /** >+ * @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/preferences/ContextLaunchingPreferencePage.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/preferences/ContextLaunchingPreferencePage.java >diff -N ui/org/eclipse/debug/internal/ui/preferences/ContextLaunchingPreferencePage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/preferences/ContextLaunchingPreferencePage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,104 @@ >+/******************************************************************************* >+ * 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.preferences; >+ >+import java.util.ArrayList; >+import java.util.List; >+ >+import org.eclipse.debug.internal.ui.DebugUIPlugin; >+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.preference.BooleanFieldEditor; >+import org.eclipse.jface.preference.FieldEditor; >+import org.eclipse.jface.preference.PreferencePage; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.ui.IWorkbench; >+import org.eclipse.ui.IWorkbenchPreferencePage; >+import org.eclipse.ui.PlatformUI; >+ >+/** >+ * A preference page for configuring launching preferences. >+ * >+ * @since 3.3 >+ */ >+public class ContextLaunchingPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { >+ >+ /** >+ * a list of the field editors >+ */ >+ private List fFieldEditors; >+ >+ /** >+ * The default constructor >+ */ >+ public ContextLaunchingPreferencePage() { >+ super(); >+ setPreferenceStore(DebugUIPlugin.getDefault().getPreferenceStore()); >+ } >+ >+ /** >+ * @see org.eclipse.jface.preference.PreferencePage#createControl(org.eclipse.swt.widgets.Composite) >+ */ >+ public void createControl(Composite parent) { >+ super.createControl(parent); >+ PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDebugHelpContextIds.CONTEXTUAL_LAUNCHING_PREFERENCE_PAGE); >+ } >+ >+ /** >+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) >+ */ >+ protected Control createContents(Composite parent) { >+ fFieldEditors = new ArrayList(); >+ Composite comp = SWTUtil.createComposite(parent, 1, 1, GridData.FILL_BOTH); >+ >+ SWTUtil.createWrapLabel(comp, DebugPreferencesMessages.ContextualLaunchPreferencePage_0, 1, 300); >+ SWTUtil.createVerticalSpacer(comp, 2); >+ //use contextual launch >+ FieldEditor edit = new BooleanFieldEditor(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH, DebugPreferencesMessages.ContextualLaunchPreferencePage_1, comp); >+ fFieldEditors.add(edit); >+ >+ //init the field editors >+ FieldEditor editor; >+ for(int i = 0; i < fFieldEditors.size(); i++) { >+ editor = (FieldEditor)fFieldEditors.get(i); >+ editor.setPreferenceStore(getPreferenceStore()); >+ editor.load(); >+ } >+ return comp; >+ } >+ >+ /** >+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) >+ */ >+ public void init(IWorkbench workbench) {} >+ >+ /** >+ * @see org.eclipse.jface.preference.PreferencePage#performDefaults() >+ */ >+ protected void performDefaults() { >+ for(int i = 0; i < fFieldEditors.size(); i++) { >+ ((FieldEditor)fFieldEditors.get(i)).loadDefault(); >+ } >+ } >+ >+ /** >+ * @see org.eclipse.jface.preference.PreferencePage#performOk() >+ */ >+ public boolean performOk() { >+ for(int i = 0; i < fFieldEditors.size(); i++) { >+ ((FieldEditor)fFieldEditors.get(i)).store(); >+ } >+ return super.performOk(); >+ } >+} >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 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/contextlaunching/ProfileContextLaunchingAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,35 @@ >+/******************************************************************************* >+ * 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.contextlaunching; >+ >+import org.eclipse.debug.core.ILaunchManager; >+ >+/** >+ * Specialization of <code>ContextLaunchingAction</code> for profile mode >+ * >+ * @see {@link ContextLaunchingAction} >+ * @see {@link ILaunchManager} >+ * @see {@link RunContextLaunchingAction} >+ * @see {@link DebugContextLaunchingAction} >+ * >+ * @since 3.3 >+ * EXPERIMENTAL >+ */ >+public class ProfileContextLaunchingAction extends ContextLaunchingAction { >+ >+ /** >+ * Constructor >+ */ >+ public ProfileContextLaunchingAction() { >+ super(ILaunchManager.PROFILE_MODE); >+ } >+ >+} >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 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/contextlaunching/RunContextLaunchingAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,35 @@ >+/******************************************************************************* >+ * 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.contextlaunching; >+ >+import org.eclipse.debug.core.ILaunchManager; >+ >+/** >+ * Specialization of <code>ContextLaunchingAction</code> for run mode >+ * >+ * @see {@link ContextLaunchingAction} >+ * @see {@link ILaunchManager} >+ * @see {@link DebugContextLaunchingAction} >+ * @see {@link ProfileContextLaunchingAction} >+ * >+ * @since 3.3 >+ * EXPERIMENTAL >+ */ >+public class RunContextLaunchingAction extends ContextLaunchingAction { >+ >+ /** >+ * Constructor >+ */ >+ public RunContextLaunchingAction() { >+ super(ILaunchManager.RUN_MODE); >+ } >+ >+} >Index: ui/org/eclipse/debug/internal/ui/preferences/DefaultLaunchConfigurationsPropertiesPage.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/preferences/DefaultLaunchConfigurationsPropertiesPage.java >diff -N ui/org/eclipse/debug/internal/ui/preferences/DefaultLaunchConfigurationsPropertiesPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/preferences/DefaultLaunchConfigurationsPropertiesPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,480 @@ >+/******************************************************************************* >+ * 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.preferences; >+ >+import java.util.ArrayList; >+import java.util.Arrays; >+import java.util.Collections; >+import java.util.Comparator; >+import java.util.HashSet; >+import java.util.Iterator; >+import java.util.List; >+import java.util.Set; >+ >+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; >+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; >+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.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.viewers.ArrayContentProvider; >+import org.eclipse.jface.viewers.CheckStateChangedEvent; >+import org.eclipse.jface.viewers.CheckboxTableViewer; >+import org.eclipse.jface.viewers.ICheckStateListener; >+import org.eclipse.jface.viewers.ISelectionChangedListener; >+import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.jface.viewers.SelectionChangedEvent; >+import org.eclipse.jface.viewers.StructuredSelection; >+import org.eclipse.jface.window.Window; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.events.SelectionListener; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Table; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.dialogs.ListDialog; >+import org.eclipse.ui.dialogs.PropertyPage; >+ >+import com.ibm.icu.text.MessageFormat; >+ >+/** >+ * Displays default launch configuration settings for a selected resource - associated launch configurations. >+ * >+ * @see {@link PropertyPage} >+ * @see {@link ILaunchConfiguration} >+ * @see {@link org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog} >+ * @see {@link IDebugHelpContextIds#DEFAULT_LAUNCHCONFIGURATION_PROPERTY_PAGE} >+ * >+ * @since 3.3 >+ */ >+public class DefaultLaunchConfigurationsPropertiesPage extends PropertyPage { >+ /** >+ * Set of configurations to be deleted >+ */ >+ private Set fDeletedConfigurations = new HashSet(); >+ >+ /** >+ * Set of original default candidates for the resource >+ */ >+ private Set fOriginalCandidates; >+ >+ /** >+ * List of the applicable launch config types for the backing resource >+ */ >+ private List fTypeCandidates = null; >+ >+ //widgets >+ private CheckboxTableViewer fViewer; >+ private Button fNewButton = null; >+ private Button fEditButton = null; >+ private Button fDuplicateButton = null; >+ private Button fDeleteButton = null; >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) >+ */ >+ protected Control createContents(Composite parent) { >+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IDebugHelpContextIds.DEFAULT_LAUNCHCONFIGURATION_PROPERTY_PAGE); >+ >+ Composite topComposite = SWTUtil.createComposite(parent, 2, 1, GridData.FILL_BOTH); >+ >+ SWTUtil.createWrapLabel(topComposite, DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_0, 2, 300); >+ SWTUtil.createVerticalSpacer(topComposite, 2); >+ SWTUtil.createWrapLabel(topComposite, MessageFormat.format(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_1, new String[]{getResource().getName()}), 2, 300); >+ >+ fViewer = createViewer(topComposite); >+ >+ Composite buttonComp = SWTUtil.createComposite(topComposite, 1, 1, GridData.FILL_VERTICAL); >+ GridLayout layout = (GridLayout) buttonComp.getLayout(); >+ layout.marginHeight = 0; >+ fNewButton = SWTUtil.createPushButton(buttonComp, DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_2, null); >+ fNewButton.setToolTipText(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_3); >+ fNewButton.addSelectionListener(new SelectionListener() { >+ public void widgetDefaultSelected(SelectionEvent e) {} >+ public void widgetSelected(SelectionEvent e) { >+ handleNew(); >+ } >+ }); >+ >+ fDuplicateButton = SWTUtil.createPushButton(buttonComp, DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_4, null); >+ fDuplicateButton.setToolTipText(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_5); >+ fDuplicateButton.setEnabled(false); >+ fDuplicateButton.addSelectionListener(new SelectionListener() { >+ public void widgetDefaultSelected(SelectionEvent e) {} >+ public void widgetSelected(SelectionEvent e) { >+ handleCopy(); >+ } >+ }); >+ fEditButton = SWTUtil.createPushButton(buttonComp, DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_6, null); >+ fEditButton.setToolTipText(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_7); >+ fEditButton.setEnabled(false); >+ fEditButton.addSelectionListener(new SelectionListener() { >+ public void widgetDefaultSelected(SelectionEvent e) {} >+ public void widgetSelected(SelectionEvent e) { >+ handleEdit(); >+ } >+ }); >+ fDeleteButton = SWTUtil.createPushButton(buttonComp, DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_8, null); >+ fDeleteButton.setToolTipText(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_9); >+ fDeleteButton.setEnabled(false); >+ fDeleteButton.addSelectionListener(new SelectionListener() { >+ public void widgetDefaultSelected(SelectionEvent e) {} >+ public void widgetSelected(SelectionEvent e) { >+ handleDelete(); >+ } >+ }); >+ >+ fViewer.setSelection(new StructuredSelection()); >+ applyDialogFont(topComposite); >+ return topComposite; >+ } >+ >+ /** >+ * Creates and returns the viewer that will display the possible default configurations. >+ * >+ * @param parent parent composite to create the viewer in >+ * @return viewer viewer that will display possible default configurations >+ */ >+ protected CheckboxTableViewer createViewer(Composite parent){ >+ CheckboxTableViewer viewer = CheckboxTableViewer.newCheckList(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER); >+ viewer.setLabelProvider(new DefaultLabelProvider()); >+ viewer.setContentProvider(new ArrayContentProvider()); >+ viewer.setComparator(new LaunchConfigurationComparator()); >+ viewer.addCheckStateListener(new ICheckStateListener() { >+ public void checkStateChanged(CheckStateChangedEvent event) { >+ if (event.getChecked()) { >+ fViewer.setCheckedElements(new Object[] {event.getElement()}); >+ } >+ else{ >+ fViewer.setCheckedElements(new Object[] {}); >+ } >+ } >+ }); >+ Table builderTable = viewer.getTable(); >+ GridData tableGridData = new GridData(GridData.FILL_BOTH); >+ tableGridData.heightHint = 300; >+ builderTable.setLayoutData(tableGridData); >+ >+ IResource resource = getResource(); >+ viewer.setInput(collectConfigCandidates(resource)); >+ try { >+ ILaunchConfiguration configuration = getLaunchManager().getDefaultConfiguration(resource); >+ if (configuration != null) { >+ Iterator iterator = fOriginalCandidates.iterator(); >+ while (iterator.hasNext()) { >+ ILaunchConfigurationWorkingCopy wc = (ILaunchConfigurationWorkingCopy) iterator.next(); >+ if (configuration.equals(wc.getOriginal())) { >+ viewer.setChecked(wc, true); >+ break; >+ } >+ } >+ } >+ } catch (CoreException e) { >+ setErrorMessage(e.getMessage()); >+ } >+ viewer.addSelectionChangedListener(new ISelectionChangedListener() { >+ public void selectionChanged(SelectionChangedEvent event) { >+ boolean empty = event.getSelection().isEmpty(); >+ fEditButton.setEnabled(!empty); >+ fDuplicateButton.setEnabled(!empty); >+ fDeleteButton.setEnabled(!empty); >+ } >+ }); >+ >+ return viewer; >+ } >+ >+ /** >+ * Returns the viewer displaying possible default configurations. >+ * >+ * @return viewer >+ */ >+ protected CheckboxTableViewer getViewer() { >+ return fViewer; >+ } >+ >+ /** >+ * Returns the launch manager >+ * @return the launch manager >+ */ >+ protected LaunchManager getLaunchManager() { >+ return (LaunchManager) DebugPlugin.getDefault().getLaunchManager(); >+ } >+ >+ /** >+ * Collects the applicable launch configuration types for the backing resource. >+ * Default implementation uses the launch shortcut evaluation expressions and leverages the >+ * mapping of launch shortcut to config type id to derive the applicable types. >+ * @return the listing of applicable launch configuration types for the backing resource >+ */ >+ protected List collectTypeCandidates() { >+ if(fTypeCandidates == null) { >+ fTypeCandidates = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getApplicableConfigurationTypes(getResource()); >+ Collections.sort(fTypeCandidates, new Comparator() { >+ public int compare(Object o1, Object o2) { >+ ILaunchConfigurationType t1 = (ILaunchConfigurationType) o1; >+ ILaunchConfigurationType t2 = (ILaunchConfigurationType) o2; >+ return t1.getName().compareTo(t2.getName()); >+ } >+ >+ }); >+ } >+ return fTypeCandidates; >+ } >+ >+ /** >+ * Returns a set of potential default configurations candidates for the given >+ * resource. The configurations are working copies. >+ * >+ * @param resource resource >+ * @return list of default candidates >+ */ >+ 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())) { >+ configs.add(configurations[i]); >+ } >+ } >+ ILaunchConfiguration configuration = null; >+ IResource[] resources = null; >+ for (Iterator iter = configs.iterator(); iter.hasNext();) { >+ configuration = (ILaunchConfiguration) iter.next(); >+ if(!DebugUITools.isPrivate(configuration) && !"org.eclipse.ui.externaltools".equals(configuration.getType().getCategory())) { //$NON-NLS-1$ >+ 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()) || >+ resources[j].getFullPath().isPrefixOf(resourcePath)) { >+ fOriginalCandidates.add(configuration.getWorkingCopy()); >+ break; >+ } >+ } >+ } >+ } >+ } >+ } >+ } catch (CoreException e) { >+ fOriginalCandidates.clear(); >+ DebugPlugin.log(e); >+ } >+ } >+ return fOriginalCandidates; >+ } >+ >+ /** >+ * Returns the resource this property page is open on. >+ * >+ * @return resource >+ */ >+ protected IResource getResource() { >+ Object element = getElement(); >+ IResource resource = null; >+ if (element instanceof IResource) { >+ resource = (IResource) element; >+ } else if (element instanceof IAdaptable) { >+ resource = (IResource) ((IAdaptable)element).getAdapter(IResource.class); >+ } >+ return resource; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.preference.PreferencePage#performOk() >+ */ >+ public boolean performOk() { >+ Object[] checked = fViewer.getCheckedElements(); >+ try { >+ ILaunchConfiguration def = null; >+ if (checked.length == 1) { >+ def = (ILaunchConfiguration) checked[0]; >+ def = ((ILaunchConfigurationWorkingCopy)def).doSave(); >+ } >+ DebugPlugin.getDefault().getLaunchManager().setDefaultConfiguration(getResource(), def); >+ } catch (CoreException e) { >+ setErrorMessage(e.getMessage()); >+ return false; >+ } >+ //delete >+ Iterator iter = fDeletedConfigurations.iterator(); >+ while (iter.hasNext()) { >+ ILaunchConfigurationWorkingCopy currentConfig = (ILaunchConfigurationWorkingCopy) iter.next(); >+ try{ >+ if (currentConfig.getOriginal() != null){ >+ currentConfig.getOriginal().delete(); >+ } >+ } catch (CoreException e) { >+ DebugPlugin.logMessage("Problem deleting configuration " + currentConfig.getName(), e); //$NON-NLS-1$ >+ } >+ } >+ //add >+ iter = fOriginalCandidates.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$ >+ } >+ } >+ } >+ >+ return super.performOk(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.preference.PreferencePage#performDefaults() >+ */ >+ protected void performDefaults() { >+ fViewer.setAllChecked(false); >+ setErrorMessage(null); >+ setValid(true); >+ super.performDefaults(); >+ } >+ >+ /** >+ * Returns the names of the launch configurations passed in as original input to the tree viewer >+ * @return the names of the original launch configurations >+ */ >+ 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()); >+ } >+ } >+ return names; >+ } >+ >+ /** >+ * Returns selected configurations. >+ * >+ * @return selected configurations >+ */ >+ private ILaunchConfigurationWorkingCopy[] getSelectedConfigurations() { >+ IStructuredSelection ss = (IStructuredSelection) fViewer.getSelection(); >+ return (ILaunchConfigurationWorkingCopy[]) ss.toList().toArray(new ILaunchConfigurationWorkingCopy[ss.size()]); >+ } >+ >+ /** >+ * Copy the selection >+ */ >+ private void handleCopy() { >+ ILaunchConfigurationWorkingCopy configuration = getSelectedConfigurations()[0]; >+ try { >+ ILaunchConfigurationWorkingCopy copy = configuration.copy( >+ ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).generateUniqueLaunchConfigurationNameFrom(configuration.getName(), getConfigurationNames())); >+ copy.setAttributes(configuration.getAttributes()); >+ fOriginalCandidates.add(copy); >+ fViewer.refresh(); >+ fViewer.setSelection(new StructuredSelection(copy)); >+ } catch (CoreException e) { >+ setErrorMessage(e.getMessage()); >+ } >+ } >+ >+ /** >+ * Delete the selection >+ */ >+ private void handleDelete() { >+ Table table = fViewer.getTable(); >+ int[] indices = table.getSelectionIndices(); >+ Arrays.sort(indices); >+ ILaunchConfiguration[] configurations = getSelectedConfigurations(); >+ for (int i = 0; i < configurations.length; i++) { >+ fDeletedConfigurations.add(configurations[i]); >+ fOriginalCandidates.remove(configurations[i]); >+ } >+ fViewer.refresh(); >+ if (indices[0] < table.getItemCount()) { >+ fViewer.setSelection(new StructuredSelection(table.getItem(indices[0]).getData())); >+ } else if (table.getItemCount() > 0) { >+ fViewer.setSelection(new StructuredSelection(table.getItem(table.getItemCount() - 1).getData())); >+ } >+ } >+ >+ /** >+ * Edit the selection >+ */ >+ private void handleEdit() { >+ edit(getSelectedConfigurations()[0]); >+ fViewer.refresh(); >+ } >+ >+ /** >+ * Edits the given configuration as a nested working copy. >+ * Returns the code from the dialog used to edit the configuration. >+ * >+ * @param configuration >+ * @return dialog return code - OK or CANCEL >+ */ >+ private int edit(ILaunchConfigurationWorkingCopy configuration) { >+ return DebugUIPlugin.openLaunchConfigurationPropertiesDialog(getShell(), configuration, IDebugUIConstants.ID_RUN_LAUNCH_GROUP, getConfigurationNames(), null); >+ } >+ >+ /** >+ * Create a new configuration >+ */ >+ private void handleNew() { >+ ListDialog dialog = new ListDialog(getShell()); >+ dialog.setTitle(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_11); >+ dialog.setContentProvider(new ArrayContentProvider()); >+ dialog.setLabelProvider(new DefaultLabelProvider()); >+ dialog.setAddCancelButton(true); >+ dialog.setMessage(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_12); >+ dialog.setInput(collectTypeCandidates()); >+ if (dialog.open() == Window.OK) { >+ Object[] result = dialog.getResult(); >+ if (result.length == 1) { >+ ILaunchConfigurationType type = (ILaunchConfigurationType) result[0]; >+ try { >+ ILaunchConfigurationWorkingCopy wc = type.newInstance(null, >+ ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()). >+ generateUniqueLaunchConfigurationNameFrom("New_configuration", getConfigurationNames())); //$NON-NLS-1$ >+ if (edit(wc) == Window.OK) { >+ fOriginalCandidates.add(wc); >+ fViewer.refresh(); >+ fViewer.setSelection(new StructuredSelection(wc)); >+ } >+ } catch (CoreException e) { >+ setErrorMessage(e.getMessage()); >+ } >+ } >+ } >+ } >+} >Index: ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.java >diff -N ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,16 @@ >+package org.eclipse.debug.internal.ui.contextlaunching; >+ >+import org.eclipse.osgi.util.NLS; >+ >+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 OpenLaunchDialogAction_0; >+ static { >+ // initialize resource bundle >+ NLS.initializeMessages(BUNDLE_NAME, ContextMessages.class); >+ } >+ >+ private ContextMessages() { >+ } >+} >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 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/contextlaunching/ContextLaunchingToolbarAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,81 @@ >+/******************************************************************************* >+ * 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.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 {@link ContextRunner} >+ * @see {@link ContextLaunchingAction} >+ * @see {@link Action} >+ * @see {@link IWorkbenchWindowActionDelegate} >+ * >+ * @since 3.3 >+ * EXPERIMENTAL >+ */ >+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().run(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/launchConfigurations/LaunchShortcutSelectionDialog.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutSelectionDialog.java >diff -N ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutSelectionDialog.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutSelectionDialog.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,123 @@ >+/******************************************************************************* >+ * 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.launchConfigurations; >+ >+import java.util.List; >+ >+import org.eclipse.core.resources.IResource; >+import org.eclipse.debug.core.DebugPlugin; >+import org.eclipse.debug.core.ILaunchMode; >+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.ui.IDebugUIConstants; >+import org.eclipse.jface.dialogs.IDialogSettings; >+import org.eclipse.jface.viewers.ArrayContentProvider; >+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; >+import org.eclipse.ui.dialogs.ListDialog; >+ >+import com.ibm.icu.text.MessageFormat; >+ >+/** >+ * Specialized dialog for showing/selecting a specific launch shortcut extension, and allowing it >+ * to be marked to be set as the default >+ * >+ * @see {@link org.eclipse.debug.internal.ui.actions.ContextLaunchingAction} >+ * >+ * @since 3.3 >+ * EXPERIMENTAL >+ */ >+public class LaunchShortcutSelectionDialog extends ListDialog { >+ >+ private static final String DIALOG_SETTINGS = IDebugUIConstants.PLUGIN_ID + ".SELECT_LAUNCH_SHORTCUT_DIALOG"; //$NON-NLS-1$; >+ >+ /** >+ * The list of input for the dialog >+ */ >+ private String fMode = null; >+ private IResource fResource = null; >+ private boolean fChecked = false; >+ >+ /** >+ * Constructor >+ * @param input >+ * @param resource >+ * @param mode >+ */ >+ public LaunchShortcutSelectionDialog(List input, IResource resource, String mode) { >+ super(DebugUIPlugin.getShell()); >+ setShellStyle(getShellStyle() | SWT.RESIZE); >+ fResource = resource; >+ fMode = mode; >+ ILaunchMode lmode = DebugPlugin.getDefault().getLaunchManager().getLaunchMode(fMode); >+ String modename = fMode; >+ if (lmode != null) { >+ modename = DebugUIPlugin.removeAccelerators(lmode.getLabel()); >+ } >+ setTitle(MessageFormat.format(LaunchConfigurationsMessages.LaunchShortcutSelectionDialog_0, new String[] {modename})); >+ setAddCancelButton(true); >+ setMessage(MessageFormat.format(LaunchConfigurationsMessages.LaunchShortcutSelectionDialog_1, new String[] {fMode, fResource.getName()})); >+ setLabelProvider(new DefaultLabelProvider()); >+ setContentProvider(new ArrayContentProvider()); >+ setInput(input); >+ } >+ >+ /** >+ * @see org.eclipse.jface.dialogs.Dialog#createContents(org.eclipse.swt.widgets.Composite) >+ */ >+ protected Control createContents(Composite parent) { >+ Composite comp = (Composite) super.createContents(parent); >+ PlatformUI.getWorkbench().getHelpSystem().setHelp(comp, IDebugHelpContextIds.SELECT_LAUNCH_METHOD_DIALOG); >+ return comp; >+ } >+ >+ /** >+ * @see org.eclipse.ui.dialogs.SelectionDialog#getDialogBoundsSettings() >+ */ >+ protected IDialogSettings getDialogBoundsSettings() { >+ IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings(); >+ IDialogSettings section = settings.getSection(DIALOG_SETTINGS); >+ if (section == null) { >+ section = settings.addNewSection(DIALOG_SETTINGS); >+ } >+ return section; >+ } >+ >+ /** >+ * @see org.eclipse.ui.dialogs.ListDialog#createDialogArea(org.eclipse.swt.widgets.Composite) >+ */ >+ protected Control createDialogArea(Composite container) { >+ Composite comp = (Composite) super.createDialogArea(container); >+ Button 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(); >+ } >+ }); >+ 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; >+ } >+} >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationComparator.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationComparator.java >diff -N ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationComparator.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationComparator.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,82 @@ >+/******************************************************************************* >+ * 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.launchConfigurations; >+ >+import java.util.Arrays; >+import java.util.Collections; >+import java.util.Comparator; >+import java.util.HashMap; >+import java.util.Iterator; >+import java.util.List; >+import java.util.Map; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.debug.core.DebugPlugin; >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.debug.core.ILaunchConfigurationType; >+import org.eclipse.ui.model.WorkbenchViewerComparator; >+ >+/** >+ * Groups configurations by type. >+ * >+ * @since 3.3 >+ */ >+public class LaunchConfigurationComparator extends WorkbenchViewerComparator { >+ >+ /** >+ * the map of categories of <code>ILaunchConfigurationType</code>s to <code>Integer</code>s entries >+ */ >+ private static Map fgCategories; >+ >+ /** >+ * @see org.eclipse.jface.viewers.ViewerComparator#category(java.lang.Object) >+ */ >+ public int category(Object element) { >+ Map map = getCategories(); >+ if (element instanceof ILaunchConfiguration) { >+ ILaunchConfiguration configuration = (ILaunchConfiguration) element; >+ try { >+ Integer i = (Integer) map.get(configuration.getType()); >+ if (i != null) { >+ return i.intValue(); >+ } >+ } catch (CoreException e) { >+ } >+ } >+ return map.size(); >+ } >+ >+ /** >+ * Returns the map of categories >+ * @return the map of categories >+ */ >+ private Map getCategories() { >+ if (fgCategories == null) { >+ fgCategories = new HashMap(); >+ List types = Arrays.asList(DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationTypes()); >+ Collections.sort(types, new Comparator() { >+ public int compare(Object o1, Object o2) { >+ ILaunchConfigurationType t1 = (ILaunchConfigurationType) o1; >+ ILaunchConfigurationType t2 = (ILaunchConfigurationType) o2; >+ return t1.getName().compareTo(t2.getName()); >+ } >+ >+ }); >+ Iterator iterator = types.iterator(); >+ int i = 0; >+ while (iterator.hasNext()) { >+ fgCategories.put(iterator.next(), new Integer(i)); >+ i++; >+ } >+ } >+ return fgCategories; >+ } >+} >Index: ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.properties >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.properties >diff -N ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.properties >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/contextlaunching/ContextMessages.properties 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,2 @@ >+ContextRunner_0=The selected context could not be launched >+OpenLaunchDialogAction_0=&Open Launch Dialog >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 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/contextlaunching/DebugContextLaunchingAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,34 @@ >+/******************************************************************************* >+ * 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.contextlaunching; >+ >+import org.eclipse.debug.core.ILaunchManager; >+ >+/** >+ * Specialization of <code>ContextLaunchingAction</code> for debug mode >+ * >+ * @see {@link ContextLaunchingAction} >+ * @see {@link ILaunchManager} >+ * @see {@link RunContextLaunchingAction} >+ * @see {@link ProfileContextLaunchingAction} >+ * >+ * @since 3.3 >+ * EXPERIMENTAL >+ */ >+public class DebugContextLaunchingAction extends ContextLaunchingAction { >+ >+ /** >+ * Constructor >+ */ >+ public DebugContextLaunchingAction() { >+ super(ILaunchManager.DEBUG_MODE); >+ } >+} >#P org.eclipse.jdt.doc.user >Index: contexts_Debugger.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.doc.user/contexts_Debugger.xml,v >retrieving revision 1.94 >diff -u -r1.94 contexts_Debugger.xml >--- contexts_Debugger.xml 7 Dec 2006 18:33:45 -0000 1.94 >+++ contexts_Debugger.xml 12 Jan 2007 22:29:31 -0000 >@@ -5,7 +5,7 @@ > Copyright (c) IBM Corporation and others 2000, 2006. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page. > > All Platform Debug contexts, those for org.eclipse.debug.ui, are located in this file >- All contexts are gouped by their relation, with all relations grouped alphabetically. >+ All contexts are grouped by their relation, with all relations grouped alphabetically. > --> > <!-- > Breakpoints View >@@ -558,7 +558,7 @@ > <topic label="Working Sets..." href="reference/views/breakpoints/ref-workingsets_viewaction.htm"/> > </context> > <context id="delete_associated_launch_configs_dialog"> >- <description>This dialog prompts users to clean up launch configuraitons that are associated with, or used to launch code from, the project that is being deleted </description> >+ <description>This dialog prompts users to clean up launch configurations that are associated with, or used to launch code from, the project that is being deleted </description> > <topic label="Running and Debugging" href="tasks/task-running_and_debugging.htm"/> > <topic label="Creating a Java application launch configuration" href="tasks/tasks-java-local-configuration.htm"/> > </context> >@@ -572,7 +572,11 @@ > <topic label="Running and Debugging" href="tasks/task-running_and_debugging.htm"/> > <topic label="Creating a Java application launch configuration" href="tasks/tasks-java-local-configuration.htm"/> > </context> >- >+ <context id="select_launch_method_dialog"> >+ <description>This dialog allows you to select a way that you would like to launch the currently selected resource.</description> >+ <topic label="Running and Debugging" href="tasks/task-running_and_debugging.htm"/> >+ <topic label="Creating a Java application launch configuration" href="tasks/tasks-java-local-configuration.htm"/> >+ </context> > > > <!-- >@@ -677,7 +681,7 @@ > <topic label="Source Attachments" href="reference/ref-124.htm"/> > </context> > <context id="launch_configuration_dialog_launchers_tab" > >- <description>This tab allows you to a specific launchers to use with the selected launch configuration in the event ther is more than one available.</description> >+ <description>This tab allows you to a specific launchers to use with the selected launch configuration in the event there is more than one available.</description> > <topic label="Java application launch configuration" href=" tasks\tasks-java-local-configuration.htm"/> > </context> > >@@ -794,7 +798,7 @@ > </context> > > <!-- >- Multiview Action conetxts >+ Multiview Action contexts > --> > <context id="find_element_context"> > <description>This command finds an element by name.</description> >@@ -867,6 +871,11 @@ > <topic label="Debug Preferences" href="reference/preferences/ref-debug.htm"/> > <topic label="Debugger Concepts" href="concepts/cdebugger.htm"/> > </context> >+ <context id="contextual_launch_preference_page"> >+ <description>This page allows you to change settings that apply to contextual launching</description> >+ <topic label="Debug Preferences" href="reference/preferences/ref-debug.htm"/> >+ <topic label="Debugger Concepts" href="concepts/cdebugger.htm"/> >+ </context> > > <!-- > Property Pages >@@ -880,6 +889,9 @@ > <context id="TableRenderingPropertiesPage_context" > > <description>This page displays properties from the selected memory.</description> > </context> >+ <context id="default_launchconfiguration_property_page"> >+ <description>This page displays the properties for default launch configurations for the selected resource</description> >+ </context> > > <!-- > Run Menu
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