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 56666 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
74480_1.patch (text/plain), 73.94 KB, created by
Michael Rennie
on 2007-01-09 17:31:29 EST
(
hide
)
Description:
work in progress
Filename:
MIME Type:
Creator:
Michael Rennie
Created:
2007-01-09 17:31:29 EST
Size:
73.94 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#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 9 Jan 2007 22:12:10 -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> >@@ -677,7 +677,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 +794,7 @@ > </context> > > <!-- >- Multiview Action conetxts >+ Multiview Action contexts > --> > <context id="find_element_context"> > <description>This command finds an element by name.</description> >@@ -867,6 +867,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 +885,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 >#P org.eclipse.debug.core >Index: core/org/eclipse/debug/internal/core/LaunchManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java,v >retrieving revision 1.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 9 Jan 2007 22:12:12 -0000 >@@ -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 9 Jan 2007 22:12:11 -0000 >@@ -87,12 +87,6 @@ > private IContainer fContainer; > > /** >- * Parent working copy. >- * @since 3.3 >- */ >- private LaunchConfigurationWorkingCopy fParent = null; >- >- /** > * Constructs a working copy of the specified launch > * configuration. > * >@@ -121,8 +115,7 @@ > super(parent.getLocation()); > setName(parent.getName()); > copyFrom(parent); >- setOriginal((LaunchConfiguration) parent.getOriginal()); >- fParent = parent; >+ setOriginal(parent); > fSuppressChange = false; > } > >@@ -173,42 +166,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 (getOriginal() instanceof ILaunchConfigurationWorkingCopy) { >+ // save to parent working copy >+ LaunchConfigurationWorkingCopy wc = (LaunchConfigurationWorkingCopy) getOriginal(); >+ 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()); > } > > >@@ -670,11 +660,7 @@ > * @see org.eclipse.debug.internal.core.LaunchConfiguration#getWorkingCopy() > */ > public ILaunchConfigurationWorkingCopy getWorkingCopy() throws CoreException { >- if (fParent == null) { >- return super.getWorkingCopy(); >- } else { >- return getNestedWorkingCopy(); >- } >+ return getNestedWorkingCopy(); > } > > /* (non-Javadoc) >@@ -683,12 +669,5 @@ > public ILaunchConfigurationWorkingCopy getNestedWorkingCopy() throws CoreException { > return new LaunchConfigurationWorkingCopy(this); > } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#getParent() >- */ >- public ILaunchConfigurationWorkingCopy getParent() { >- return fParent; >- } > } > >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 9 Jan 2007 22:12:11 -0000 >@@ -277,18 +277,4 @@ > * </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. >- * >- * @return parent or <code>null</code> >- * <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 getParent(); > } >#P org.eclipse.debug.ui >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 9 Jan 2007 22:12:14 -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 9 Jan 2007 22:12:14 -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 >@@ -20,11 +20,11 @@ > */ > 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 ("launchable".equals(property)) { //$NON-NLS-1$ > if (DebugUIPlugin.getDefault().getLaunchConfigurationManager().launchModeAvailable((String)expectedValue)) { > return Platform.getAdapterManager().hasAdapter(receiver, ILaunchable.class.getName()); > } >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 9 Jan 2007 22:12:14 -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 9 Jan 2007 22:12:14 -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$ >@@ -115,6 +116,7 @@ > // 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$ >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 9 Jan 2007 22:12:14 -0000 >@@ -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. >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 9 Jan 2007 22:12:14 -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.ContextualLaunchPreferencePage" >+ 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 >@@ -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,72 @@ > 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.actions.ContextLaunchingContributedAction" >+ 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.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.actions.ContextLaunchingContributedAction" >+ 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.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.actions.ContextLaunchingContributedAction" >+ 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.launchable" value="run"/> >+ </and> >+ </enablement> >+ </objectContribution> > <viewerContribution > targetID="org.eclipse.debug.ui.ProcessConsoleType.#ContextMenu" > id="org.eclipse.debug.ui.processConsoleContextMenu"> >@@ -1394,6 +1475,17 @@ > </or> > </enabledWhen> > </page> >+ <page >+ class="org.eclipse.debug.internal.ui.preferences.DefaultLaunchConfigurationsPropertiesPage" >+ id="org.eclipse.debug.ui.properties.defaultLaunchConfigurations" >+ name="%DefaultLaunchConfigurationsPropPage.name" >+ > >+ <enabledWhen> >+ <adapt >+ type="org.eclipse.core.resources.IResource"> >+ </adapt> >+ </enabledWhen> >+ </page> > </extension> > <!-- commands and their bindings > NOTE: >@@ -2050,6 +2142,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 +2334,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 9 Jan 2007 22:12:14 -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 >@@ -329,6 +342,8 @@ > preferenceKeywords.perspective=perspectives switching assign automatic run debug > preferenceKeywords.launchConfigurations=filters launch migration configurations run debug > preferenceKeywords.launchDelegates=launch delegate duplicate run debug profile mode configuration launchers launcher modes >+preferenceKeywords.contextLaunching=run debug profile launch contextual delegate configuration execute >+ > > exportBreakpoints.label=E&xport Breakpoints... > importBreakpoints.label=I&mport Breakpoints... >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupExtension.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupExtension.java,v >retrieving revision 1.20 >diff -u -r1.20 LaunchConfigurationTabGroupExtension.java >--- ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupExtension.java 4 Jan 2007 15:01:14 -0000 1.20 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupExtension.java 9 Jan 2007 22:12:14 -0000 >@@ -57,7 +57,7 @@ > * on the given configuration element > * > * @param element the configuration element defining the >- * attribtues of this launch configuration tab extension >+ * attributes of this launch configuration tab extension > * @return a new launch configuration tab extension > */ > public LaunchConfigurationTabGroupExtension(IConfigurationElement element) { >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 9 Jan 2007 22:12:14 -0000 >@@ -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; >@@ -632,6 +639,9 @@ > boolean refreshtabs = !delegatesEqual(fWorkingCopy, configuration); > fOriginal = configuration; > fWorkingCopy = configuration.getWorkingCopy(); >+ if(fOriginal instanceof ILaunchConfigurationWorkingCopy) { >+ fWorkingCopy.doSave(); >+ } > displayInstanceTabs(refreshtabs); > } else if (fInput instanceof ILaunchConfigurationType) { > fDescription = getDescription((ILaunchConfigurationType)fInput); >Index: ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java,v >retrieving revision 1.31 >diff -u -r1.31 LaunchShortcutExtension.java >--- ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java 3 Jan 2007 20:04:29 -0000 1.31 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchShortcutExtension.java 9 Jan 2007 22:12:14 -0000 >@@ -257,7 +257,7 @@ > * expression tree is malformed. > */ > public Expression getContextualLaunchEnablementExpression() throws CoreException { >- // all of this stuff is optional, so...tedius testing is required >+ // all of this stuff is optional, so...tedious testing is required > if (fContextualLaunchExpr == null) { > IConfigurationElement contextualLaunchElement = getContextualLaunchConfigurationElement(); > if (contextualLaunchElement == null) { >@@ -284,7 +284,7 @@ > * expression tree is malformed. > */ > public Expression getShortcutEnablementExpression() throws CoreException { >- // all of this stuff is optional, so...tedius testing is required >+ // all of this stuff is optional, so...tedious testing is required > if (fStandardLaunchExpr == null) { > IConfigurationElement[] elements = getConfigurationElement().getChildren(ExpressionTagNames.ENABLEMENT); > IConfigurationElement enablement = elements.length > 0 ? elements[0] : null; >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 9 Jan 2007 22:12:14 -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 && type.getCategory() == null && !types.contains(type)) { >+ 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 9 Jan 2007 22:12:15 -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 9 Jan 2007 22:12:14 -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/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 9 Jan 2007 22:12:15 -0000 >@@ -13,6 +13,8 @@ > > import org.eclipse.debug.core.ILaunchConfiguration; > import org.eclipse.debug.internal.ui.DebugUIPlugin; >+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; >+import org.eclipse.debug.internal.ui.launchConfigurations.ContextLaunchAction; > import org.eclipse.debug.internal.ui.launchConfigurations.OrganizeFavoritesAction; > import org.eclipse.debug.ui.DebugUITools; > import org.eclipse.jface.action.IAction; >@@ -54,9 +56,13 @@ > if (menu.getItemCount() > 0) { > addSeparator(menu); > } >- >- addToMenu(menu, new LaunchShortcutsAction(getLaunchGroupIdentifier()), -1); >- addToMenu(menu, getOpenDialogAction(), -1); >+ if(DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH)) { >+ addToMenu(menu, new ContextLaunchAction(getLaunchGroupIdentifier()), -1); >+ } >+ else { >+ addToMenu(menu, new LaunchShortcutsAction(getLaunchGroupIdentifier()), -1); >+ addToMenu(menu, getOpenDialogAction(), -1); >+ } > addToMenu(menu, new OrganizeFavoritesAction(getLaunchGroupIdentifier()), -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/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,499 @@ >+/******************************************************************************* >+ * 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.core.ILaunchManager; >+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.ILaunchGroup; >+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.viewers.Viewer; >+import org.eclipse.jface.viewers.ViewerFilter; >+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 parent class {@link PropertyPage} >+ * @see associated interface {@link ILaunchConfiguration} >+ * @see utilized dialog {@link org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog} >+ * @see page help context id {@link IDebugHelpContextIds#DEFAULT_LAUNCHCONFIGURATION_PROPERTY_PAGE} >+ * >+ * @since 3.3 >+ */ >+public class DefaultLaunchConfigurationsPropertiesPage extends PropertyPage { >+ >+ /** >+ * Provides a viewer filter for the tree >+ */ >+ class DefaultConfigFilter extends ViewerFilter { >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) >+ */ >+ public boolean select(Viewer viewer, Object parentElement, Object element) { >+ boolean select = true; >+ if (element instanceof ILaunchConfiguration) { >+ try { >+ ILaunchConfiguration configuration = (ILaunchConfiguration) element; >+ select &= configuration.getType().getCategory() == null; >+ select &= !DebugUITools.isPrivate(configuration); >+ if (!configuration.isLocal()) { >+ select &= getResource().getProject().equals(configuration.getFile().getProject()); >+ } >+ } >+ catch (CoreException e) {return false;} >+ } >+ return select; >+ } >+ >+ } >+ >+ /** >+ * List of configurations to be deleted >+ */ >+ private Set fDeletedConfigurations = new HashSet(); >+ >+ /** >+ * List of original default candidates for the resource >+ */ >+ private Set fOriginalCandidates; >+ >+ private Set fConfigurationTypeContext = 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[] {}); >+ } >+ } >+ }); >+ // Only filter private configurations and external tools to avoid filtering a default >+ viewer.addFilter(new DefaultConfigFilter()); >+ Table builderTable = viewer.getTable(); >+ GridData tableGridData = new GridData(GridData.FILL_BOTH); >+ tableGridData.heightHint = 300; >+ builderTable.setLayoutData(tableGridData); >+ >+ IResource resource = getResource(); >+ fOriginalCandidates = getDefaultCandidates(resource); >+ viewer.setInput(fOriginalCandidates); >+ try { >+ ILaunchConfiguration configuration = DebugPlugin.getDefault().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 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 a list of potential default configurations candidates for the given >+ * resource. The configurations are working copies. >+ * >+ * @param resource resource >+ * @return list of default candidates >+ */ >+ private Set getDefaultCandidates(IResource resource) { >+ collectConfigurationTypeContext(); >+ IPath resourcePath = resource.getFullPath(); >+ ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); >+ Set set = new HashSet(); >+ try { >+ ILaunchConfiguration[] configurations = manager.getLaunchConfigurations(); >+ ILaunchConfiguration configuration = null; >+ IResource[] resources = null; >+ for (int i = 0; i < configurations.length; i++) { >+ configuration = configurations[i]; >+ resources = configuration.getMappedResources(); >+ if (resources != null) { >+ for (int j = 0; j < resources.length; j++) { >+ if (resource.equals(resources[j]) || resourcePath.isPrefixOf(resources[j].getFullPath())) { >+ set.add(configuration.getWorkingCopy()); >+ break; >+ } >+ } >+ } else { >+ // 1. similar to launch dialog - if no resource mapping, display the config >+ if (!"org.eclipse.ui.externaltools".equals(configuration.getType().getCategory())) { //$NON-NLS-1$ >+ set.add(configuration.getWorkingCopy()); >+ fConfigurationTypeContext.add(configuration.getType()); >+ } >+ } >+ } >+ } catch (CoreException e) { >+ set.clear(); >+ DebugUIPlugin.log(e); >+ } >+ return set; >+ } >+ >+ /** >+ * Collects the default set of <code>ILaunchConfigurationType</code>s based on the mapping from launch shortcuts. >+ * We also must consider those types of launch configurations that do not support a resource mapping, as those types might >+ * apply but we can't be sure >+ */ >+ private void collectConfigurationTypeContext() { >+ if(fConfigurationTypeContext == null) { >+ fConfigurationTypeContext = new HashSet(); >+ fConfigurationTypeContext.addAll(DebugUIPlugin.getDefault().getLaunchConfigurationManager().getApplicableConfigurationTypes(getResource())); >+ } >+ } >+ >+ /** >+ * 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) { >+ // TODO: This will result in an NPE in non-standard groups >+ ILaunchGroup group = DebugUITools.getLaunchGroup(configuration, ILaunchManager.RUN_MODE); >+ if (group == null) { >+ group = DebugUITools.getLaunchGroup(configuration, ILaunchManager.DEBUG_MODE); >+ } >+ return DebugUIPlugin.openLaunchConfigurationPropertiesDialog(getShell(), configuration, group.getIdentifier(), getConfigurationNames(), null); >+ } >+ >+ /** >+ * Create a new configuration >+ */ >+ private void handleNew() { >+ List avail = new ArrayList(fConfigurationTypeContext); >+ Collections.sort(avail, new Comparator() { >+ public int compare(Object o1, Object o2) { >+ ILaunchConfigurationType t1 = (ILaunchConfigurationType) o1; >+ ILaunchConfigurationType t2 = (ILaunchConfigurationType) o2; >+ return t1.getName().compareTo(t2.getName()); >+ } >+ >+ }); >+ 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(avail); >+ 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/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/preferences/ContextualLaunchPreferencePage.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/preferences/ContextualLaunchPreferencePage.java >diff -N ui/org/eclipse/debug/internal/ui/preferences/ContextualLaunchPreferencePage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/preferences/ContextualLaunchPreferencePage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,113 @@ >+/******************************************************************************* >+ * 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 ContextualLaunchPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { >+ >+ /** >+ * a list of the field editors >+ * @since 3.2 >+ */ >+ private List fFieldEditors; >+ >+ /** >+ * The default constructor >+ */ >+ public ContextualLaunchPreferencePage() { >+ 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 >+ initFieldEditors(); >+ return comp; >+ } >+ >+ /** >+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) >+ */ >+ public void init(IWorkbench workbench) {} >+ >+ /** >+ * Initializes the field editors to their values >+ * @since 3.2 >+ */ >+ private void initFieldEditors() { >+ FieldEditor editor; >+ for(int i = 0; i < fFieldEditors.size(); i++) { >+ editor = (FieldEditor)fFieldEditors.get(i); >+ editor.setPreferenceStore(getPreferenceStore()); >+ editor.load(); >+ } >+ } >+ >+ /** >+ * @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/actions/ContextLaunchingContributedAction.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/actions/ContextLaunchingContributedAction.java >diff -N ui/org/eclipse/debug/internal/ui/actions/ContextLaunchingContributedAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/actions/ContextLaunchingContributedAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,56 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.debug.internal.ui.actions; >+ >+import org.eclipse.jface.action.IAction; >+import org.eclipse.jface.viewers.ISelection; >+import org.eclipse.swt.widgets.Event; >+import org.eclipse.ui.IActionDelegate2; >+ >+/** >+ * A stub action >+ * >+ * @since 3.3 >+ * EXPERIMENTAL >+ */ >+public class ContextLaunchingContributedAction implements IActionDelegate2 { >+ >+ /** >+ * Constructor >+ */ >+ public ContextLaunchingContributedAction() {} >+ >+ /** >+ * @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) {} >+ >+ /** >+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) >+ */ >+ public void run(IAction action) {} >+ >+ /** >+ * @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/launchConfigurations/ContextLaunchAction.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/launchConfigurations/ContextLaunchAction.java >diff -N ui/org/eclipse/debug/internal/ui/launchConfigurations/ContextLaunchAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/ContextLaunchAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,64 @@ >+/******************************************************************************* >+ * 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 org.eclipse.debug.internal.ui.DebugUIPlugin; >+import org.eclipse.jface.action.Action; >+import org.eclipse.jface.action.IAction; >+import org.eclipse.jface.viewers.ISelection; >+import org.eclipse.ui.IWorkbenchWindow; >+import org.eclipse.ui.IWorkbenchWindowActionDelegate; >+ >+/** >+ * A wrapper class for a context launching toolbar action >+ * >+ * @since 3.3 >+ * EXPERIMENTAL >+ */ >+public class ContextLaunchAction extends Action implements IWorkbenchWindowActionDelegate { >+ >+ private String fId = null; >+ >+ /** >+ * Constructor >+ * @param id >+ */ >+ public ContextLaunchAction(String id) { >+ fId = id; >+ LaunchGroupExtension extension = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(id); >+ if (extension != null) { >+ setText(extension.getLabel()); >+ setImageDescriptor(extension.getImageDescriptor()); >+ } >+ } >+ >+ /** >+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose() >+ */ >+ public void dispose() { >+ fId = null; >+ } >+ >+ /** >+ * @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) >+ */ >+ public void run(IAction action) {} >+ >+ /** >+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) >+ */ >+ public void selectionChanged(IAction action, ISelection selection) {} >+} >#P org.eclipse.jdt.debug.ui >Index: ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaMainTab.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaMainTab.java,v >retrieving revision 1.44 >diff -u -r1.44 JavaMainTab.java >--- ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaMainTab.java 2 Jan 2007 20:26:16 -0000 1.44 >+++ ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaMainTab.java 9 Jan 2007 22:12:16 -0000 >@@ -53,7 +53,7 @@ > * A launch configuration tab that displays and edits project and > * main type name launch configuration attributes. > * <p> >- * This class may be instantiated. This class is not intended to be subclassed. >+ * This class may be instantiated. This class is not intended to be sub-classed. > * </p> > * @since 3.2 > */
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