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 46244 Details for
Bug 137057
[launching] Allow user to resolve launcher to user for config/mode when > 1
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
first run
137057 (text/plain), 95.79 KB, created by
Michael Rennie
on 2006-07-13 10:50:01 EDT
(
hide
)
Description:
first run
Filename:
MIME Type:
Creator:
Michael Rennie
Created:
2006-07-13 10:50:01 EDT
Size:
95.79 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.debug.core >Index: schema/launchDelegates.exsd >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/schema/launchDelegates.exsd,v >retrieving revision 1.8 >diff -u -r1.8 launchDelegates.exsd >--- schema/launchDelegates.exsd 14 Jun 2005 15:38:54 -0000 1.8 >+++ schema/launchDelegates.exsd 13 Jul 2006 14:41:23 -0000 >@@ -1,155 +1,165 @@ >-<?xml version='1.0' encoding='UTF-8'?> >-<!-- Schema file written by PDE --> >-<schema targetNamespace="org.eclipse.debug.core"> >-<annotation> >- <appInfo> >- <meta.schema plugin="org.eclipse.debug.core" id="launchDelegates" name="Launch Delegates"/> >- </appInfo> >- <documentation> >- This extension point provides a mechanism for contributing a launch delegate to an existing launch configuration type for one or more launch modes. Since launch modes are extensible, it may be neccessary to contribute additional launch delegates to an existing launch configuration type. Each launch delegate is contributed for a specific launch configuration type. A launch delegate supports one or more launch modes, and specifies a delegate responsible for the implementation of launching. >- </documentation> >- </annotation> >- >- <element name="extension"> >- <complexType> >- <sequence> >- <element ref="launchDelegate" minOccurs="0" maxOccurs="unbounded"/> >- </sequence> >- <attribute name="point" type="string" use="required"> >- <annotation> >- <documentation> >- a fully qualified identifier of the target extension point >- </documentation> >- </annotation> >- </attribute> >- <attribute name="id" type="string"> >- <annotation> >- <documentation> >- an optional identifier of the extension instance >- </documentation> >- </annotation> >- </attribute> >- <attribute name="name" type="string"> >- <annotation> >- <documentation> >- an optional name of the extension instance >- </documentation> >- </annotation> >- </attribute> >- </complexType> >- </element> >- >- <element name="launchDelegate"> >- <annotation> >- <appInfo> >- <meta.element labelAttribute="name"/> >- </appInfo> >- </annotation> >- <complexType> >- <sequence> >- </sequence> >- <attribute name="id" type="string" use="required"> >- <annotation> >- <documentation> >- specifies a unique identifier for this launch delegate. >- </documentation> >- </annotation> >- </attribute> >- <attribute name="delegate" type="string" use="required"> >- <annotation> >- <documentation> >- specifies the fully qualified name of the Java class that implements <code>ILaunchConfigurationDelegate</code>. >-Launch configuration instances of this delegate's type will delegate to instances of this class to perform launching. >- </documentation> >- <appInfo> >- <meta.attribute kind="java" basedOn="org.eclipse.debug.core.model.ILaunchConfigurationDelegate"/> >- </appInfo> >- </annotation> >- </attribute> >- <attribute name="modes" type="string" use="required"> >- <annotation> >- <documentation> >- specifies a comma-separated list of the modes this lauch delegate supports. >- </documentation> >- </annotation> >- </attribute> >- <attribute name="type" type="string" use="required"> >- <annotation> >- <documentation> >- identifier of an existing launch configuration type that this launch delegate is capable of launching. >- </documentation> >- </annotation> >- </attribute> >- <attribute name="sourcePathComputerId" type="string"> >- <annotation> >- <documentation> >- The unique identifier of a sourcePathComputer extension that is used to compute a default source lookup path for launch configurations of this type. Since 3.1, this attribute cab be specified in a launchDelegate extension when unspecified in the assocaited launchConfigurationType extension. Only one source path computer can be specified per launch configuration type. >- </documentation> >- </annotation> >- </attribute> >- <attribute name="sourceLocatorId" type="string"> >- <annotation> >- <documentation> >- The unique identifier of a sourceLocator extension that is used to create the source locator for sessions launched using launch configurations of this type. Since 3.1, this attribute can be specified in a launchDelegate extension when unspecified in the assocaited launchConfigurationType extension. Only one source locater can be specified per launch configuration type. >- </documentation> >- </annotation> >- </attribute> >- </complexType> >- </element> >- >- <annotation> >- <appInfo> >- <meta.section type="since"/> >- </appInfo> >- <documentation> >- 3.0 >- </documentation> >- </annotation> >- >- <annotation> >- <appInfo> >- <meta.section type="examples"/> >- </appInfo> >- <documentation> >- The following is an example of a launch delegate extension point: >- >-<p> >-<pre> >- <extension point="org.eclipse.debug.core.launchDelegates"> >- <launchDelegate >- id="com.example.ExampleProfileDelegate" >- delegate="com.example.ExampleProfileDelegate" >- type="org.eclipse.jdt.launching.localJavaApplication" >- modes="profile"> >- </launchDelegate> >- </extension> >-</pre> >-</p> >- >-In the example above, the specified launch delegate is contributed to launch Java applications in profile mode. >- </documentation> >- </annotation> >- >- <annotation> >- <appInfo> >- <meta.section type="apiInfo"/> >- </appInfo> >- <documentation> >- Value of the attribute <b>delegate</b> must be a fully qualified name of a Java class that implements the interface <b>org.eclipse.debug.core.model.ILaunchConfigurationDelegate</b>. >- </documentation> >- </annotation> >- >- <annotation> >- <appInfo> >- <meta.section type="copyright"/> >- </appInfo> >- <documentation> >- Copyright (c) 2000, 2005 IBM Corporation and others.<br> >-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 >-<a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a> >- </documentation> >- </annotation> >- >-</schema> >+<?xml version='1.0' encoding='UTF-8'?> >+<!-- Schema file written by PDE --> >+<schema targetNamespace="org.eclipse.debug.core"> >+<annotation> >+ <appInfo> >+ <meta.schema plugin="org.eclipse.debug.core" id="launchDelegates" name="Launch Delegates"/> >+ </appInfo> >+ <documentation> >+ This extension point provides a mechanism for contributing a launch delegate to an existing launch configuration type for one or more launch modes. Since launch modes are extensible, it may be neccessary to contribute additional launch delegates to an existing launch configuration type. Each launch delegate is contributed for a specific launch configuration type. A launch delegate supports one or more launch modes, and specifies a delegate responsible for the implementation of launching. >+ </documentation> >+ </annotation> >+ >+ <element name="extension"> >+ <complexType> >+ <sequence> >+ <element ref="launchDelegate" minOccurs="0" maxOccurs="unbounded"/> >+ </sequence> >+ <attribute name="point" type="string" use="required"> >+ <annotation> >+ <documentation> >+ a fully qualified identifier of the target extension point >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="id" type="string"> >+ <annotation> >+ <documentation> >+ an optional identifier of the extension instance >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="name" type="string"> >+ <annotation> >+ <documentation> >+ an optional name of the extension instance >+ </documentation> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <element name="launchDelegate"> >+ <annotation> >+ <appInfo> >+ <meta.element labelAttribute="name"/> >+ </appInfo> >+ </annotation> >+ <complexType> >+ <sequence> >+ </sequence> >+ <attribute name="id" type="string" use="required"> >+ <annotation> >+ <documentation> >+ specifies a unique identifier for this launch delegate. >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="delegate" type="string" use="required"> >+ <annotation> >+ <documentation> >+ specifies the fully qualified name of the Java class that implements <code>ILaunchConfigurationDelegate</code>. >+Launch configuration instances of this delegate's type will delegate to instances of this class to perform launching. >+ </documentation> >+ <appInfo> >+ <meta.attribute kind="java" basedOn="org.eclipse.debug.core.model.ILaunchConfigurationDelegate"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ <attribute name="modes" type="string" use="required"> >+ <annotation> >+ <documentation> >+ specifies a comma-separated list of the modes this lauch delegate supports. >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="type" type="string" use="required"> >+ <annotation> >+ <documentation> >+ identifier of an existing launch configuration type that this launch delegate is capable of launching. >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="sourcePathComputerId" type="string"> >+ <annotation> >+ <documentation> >+ The unique identifier of a sourcePathComputer extension that is used to compute a default source lookup path for launch configurations of this type. Since 3.1, this attribute cab be specified in a launchDelegate extension when unspecified in the assocaited launchConfigurationType extension. Only one source path computer can be specified per launch configuration type. >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="sourceLocatorId" type="string"> >+ <annotation> >+ <documentation> >+ The unique identifier of a sourceLocator extension that is used to create the source locator for sessions launched using launch configurations of this type. Since 3.1, this attribute can be specified in a launchDelegate extension when unspecified in the assocaited launchConfigurationType extension. Only one source locater can be specified per launch configuration type. >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="name" type="string"> >+ <annotation> >+ <documentation> >+ A human readable name for the delegate >+ </documentation> >+ <appInfo> >+ <meta.attribute translatable="true"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="since"/> >+ </appInfo> >+ <documentation> >+ 3.0 >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="examples"/> >+ </appInfo> >+ <documentation> >+ The following is an example of a launch delegate extension point: >+ >+<p> >+<pre> >+ <extension point="org.eclipse.debug.core.launchDelegates"> >+ <launchDelegate >+ id="com.example.ExampleProfileDelegate" >+ delegate="com.example.ExampleProfileDelegate" >+ type="org.eclipse.jdt.launching.localJavaApplication" >+ modes="profile"> >+ </launchDelegate> >+ </extension> >+</pre> >+</p> >+ >+In the example above, the specified launch delegate is contributed to launch Java applications in profile mode. >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="apiInfo"/> >+ </appInfo> >+ <documentation> >+ Value of the attribute <b>delegate</b> must be a fully qualified name of a Java class that implements the interface <b>org.eclipse.debug.core.model.ILaunchConfigurationDelegate</b>. >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="copyright"/> >+ </appInfo> >+ <documentation> >+ Copyright (c) 2000, 2005 IBM Corporation and others.<br> >+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 >+<a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a> >+ </documentation> >+ </annotation> >+ >+</schema> >Index: core/org/eclipse/debug/internal/core/LaunchConfigurationType.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchConfigurationType.java,v >retrieving revision 1.33 >diff -u -r1.33 LaunchConfigurationType.java >--- core/org/eclipse/debug/internal/core/LaunchConfigurationType.java 8 May 2006 19:48:58 -0000 1.33 >+++ core/org/eclipse/debug/internal/core/LaunchConfigurationType.java 13 Jul 2006 14:41:23 -0000 >@@ -115,7 +115,7 @@ > * > * @return this type's configuration element > */ >- protected IConfigurationElement getConfigurationElement() { >+ public IConfigurationElement getConfigurationElement() { > return fElement; > } > >@@ -162,6 +162,10 @@ > if (!supportsMode(mode)) { > throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.LaunchConfigurationType_9, new String[] {mode, getIdentifier()}), null)); > } >+ ILaunchConfigurationDelegate ld = DebugPlugin.getDefault().getLaunchManager().getPreferredDelegate(this, mode); >+ if(ld != null) { >+ return ld; >+ } > if (fDelegates == null) { > // initialize delegate table with base modes > fDelegates = new Hashtable(3); >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.165 >diff -u -r1.165 LaunchManager.java >--- core/org/eclipse/debug/internal/core/LaunchManager.java 21 Jun 2006 19:32:09 -0000 1.165 >+++ core/org/eclipse/debug/internal/core/LaunchManager.java 13 Jul 2006 14:41:23 -0000 >@@ -69,6 +69,7 @@ > import org.eclipse.core.runtime.ListenerList; > import org.eclipse.core.runtime.Platform; > import org.eclipse.core.runtime.PlatformObject; >+import org.eclipse.core.runtime.Preferences; > import org.eclipse.core.runtime.SafeRunner; > import org.eclipse.core.runtime.Status; > import org.eclipse.core.variables.VariablesPlugin; >@@ -86,6 +87,7 @@ > import org.eclipse.debug.core.IStatusHandler; > import org.eclipse.debug.core.model.IDebugTarget; > import org.eclipse.debug.core.model.IDisconnect; >+import org.eclipse.debug.core.model.ILaunchConfigurationDelegate; > import org.eclipse.debug.core.model.IPersistableSourceLocator; > import org.eclipse.debug.core.model.IProcess; > import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector; >@@ -136,6 +138,24 @@ > private static final String EMPTY_STRING = ""; //$NON-NLS-1$ > > /** >+ * Constant for the root preference node for saving preferred launch delegates >+ * @since 3.3 >+ */ >+ private static final String PREFERRED_DELEGATE = "preferredDelegates"; //$NON-NLS-1$ >+ >+ /** >+ * Constant for the delegate provider attribute when saving preferred delegates >+ * @since 3.3 >+ */ >+ private static final String DELEGATE_PROVIDER = "provider"; //$NON-NLS-1$ >+ >+ /** >+ * Constant for the mode attribute when saving preferred delegates >+ * @since 3.3 >+ */ >+ private static final String DELEGATE_MODE = "mode"; //$NON-NLS-1$ >+ >+ /** > * Status code for which a UI prompter is registered. > * > * @since 3.2 >@@ -150,7 +170,85 @@ > */ > protected static final IStatus deleteAssociatedLaunchConfigs = new Status(IStatus.INFO, DEBUG_CORE, 225, EMPTY_STRING, null); > >+ /** >+ * Simple class to collect information for a single preferred delegate >+ * @since 3.3 >+ */ >+ class PreferredDelegate { >+ private String fMode; >+ private ILaunchConfigurationDelegate fDelegate; >+ private ILaunchConfigurationType fType; >+ private String fProvider; >+ >+ public PreferredDelegate(ILaunchConfigurationType type, ILaunchConfigurationDelegate delegate, String mode, String provider) { >+ fMode = mode; >+ fDelegate = delegate; >+ fType = type; >+ fProvider = provider; >+ } >+ >+ public void setProvider(String provider) { >+ fProvider = provider; >+ } >+ >+ public String getMode() { >+ return fMode; >+ } >+ >+ public String getProvider() { >+ return fProvider; >+ } >+ >+ public ILaunchConfigurationDelegate getDelegeate() { >+ return fDelegate; >+ } >+ >+ public void setDelegate(ILaunchConfigurationDelegate delegate) { >+ fDelegate = delegate; >+ } >+ >+ public ILaunchConfigurationType getType() { >+ return fType; >+ } >+ } > >+ /** >+ * Simple class to describe a list of conflicting delegates for a specific type and mode >+ * @since 3.3 >+ */ >+ class ConflictingDelegate { >+ private String fMode; >+ private ILaunchConfigurationType fType; >+ private String fProvider; >+ /** map: <provider _id, delegate> **/ >+ private HashMap fConflicts; >+ >+ public ConflictingDelegate(ILaunchConfigurationType type, String mode, HashMap conflicts) { >+ fType = type; >+ fMode = mode; >+ fConflicts = conflicts; >+ } >+ >+ public void setProvider(String provider) { >+ fProvider = provider; >+ } >+ >+ public ILaunchConfigurationType getType() { >+ return fType; >+ } >+ >+ public String getMode() { >+ return fMode; >+ } >+ >+ public HashMap getConflicts() { >+ return fConflicts; >+ } >+ >+ public String getProvider() { >+ return fProvider; >+ } >+ } > > /** > * Notifies a launch config listener in a safe runnable to handle >@@ -529,6 +627,23 @@ > private List fLaunchConfigurationTypes = null; > > /** >+ * List of <code>PreferredDelegate</code> objects >+ * @since 3.3 >+ */ >+ private List fPreferredDelegates = null; >+ >+ /** >+ * List of <code>ConflictingDelegate</code> objects >+ * @since 3.3 >+ */ >+ private List fConflictingDelegates = null; >+ >+ /** >+ * The last chosen provider id, which allows us to maintain similar default choices for providers. >+ */ >+ private String fLastChosenDefaultProvider = null; >+ >+ /** > * Launch configuration cache. Keys are <code>LaunchConfiguration</code>, > * values are <code>LaunchConfigurationInfo</code>. > */ >@@ -1024,7 +1139,58 @@ > } > > /** >- * @see ILaunchManager#getDebugTargets() >+ * @see org.eclipse.debug.core.ILaunchManager#getContributedDelegates(java.lang.String) >+ */ >+ public synchronized List getContributedDelegates(String mode) { >+ ArrayList list = new ArrayList(0); >+ List delegates = getContributedDelegates(); >+ ContributedDelegate cd = null; >+ for(int i = 0; i < delegates.size(); i++) { >+ cd = (ContributedDelegate) delegates.get(i); >+ if(cd.getModes().contains(mode)) { >+ list.add(cd); >+ } >+ } >+ return list; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.ILaunchManager#getContributedDelegates(org.eclipse.debug.core.ILaunchConfigurationType, java.lang.String) >+ */ >+ public synchronized List getContributedDelegates(ILaunchConfigurationType type, String mode) throws CoreException { >+ if(!type.supportsMode(mode)) { >+ throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.LaunchConfigurationType_9, new String[] {mode, type.getIdentifier()}), null)); >+ } >+ ArrayList list = new ArrayList(0); >+ List delegates = getContributedDelegates(); >+ ContributedDelegate cd = null; >+ for(int i = 0; i < delegates.size(); i++) { >+ cd = (ContributedDelegate) delegates.get(i); >+ if(cd.getModes().contains(mode) & cd.getLaunchConfigurationType().equals(type.getIdentifier())) { >+ list.add(cd); >+ } >+ } >+ return list; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.ILaunchManager#getContributedDelegates(org.eclipse.debug.core.ILaunchConfigurationType) >+ */ >+ public synchronized List getContributedDelegates(ILaunchConfigurationType type) throws CoreException { >+ ArrayList list = new ArrayList(0); >+ List delegates = getContributedDelegates(); >+ ContributedDelegate cd = null; >+ for(int i = 0; i < delegates.size(); i++) { >+ cd = (ContributedDelegate) delegates.get(i); >+ if(cd.getLaunchConfigurationType().equals(type.getIdentifier())) { >+ list.add(cd); >+ } >+ } >+ return list; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.ILaunchManager#getDebugTargets() > */ > public IDebugTarget[] getDebugTargets() { > synchronized (fLaunches) { >@@ -1540,7 +1706,7 @@ > } > > /** >- * Load comparator extensions. >+ * Load launch mode extensions. > * > * @exception CoreException if an exception occurs reading > * the extensions >@@ -1942,6 +2108,7 @@ > /** > * Terminates/Disconnects any active debug targets/processes. > * Clears launch configuration types. >+ * Saves and clears preferred launch delegates > */ > public void shutdown() { > fListeners = new ListenerList(); >@@ -1966,7 +2133,7 @@ > } > > clearAllLaunchConfigurations(); >- >+ clearPreferredLaunchDelegates(); > getWorkspace().removeResourceChangeListener(this); > } > >@@ -2017,5 +2184,300 @@ > } > } > >+ /** >+ * @see org.eclipse.debug.core.IPreferredLaunchDelegateManager#getPreferredDelegate(org.eclipse.debug.core.ILaunchConfigurationType, java.lang.String) >+ * @since 3.3 >+ */ >+ public ILaunchConfigurationDelegate getPreferredDelegate(ILaunchConfigurationType type, String mode) throws CoreException { >+ if(!type.supportsMode(mode)) { >+ throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.LaunchConfigurationType_9, new String[] {mode, type.getIdentifier()}), null)); >+ } >+ PreferredDelegate pd = findPreferredDelegate(type, mode); >+ if(pd != null) { >+ return pd.getDelegeate(); >+ } >+ return null; >+ } >+ >+ /** >+ * @see org.eclipse.debug.core.IPreferredLaunchDelegateManager#hasConflictingDelegates(org.eclipse.debug.core.ILaunchConfigurationType, java.lang.String) >+ * @since 3.3 >+ */ >+ public boolean hasConflictingDelegates(ILaunchConfigurationType type, String mode) throws CoreException { >+ if(!type.supportsMode(mode)) { >+ throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.LaunchConfigurationType_9, new String[] {mode, type.getIdentifier()}), null)); >+ } >+ return findConflictingDelegate(type, mode) != null; >+ } >+ >+ /** >+ * @see org.eclipse.debug.core.IPreferredLaunchDelegateManager#setPreferredDelegate(org.eclipse.debug.core.ILaunchConfigurationType, java.lang.String, org.eclipse.debug.core.model.ILaunchConfigurationDelegate) >+ * @since 3.3 >+ */ >+ public void setPreferredDelegate(ILaunchConfigurationType type, String mode, ILaunchConfigurationDelegate delegate, String provider) throws CoreException { >+ if(!type.supportsMode(mode)) { >+ throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.LaunchConfigurationType_9, new String[] {mode, type.getIdentifier()}), null)); >+ } >+ initializePreferredDelegates(); >+ PreferredDelegate pd = findPreferredDelegate(type, mode); >+ if(pd == null) { >+ fPreferredDelegates.add(new PreferredDelegate(type, delegate, mode, provider)); >+ } >+ else { >+ pd.setDelegate(delegate); >+ pd.setProvider(provider); >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.ILaunchManager#getConflictingDelegates(org.eclipse.debug.core.ILaunchConfigurationType, java.lang.String) >+ */ >+ public HashMap getConflictingDelegates(ILaunchConfigurationType type, String mode) throws CoreException { >+ if(!type.supportsMode(mode)) { >+ throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.LaunchConfigurationType_9, new String[] {mode, type.getIdentifier()}), null)); >+ } >+ ConflictingDelegate cd = findConflictingDelegate(type, mode); >+ if(cd != null) { >+ return cd.getConflicts(); >+ } >+ return new HashMap(0); >+ } >+ >+ /** >+ * @see org.eclipse.debug.core.IPreferredLaunchDelegateManager#removePreferredDelegate(org.eclipse.debug.core.ILaunchConfigurationType, java.lang.String) >+ * @since 3.3 >+ */ >+ public void removePreferredDelegate(ILaunchConfigurationType type, String mode) throws CoreException { >+ if(!type.supportsMode(mode)) { >+ throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.LaunchConfigurationType_9, new String[] {mode, type.getIdentifier()}), null)); >+ } >+ fPreferredDelegates.remove(findPreferredDelegate(type, mode)); >+ } >+ >+ /** >+ * Internal method for finding a <code>PreferredDelegate</code> item from a specified type and mode >+ * @param type the type to find >+ * @param mode the mode associated with the type >+ * @return the <code>PreferredDelegate</code> object or <code>null</code> if not found >+ * @since 3.3 >+ */ >+ private PreferredDelegate findPreferredDelegate(ILaunchConfigurationType type, String mode) throws CoreException { >+ PreferredDelegate prefer = null; >+ initializePreferredDelegates(); >+ for(int i = 0; i < fPreferredDelegates.size(); i++) { >+ prefer = (PreferredDelegate) fPreferredDelegates.get(i); >+ if(prefer.getType().getIdentifier().equals(type.getIdentifier()) & prefer.getMode().equals(mode)) { >+ return prefer; >+ } >+ } >+ // if at this stage we have none for conflicting types, pick some defaults. >+ //if a there is a shared provider accross multi conflicts try to choose that one to maintain consistency >+ if(hasConflictingDelegates(type, mode)) { >+ HashMap map = getConflictingDelegates(type, mode); >+ if(!map.containsKey(fLastChosenDefaultProvider)) { >+ for(Iterator iter = map.keySet().iterator(); iter.hasNext();) { >+ fLastChosenDefaultProvider = (String) iter.next(); >+ break; >+ } >+ } >+ prefer = new PreferredDelegate(type, (ILaunchConfigurationDelegate) map.get(fLastChosenDefaultProvider), mode, fLastChosenDefaultProvider); >+ fPreferredDelegates.add(prefer); >+ return prefer; >+ } >+ return null; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.ILaunchManager#getPreferredDelegateProvider(org.eclipse.debug.core.ILaunchConfigurationType, java.lang.String) >+ */ >+ public String getPreferredDelegateProvider(ILaunchConfigurationType type, String mode) throws CoreException { >+ if(!type.supportsMode(mode)) { >+ throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.LaunchConfigurationType_9, new String[] {mode, type.getIdentifier()}), null)); >+ } >+ PreferredDelegate pd = findPreferredDelegate(type, mode); >+ if(pd != null) { >+ return pd.getProvider(); >+ } >+ return null; >+ } >+ >+ /** >+ * Returns the <code>ConflictingDelegate</code> object associated with the specified type and given mode >+ * @param type the type to check for >+ * @param mode the mode for the type >+ * @return the <code>ConflictingDelegate</code> object or <code>null</code> if none >+ * @since 3.3 >+ */ >+ private ConflictingDelegate findConflictingDelegate(ILaunchConfigurationType type, String mode) { >+ ConflictingDelegate conflict = null; >+ initializeConflictingDelegates(); >+ for(int i = 0; i < fConflictingDelegates.size(); i++) { >+ conflict = (ConflictingDelegate) fConflictingDelegates.get(i); >+ if(type.getIdentifier().equals(conflict.getType().getIdentifier()) & mode.equals(conflict.getMode())) { >+ return conflict; >+ } >+ } >+ return null; >+ } >+ >+ /** >+ * initializes the cache of preferred launch delegates from the <code>DebugPlugin</code> preferences >+ * @since 3.3 >+ */ >+ private synchronized void initializePreferredDelegates() { >+ if(fPreferredDelegates == null) { >+ fPreferredDelegates = new ArrayList(0); >+ Preferences prefs = DebugPlugin.getDefault().getPluginPreferences(); >+ String docname = prefs.getString(DebugPlugin.PREF_PREFERRED_LAUNCH_DELEGATES); >+ if(!docname.equals(EMPTY_STRING)) { >+ try { >+ Element root = DebugPlugin.parseDocument(docname); >+ NodeList delegates = root.getChildNodes(); >+ Node child = null; >+ Element delegate = null; >+ ILaunchConfigurationType type = null; >+ String mode = null; >+ String provider = null; >+ List contributed = null; >+ ContributedDelegate cdelegate = null; >+ for(int i = 0; i < delegates.getLength(); i++) { >+ child = delegates.item(i); >+ if(child instanceof Element) { >+ delegate = (Element) child; >+ type = getLaunchConfigurationType(delegate.getNodeName()); >+ if(type != null) { >+ mode = delegate.getAttribute(DELEGATE_MODE); >+ provider = delegate.getAttribute(DELEGATE_PROVIDER); >+ if(provider != null && provider.equals(type.getIdentifier())) { >+ //use the default one (non-contributed) >+ fPreferredDelegates.add(new PreferredDelegate(type, type.getDelegate(mode), mode, provider)); >+ } >+ else { >+ //if we are not using the 'default' delegate search the contributed ones >+ contributed = getContributedDelegates(type, mode); >+ for(int j = 0; j < contributed.size(); j++) { >+ cdelegate = (ContributedDelegate) contributed.get(j); >+ if(cdelegate.getLaunchConfigurationType().equals(type.getIdentifier()) & cdelegate.getIdentifier().equals(provider)) { >+ fPreferredDelegates.add(new PreferredDelegate(type, cdelegate.getDelegate(), mode, cdelegate.getIdentifier())); >+ } >+ } >+ } >+ } >+ } >+ } >+ } >+ catch (CoreException e) {DebugPlugin.log(e);} >+ } >+ } >+ } >+ >+ /** >+ * initializes the cache of conflicting launch delegates >+ * @since 3.3 >+ */ >+ private synchronized void initializeConflictingDelegates() { >+ if(fConflictingDelegates == null) { >+ try { >+ fConflictingDelegates = new ArrayList(); >+ List types = getLaunchConfigurationTypeList(); >+ ILaunchConfigurationType type = null; >+ HashMap map = new HashMap(); >+ HashMap dels = null; >+ String mode = null; >+ Set modes = null; >+ Object obj = null; >+ List tmp = null; >+ ContributedDelegate contrib = null; >+ for(int i = 0; i < types.size(); i++) { >+ type = (ILaunchConfigurationType) types.get(i); >+ modes = type.getSupportedModes(); >+ //load up the default modes >+ for(Iterator imodes = modes.iterator(); imodes.hasNext();) { >+ mode = (String) imodes.next(); >+ obj = map.get(mode); >+ if(obj == null) { >+ dels = new HashMap(0); >+ } >+ else { >+ dels = (HashMap)obj; >+ } >+ dels.put(type.getIdentifier(), type.getDelegate(mode)); >+ map.put(mode, dels); >+ } >+ //now get all of the contributed ones for this type >+ tmp = getContributedDelegates(type); >+ for(int j = 0; j < tmp.size(); j++) { >+ contrib = (ContributedDelegate)tmp.get(j); >+ modes = contrib.getModes(); >+ for(Iterator imodes = modes.iterator(); imodes.hasNext();) { >+ mode = (String) imodes.next(); >+ obj = map.get(mode); >+ if(obj == null) { >+ dels = new HashMap(0); >+ } >+ else { >+ dels = (HashMap)obj; >+ } >+ if(dels.containsValue(contrib.getDelegate())) { >+ dels.remove(type.getIdentifier()); >+ } >+ dels.put(contrib.getIdentifier(), contrib.getDelegate()); >+ map.put(mode, dels); >+ } >+ } >+ //now for each mode in the map see if there are conflicts, if so add them to the list >+ for(Iterator iter = map.keySet().iterator(); iter.hasNext();) { >+ mode = (String)iter.next(); >+ dels = (HashMap)map.get(mode); >+ if(dels != null && dels.size() > 1) { >+ //we have a conflict >+ fConflictingDelegates.add(new ConflictingDelegate(type, mode, dels)); >+ } >+ } >+ map.clear(); >+ } >+ } >+ catch(CoreException e) {DebugPlugin.log(e);} >+ } >+ } > >+ /** >+ * Cleans up the caches used for the preferred delegates on shutdown >+ * Document elements are created as: >+ * <pre><config_type_id mode="" provider=""/></pre> >+ * Where provider can be either config_type_id or the id of the contributed delegate. >+ * @since 3.3 >+ */ >+ private void clearPreferredLaunchDelegates() { >+ if(fPreferredDelegates != null) { >+ try { >+ Preferences prefs = DebugPlugin.getDefault().getPluginPreferences(); >+ Document doc = DebugPlugin.newDocument(); >+ Element root = doc.createElement(PREFERRED_DELEGATE); >+ doc.appendChild(root); >+ Element child = null; >+ PreferredDelegate delegate = null; >+ for(int i = 0; i < fPreferredDelegates.size(); i++) { >+ delegate = (PreferredDelegate) fPreferredDelegates.get(i); >+ child = doc.createElement(delegate.getType().getIdentifier()); >+ child.setAttribute(DELEGATE_MODE, delegate.getMode()); >+ child.setAttribute(DELEGATE_PROVIDER, delegate.getProvider()); >+ root.appendChild(child); >+ } >+ try { >+ prefs.setValue(DebugPlugin.PREF_PREFERRED_LAUNCH_DELEGATES, serializeDocument(doc)); >+ DebugPlugin.getDefault().savePluginPreferences(); >+ } >+ catch (IOException ioe) {DebugPlugin.log(ioe);} >+ catch (TransformerException te) {DebugPlugin.log(te);} >+ } >+ catch (CoreException e) {DebugPlugin.log(e);} >+ fPreferredDelegates.clear(); >+ fPreferredDelegates = null; >+ } >+ if(fConflictingDelegates != null) { >+ fConflictingDelegates.clear(); >+ fConflictingDelegates = null; >+ } >+ } > } >Index: core/org/eclipse/debug/internal/core/ContributedDelegate.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ContributedDelegate.java,v >retrieving revision 1.9 >diff -u -r1.9 ContributedDelegate.java >--- core/org/eclipse/debug/internal/core/ContributedDelegate.java 8 May 2006 19:48:58 -0000 1.9 >+++ core/org/eclipse/debug/internal/core/ContributedDelegate.java 13 Jul 2006 14:41:23 -0000 >@@ -65,7 +65,7 @@ > * > * @return this delegate's configuration element > */ >- protected IConfigurationElement getConfigurationElement() { >+ public IConfigurationElement getConfigurationElement() { > return fElement; > } > >@@ -74,7 +74,7 @@ > * > * @return the set of modes specified in the configuration data > */ >- protected Set getModes() { >+ public Set getModes() { > if (fModes == null) { > String modes= getConfigurationElement().getAttribute("modes"); //$NON-NLS-1$ > if (modes == null) { >@@ -94,11 +94,11 @@ > * Returns the type identifier of launch configuration type this delegate is > * contributed to. > */ >- protected String getLaunchConfigurationType() { >+ public String getLaunchConfigurationType() { > return getConfigurationElement().getAttribute("type"); //$NON-NLS-1$ > } > >- protected ILaunchConfigurationDelegate getDelegate() throws CoreException { >+ public ILaunchConfigurationDelegate getDelegate() throws CoreException { > if (fDelegate == null) { > Object object = getConfigurationElement().createExecutableExtension("delegate"); //$NON-NLS-1$ > if (object instanceof ILaunchConfigurationDelegate) { >@@ -113,7 +113,7 @@ > /** > * Returns the identifier of this extension point. > */ >- protected String getIdentifier() { >+ public String getIdentifier() { > return getConfigurationElement().getAttribute("id"); //$NON-NLS-1$ > } > >@@ -126,7 +126,7 @@ > * > * @since 3.1 > */ >- protected String getSourcePathComputerId() { >+ public String getSourcePathComputerId() { > return getConfigurationElement().getAttribute("sourcePathComputerId"); //$NON-NLS-1$ > } > >@@ -139,7 +139,7 @@ > * > * @since 3.1 > */ >- protected String getSourceLocaterId() { >+ public String getSourceLocaterId() { > return getConfigurationElement().getAttribute("sourceLocatorId"); //$NON-NLS-1$ > } > } >Index: core/org/eclipse/debug/core/ILaunchManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchManager.java,v >retrieving revision 1.58 >diff -u -r1.58 ILaunchManager.java >--- core/org/eclipse/debug/core/ILaunchManager.java 12 Jun 2006 20:42:23 -0000 1.58 >+++ core/org/eclipse/debug/core/ILaunchManager.java 13 Jul 2006 14:41:23 -0000 >@@ -11,11 +11,14 @@ > package org.eclipse.debug.core; > > >+import java.util.HashMap; >+import java.util.List; > import java.util.Map; > > import org.eclipse.core.resources.IFile; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.debug.core.model.IDebugTarget; >+import org.eclipse.debug.core.model.ILaunchConfigurationDelegate; > import org.eclipse.debug.core.model.IPersistableSourceLocator; > import org.eclipse.debug.core.model.IProcess; > import org.eclipse.debug.core.sourcelookup.ISourceContainerType; >@@ -127,6 +130,32 @@ > * @return an array of debug targets > */ > public IDebugTarget[] getDebugTargets(); >+ /** >+ * return a list of the contrbuted delegates for the specified mode >+ * @param mode the mode to get delegates for >+ * @return a list of contributed delegates for the given mode or an empty list if none are found >+ * @since 3.3 >+ */ >+ public List getContributedDelegates(String mode); >+ /** >+ * returns the contributed delegates to the specified type with the given mode. >+ * If the type does not support the mode a <code>CoreException</code> is thrown >+ * @param type the type to check >+ * @param mode the mode for the type >+ * @return a listing of contributed delegates for the given type in the specified mode, or an empty list if none are found >+ * @throws CoreException >+ * @since 3.3 >+ */ >+ public List getContributedDelegates(ILaunchConfigurationType type, String mode) throws CoreException; >+ /** >+ * returns the contributed delegates to the specified type. >+ * @param type the type to check >+ * @param mode the mode for the type >+ * @return a listing of contributed delegates for the given type, or an empty list if none are found >+ * @throws CoreException >+ * @since 3.3 >+ */ >+ public List getContributedDelegates(ILaunchConfigurationType type) throws CoreException; > /** > * Returns an array of environment variables to be used when > * launching the given configuration or <code>null</code> if unspecified. >@@ -236,6 +265,70 @@ > public ILaunchConfiguration[] getMigrationCandidates() throws CoreException; > > /** >+ * Returns the preferred <code>ILaunchConfigurationDelegate</code> for the given type and mode >+ * @param type the type to get the preferred delegate for >+ * @param mode the mode the delegate applies to >+ * @return the preferred delegate or <code>null</code> if there isn't one or if the type does not support the mode >+ * @throws CoreException >+ * @since 3.3 >+ */ >+ public ILaunchConfigurationDelegate getPreferredDelegate(ILaunchConfigurationType type, String mode) throws CoreException; >+ >+ /** >+ * Returns the id of the provider for the preferred delegate for the specified type and mode >+ * @param type the type to find the preferred delegate for >+ * @param mode the mode for the type >+ * @return the id of the provider for the preferred delegate or <code>null</code> if not found >+ * @throws CoreException >+ * @since 3.3 >+ */ >+ public String getPreferredDelegateProvider(ILaunchConfigurationType type, String mode) throws CoreException; >+ >+ /** >+ * Allows a preferred delegate to be set for the given type under the specified mode >+ * If the specified mode is not supported by the type a <code>CoreException</code> is thrown >+ * @param type the type set the delegate for >+ * @param mode the mode for the type >+ * @param delegate the delegate to set as the preferred one >+ * @throws CoreException >+ * @since 3.3 >+ */ >+ public void setPreferredDelegate(ILaunchConfigurationType type, String mode, ILaunchConfigurationDelegate delegate, String provider) throws CoreException; >+ >+ /** >+ * Allows a preferred delegate to be removed from the listing of delegates >+ * If the specified mode is not supported by the given type a <code>CoreException</code> is thrown. >+ * @param type the type to remove >+ * @param mode the mode for the type >+ * @throws CoreException >+ * @since 3.3 >+ */ >+ public void removePreferredDelegate(ILaunchConfigurationType type, String mode) throws CoreException; >+ >+ /** >+ * Determines if the specified type and mode combination have conflicting launch configuration delegates >+ * A conflict is defined as a given launch configuration type having two or more launch delegates for the same mode. >+ * @param type the type to check for >+ * @param mode the mode for the type >+ * @return true if the specified type and mode have conflicting launch delegate, false otherwise >+ * @throws CoreException >+ * @since 3.3 >+ */ >+ public boolean hasConflictingDelegates(ILaunchConfigurationType type, String mode) throws CoreException; >+ >+ /** >+ * Return a mapping of all of the conflicting launch delegates for the specified type in the given mode >+ * Map formulation: <code>(String type_id, HashMap(String provider_id, ILaunchConfigurationDelegate delegate))</code> >+ * If no conflicting delegates are found an empty map is returned. >+ * @param type the type to check >+ * @param mode the mode for the type >+ * @return a mapping of provider id to delegate of the conflicting delegates. >+ * @throws CoreException >+ * @since 3.3 >+ */ >+ public HashMap getConflictingDelegates(ILaunchConfigurationType type, String mode) throws CoreException; >+ >+ /** > * When a launch configuration is created or moved, registered launch > * configuration listeners (see <code>ILaunchConfigurationListener</code>) > * are notified of an add notification for the new configuration. If the >Index: core/org/eclipse/debug/core/DebugPlugin.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java,v >retrieving revision 1.137 >diff -u -r1.137 DebugPlugin.java >--- core/org/eclipse/debug/core/DebugPlugin.java 21 Jun 2006 19:32:09 -0000 1.137 >+++ core/org/eclipse/debug/core/DebugPlugin.java 13 Jul 2006 14:41:23 -0000 >@@ -15,7 +15,6 @@ > import java.io.File; > import java.io.IOException; > import java.io.InputStream; >-import com.ibm.icu.text.MessageFormat; > import java.util.ArrayList; > import java.util.HashMap; > import java.util.Iterator; >@@ -61,6 +60,8 @@ > import org.xml.sax.SAXException; > import org.xml.sax.helpers.DefaultHandler; > >+import com.ibm.icu.text.MessageFormat; >+ > /** > * There is one instance of the debug plug-in available from > * <code>DebugPlugin.getDefault()</code>. The debug plug-in provides: >@@ -86,6 +87,13 @@ > private static final String PI_DEBUG_CORE = "org.eclipse.debug.core"; //$NON-NLS-1$ > > /** >+ * Defines the pref name for the preferred launch delegates section >+ * >+ * @since 3.3 >+ */ >+ public static final String PREF_PREFERRED_LAUNCH_DELEGATES = "preferredLaunchDelegates"; //$NON-NLS-1$ >+ >+ /** > * Simple identifier constant (value <code>"launchConfigurationTypes"</code>) > * for the launch configuration types extension point. > * >@@ -580,7 +588,6 @@ > if (fMemoryBlockManager != null) { > fMemoryBlockManager.shutdown(); > } >- > fEventListeners.clear(); > > if (fEventFilters != null) { >#P org.eclipse.jdt.debug.ui >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug.ui/plugin.xml,v >retrieving revision 1.417 >diff -u -r1.417 plugin.xml >--- plugin.xml 10 Jul 2006 15:00:37 -0000 1.417 >+++ plugin.xml 13 Jul 2006 14:41:26 -0000 >@@ -1838,10 +1838,11 @@ > <extension > point="org.eclipse.debug.ui.launchConfigurationTabGroups"> > <launchConfigurationTabGroup >- type="org.eclipse.jdt.launching.localJavaApplication" >- helpContextId="org.eclipse.jdt.debug.ui.launchConfigHelpContext.local_java_application" > class="org.eclipse.jdt.internal.debug.ui.launcher.LocalJavaApplicationTabGroup" >- id="org.eclipse.jdt.debug.ui.launchConfigurationTabGroup.localJavaApplication"> >+ helpContextId="org.eclipse.jdt.debug.ui.launchConfigHelpContext.local_java_application" >+ id="org.eclipse.jdt.debug.ui.launchConfigurationTabGroup.localJavaApplication" >+ launchDelegate="org.eclipse.jdt.launching.JavaLaunchDelegate" >+ type="org.eclipse.jdt.launching.localJavaApplication"> > <launchMode > mode="debug" > perspective="org.eclipse.debug.ui.DebugPerspective" >@@ -1853,17 +1854,19 @@ > </launchMode> > </launchConfigurationTabGroup> > <launchConfigurationTabGroup >- type="org.eclipse.jdt.launching.remoteJavaApplication" >+ class="org.eclipse.jdt.internal.debug.ui.launcher.RemoteJavaApplicationTabGroup" > description="%remoteJavaApplicationTabGroupDescription" > helpContextId="org.eclipse.jdt.debug.ui.launchConfigHelpContext.remote_java_application" >- class="org.eclipse.jdt.internal.debug.ui.launcher.RemoteJavaApplicationTabGroup" >- id="org.eclipse.jdt.debug.ui.launchConfigurationTabGroup.remoteJavaApplication"> >+ id="org.eclipse.jdt.debug.ui.launchConfigurationTabGroup.remoteJavaApplication" >+ launchDelegate="org.eclipse.jdt.internal.launching.JavaRemoteApplicationLaunchConfigurationDelegate" >+ type="org.eclipse.jdt.launching.remoteJavaApplication"> > </launchConfigurationTabGroup> > <launchConfigurationTabGroup >- type="org.eclipse.jdt.launching.javaApplet" >- helpContextId="org.eclipse.jdt.debug.ui.launchConfigHelpContext.java_applet" > class="org.eclipse.jdt.internal.debug.ui.launcher.JavaAppletTabGroup" >- id="org.eclipse.jdt.debug.ui.launchConfigurationTabGroup.javaApplet"> >+ helpContextId="org.eclipse.jdt.debug.ui.launchConfigHelpContext.java_applet" >+ id="org.eclipse.jdt.debug.ui.launchConfigurationTabGroup.javaApplet" >+ launchDelegate="org.eclipse.jdt.internal.launching.JavaAppletLaunchConfigurationDelegate" >+ type="org.eclipse.jdt.launching.javaApplet"> > <launchMode > mode="debug" > perspective="org.eclipse.debug.ui.DebugPerspective" >#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.86 >diff -u -r1.86 contexts_Debugger.xml >--- contexts_Debugger.xml 1 Jul 2006 03:47:32 -0000 1.86 >+++ contexts_Debugger.xml 13 Jul 2006 14:41:27 -0000 >@@ -735,6 +735,9 @@ > <context id="resetMemoryMonitor_preference_page_context" > > <description>On this page, you can configure the reset memory monitor behavior. </description> > </context> >+ <context id="conflicting_launch_delegates_page"> >+ <description>On this page you can select which launch elements will be used in the event there is a conflict in providers.</description> >+ </context> > > <!-- > Property Pages >#P org.eclipse.debug.ui >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/plugin.xml,v >retrieving revision 1.373 >diff -u -r1.373 plugin.xml >--- plugin.xml 14 Jun 2006 21:06:58 -0000 1.373 >+++ plugin.xml 13 Jul 2006 14:41:29 -0000 >@@ -144,6 +144,13 @@ > name="%LaunchConfigurationsPage.name"> > <keywordReference id="org.eclipse.debug.ui.launchconfigurations"/> > </page> >+ <page >+ category="org.eclipse.debug.ui.LaunchingPreferencePage" >+ class="org.eclipse.debug.internal.ui.preferences.ConflictingLaunchDelegatesPage" >+ id="org.eclipse.debug.ui.conflictingLaunchDelegatesPage" >+ name="%ConflictingLaunchDelegatesPage.name"> >+ <keywordReference id="org.eclipse.debug.ui.conflictingLaunchDelegates"/> >+ </page> > </extension> > <extension > point="org.eclipse.ui.actionSets"> >@@ -2288,6 +2295,9 @@ > <keyword > id="org.eclipse.debug.ui.launchconfigurations" > label="%preferenceKeywords.launchConfigurations"/> >+ <keyword >+ id="org.eclipse.debug.ui.conflictingLaunchDelegates" >+ label="launch run debug configurations delegates profile"/> > </extension> > <extension > point="org.eclipse.ui.importWizards"> >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/plugin.properties,v >retrieving revision 1.218 >diff -u -r1.218 plugin.properties >--- plugin.properties 31 May 2006 14:18:56 -0000 1.218 >+++ plugin.properties 13 Jul 2006 14:41:28 -0000 >@@ -19,6 +19,7 @@ > ConsoleFont.label= Console font > ConsoleLineTrackersExtensionName= Console Line Trackers > LaunchingPreferencePage.name=Launching >+ConflictingLaunchDelegatesPage.name=Launch Providers > ViewManagementPreferencePage.name=View Management > ConsolePreferencePage.name=Console > DebugModelContextBindingsName=Debug Model Context Bindings >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.17 >diff -u -r1.17 LaunchConfigurationTabGroupExtension.java >--- ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupExtension.java 18 Mar 2005 19:45:27 -0000 1.17 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupExtension.java 13 Jul 2006 14:41:30 -0000 >@@ -131,6 +131,14 @@ > } > > /** >+ * @return the defined launch delegate for this tab group extension >+ * @since 3.3 >+ */ >+ protected String getLaunchDelegate() { >+ return getConfigurationElement().getAttribute("launchDelegate"); //$NON-NLS-1$ >+ } >+ >+ /** > * Returns the identifier of the help context associated with this tab > * group, or <code>null</code> if one was not specified. > * >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.153 >diff -u -r1.153 LaunchConfigurationsMessages.properties >--- ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties 21 Jun 2006 20:04:04 -0000 1.153 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties 13 Jul 2006 14:41:31 -0000 >@@ -53,6 +53,7 @@ > LaunchConfigurationTabGroupViewer_6=- Press the 'Duplicate' button to copy the selected configuration. > LaunchConfigurationTabGroupViewer_5=Configure launch perspective settings from the <a>Perspectives</a> preference page. > LaunchConfigurationTabGroupViewer_8=- Press the 'Filter' button to configure filtering options. >+LaunchConfigurationTabGroupViewer_9=Select a <a>default provider</a> for launching when more than one option is available. > LaunchConfigurationDialog_Create__manage__and_run_launch_configurations_8=Create, manage, and run configurations > LaunchConfigurationDialog_Dele_te_14=De&lete > LaunchConfigurationDialog_Discard_changes__38=Discard changes? >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.63 >diff -u -r1.63 LaunchConfigurationTabGroupViewer.java >--- ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java 15 Jun 2006 15:05:26 -0000 1.63 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java 13 Jul 2006 14:41:31 -0000 >@@ -11,8 +11,6 @@ > package org.eclipse.debug.internal.ui.launchConfigurations; > > >-import com.ibm.icu.text.MessageFormat; >- > import org.eclipse.core.resources.IResource; > import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.CoreException; >@@ -25,6 +23,7 @@ > import org.eclipse.debug.internal.ui.DebugUIPlugin; > import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; > import org.eclipse.debug.internal.ui.SWTUtil; >+import org.eclipse.debug.internal.ui.preferences.ConflictingLaunchDelegatesPage; > import org.eclipse.debug.internal.ui.preferences.PerspectivePreferencePage; > import org.eclipse.debug.ui.DebugUITools; > import org.eclipse.debug.ui.ILaunchConfigurationDialog; >@@ -39,7 +38,6 @@ > import org.eclipse.jface.viewers.Viewer; > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.BusyIndicator; >-import org.eclipse.swt.custom.CLabel; > import org.eclipse.swt.custom.CTabFolder; > import org.eclipse.swt.custom.CTabItem; > import org.eclipse.swt.custom.StackLayout; >@@ -50,7 +48,6 @@ > import org.eclipse.swt.events.SelectionEvent; > import org.eclipse.swt.events.SelectionListener; > import org.eclipse.swt.graphics.Color; >-import org.eclipse.swt.graphics.Font; > import org.eclipse.swt.graphics.Image; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.layout.GridLayout; >@@ -65,6 +62,8 @@ > import org.eclipse.ui.IWorkbenchPreferenceConstants; > import org.eclipse.ui.PlatformUI; > >+import com.ibm.icu.text.MessageFormat; >+ > /** > * A viewer that displays tabs for a launch configuration, with apply and revert > * buttons. >@@ -306,69 +305,44 @@ > } > > /** >- * Simple method to create a spacer in the page >- * >- * @param composite the composite to add the spacer to >- * @param columnSpan the amount of space for the spacer >- * @since 3.2 >- */ >- protected void createSpacer(Composite composite, int columnSpan) { >- Label label = new Label(composite, SWT.NONE); >- GridData gd = new GridData(); >- gd.horizontalSpan = columnSpan; >- label.setLayoutData(gd); >- } >- >- /** > * Creates some help text for the tab group launch types > * @param parent thep arent composite > * @since 3.2 > */ > private void createGettingStarted(Composite parent) { >- Font font = parent.getFont(); >- GridData gd = null; >- createWrapLabel(parent, null, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_1); >- createWrapLabel(parent, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_NEW_CONFIG), >- LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_2); >- createWrapLabel(parent, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_DUPLICATE_CONFIG), >- LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_6); >- createWrapLabel(parent, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_DELETE_CONFIG), >- LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_4); >- createWrapLabel(parent, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_FILTER_CONFIGS), >- LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_8); >- createWrapLabel(parent, DebugUITools.getImage(IInternalDebugUIConstants.IMG_OVR_TRANSPARENT), >- LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_3); >+ int width = parent.getBounds().width - 30; >+ SWTUtil.createWrapCLabel(parent, null, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_1, 1, GridData.FILL_HORIZONTAL, width); >+ SWTUtil.createWrapCLabel(parent, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_NEW_CONFIG), >+ LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_2, 1, GridData.FILL_HORIZONTAL, width); >+ SWTUtil.createWrapCLabel(parent, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_DUPLICATE_CONFIG), >+ LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_6, 1, GridData.FILL_HORIZONTAL, width); >+ SWTUtil.createWrapCLabel(parent, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_DELETE_CONFIG), >+ LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_4, 1, GridData.FILL_HORIZONTAL, width); >+ SWTUtil.createWrapCLabel(parent, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_FILTER_CONFIGS), >+ LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_8, 1, GridData.FILL_HORIZONTAL, width); >+ SWTUtil.createWrapCLabel(parent, DebugUITools.getImage(IInternalDebugUIConstants.IMG_OVR_TRANSPARENT), >+ LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_3, 1, GridData.FILL_HORIZONTAL, width); > >- createSpacer(parent, 2); >- Link link = new Link(parent, SWT.LEFT | SWT.WRAP); >- link.setText(LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_5); >- link.setFont(font); >- gd = new GridData(GridData.FILL_HORIZONTAL); >- gd.widthHint = parent.getBounds().width - 30; >- link.setLayoutData(gd); >+ SWTUtil.createVerticalSpacer(parent, 1, 2); >+ //link for perspetives >+ Link link = SWTUtil.createLink(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_5, 1, GridData.FILL_HORIZONTAL, parent.getBounds().width - 30); > link.addSelectionListener(new SelectionListener() { > public void widgetSelected(SelectionEvent e) { > SWTUtil.showPreferencePage("org.eclipse.debug.ui.PerspectivePreferencePage", new PerspectivePreferencePage()); //$NON-NLS-1$ > } > public void widgetDefaultSelected(SelectionEvent e) {} > }); >+ >+ SWTUtil.createVerticalSpacer(parent, 1, 2); >+ //link for conflicting delegates >+ link = SWTUtil.createLink(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_9, 1, GridData.FILL_HORIZONTAL, parent.getBounds().width - 30); >+ link.addSelectionListener(new SelectionListener() { >+ public void widgetSelected(SelectionEvent e) { >+ SWTUtil.showPreferencePage("org.eclipse.debug.ui.conflictingLaunchDelegatesPage", new ConflictingLaunchDelegatesPage()); //$NON-NLS-1$ >+ } >+ public void widgetDefaultSelected(SelectionEvent e) {} >+ }); > } >- >- /** >- * Create a label on the given parent that wraps text. >- * >- * @param parent >- * @param text >- */ >- private void createWrapLabel(Composite parent, Image image, String text) { >- CLabel lbl = new CLabel(parent, SWT.NONE | SWT.WRAP); >- lbl.setImage(image); >- lbl.setFont(parent.getFont()); >- lbl.setText(text); >- GridData gd = new GridData(GridData.FILL_HORIZONTAL); >- gd.widthHint = parent.getBounds().width - 30; >- lbl.setLayoutData(gd); >- } > > /** > * Creates the tab folder for displaying config instances >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.35 >diff -u -r1.35 LaunchConfigurationsMessages.java >--- ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java 21 Jun 2006 20:04:04 -0000 1.35 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java 13 Jul 2006 14:41:31 -0000 >@@ -90,6 +90,8 @@ > public static String LaunchConfigurationsDialog_Warning_2; > public static String LaunchConfigurationsDialog_Information_3; > public static String LaunchConfigurationPresentationManager_No_tab_group_defined_for_launch_configuration_type__0__3; >+ >+ public static String LaunchConfigurationTabGroupViewer_9; > 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/LaunchConfigurationPresentationManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPresentationManager.java,v >retrieving revision 1.33 >diff -u -r1.33 LaunchConfigurationPresentationManager.java >--- ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPresentationManager.java 21 Jun 2006 20:04:04 -0000 1.33 >+++ ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPresentationManager.java 13 Jul 2006 14:41:30 -0000 >@@ -11,10 +11,8 @@ > package org.eclipse.debug.internal.ui.launchConfigurations; > > >-import com.ibm.icu.text.MessageFormat; >-import java.util.Hashtable; >+import java.util.HashMap; > import java.util.Iterator; >-import java.util.Map; > import java.util.Set; > > import org.eclipse.core.runtime.CoreException; >@@ -26,10 +24,13 @@ > import org.eclipse.core.runtime.Status; > import org.eclipse.debug.core.DebugPlugin; > import org.eclipse.debug.core.ILaunchConfigurationType; >+import org.eclipse.debug.core.ILaunchManager; > import org.eclipse.debug.internal.ui.DebugUIPlugin; > import org.eclipse.debug.ui.IDebugUIConstants; > import org.eclipse.debug.ui.ILaunchConfigurationTabGroup; > >+import com.ibm.icu.text.MessageFormat; >+ > /** > * Manages contributed launch configuration tabs > */ >@@ -39,17 +40,17 @@ > * The singleton launch configuration presentation manager > */ > private static LaunchConfigurationPresentationManager fgDefault; >+ >+ private static final String MODELESS = "*"; //$NON-NLS-1$ > > /** >- * Collection of launch configuration tab group extensions >- * defined in plug-in xml. Entries are keyed by launch >- * configuration type identifier (<code>String</code>), >- * and entires are tables of launch modes (<code>String</code>) >- * to <code>LaunchConfigurationTabGroupExtension</code>. "*" is >- * used to represent the default tab group (i.e. unspecified mode). >+ * Mapping of the types to the extensions >+ * Map is of form: >+ * HashMap<ILaunchConfigurationType, HashMap<String, HashMap<LaunchConfigurationTabGroupExtension, String>>> >+ * @since 3.3 > */ >- private Hashtable fTabGroupExtensions; >- >+ private HashMap fMap; >+ > /** > * Constructs the singleton launch configuration presentation > * manager. >@@ -74,43 +75,54 @@ > * defined in XML, and adds them to the table of tab group extensions. > */ > private void initializeTabGroupExtensions() { >- fTabGroupExtensions = new Hashtable(); >+ fMap = new HashMap(0); > IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_LAUNCH_CONFIGURATION_TAB_GROUPS); > IConfigurationElement[] groups = extensionPoint.getConfigurationElements(); >+ LaunchConfigurationTabGroupExtension group = null; >+ ILaunchConfigurationType type = null; >+ String typeId = null; >+ IExtension ext = null; >+ Set modes = null; >+ String mode = null; >+ HashMap mod = null; >+ HashMap grp = null; > for (int i = 0; i < groups.length; i++) { >- LaunchConfigurationTabGroupExtension group = new LaunchConfigurationTabGroupExtension(groups[i]); >- String typeId = group.getTypeIdentifier(); >+ group = new LaunchConfigurationTabGroupExtension(groups[i]); >+ typeId = group.getTypeIdentifier(); >+ ext = groups[i].getDeclaringExtension(); > if (typeId == null) { >- IExtension ext = groups[i].getDeclaringExtension(); > IStatus status = new Status(IStatus.ERROR, IDebugUIConstants.PLUGIN_ID, IDebugUIConstants.STATUS_INVALID_EXTENSION_DEFINITION, > MessageFormat.format("Launch configuration tab group extension {0} does not specify launch configuration type.", (new String[] {ext.getUniqueIdentifier()})), null); //$NON-NLS-1$ > DebugUIPlugin.log(status); >- } else { >- // verify it references a valid launch configuration type >- ILaunchConfigurationType lct = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(typeId); >- if (lct == null) { >- IExtension ext = groups[i].getDeclaringExtension(); >+ } >+ else { >+ type = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(typeId); >+ if (type == null) { > IStatus status = new Status(IStatus.ERROR, IDebugUIConstants.PLUGIN_ID, IDebugUIConstants.STATUS_INVALID_EXTENSION_DEFINITION, > MessageFormat.format("Launch configuration tab group extension {0} refers to non-existent launch configuration type {1}.", (new String[] {ext.getUniqueIdentifier(), typeId})), null); //$NON-NLS-1$ > DebugUIPlugin.log(status); > } >- } >- if (typeId != null) { >- // get the map for the config type >- Map map = (Map)fTabGroupExtensions.get(typeId); >- if (map == null) { >- map = new Hashtable(); >- fTabGroupExtensions.put(typeId, map); >+ modes = group.getModes(); >+ mod = (HashMap) fMap.get(type); >+ grp = null; >+ if(mod == null) { >+ mod = new HashMap(0); >+ fMap.put(type, mod); > } >- Set modes = group.getModes(); > if (modes == null) { >- // default tabs - store with "*" >- map.put("*", group); //$NON-NLS-1$ >- } else { >- // store per mode >- Iterator iterator = modes.iterator(); >- while (iterator.hasNext()) { >- map.put(iterator.next(), group); >+ grp = new HashMap(0); >+ grp.put(group, null); >+ mod.put(MODELESS, grp); >+ } >+ else { >+ for(Iterator iter = modes.iterator(); iter.hasNext();) { >+ mode = (String) iter.next(); >+ grp = (HashMap) mod.get(mode); >+ if(grp == null) { >+ grp = new HashMap(0); >+ mod.put(mode, grp); >+ } >+ grp.put(group, group.getLaunchDelegate()); > } > } > } >@@ -144,17 +156,57 @@ > * @return launch tab group extension or <code>null</code> > */ > protected LaunchConfigurationTabGroupExtension getExtension(String type, String mode) { >- // get the map for the config type >- Map map = (Map)fTabGroupExtensions.get(type); >- if (map != null) { >- // try the specific mode >- Object extension = map.get(mode); >- if (extension == null) { >- // get the default tabs >- extension = map.get("*"); //$NON-NLS-1$ >- } >- return (LaunchConfigurationTabGroupExtension)extension; >+ if(mode == null) { >+ mode = MODELESS; > } >+ return findExtensionItem(type, mode); >+ } >+ >+ /** >+ * Finds the corresponding <code>LaunchConfigurationTabGroupExtension</code> for the given type id and the mode >+ * @param type the id of the <code>LaunchConfigurationType</code> we want the tab group for >+ * @param mode the mode we want the tab group for >+ * @return the corresponding ag group extension or <code>null</code> if not found >+ * @since 3.3 >+ */ >+ private LaunchConfigurationTabGroupExtension findExtensionItem(String type, String mode) { >+ try { >+ ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager(); >+ ILaunchConfigurationType lctype = lm.getLaunchConfigurationType(type); >+ HashMap stype = (HashMap) fMap.get(lctype); >+ if(stype != null) { >+ HashMap smode = (HashMap) stype.get(mode); >+ if(smode == null) { >+ smode = (HashMap)stype.get(MODELESS); >+ } >+ if(smode.size() > 1) { >+ //choose preferred >+ String delegate = lm.getPreferredDelegateProvider(lctype, mode); >+ LaunchConfigurationTabGroupExtension ext = null; >+ String prefer = null; >+ for(Iterator iter = smode.keySet().iterator(); iter.hasNext();) { >+ ext = (LaunchConfigurationTabGroupExtension) iter.next(); >+ prefer = (String) smode.get(ext); >+ if(delegate == null & prefer == null) { >+ return ext; >+ } >+ else { >+ if(delegate != null && delegate.equals(prefer)) { >+ return ext; >+ } >+ } >+ } >+ //if we are here it is due to contributor's not specifying a delegate name on their group extension >+ //just return the first one >+ return (LaunchConfigurationTabGroupExtension) smode.keySet().iterator().next(); >+ } >+ else { >+ //return the only one if no preferred given >+ return (LaunchConfigurationTabGroupExtension) smode.keySet().iterator().next(); >+ } >+ } >+ } >+ catch (CoreException e) {DebugUIPlugin.log(e);} > return null; > } > >Index: ui/org/eclipse/debug/internal/ui/SWTUtil.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/SWTUtil.java,v >retrieving revision 1.17 >diff -u -r1.17 SWTUtil.java >--- ui/org/eclipse/debug/internal/ui/SWTUtil.java 1 Jul 2006 03:47:07 -0000 1.17 >+++ ui/org/eclipse/debug/internal/ui/SWTUtil.java 13 Jul 2006 14:41:29 -0000 >@@ -21,6 +21,7 @@ > import org.eclipse.jface.util.Assert; > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.BusyIndicator; >+import org.eclipse.swt.custom.CLabel; > import org.eclipse.swt.graphics.Font; > import org.eclipse.swt.graphics.Image; > import org.eclipse.swt.layout.GridData; >@@ -29,6 +30,7 @@ > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Group; > import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Link; > import org.eclipse.swt.widgets.Text; > > /** >@@ -148,6 +150,68 @@ > } > > /** >+ * Creates a new label widget >+ * @param parent the parent composite to add this label widget to >+ * @param style the SWT style for the widget >+ * @param text the text for the label >+ * @param hspan the horizontal span to take up in the parent composite >+ * @return the new label >+ * @since 3.3 >+ */ >+ public static Label createLabel(Composite parent, int style, String text, int hspan) { >+ Label l = new Label(parent, style); >+ l.setFont(parent.getFont()); >+ l.setText(text); >+ GridData gd = new GridData(GridData.FILL_HORIZONTAL); >+ gd.horizontalSpan = hspan; >+ l.setLayoutData(gd); >+ return l; >+ } >+ >+ /** >+ * Creates a new wrapping label widget >+ * @param parent the parent composite to add this label widget to >+ * @param style the SWT style for the widget >+ * @param text the text for the label >+ * @param hspan the horizontal span to take up in the parent composite >+ * @return the new label >+ * @since 3.3 >+ */ >+ public static Label createWrappedLabel(Composite parent, String text, int hspan, int width) { >+ Label l = new Label(parent, SWT.WRAP); >+ l.setFont(parent.getFont()); >+ l.setText(text); >+ GridData gd = new GridData(GridData.FILL_HORIZONTAL); >+ gd.horizontalSpan = hspan; >+ gd.widthHint = width; >+ l.setLayoutData(gd); >+ return l; >+ } >+ >+ /** >+ * Creates a new <code>CLabel</code> object >+ * @param parent the parent composite to add this clabel to >+ * @param image the image for the label >+ * @param text the text for the label >+ * @param hspan the horizontal span the label should take up in the parent >+ * @param fill the fill style for label >+ * @param width the width for the label >+ * @return a new <code>CLabel</code> object >+ * @since 3.3 >+ */ >+ public static CLabel createWrapCLabel(Composite parent, Image image, String text, int hspan, int fill, int width) { >+ CLabel lbl = new CLabel(parent, SWT.NONE | SWT.WRAP); >+ lbl.setImage(image); >+ lbl.setFont(parent.getFont()); >+ lbl.setText(text); >+ GridData gd = new GridData(fill); >+ gd.widthHint = width/*parent.getBounds().width - 30*/; >+ gd.horizontalSpan = hspan; >+ lbl.setLayoutData(gd); >+ return lbl; >+ } >+ >+ /** > * Creates a new text widget > * @param parent the parent composite to add this text widget to > * @param hspan the horizontal span to take up on the parent composite >@@ -258,6 +322,21 @@ > } > > /** >+ * creates a vertical spacer for seperating components >+ * @param comp >+ * @param numlines >+ * @param span the horizontal span for the spacer >+ * @since 3.3 >+ */ >+ public static void createVerticalSpacer(Composite comp, int numlines, int span) { >+ Label lbl = new Label(comp, SWT.NONE); >+ GridData gd = new GridData(GridData.FILL_HORIZONTAL); >+ gd.horizontalSpan = span; >+ gd.heightHint = numlines; >+ lbl.setLayoutData(gd); >+ } >+ >+ /** > * Creates a Composite widget > * @param parent the parent composite to add this composite to > * @param columns the number of columns within the composite >@@ -281,6 +360,27 @@ > } > > /** >+ * Creates a <code>Link</code> object >+ * @param parent the parent composite to add this link to >+ * @param text the text for the link >+ * @param hspan the horizontal span the link object should take up in the parent >+ * @param fill the fill style for the link >+ * @param width the width in pixels of the link >+ * @return a new <code>Link</code> object >+ * @since 3.3 >+ */ >+ public static final Link createLink(Composite parent, String text, int hspan, int fill, int width) { >+ Link link = new Link(parent, SWT.LEFT | SWT.WRAP); >+ link.setFont(parent.getFont()); >+ link.setText(text); >+ GridData gd = new GridData(fill); >+ gd.widthHint = width; >+ gd.horizontalSpan = hspan; >+ link.setLayoutData(gd); >+ return link; >+ } >+ >+ /** > * This method allows us to open the preference dialog on the specific page, in this case the perspective page > * @param id the id of pref page to show > * @param page the actual page to show >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.55 >diff -u -r1.55 IDebugHelpContextIds.java >--- ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java 1 Jul 2006 03:47:07 -0000 1.55 >+++ ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java 13 Jul 2006 14:41:29 -0000 >@@ -73,6 +73,7 @@ > public static final String LAUNCHING_PREFERENCE_PAGE = PREFIX + "launching_preference_page_context"; //$NON-NLS-1$ > 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 CONFLICTING_LAUNCH_DELEGATES_PAGE = PREFIX + "conflicting_launch_delegates_page"; //$NON-NLS-1$ > > // Dialogs > public static final String LAUNCH_CONFIGURATION_DIALOG = PREFIX + "launch_configuration_dialog"; //$NON-NLS-1$ >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.88 >diff -u -r1.88 DebugPreferencesMessages.properties >--- ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties 11 Apr 2006 16:25:33 -0000 1.88 >+++ ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties 13 Jul 2006 14:41:31 -0000 >@@ -121,3 +121,7 @@ > LaunchConfigurationsPreferencePage_1=Launch Configurations > LaunchConfigurationsPreferencePage_2=Delete configurations when associated project is deleted > LaunchConfigurationsPreferencePage_3=Apply window &working set(s) >+ConflictingLaunchDelegatesPage_page_title=Launch Providers >+ConflictingLaunchDelegatesPage_page_description=Conflicting launch providers are displayed below. To change the default launch provider for a particular conflicting launch mode, select it in the Conflicting Providers list and then check the desired entry in the Default Provider list. >+ConflictingLaunchDelegatesPage_conflicting_providers=Conflicting Providers >+ConflictingLaunchDelegatesPage_default_delegate=Default Delegate >Index: ui/org/eclipse/debug/internal/ui/preferences/LaunchConfigurationTreeContentProviderNoChildren.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchConfigurationTreeContentProviderNoChildren.java,v >retrieving revision 1.1 >diff -u -r1.1 LaunchConfigurationTreeContentProviderNoChildren.java >--- ui/org/eclipse/debug/internal/ui/preferences/LaunchConfigurationTreeContentProviderNoChildren.java 28 Sep 2005 16:06:25 -0000 1.1 >+++ ui/org/eclipse/debug/internal/ui/preferences/LaunchConfigurationTreeContentProviderNoChildren.java 13 Jul 2006 14:41:31 -0000 >@@ -29,7 +29,7 @@ > */ > public LaunchConfigurationTreeContentProviderNoChildren(String mode, Shell shell) { > super(mode, shell); >- }//end constructor >+ } > > /* (non-Javadoc) > * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object) >@@ -44,4 +44,4 @@ > public Object[] getChildren(Object parentElement) { > return new Object[] {}; > } >-}//end class >+} >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.18 >diff -u -r1.18 DebugPreferencesMessages.java >--- ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java 8 May 2006 20:07:18 -0000 1.18 >+++ ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java 13 Jul 2006 14:41:31 -0000 >@@ -15,6 +15,14 @@ > public class DebugPreferencesMessages extends NLS { > private static final String BUNDLE_NAME = "org.eclipse.debug.internal.ui.preferences.DebugPreferencesMessages";//$NON-NLS-1$ > >+ public static String ConflictingLaunchDelegatesPage_conflicting_providers; >+ >+ public static String ConflictingLaunchDelegatesPage_default_delegate; >+ >+ public static String ConflictingLaunchDelegatesPage_page_description; >+ >+ public static String ConflictingLaunchDelegatesPage_page_title; >+ > public static String ConsolePreferencePage_Console_settings; > public static String ConsolePreferencePage_Show__Console_View_when_there_is_program_error_3; > public static String ConsolePreferencePage_Show__Console_View_when_there_is_program_output_3; >Index: ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java,v >retrieving revision 1.42 >diff -u -r1.42 IDebugPreferenceConstants.java >--- ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java 8 May 2006 20:07:18 -0000 1.42 >+++ ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java 13 Jul 2006 14:41:31 -0000 >@@ -147,7 +147,6 @@ > * @since 3.2 > */ > public static final int PREF_ROW_SIZE_DEFAULT = 16; >- > > /** > * Default padded string for renderings >Index: schema/launchConfigurationTabGroups.exsd >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/schema/launchConfigurationTabGroups.exsd,v >retrieving revision 1.15 >diff -u -r1.15 launchConfigurationTabGroups.exsd >--- schema/launchConfigurationTabGroups.exsd 20 Apr 2005 15:30:45 -0000 1.15 >+++ schema/launchConfigurationTabGroups.exsd 13 Jul 2006 14:41:29 -0000 >@@ -86,6 +86,13 @@ > </appInfo> > </annotation> > </attribute> >+ <attribute name="launchDelegate" type="string"> >+ <annotation> >+ <documentation> >+ this field associates this tab group to a specific id of a launch configuration delegate >+ </documentation> >+ </annotation> >+ </attribute> > </complexType> > </element> > >@@ -136,7 +143,8 @@ > <launchConfigurationTabGroup > id="com.example.ExampleTabGroup" > type="com.example.ExampleLaunchConfigurationTypeIdentifier" >- class="com.example.ExampleLaunchConfigurationTabGroupClass"> >+ class="com.example.ExampleLaunchConfigurationTabGroupClass" >+ launchDelegate="com.example.ExampleLaunchDelegate"> > </launchConfigurationTabGroup> > </extension> > </pre> >@@ -154,6 +162,8 @@ > <documentation> > Value of the attribute <code>class</code> must be a fully qualified name of a Java class that implements the > interface <code>org.eclipse.debug.ui.ILaunchConfigurationTabGroup</code>. >+ >+Value of <code>launchDelegate</code> must match name an existing id for a <code>LaunchConfigurationDelegate</code> defined in a <code>LaunchConfigurationType</code> or <code>LaunchDelegate</code> extension point. > </documentation> > </annotation> > >@@ -162,7 +172,7 @@ > <meta.section type="copyright"/> > </appInfo> > <documentation> >-Copyright (c) 2000, 2005 IBM Corporation and others.<br> >+ Copyright (c) 2000, 2005 IBM Corporation and others.<br> > 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 >Index: ui/org/eclipse/debug/internal/ui/preferences/ConflictingLaunchDelegatesPage.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/preferences/ConflictingLaunchDelegatesPage.java >diff -N ui/org/eclipse/debug/internal/ui/preferences/ConflictingLaunchDelegatesPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/preferences/ConflictingLaunchDelegatesPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,334 @@ >+/******************************************************************************* >+ * 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.Collection; >+import java.util.HashMap; >+import java.util.Iterator; >+import java.util.List; >+import java.util.Map; >+import java.util.Set; >+import java.util.Map.Entry; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.debug.core.DebugPlugin; >+import org.eclipse.debug.core.ILaunchConfigurationType; >+import org.eclipse.debug.core.ILaunchManager; >+import org.eclipse.debug.core.model.ILaunchConfigurationDelegate; >+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.jface.preference.PreferencePage; >+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.IStructuredContentProvider; >+import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.jface.viewers.SelectionChangedEvent; >+import org.eclipse.jface.viewers.StructuredSelection; >+import org.eclipse.jface.viewers.TableViewer; >+import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.graphics.Image; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Group; >+import org.eclipse.swt.widgets.Table; >+import org.eclipse.swt.widgets.TableItem; >+import org.eclipse.ui.IWorkbench; >+import org.eclipse.ui.IWorkbenchPreferencePage; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.model.WorkbenchViewerSorter; >+ >+/** >+ * Class provides a pref page to allow users to resolve which launch configuration >+ * elements and which launch delegates are to be used in the event of more than >+ * one launcher being provided for the same mode and launch. >+ * >+ * See Bug 137057 [launching] Allow user to resolve launcher to user for config/mode when > 1 >+ * >+ * @since 3.3 >+ */ >+public class ConflictingLaunchDelegatesPage extends PreferencePage implements IWorkbenchPreferencePage { >+ >+ /** >+ * Label provider for both tables >+ */ >+ class LabelProvider extends DefaultLabelProvider { >+ public String getText(Object element) { >+ if(element instanceof ConflictingProvider) { >+ ConflictingProvider cp = (ConflictingProvider) element; >+ return super.getText(cp.getLaunchConfigurationType())+" ("+cp.getMode()+" mode)"; //$NON-NLS-1$//$NON-NLS-2$ >+ } >+ if(element instanceof Entry) { >+ return (String) ((Entry)element).getKey(); >+ } >+ return super.getText(element); >+ } >+ >+ public Image getImage(Object element) { >+ if(element instanceof ConflictingProvider) { >+ return super.getImage(((ConflictingProvider) element).getLaunchConfigurationType()); >+ } >+ return super.getImage(element); >+ } >+ } >+ >+ /** >+ * Content provider for both tables >+ */ >+ class TableContentProvider implements IStructuredContentProvider { >+ >+ Collection elements = null; >+ >+ public Object[] getElements(Object inputElement) { >+ if(elements == null) { >+ return new Object[0]; >+ } >+ else { >+ return elements.toArray(); >+ } >+ } >+ >+ public void dispose() {} >+ >+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { >+ if(newInput instanceof Collection) { >+ elements = (Collection) newInput; >+ } >+ else if(newInput instanceof Map) { >+ elements = ((Map)newInput).entrySet(); >+ } >+ } >+ } >+ >+ /** >+ * Provides a wrapper for information needed to describe a conflicting provider >+ */ >+ class ConflictingProvider { >+ >+ private ILaunchConfigurationType fType; >+ private String fMode; >+ private HashMap fConflicts; >+ private String fProvider; >+ private ILaunchConfigurationDelegate fDelegate; >+ >+ public ConflictingProvider(ILaunchConfigurationType type, String mode, HashMap conflicts) { >+ fType = type; >+ fMode = mode; >+ fConflicts = conflicts; >+ } >+ >+ public void setPreferredDelegate(String provider, ILaunchConfigurationDelegate delegate) { >+ fProvider = provider; >+ fDelegate = delegate; >+ } >+ >+ public String getProvider() { >+ return fProvider; >+ } >+ >+ public String getMode() { >+ return fMode; >+ } >+ >+ public ILaunchConfigurationDelegate getDelegate() { >+ return fDelegate; >+ } >+ >+ public ILaunchConfigurationType getLaunchConfigurationType() { >+ return fType; >+ } >+ >+ public HashMap getConflicts() { >+ return fConflicts; >+ } >+ >+ } >+ >+ private static final int LABEL_WIDTH_HINT = 450; >+ private static final int TREE_HEIGHT = 200; >+ private static final int TREE_WIDTH = 150; >+ private ILaunchManager fLManager = DebugPlugin.getDefault().getLaunchManager(); >+ >+ /** >+ * maps ConflictingProvider to ILaunchConfigurationDelegate >+ */ >+ private HashMap fChangedDelegates = new HashMap(); >+ private List fConflictingProviders = null; >+ private boolean fDirty = false; >+ >+ //widgets >+ private Table fTable; >+ private TableViewer fTableViewer; >+ private CheckboxTableViewer fCheckTableViewer; >+ private Table fCheckTable; >+ >+ /** >+ * default constructor >+ */ >+ public ConflictingLaunchDelegatesPage() { >+ setTitle(DebugPreferencesMessages.ConflictingLaunchDelegatesPage_page_title); >+ init(null); >+ } >+ >+ /** >+ * Constructor >+ * @param title the title of the page >+ */ >+ public ConflictingLaunchDelegatesPage(String title) { >+ super(title); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) >+ */ >+ protected Control createContents(Composite parent) { >+ Composite comp = SWTUtil.createComposite(parent, parent.getFont(), 2, 1, GridData.FILL_BOTH); >+ SWTUtil.createWrappedLabel(comp, DebugPreferencesMessages.ConflictingLaunchDelegatesPage_page_description, 2, LABEL_WIDTH_HINT); >+ SWTUtil.createVerticalSpacer(comp, 1, 2); >+ //create the tree viewer for the conflicting providers >+ Group group = SWTUtil.createGroup(comp, DebugPreferencesMessages.ConflictingLaunchDelegatesPage_conflicting_providers, 1, 1, GridData.FILL_HORIZONTAL); >+ fTable = new Table(group, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER); >+ GridData gd = new GridData(GridData.FILL_HORIZONTAL); >+ gd.heightHint = TREE_HEIGHT; >+ gd.widthHint = TREE_WIDTH; >+ fTable.setLayoutData(gd); >+ fTableViewer = new TableViewer(fTable); >+ fTableViewer.setLabelProvider(new LabelProvider()); >+ fTableViewer.setSorter(new WorkbenchViewerSorter()); >+ fTableViewer.setContentProvider(new TableContentProvider()); >+ fTableViewer.setInput(fConflictingProviders); >+ fTableViewer.addPostSelectionChangedListener(new ISelectionChangedListener() { >+ public void selectionChanged(SelectionChangedEvent event) { >+ handleSelectionChangedEvent(event); >+ } >+ }); >+ //create the check table viewer for the default provider >+ group = SWTUtil.createGroup(comp, DebugPreferencesMessages.ConflictingLaunchDelegatesPage_default_delegate, 1, 1, GridData.FILL_HORIZONTAL); >+ fCheckTable = new Table(group, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER | SWT.CHECK); >+ gd = new GridData(GridData.FILL_HORIZONTAL); >+ gd.heightHint = TREE_HEIGHT; >+ gd.widthHint = TREE_WIDTH; >+ fCheckTable.setLayoutData(gd); >+ fCheckTableViewer = new CheckboxTableViewer(fCheckTable); >+ fCheckTableViewer.setLabelProvider(new LabelProvider()); >+ fCheckTableViewer.setSorter(new WorkbenchViewerSorter()); >+ fCheckTableViewer.setContentProvider(new TableContentProvider()); >+ fCheckTableViewer.addCheckStateListener(new ICheckStateListener() { >+ public void checkStateChanged(CheckStateChangedEvent event) { >+ Object obj = event.getElement(); >+ boolean checked = event.getChecked(); >+ fCheckTableViewer.setAllChecked(false); >+ fCheckTableViewer.setChecked(obj, checked); >+ ConflictingProvider cp = getConflictingProvider(); >+ Entry entry = (Entry) obj; >+ if(checked) { >+ cp.setPreferredDelegate((String) entry.getKey(), (ILaunchConfigurationDelegate) entry.getValue()); >+ } >+ else { >+ cp.setPreferredDelegate(null, null); >+ } >+ fChangedDelegates.put(cp, obj); >+ fDirty = true; >+ } >+ }); >+ if(fTable.getItemCount() > 0) { >+ fTableViewer.setSelection(new StructuredSelection(fTable.getItem(0).getData())); >+ } >+ return comp; >+ } >+ >+ /** >+ * @return the <code>ConflictingProvider</code> from the right hand side table >+ */ >+ private ConflictingProvider getConflictingProvider() { >+ return (ConflictingProvider) fTable.getSelection()[0].getData(); >+ } >+ >+ /* (non-Javadoc) >+ * @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.CONFLICTING_LAUNCH_DELEGATES_PAGE); >+ } >+ >+ /** >+ * method handles what to do after the selection changes in the Conflicting Providers tree >+ * @param event the selection changed event >+ */ >+ private void handleSelectionChangedEvent(SelectionChangedEvent event) { >+ IStructuredSelection sel = (IStructuredSelection) event.getSelection(); >+ if(!sel.isEmpty()) { >+ fCheckTableViewer.setInput(getConflictingProvider().getConflicts()); >+ //set the checked state based on what has been changed >+ TableItem[] items = fCheckTable.getItems(); >+ Entry entry = null; >+ for(int i = 0; i < items.length; i++) { >+ entry = (Entry) items[i].getData(); >+ if(entry.getValue().equals(getConflictingProvider().getDelegate())) { >+ fCheckTableViewer.setChecked(entry, true); >+ } >+ } >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.preference.PreferencePage#performApply() >+ */ >+ public boolean performOk() { >+ if(fDirty) { >+ try { >+ ConflictingProvider cp = null; >+ for(Iterator iter = fChangedDelegates.keySet().iterator(); iter.hasNext();) { >+ cp = (ConflictingProvider) iter.next(); >+ if(cp.getProvider() == null) { >+ fLManager.removePreferredDelegate(cp.getLaunchConfigurationType(), cp.getMode()); >+ } >+ else { >+ fLManager.setPreferredDelegate(cp.getLaunchConfigurationType(), cp.getMode(), cp.getDelegate(), cp.getProvider()); >+ } >+ } >+ } >+ catch(CoreException e) {DebugUIPlugin.log(e);} >+ } >+ return super.performOk(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) >+ */ >+ public void init(IWorkbench workbench) { >+ try { >+ fConflictingProviders = new ArrayList(0); >+ ILaunchConfigurationType[] types = fLManager.getLaunchConfigurationTypes(); >+ ConflictingProvider cp = null; >+ for(int i = 0; i < types.length; i++) { >+ Set modes = types[i].getSupportedModes(); >+ for(Iterator iter = modes.iterator(); iter.hasNext();) { >+ String mode = (String) iter.next(); >+ if(fLManager.hasConflictingDelegates(types[i], mode)) { >+ cp = new ConflictingProvider(types[i], mode, fLManager.getConflictingDelegates(types[i], mode)); >+ cp.setPreferredDelegate(fLManager.getPreferredDelegateProvider(types[i], mode), fLManager.getPreferredDelegate(types[i], mode)); >+ fConflictingProviders.add(cp); >+ } >+ } >+ } >+ } >+ catch(CoreException e) {DebugUIPlugin.log(e);} >+ } >+ >+}
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 137057
: 46244