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 50306 Details for
Bug 157059
[launching] extensible launch options
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
phase 2
phase 2 (text/plain), 89.30 KB, created by
Michael Rennie
on 2006-09-15 17:14:33 EDT
(
hide
)
Description:
phase 2
Filename:
MIME Type:
Creator:
Michael Rennie
Created:
2006-09-15 17:14:33 EDT
Size:
89.30 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.9 >diff -u -r1.9 launchDelegates.exsd >--- schema/launchDelegates.exsd 13 Sep 2006 19:09:07 -0000 1.9 >+++ schema/launchDelegates.exsd 15 Sep 2006 20:51:59 -0000 >@@ -46,7 +46,8 @@ > </appInfo> > </annotation> > <complexType> >- <sequence> >+ <sequence minOccurs="0" maxOccurs="unbounded"> >+ <element ref="appliesTo"/> > </sequence> > <attribute name="id" type="string" use="required"> > <annotation> >@@ -55,6 +56,25 @@ > </documentation> > </annotation> > </attribute> >+ <attribute name="name" type="string"> >+ <annotation> >+ <documentation> >+ specifies a human readable name for this delegate >+ >+since 3.3M3 >+ >+<p> >+<strong>EXPERIMENTAL</strong>. This attribute has been added as >+part of a work in progress. There is no guarantee that this API will >+remain unchanged during the 3.3 release cycle. Please do not use this API >+without consulting with the Platform/Debug team. >+</p> >+ </documentation> >+ <appInfo> >+ <meta.attribute translatable="true"/> >+ </appInfo> >+ </annotation> >+ </attribute> > <attribute name="delegate" type="string" use="required"> > <annotation> > <documentation> >@@ -66,18 +86,42 @@ > </appInfo> > </annotation> > </attribute> >- <attribute name="modes" type="string" use="required"> >+ <attribute name="modes" type="string"> > <annotation> > <documentation> > specifies a comma-separated list of the modes this lauch delegate supports. >+ >+Deprecated for 3.3M3. Instead make use of appliesTo and option expressions. >+ >+<p> >+<strong>EXPERIMENTAL</strong>. This attribute has been deprecated as >+part of a work in progress. There is no guarantee that this API will >+remain unchanged during the 3.3 release cycle. Please do not use this API >+without consulting with the Platform/Debug team. >+</p> > </documentation> >+ <appInfo> >+ <meta.attribute deprecated="true"/> >+ </appInfo> > </annotation> > </attribute> >- <attribute name="type" type="string" use="required"> >+ <attribute name="type" type="string"> > <annotation> > <documentation> > identifier of an existing launch configuration type that this launch delegate is capable of launching. >+ >+Deprecated for 3.3M3. Instead use appliesTo to indicate what launch configuration type this delegate can launch >+ >+<p> >+<strong>EXPERIMENTAL</strong>. This attribute has been deprecated as >+part of a work in progress. There is no guarantee that this API will >+remain unchanged during the 3.3 release cycle. Please do not use this API >+without consulting with the Platform/Debug team. >+</p> > </documentation> >+ <appInfo> >+ <meta.attribute deprecated="true"/> >+ </appInfo> > </annotation> > </attribute> > <attribute name="sourcePathComputerId" type="string"> >@@ -97,6 +141,106 @@ > </complexType> > </element> > >+ <element name="appliesTo"> >+ <annotation> >+ <documentation> >+ The appliesTo node abstracts the type parameter from the delegate definition itself. this way we can simply have a listing of type that this delegate applies to defined with the delegate, removing the need for multiple launch delegate declarations for different launch configuration types. >+ >+<p> >+<strong>EXPERIMENTAL</strong>. This element has been added as >+part of a work in progress. There is no guarantee that this API will >+remain unchanged during the 3.3 release cycle. Please do not use this API >+without consulting with the Platform/Debug team. >+</p> >+ </documentation> >+ </annotation> >+ <complexType> >+ <sequence> >+ <choice> >+ <element ref="and"/> >+ <element ref="or"/> >+ </choice> >+ </sequence> >+ <attribute name="type" type="string" use="required"> >+ <annotation> >+ <documentation> >+ refers to the unique id of the launch configuration type this delegate can launch >+ </documentation> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <element name="and"> >+ <annotation> >+ <documentation> >+ A node indicating all child elements should be iterated over and anded together in a boolean expression >+ >+<p> >+<strong>EXPERIMENTAL</strong>. This element has been added as >+part of a work in progress. There is no guarantee that this API will >+remain unchanged during the 3.3 release cycle. Please do not use this API >+without consulting with the Platform/Debug team. >+</p> >+ </documentation> >+ </annotation> >+ <complexType> >+ <sequence minOccurs="1" maxOccurs="unbounded"> >+ <choice> >+ <element ref="option"/> >+ <element ref="or"/> >+ </choice> >+ </sequence> >+ </complexType> >+ </element> >+ >+ <element name="or"> >+ <annotation> >+ <documentation> >+ A node indicating that all elements should be iterated over and ored together in a boolean expression >+ >+<p> >+<strong>EXPERIMENTAL</strong>. This element has been added as >+part of a work in progress. There is no guarantee that this API will >+remain unchanged during the 3.3 release cycle. Please do not use this API >+without consulting with the Platform/Debug team. >+</p> >+ </documentation> >+ </annotation> >+ <complexType> >+ <sequence minOccurs="1" maxOccurs="unbounded"> >+ <choice> >+ <element ref="option"/> >+ <element ref="and"/> >+ </choice> >+ </sequence> >+ </complexType> >+ </element> >+ >+ <element name="option"> >+ <annotation> >+ <documentation> >+ A node that describes the option to be associated with the type this delegate applies to. The 'option' field is from the launch option contribution >+ >+<p> >+<strong>EXPERIMENTAL</strong>. This element has been added as >+part of a work in progress. There is no guarantee that this API will >+remain unchanged during the 3.3 release cycle. Please do not use this API >+without consulting with the Platform/Debug team. >+</p> >+ </documentation> >+ </annotation> >+ <complexType> >+ <attribute name="option" type="string" use="required"> >+ <annotation> >+ <documentation> >+ the option field from the launch option contribution that this delegate applies to >+ </documentation> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ > <annotation> > <appInfo> > <meta.section type="since"/> >@@ -127,6 +271,46 @@ > </p> > > In the example above, the specified launch delegate is contributed to launch Java applications in profile mode. >+ >+The previous example has been deprecated as of 3.3M3, but left in for brevity. See the following example for new usage. >+ >+<p> >+<pre> >+<extension point="org.eclipse.debug.core.launchDelegates"> >+ <launchDelegate >+ delegate="org.eclipse.jdt.launching.JavaLaunchDelegate" >+ id="org.eclipse.jdt.launching.JavaLaunchDelegate"> >+ <appliesTo type="org.eclipse.jdt.launching.localJavaApplication"> >+ <or> >+ <option option="debug"/> >+ </or> >+ </appliesTo> >+ </launchDelegate> >+ </extension> >+</pre> >+</p> >+ >+In 3.3 mode-based launching has been deprecated, and in its place we have provided launching with options. Options are contributed via the <code>launchOptions</code> extension point and can be referenced here to describe what options your launch delegate supports. Options are further arranged in the form of expressions that can be evaluated to determine suitablility of your delegate for a variety of combinations of options. >+ >+For example if you had a delegate that could support debugging and tracing or debugging and profiling your appliesTo section might look like the following: >+ >+<p> >+<pre> >+... >+<appliesTo type="org.eclipse.jdt.launching.localJavaApplication"> >+ <and> >+ <option option="debug"/> >+ <or> >+ <option option="tracing"/> >+ <option option="profiling"/> >+ </or> >+ </and> >+</appliesTo> >+... >+</pre> >+</p> >+ >+With the seperation of the type from the delegate definition itself, you can now specify that this one delegate applies to more than one launch configuration type without having to redefine it for each type. Furthermore, each launch configuration type that you specify can have its own independent expression for options. > </documentation> > </annotation> > >Index: schema/launchModes.exsd >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/schema/launchModes.exsd,v >retrieving revision 1.9 >diff -u -r1.9 launchModes.exsd >--- schema/launchModes.exsd 25 Jan 2006 21:52:43 -0000 1.9 >+++ schema/launchModes.exsd 15 Sep 2006 20:51:59 -0000 >@@ -7,10 +7,22 @@ > </appInfo> > <documentation> > This extension point provides a mechanism for contributing launch modes to the debug platform. The debug platform defines modes for "run", "debug", and "profile". >+ >+<p> >+<strong>EXPERIMENTAL</strong>. This extension point has been deprecated as >+part of a work in progress. There is no guarantee that this API will >+remain unchanged during the 3.3 release cycle. Please do not use this API >+without consulting with the Platform/Debug team. >+</p> > </documentation> > </annotation> > > <element name="extension"> >+ <annotation> >+ <appInfo> >+ <meta.element deprecated="true"/> >+ </appInfo> >+ </annotation> > <complexType> > <sequence> > <element ref="launchMode" minOccurs="0" maxOccurs="unbounded"/> >@@ -53,6 +65,9 @@ > <documentation> > specifies a unique identifier for this launch mode. The launch modes contributed by the debug plaform are "run", "debug", and "profile". > </documentation> >+ <appInfo> >+ <meta.attribute deprecated="true"/> >+ </appInfo> > </annotation> > </attribute> > <attribute name="label" type="string" use="required"> >@@ -61,7 +76,7 @@ > A human-readable label that describes the launch mode > </documentation> > <appInfo> >- <meta.attribute translatable="true"/> >+ <meta.attribute translatable="true" deprecated="true"/> > </appInfo> > </annotation> > </attribute> >@@ -71,7 +86,7 @@ > A human-readable label to be used in a launch cascade menu. For example "Run As". This attribute was added in 3.2 to allow the label to be properly externalized. When unspecified, a default label is created via concatenation. > </documentation> > <appInfo> >- <meta.attribute translatable="true"/> >+ <meta.attribute translatable="true" deprecated="true"/> > </appInfo> > </annotation> > </attribute> >Index: schema/launchConfigurationTypes.exsd >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/schema/launchConfigurationTypes.exsd,v >retrieving revision 1.15 >diff -u -r1.15 launchConfigurationTypes.exsd >--- schema/launchConfigurationTypes.exsd 9 Dec 2005 15:55:03 -0000 1.15 >+++ schema/launchConfigurationTypes.exsd 15 Sep 2006 20:51:59 -0000 >@@ -60,22 +60,39 @@ > </documentation> > </annotation> > </attribute> >- <attribute name="delegate" type="string" use="required"> >+ <attribute name="delegate" type="string"> > <annotation> > <documentation> > specifies the fully qualified name of the Java class that implements <code>ILaunchConfigurationDelegate</code>. > Launch configuration instances of this type will delegate to instances of this class to perform launching. >+ >+<p> >+<strong>EXPERIMENTAL</strong>. This attribute has been deprecated as >+part of a work in progress. There is no guarantee that this API will >+remain unchanged during the 3.3 release cycle. Please do not use this API >+without consulting with the Platform/Debug team. >+</p> > </documentation> > <appInfo> >- <meta.attribute kind="java" basedOn="org.eclipse.debug.core.model.ILaunchConfigurationDelegate"/> >+ <meta.attribute kind="java" basedOn="org.eclipse.debug.core.model.ILaunchConfigurationDelegate" deprecated="true"/> > </appInfo> > </annotation> > </attribute> >- <attribute name="modes" type="string" use="required"> >+ <attribute name="modes" type="string"> > <annotation> > <documentation> > specifies a comma-separated list of the modes this type of lauch configuration supports - "run" and/or "debug". >+ >+<p> >+<strong>EXPERIMENTAL</strong>. This attribute has been deprecated as >+part of a work in progress. There is no guarantee that this API will >+remain unchanged during the 3.3 release cycle. Please do not use this API >+without consulting with the Platform/Debug team. >+</p> > </documentation> >+ <appInfo> >+ <meta.attribute deprecated="true"/> >+ </appInfo> > </annotation> > </attribute> > <attribute name="name" type="string" use="required"> >@@ -126,6 +143,25 @@ > </appInfo> > </annotation> > </attribute> >+ <attribute name="icon" type="string"> >+ <annotation> >+ <documentation> >+ The id of the icon for this launch configuraiton type. >+ >+since 3.3 >+ >+<p> >+<strong>EXPERIMENTAL</strong>. This element has been added as >+part of a work in progress. There is no guarantee that this API will >+remain unchanged during the 3.3 release cycle. Please do not use this API >+without consulting with the Platform/Debug team. >+</p> >+ </documentation> >+ <appInfo> >+ <meta.attribute kind="resource"/> >+ </appInfo> >+ </annotation> >+ </attribute> > </complexType> > </element> > >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.60 >diff -u -r1.60 ILaunchManager.java >--- core/org/eclipse/debug/core/ILaunchManager.java 15 Sep 2006 02:33:50 -0000 1.60 >+++ core/org/eclipse/debug/core/ILaunchManager.java 15 Sep 2006 20:51:58 -0000 >@@ -213,6 +213,14 @@ > * @param mode mode identifier > * @return launch mode or <code>null</code> > * @since 3.0 >+ * >+ * @deprecated launch modes are removed for 3.3M3 in favour of launching with options >+ * <p> >+ * <strong>EXPERIMENTAL</strong>. This method has been deprecated as >+ * part of a work in progress. There is no guarantee that this API will >+ * remain unchanged during the 3.3 release cycle. Please do not use this API >+ * without consulting with the Platform/Debug team. >+ * </p> > */ > public ILaunchMode getLaunchMode(String mode); > >@@ -221,6 +229,14 @@ > * > * @return all registered launch modes > * @since 3.0 >+ * >+ * @deprecated launch modes are removed for 3.3M3 in favour of launching with options >+ * <p> >+ * <strong>EXPERIMENTAL</strong>. This method has been deprecated as >+ * part of a work in progress. There is no guarantee that this API will >+ * remain unchanged during the 3.3 release cycle. Please do not use this API >+ * without consulting with the Platform/Debug team. >+ * </p> > */ > public ILaunchMode[] getLaunchModes(); > >@@ -229,7 +245,7 @@ > * @param optionId the unique id of the launch option > * @return the lauch option associated with ther specified id or <code>null</code> if not found > * <p> >- * <strong>EXPERIMENTAL</strong>. This ,method has been added as >+ * <strong>EXPERIMENTAL</strong>. This method has been added as > * part of a work in progress. There is no guarantee that this API will > * remain unchanged during the 3.3 release cycle. Please do not use this API > * without consulting with the Platform/Debug team. >@@ -242,7 +258,7 @@ > * Returns all registered launch options > * @return all registered launch options > * <p> >- * <strong>EXPERIMENTAL</strong>. This ,method has been added as >+ * <strong>EXPERIMENTAL</strong>. This method has been added as > * part of a work in progress. There is no guarantee that this API will > * remain unchanged during the 3.3 release cycle. Please do not use this API > * without consulting with the Platform/Debug team. >@@ -252,6 +268,21 @@ > public ILaunchOption[] getLaunchOptions(); > > /** >+ * Returns all of the launch delegates. The rturned listing of delegates cannot be directly used to launch, >+ * instead the method <code>IlaunchDelegate.getDelegate</code> must be used to acquire an executable form of >+ * the delegate, allowing us to maintain lazy loading of the delegates themselves. >+ * @return all of the launch delegates >+ * @since 3.3 >+ * <p> >+ * <strong>EXPERIMENTAL</strong>. This method has been added as >+ * part of a work in progress. There is no guarantee that this API will >+ * remain unchanged during the 3.3 release cycle. Please do not use this API >+ * without consulting with the Platform/Debug team. >+ * </p> >+ */ >+ public ILaunchDelegate[] getLaunchDelegates(); >+ >+ /** > * Returns a collection of launch configurations that required migration to be > * compatible with current tooling. > * >Index: core/org/eclipse/debug/core/ILaunchConfigurationType.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchConfigurationType.java,v >retrieving revision 1.26 >diff -u -r1.26 ILaunchConfigurationType.java >--- core/org/eclipse/debug/core/ILaunchConfigurationType.java 12 Jun 2006 20:42:24 -0000 1.26 >+++ core/org/eclipse/debug/core/ILaunchConfigurationType.java 15 Sep 2006 20:51:58 -0000 >@@ -181,6 +181,13 @@ > * > * @return the set of all supported modes > * @since 3.2 >+ * @deprecated launch modes are removed for 3.3M3 in favour of launching with options >+ * <p> >+ * <strong>EXPERIMENTAL</strong>. This method has been deprecated as >+ * part of a work in progress. There is no guarantee that this API will >+ * remain unchanged during the 3.3 release cycle. Please do not use this API >+ * without consulting with the Platform/Debug team. >+ * </p> > */ > public Set getSupportedModes(); > >@@ -222,6 +229,44 @@ > * <code>DEBUG_MODE</code>. > * @return whether this kind of launch configuration supports the > * specified mode >+ * >+ * @deprecated launch modes are removed for 3.3M3 in favour of launching with options >+ * <p> >+ * <strong>EXPERIMENTAL</strong>. This method has been deprecated as >+ * part of a work in progress. There is no guarantee that this API will >+ * remain unchanged during the 3.3 release cycle. Please do not use this API >+ * without consulting with the Platform/Debug team. >+ * </p> > */ > public boolean supportsMode(String mode); >+ >+ /** >+ * Returns the simple name of the plugin that contributed this launch configuration type >+ * @return the name of the contributor >+ * @since 3.3 >+ * >+ * <p> >+ * <strong>EXPERIMENTAL</strong>. This method has been added as >+ * part of a work in progress. There is no guarantee that this API will >+ * remain unchanged during the 3.3 release cycle. Please do not use this API >+ * without consulting with the Platform/Debug team. >+ * </p> >+ */ >+ public String getContributorName(); >+ >+ /** >+ * Returns the path of the image descriptor for this launch configuration type, which in turn >+ * is used in <code>DebugPluginImages</code> to load the image registry with config images. >+ * NOTE: the path could be only a fragment, and might require qualification via the bundle of the contributor. >+ * @return the id of the image for this config type >+ * @since 3.3 >+ * >+ * <p> >+ * <strong>EXPERIMENTAL</strong>. This method has been added as >+ * part of a work in progress. There is no guarantee that this API will >+ * remain unchanged during the 3.3 release cycle. Please do not use this API >+ * without consulting with the Platform/Debug team. >+ * </p> >+ */ >+ public String getImageDescriptorPath(); > } >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 15 Sep 2006 20:51:58 -0000 >@@ -11,14 +11,11 @@ > package org.eclipse.debug.internal.core; > > >-import com.ibm.icu.text.MessageFormat; > import java.util.HashSet; > import java.util.Hashtable; >-import java.util.Iterator; >-import java.util.List; > import java.util.Map; > import java.util.Set; >-import java.util.StringTokenizer; >+ > import org.eclipse.core.resources.IContainer; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IConfigurationElement; >@@ -30,10 +27,13 @@ > import org.eclipse.debug.core.ILaunchConfigurationMigrationDelegate; > import org.eclipse.debug.core.ILaunchConfigurationType; > import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; >+import org.eclipse.debug.core.ILaunchDelegate; > import org.eclipse.debug.core.ILaunchManager; > import org.eclipse.debug.core.model.ILaunchConfigurationDelegate; > import org.eclipse.debug.core.sourcelookup.ISourcePathComputer; > >+import com.ibm.icu.text.MessageFormat; >+ > /** > * A launch configuration type wrappers a configuration > * element for a <code>launchConfigurationType</code> >@@ -41,22 +41,27 @@ > */ > public class LaunchConfigurationType extends PlatformObject implements ILaunchConfigurationType { > >- private static String MIGRATION_DELEGATE = "migrationDelegate"; //$NON-NLS-1$ >- > /** > * The configuration element of the extension. > */ > private IConfigurationElement fElement; > > /** >- * Base modes this type supports. >+ * a listing of modes contributed to this launch configuration type >+ * @since 3.3 >+ */ >+ private Set fModes = null; >+ >+ /** >+ * the default source path computer for this config type >+ * @since 3.3 > */ >- private Set fBaseModes; >+ private ISourcePathComputer fSourcePathComputer = null; > > /** >- * Modes that delegates have been contributed for >+ * The source locator id for this config type > */ >- private Set fContributedModes; >+ private String fSourceLocator = null; > > /** > * The delegates for launch configurations of this type. >@@ -73,71 +78,21 @@ > * @param element configuration element > */ > protected LaunchConfigurationType(IConfigurationElement element) { >- setConfigurationElement(element); >+ fElement = element; > } > > /* (non-Javadoc) > * @see org.eclipse.debug.core.ILaunchConfigurationType#getAttribute(java.lang.String) > */ > public String getAttribute(String attributeName) { >- return getConfigurationElement().getAttribute(attributeName); >+ return fElement.getAttribute(attributeName); > } >- >- /** >- * Returns the set of modes specified in the configuration data. >- * >- * @return the set of modes specified in the configuration data >- */ >- protected Set getBaseModes() { >- if (fBaseModes == null) { >- String modes= getConfigurationElement().getAttribute("modes"); //$NON-NLS-1$ >- if (modes == null) { >- return new HashSet(0); >- } >- StringTokenizer tokenizer= new StringTokenizer(modes, ","); //$NON-NLS-1$ >- fBaseModes = new HashSet(tokenizer.countTokens()); >- while (tokenizer.hasMoreTokens()) { >- fBaseModes.add(tokenizer.nextToken().trim()); >- } >- } >- return fBaseModes; >- } > > /* (non-Javadoc) > * @see org.eclipse.debug.core.ILaunchConfigurationType#getCategory() > */ > public String getCategory() { >- return getConfigurationElement().getAttribute("category"); //$NON-NLS-1$ >- } >- >- /** >- * Returns this type's configuration element. >- * >- * @return this type's configuration element >- */ >- protected IConfigurationElement getConfigurationElement() { >- return fElement; >- } >- >- /** >- * Returns the set of modes delegates have been contributed for >- * >- * @return the set of modes delegates have been contributed for >- */ >- protected Set getContributedModes() { >- if (fContributedModes == null) { >- fContributedModes = new HashSet(0); >- // add modes for contributed delegates >- List delegates = ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).getContributedDelegates(); >- Iterator iterator = delegates.iterator(); >- while (iterator.hasNext()) { >- ContributedDelegate delegate = (ContributedDelegate)iterator.next(); >- if (delegate.getLaunchConfigurationType().equals(getIdentifier())) { >- fContributedModes.addAll(delegate.getModes()); >- } >- } >- } >- return fContributedModes; >+ return fElement.getAttribute(ConfigurationElementConstants.CATEGORY); > } > > /** >@@ -164,40 +119,22 @@ > } > if (fDelegates == null) { > // initialize delegate table with base modes >- fDelegates = new Hashtable(3); >+ fDelegates = new Hashtable(); > } > ILaunchConfigurationDelegate delegate = (ILaunchConfigurationDelegate)fDelegates.get(mode); > if (delegate == null) { >- Set modes = getBaseModes(); >- if (modes.contains(mode)) { >- Object object = getConfigurationElement().createExecutableExtension("delegate"); //$NON-NLS-1$ >- if (object instanceof ILaunchConfigurationDelegate) { >- Iterator iter = modes.iterator(); >- while (iter.hasNext()) { >- fDelegates.put(iter.next(), object); >- } >- return (ILaunchConfigurationDelegate)object; >- } >- throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.LaunchConfigurationType_Launch_delegate_for__0__does_not_implement_required_interface_ILaunchConfigurationDelegate__1, new String[]{getName()}), null)); >- } >- // contributed modes >- List contributed = ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).getContributedDelegates(); >- Iterator iterator = contributed.iterator(); >- while (iterator.hasNext()) { >- ContributedDelegate contributedDelegate = (ContributedDelegate)iterator.next(); >- if (getIdentifier().equals(contributedDelegate.getLaunchConfigurationType())) { >- modes = contributedDelegate.getModes(); >- if (modes.contains(mode)) { >- delegate = contributedDelegate.getDelegate(); >- Iterator modesIterator = modes.iterator(); >- while (modesIterator.hasNext()) { >- fDelegates.put(modesIterator.next(), delegate); >- } >+ if(fModes.contains(mode)) { >+ ILaunchDelegate[] delegates = ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).getLaunchDelegates(); >+ for(int i = 0; i < delegates.length; i++) { >+ if(delegates[i].appliesTo(getIdentifier(), mode)) { >+ delegate = delegates[i].getDelegate(); >+ fDelegates.put(mode, delegate); > return delegate; > } > } > } >- } else { >+ } >+ else { > return delegate; > } > throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.LaunchConfigurationType_10, new String[] {getIdentifier(), mode}), null)); >@@ -207,14 +144,14 @@ > * @see org.eclipse.debug.core.ILaunchConfigurationType#getIdentifier() > */ > public String getIdentifier() { >- return getConfigurationElement().getAttribute("id"); //$NON-NLS-1$ >+ return fElement.getAttribute(ConfigurationElementConstants.ID); > } > > /* (non-Javadoc) > * @see org.eclipse.debug.core.ILaunchConfigurationType#getName() > */ > public String getName() { >- return getConfigurationElement().getAttribute("name"); //$NON-NLS-1$ >+ return fElement.getAttribute(ConfigurationElementConstants.NAME); > } > > /* (non-Javadoc) >@@ -228,50 +165,67 @@ > * @see org.eclipse.debug.core.ILaunchConfigurationType#getSourceLocatorId() > */ > public String getSourceLocatorId() { >- String id = getAttribute("sourceLocatorId"); //$NON-NLS-1$ >- if (id == null) { >- // check for specification by mode specific delegate >- List delegates = ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).getContributedDelegates(); >- Iterator iterator = delegates.iterator(); >- while (iterator.hasNext() && id == null) { >- ContributedDelegate delegate = (ContributedDelegate)iterator.next(); >- if (delegate.getLaunchConfigurationType().equals(getIdentifier())) { >- id = delegate.getSourceLocaterId(); >+ if(fSourceLocator == null) { >+ //try the type itself >+ fSourceLocator = getAttribute(ConfigurationElementConstants.SOURCE_LOCATOR); >+ if(fSourceLocator == null) { >+ //try from launch manager >+ ILaunchDelegate[] delegates = ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).getLaunchDelegates(); >+ for(int i = 0; i < delegates.length; i++) { >+ if(delegates[i].appliesTo(getIdentifier())) { >+ fSourceLocator = delegates[i].getSourceLocatorId(); >+ if(fSourceLocator != null) { >+ return fSourceLocator; >+ } >+ } > } > } > } >- return id; >+ return fSourceLocator; > } > > /* (non-Javadoc) > * @see org.eclipse.debug.core.ILaunchConfigurationType#getSourcePathComputer() > */ > public ISourcePathComputer getSourcePathComputer() { >- String id = getConfigurationElement().getAttribute("sourcePathComputerId"); //$NON-NLS-1$ >- if (id == null) { >- // check for specification by mode specific delegate >- List delegates = ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).getContributedDelegates(); >- Iterator iterator = delegates.iterator(); >- while (iterator.hasNext() && id == null) { >- ContributedDelegate delegate = (ContributedDelegate)iterator.next(); >- if (delegate.getLaunchConfigurationType().equals(getIdentifier())) { >- id = delegate.getSourcePathComputerId(); >+ if(fSourcePathComputer == null) { >+ //get the id >+ String id = fElement.getAttribute(ConfigurationElementConstants.SOURCE_PATH_COMPUTER); >+ LaunchManager lmgr = (LaunchManager)DebugPlugin.getDefault().getLaunchManager(); >+ if(id == null) { >+ //try from the launch manager >+ ILaunchDelegate[] delegates = lmgr.getLaunchDelegates(); >+ for(int i = 0; i < delegates.length; i++) { >+ if(delegates[i].appliesTo(getIdentifier())) { >+ id = delegates[i].getSourcePathComputerId(); >+ if(id != null) { >+ break; >+ } >+ } > } > } >+ if(id != null) { >+ fSourcePathComputer = lmgr.getSourcePathComputer(id); >+ } > } >- if (id != null && id.length() > 0) { >- return DebugPlugin.getDefault().getLaunchManager().getSourcePathComputer(id); >- } >- return null; >+ return fSourcePathComputer; > } > >- /* (non-Javadoc) >+ /** > * @see org.eclipse.debug.core.ILaunchConfigurationType#getSupportedModes() >+ * @deprecated launch modes are removed for 3.3M3 in favour of launching with options > */ > public Set getSupportedModes() { >- HashSet modes = new HashSet(getBaseModes()); >- modes.addAll(getContributedModes()); >- return modes; >+ if(fModes == null) { >+ fModes = new HashSet(); >+ ILaunchDelegate[] delegates = ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).getLaunchDelegates(); >+ for(int i= 0; i < delegates.length; i++) { >+ if(delegates[i].appliesTo(getIdentifier())) { >+ fModes.addAll(delegates[i].getModes()); >+ } >+ } >+ } >+ return fModes; > } > > /** >@@ -283,14 +237,14 @@ > * @since 3.2 > */ > public boolean isMigrationCandidate(ILaunchConfiguration candidate) throws CoreException { >- if(getAttribute(MIGRATION_DELEGATE) != null) { >+ if(getAttribute(ConfigurationElementConstants.MIGRATION_DELEGATE) != null) { > if(fDelegates == null) { > fDelegates = new Hashtable(); > } >- Object delegate = fDelegates.get(MIGRATION_DELEGATE); >+ Object delegate = fDelegates.get(ConfigurationElementConstants.MIGRATION_DELEGATE); > if(delegate == null) { >- delegate = getConfigurationElement().createExecutableExtension(MIGRATION_DELEGATE); >- fDelegates.put(MIGRATION_DELEGATE, delegate); >+ delegate = fElement.createExecutableExtension(ConfigurationElementConstants.MIGRATION_DELEGATE); >+ fDelegates.put(ConfigurationElementConstants.MIGRATION_DELEGATE, delegate); > } > if(delegate instanceof ILaunchConfigurationMigrationDelegate) { > return ((ILaunchConfigurationMigrationDelegate)delegate).isCandidate(candidate); >@@ -303,7 +257,7 @@ > * @see org.eclipse.debug.core.ILaunchConfigurationType#isPublic() > */ > public boolean isPublic() { >- String publicString = getConfigurationElement().getAttribute("public"); //$NON-NLS-1$ >+ String publicString = fElement.getAttribute(ConfigurationElementConstants.PUBLIC); > if (publicString != null) { > if (publicString.equalsIgnoreCase("false")) { //$NON-NLS-1$ > return false; >@@ -320,14 +274,14 @@ > * @since 3.2 > */ > public void migrate(ILaunchConfiguration candidate) throws CoreException { >- if(getAttribute(MIGRATION_DELEGATE) != null) { >+ if(getAttribute(ConfigurationElementConstants.MIGRATION_DELEGATE) != null) { > if(fDelegates == null) { > fDelegates = new Hashtable(); > } >- Object delegate = fDelegates.get(MIGRATION_DELEGATE); >+ Object delegate = fDelegates.get(ConfigurationElementConstants.MIGRATION_DELEGATE); > if(delegate == null) { >- delegate = getConfigurationElement().createExecutableExtension(MIGRATION_DELEGATE); >- fDelegates.put(MIGRATION_DELEGATE, delegate); >+ delegate = fElement.createExecutableExtension(ConfigurationElementConstants.MIGRATION_DELEGATE); >+ fDelegates.put(ConfigurationElementConstants.MIGRATION_DELEGATE, delegate); > } > if(delegate instanceof ILaunchConfigurationMigrationDelegate) { > ((ILaunchConfigurationMigrationDelegate)delegate).migrate(candidate); >@@ -339,23 +293,29 @@ > * @see org.eclipse.debug.core.ILaunchConfigurationType#newInstance(org.eclipse.core.resources.IContainer, java.lang.String) > */ > public ILaunchConfigurationWorkingCopy newInstance(IContainer container, String name) { >- return new LaunchConfigurationWorkingCopy(container, name, this); >+ return new LaunchConfigurationWorkingCopy(container, name, this); > } > > /** >- * Sets this type's configuration element. >- * >- * @param element this type's configuration element >+ * @see org.eclipse.debug.core.ILaunchConfigurationType#supportsMode(java.lang.String) >+ * @deprecated launch modes are removed for 3.3M3 in favour of launching with options > */ >- private void setConfigurationElement(IConfigurationElement element) { >- fElement = element; >+ public boolean supportsMode(String mode) { >+ return getSupportedModes().contains(mode); > } >- >- /** >- * @see ILaunchConfigurationType#supportsMode(String) >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.ILaunchConfigurationType#getContributorName() > */ >- public boolean supportsMode(String mode) { >- return getBaseModes().contains(mode) || getContributedModes().contains(mode); >+ public String getContributorName() { >+ return fElement.getContributor().getName(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.ILaunchConfigurationType#getImageDescriptorId() >+ */ >+ public String getImageDescriptorPath() { >+ return fElement.getAttribute(ConfigurationElementConstants.ICON); > } > } > >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.167 >diff -u -r1.167 LaunchManager.java >--- core/org/eclipse/debug/internal/core/LaunchManager.java 13 Sep 2006 19:09:07 -0000 1.167 >+++ core/org/eclipse/debug/internal/core/LaunchManager.java 15 Sep 2006 20:51:59 -0000 >@@ -76,6 +76,7 @@ > import org.eclipse.debug.core.ILaunchConfiguration; > import org.eclipse.debug.core.ILaunchConfigurationListener; > import org.eclipse.debug.core.ILaunchConfigurationType; >+import org.eclipse.debug.core.ILaunchDelegate; > import org.eclipse.debug.core.ILaunchListener; > import org.eclipse.debug.core.ILaunchManager; > import org.eclipse.debug.core.ILaunchMode; >@@ -507,17 +508,14 @@ > * @throws IOException if the encoding attempted to be used is not supported > */ > public static String serializeDocument(Document doc) throws TransformerException, IOException { >- ByteArrayOutputStream s= new ByteArrayOutputStream(); >- >- TransformerFactory factory= TransformerFactory.newInstance(); >- Transformer transformer= factory.newTransformer(); >+ ByteArrayOutputStream s = new ByteArrayOutputStream(); >+ TransformerFactory factory = TransformerFactory.newInstance(); >+ Transformer transformer = factory.newTransformer(); > transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ > transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ >- >- DOMSource source= new DOMSource(doc); >- StreamResult outputTarget= new StreamResult(s); >+ DOMSource source = new DOMSource(doc); >+ StreamResult outputTarget = new StreamResult(s); > transformer.transform(source, outputTarget); >- > return s.toString("UTF8"); //$NON-NLS-1$ > } > >@@ -564,8 +562,16 @@ > private HashMap fLaunchOptions = null; > > /** >+ * A map of ILaunchDelegate objects stored by id of delegate, or launch config type >+ */ >+ private HashMap fLaunchDelegates = null; >+ >+ /** > * List of contributed launch delegates (delegates contributed for existing > * launch configuration types). >+ * >+ * @deprecated as of 3.3M3, all delegates are treated as simply <code>ILaunchDelegate</code>s. there is no distinction >+ * between them (those contributd via the launch config type and those contributed via a <code>launchDelegates</code> contribution. > */ > private List fContributedDelegates = null; > >@@ -830,8 +836,9 @@ > } > Iterator iter = list.iterator(); > List configs = new ArrayList(list.size()); >+ IFile file = null; > while (iter.hasNext()) { >- IFile file = (IFile)iter.next(); >+ file = (IFile)iter.next(); > configs.add(getLaunchConfiguration(file)); > } > return configs; >@@ -856,8 +863,9 @@ > } > }; > String[] files = directory.list(filter); >+ LaunchConfiguration config = null; > for (int i = 0; i < files.length; i++) { >- LaunchConfiguration config = new LaunchConfiguration(containerPath.append(files[i])); >+ config = new LaunchConfiguration(containerPath.append(files[i])); > configs.add(config); > } > } >@@ -893,13 +901,13 @@ > try { > index = Integer.parseInt(trailer); > baseName = baseName.substring(0, copyIndex); >- } catch (NumberFormatException nfe) { >- } >+ } >+ catch (NumberFormatException nfe) {} > } > } > String newName = baseName; > >- StringBuffer buffer= null; >+ StringBuffer buffer = null; > while (isExistingLaunchConfigurationName(newName)) { > buffer = new StringBuffer(baseName); > buffer.append(" ("); //$NON-NLS-1$ >@@ -995,16 +1003,18 @@ > List configs = new ArrayList(4); > NodeList list = root.getChildNodes(); > int length = list.getLength(); >+ Node node = null; >+ Element entry = null; >+ String memento = null; > for (int i = 0; i < length; ++i) { >- Node node = list.item(i); >+ node = list.item(i); > short type = node.getNodeType(); > if (type == Node.ELEMENT_NODE) { >- Element entry = (Element) node; >- String nodeName = entry.getNodeName(); >- if (!nodeName.equals("launchConfiguration")) { //$NON-NLS-1$ >+ entry = (Element) node; >+ if (!entry.getNodeName().equals("launchConfiguration")) { //$NON-NLS-1$ > throw invalidFormat; > } >- String memento = entry.getAttribute("memento"); //$NON-NLS-1$ >+ memento = entry.getAttribute("memento"); //$NON-NLS-1$ > if (memento == null) { > throw invalidFormat; > } >@@ -1016,18 +1026,7 @@ > > protected ConfigurationNotifier getConfigurationNotifier() { > return new ConfigurationNotifier(); >- } >- >- /** >- * Returns a list of launch delegates contributed for existing launch configuration >- * types. >- * >- * @return list of ContributedDelegate >- */ >- protected List getContributedDelegates() { >- initializeContributedDelegates(); >- return fContributedDelegates; >- } >+ } > > /** > * @see ILaunchManager#getDebugTargets() >@@ -1036,9 +1035,10 @@ > synchronized (fLaunches) { > List allTargets= new ArrayList(fLaunches.size()); > if (fLaunches.size() > 0) { >- Iterator e= fLaunches.iterator(); >+ Iterator e = fLaunches.iterator(); >+ IDebugTarget[] targets = null; > while (e.hasNext()) { >- IDebugTarget[] targets= ((ILaunch) e.next()).getDebugTargets(); >+ targets = ((ILaunch) e.next()).getDebugTargets(); > for (int i = 0; i < targets.length; i++) { > allTargets.add(targets[i]); > } >@@ -1073,10 +1073,9 @@ > if (configEnv == null) { > return null; > } >- Map env = null; >+ Map env = new HashMap(); > // build base environment >- env= new HashMap(); >- boolean append= configuration.getAttribute(ATTR_APPEND_ENVIRONMENT_VARIABLES, true); >+ boolean append = configuration.getAttribute(ATTR_APPEND_ENVIRONMENT_VARIABLES, true); > if (append) { > env.putAll(getNativeEnvironmentCasePreserved()); > } >@@ -1084,10 +1083,17 @@ > // Add variables from config > Iterator iter= configEnv.entrySet().iterator(); > boolean win32= Platform.getOS().equals(Constants.OS_WIN32); >+ Map.Entry entry = null; >+ String key = null; >+ String value = null; >+ Object nativeValue = null; >+ Iterator envIter = null; >+ Map.Entry nativeEntry = null; >+ String nativeKey = null; > while (iter.hasNext()) { >- Map.Entry entry= (Map.Entry) iter.next(); >- String key= (String) entry.getKey(); >- String value = (String) entry.getValue(); >+ entry = (Map.Entry) iter.next(); >+ key = (String) entry.getKey(); >+ value = (String) entry.getValue(); > // translate any string substitution variables > if (value != null) { > value = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(value); >@@ -1095,7 +1101,7 @@ > boolean added= false; > if (win32) { > // First, check if the key is an exact match for an existing key. >- Object nativeValue= env.get(key); >+ nativeValue = env.get(key); > if (nativeValue != null) { > // If an exact match is found, just replace the value > env.put(key, value); >@@ -1103,13 +1109,13 @@ > // Win32 vars are case-insensitive. If an exact match isn't found, iterate to > // check for a case-insensitive match. We maintain the key's case (see bug 86725), > // but do a case-insensitive comparison (for example, "pAtH" will still override "PATH"). >- Iterator envIter= env.entrySet().iterator(); >+ envIter = env.entrySet().iterator(); > while (envIter.hasNext()) { >- Map.Entry nativeEntry = (Map.Entry) envIter.next(); >- String nativeKey= (String) (nativeEntry).getKey(); >+ nativeEntry = (Map.Entry) envIter.next(); >+ nativeKey = (String) (nativeEntry).getKey(); > if (nativeKey.equalsIgnoreCase(key)) { > nativeEntry.setValue(value); >- added= true; >+ added = true; > break; > } > } >@@ -1120,11 +1126,12 @@ > } > } > >- iter= env.entrySet().iterator(); >- List strings= new ArrayList(env.size()); >+ iter = env.entrySet().iterator(); >+ List strings = new ArrayList(env.size()); >+ StringBuffer buffer = null; > while (iter.hasNext()) { >- Map.Entry entry = (Map.Entry) iter.next(); >- StringBuffer buffer= new StringBuffer((String) entry.getKey()); >+ entry = (Map.Entry) iter.next(); >+ buffer = new StringBuffer((String) entry.getKey()); > buffer.append('=').append((String) entry.getValue()); > strings.add(buffer.toString()); > } >@@ -1215,8 +1222,9 @@ > public ILaunchConfiguration[] getLaunchConfigurations(ILaunchConfigurationType type) throws CoreException { > Iterator iter = getAllLaunchConfigurations().iterator(); > List configs = new ArrayList(); >+ ILaunchConfiguration config = null; > while (iter.hasNext()) { >- ILaunchConfiguration config = (ILaunchConfiguration)iter.next(); >+ config = (ILaunchConfiguration)iter.next(); > if (config.getType().equals(type)) { > configs.add(config); > } >@@ -1224,7 +1232,6 @@ > return (ILaunchConfiguration[])configs.toArray(new ILaunchConfiguration[configs.size()]); > } > >- > /** > * Returns all launch configurations that are stored as resources > * in the given project. >@@ -1236,9 +1243,11 @@ > protected List getLaunchConfigurations(IProject project) { > Iterator iter = getAllLaunchConfigurations().iterator(); > List configs = new ArrayList(); >+ ILaunchConfiguration config = null; >+ IFile file = null; > while (iter.hasNext()) { >- ILaunchConfiguration config = (ILaunchConfiguration)iter.next(); >- IFile file = config.getFile(); >+ config = (ILaunchConfiguration)iter.next(); >+ file = config.getFile(); > if (file != null && file.getProject().equals(project)) { > configs.add(config); > } >@@ -1276,16 +1285,18 @@ > } > } > >- /* (non-Javadoc) >+ /**) > * @see org.eclipse.debug.core.ILaunchManager#getLaunchMode(java.lang.String) >+ * @deprecated launch modes are removed for 3.3M3 in favour of launching with options > */ > public ILaunchMode getLaunchMode(String mode) { > initializeLaunchModes(); > return (ILaunchMode) fLaunchModes.get(mode); > } > >- /* (non-Javadoc) >+ /** > * @see org.eclipse.debug.core.ILaunchManager#getLaunchModes() >+ * @deprecated launch modes are removed for 3.3M3 in favour of launching with options > */ > public ILaunchMode[] getLaunchModes() { > initializeLaunchModes(); >@@ -1309,7 +1320,79 @@ > Collection col = fLaunchOptions.values(); > return (ILaunchOption[])col.toArray(new ILaunchOption[col.size()]); > } >- >+ >+ /** >+ * Initializes the listing of registered launch options. Does no work if the mapping is already populated. >+ * @since 3.3 >+ */ >+ private synchronized void initializeLaunchOptions() { >+ if(fLaunchOptions == null) { >+ try { >+ IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_OPTIONS); >+ IConfigurationElement[] infos = extensionPoint.getConfigurationElements(); >+ fLaunchOptions = new HashMap(); >+ ILaunchOption option = null; >+ for(int i = 0; i < infos.length; i++) { >+ option = new LaunchOption(infos[i]); >+ fLaunchOptions.put(option.getIdentifier(), option); >+ } >+ } >+ catch(CoreException ce) {DebugPlugin.log(ce);} >+ } >+ } >+ >+ /** >+ * @return the listing of launch delegates available to the launching framework >+ * @since 3.3 >+ */ >+ public ILaunchDelegate[] getLaunchDelegates() { >+ initializeLaunchDelegates(); >+ Collection col = fLaunchDelegates.values(); >+ return (ILaunchDelegate[]) col.toArray(new ILaunchDelegate[col.size()]); >+ } >+ >+ /** >+ * Finds a launch delegate associated with the specified id. For backwards compatibility id can be either >+ * the id provided in a <code>launchDelegates</code> contribution, or the id provided in a >+ * <code>launchConfigurationTypes</code> contribution. >+ * @param configtypeId the id of the delegate to search for >+ * @return the <code>ILaunchDelegate</code> associated with the specifed id or <code>null</code> if no >+ * mapping exists >+ * @since 3.3 >+ */ >+ public ILaunchDelegate getLaunchDelegate(String id) { >+ initializeLaunchDelegates(); >+ return (ILaunchDelegate) fLaunchDelegates.get(id); >+ } >+ >+ /** >+ * Initializes the listing of delegates available to the launching framework >+ * @since 3.3 >+ */ >+ private synchronized void initializeLaunchDelegates() { >+ if(fLaunchDelegates == null) { >+ fLaunchDelegates = new HashMap(); >+ //get all launch delegate contributions >+ IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_DELEGATES); >+ IConfigurationElement[] infos = extensionPoint.getConfigurationElements(); >+ ILaunchDelegate delegate = null; >+ for(int i = 0; i < infos.length; i++) { >+ delegate = new LaunchDelegate(infos[i]); >+ fLaunchDelegates.put(delegate.getIdentifier(), delegate); >+ } >+ //get all delegates from launch configuration type contributions >+ extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES); >+ infos = extensionPoint.getConfigurationElements(); >+ for(int i = 0; i < infos.length; i++) { >+ //must check to see if delegate is provided in contribution >+ if(infos[i].getAttribute("delegate") != null) { //$NON-NLS-1$ >+ delegate = new LaunchDelegate(infos[i]); >+ fLaunchDelegates.put(delegate.getIdentifier(), delegate); >+ } >+ } >+ } >+ } >+ > /** > * Returns all launch configurations that are stored locally. > * >@@ -1397,9 +1480,11 @@ > if (Platform.getOS().equals(Constants.OS_WIN32)) { > fgNativeEnv= new HashMap(); > Iterator entries = casePreserved.entrySet().iterator(); >+ Map.Entry entry = null; >+ String key = null; > while (entries.hasNext()) { >- Map.Entry entry = (Entry) entries.next(); >- String key = ((String)entry.getKey()).toUpperCase(); >+ entry = (Entry) entries.next(); >+ key = ((String)entry.getKey()).toUpperCase(); > fgNativeEnv.put(key, entry.getValue()); > } > } else { >@@ -1425,10 +1510,11 @@ > */ > public IProcess[] getProcesses() { > synchronized (fLaunches) { >- List allProcesses= new ArrayList(fLaunches.size()); >- Iterator e= fLaunches.iterator(); >+ List allProcesses = new ArrayList(fLaunches.size()); >+ Iterator e = fLaunches.iterator(); >+ IProcess[] processes = null; > while (e.hasNext()) { >- IProcess[] processes= ((ILaunch) e.next()).getProcesses(); >+ processes = ((ILaunch) e.next()).getProcesses(); > for (int i= 0; i < processes.length; i++) { > allProcesses.add(processes[i]); > } >@@ -1494,9 +1580,11 @@ > IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_COMPARATORS); > IConfigurationElement[] infos= extensionPoint.getConfigurationElements(); > fComparators = new HashMap(infos.length); >+ IConfigurationElement configurationElement = null; >+ String attr = null; > for (int i= 0; i < infos.length; i++) { >- IConfigurationElement configurationElement = infos[i]; >- String attr = configurationElement.getAttribute("attribute"); //$NON-NLS-1$ >+ configurationElement = infos[i]; >+ attr = configurationElement.getAttribute("attribute"); //$NON-NLS-1$ > if (attr != null) { > fComparators.put(attr, new LaunchConfigurationComparator(configurationElement)); > } else { >@@ -1508,32 +1596,18 @@ > } > } > } >- >+ > /** >- * Initializes contributed launch delegates (i.e. delegates contributed >- * to an existing launch configuration type). >+ * Initializes the listing of <code>LaunchConfigurationType</code>s. > */ >- private synchronized void initializeContributedDelegates() { >- if (fContributedDelegates == null) { >- IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_DELEGATES); >- IConfigurationElement[] infos = extensionPoint.getConfigurationElements(); >- fContributedDelegates = new ArrayList(infos.length); >- for (int i= 0; i < infos.length; i++) { >- fContributedDelegates.add(new ContributedDelegate(infos[i])); >- } >- } >- } >- > private synchronized void initializeLaunchConfigurationTypes() { > if (fLaunchConfigurationTypes == null) { > hookResourceChangeListener(); > IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES); >- IConfigurationElement[] infos= extensionPoint.getConfigurationElements(); >- fLaunchConfigurationTypes= new ArrayList(infos.length); >- for (int i= 0; i < infos.length; i++) { >- IConfigurationElement configurationElement = infos[i]; >- LaunchConfigurationType configType = new LaunchConfigurationType(configurationElement); >- fLaunchConfigurationTypes.add(configType); >+ IConfigurationElement[] infos = extensionPoint.getConfigurationElements(); >+ fLaunchConfigurationTypes = new ArrayList(infos.length); >+ for (int i= 0; i < infos.length; i++) { >+ fLaunchConfigurationTypes.add(new LaunchConfigurationType(infos[i])); > } > } > } >@@ -1543,6 +1617,7 @@ > * > * @exception CoreException if an exception occurs reading > * the extensions >+ * > */ > private synchronized void initializeLaunchModes() { > if (fLaunchModes == null) { >@@ -1559,26 +1634,6 @@ > catch (CoreException e) {DebugPlugin.log(e);} > } > } >- >- /** >- * Initializes the listing of registered launch options. Does no work if the mapping is already populated. >- * @since 3.3 >- */ >- private synchronized void initializeLaunchOptions() { >- if(fLaunchOptions == null) { >- try { >- IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_OPTIONS); >- IConfigurationElement[] infos = extensionPoint.getConfigurationElements(); >- fLaunchOptions = new HashMap(); >- ILaunchOption option = null; >- for(int i = 0; i < infos.length; i++) { >- option = new LaunchOption(infos[i]); >- fLaunchOptions.put(option.getIdentifier(), option); >- } >- } >- catch(CoreException ce) {DebugPlugin.log(ce);} >- } >- } > > /** > * Initializes source container type and source path computer extensions. >@@ -1615,9 +1670,11 @@ > IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_SOURCE_LOCATORS); > IConfigurationElement[] infos= extensionPoint.getConfigurationElements(); > fSourceLocators= new HashMap(infos.length); >+ IConfigurationElement configurationElement = null; >+ String id = null; > for (int i= 0; i < infos.length; i++) { >- IConfigurationElement configurationElement = infos[i]; >- String id = configurationElement.getAttribute("id"); //$NON-NLS-1$ >+ configurationElement = infos[i]; >+ id = configurationElement.getAttribute("id"); //$NON-NLS-1$ > if (id != null) { > fSourceLocators.put(id,configurationElement); > } else { >@@ -1812,8 +1869,7 @@ > if (!configs.isEmpty()) { > Iterator iterator = configs.iterator(); > while (iterator.hasNext()) { >- ILaunchConfiguration configuration = (ILaunchConfiguration)iterator.next(); >- launchConfigurationDeleted(configuration); >+ launchConfigurationDeleted((ILaunchConfiguration)iterator.next()); > } > } > //bug 12134 >@@ -1832,8 +1888,7 @@ > if (!configs.isEmpty()) { > Iterator iterator = configs.iterator(); > while (iterator.hasNext()) { >- ILaunchConfiguration config = (ILaunchConfiguration) iterator.next(); >- launchConfigurationAdded(config); >+ launchConfigurationAdded((ILaunchConfiguration) iterator.next()); > } > } > } >@@ -1953,8 +2008,9 @@ > fLaunchesListeners = new ListenerList(); > fLaunchConfigurationListeners = new ListenerList(); > ILaunch[] launches = getLaunches(); >+ ILaunch launch = null; > for (int i= 0; i < launches.length; i++) { >- ILaunch launch= launches[i]; >+ launch = launches[i]; > try { > if (launch instanceof IDisconnect) { > IDisconnect disconnect = (IDisconnect)launch; >@@ -2014,8 +2070,9 @@ > */ > protected void verifyConfigurations(List verify, List valid) { > Iterator configs = verify.iterator(); >+ ILaunchConfiguration config = null; > while (configs.hasNext()) { >- ILaunchConfiguration config = (ILaunchConfiguration)configs.next(); >+ config = (ILaunchConfiguration)configs.next(); > if (isValid(config)) { > valid.add(config); > } >Index: core/org/eclipse/debug/internal/core/ContributedDelegate.java >=================================================================== >RCS file: core/org/eclipse/debug/internal/core/ContributedDelegate.java >diff -N core/org/eclipse/debug/internal/core/ContributedDelegate.java >--- core/org/eclipse/debug/internal/core/ContributedDelegate.java 8 May 2006 19:48:58 -0000 1.9 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,145 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- *******************************************************************************/ >-package org.eclipse.debug.internal.core; >- >-import com.ibm.icu.text.MessageFormat; >-import java.util.HashSet; >-import java.util.Set; >-import org.eclipse.core.runtime.CoreException; >-import org.eclipse.core.runtime.IConfigurationElement; >-import org.eclipse.core.runtime.IStatus; >-import org.eclipse.core.runtime.Status; >-import org.eclipse.debug.core.DebugPlugin; >-import org.eclipse.debug.core.model.ILaunchConfigurationDelegate; >- >-/** >- * A placeholder for a launch delegate contributed for a launch mode for an >- * existing launch configuration type. >- */ >-public class ContributedDelegate { >- >- /** >- * The configuration element of the extension. >- */ >- private IConfigurationElement fElement; >- >- /** >- * Modes this delegate supports. >- */ >- private Set fModes; >- >- /** >- * Delegate, or <code>null</code> if not yet instantiated. >- */ >- private ILaunchConfigurationDelegate fDelegate; >- >- /** >- * Constructs a new contributed delegate on the >- * given configuration element. >- * >- * @param element configuration element >- */ >- protected ContributedDelegate(IConfigurationElement element) { >- setConfigurationElement(element); >- } >- >- /** >- * Sets this delegate's configuration element. >- * >- * @param element this delegate's configuration element >- */ >- private void setConfigurationElement(IConfigurationElement element) { >- fElement = element; >- } >- >- /** >- * Returns this delegate's configuration element. >- * >- * @return this delegate's configuration element >- */ >- protected IConfigurationElement getConfigurationElement() { >- return fElement; >- } >- >- /** >- * Returns the set of modes specified in the configuration data. >- * >- * @return the set of modes specified in the configuration data >- */ >- protected Set getModes() { >- if (fModes == null) { >- String modes= getConfigurationElement().getAttribute("modes"); //$NON-NLS-1$ >- if (modes == null) { >- return new HashSet(0); >- } >- String[] strings = modes.split(","); //$NON-NLS-1$ >- fModes = new HashSet(3); >- for (int i = 0; i < strings.length; i++) { >- String string = strings[i]; >- fModes.add(string.trim()); >- } >- } >- return fModes; >- } >- >- /** >- * Returns the type identifier of launch configuration type this delegate is >- * contributed to. >- */ >- protected String getLaunchConfigurationType() { >- return getConfigurationElement().getAttribute("type"); //$NON-NLS-1$ >- } >- >- protected ILaunchConfigurationDelegate getDelegate() throws CoreException { >- if (fDelegate == null) { >- Object object = getConfigurationElement().createExecutableExtension("delegate"); //$NON-NLS-1$ >- if (object instanceof ILaunchConfigurationDelegate) { >- fDelegate = (ILaunchConfigurationDelegate)object; >- } else { >- throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.LaunchConfigurationType_Launch_delegate_for__0__does_not_implement_required_interface_ILaunchConfigurationDelegate__1, new String[]{getIdentifier()}), null)); >- } >- } >- return fDelegate; >- } >- >- /** >- * Returns the identifier of this extension point. >- */ >- protected String getIdentifier() { >- return getConfigurationElement().getAttribute("id"); //$NON-NLS-1$ >- } >- >- /** >- * Returns the source path computer id specified by this launch delegate >- * or <code>null</code> if none. >- * >- * @return the source path computer id specified by this launch delegate >- * or <code>null</code> if none >- * >- * @since 3.1 >- */ >- protected String getSourcePathComputerId() { >- return getConfigurationElement().getAttribute("sourcePathComputerId"); //$NON-NLS-1$ >- } >- >- /** >- * Returns the source locater id specified by this launch delegate >- * or <code>null</code> if none. >- * >- * @return the source locater id specified by this launch delegate >- * or <code>null</code> if none >- * >- * @since 3.1 >- */ >- protected String getSourceLocaterId() { >- return getConfigurationElement().getAttribute("sourceLocatorId"); //$NON-NLS-1$ >- } >-} >Index: buildnotes_platform-debug.html >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.core/buildnotes_platform-debug.html,v >retrieving revision 1.1637 >diff -u -r1.1637 buildnotes_platform-debug.html >--- buildnotes_platform-debug.html 13 Sep 2006 19:09:07 -0000 1.1637 >+++ buildnotes_platform-debug.html 15 Sep 2006 20:51:58 -0000 >@@ -24,6 +24,18 @@ > <li>Added <code>ILaunchOption</code> -- which describes a single contributed launch option within the launch manager</li> > <li>Added <code>ILaunchManager.getLaunchOptions()</code> -- returns and array of all of the <code>ILaunchOptions</code> registered with the launch manager</li> > <li>Added <code>ILaunchManager.getLaunchOption(String id)</code> -- returns the <code>ILaunchOption</code> associated with the given unique id, or <code>null</code></li> >+ <li>Added <code>launchDelegates</code> extension point atribute: name</li> >+ <li>Added <code>launchDelegates</code> extension point sub-elements: and, or, appliesTo and option</li> >+ <li>Added <code>launchConfigurationTypes</code> extension point attribute: icon</li> >+ <li>Deprecated <code>launchConfigurationTypes</code> extension point attributes: delegate and modes</li> >+ <li>Deprecated <code>launchModes</code> extension point</li> >+ <li>Deprecated <code>ILaunchConfigurationType.getSupportedModes</code></li> >+ <li>Deprecated <code>ILaunchConfigurationType.supportsMode(String)</code></li> >+ <li>Deprecated <code>ILaunchManager.getLaunchMode(String)</code></li> >+ <li>Deprecated <code>ILaunchManager.getLaunchModes()</code></li> >+ <li>Deprecated <code>launchDelegates</code> extension point attributes: modes and type</li> >+ <li>Deprecated <code>launchConfigurationTypeImages</code> extension point</li> >+ > </ul> > > <h2>Sep 12, 2006</h2> >Index: core/org/eclipse/debug/core/ILaunchDelegate.java >=================================================================== >RCS file: core/org/eclipse/debug/core/ILaunchDelegate.java >diff -N core/org/eclipse/debug/core/ILaunchDelegate.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ core/org/eclipse/debug/core/ILaunchDelegate.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,97 @@ >+/******************************************************************************* >+ * 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.core; >+ >+import java.util.Set; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.debug.core.model.ILaunchConfigurationDelegate; >+ >+/** >+ * This interface describes a launch delegate >+ * Clients can contribute launch delegate through the <code>launchDelegates</code> extension point >+ * >+ * Example contribution of the local java launch delegate >+ * <pre> >+ * <launchDelegate >+ delegate="org.eclipse.jdt.launching.JavaLaunchDelegate" >+ id="org.eclipse.jdt.launching.JavaLaunchDelegate"> >+ <appliesTo >+ type="org.eclipse.jdt.launching.localJavaApplication"> >+ <option >+ option="debug"> >+ </option> >+ </appliesTo> >+ </launchDelegate> >+ * </pre> >+ * >+ * Clients are NOT intended to implement this interface >+ * @since 3.3 >+ */ >+public interface ILaunchDelegate { >+ >+ /** >+ * @return returns the unique id of the delegate >+ */ >+ public String getIdentifier(); >+ >+ /** >+ * @return the launch delegate >+ */ >+ public ILaunchConfigurationDelegate getDelegate() throws CoreException; >+ >+ /** >+ * One delegate definition can now be associated with more than on launch configuration type. >+ * In this case we need to return them all. In the deprecated case when one delegate is associated >+ * with one type, we only need return the one (a set of only one element) >+ * @return the set of associated launch configuration type ids (String) or the empty set, never <code>null</code> >+ */ >+ public Set getLaunchConfigurationTypes(); >+ >+ /** >+ * @return the associated source locator id or <code>null</code> if not provided >+ */ >+ public String getSourceLocatorId(); >+ >+ /** >+ * @return the associated source path computer id or <code>null</code> if not provided >+ */ >+ public String getSourcePathComputerId(); >+ >+ /** >+ * @return the options associated with this delegate. If no options are specified an empty set is >+ * returned, never <code>null</code>. >+ */ >+ public Set getOptions(); >+ >+ /** >+ * This method is provided as a backward compatibility measure to allow access to modes, if mode-based >+ * launching is still being used. >+ * >+ * @return a set of modes for this delegate or the empty set if none are found, never <code>null</code>. >+ */ >+ public Set getModes(); >+ >+ /** >+ * used to determine if the delegate applies to the specified launch configuration type via its id only (no expression evaluation is done) >+ * @param configtypeId the id of the <code>ILaunchConfigurationType</code>. >+ * @return true if the delegate applies to the associated config type, false otherwise >+ */ >+ public boolean appliesTo(String configtypeId); >+ >+ /** >+ * used to determine if the delegate applies to the specified launch configuration type via its id and mode (no expression evaluation is done) >+ * @param configtypeId the id of the <code>ILaunchConfigurationType</code>. >+ * @param mode the mode >+ * @return true if the delegate applies to the associated config type, false otherwise >+ */ >+ public boolean appliesTo(String configtypeId, String mode); >+} >Index: core/org/eclipse/debug/internal/core/ConfigurationElementConstants.java >=================================================================== >RCS file: core/org/eclipse/debug/internal/core/ConfigurationElementConstants.java >diff -N core/org/eclipse/debug/internal/core/ConfigurationElementConstants.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ core/org/eclipse/debug/internal/core/ConfigurationElementConstants.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,89 @@ >+/******************************************************************************* >+ * 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.core; >+ >+/** >+ * This class provides a repository for the names of <code>IConfigurationElement</code> child node ids. >+ * @since 3.3 >+ * <p> >+ * <strong>EXPERIMENTAL</strong>. This class has been added as >+ * part of a work in progress. There is no guarantee that this API will >+ * remain unchanged during the 3.3 release cycle. Please do not use this API >+ * without consulting with the Platform/Debug team. >+ * </p> >+ */ >+public class ConfigurationElementConstants { >+ >+ /** >+ * The id node name for a configuration element >+ */ >+ public static String ID = "id"; //$NON-NLS-1$ >+ >+ /** >+ * the name node name for a configuration element >+ */ >+ public static String NAME = "name"; //$NON-NLS-1$ >+ >+ /** >+ * the category node name for a configuration element >+ */ >+ public static String CATEGORY = "category"; //$NON-NLS-1$ >+ >+ /** >+ * the icon node name for a configuration element >+ */ >+ public static String ICON = "icon"; //$NON-NLS-1$ >+ >+ /** >+ * the public node name for a configuration element >+ */ >+ public static String PUBLIC = "public"; //$NON-NLS-1$ >+ >+ /** >+ * the modes node name for a configuration element >+ */ >+ public static String MODES = "modes"; //$NON-NLS-1$ >+ >+ /** >+ * the type node name for a configuration element >+ */ >+ public static final String TYPE = "type"; //$NON-NLS-1$ >+ >+ /** >+ * the option node name for a configuration element >+ */ >+ public static final String OPTION = "option"; //$NON-NLS-1$ >+ >+ /** >+ * the delegate node name for a configuration element >+ */ >+ public static final String DELEGATE = "delegate"; //$NON-NLS-1$ >+ >+ /** >+ * the appliesTo node name for a configuration element >+ */ >+ public static final String APPLIES_TO = "appliesTo"; //$NON-NLS-1$ >+ >+ /** >+ * the sourcePathComputerId node name for a configuration element >+ */ >+ public static final String SOURCE_PATH_COMPUTER = "sourcePathComputerId"; //$NON-NLS-1$ >+ >+ /** >+ * the sourceLocatorId node name for a configuration element >+ */ >+ public static final String SOURCE_LOCATOR = "sourceLocatorId"; //$NON-NLS-1$ >+ >+ /** >+ * the migrationDelegate node name for a configuration element >+ */ >+ public static String MIGRATION_DELEGATE = "migrationDelegate"; //$NON-NLS-1$ >+} >Index: core/org/eclipse/debug/internal/core/LaunchDelegate.java >=================================================================== >RCS file: core/org/eclipse/debug/internal/core/LaunchDelegate.java >diff -N core/org/eclipse/debug/internal/core/LaunchDelegate.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ core/org/eclipse/debug/internal/core/LaunchDelegate.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,180 @@ >+/******************************************************************************* >+ * 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.core; >+ >+import java.util.HashSet; >+import java.util.Set; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.debug.core.DebugPlugin; >+import org.eclipse.debug.core.ILaunchDelegate; >+import org.eclipse.debug.core.model.ILaunchConfigurationDelegate; >+ >+import com.ibm.icu.text.MessageFormat; >+ >+/** >+ * Proxy to a launch delegate extension >+ * >+ * @since 3.3 >+ */ >+public class LaunchDelegate implements ILaunchDelegate { >+ >+ /** >+ * The configuration element for this delegate >+ */ >+ private IConfigurationElement fElement = null; >+ >+ /** >+ * The cached delegate. Remains null until asked for, then persisted >+ */ >+ private ILaunchConfigurationDelegate fDelegate = null; >+ >+ //lists of cached entries >+ private HashSet fModes = null; >+ private HashSet fOptions = null; >+ private HashSet fTypes = null; >+ >+ /** >+ * Constructor >+ * @param element the configuration element to associate with this launch delegate >+ */ >+ public LaunchDelegate(IConfigurationElement element) { >+ fElement = element; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.ILaunchDelegate#getDelegate() >+ */ >+ public ILaunchConfigurationDelegate getDelegate() throws CoreException { >+ if(fDelegate == null) { >+ Object obj = fElement.createExecutableExtension(ConfigurationElementConstants.DELEGATE); >+ if(obj instanceof ILaunchConfigurationDelegate) { >+ return (ILaunchConfigurationDelegate)obj; >+ } >+ throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.LaunchConfigurationType_Launch_delegate_for__0__does_not_implement_required_interface_ILaunchConfigurationDelegate__1, new String[]{getIdentifier()}), null)); >+ } >+ return fDelegate; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.ILaunchDelegate#getIdentifier() >+ */ >+ public String getIdentifier() { >+ return fElement.getAttribute(ConfigurationElementConstants.ID); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.ILaunchDelegate#getLaunchConfigurationType() >+ */ >+ public Set getLaunchConfigurationTypes() { >+ if(fTypes == null) { >+ fTypes = new HashSet(); >+ //try for appliesTo first off >+ IConfigurationElement[] types = fElement.getChildren(ConfigurationElementConstants.APPLIES_TO); >+ for(int i = 0; i < types.length; i++) { >+ fTypes.add(types[i].getAttribute(ConfigurationElementConstants.TYPE)); >+ } >+ if(fTypes.size() < 1) { >+ //fall back to single association if no appliesTo >+ String type = fElement.getAttribute(ConfigurationElementConstants.TYPE); >+ if(type == null) { >+ //the case when we have passed a launch configuration type to the launch delegate >+ type = fElement.getAttribute(ConfigurationElementConstants.ID); >+ } >+ fTypes.add(type); >+ } >+ } >+ return fTypes; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.ILaunchDelegate#getOptions() >+ */ >+ public Set getOptions() { >+ if(fOptions == null) { >+ fOptions = new HashSet(); >+ IConfigurationElement[] applies = fElement.getChildren(ConfigurationElementConstants.APPLIES_TO); >+ if(applies.length > 0) { >+ findAllOptions(applies, fOptions); >+ } >+ } >+ return fOptions; >+ } >+ >+ /** >+ * Recursively finds all option for the given launch delegate >+ * @param infos the root listing of infos to search >+ * @param list the listing to add found options to >+ */ >+ private void findAllOptions(IConfigurationElement[] infos, HashSet list) { >+ IConfigurationElement[] children = null; >+ String option = null; >+ for(int i = 0; i < infos.length; i++) { >+ children = infos[i].getChildren(); >+ if(children.length > 0) { >+ findAllOptions(children, list); >+ } >+ option = infos[i].getAttribute(ConfigurationElementConstants.OPTION); >+ if(option != null) { >+ list.add(option); >+ } >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.ILaunchDelegate#getModes() >+ */ >+ public Set getModes() { >+ if (fModes == null) { >+ fModes = new HashSet(); >+ String modes = fElement.getAttribute("modes"); //$NON-NLS-1$ >+ if (modes != null) { >+ String[] strings = modes.split(","); //$NON-NLS-1$ >+ for (int i = 0; i < strings.length; i++) { >+ fModes.add(strings[i].trim()); >+ } >+ } >+ } >+ return fModes; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.ILaunchDelegate#getSourceLocatorId() >+ */ >+ public String getSourceLocatorId() { >+ return fElement.getAttribute(ConfigurationElementConstants.SOURCE_LOCATOR); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.ILaunchDelegate#getSourcePathComputerId() >+ */ >+ public String getSourcePathComputerId() { >+ return fElement.getAttribute(ConfigurationElementConstants.SOURCE_PATH_COMPUTER); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.ILaunchDelegate#appliesTo(java.lang.String) >+ */ >+ public boolean appliesTo(String configtypeId) { >+ return getLaunchConfigurationTypes().contains(configtypeId); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.ILaunchDelegate#appliesTo(java.lang.String, java.lang.String) >+ */ >+ public boolean appliesTo(String configtypeId, String mode) { >+ return getLaunchConfigurationTypes().contains(configtypeId) & getModes().contains(mode); >+ } >+ >+} >#P org.eclipse.debug.ui >Index: ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java,v >retrieving revision 1.275 >diff -u -r1.275 DebugUIPlugin.java >--- ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java 8 May 2006 20:07:20 -0000 1.275 >+++ ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java 15 Sep 2006 20:52:01 -0000 >@@ -1037,6 +1037,26 @@ > } > > /** >+ * Returns an image descriptor for the icon referenced by the given path >+ * and contributor name, or <code>null</code> if none. >+ * >+ * @param name the name of the contributor >+ * @param path the path of the icon (from the configuration element) >+ * @return image descriptor or <code>null</code> >+ * @since 3.3 >+ */ >+ public static ImageDescriptor getImageDescriptor(String name, String path) { >+ Bundle bundle = Platform.getBundle(name); >+ if (path != null) { >+ URL iconURL = FileLocator.find(bundle , new Path(path), null); >+ if (iconURL != null) { >+ return ImageDescriptor.createFromURL(iconURL); >+ } >+ } >+ return null; >+ } >+ >+ /** > * Performs extra filtering for launch configurations based on the prefs set on the > * Launch Configurations page > * @param config the config to filter >Index: ui/org/eclipse/debug/internal/ui/DebugPluginImages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPluginImages.java,v >retrieving revision 1.94 >diff -u -r1.94 DebugPluginImages.java >--- ui/org/eclipse/debug/internal/ui/DebugPluginImages.java 9 Jun 2006 13:40:02 -0000 1.94 >+++ ui/org/eclipse/debug/internal/ui/DebugPluginImages.java 15 Sep 2006 20:52:01 -0000 >@@ -14,12 +14,17 @@ > > > import java.net.URL; >+import java.util.HashSet; >+import java.util.Set; > > import org.eclipse.core.runtime.FileLocator; > import org.eclipse.core.runtime.IConfigurationElement; > import org.eclipse.core.runtime.IExtensionPoint; > import org.eclipse.core.runtime.Path; > import org.eclipse.core.runtime.Platform; >+import org.eclipse.debug.core.DebugPlugin; >+import org.eclipse.debug.core.ILaunchConfigurationType; >+import org.eclipse.debug.internal.core.ConfigurationElementConstants; > import org.eclipse.debug.ui.IDebugUIConstants; > import org.eclipse.jface.resource.ImageDescriptor; > import org.eclipse.jface.resource.ImageRegistry; >@@ -230,20 +235,37 @@ > declareRegistryImage(IInternalDebugUIConstants.IMG_EDIT_SRC_DIR_WIZ, WIZBAN + "editdir_wiz.png"); //$NON-NLS-1$ > > // launch configuration types >- IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPE_IMAGES); >- IConfigurationElement[] configElements= extensionPoint.getConfigurationElements(); >- for (int i = 0; i < configElements.length; i++) { >- IConfigurationElement configElement = configElements[i]; >- ImageDescriptor descriptor = DebugUIPlugin.getImageDescriptor(configElement, ATTR_LAUNCH_CONFIG_TYPE_ICON); >- if (descriptor == null) { >- descriptor = ImageDescriptor.getMissingImageDescriptor(); >+ //try to get the images from the config types themselves, cache those that could not be found >+ ILaunchConfigurationType[] types = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationTypes(); >+ String path = null; >+ Set missing = new HashSet(); >+ ImageDescriptor descriptor = null; >+ for (int i = 0; i < types.length; i++) { >+ path = types[i].getImageDescriptorPath(); >+ if(path == null) { >+ missing.add(types[i].getIdentifier()); >+ } >+ else { >+ descriptor = DebugUIPlugin.getImageDescriptor(types[i].getContributorName(), path); >+ imageRegistry.put(types[i].getIdentifier(), (descriptor == null ? ImageDescriptor.getMissingImageDescriptor() : descriptor)); >+ } >+ } >+ if(missing.size() > 0) { >+ //if we are missing some images try to find them in the deprecated extension point >+ IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPE_IMAGES); >+ IConfigurationElement[] configElements = extensionPoint.getConfigurationElements(); >+ String configTypeID = null; >+ for (int i = 0; i < configElements.length; i++) { >+ configTypeID = configElements[i].getAttribute(ATTR_LAUNCH_CONFIG_TYPE_ID); >+ if (configTypeID == null) { >+ // bug 12652 >+ configTypeID = configElements[i].getAttribute(ConfigurationElementConstants.TYPE); >+ } >+ if(missing.contains(configTypeID)) { >+ descriptor = DebugUIPlugin.getImageDescriptor(configElements[i], ATTR_LAUNCH_CONFIG_TYPE_ICON); >+ imageRegistry.put(configTypeID, (descriptor == null ? ImageDescriptor.getMissingImageDescriptor() : descriptor)); >+ } > } >- String configTypeID = configElement.getAttribute(ATTR_LAUNCH_CONFIG_TYPE_ID); >- if (configTypeID == null) { >- // bug 12652 >- configTypeID = configElement.getAttribute("type"); //$NON-NLS-1$ >- } >- imageRegistry.put(configTypeID, descriptor); > } > } > >Index: schema/launchConfigurationTypeImages.exsd >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/schema/launchConfigurationTypeImages.exsd,v >retrieving revision 1.6 >diff -u -r1.6 launchConfigurationTypeImages.exsd >--- schema/launchConfigurationTypeImages.exsd 20 Apr 2005 15:30:45 -0000 1.6 >+++ schema/launchConfigurationTypeImages.exsd 15 Sep 2006 20:52:01 -0000 >@@ -2,15 +2,27 @@ > <!-- Schema file written by PDE --> > <schema targetNamespace="org.eclipse.debug.ui"> > <annotation> >- <appInfo> >- <meta.schema plugin="org.eclipse.debug.ui" id="launchConfigurationTypeImages" name="Launch Configuration Type Images"/> >- </appInfo> >- <documentation> >- This extension point provides a way to associate an image with a launch configuration type. >- </documentation> >-</annotation> >+ <appInfo> >+ <meta.schema plugin="org.eclipse.debug.ui" id="launchConfigurationTypeImages" name="Launch Configuration Type Images"/> >+ </appInfo> >+ <documentation> >+ This extension point provides a way to associate an image with a launch configuration type. >+ >+<p> >+<strong>EXPERIMENTAL</strong>. This extension point has been deprecated as >+part of a work in progress. There is no guarantee that this API will >+remain unchanged during the 3.3 release cycle. Please do not use this API >+without consulting with the Platform/Debug team. >+</p> >+ </documentation> >+ </annotation> > > <element name="extension"> >+ <annotation> >+ <appInfo> >+ <meta.element deprecated="true"/> >+ </appInfo> >+ </annotation> > <complexType> > <sequence> > <element ref="launchConfigurationTypeImage" minOccurs="0" maxOccurs="unbounded"/> >@@ -32,7 +44,7 @@ > <attribute name="name" type="string"> > <annotation> > <documentation> >- an optional name of the extension instance >+ an optional name of the extension instance > </documentation> > </annotation> > </attribute> >@@ -46,22 +58,30 @@ > <documentation> > specifies a unique identifier for this launch configuration type image. > </documentation> >+ <appInfo> >+ <meta.attribute deprecated="true"/> >+ </appInfo> > </annotation> > </attribute> > <attribute name="configTypeID" type="string" use="required"> > <annotation> > <documentation> >- specifies the fully qualified ID of a launch configuration type.(in 2.1, this attribute can also be specified using the "type" attribute, to be consistent with the launchConfigurationTabGroups extension point). >+ specifies the fully qualified ID of a launch configuration type.(in 2.1, this attribute can also be specified using the "type" attribute, to be consistent with the launchConfigurationTabGroups extension point). > </documentation> >+ <appInfo> >+ <meta.attribute deprecated="true"/> >+ </appInfo> > </annotation> > </attribute> > <attribute name="icon" type="string" use="required"> > <annotation> > <documentation> > specifies the plugin-relative path of an image file. >+ >+<br><b>To supply an image to the specified launch configuration type, it should be done in the launch configuration type definition.</b> > </documentation> > <appInfo> >- <meta.attribute kind="resource"/> >+ <meta.attribute kind="resource" deprecated="true"/> > </appInfo> > </annotation> > </attribute> >@@ -77,24 +97,24 @@ > > <p> > <pre> >- <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages"> >- <launchConfigurationTypeImage >- id="com.example.FirstLaunchConfigurationTypeImage" >- configTypeID="com.example.FirstLaunchConfigurationType" >- icon="icons/FirstLaunchConfigurationType.gif"> >- </launchConfigurationTypeImage> >- </extension> >+ <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages"> >+ <launchConfigurationTypeImage >+ id="com.example.FirstLaunchConfigurationTypeImage" >+ configTypeID="com.example.FirstLaunchConfigurationType" >+ icon="icons/FirstLaunchConfigurationType.gif"> >+ </launchConfigurationTypeImage> >+ </extension> > </pre> > </p> > </documentation> > </annotation> >- >+ > <annotation> > <appInfo> > <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
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 157059
:
50306
|
50933
|
51706
|
51719
|
51935
|
51964
|
52144
|
52498
|
52620
|
53657
|
54555
|
54562
|
54584