Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 157059 | Differences between
and this patch

Collapse All | Expand All

(-)plugin.xml (-6 / +24 lines)
Lines 27-54 Link Here
27
   <extension
27
   <extension
28
         point="org.eclipse.debug.core.launchConfigurationTypes">
28
         point="org.eclipse.debug.core.launchConfigurationTypes">
29
      <launchConfigurationType
29
      <launchConfigurationType
30
            delegate="org.eclipse.jdt.launching.JavaLaunchDelegate"
31
            id="org.eclipse.jdt.launching.localJavaApplication"
30
            id="org.eclipse.jdt.launching.localJavaApplication"
32
            migrationDelegate="org.eclipse.jdt.internal.launching.JavaMigrationDelegate"
31
            migrationDelegate="org.eclipse.jdt.internal.launching.JavaMigrationDelegate"
33
            modes="run, debug"
34
            name="%localJavaApplication"
32
            name="%localJavaApplication"
35
            sourceLocatorId="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"
33
            sourceLocatorId="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"
36
            sourcePathComputerId="org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer">
34
            sourcePathComputerId="org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer">
37
      </launchConfigurationType>
35
      </launchConfigurationType>
38
      <launchConfigurationType
36
      <launchConfigurationType
39
            delegate="org.eclipse.jdt.internal.launching.JavaRemoteApplicationLaunchConfigurationDelegate"
40
            id="org.eclipse.jdt.launching.remoteJavaApplication"
37
            id="org.eclipse.jdt.launching.remoteJavaApplication"
41
            migrationDelegate="org.eclipse.jdt.internal.launching.JavaMigrationDelegate"
38
            migrationDelegate="org.eclipse.jdt.internal.launching.JavaMigrationDelegate"
42
            modes="debug"
43
            name="%remoteJavaApplication"
39
            name="%remoteJavaApplication"
44
            sourceLocatorId="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"
40
            sourceLocatorId="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"
45
            sourcePathComputerId="org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer">
41
            sourcePathComputerId="org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer">
46
      </launchConfigurationType>
42
      </launchConfigurationType>
47
      <launchConfigurationType
43
      <launchConfigurationType
48
            delegate="org.eclipse.jdt.internal.launching.JavaAppletLaunchConfigurationDelegate"
49
            id="org.eclipse.jdt.launching.javaApplet"
44
            id="org.eclipse.jdt.launching.javaApplet"
50
            migrationDelegate="org.eclipse.jdt.internal.launching.JavaMigrationDelegate"
45
            migrationDelegate="org.eclipse.jdt.internal.launching.JavaMigrationDelegate"
51
            modes="run, debug"
52
            name="%appletLabel"
46
            name="%appletLabel"
53
            sourceLocatorId="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"
47
            sourceLocatorId="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"
54
            sourcePathComputerId="org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer">
48
            sourcePathComputerId="org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer">
Lines 189-193 Link Here
189
      	 name= "%jreContainerMarkerProblemName">
183
      	 name= "%jreContainerMarkerProblemName">
190
      <super type="org.eclipse.core.resources.problemmarker"/>
184
      <super type="org.eclipse.core.resources.problemmarker"/>
191
      <persistent value="true"/>
185
      <persistent value="true"/>
186
   </extension>
187
   <extension
188
         point="org.eclipse.debug.core.launchDelegates">
189
      <launchDelegate
190
            delegate="org.eclipse.jdt.launching.JavaLaunchDelegate"
191
            id="org.eclipse.jdt.launching.localJavaApplicationDelegate"
192
            modes="run, debug"
193
            name="%localJavaApplication"
194
            type="org.eclipse.jdt.launching.localJavaApplication">
195
      </launchDelegate>
196
      <launchDelegate
197
            delegate="org.eclipse.jdt.internal.launching.JavaRemoteApplicationLaunchConfigurationDelegate"
198
            id="org.eclipse.jdt.launching.remoteJavaApplicationDelegate"
199
            modes="debug"
200
            name="%remoteJavaApplication"
201
            type="org.eclipse.jdt.launching.remoteJavaApplication">
202
      </launchDelegate>
203
      <launchDelegate
204
            delegate="org.eclipse.jdt.internal.launching.JavaAppletLaunchConfigurationDelegate"
205
            id="org.eclipse.jdt.launching.javaAppletDelegate"
206
            modes="run, debug"
207
            name="%appletLabel"
208
            type="org.eclipse.jdt.launching.javaApplet">
209
      </launchDelegate>
192
   </extension>   
210
   </extension>   
193
</plugin>
211
</plugin>
(-)schema/launchConfigurationTypeImages.exsd (-31 / +22 lines)
Lines 2-14 Link Here
2
<!-- Schema file written by PDE -->
2
<!-- Schema file written by PDE -->
3
<schema targetNamespace="org.eclipse.debug.ui">
3
<schema targetNamespace="org.eclipse.debug.ui">
4
<annotation>
4
<annotation>
5
   <appInfo>
5
      <appInfo>
6
      <meta.schema plugin="org.eclipse.debug.ui" id="launchConfigurationTypeImages" name="Launch Configuration Type Images"/>
6
         <meta.schema plugin="org.eclipse.debug.ui" id="launchConfigurationTypeImages" name="Launch Configuration Type Images"/>
7
   </appInfo>
7
      </appInfo>
8
   <documentation>
8
      <documentation>
9
      This extension point provides a way to associate an image with a launch configuration type.
9
         This extension point provides a way to associate an image with a launch configuration type.
10
   </documentation>
10
      </documentation>
11
</annotation>
11
   </annotation>
12
12
13
   <element name="extension">
13
   <element name="extension">
14
      <complexType>
14
      <complexType>
Lines 22-45 Link Here
22
               </documentation>
22
               </documentation>
23
            </annotation>
23
            </annotation>
24
         </attribute>
24
         </attribute>
25
         <attribute name="id" type="string">
26
            <annotation>
27
               <documentation>
28
                  an optional identifier of the extension instance
29
               </documentation>
30
            </annotation>
31
         </attribute>
32
         <attribute name="name" type="string">
33
            <annotation>
34
               <documentation>
35
                 an optional name of the extension instance
36
               </documentation>
37
            </annotation>
38
         </attribute>
39
      </complexType>
25
      </complexType>
40
   </element>
26
   </element>
41
27
42
   <element name="launchConfigurationTypeImage">
28
   <element name="launchConfigurationTypeImage">
29
      <annotation>
30
         <documentation>
31
            &lt;p&gt;In 3.3, if possible, the image for a launch configuration type should be moved to the launch configuration type extension contribution&lt;/p&gt;
32
         </documentation>
33
      </annotation>
43
      <complexType>
34
      <complexType>
44
         <attribute name="id" type="string" use="required">
35
         <attribute name="id" type="string" use="required">
45
            <annotation>
36
            <annotation>
Lines 51-57 Link Here
51
         <attribute name="configTypeID" type="string" use="required">
42
         <attribute name="configTypeID" type="string" use="required">
52
            <annotation>
43
            <annotation>
53
               <documentation>
44
               <documentation>
54
                  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).
45
                  specifies the fully qualified ID of a launch configuration type.(in 2.1, this attribute can also be specified using the &quot;type&quot; attribute, to be consistent with the launchConfigurationTabGroups extension point).
55
               </documentation>
46
               </documentation>
56
            </annotation>
47
            </annotation>
57
         </attribute>
48
         </attribute>
Lines 77-100 Link Here
77
68
78
&lt;p&gt;
69
&lt;p&gt;
79
&lt;pre&gt;
70
&lt;pre&gt;
80
	&lt;extension point="org.eclipse.debug.ui.launchConfigurationTypeImages"&gt;
71
 &lt;extension point=&quot;org.eclipse.debug.ui.launchConfigurationTypeImages&quot;&gt;
81
		&lt;launchConfigurationTypeImage
72
  &lt;launchConfigurationTypeImage
82
			  id="com.example.FirstLaunchConfigurationTypeImage"
73
     id=&quot;com.example.FirstLaunchConfigurationTypeImage&quot;
83
			  configTypeID="com.example.FirstLaunchConfigurationType"
74
     configTypeID=&quot;com.example.FirstLaunchConfigurationType&quot;
84
			  icon="icons/FirstLaunchConfigurationType.gif"&gt;
75
     icon=&quot;icons/FirstLaunchConfigurationType.gif&quot;&gt;
85
		&lt;/launchConfigurationTypeImage&gt;
76
  &lt;/launchConfigurationTypeImage&gt;
86
	&lt;/extension&gt;
77
 &lt;/extension&gt;
87
&lt;/pre&gt;
78
&lt;/pre&gt;
88
&lt;/p&gt;
79
&lt;/p&gt;
89
      </documentation>
80
      </documentation>
90
   </annotation>
81
   </annotation>
91
   
82
92
   <annotation>
83
   <annotation>
93
      <appInfo>
84
      <appInfo>
94
         <meta.section type="copyright"/>
85
         <meta.section type="copyright"/>
95
      </appInfo>
86
      </appInfo>
96
      <documentation>
87
      <documentation>
97
Copyright (c) 2000, 2005 IBM Corporation and others.&lt;br&gt;
88
         Copyright (c) 2000, 2005 IBM Corporation and others.&lt;br&gt;
98
All rights reserved. This program and the accompanying materials are made 
89
All rights reserved. This program and the accompanying materials are made 
99
available under the terms of the Eclipse Public License v1.0 which 
90
available under the terms of the Eclipse Public License v1.0 which 
100
accompanies this distribution, and is available at 
91
accompanies this distribution, and is available at 
(-)ui/org/eclipse/debug/ui/AbstractLaunchConfigurationTab.java (-1 / +1 lines)
Lines 29-35 Link Here
29
/**
29
/**
30
 * Common function for launch configuration tabs.
30
 * Common function for launch configuration tabs.
31
 * <p>
31
 * <p>
32
 * Clients may subclass this class.
32
 * Clients s subclass this class.
33
 * </p>
33
 * </p>
34
 * @see ILaunchConfigurationTab
34
 * @see ILaunchConfigurationTab
35
 * @since 2.0
35
 * @since 2.0
(-)ui/org/eclipse/debug/ui/DebugUITools.java (-1 / +34 lines)
Lines 35-40 Link Here
35
import org.eclipse.debug.internal.ui.LazyModelPresentation;
35
import org.eclipse.debug.internal.ui.LazyModelPresentation;
36
import org.eclipse.debug.internal.ui.contexts.DebugContextManager;
36
import org.eclipse.debug.internal.ui.contexts.DebugContextManager;
37
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationDialog;
37
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationDialog;
38
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationEditDialog;
38
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager;
39
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager;
39
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationPropertiesDialog;
40
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationPropertiesDialog;
40
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog;
41
import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog;
Lines 458-464 Link Here
458
    		
459
    		
459
    	return Window.CANCEL;
460
    	return Window.CANCEL;
460
    }
461
    }
461
			
462
		
463
    /**
464
     * Open the launch configuration dialog on the specified launch
465
     * configuration. The dialog displays the tabs for a single configuration
466
     * only (a tree of launch configuration is not displayed)
467
     * <p>
468
     * If a status is specified, a status handler is consulted to handle the
469
     * status. The status handler is passed the instance of the launch
470
     * configuration dialog that is opened. This gives the status handler an
471
     * opportunity to perform error handling/initialization as required.
472
     * </p>
473
     * @param shell the parent shell for the launch configuration dialog
474
     * @param configuration the configuration to display
475
     * @param groupIdentifier group identifier of the launch group the launch configuration
476
     * belongs to
477
     * @param status the status to display, or <code>null</code> if none 
478
     * @return the return code from opening the launch configuration dialog -
479
     *  one  of <code>Window.OK</code> or <code>Window.CANCEL</code>
480
     *  
481
     * @since 3.3
482
     * 
483
     * EXPERIMENTAL
484
     */
485
    public static int openLaunchConfigurationEditDialog(Shell shell, ILaunchConfiguration configuration, String groupIdentifier, IStatus status) {
486
    	LaunchGroupExtension group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(groupIdentifier);
487
    	if (group != null) {
488
    		LaunchConfigurationEditDialog dialog = new LaunchConfigurationEditDialog(shell, configuration, group);
489
    		dialog.setInitialStatus(status);
490
    		return dialog.open();
491
    	} 
492
    	return Window.CANCEL;
493
    }
494
    
462
	/**
495
	/**
463
	 * Saves all dirty editors and builds the workspace according to current
496
	 * Saves all dirty editors and builds the workspace according to current
464
	 * preference settings, and returns whether a launch should proceed.
497
	 * preference settings, and returns whether a launch should proceed.
(-)ui/org/eclipse/debug/ui/IDebugUIConstants.java (+14 lines)
Lines 927-932 Link Here
927
	public static final String EXTENSION_POINT_LAUNCH_CONFIGURATION_TAB_GROUPS= "launchConfigurationTabGroups";	 //$NON-NLS-1$	
927
	public static final String EXTENSION_POINT_LAUNCH_CONFIGURATION_TAB_GROUPS= "launchConfigurationTabGroups";	 //$NON-NLS-1$	
928
928
929
	/**
929
	/**
930
	 * Contributed Launch Configuration Tab extension point indentifier
931
	 * 
932
	 * <p>
933
	 * <strong>EXPERIMENTAL</strong>. This constant has been added as
934
	 * part of a work in progress. There is no guarantee that this API will
935
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
936
	 * without consulting with the Platform/Debug team.
937
	 * </p>
938
	 * 
939
	 * @since 3.3
940
	 */
941
	public static final String EXTENSION_POINT_CONTRIBUTED_LAUNCH_TABS = "launchConfigurationTabs"; //$NON-NLS-1$
942
	
943
	/**
930
	 * Launch shortcuts extension point identifier
944
	 * Launch shortcuts extension point identifier
931
	 * (value <code>"launchShortcuts"</code>).
945
	 * (value <code>"launchShortcuts"</code>).
932
	 * 
946
	 * 
(-)plugin.properties (+2 lines)
Lines 43-48 Link Here
43
DebugLaunchGroup.title=Select or configure an application to debug
43
DebugLaunchGroup.title=Select or configure an application to debug
44
DebugModelPresentationExtensionName=Debug Model Presentation
44
DebugModelPresentationExtensionName=Debug Model Presentation
45
45
46
LaunchConfigurationTabsExtension.name=Launch Configuration Tabs
47
46
DebugPerspective.name=Debug
48
DebugPerspective.name=Debug
47
DebugPerspective.description=This Debug perspective is designed to support application debugging.  It incorporates views for displaying the debug stack, variables and breakpoint management.
49
DebugPerspective.description=This Debug perspective is designed to support application debugging.  It incorporates views for displaying the debug stack, variables and breakpoint management.
48
50
(-)plugin.xml (-1 / +8 lines)
Lines 18-23 Link Here
18
   <extension-point id="memoryRenderings" name="%memoryRenderingsExtensionPointName" schema="schema/memoryRenderings.exsd"/>
18
   <extension-point id="memoryRenderings" name="%memoryRenderingsExtensionPointName" schema="schema/memoryRenderings.exsd"/>
19
   <extension-point id="breakpointOrganizers" name="%BreakpointOrganizersName" schema="schema/breakpointOrganizers.exsd"/>
19
   <extension-point id="breakpointOrganizers" name="%BreakpointOrganizersName" schema="schema/breakpointOrganizers.exsd"/>
20
   <extension-point id="variableValueEditors" name="%VariableValueEditorsName" schema="schema/variableValueEditors.exsd"/>
20
   <extension-point id="variableValueEditors" name="%VariableValueEditorsName" schema="schema/variableValueEditors.exsd"/>
21
   <extension-point id="launchConfigurationTabs" name="%LaunchConfigurationTabsExtension.name" schema="schema/launchConfigurationTabs.exsd"/>
21
22
22
<!-- Extensions -->
23
<!-- Extensions -->
23
   <extension
24
   <extension
Lines 1338-1344 Link Here
1338
            class="org.eclipse.debug.internal.ui.launchConfigurations.DeleteLaunchConfigurationStatusHandler"
1339
            class="org.eclipse.debug.internal.ui.launchConfigurations.DeleteLaunchConfigurationStatusHandler"
1339
            code="225"
1340
            code="225"
1340
            id="org.eclipse.debug.ui.deleteAssociatedLaunchConfigs"
1341
            id="org.eclipse.debug.ui.deleteAssociatedLaunchConfigs"
1341
            plugin="org.eclipse.debug.core"/> 
1342
            plugin="org.eclipse.debug.core"/>
1343
      <statusHandler
1344
            class="org.eclipse.debug.internal.ui.launchConfigurations.LaunchDelegateNotAvailableHandler"
1345
            code="226"
1346
            id="org.eclipse.debug.ui.statusHandler.launchDelegateNotAvailable"
1347
            plugin="org.eclipse.debug.core">
1348
      </statusHandler> 
1342
   </extension>
1349
   </extension>
1343
   <extension
1350
   <extension
1344
         point="org.eclipse.debug.ui.launchGroups">
1351
         point="org.eclipse.debug.ui.launchGroups">
(-)ui/org/eclipse/debug/internal/ui/actions/EditLaunchConfigurationAction.java (-4 / +21 lines)
Lines 36-42 Link Here
36
public class EditLaunchConfigurationAction extends SelectionListenerAction {
36
public class EditLaunchConfigurationAction extends SelectionListenerAction {
37
	
37
	
38
	private ILaunchConfiguration fConfiguration = null;
38
	private ILaunchConfiguration fConfiguration = null;
39
	private String fMode =null;
39
	private String fMode = null;
40
	private boolean fTerminated = false;
40
41
41
	/**
42
	/**
42
	 * Constructs a new action.
43
	 * Constructs a new action.
Lines 87-92 Link Here
87
					}	
88
					}	
88
					setLaunchConfiguration(configuration);
89
					setLaunchConfiguration(configuration);
89
					setMode(launch.getLaunchMode());
90
					setMode(launch.getLaunchMode());
91
					setIsTerminated(launch.isTerminated());
90
					setText(MessageFormat.format(ActionMessages.EditLaunchConfigurationAction_1, new String[]{configuration.getName()})); 
92
					setText(MessageFormat.format(ActionMessages.EditLaunchConfigurationAction_1, new String[]{configuration.getName()})); 
91
					ImageDescriptor descriptor = null;
93
					ImageDescriptor descriptor = null;
92
					try {
94
					try {
Lines 123-137 Link Here
123
		return fMode;
125
		return fMode;
124
	}
126
	}
125
	
127
	
128
	protected boolean isTerminated() {
129
		return fTerminated;
130
	}
131
	
132
	protected void setIsTerminated(boolean terminated) {
133
		fTerminated = terminated;
134
	}
135
	
126
	/**
136
	/**
127
	 * @see org.eclipse.jface.action.IAction#run()
137
	 * @see org.eclipse.jface.action.IAction#run()
128
	 */
138
	 */
129
	public void run() {
139
	public void run() {
130
		ILaunchGroup group = DebugUITools.getLaunchGroup(getLaunchConfiguration(), getMode());
140
		ILaunchGroup group = DebugUITools.getLaunchGroup(getLaunchConfiguration(), getMode());
131
		if (group != null) {
141
		if (group != null) {
132
			DebugUITools.openLaunchConfigurationDialog(
142
			if(isTerminated()) {
133
				DebugUIPlugin.getShell(), getLaunchConfiguration(),
143
				DebugUITools.openLaunchConfigurationDialog(
134
				group.getIdentifier(), null);
144
					DebugUIPlugin.getShell(), getLaunchConfiguration(),
145
					group.getIdentifier(), null);
146
			}
147
			else {
148
				DebugUITools.openLaunchConfigurationEditDialog(
149
						DebugUIPlugin.getShell(), getLaunchConfiguration(),
150
						group.getIdentifier(), null);
151
			}
135
		}
152
		}
136
	}
153
	}
137
154
(-)ui/org/eclipse/debug/internal/ui/DebugPluginImages.java (-13 / +35 lines)
Lines 14-25 Link Here
14
14
15
15
16
import java.net.URL;
16
import java.net.URL;
17
import java.util.HashSet;
18
import java.util.Set;
17
19
18
import org.eclipse.core.runtime.FileLocator;
20
import org.eclipse.core.runtime.FileLocator;
19
import org.eclipse.core.runtime.IConfigurationElement;
21
import org.eclipse.core.runtime.IConfigurationElement;
20
import org.eclipse.core.runtime.IExtensionPoint;
22
import org.eclipse.core.runtime.IExtensionPoint;
21
import org.eclipse.core.runtime.Path;
23
import org.eclipse.core.runtime.Path;
22
import org.eclipse.core.runtime.Platform;
24
import org.eclipse.core.runtime.Platform;
25
import org.eclipse.debug.core.DebugPlugin;
26
import org.eclipse.debug.core.ILaunchConfigurationType;
27
import org.eclipse.debug.internal.core.IConfigurationElementConstants;
23
import org.eclipse.debug.ui.IDebugUIConstants;
28
import org.eclipse.debug.ui.IDebugUIConstants;
24
import org.eclipse.jface.resource.ImageDescriptor;
29
import org.eclipse.jface.resource.ImageDescriptor;
25
import org.eclipse.jface.resource.ImageRegistry;
30
import org.eclipse.jface.resource.ImageRegistry;
Lines 230-249 Link Here
230
		declareRegistryImage(IInternalDebugUIConstants.IMG_EDIT_SRC_DIR_WIZ, WIZBAN + "editdir_wiz.png"); //$NON-NLS-1$
235
		declareRegistryImage(IInternalDebugUIConstants.IMG_EDIT_SRC_DIR_WIZ, WIZBAN + "editdir_wiz.png"); //$NON-NLS-1$
231
		
236
		
232
		// launch configuration types
237
		// launch configuration types
233
		IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPE_IMAGES);
238
		//try to get the images from the config types themselves, cache those that could not be found
234
		IConfigurationElement[] configElements= extensionPoint.getConfigurationElements();
239
		ILaunchConfigurationType[] types = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationTypes();
235
		for (int i = 0; i < configElements.length; i++) {
240
		String path = null;
236
			IConfigurationElement configElement = configElements[i];
241
		Set missing = new HashSet();
237
			ImageDescriptor descriptor = DebugUIPlugin.getImageDescriptor(configElement, ATTR_LAUNCH_CONFIG_TYPE_ICON);
242
		ImageDescriptor descriptor = null;
238
			if (descriptor == null) {
243
		for (int i = 0; i < types.length; i++) {
239
				descriptor = ImageDescriptor.getMissingImageDescriptor();
244
			path = types[i].getImageDescriptorPath();
245
			if(path == null) {
246
				missing.add(types[i].getIdentifier());
247
			}
248
			else {
249
				descriptor = DebugUIPlugin.getImageDescriptor(types[i].getContributorName(), path);
250
				imageRegistry.put(types[i].getIdentifier(), (descriptor == null ? ImageDescriptor.getMissingImageDescriptor() : descriptor));
251
			}
252
		}
253
		if(missing.size() > 0) {
254
			//if we are missing some images try to find them in the deprecated extension point
255
			IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPE_IMAGES);
256
			IConfigurationElement[] configElements = extensionPoint.getConfigurationElements();
257
			String configTypeID = null;
258
			for (int i = 0; i < configElements.length; i++) {
259
				configTypeID = configElements[i].getAttribute(ATTR_LAUNCH_CONFIG_TYPE_ID);
260
				if (configTypeID == null) {
261
					// bug 12652
262
					configTypeID = configElements[i].getAttribute(IConfigurationElementConstants.TYPE);
263
				}
264
				if(missing.contains(configTypeID)) {
265
					descriptor = DebugUIPlugin.getImageDescriptor(configElements[i], ATTR_LAUNCH_CONFIG_TYPE_ICON);		
266
					imageRegistry.put(configTypeID, (descriptor == null ? ImageDescriptor.getMissingImageDescriptor() : descriptor));
267
				}
240
			}
268
			}
241
			String configTypeID = configElement.getAttribute(ATTR_LAUNCH_CONFIG_TYPE_ID);
242
			if (configTypeID == null) {
243
				// bug 12652
244
				configTypeID = configElement.getAttribute("type"); //$NON-NLS-1$
245
			}			
246
			imageRegistry.put(configTypeID, descriptor);				
247
		}
269
		}
248
	}
270
	}
249
271
(-)ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java (+20 lines)
Lines 1037-1042 Link Here
1037
    }
1037
    }
1038
    
1038
    
1039
    /**
1039
    /**
1040
     * Returns an image descriptor for the icon referenced by the given path
1041
     * and contributor name, or <code>null</code> if none.
1042
     * 
1043
     * @param name the name of the contributor
1044
     * @param path the path of the icon (from the configuration element)
1045
     * @return image descriptor or <code>null</code>
1046
     * @since 3.3
1047
     */
1048
    public static ImageDescriptor getImageDescriptor(String name, String path) {
1049
		Bundle bundle = Platform.getBundle(name);
1050
		if (path != null) {
1051
			URL iconURL = FileLocator.find(bundle , new Path(path), null);
1052
			if (iconURL != null) {
1053
				return ImageDescriptor.createFromURL(iconURL);
1054
			}
1055
		}    	
1056
		return null;
1057
    }
1058
    
1059
    /**
1040
	 * Performs extra filtering for launch configurations based on the prefs set on the 
1060
	 * Performs extra filtering for launch configurations based on the prefs set on the 
1041
	 * Launch Configurations page
1061
	 * Launch Configurations page
1042
	 * @param config the config to filter
1062
	 * @param config the config to filter
(-)ui/org/eclipse/debug/internal/ui/IDebugHelpContextIds.java (+1 lines)
Lines 97-102 Link Here
97
	public static final String MAX_DETAILS_LENGTH_DIALOG = PREFIX + "max_details_length_dialog_context"; //$NON-NLS-1$
97
	public static final String MAX_DETAILS_LENGTH_DIALOG = PREFIX + "max_details_length_dialog_context"; //$NON-NLS-1$
98
	public static final String SELECT_DEFAULT_WORKINGSET_DIALOG = PREFIX + "select_breakpoint_workingset_dialog"; //$NON-NLS-1$
98
	public static final String SELECT_DEFAULT_WORKINGSET_DIALOG = PREFIX + "select_breakpoint_workingset_dialog"; //$NON-NLS-1$
99
	public static final String DELETE_ASSOCIATED_LAUNCH_CONFIGS_DIALOG = PREFIX + "delete_associated_launch_configs_dialog"; //$NON-NLS-1$
99
	public static final String DELETE_ASSOCIATED_LAUNCH_CONFIGS_DIALOG = PREFIX + "delete_associated_launch_configs_dialog"; //$NON-NLS-1$
100
	public static final String SELECT_LAUNCH_OPTIONS_DIALOG = PREFIX + "select_launch_options_dialog"; //$NON-NLS-1$
100
	
101
	
101
	// Property pages
102
	// Property pages
102
	public static final String PROCESS_PROPERTY_PAGE = PREFIX + "process_property_page_context"; //$NON-NLS-1$
103
	public static final String PROCESS_PROPERTY_PAGE = PREFIX + "process_property_page_context"; //$NON-NLS-1$
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPropertiesDialog.java (-5 / +4 lines)
Lines 11-18 Link Here
11
package org.eclipse.debug.internal.ui.launchConfigurations;
11
package org.eclipse.debug.internal.ui.launchConfigurations;
12
12
13
13
14
import com.ibm.icu.text.MessageFormat;
15
16
import org.eclipse.core.runtime.IStatus;
14
import org.eclipse.core.runtime.IStatus;
17
import org.eclipse.debug.core.DebugPlugin;
15
import org.eclipse.debug.core.DebugPlugin;
18
import org.eclipse.debug.core.ILaunchConfiguration;
16
import org.eclipse.debug.core.ILaunchConfiguration;
Lines 26-31 Link Here
26
import org.eclipse.swt.layout.GridLayout;
24
import org.eclipse.swt.layout.GridLayout;
27
import org.eclipse.swt.widgets.Composite;
25
import org.eclipse.swt.widgets.Composite;
28
import org.eclipse.swt.widgets.Shell;
26
import org.eclipse.swt.widgets.Shell;
27
28
import com.ibm.icu.text.MessageFormat;
29
 
29
 
30
30
31
/**
31
/**
Lines 108-125 Link Here
108
		topLayout.marginWidth = 5;
108
		topLayout.marginWidth = 5;
109
		topComp.setLayout(topLayout);
109
		topComp.setLayout(topLayout);
110
		topComp.setFont(dialogComp.getFont());
110
		topComp.setFont(dialogComp.getFont());
111
	
111
112
		// Set the things that TitleAreaDialog takes care of 
112
		// Set the things that TitleAreaDialog takes care of 
113
		setTitle(getTitleAreaTitle());
113
		setTitle(getTitleAreaTitle());
114
		setMessage(""); //$NON-NLS-1$
114
		setMessage(""); //$NON-NLS-1$
115
		setModeLabelState();
115
		setModeLabelState();
116
	
116
		
117
		// Build the launch configuration edit area and put it into the composite.
117
		// Build the launch configuration edit area and put it into the composite.
118
		Composite editAreaComp = createLaunchConfigurationEditArea(topComp);
118
		Composite editAreaComp = createLaunchConfigurationEditArea(topComp);
119
		gd = new GridData(GridData.FILL_BOTH);
119
		gd = new GridData(GridData.FILL_BOTH);
120
		editAreaComp.setLayoutData(gd);
120
		editAreaComp.setLayoutData(gd);
121
		editAreaComp.setFont(dialogComp.getFont());
121
		editAreaComp.setFont(dialogComp.getFont());
122
		
123
		dialogComp.layout(true);
122
		dialogComp.layout(true);
124
		applyDialogFont(dialogComp);
123
		applyDialogFont(dialogComp);
125
	}
124
	}
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupExtension.java (-11 / +26 lines)
Lines 18-23 Link Here
18
18
19
import org.eclipse.core.runtime.CoreException;
19
import org.eclipse.core.runtime.CoreException;
20
import org.eclipse.core.runtime.IConfigurationElement;
20
import org.eclipse.core.runtime.IConfigurationElement;
21
import org.eclipse.debug.internal.core.IConfigurationElementConstants;
21
import org.eclipse.debug.ui.ILaunchConfigurationTabGroup;
22
import org.eclipse.debug.ui.ILaunchConfigurationTabGroup;
22
23
23
24
Lines 84-98 Link Here
84
	 */
85
	 */
85
	protected Set getModes() {
86
	protected Set getModes() {
86
		if (fModes == null) {
87
		if (fModes == null) {
87
			IConfigurationElement[] modes= getConfigurationElement().getChildren("launchMode"); //$NON-NLS-1$
88
			IConfigurationElement[] modes= getConfigurationElement().getChildren(IConfigurationElementConstants.LAUNCH_MODE);
88
			if (modes.length > 0) {
89
			if (modes.length > 0) {
89
				fModes = new HashSet(modes.length);
90
				fModes = new HashSet(modes.length);
90
				fPerspectives = new Hashtable(modes.length);
91
				fPerspectives = new Hashtable(modes.length);
92
				IConfigurationElement element = null;
93
				String perspective = null;
94
				String mode = null;
91
				for (int i = 0; i < modes.length; i++) {
95
				for (int i = 0; i < modes.length; i++) {
92
					IConfigurationElement element = modes[i];
96
					element = modes[i];
93
					String mode = element.getAttribute("mode"); //$NON-NLS-1$
97
					mode = element.getAttribute(IConfigurationElementConstants.MODE);
94
					fModes.add(mode);
98
					fModes.add(mode);
95
					String perspective = element.getAttribute("perspective"); //$NON-NLS-1$
99
					perspective = element.getAttribute(IConfigurationElementConstants.PERSPECTIVE);
96
					if (perspective != null) {
100
					if (perspective != null) {
97
						fPerspectives.put(mode, perspective);
101
						fPerspectives.put(mode, perspective);
98
					}
102
					}
Lines 127-133 Link Here
127
	 *  tab group is associated with
131
	 *  tab group is associated with
128
	 */	
132
	 */	
129
	protected String getTypeIdentifier() {
133
	protected String getTypeIdentifier() {
130
		return getConfigurationElement().getAttribute("type"); //$NON-NLS-1$
134
		return getConfigurationElement().getAttribute(IConfigurationElementConstants.TYPE);
131
	}
135
	}
132
	
136
	
133
	/**
137
	/**
Lines 139-145 Link Here
139
	 * @since 2.1
143
	 * @since 2.1
140
	 */	
144
	 */	
141
	protected String getHelpContextId() {
145
	protected String getHelpContextId() {
142
		return getConfigurationElement().getAttribute("helpContextId"); //$NON-NLS-1$		
146
		return getConfigurationElement().getAttribute(IConfigurationElementConstants.HELP_CONTEXT_ID);		
147
	}
148
	
149
	/**
150
	 * Returns the identifier of the tab group
151
	 * @return the id of the tab group
152
	 * 
153
	 * @since 3.3
154
	 */
155
	protected String getIdentifier() {
156
		return getConfigurationElement().getAttribute(IConfigurationElementConstants.ID); 
143
	}
157
	}
144
	
158
	
145
	/**
159
	/**
Lines 150-156 Link Here
150
	 * 	the tab group
164
	 * 	the tab group
151
	 */
165
	 */
152
	public ILaunchConfigurationTabGroup newTabGroup() throws CoreException {
166
	public ILaunchConfigurationTabGroup newTabGroup() throws CoreException {
153
		return (ILaunchConfigurationTabGroup)getConfigurationElement().createExecutableExtension("class"); //$NON-NLS-1$
167
		return (ILaunchConfigurationTabGroup)getConfigurationElement().createExecutableExtension(IConfigurationElementConstants.CLASS); 
154
	}
168
	}
155
169
156
	/**
170
	/**
Lines 163-179 Link Here
163
	public String getDescription(String mode) {
177
	public String getDescription(String mode) {
164
		String description = null;
178
		String description = null;
165
		
179
		
166
		IConfigurationElement[] children = fConfig.getChildren("launchMode"); //$NON-NLS-1$
180
		IConfigurationElement[] children = fConfig.getChildren(IConfigurationElementConstants.LAUNCH_MODE);
167
		if (children!= null && children.length != 0) {
181
		if (children!= null && children.length != 0) {
182
			IConfigurationElement child = null;
168
			for (int i=0; i<children.length; i++) {
183
			for (int i=0; i<children.length; i++) {
169
				IConfigurationElement child = children[i];
184
				child = children[i];
170
				if (child.getAttribute("mode").equals(mode)) { //$NON-NLS-1$
185
				if (child.getAttribute("mode").equals(mode)) { //$NON-NLS-1$
171
					description = child.getAttribute("description"); //$NON-NLS-1$
186
					description = child.getAttribute(IConfigurationElementConstants.DESCRIPTION);
172
				}
187
				}
173
			}
188
			}
174
		} 
189
		} 
175
		if (description == null){
190
		if (description == null){
176
			description = fConfig.getAttribute("description"); //$NON-NLS-1$
191
			description = fConfig.getAttribute(IConfigurationElementConstants.DESCRIPTION);
177
		}
192
		}
178
		
193
		
179
		if (description == null)
194
		if (description == null)
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java (-7 / +107 lines)
Lines 11-16 Link Here
11
package org.eclipse.debug.internal.ui.launchConfigurations;
11
package org.eclipse.debug.internal.ui.launchConfigurations;
12
12
13
13
14
import java.util.HashSet;
15
import java.util.Set;
16
14
import org.eclipse.core.resources.IResource;
17
import org.eclipse.core.resources.IResource;
15
import org.eclipse.core.resources.ResourcesPlugin;
18
import org.eclipse.core.resources.ResourcesPlugin;
16
import org.eclipse.core.runtime.CoreException;
19
import org.eclipse.core.runtime.CoreException;
Lines 20-25 Link Here
20
import org.eclipse.debug.core.ILaunchConfiguration;
23
import org.eclipse.debug.core.ILaunchConfiguration;
21
import org.eclipse.debug.core.ILaunchConfigurationType;
24
import org.eclipse.debug.core.ILaunchConfigurationType;
22
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
25
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
26
import org.eclipse.debug.internal.core.LaunchManager;
23
import org.eclipse.debug.internal.ui.DebugUIPlugin;
27
import org.eclipse.debug.internal.ui.DebugUIPlugin;
24
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
28
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
25
import org.eclipse.debug.internal.ui.SWTUtil;
29
import org.eclipse.debug.internal.ui.SWTUtil;
Lines 29-34 Link Here
29
import org.eclipse.debug.ui.ILaunchConfigurationTabGroup;
33
import org.eclipse.debug.ui.ILaunchConfigurationTabGroup;
30
import org.eclipse.jface.dialogs.Dialog;
34
import org.eclipse.jface.dialogs.Dialog;
31
import org.eclipse.jface.dialogs.ErrorDialog;
35
import org.eclipse.jface.dialogs.ErrorDialog;
36
import org.eclipse.jface.dialogs.IDialogConstants;
32
import org.eclipse.jface.viewers.ISelection;
37
import org.eclipse.jface.viewers.ISelection;
33
import org.eclipse.jface.viewers.IStructuredSelection;
38
import org.eclipse.jface.viewers.IStructuredSelection;
34
import org.eclipse.jface.viewers.SelectionChangedEvent;
39
import org.eclipse.jface.viewers.SelectionChangedEvent;
Lines 69-75 Link Here
69
 * buttons.
74
 * buttons.
70
 */
75
 */
71
public class LaunchConfigurationTabGroupViewer extends Viewer {
76
public class LaunchConfigurationTabGroupViewer extends Viewer {
72
	
77
73
	private final String EMPTY_STRING = ""; //$NON-NLS-1$
78
	private final String EMPTY_STRING = ""; //$NON-NLS-1$
74
	/**
79
	/**
75
	 * Containing launch dialog
80
	 * Containing launch dialog
Lines 162-167 Link Here
162
	private Composite fTabPlaceHolder = null;
167
	private Composite fTabPlaceHolder = null;
163
	
168
	
164
	/**
169
	/**
170
	 * A link to allow users to select a valid set of launch options for the specified mode
171
	 * @since 3.3
172
	 * EXPERIMENTAL
173
	 */
174
	private Link fOptionsLink = null;
175
	
176
	/**
165
	 * A new composite replacing the perspectives tab
177
	 * A new composite replacing the perspectives tab
166
	 * @since 3.2
178
	 * @since 3.2
167
	 */
179
	 */
Lines 239-245 Link Here
239
		fTabPlaceHolder = new Composite(mainComp, SWT.NONE);
251
		fTabPlaceHolder = new Composite(mainComp, SWT.NONE);
240
		fTabPlaceHolder.setLayout(new StackLayout());
252
		fTabPlaceHolder.setLayout(new StackLayout());
241
		gd = new GridData(GridData.FILL_BOTH);
253
		gd = new GridData(GridData.FILL_BOTH);
242
		gd.horizontalSpan = 2;
243
		fTabPlaceHolder.setLayoutData(gd);
254
		fTabPlaceHolder.setLayoutData(gd);
244
        
255
        
245
		fGettingStarted = new Composite(fTabPlaceHolder, SWT.NONE);
256
		fGettingStarted = new Composite(fTabPlaceHolder, SWT.NONE);
Lines 256-262 Link Here
256
		fTabComposite.setLayout(layout);
267
		fTabComposite.setLayout(layout);
257
		gd = new GridData(GridData.FILL_BOTH);
268
		gd = new GridData(GridData.FILL_BOTH);
258
		fTabComposite.setLayoutData(gd);
269
		fTabComposite.setLayoutData(gd);
259
        
270
		
260
		fNameLabel = new Label(fTabComposite, SWT.HORIZONTAL | SWT.LEFT);
271
		fNameLabel = new Label(fTabComposite, SWT.HORIZONTAL | SWT.LEFT);
261
		fNameLabel.setText(LaunchConfigurationsMessages.LaunchConfigurationDialog__Name__16); 
272
		fNameLabel.setText(LaunchConfigurationsMessages.LaunchConfigurationDialog__Name__16); 
262
        fNameLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
273
        fNameLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
Lines 272-285 Link Here
272
    		
283
    		
273
		createTabFolder(fTabComposite);
284
		createTabFolder(fTabComposite);
274
		
285
		
275
		Composite buttonComp = new Composite(mainComp, SWT.NONE);
286
		Composite blComp = SWTUtil.createComposite(mainComp, mainComp.getFont(), 2, 1, GridData.FILL_HORIZONTAL);
287
		Composite linkComp = SWTUtil.createComposite(blComp, blComp.getFont(), 1, 1, GridData.FILL_HORIZONTAL);
288
//		a link for launch options
289
		fOptionsLink = new Link(linkComp, SWT.NONE);
290
		fOptionsLink.setText(LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_13);
291
		fOptionsLink.setFont(linkComp.getFont());
292
		gd = new GridData(GridData.BEGINNING);
293
		fOptionsLink.setLayoutData(gd);
294
		fOptionsLink.addSelectionListener(new SelectionListener() {
295
			public void widgetSelected(SelectionEvent e) {
296
				//collect the options available
297
				SelectLaunchOptionsDialog sld = new SelectLaunchOptionsDialog(getShell(), 
298
						getLaunchConfigurationDialog().getMode(), 
299
						((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).getLaunchDelegates(fTabType.getIdentifier()));
300
				if(sld.open() == IDialogConstants.OK_ID) {
301
					//set the options to the config
302
					Object[] res = sld.getResult();
303
					if(res != null) {
304
						HashSet list = new HashSet();
305
						for(int i = 0; i < res.length; i++) {
306
							list.add(res[i]);
307
						}
308
						ILaunchConfigurationWorkingCopy wc = getWorkingCopy();
309
						wc.setOptions(list);
310
						refresh();
311
						refreshStatus();
312
					}
313
				}
314
			}
315
			public void widgetDefaultSelected(SelectionEvent e) {}
316
		});
317
		fOptionsLink.setVisible(false);
318
		
319
		Composite buttonComp = new Composite(blComp, SWT.NONE);
276
		GridLayout buttonCompLayout = new GridLayout();
320
		GridLayout buttonCompLayout = new GridLayout();
277
		buttonCompLayout.numColumns = 2;
321
		buttonCompLayout.numColumns = 2;
278
		buttonComp.setLayout(buttonCompLayout);
322
		buttonComp.setLayout(buttonCompLayout);
279
		gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
323
		gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
280
		gd.horizontalSpan = 2;
281
		buttonComp.setLayoutData(gd);
324
		buttonComp.setLayoutData(gd);
282
325
		
283
		fApplyButton = new Button(buttonComp, SWT.PUSH);
326
		fApplyButton = new Button(buttonComp, SWT.PUSH);
284
		fApplyButton.setText(LaunchConfigurationsMessages.LaunchConfigurationDialog__Apply_17); 
327
		fApplyButton.setText(LaunchConfigurationsMessages.LaunchConfigurationDialog__Apply_17); 
285
		gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
328
		gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
Lines 305-310 Link Here
305
	}
348
	}
306
	
349
	
307
	/**
350
	/**
351
	 * Shows/hides the options link on the top of the viewer
352
	 * @param show true if the link should be visible, false otherwise
353
	 * @since 3.3
354
	 * 
355
	 * EXPERIMENTAL
356
	 */
357
	protected void showOptionsLink(boolean show) {
358
		fOptionsLink.setVisible(show);
359
	}
360
	
361
	/**
308
	 * Simple method to create a spacer in the page
362
	 * Simple method to create a spacer in the page
309
	 * 
363
	 * 
310
	 * @param composite the composite to add the spacer to
364
	 * @param composite the composite to add the spacer to
Lines 485-491 Link Here
485
				error = tabs[i].getErrorMessage() != null;
539
				error = tabs[i].getErrorMessage() != null;
486
				item = fTabFolder.getItem(i);
540
				item = fTabFolder.getItem(i);
487
				setTabIcon(item, error, tabs[i]);
541
				setTabIcon(item, error, tabs[i]);
488
			}		
542
			}
543
			fOptionsLink.setVisible(!canLaunchWithOptions());
489
		}
544
		}
490
	}
545
	}
491
546
Lines 958-967 Link Here
958
				return false;
1013
				return false;
959
			}
1014
			}
960
		}
1015
		}
1016
		
961
		return true;
1017
		return true;
962
	}	
1018
	}	
963
	
1019
	
964
	/**
1020
	/**
1021
	 * Determines if the tab groups that is currently visible can launch with the currently selected
1022
	 * set of options.
1023
	 * 
1024
	 * <p>
1025
	 * <strong>EXPERIMENTAL</strong>. This method has been added as
1026
	 * part of a work in progress. There is no guarantee that this API will
1027
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
1028
	 * without consulting with the Platform/Debug team.
1029
	 * </p>
1030
	 * @return
1031
	 */
1032
	public boolean canLaunchWithOptions() {
1033
		if(fInitializingTabs) {
1034
			return false;
1035
		}
1036
		//check if selected options exist and that the selected combination can be launched
1037
		try {
1038
			ILaunchConfigurationWorkingCopy wc = getWorkingCopy();
1039
			Set options = wc.getOptions();
1040
			if(options.size() > 0) {
1041
				return ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).getLaunchDelegates(fTabType.getIdentifier(), getLaunchConfigurationDialog().getMode(), (String[]) options.toArray(new String[options.size()])).length > 0;
1042
			}
1043
		} 
1044
		catch (CoreException e) {
1045
			e.printStackTrace();
1046
		}
1047
		return true;
1048
	}
1049
	
1050
	/**
965
	 * Returns the current error message or <code>null</code> if none.
1051
	 * Returns the current error message or <code>null</code> if none.
966
	 */
1052
	 */
967
	public String getErrorMesssage() {
1053
	public String getErrorMesssage() {
Lines 988-993 Link Here
988
			return message;
1074
			return message;
989
		}
1075
		}
990
		
1076
		
1077
	//EXPERIMENTAL
991
		ILaunchConfigurationTab[] allTabs = getTabs();
1078
		ILaunchConfigurationTab[] allTabs = getTabs();
992
		for (int i = 0; i < allTabs.length; i++) {
1079
		for (int i = 0; i < allTabs.length; i++) {
993
			ILaunchConfigurationTab tab = allTabs[i];
1080
			ILaunchConfigurationTab tab = allTabs[i];
Lines 1004-1009 Link Here
1004
				return temp.toString();
1091
				return temp.toString();
1005
			}
1092
			}
1006
		}
1093
		}
1094
		if(!canLaunchWithOptions()) {
1095
			try {
1096
				Object o = getInput();
1097
				String name = null;
1098
				if(o instanceof ILaunchConfiguration) {
1099
					ILaunchConfiguration lc = (ILaunchConfiguration) o;
1100
					name = LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_9+lc.getName();
1101
				}
1102
				return (name == null ? LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_10 : name) + LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_11+getLaunchConfigurationDialog().getMode()+LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_12+getWorkingCopy().getOptions().toString();
1103
			} catch (CoreException e) {
1104
				e.printStackTrace();
1105
			}
1106
		}
1007
		return null;
1107
		return null;
1008
	}	
1108
	}	
1009
	
1109
	
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationDialog.java (-1 / +1 lines)
Lines 68-74 Link Here
68
	public void updateButtons() {
68
	public void updateButtons() {
69
		// Launch button
69
		// Launch button
70
		getTabViewer().refresh();
70
		getTabViewer().refresh();
71
		getButton(ID_LAUNCH_BUTTON).setEnabled(getTabViewer().canLaunch());
71
		getButton(ID_LAUNCH_BUTTON).setEnabled(getTabViewer().canLaunch() & getTabViewer().canLaunchWithOptions());
72
		
72
		
73
	}
73
	}
74
		
74
		
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties (-1 / +14 lines)
Lines 46-57 Link Here
46
LaunchConfigurationDialog_An_exception_occurred_while_retrieving_launch_configurations_20=An exception occurred while retrieving launch configurations
46
LaunchConfigurationDialog_An_exception_occurred_while_retrieving_launch_configurations_20=An exception occurred while retrieving launch configurations
47
LaunchConfigurationTabGroupViewer_0={0} is an invalid character in launch configuration name {1}
47
LaunchConfigurationTabGroupViewer_0={0} is an invalid character in launch configuration name {1}
48
LaunchConfigurationTabGroupViewer_1=Configure launch settings from this dialog:
48
LaunchConfigurationTabGroupViewer_1=Configure launch settings from this dialog:
49
LaunchConfigurationTabGroupViewer_10=The selected configuration
50
LaunchConfigurationTabGroupViewer_11=\ cannot be launched with the set of options: 
51
LaunchConfigurationTabGroupViewer_12=\ and 
52
LaunchConfigurationTabGroupViewer_13=Select a supported set of <a>launch options</a> for this mode.
49
LaunchConfigurationTabGroupViewer_2=- Press the 'New' button to create a configuration of the selected type.
53
LaunchConfigurationTabGroupViewer_2=- Press the 'New' button to create a configuration of the selected type.
50
LaunchConfigurationTabGroupViewer_3=- Edit or view an existing configuration by selecting it.
54
LaunchConfigurationTabGroupViewer_3=- Edit or view an existing configuration by selecting it.
51
LaunchConfigurationTabGroupViewer_4=- Press the 'Delete' button to remove the selected configuration.
55
LaunchConfigurationTabGroupViewer_4=- Press the 'Delete' button to remove the selected configuration.
52
LaunchConfigurationTabGroupViewer_6=- Press the 'Duplicate' button to copy the selected configuration.
56
LaunchConfigurationTabGroupViewer_6=- Press the 'Duplicate' button to copy the selected configuration.
53
LaunchConfigurationTabGroupViewer_5=Configure launch perspective settings from the <a>Perspectives</a> preference page.
57
LaunchConfigurationTabGroupViewer_5=Configure launch perspective settings from the <a>Perspectives</a> preference page.
54
LaunchConfigurationTabGroupViewer_8=- Press the 'Filter' button to configure filtering options.
58
LaunchConfigurationTabGroupViewer_8=- Press the 'Filter' button to configure filtering options.
59
LaunchConfigurationTabGroupViewer_9=Configuration 
55
LaunchConfigurationDialog_Create__manage__and_run_launch_configurations_8=Create, manage, and run configurations
60
LaunchConfigurationDialog_Create__manage__and_run_launch_configurations_8=Create, manage, and run configurations
56
LaunchConfigurationDialog_Dele_te_14=De&lete
61
LaunchConfigurationDialog_Dele_te_14=De&lete
57
LaunchConfigurationDialog_Discard_changes__38=Discard changes?
62
LaunchConfigurationDialog_Discard_changes__38=Discard changes?
Lines 65-70 Link Here
65
LaunchConfigurationDialog_Name_required_for_launch_configuration_11=Name required for launch configuration
70
LaunchConfigurationDialog_Name_required_for_launch_configuration_11=Name required for launch configuration
66
LaunchConfigurationDialog_Ne_w_13=Ne&w
71
LaunchConfigurationDialog_Ne_w_13=Ne&w
67
LaunchConfigurationDialog_No_33=No
72
LaunchConfigurationDialog_No_33=No
73
LaunchConfigurationEditDialog_0=Modify configuration and continue.
74
LaunchConfigurationEditDialog_1=Continue
68
LaunchConfigurationDialog_Ready_to_launch_2=Ready to launch
75
LaunchConfigurationDialog_Ready_to_launch_2=Ready to launch
69
LaunchConfigurationDialog_Save_changes__31=Save changes?
76
LaunchConfigurationDialog_Save_changes__31=Save changes?
70
LaunchConfigurationDialog_The_configuration___29=The configuration "{0}" has unsaved changes.  Do you wish to save them?
77
LaunchConfigurationDialog_The_configuration___29=The configuration "{0}" has unsaved changes.  Do you wish to save them?
Lines 96-102 Link Here
96
LaunchConfigurationPropertiesDialog_Edit_launch_configuration_properties_1=Edit launch configuration properties
103
LaunchConfigurationPropertiesDialog_Edit_launch_configuration_properties_1=Edit launch configuration properties
97
LaunchConfigurationPropertiesDialog_Properties_for__0__2=Properties for {0}
104
LaunchConfigurationPropertiesDialog_Properties_for__0__2=Properties for {0}
98
105
99
LaunchConfigurationDialog_Modify_attributes_and_launch__1=Modify attributes and launch.
106
LaunchConfigurationDialog_Modify_attributes_and_launch__1=Edit configuration and launch.
100
107
101
LaunchConfigurationTabGroupViewer_No_tabs_defined_for_launch_configuration_type__0__1=No tabs defined for launch configuration type {0}
108
LaunchConfigurationTabGroupViewer_No_tabs_defined_for_launch_configuration_type__0__1=No tabs defined for launch configuration type {0}
102
109
Lines 162-164 Link Here
162
CollapseAllLaunchConfigurationAction_0=Collapse All
169
CollapseAllLaunchConfigurationAction_0=Collapse All
163
CollapseAllLaunchConfigurationAction_1=Collapses all expanded launch configurations.
170
CollapseAllLaunchConfigurationAction_1=Collapses all expanded launch configurations.
164
CollapseAllLaunchConfigurationAction_2=This action collapses all of the launch configurations currently visible and expanded.
171
CollapseAllLaunchConfigurationAction_2=This action collapses all of the launch configurations currently visible and expanded.
172
SelectLaunchOptionsDialog_0=\ (with no options)
173
SelectLaunchOptionsDialog_1=: 
174
SelectLaunchOptionsDialog_2=A plugin that once provided the ability to launch the saved set of launch options for the current launch configuration is no longer available. As such, you must select a valid set of launch options that can be launched
175
SelectLaunchOptionsDialog_3=Select Launch Options
176
SelectLaunchOptionsDialog_4=&Select a supported options combination:
177
SelectLaunchOptionsDialog_5=\ for 
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationPresentationManager.java (-36 / +97 lines)
Lines 11-16 Link Here
11
package org.eclipse.debug.internal.ui.launchConfigurations;
11
package org.eclipse.debug.internal.ui.launchConfigurations;
12
12
13
 
13
 
14
import java.util.ArrayList;
14
import java.util.Hashtable;
15
import java.util.Hashtable;
15
import java.util.Iterator;
16
import java.util.Iterator;
16
import java.util.Map;
17
import java.util.Map;
Lines 22-31 Link Here
22
import org.eclipse.core.runtime.IStatus;
23
import org.eclipse.core.runtime.IStatus;
23
import org.eclipse.core.runtime.Platform;
24
import org.eclipse.core.runtime.Platform;
24
import org.eclipse.core.runtime.Status;
25
import org.eclipse.core.runtime.Status;
25
import org.eclipse.debug.core.DebugPlugin;
26
import org.eclipse.debug.core.ILaunchConfigurationType;
26
import org.eclipse.debug.core.ILaunchConfigurationType;
27
import org.eclipse.debug.internal.core.IConfigurationElementConstants;
27
import org.eclipse.debug.internal.ui.DebugUIPlugin;
28
import org.eclipse.debug.internal.ui.DebugUIPlugin;
29
import org.eclipse.debug.internal.ui.LaunchConfigurationTabExtension;
28
import org.eclipse.debug.ui.IDebugUIConstants;
30
import org.eclipse.debug.ui.IDebugUIConstants;
31
import org.eclipse.debug.ui.ILaunchConfigurationTab;
29
import org.eclipse.debug.ui.ILaunchConfigurationTabGroup;
32
import org.eclipse.debug.ui.ILaunchConfigurationTabGroup;
30
33
31
import com.ibm.icu.text.MessageFormat;
34
import com.ibm.icu.text.MessageFormat;
Lines 49-54 Link Here
49
	 * used to represent the default tab group (i.e. unspecified mode).
52
	 * used to represent the default tab group (i.e. unspecified mode).
50
	 */
53
	 */
51
	private Hashtable fTabGroupExtensions;	
54
	private Hashtable fTabGroupExtensions;	
55
	
56
	/**
57
	 * contributed tabs are stored by the tab group id that they contribute to.
58
	 * each entry is a futher <code>Hashtable</code> consisting of the corrseponding
59
	 * <code>LaunchConfigurationTabExtension</code> objects for each contributed tab stored by their 
60
	 * id
61
	 * 
62
	 * @since 3.3
63
	 */
64
	private Hashtable fContributedTabs;
52
			
65
			
53
	/**
66
	/**
54
	 * Constructs the singleton launch configuration presentation
67
	 * Constructs the singleton launch configuration presentation
Lines 57-62 Link Here
57
	private LaunchConfigurationPresentationManager() {
70
	private LaunchConfigurationPresentationManager() {
58
		fgDefault = this;
71
		fgDefault = this;
59
		initializeTabGroupExtensions();
72
		initializeTabGroupExtensions();
73
		initializeContributedTabExtensions();
60
	}
74
	}
61
75
62
	/**
76
	/**
Lines 75-126 Link Here
75
	 */
89
	 */
76
	private void initializeTabGroupExtensions() {
90
	private void initializeTabGroupExtensions() {
77
		fTabGroupExtensions = new Hashtable();
91
		fTabGroupExtensions = new Hashtable();
78
		IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_LAUNCH_CONFIGURATION_TAB_GROUPS);
92
		IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_LAUNCH_CONFIGURATION_TAB_GROUPS);
79
		IConfigurationElement[] groups = extensionPoint.getConfigurationElements();
93
		IConfigurationElement[] groups = extensionPoint.getConfigurationElements();
94
		LaunchConfigurationTabGroupExtension group = null;
95
		String typeId = null;
96
		Map map = null;
97
		Set modes = null;
80
		for (int i = 0; i < groups.length; i++) {
98
		for (int i = 0; i < groups.length; i++) {
81
			LaunchConfigurationTabGroupExtension group = new LaunchConfigurationTabGroupExtension(groups[i]);
99
			group = new LaunchConfigurationTabGroupExtension(groups[i]);
82
			String typeId = group.getTypeIdentifier();
100
			typeId = group.getTypeIdentifier();
83
			if (typeId == null) {
101
			map = (Map)fTabGroupExtensions.get(typeId);
84
				IStatus status = new Status(IStatus.ERROR, IDebugUIConstants.PLUGIN_ID, IDebugUIConstants.STATUS_INVALID_EXTENSION_DEFINITION,
102
			if (map == null) {
85
					 MessageFormat.format("Launch configuration tab group extension {0} does not specify launch configuration type.", (new String[] {groups[i].getAttribute("id")})), null);  //$NON-NLS-1$ //$NON-NLS-2$
103
				map = new Hashtable();
86
					DebugUIPlugin.log(status);
104
				fTabGroupExtensions.put(typeId, map);
87
			} else {
88
				// verify it references a valid launch configuration type
89
				ILaunchConfigurationType lct = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(typeId);
90
				if (lct == null) {
91
					IStatus status = new Status(IStatus.ERROR, IDebugUIConstants.PLUGIN_ID, IDebugUIConstants.STATUS_INVALID_EXTENSION_DEFINITION,
92
					 MessageFormat.format("Launch configuration tab group extension {0} refers to non-existent launch configuration type {1}.", (new String[] {groups[i].getAttribute("id"), typeId})), null);  //$NON-NLS-1$ //$NON-NLS-2$
93
					DebugUIPlugin.log(status);
94
				}
95
			}
105
			}
96
			if (typeId != null) {
106
			modes = group.getModes();
97
				// get the map for the config type
107
			if (modes == null) {
98
				Map map = (Map)fTabGroupExtensions.get(typeId);
108
				// default tabs - store with "*"
99
				if (map == null) {
109
				map.put("*", group); //$NON-NLS-1$
100
					map = new Hashtable();
110
			} else {
101
					fTabGroupExtensions.put(typeId, map);
111
				// store per mode
102
				}
112
				Iterator iterator = modes.iterator();
103
				Set modes = group.getModes();
113
				while (iterator.hasNext()) {
104
				if (modes == null) {
114
					map.put(iterator.next(), group);
105
					// default tabs - store with "*"
106
					map.put("*", group); //$NON-NLS-1$
107
				} else {
108
					// store per mode
109
					Iterator iterator = modes.iterator();
110
					while (iterator.hasNext()) {
111
						map.put(iterator.next(), group);
112
					}
113
				}
115
				}
114
			}
116
			}
115
		}
117
		}
116
	}	
118
	}	
117
	
119
	
118
	/**
120
	/**
121
	 * This method is used to collect all of the contributed tabs defined by the <code>launchConfigurationTabs</code>
122
	 * extension point
123
	 * <p>
124
	 * <strong>EXPERIMENTAL</strong>. This method has been added as
125
	 * part of a work in progress. There is no guarantee that this API will
126
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
127
	 * without consulting with the Platform/Debug team.
128
	 * </p>
129
	 * @since 3.3
130
	 */
131
	private void initializeContributedTabExtensions() {
132
		fContributedTabs = new Hashtable();
133
		IExtensionPoint epoint = Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), IDebugUIConstants.EXTENSION_POINT_CONTRIBUTED_LAUNCH_TABS);
134
		IConfigurationElement[] elements = epoint.getConfigurationElements();
135
		LaunchConfigurationTabExtension tab = null;
136
		Hashtable element = null;
137
		for(int i = 0; i < elements.length; i++) {
138
			tab = new LaunchConfigurationTabExtension(elements[i]);
139
			element = (Hashtable) fContributedTabs.get(tab.getTabGroupId());
140
			if(element == null) {
141
				element = new Hashtable();
142
				element.put(tab.getIdentifier(), tab);
143
				fContributedTabs.put(tab.getTabGroupId(), element);
144
			}
145
			element.put(tab.getIdentifier(), tab);
146
		}
147
	}
148
	
149
	/**
119
	 * Returns the tab group for the given launch configuration type and mode.
150
	 * Returns the tab group for the given launch configuration type and mode.
120
	 * 
151
	 * 
121
	 * @param type launch configuration type
152
	 * @param type launch configuration type
122
	 * @param mode launch mode
153
	 * @param mode launch mode
123
	 * @return the tab group for the given type of launch configuration
154
	 * @return the tab group for the given type of launch configuration, or <code>null</code> if none
124
	 * @exception CoreException if an exception occurs creating the group
155
	 * @exception CoreException if an exception occurs creating the group
125
	 */
156
	 */
126
	public ILaunchConfigurationTabGroup getTabGroup(ILaunchConfigurationType type, String mode) throws CoreException {
157
	public ILaunchConfigurationTabGroup getTabGroup(ILaunchConfigurationType type, String mode) throws CoreException {
Lines 130-136 Link Here
130
			 MessageFormat.format(LaunchConfigurationsMessages.LaunchConfigurationPresentationManager_No_tab_group_defined_for_launch_configuration_type__0__3, (new String[] {type.getIdentifier()})), null);  
161
			 MessageFormat.format(LaunchConfigurationsMessages.LaunchConfigurationPresentationManager_No_tab_group_defined_for_launch_configuration_type__0__3, (new String[] {type.getIdentifier()})), null);  
131
			 throw new CoreException(status);
162
			 throw new CoreException(status);
132
		} 
163
		} 
133
		return ext.newTabGroup();		
164
		return new LaunchConfigurationTabGroupWrapper(ext.newTabGroup(), ext.getIdentifier());		
165
	}
166
	
167
	/**
168
	 * Returns the listing of <code>ILaunchConfigurationTab</code>s for the specified <code>ILaunchConfigurationTabGroup</code>.
169
	 * If no tabs are found for the specified id an empty array is returned, never <code>null</code>
170
	 * @param groupid
171
	 * @return the <code>ILaunchConfigurationTab</code>s for the specified <code>ILaunchConfigurationTabGroup</code> id,
172
	 * or an empty array if none are found
173
	 * 
174
	 * <p>
175
	 * <strong>EXPERIMENTAL</strong>. This method has been added as
176
	 * part of a work in progress. There is no guarantee that this API will
177
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
178
	 * without consulting with the Platform/Debug team.
179
	 * </p>
180
	 * @since 3.3
181
	 */
182
	public ILaunchConfigurationTab[] createContributedTabs(String groupid) {
183
		Hashtable tabs = (Hashtable) fContributedTabs.get(groupid);
184
		ArrayList list = new ArrayList();
185
		if(tabs != null) {
186
			LaunchConfigurationTabExtension ext = null;
187
			for(Iterator iter = tabs.keySet().iterator(); iter.hasNext();) {
188
				ext = (LaunchConfigurationTabExtension) tabs.get(iter.next());
189
				if(ext != null) {
190
					list.add(ext.getTab());
191
				}
192
			}
193
		}
194
		return (ILaunchConfigurationTab[]) list.toArray(new ILaunchConfigurationTab[list.size()]);
134
	}
195
	}
135
	
196
	
136
	/**
197
	/**
Lines 187-193 Link Here
187
	 */
248
	 */
188
	public String getDescription(ILaunchConfigurationType configType, String mode) {
249
	public String getDescription(ILaunchConfigurationType configType, String mode) {
189
		LaunchConfigurationPresentationManager manager = LaunchConfigurationPresentationManager.getDefault();
250
		LaunchConfigurationPresentationManager manager = LaunchConfigurationPresentationManager.getDefault();
190
		LaunchConfigurationTabGroupExtension extension = manager.getExtension(configType.getAttribute("id"), mode); //$NON-NLS-1$
251
		LaunchConfigurationTabGroupExtension extension = manager.getExtension(configType.getAttribute(IConfigurationElementConstants.ID), mode);
191
		return (extension != null ? extension.getDescription(mode) : null);
252
		return (extension != null ? extension.getDescription(mode) : null);
192
	}	
253
	}	
193
	
254
	
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java (+26 lines)
Lines 58-63 Link Here
58
	public static String LaunchConfigurationDialog__Apply_17;
58
	public static String LaunchConfigurationDialog__Apply_17;
59
	public static String LaunchConfigurationDialog__Name__16;
59
	public static String LaunchConfigurationDialog__Name__16;
60
	public static String LaunchConfigurationDialog_An_exception_occurred_while_retrieving_launch_configurations_20;
60
	public static String LaunchConfigurationDialog_An_exception_occurred_while_retrieving_launch_configurations_20;
61
62
	public static String LaunchConfigurationEditDialog_0;
63
64
	public static String LaunchConfigurationEditDialog_1;
61
	public static String LaunchConfigurationTabGroupViewer_0;
65
	public static String LaunchConfigurationTabGroupViewer_0;
62
	public static String LaunchConfigurationDialog_Create__manage__and_run_launch_configurations_8;
66
	public static String LaunchConfigurationDialog_Create__manage__and_run_launch_configurations_8;
63
	public static String LaunchConfigurationDialog_Dele_te_14;
67
	public static String LaunchConfigurationDialog_Dele_te_14;
Lines 88-93 Link Here
88
	public static String LaunchConfigurationsDialog_Warning_2;
92
	public static String LaunchConfigurationsDialog_Warning_2;
89
	public static String LaunchConfigurationsDialog_Information_3;
93
	public static String LaunchConfigurationsDialog_Information_3;
90
	public static String LaunchConfigurationPresentationManager_No_tab_group_defined_for_launch_configuration_type__0__3;
94
	public static String LaunchConfigurationPresentationManager_No_tab_group_defined_for_launch_configuration_type__0__3;
95
96
	public static String LaunchConfigurationTabGroupViewer_10;
97
98
	public static String LaunchConfigurationTabGroupViewer_11;
99
100
	public static String LaunchConfigurationTabGroupViewer_12;
101
102
	public static String LaunchConfigurationTabGroupViewer_13;
103
104
	public static String LaunchConfigurationTabGroupViewer_9;
91
	public static String PerspectiveManager_Error_1;
105
	public static String PerspectiveManager_Error_1;
92
	public static String PerspectiveManager_Unable_to_switch_perpsectives_as_specified_by_launch___0__4;
106
	public static String PerspectiveManager_Unable_to_switch_perpsectives_as_specified_by_launch___0__4;
93
	public static String PerspectiveManager_Unable_to_switch_to_perspective___0__2;
107
	public static String PerspectiveManager_Unable_to_switch_to_perspective___0__2;
Lines 201-204 Link Here
201
215
202
	public static String CollapseAllLaunchConfigurationAction_2;
216
	public static String CollapseAllLaunchConfigurationAction_2;
203
217
218
	public static String SelectLaunchOptionsDialog_0;
219
220
	public static String SelectLaunchOptionsDialog_1;
221
222
	public static String SelectLaunchOptionsDialog_2;
223
224
	public static String SelectLaunchOptionsDialog_3;
225
226
	public static String SelectLaunchOptionsDialog_4;
227
228
	public static String SelectLaunchOptionsDialog_5;
229
204
}
230
}
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java (-2 / +2 lines)
Lines 519-525 Link Here
519
				IStructuredSelection selection = (IStructuredSelection)fLaunchConfigurationView.getViewer().getSelection();
519
				IStructuredSelection selection = (IStructuredSelection)fLaunchConfigurationView.getViewer().getSelection();
520
				Object target = selection.getFirstElement();
520
				Object target = selection.getFirstElement();
521
				if (target instanceof ILaunchConfiguration) {
521
				if (target instanceof ILaunchConfiguration) {
522
					if (getTabViewer().canLaunch()) {
522
					if (getTabViewer().canLaunch() & getTabViewer().canLaunchWithOptions()) {
523
						handleLaunchPressed();
523
						handleLaunchPressed();
524
					}
524
					}
525
				} else {
525
				} else {
Lines 1421-1427 Link Here
1421
		getDeleteAction().setEnabled(getDeleteAction().isEnabled());
1421
		getDeleteAction().setEnabled(getDeleteAction().isEnabled());
1422
		getDuplicateAction().setEnabled(getDuplicateAction().isEnabled());
1422
		getDuplicateAction().setEnabled(getDuplicateAction().isEnabled());
1423
		getTabViewer().refresh();
1423
		getTabViewer().refresh();
1424
		getButton(ID_LAUNCH_BUTTON).setEnabled(getTabViewer().canLaunch());
1424
		getButton(ID_LAUNCH_BUTTON).setEnabled(getTabViewer().canLaunch() & getTabViewer().canLaunchWithOptions());
1425
	}
1425
	}
1426
1426
1427
	/* (non-Javadoc)
1427
	/* (non-Javadoc)
(-)ui/org/eclipse/debug/internal/ui/sourcelookup/SourceLookupPanel.java (-1 / +2 lines)
Lines 258-264 Link Here
258
			if (type == null) {
258
			if (type == null) {
259
				type = configuration.getType().getSourceLocatorId();
259
				type = configuration.getType().getSourceLocatorId();
260
			}
260
			}
261
		}catch(CoreException e){
261
		}
262
		catch(CoreException e){
262
			setErrorMessage(e.getMessage());
263
			setErrorMessage(e.getMessage());
263
			return;
264
			return;
264
		}	
265
		}	
(-)schema/launchConfigurationTabs.exsd (+137 lines)
Added Link Here
1
<?xml version='1.0' encoding='UTF-8'?>
2
<!-- Schema file written by PDE -->
3
<schema targetNamespace="org.eclipse.debug.ui">
4
<annotation>
5
      <appInfo>
6
         <meta.schema plugin="org.eclipse.debug.ui" id="launchConfigurationTabs" name="Launch Configuration Tabs"/>
7
      </appInfo>
8
      <documentation>
9
         This extension point is used to allow developers to contribute launch configuration tabs (one or more) to an existing launch configuration tab group.
10
11
12
&lt;p&gt;&lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;. This method has been added as
13
part of a work in progress. There is no guarantee that this API will
14
remain unchanged during the 3.3 release cycle. Please do not use this API
15
without consulting with the Platform/Debug team.&lt;/p&gt;
16
      </documentation>
17
   </annotation>
18
19
   <element name="extension">
20
      <complexType>
21
         <sequence minOccurs="1" maxOccurs="unbounded">
22
            <element ref="tab"/>
23
         </sequence>
24
         <attribute name="point" type="string" use="required">
25
            <annotation>
26
               <documentation>
27
                  
28
               </documentation>
29
            </annotation>
30
         </attribute>
31
      </complexType>
32
   </element>
33
34
   <element name="tab">
35
      <annotation>
36
         <documentation>
37
            describes an individual launch configuration tab contribution
38
         </documentation>
39
      </annotation>
40
      <complexType>
41
         <attribute name="id" type="string" use="required">
42
            <annotation>
43
               <documentation>
44
                  the unique id of this contributed tab
45
               </documentation>
46
            </annotation>
47
         </attribute>
48
         <attribute name="group" type="string" use="required">
49
            <annotation>
50
               <documentation>
51
                  the string id of the &lt;code&gt;ILaunchConfigurationTabGroup&lt;/code&gt; that this tab should be contributed to
52
               </documentation>
53
            </annotation>
54
         </attribute>
55
         <attribute name="name" type="string" use="required">
56
            <annotation>
57
               <documentation>
58
                  a human readable name for this tab. the prvided name does not have to be the name that you wish to appear on the tab itself. But it should sufficiently describe your tab.
59
               </documentation>
60
            </annotation>
61
         </attribute>
62
         <attribute name="class" type="string" use="required">
63
            <annotation>
64
               <documentation>
65
                  the implementation of your tab
66
               </documentation>
67
               <appInfo>
68
                  <meta.attribute kind="java" basedOn="org.eclipse.debug.ui.ILaunchConfigurationTab"/>
69
               </appInfo>
70
            </annotation>
71
         </attribute>
72
      </complexType>
73
   </element>
74
75
   <annotation>
76
      <appInfo>
77
         <meta.section type="since"/>
78
      </appInfo>
79
      <documentation>
80
         Eclipse 3.3 M3
81
      </documentation>
82
   </annotation>
83
84
   <annotation>
85
      <appInfo>
86
         <meta.section type="examples"/>
87
      </appInfo>
88
      <documentation>
89
         The following example adds the tab &quot;FooTab&quot; to the local java application launch tab group.
90
91
&lt;p&gt;
92
&lt;pre&gt;
93
&lt;extension point=&quot;org.eclipse.debug.ui.launchConfigurationTabs&quot;&gt;
94
    &lt;tab
95
      	class=&quot;org.eclipse.jdt.debug.ui.launchConfigurations.FooTab&quot;
96
        group=&quot;org.eclipse.jdt.debug.ui.launchConfigurationTabGroup.localJavaApplication&quot;
97
        id=&quot;org.eclipse.jdt.debug.ui.fooTab&quot;
98
        name=&quot;Foo Tab&quot;&gt;
99
    &lt;/tab&gt;
100
 &lt;/extension&gt;	
101
&lt;/pre&gt;
102
&lt;/p&gt;
103
      </documentation>
104
   </annotation>
105
106
   <annotation>
107
      <appInfo>
108
         <meta.section type="apiInfo"/>
109
      </appInfo>
110
      <documentation>
111
         [Enter API information here.]
112
      </documentation>
113
   </annotation>
114
115
   <annotation>
116
      <appInfo>
117
         <meta.section type="implementation"/>
118
      </appInfo>
119
      <documentation>
120
         [Enter information about supplied implementation of this extension point.]
121
      </documentation>
122
   </annotation>
123
124
   <annotation>
125
      <appInfo>
126
         <meta.section type="copyright"/>
127
      </appInfo>
128
      <documentation>
129
         Copyright (c) 2006 IBM Corporation and others.&lt;br&gt;
130
All rights reserved. This program and the accompanying materials are made 
131
available under the terms of the Eclipse Public License v1.0 which 
132
accompanies this distribution, and is available at 
133
&lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
134
      </documentation>
135
   </annotation>
136
137
</schema>
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupWrapper.java (+128 lines)
Added Link Here
1
package org.eclipse.debug.internal.ui.launchConfigurations;
2
3
import org.eclipse.debug.core.ILaunch;
4
import org.eclipse.debug.core.ILaunchConfiguration;
5
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
6
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
7
import org.eclipse.debug.ui.ILaunchConfigurationTab;
8
import org.eclipse.debug.ui.ILaunchConfigurationTabGroup;
9
10
/**
11
 * This class is used to wrap a contributed <code>ILaunchConfigurationTabGroup</code> with any contributed tabs
12
 * for that group (from a <code>launchConfigurationTabs</code> extension point).
13
 * 
14
 * <p>
15
 * <strong>EXPERIMENTAL</strong>. This class has been added as
16
 * part of a work in progress. There is no guarantee that this API will
17
 * remain unchanged during the 3.3 release cycle. Please do not use this API
18
 * without consulting with the Platform/Debug team.
19
 * </p>
20
 * @since 3.3
21
 */
22
public class LaunchConfigurationTabGroupWrapper implements ILaunchConfigurationTabGroup {
23
	
24
	private ILaunchConfigurationTabGroup fGroup = null;
25
	private String fGroupId = null;
26
	private ILaunchConfigurationTab[] fContributedTabs = null;
27
	
28
	/**
29
	 * Constructor
30
	 * @param group the existing group to wrapper
31
	 */
32
	public LaunchConfigurationTabGroupWrapper(ILaunchConfigurationTabGroup group, String groupId) {
33
		fGroup = group;
34
		fGroupId = groupId;
35
	}
36
	
37
	/**
38
	 * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
39
	 */
40
	public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
41
		if(fGroup != null) {
42
			fGroup.createTabs(dialog, mode);
43
		}
44
	}
45
46
	/**
47
	 * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#dispose()
48
	 */
49
	public void dispose() {
50
		if(fGroup != null) {
51
			fGroup.dispose();
52
		}
53
		if(fContributedTabs != null) {
54
			for(int i = 0; i < fContributedTabs.length; i++) {
55
				fContributedTabs[i].dispose();
56
			}
57
		}
58
	}
59
60
	/**
61
	 * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#getTabs()
62
	 */
63
	public ILaunchConfigurationTab[] getTabs() {
64
		if(fContributedTabs == null) {
65
			fContributedTabs = LaunchConfigurationPresentationManager.getDefault().createContributedTabs(fGroupId);
66
		}
67
		ILaunchConfigurationTab[] grouptabs = fGroup.getTabs();
68
		ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[grouptabs.length + fContributedTabs.length];
69
		System.arraycopy(grouptabs, 0, tabs, 0, grouptabs.length);
70
		System.arraycopy(fContributedTabs, 0, tabs, grouptabs.length, fContributedTabs.length);
71
		return tabs;
72
	}
73
74
	/**
75
	 * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
76
	 */
77
	public void initializeFrom(ILaunchConfiguration configuration) {
78
		if(fGroup != null) {
79
			fGroup.initializeFrom(configuration);
80
		}
81
		if(fContributedTabs == null) {
82
			getTabs();
83
		}
84
		for(int i = 0; i < fContributedTabs.length; i++) {
85
			fContributedTabs[i].initializeFrom(configuration);
86
		}
87
	}
88
89
	/**
90
	 * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#launched(org.eclipse.debug.core.ILaunch)
91
	 */
92
	public void launched(ILaunch launch) {
93
		if(fGroup != null) {
94
			fGroup.launched(launch);
95
		}
96
	}
97
98
	/**
99
	 * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
100
	 */
101
	public void performApply(ILaunchConfigurationWorkingCopy configuration) {
102
		if(fGroup != null) {
103
			fGroup.performApply(configuration);
104
			if(fContributedTabs == null) {
105
				getTabs();
106
			}
107
			for(int i = 0; i < fContributedTabs.length; i++) {
108
				fContributedTabs[i].performApply(configuration);
109
			}
110
		}
111
	}
112
113
	/**
114
	 * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
115
	 */
116
	public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
117
		if(fGroup != null) {
118
			fGroup.setDefaults(configuration);
119
			if(fContributedTabs == null) { 
120
				getTabs();
121
			}
122
			for(int i = 0; i < fContributedTabs.length; i++) {
123
				fContributedTabs[i].setDefaults(configuration);
124
			}
125
		}
126
	}
127
128
}
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationEditDialog.java (+59 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.debug.internal.ui.launchConfigurations;
12
13
import org.eclipse.debug.core.ILaunchConfiguration;
14
import org.eclipse.debug.ui.IDebugUIConstants;
15
import org.eclipse.swt.widgets.Composite;
16
import org.eclipse.swt.widgets.Shell;
17
18
/**
19
 * This class is used to construct a launch configuraityon dialog used to edit a launch configuration and continue,
20
 * not allowing a launch to occur.
21
 * 
22
 * @since 3.3
23
 * 
24
 * EXPERIMENTAL
25
 */
26
public class LaunchConfigurationEditDialog extends LaunchConfigurationDialog {
27
28
	public LaunchConfigurationEditDialog(Shell shell, ILaunchConfiguration launchConfiguration, LaunchGroupExtension group) {
29
		super(shell, launchConfiguration, group);
30
	}
31
32
	/* (non-Javadoc)
33
	 * @see org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationPropertiesDialog#getTitleAreaTitle()
34
	 */
35
	protected String getTitleAreaTitle() {
36
		return LaunchConfigurationsMessages.LaunchConfigurationEditDialog_0; 
37
	}
38
	
39
	/* (non-Javadoc)
40
	 * @see org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationPropertiesDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
41
	 */
42
	protected void createButtonsForButtonBar(Composite parent) {
43
		createButton(parent, ID_CLOSE_BUTTON, LaunchConfigurationsMessages.LaunchConfigurationEditDialog_1, true);  
44
	}
45
	
46
	/* (non-Javadoc)
47
	 * @see org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationPropertiesDialog#updateButtons()
48
	 */
49
	public void updateButtons() {
50
		getTabViewer().refresh();
51
	}
52
	
53
	/* (non-Javadoc)
54
	 * @see org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationPropertiesDialog#getDialogSettingsSectionName()
55
	 */
56
	protected String getDialogSettingsSectionName() {
57
		return IDebugUIConstants.PLUGIN_ID + ".LAUNCH_CONFIGURATION_EDIT_DIALOG_SECTION"; //$NON-NLS-1$
58
	}
59
}
(-)ui/org/eclipse/debug/internal/ui/LaunchConfigurationTabExtension.java (+82 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.debug.internal.ui;
12
13
import org.eclipse.core.runtime.CoreException;
14
import org.eclipse.core.runtime.IConfigurationElement;
15
import org.eclipse.debug.internal.core.IConfigurationElementConstants;
16
import org.eclipse.debug.ui.ILaunchConfigurationTab;
17
18
/**
19
 * Provides a proxy to a launchConfigurationTabs extension point
20
 * 
21
 * <p>
22
 * <strong>EXPERIMENTAL</strong>. This method has been added as
23
 * part of a work in progress. There is no guarantee that this API will
24
 * remain unchanged during the 3.3 release cycle. Please do not use this API
25
 * without consulting with the Platform/Debug team.
26
 * </p>
27
 * @since 3.3
28
 */
29
public final class LaunchConfigurationTabExtension {
30
31
	/**
32
	 * The configuration element backing this proxy
33
	 */
34
	IConfigurationElement fElement = null;
35
	
36
	/**
37
	 * Constructor
38
	 * @param element the <code>IConfigurationElement</code> for this proxy
39
	 */
40
	public LaunchConfigurationTabExtension(IConfigurationElement element) {
41
		fElement = element;
42
	}
43
	
44
	/**
45
	 * Returns the unique id ofthe tab
46
	 * @return the unique id of the tab
47
	 */
48
	public String getIdentifier() {
49
		return fElement.getAttribute(IConfigurationElementConstants.ID);
50
	}
51
52
	/**
53
	 * Returns the human readable name for the tab, not to be confused with the name that appears on the tab itself
54
	 * @return the name of the tab
55
	 */
56
	public String getName() {
57
		return fElement.getAttribute(IConfigurationElementConstants.NAME);
58
	}
59
60
	/**
61
	 * Returns the instantiated class of this tab
62
	 * @return the instantiated class of this tab
63
	 */
64
	public ILaunchConfigurationTab getTab() {
65
		try {
66
			Object object = fElement.createExecutableExtension(IConfigurationElementConstants.CLASS);
67
			if(object instanceof ILaunchConfigurationTab) {
68
				return (ILaunchConfigurationTab) object;
69
			}
70
		} catch (CoreException e) {DebugUIPlugin.log(e);}
71
		return null;
72
	}
73
74
	/**
75
	 * Returns the unique id of the <code>ILaunchConfigurationTabGroup</code> that this tab contributes to
76
	 * @return the id of the <code>ILaunchConfigurationTabGroup</code> this tab conributes to
77
	 */
78
	public String getTabGroupId() {
79
		return fElement.getAttribute(IConfigurationElementConstants.GROUP);
80
	}
81
82
}
(-)ui/org/eclipse/debug/ui/AbstractOptionLaunchConfigurationTab.java (+83 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.debug.ui;
12
13
import java.util.Set;
14
15
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.debug.core.DebugPlugin;
17
import org.eclipse.debug.core.ILaunchConfiguration;
18
import org.eclipse.debug.core.ILaunchConfigurationListener;
19
import org.eclipse.debug.internal.ui.DebugUIPlugin;
20
import org.eclipse.swt.widgets.Composite;
21
22
/**
23
 * This class provides a basis for the contribution of an <code>ILaunchConfigurationTab</code> which manipulates
24
 * a specified launch modification option.
25
 * 
26
 * This class is intended to be subclassed by clients, and should be subclassed if a tab with an option it contributed
27
 * 
28
 * @since 3.3
29
 * 
30
 * EXPERIMENTAL
31
 */
32
public abstract class AbstractOptionLaunchConfigurationTab extends AbstractLaunchConfigurationTab implements ILaunchConfigurationListener {
33
	
34
	/**
35
	 * This method returns the name of the option that this tab controls
36
	 * @return the name of the option that this tab is to control
37
	 */
38
	public abstract Set getOptions();
39
	
40
	/**
41
	 * This method is used to update the controls associated with setting the option for this tab.
42
	 * Update of the control takes place when a launch configuration has changed, which can occur when a tab 
43
	 * is deactivated, or if an option is modified outside of the tabs' control.
44
	 * @param options the current list of options from the working copy
45
	 */
46
	public abstract void updateOptionControls(Set options);
47
	
48
	/**
49
	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
50
	 */
51
	public void createControl(Composite parent) {
52
		DebugPlugin.getDefault().getLaunchManager().addLaunchConfigurationListener(this);
53
	}
54
	
55
	/**
56
	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose()
57
	 */
58
	public void dispose() {
59
		DebugPlugin.getDefault().getLaunchManager().removeLaunchConfigurationListener(this);
60
		super.dispose();
61
	}
62
63
	/**
64
	 * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationAdded(org.eclipse.debug.core.ILaunchConfiguration)
65
	 */
66
	public void launchConfigurationAdded(ILaunchConfiguration configuration) {}
67
68
	/**
69
	 * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationRemoved(org.eclipse.debug.core.ILaunchConfiguration)
70
	 */
71
	public void launchConfigurationRemoved(ILaunchConfiguration configuration) {}
72
	
73
	/**
74
	 * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationChanged(org.eclipse.debug.core.ILaunchConfiguration)
75
	 */
76
	public void launchConfigurationChanged(ILaunchConfiguration configuration) {
77
		try {
78
			updateOptionControls(configuration.getOptions());
79
		} 
80
		catch (CoreException e) {DebugUIPlugin.log(e);}
81
	}
82
83
}
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchOptionsDialog.java (+164 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.debug.internal.ui.launchConfigurations;
12
13
import java.util.Set;
14
15
import org.eclipse.debug.internal.core.LaunchDelegate;
16
import org.eclipse.debug.internal.ui.DebugUIPlugin;
17
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
18
import org.eclipse.debug.internal.ui.SWTUtil;
19
import org.eclipse.debug.ui.IDebugUIConstants;
20
import org.eclipse.jface.dialogs.Dialog;
21
import org.eclipse.jface.dialogs.IDialogSettings;
22
import org.eclipse.jface.viewers.ArrayContentProvider;
23
import org.eclipse.jface.viewers.CheckStateChangedEvent;
24
import org.eclipse.jface.viewers.CheckboxTableViewer;
25
import org.eclipse.jface.viewers.ICheckStateListener;
26
import org.eclipse.jface.viewers.ILabelProvider;
27
import org.eclipse.jface.viewers.ILabelProviderListener;
28
import org.eclipse.swt.SWT;
29
import org.eclipse.swt.graphics.Image;
30
import org.eclipse.swt.graphics.Point;
31
import org.eclipse.swt.layout.GridData;
32
import org.eclipse.swt.widgets.Composite;
33
import org.eclipse.swt.widgets.Control;
34
import org.eclipse.swt.widgets.Shell;
35
import org.eclipse.swt.widgets.Table;
36
import org.eclipse.ui.PlatformUI;
37
import org.eclipse.ui.dialogs.SelectionDialog;
38
39
/**
40
 * This class provides a dialog to present the user with a list of of viable launch options in the event 
41
 * the plugin that provides either a launch option or a contributed launch delegate is no longer available.
42
 * The user can select one of the launch mode/option configuration sform this dialog and repair the option 
43
 * configuration state of the the current launch configuration
44
 * 
45
 *  @since 3.3
46
 *  
47
 *  EXPERIMENTAL
48
 */
49
public class SelectLaunchOptionsDialog extends SelectionDialog {
50
51
	/**
52
	 * Builds labels for list control of the form: Mode + (no options) | [optionslist]
53
	 */
54
	class OptionsLabelProvider implements ILabelProvider {
55
		public Image getImage(Object element) {return null;}
56
		public String getText(Object element) {
57
			LaunchDelegate del = (LaunchDelegate) element;
58
			Set set = del.getOptions();
59
			return del.getName() + LaunchConfigurationsMessages.SelectLaunchOptionsDialog_5 + fMode + (set.isEmpty() ? LaunchConfigurationsMessages.SelectLaunchOptionsDialog_0 : LaunchConfigurationsMessages.SelectLaunchOptionsDialog_1 + set);
60
		}
61
		public void addListener(ILabelProviderListener listener) {}
62
		public void dispose() {}
63
		public boolean isLabelProperty(Object element, String property) {return false;}
64
		public void removeListener(ILabelProviderListener listener) {}
65
	}
66
	
67
	private static final String SETTINGS_ID = IDebugUIConstants.PLUGIN_ID + ".SELECT_LAUNCH_OPTIONS_DIALOG"; //$NON-NLS-1$
68
	
69
	private LaunchDelegate[] fDelegates = null;
70
	private String fMode = null;
71
	private Object[] fResult = null;
72
	private CheckboxTableViewer fTableViewer = null;
73
	private Table fTable  = null;
74
	
75
	/**
76
	 * Constructor
77
	 * @param parentShell the parent shell
78
	 * @param message the message for the dialog
79
	 * @param options the listing of arrays of options (each entry in the list must be an <code>Set</code> of options)
80
	 */
81
	public SelectLaunchOptionsDialog(Shell parentShell, String mode, LaunchDelegate[] delegates) {
82
		super(parentShell);
83
		super.setMessage(LaunchConfigurationsMessages.SelectLaunchOptionsDialog_2);
84
		super.setTitle(LaunchConfigurationsMessages.SelectLaunchOptionsDialog_3);
85
		setShellStyle(getShellStyle() | SWT.RESIZE);
86
		fDelegates = delegates;
87
		fMode = mode;
88
	}
89
	
90
	/**
91
	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
92
	 */
93
	protected Control createDialogArea(Composite parent) {
94
		initializeDialogUnits(parent);
95
		Composite comp = (Composite) super.createDialogArea(parent);
96
		SWTUtil.createLabel(comp, LaunchConfigurationsMessages.SelectLaunchOptionsDialog_4, 1);
97
		fTable = new Table(comp, SWT.BORDER | SWT.SINGLE | SWT.CHECK);
98
		fTable.setLayoutData(new GridData(GridData.FILL_BOTH));
99
		fTableViewer = new CheckboxTableViewer(fTable);
100
		fTableViewer.setLabelProvider(new OptionsLabelProvider());
101
		fTableViewer.setContentProvider(new ArrayContentProvider());
102
		fTableViewer.setInput(fDelegates);
103
		fTableViewer.addCheckStateListener(new ICheckStateListener() {
104
			public void checkStateChanged(CheckStateChangedEvent event) {
105
				fTableViewer.setAllChecked(false);
106
				fTableViewer.setChecked(event.getElement(), true);
107
			}
108
		});
109
		Dialog.applyDialogFont(comp);
110
		PlatformUI.getWorkbench().getHelpSystem().setHelp(comp, IDebugHelpContextIds.SELECT_LAUNCH_OPTIONS_DIALOG);
111
		return comp;
112
	}
113
	
114
	/**
115
	 * @see org.eclipse.ui.dialogs.SelectionDialog#getResult()
116
	 */
117
	public Object[] getResult() {
118
		return fResult;
119
	}
120
121
	/**
122
	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
123
	 */
124
	protected void okPressed() {
125
		Object[] o =  fTableViewer.getCheckedElements();
126
		if(o.length > 0) {
127
			fResult = ((LaunchDelegate)o[0]).getOptions().toArray();
128
		}
129
		super.okPressed();
130
	}
131
132
	/* (non-Javadoc)
133
	 * @see org.eclipse.ui.dialogs.SelectionDialog#getDialogBoundsSettings()
134
	 */
135
	protected IDialogSettings getDialogBoundsSettings() {
136
		IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings();
137
		IDialogSettings section = settings.getSection(SETTINGS_ID);
138
		if (section == null) {
139
			section = settings.addNewSection(SETTINGS_ID);
140
		} 
141
		return section;
142
	}
143
144
	/* (non-Javadoc)
145
	 * @see org.eclipse.jface.dialogs.Dialog#getInitialSize()
146
	 */
147
	protected Point getInitialSize() {
148
		IDialogSettings settings = getDialogBoundsSettings();
149
		if(settings != null) {
150
			try {
151
				int width = settings.getInt("DIALOG_WIDTH"); //$NON-NLS-1$
152
				int height = settings.getInt("DIALOG_HEIGHT"); //$NON-NLS-1$
153
				if(width > 0 & height > 0) {
154
					return new Point(width, height);
155
				}
156
			}
157
			catch (NumberFormatException nfe) {
158
				return new Point(350, 400);
159
			}
160
		}
161
		return new Point(350, 400);
162
	}
163
164
}
(-)ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchDelegateNotAvailableHandler.java (+48 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.debug.internal.ui.launchConfigurations;
12
13
import org.eclipse.core.runtime.CoreException;
14
import org.eclipse.core.runtime.IStatus;
15
import org.eclipse.core.runtime.Status;
16
import org.eclipse.debug.core.ILaunchConfiguration;
17
import org.eclipse.debug.core.IStatusHandler;
18
import org.eclipse.debug.internal.ui.DebugUIPlugin;
19
import org.eclipse.debug.ui.DebugUITools;
20
21
/**
22
 * This class provides a mechanism to prompt users in the UI thread from debug.core in the case where
23
 * a launch delegate has gone missing and a new choice needs to be made in the launch dialog.
24
 * 
25
 * @since 3.3
26
 * 
27
 * EXPERIMENTAL
28
 */
29
public class LaunchDelegateNotAvailableHandler implements IStatusHandler {
30
31
	/**
32
	 * @see org.eclipse.debug.core.IStatusHandler#handleStatus(org.eclipse.core.runtime.IStatus, java.lang.Object)
33
	 */
34
	public Object handleStatus(IStatus status, Object source) throws CoreException {
35
		if(source instanceof Object[]) {
36
			Object[] infos = (Object[]) source;
37
			if(infos.length == 2) {
38
				ILaunchConfiguration config = (ILaunchConfiguration) infos[0];
39
				String mode = (String) infos[1];
40
				DebugUITools.openLaunchConfigurationEditDialog(DebugUIPlugin.getShell(), 
41
						config, 
42
						DebugUITools.getLaunchGroup(config, mode).getIdentifier(),
43
						null);
44
			}
45
		}
46
		return Status.OK_STATUS;
47
	}
48
}
(-)contexts_Debugger.xml (+5 lines)
Lines 482-487 Link Here
482
   		<topic label="Running and Debugging" href="tasks/task-running_and_debugging.htm"/>
482
   		<topic label="Running and Debugging" href="tasks/task-running_and_debugging.htm"/>
483
		<topic label="Creating a Java application launch configuration" href="tasks/tasks-java-local-configuration.htm"/>
483
		<topic label="Creating a Java application launch configuration" href="tasks/tasks-java-local-configuration.htm"/>
484
   	</context>
484
   	</context>
485
   	<context id="select_launch_options_dialog">
486
   		<description>This dialog prompts users to select an available set of conbination of launch options in the event a plugin, no longer provided, has set launch options in the current launch configuration.</description>
487
   		<topic label="Running and Debugging" href="tasks/task-running_and_debugging.htm"/>
488
		<topic label="Creating a Java application launch configuration" href="tasks/tasks-java-local-configuration.htm"/>
489
   	</context>
485
490
486
491
487
492
(-)core/org/eclipse/debug/core/ILaunchManager.java (-2 / +2 lines)
Lines 229-235 Link Here
229
	 * @param optionId the unique id of the launch option
229
	 * @param optionId the unique id of the launch option
230
	 * @return the lauch option associated with ther specified id or <code>null</code> if not found
230
	 * @return the lauch option associated with ther specified id or <code>null</code> if not found
231
	 * <p>
231
	 * <p>
232
	 * <strong>EXPERIMENTAL</strong>. This ,method has been added as
232
	 * <strong>EXPERIMENTAL</strong>. This method has been added as
233
	 * part of a work in progress. There is no guarantee that this API will
233
	 * part of a work in progress. There is no guarantee that this API will
234
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
234
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
235
	 * without consulting with the Platform/Debug team.
235
	 * without consulting with the Platform/Debug team.
Lines 242-248 Link Here
242
	 * Returns all registered launch options
242
	 * Returns all registered launch options
243
	 * @return all registered launch options
243
	 * @return all registered launch options
244
	 * <p>
244
	 * <p>
245
	 * <strong>EXPERIMENTAL</strong>. This ,method has been added as
245
	 * <strong>EXPERIMENTAL</strong>. This method has been added as
246
	 * part of a work in progress. There is no guarantee that this API will
246
	 * part of a work in progress. There is no guarantee that this API will
247
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
247
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
248
	 * without consulting with the Platform/Debug team.
248
	 * without consulting with the Platform/Debug team.
(-)core/org/eclipse/debug/core/ILaunchOption.java (-12 / +3 lines)
Lines 16-27 Link Here
16
 * 
16
 * 
17
 * Example contribution of the debug launch option:
17
 * Example contribution of the debug launch option:
18
 * <pre>
18
 * <pre>
19
 * <extension
19
 * <extension point="org.eclipse.debug.core.launchOptions">
20
         point="org.eclipse.debug.core.launchOptions">
21
      <launchOption
20
      <launchOption
22
            id="org.eclipse.debug.core.debug"
21
            id="org.eclipse.debug.core.debug"
23
            label="Debug"
22
            label="Debug">
24
            option="debug">
25
      </launchOption>
23
      </launchOption>
26
   </extension>   
24
   </extension>   
27
 * </pre>
25
 * </pre>
Lines 45-58 Link Here
45
	public String getLabel();
43
	public String getLabel();
46
	
44
	
47
	/**
45
	/**
48
	 * Returns the launch option defined for this extension. The option is non-translatable, one word and
46
	 * @return the unique id provided for this option e.g. debug
49
	 * all lowercase.
50
	 * @return the option defined by this extension
51
	 */
52
	public String getOption();
53
	
54
	/**
55
	 * @return the unique id provided for this option e.g. org.eclipse.debug.core.debug
56
	 */
47
	 */
57
	public String getIdentifier();
48
	public String getIdentifier();
58
}
49
}
(-)core/org/eclipse/debug/core/ILaunchConfiguration.java (+36 lines)
Lines 13-18 Link Here
13
13
14
import java.util.List;
14
import java.util.List;
15
import java.util.Map;
15
import java.util.Map;
16
import java.util.Set;
16
17
17
import org.eclipse.core.resources.IFile;
18
import org.eclipse.core.resources.IFile;
18
import org.eclipse.core.resources.IResource;
19
import org.eclipse.core.resources.IResource;
Lines 190-195 Link Here
190
	public List getAttribute(String attributeName, List defaultValue) throws CoreException;
191
	public List getAttribute(String attributeName, List defaultValue) throws CoreException;
191
	
192
	
192
	/**
193
	/**
194
	 * Returns the <code>java.util.Set</code>-valued attribute with the given name.  
195
	 * Returns the given default value if the attribute is undefined.
196
	 *
197
	 * @param attributeName the name of the attribute
198
	 * @param defaultValue the value to use if no value is found
199
	 * @return the value or the default value if no value was found.
200
	 * @exception CoreException if this method fails. Reasons include:
201
	 * <ul>
202
	 * <li>An exception occurs while retrieving the attribute from
203
	 *  underlying storage.</li>
204
	 * <li>An attribute with the given name exists, but does not
205
	 *  have a List value</li>
206
	 * </ul>
207
	 * 
208
	 * @since 3.3
209
	 * 
210
	 * EXPERIMENTAL
211
	 */
212
	public Set getAttribute(String attributeName, Set defaultValue) throws CoreException;
213
	
214
	/**
193
	 * Returns the <code>java.util.Map</code>-valued attribute with the given name.  
215
	 * Returns the <code>java.util.Map</code>-valued attribute with the given name.  
194
	 * Returns the given default value if the attribute is undefined.
216
	 * Returns the given default value if the attribute is undefined.
195
	 *
217
	 *
Lines 304-309 Link Here
304
	public String getName();		
326
	public String getName();		
305
	
327
	
306
	/**
328
	/**
329
	 * 
330
	 * @return returns the options that this configuration supports
331
	 * 
332
	 * <p>
333
	 * <strong>EXPERIMENTAL</strong>. This method has been added as
334
	 * part of a work in progress. There is no guarantee that this API will
335
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
336
	 * without consulting with the Platform/Debug team.
337
	 * </p>
338
	 * @since 3.3
339
	 */
340
	public Set getOptions() throws CoreException;
341
	
342
	/**
307
	 * Returns the type of this launch configuration. This is a
343
	 * Returns the type of this launch configuration. This is a
308
	 * handle-only method.
344
	 * handle-only method.
309
	 * 
345
	 * 
(-)core/org/eclipse/debug/core/ILaunchConfigurationWorkingCopy.java (+89 lines)
Lines 13-18 Link Here
13
13
14
import java.util.List;
14
import java.util.List;
15
import java.util.Map;
15
import java.util.Map;
16
import java.util.Set;
16
17
17
import org.eclipse.core.resources.IContainer;
18
import org.eclipse.core.resources.IContainer;
18
import org.eclipse.core.resources.IResource;
19
import org.eclipse.core.resources.IResource;
Lines 172-175 Link Here
172
	 * @since 3.2
173
	 * @since 3.2
173
	 */
174
	 */
174
	public void setMappedResources(IResource[] resources);
175
	public void setMappedResources(IResource[] resources);
176
	
177
	/**
178
	 * This method is used to set an option for the associated <code>ILaunchConfiguraiton</code>.
179
	 * 
180
	 * If the option is <code>null</code>, or is alrready in the current set of options no changes are made
181
	 * 
182
	 * @param option the name of the option to set 
183
	 * 
184
	 * <p>
185
	 * <strong>EXPERIMENTAL</strong>. This method has been added as
186
	 * part of a work in progress. There is no guarantee that this API will
187
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
188
	 * without consulting with the Platform/Debug team.
189
	 * </p>
190
	 * @since 3.3
191
	 */
192
	public void addOption(String option);
193
	
194
	/**
195
	 * This method is used to remove an option from the associated <code>ILaunchConfiguraiton</code>.
196
	 * 
197
	 * If the option is <code>null</code> or not contained in the current set of options no changes are made
198
	 * 
199
	 * @param option the name of the option to remove 
200
	 * 
201
	 * <p>
202
	 * <strong>EXPERIMENTAL</strong>. This method has been added as
203
	 * part of a work in progress. There is no guarantee that this API will
204
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
205
	 * without consulting with the Platform/Debug team.
206
	 * </p>
207
	 * @since 3.3
208
	 */
209
	public void removeOption(String option);
210
	
211
	/**
212
	 * This method is used to set the options for the associated <code>ILaunchConfiguration</code>.
213
	 * Unlike <code>ILaunchConfigurationWorkingCopy.setOption(String, boolean)</code>, this method will over-write the existing 
214
	 * set of options with the new listing specified, it will NOT add the specified listing to the current set of options.
215
	 * 
216
	 * If the specified list of options is empty or <code>null</code>, the 'options' attribute is removed from the launch configuration altogether
217
	 * 
218
	 * @param options the list of options to replace the currently set ones with
219
	 * 
220
	 * <p>
221
	 * <strong>EXPERIMENTAL</strong>. This method has been added as
222
	 * part of a work in progress. There is no guarantee that this API will
223
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
224
	 * without consulting with the Platform/Debug team.
225
	 * </p>
226
	 * @since 3.3
227
	 */
228
	public void setOptions(Set options);
229
	
230
	/**
231
	 * This method is used to add the set of options to the associated <code>ILaunchConfiguraiton</code>.
232
	 * The original set of options is maintained and this set is appended to it
233
	 * 
234
	 * If the specified list of options is empty or <code>null</code>, no changes are made
235
	 * 
236
	 * @param options the set of options to append to the current set of options
237
	 * 
238
	 * <p>
239
	 * <strong>EXPERIMENTAL</strong>. This method has been added as
240
	 * part of a work in progress. There is no guarantee that this API will
241
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
242
	 * without consulting with the Platform/Debug team.
243
	 * </p>
244
	 * @since 3.3
245
	 */
246
	public void addOptions(Set options);
247
	
248
	/**
249
	 * This method is used to remove a set of options from the associated <code>ILaunchConfiguraiton</code>.
250
	 * 
251
	 * If the set is empty or <code>null</code> no changes are made
252
	 * 
253
	 * @param option the name of the option to remove 
254
	 * 
255
	 * <p>
256
	 * <strong>EXPERIMENTAL</strong>. This method has been added as
257
	 * part of a work in progress. There is no guarantee that this API will
258
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
259
	 * without consulting with the Platform/Debug team.
260
	 * </p>
261
	 * @since 3.3
262
	 */
263
	public void removeOptions(Set options);
175
}
264
}
(-)core/org/eclipse/debug/core/ILaunchConfigurationType.java (+66 lines)
Lines 126-135 Link Here
126
	 * @exception CoreException if unable to instantiate the
126
	 * @exception CoreException if unable to instantiate the
127
	 *  delegate
127
	 *  delegate
128
	 * @since 3.0
128
	 * @since 3.0
129
	 * @deprecated we have introduced launch options in 3.3M3 and delegates can be acquired using the new 
130
	 * <code>getDelegate(String mode, String[] options)</code> version. If no options are desired or cared about passing <code>null</code>
131
	 * works as though options are not considered at all. 
132
	 * 
129
	 */	
133
	 */	
130
	public ILaunchConfigurationDelegate getDelegate(String mode) throws CoreException;
134
	public ILaunchConfigurationDelegate getDelegate(String mode) throws CoreException;
131
	
135
	
132
	/**
136
	/**
137
	 * Returns the launch delegate for the specifed mode with the given options
138
	 * @param mode the mode to get the delegate for
139
	 * @param options the options that the delegate must support
140
	 * @return the <code>ILaunchConfigurationDelegate</code> for the given mode and options, or <code>null</code> if the is not one
141
	 * @throws CoreException
142
	 * @since 3.3
143
	 * 
144
	 * <p>
145
	 * <strong>EXPERIMENTAL</strong>. This method has been added as
146
	 * part of a work in progress. There is no guarantee that this API will
147
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
148
	 * without consulting with the Platform/Debug team.
149
	 * </p>
150
	 */
151
	public ILaunchConfigurationDelegate getDelegate(String mode, String[] options) throws CoreException;
152
	
153
	/**
133
	 * Returns the unique identifier for this type of launch configuration
154
	 * Returns the unique identifier for this type of launch configuration
134
	 * 
155
	 * 
135
	 * @return the unique identifier for this type of launch configuration
156
	 * @return the unique identifier for this type of launch configuration
Lines 157-165 Link Here
157
	 * Launch configuration types optionally specify this attribute
178
	 * Launch configuration types optionally specify this attribute
158
	 * in their plug-in XML via the <code>sourceLocatorId</code> attribute.  
179
	 * in their plug-in XML via the <code>sourceLocatorId</code> attribute.  
159
	 *  
180
	 *  
181
	 * In 3.3 we now search for a source locator id from contributed delegates that apply
182
	 * to this launch congfiguration type. As we assume only one locator id
183
	 * will be provided for any one contributed launch configuraiton type, the search is done
184
	 * on a first-found basis; i.e. the first delegate found is assumed to be the source lookup
185
	 * provider, and is cached for subsequent uses in source lookup. 
186
	 *  
160
	 * @return the identifier of the persistable source locator registered with
187
	 * @return the identifier of the persistable source locator registered with
161
	 *  this launch configurations type, or <code>null</code> if unspecified
188
	 *  this launch configurations type, or <code>null</code> if unspecified
162
	 * @since 3.0
189
	 * @since 3.0
190
	 * 
163
	 */
191
	 */
164
	public String getSourceLocatorId();
192
	public String getSourceLocatorId();
165
	
193
	
Lines 169-177 Link Here
169
	 * registered with a launch configuration type in plug-in XML via the
197
	 * registered with a launch configuration type in plug-in XML via the
170
	 * <code>sourcePathComputerId</code> attribute.
198
	 * <code>sourcePathComputerId</code> attribute.
171
	 * 
199
	 * 
200
	 * In 3.3 we now will look for a source path computer id from launch delegates that apply
201
	 * to this launch configuration type. As we assume only one locator id
202
	 * will be provided for any one contributed launch configuraiton type, the search is done
203
	 * on a first-found basis; i.e. the first delegate found is assumed to be the source lookup
204
	 * provider, and is cached for subsequent uses in source lookup. 
205
	 * 
172
	 * @return the source path computer registered with this launch configuration
206
	 * @return the source path computer registered with this launch configuration
173
	 * type or <code>null</code> if unspecified
207
	 * type or <code>null</code> if unspecified
174
	 * @since 3.0
208
	 * @since 3.0
209
	 * 
175
	 */
210
	 */
176
	public ISourcePathComputer getSourcePathComputer();	
211
	public ISourcePathComputer getSourcePathComputer();	
177
	
212
	
Lines 222-227 Link Here
222
	 *  <code>DEBUG_MODE</code>.
257
	 *  <code>DEBUG_MODE</code>.
223
	 * @return whether this kind of launch configuration supports the
258
	 * @return whether this kind of launch configuration supports the
224
	 *  specified mode
259
	 *  specified mode
260
	 *  
225
	 */
261
	 */
226
	public boolean supportsMode(String mode);
262
	public boolean supportsMode(String mode);
263
	
264
	/**
265
	 * Returns the simple name of the plugin that contributed this launch configuration type
266
	 * @return the name of the contributor
267
	 * @since 3.3
268
	 * 
269
	 * <p>
270
	 * <strong>EXPERIMENTAL</strong>. This method has been added as
271
	 * part of a work in progress. There is no guarantee that this API will
272
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
273
	 * without consulting with the Platform/Debug team.
274
	 * </p>
275
	 */
276
	public String getContributorName();
277
	
278
	/**
279
	 * Returns the path of the image descriptor for this launch configuration type, which in turn 
280
	 * is used in <code>DebugPluginImages</code> to load the image registry with config images.
281
	 * NOTE: the path could be only a fragment, and might require qualification via the bundle of the contributor.
282
	 * @return the id of the image for this config type
283
	 * @since 3.3
284
	 * 
285
	 * <p>
286
	 * <strong>EXPERIMENTAL</strong>. This method has been added as
287
	 * part of a work in progress. There is no guarantee that this API will
288
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
289
	 * without consulting with the Platform/Debug team.
290
	 * </p>
291
	 */
292
	public String getImageDescriptorPath();
227
}
293
}
(-)core/org/eclipse/debug/internal/core/LaunchManager.java (-115 / +300 lines)
Lines 148-154 Link Here
148
	 * @since 3.2
148
	 * @since 3.2
149
	 */
149
	 */
150
	protected static final IStatus deleteAssociatedLaunchConfigs = new Status(IStatus.INFO, DEBUG_CORE, 225, EMPTY_STRING, null);
150
	protected static final IStatus deleteAssociatedLaunchConfigs = new Status(IStatus.INFO, DEBUG_CORE, 225, EMPTY_STRING, null);
151
    
152
	
151
	
153
	
152
	
154
	/**
153
	/**
Lines 507-523 Link Here
507
	 * @throws IOException if the encoding attempted to be used is not supported
506
	 * @throws IOException if the encoding attempted to be used is not supported
508
	 */
507
	 */
509
	public static String serializeDocument(Document doc) throws TransformerException, IOException {
508
	public static String serializeDocument(Document doc) throws TransformerException, IOException {
510
		ByteArrayOutputStream s= new ByteArrayOutputStream();
509
		ByteArrayOutputStream s = new ByteArrayOutputStream();
511
		
510
		TransformerFactory factory = TransformerFactory.newInstance();
512
		TransformerFactory factory= TransformerFactory.newInstance();
511
		Transformer transformer = factory.newTransformer();
513
		Transformer transformer= factory.newTransformer();
514
		transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
512
		transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
515
		transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
513
		transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
516
		
514
		DOMSource source = new DOMSource(doc);
517
		DOMSource source= new DOMSource(doc);
515
		StreamResult outputTarget = new StreamResult(s);
518
		StreamResult outputTarget= new StreamResult(s);
519
		transformer.transform(source, outputTarget);
516
		transformer.transform(source, outputTarget);
520
		
521
		return s.toString("UTF8"); //$NON-NLS-1$			
517
		return s.toString("UTF8"); //$NON-NLS-1$			
522
	}
518
	}
523
	
519
	
Lines 564-573 Link Here
564
	private HashMap fLaunchOptions = null;
560
	private HashMap fLaunchOptions = null;
565
	
561
	
566
	/**
562
	/**
567
	 * List of contributed launch delegates (delegates contributed for existing
563
	 * A map of LaunchDelegate objects stored by id of delegate, or launch config type
568
	 * launch configuration types).
569
	 */
564
	 */
570
	private List fContributedDelegates = null;
565
	private HashMap fLaunchDelegates = null;
566
	
567
	/**
568
	 * A map of duplicate delegates arranged by config type id
569
	 */
570
	private HashMap fDuplicateDelegates = null;
571
571
572
	/**
572
	/**
573
	 * Collection of launches
573
	 * Collection of launches
Lines 581-587 Link Here
581
	/**
581
	/**
582
	 * Collection of listeners
582
	 * Collection of listeners
583
	 */
583
	 */
584
	private ListenerList fListeners= new ListenerList();
584
	private ListenerList fListeners = new ListenerList();
585
	
585
	
586
	/**
586
	/**
587
	 * Collection of "plural" listeners.
587
	 * Collection of "plural" listeners.
Lines 630-636 Link Here
630
	 * and values are associated configuration elements.
630
	 * and values are associated configuration elements.
631
	 */
631
	 */
632
	private Map sourcePathComputers;
632
	private Map sourcePathComputers;
633
	
633
634
	/**
634
	/**
635
	 * @see ILaunchManager#addLaunch(ILaunch)
635
	 * @see ILaunchManager#addLaunch(ILaunch)
636
	 */
636
	 */
Lines 830-837 Link Here
830
		}
830
		}
831
		Iterator iter = list.iterator();
831
		Iterator iter = list.iterator();
832
		List configs = new ArrayList(list.size());
832
		List configs = new ArrayList(list.size());
833
		IFile file = null;
833
		while (iter.hasNext()) {
834
		while (iter.hasNext()) {
834
			IFile file = (IFile)iter.next();
835
			file = (IFile)iter.next();
835
			configs.add(getLaunchConfiguration(file));
836
			configs.add(getLaunchConfiguration(file));
836
		}
837
		}
837
		return configs;
838
		return configs;
Lines 856-863 Link Here
856
				}
857
				}
857
			};
858
			};
858
			String[] files = directory.list(filter);
859
			String[] files = directory.list(filter);
860
			LaunchConfiguration config = null;
859
			for (int i = 0; i < files.length; i++) {
861
			for (int i = 0; i < files.length; i++) {
860
				LaunchConfiguration config = new LaunchConfiguration(containerPath.append(files[i]));
862
				config = new LaunchConfiguration(containerPath.append(files[i]));
861
				configs.add(config);
863
				configs.add(config);
862
			}
864
			}
863
		}
865
		}
Lines 893-905 Link Here
893
				try {
895
				try {
894
					index = Integer.parseInt(trailer);
896
					index = Integer.parseInt(trailer);
895
					baseName = baseName.substring(0, copyIndex);
897
					baseName = baseName.substring(0, copyIndex);
896
				} catch (NumberFormatException nfe) {
898
				} 
897
				}
899
				catch (NumberFormatException nfe) {}
898
			}
900
			}
899
		} 
901
		} 
900
		String newName = baseName;
902
		String newName = baseName;
901
		
903
		
902
		StringBuffer buffer= null;
904
		StringBuffer buffer = null;
903
		while (isExistingLaunchConfigurationName(newName)) {
905
		while (isExistingLaunchConfigurationName(newName)) {
904
			buffer = new StringBuffer(baseName);
906
			buffer = new StringBuffer(baseName);
905
			buffer.append(" ("); //$NON-NLS-1$
907
			buffer.append(" ("); //$NON-NLS-1$
Lines 995-1010 Link Here
995
		List configs = new ArrayList(4);	
997
		List configs = new ArrayList(4);	
996
		NodeList list = root.getChildNodes();
998
		NodeList list = root.getChildNodes();
997
		int length = list.getLength();
999
		int length = list.getLength();
1000
		Node node = null;
1001
		Element entry = null;
1002
		String memento = null;
998
		for (int i = 0; i < length; ++i) {
1003
		for (int i = 0; i < length; ++i) {
999
			Node node = list.item(i);
1004
			node = list.item(i);
1000
			short type = node.getNodeType();
1005
			short type = node.getNodeType();
1001
			if (type == Node.ELEMENT_NODE) {
1006
			if (type == Node.ELEMENT_NODE) {
1002
				Element entry = (Element) node;
1007
				entry = (Element) node;
1003
				String nodeName = entry.getNodeName();
1008
				if (!entry.getNodeName().equals("launchConfiguration")) { //$NON-NLS-1$
1004
				if (!nodeName.equals("launchConfiguration")) { //$NON-NLS-1$
1005
					throw invalidFormat;
1009
					throw invalidFormat;
1006
				}
1010
				}
1007
				String memento = entry.getAttribute("memento"); //$NON-NLS-1$
1011
				memento = entry.getAttribute("memento"); //$NON-NLS-1$
1008
				if (memento == null) {
1012
				if (memento == null) {
1009
					throw invalidFormat;
1013
					throw invalidFormat;
1010
				}
1014
				}
Lines 1016-1033 Link Here
1016
	
1020
	
1017
	protected ConfigurationNotifier getConfigurationNotifier() {
1021
	protected ConfigurationNotifier getConfigurationNotifier() {
1018
		return new ConfigurationNotifier();
1022
		return new ConfigurationNotifier();
1019
	}	
1023
	}			
1020
	
1021
	/**
1022
	 * Returns a list of launch delegates contributed for existing launch configuration
1023
	 * types.
1024
	 * 
1025
	 * @return list of ContributedDelegate
1026
	 */
1027
	protected List getContributedDelegates() {
1028
		initializeContributedDelegates();
1029
		return fContributedDelegates;
1030
	}		
1031
	
1024
	
1032
	/**
1025
	/**
1033
	 * @see ILaunchManager#getDebugTargets()
1026
	 * @see ILaunchManager#getDebugTargets()
Lines 1036-1044 Link Here
1036
		synchronized (fLaunches) {
1029
		synchronized (fLaunches) {
1037
			List allTargets= new ArrayList(fLaunches.size());
1030
			List allTargets= new ArrayList(fLaunches.size());
1038
			if (fLaunches.size() > 0) {
1031
			if (fLaunches.size() > 0) {
1039
				Iterator e= fLaunches.iterator();
1032
				Iterator e = fLaunches.iterator();
1033
				IDebugTarget[] targets = null;
1040
				while (e.hasNext()) {
1034
				while (e.hasNext()) {
1041
					IDebugTarget[] targets= ((ILaunch) e.next()).getDebugTargets();
1035
					targets = ((ILaunch) e.next()).getDebugTargets();
1042
					for (int i = 0; i < targets.length; i++) {
1036
					for (int i = 0; i < targets.length; i++) {
1043
						allTargets.add(targets[i]);
1037
						allTargets.add(targets[i]);
1044
					}
1038
					}
Lines 1073-1082 Link Here
1073
		if (configEnv == null) {
1067
		if (configEnv == null) {
1074
			return null;
1068
			return null;
1075
		}
1069
		}
1076
		Map env = null;
1070
		Map env = new HashMap();
1077
		// build base environment
1071
		// build base environment
1078
		env= new HashMap();
1072
		boolean append = configuration.getAttribute(ATTR_APPEND_ENVIRONMENT_VARIABLES, true);
1079
		boolean append= configuration.getAttribute(ATTR_APPEND_ENVIRONMENT_VARIABLES, true);
1080
		if (append) {
1073
		if (append) {
1081
			env.putAll(getNativeEnvironmentCasePreserved());
1074
			env.putAll(getNativeEnvironmentCasePreserved());
1082
		}
1075
		}
Lines 1084-1093 Link Here
1084
		// Add variables from config
1077
		// Add variables from config
1085
		Iterator iter= configEnv.entrySet().iterator();
1078
		Iterator iter= configEnv.entrySet().iterator();
1086
		boolean win32= Platform.getOS().equals(Constants.OS_WIN32);
1079
		boolean win32= Platform.getOS().equals(Constants.OS_WIN32);
1080
		Map.Entry entry = null;
1081
		String key = null;
1082
		String value = null;
1083
		Object nativeValue = null;
1084
		Iterator envIter = null;
1085
		Map.Entry nativeEntry = null;
1086
		String nativeKey = null;
1087
		while (iter.hasNext()) {
1087
		while (iter.hasNext()) {
1088
			Map.Entry entry= (Map.Entry) iter.next();
1088
			entry = (Map.Entry) iter.next();
1089
			String key= (String) entry.getKey();
1089
			key = (String) entry.getKey();
1090
            String value = (String) entry.getValue();
1090
            value = (String) entry.getValue();
1091
            // translate any string substitution variables
1091
            // translate any string substitution variables
1092
            if (value != null) {
1092
            if (value != null) {
1093
                value = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(value);
1093
                value = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(value);
Lines 1095-1101 Link Here
1095
            boolean added= false;
1095
            boolean added= false;
1096
			if (win32) {
1096
			if (win32) {
1097
                // First, check if the key is an exact match for an existing key.
1097
                // First, check if the key is an exact match for an existing key.
1098
                Object nativeValue= env.get(key);
1098
				nativeValue = env.get(key);
1099
                if (nativeValue != null) {
1099
                if (nativeValue != null) {
1100
                    // If an exact match is found, just replace the value
1100
                    // If an exact match is found, just replace the value
1101
                    env.put(key, value);
1101
                    env.put(key, value);
Lines 1103-1115 Link Here
1103
                    // Win32 vars are case-insensitive. If an exact match isn't found, iterate to
1103
                    // Win32 vars are case-insensitive. If an exact match isn't found, iterate to
1104
                    // check for a case-insensitive match. We maintain the key's case (see bug 86725),
1104
                    // check for a case-insensitive match. We maintain the key's case (see bug 86725),
1105
                    // but do a case-insensitive comparison (for example, "pAtH" will still override "PATH").
1105
                    // but do a case-insensitive comparison (for example, "pAtH" will still override "PATH").
1106
                    Iterator envIter= env.entrySet().iterator();
1106
                    envIter = env.entrySet().iterator();
1107
                    while (envIter.hasNext()) {
1107
                    while (envIter.hasNext()) {
1108
                        Map.Entry nativeEntry = (Map.Entry) envIter.next();
1108
                        nativeEntry = (Map.Entry) envIter.next();
1109
                        String nativeKey= (String) (nativeEntry).getKey();
1109
                        nativeKey = (String) (nativeEntry).getKey();
1110
                        if (nativeKey.equalsIgnoreCase(key)) {
1110
                        if (nativeKey.equalsIgnoreCase(key)) {
1111
                            nativeEntry.setValue(value);
1111
                            nativeEntry.setValue(value);
1112
                            added= true;
1112
                            added = true;
1113
                            break;
1113
                            break;
1114
                        }
1114
                        }
1115
                    }
1115
                    }
Lines 1120-1130 Link Here
1120
            }
1120
            }
1121
		}		
1121
		}		
1122
		
1122
		
1123
		iter= env.entrySet().iterator();
1123
		iter = env.entrySet().iterator();
1124
		List strings= new ArrayList(env.size());
1124
		List strings = new ArrayList(env.size());
1125
		StringBuffer buffer = null;
1125
		while (iter.hasNext()) {
1126
		while (iter.hasNext()) {
1126
			Map.Entry entry = (Map.Entry) iter.next();
1127
			entry = (Map.Entry) iter.next();
1127
			StringBuffer buffer= new StringBuffer((String) entry.getKey());
1128
			buffer = new StringBuffer((String) entry.getKey());
1128
			buffer.append('=').append((String) entry.getValue());
1129
			buffer.append('=').append((String) entry.getValue());
1129
			strings.add(buffer.toString());
1130
			strings.add(buffer.toString());
1130
		}
1131
		}
Lines 1215-1222 Link Here
1215
	public ILaunchConfiguration[] getLaunchConfigurations(ILaunchConfigurationType type) throws CoreException {
1216
	public ILaunchConfiguration[] getLaunchConfigurations(ILaunchConfigurationType type) throws CoreException {
1216
		Iterator iter = getAllLaunchConfigurations().iterator();
1217
		Iterator iter = getAllLaunchConfigurations().iterator();
1217
		List configs = new ArrayList();
1218
		List configs = new ArrayList();
1219
		ILaunchConfiguration config = null;
1218
		while (iter.hasNext()) {
1220
		while (iter.hasNext()) {
1219
			ILaunchConfiguration config = (ILaunchConfiguration)iter.next();
1221
			config = (ILaunchConfiguration)iter.next();
1220
			if (config.getType().equals(type)) {
1222
			if (config.getType().equals(type)) {
1221
				configs.add(config);
1223
				configs.add(config);
1222
			}
1224
			}
Lines 1224-1230 Link Here
1224
		return (ILaunchConfiguration[])configs.toArray(new ILaunchConfiguration[configs.size()]);
1226
		return (ILaunchConfiguration[])configs.toArray(new ILaunchConfiguration[configs.size()]);
1225
	}
1227
	}
1226
	
1228
	
1227
	
1228
	/**
1229
	/**
1229
	 * Returns all launch configurations that are stored as resources
1230
	 * Returns all launch configurations that are stored as resources
1230
	 * in the given project.
1231
	 * in the given project.
Lines 1236-1244 Link Here
1236
	protected List getLaunchConfigurations(IProject project) {
1237
	protected List getLaunchConfigurations(IProject project) {
1237
		Iterator iter = getAllLaunchConfigurations().iterator();
1238
		Iterator iter = getAllLaunchConfigurations().iterator();
1238
		List configs = new ArrayList();
1239
		List configs = new ArrayList();
1240
		ILaunchConfiguration config = null;
1241
		IFile file = null;
1239
		while (iter.hasNext()) {
1242
		while (iter.hasNext()) {
1240
			ILaunchConfiguration config = (ILaunchConfiguration)iter.next();
1243
			config = (ILaunchConfiguration)iter.next();
1241
			IFile file = config.getFile();
1244
			file = config.getFile();
1242
			if (file != null && file.getProject().equals(project)) {
1245
			if (file != null && file.getProject().equals(project)) {
1243
				configs.add(config);
1246
				configs.add(config);
1244
			}
1247
			}
Lines 1276-1282 Link Here
1276
		}
1279
		}
1277
	}
1280
	}
1278
	
1281
	
1279
	/* (non-Javadoc)
1282
	/**)
1280
	 * @see org.eclipse.debug.core.ILaunchManager#getLaunchMode(java.lang.String)
1283
	 * @see org.eclipse.debug.core.ILaunchManager#getLaunchMode(java.lang.String)
1281
	 */
1284
	 */
1282
	public ILaunchMode getLaunchMode(String mode) {
1285
	public ILaunchMode getLaunchMode(String mode) {
Lines 1284-1290 Link Here
1284
		return (ILaunchMode) fLaunchModes.get(mode);
1287
		return (ILaunchMode) fLaunchModes.get(mode);
1285
	}
1288
	}
1286
	
1289
	
1287
	/* (non-Javadoc)
1290
	/**
1288
	 * @see org.eclipse.debug.core.ILaunchManager#getLaunchModes()
1291
	 * @see org.eclipse.debug.core.ILaunchManager#getLaunchModes()
1289
	 */
1292
	 */
1290
	public ILaunchMode[] getLaunchModes() {
1293
	public ILaunchMode[] getLaunchModes() {
Lines 1309-1315 Link Here
1309
		Collection col = fLaunchOptions.values();
1312
		Collection col = fLaunchOptions.values();
1310
		return (ILaunchOption[])col.toArray(new ILaunchOption[col.size()]);
1313
		return (ILaunchOption[])col.toArray(new ILaunchOption[col.size()]);
1311
	}
1314
	}
1312
		
1315
	
1316
	/**
1317
	 * Initializes the listing of registered launch options. Does no work if the mapping is already populated.
1318
	 * 
1319
	 * <p>
1320
	 * <strong>EXPERIMENTAL</strong>. This method has been added as
1321
	 * part of a work in progress. There is no guarantee that this API will
1322
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
1323
	 * without consulting with the Platform/Debug team.
1324
	 * </p>
1325
	 * @since 3.3  
1326
	 */
1327
	private synchronized void initializeLaunchOptions() {
1328
		if(fLaunchOptions == null) {
1329
			IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_OPTIONS);
1330
			IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
1331
			fLaunchOptions = new HashMap();
1332
			ILaunchOption option = null;
1333
			for(int i =  0; i < infos.length; i++) {
1334
				option = new LaunchOption(infos[i]);
1335
				fLaunchOptions.put(option.getIdentifier(), option);
1336
			}
1337
		}
1338
	}
1339
	
1340
	/**
1341
	 * Returns all of the launch delegates. The rturned listing of delegates cannot be directly used to launch,
1342
	 * instead the method <code>IlaunchDelegate.getDelegate</code> must be used to acquire an executable form of
1343
	 * the delegate, allowing us to maintain lazy loading of the delegates themselves.
1344
	 * @return all of the launch delegates
1345
	 * @since 3.3
1346
	 * <p>
1347
	 * <strong>EXPERIMENTAL</strong>. This method has been added as
1348
	 * part of a work in progress. There is no guarantee that this API will
1349
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
1350
	 * without consulting with the Platform/Debug team.
1351
	 * </p>
1352
	 */
1353
	public LaunchDelegate[] getLaunchDelegates() {
1354
		initializeLaunchDelegates();
1355
		Collection col = fLaunchDelegates.values();
1356
		return (LaunchDelegate[]) col.toArray(new LaunchDelegate[col.size()]);
1357
	}
1358
	
1359
	/** Returns the launch delegates that applies to the specified options for the specified mode and type id
1360
	 * @param typeid the <code>ILaunchConfigurationType</code> id
1361
	 * @param the mode id
1362
	 * @param options the array of options to find the delegate for
1363
	 * @return the delegates that apply to the specified launch options for the specified mode and type id
1364
	 * 
1365
	 * <p>
1366
	 * <strong>EXPERIMENTAL</strong>. This method has been added as
1367
	 * part of a work in progress. There is no guarantee that this API will
1368
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
1369
	 * without consulting with the Platform/Debug team.
1370
	 * </p>
1371
	 * @since 3.3
1372
	 */
1373
	public LaunchDelegate[] getLaunchDelegates(String typeid, String mode, String[] options) {
1374
		initializeLaunchDelegates();
1375
		LaunchDelegate ld = null;
1376
		boolean applies = true;
1377
		ArrayList list = new ArrayList();
1378
		Set doptions = null;
1379
		for(Iterator iter = fLaunchDelegates.keySet().iterator(); iter.hasNext();) {
1380
			ld = (LaunchDelegate) fLaunchDelegates.get(iter.next());
1381
			doptions = ld.getOptions();
1382
			if(ld.appliesTo(typeid, mode)) {
1383
				if(options != null) {
1384
					if(doptions.size() > 0 & options.length == 0) {
1385
						applies = false;
1386
					}
1387
					for(int i = 0; i < options.length; i++) {
1388
						applies &= doptions.contains(options[i]);
1389
					}
1390
				}
1391
				else if(doptions.size() > 0) {
1392
					applies = false;
1393
				}
1394
				if(applies) {
1395
					list.add(ld);
1396
				}
1397
				applies = true;
1398
			}
1399
		}
1400
		return (LaunchDelegate[]) list.toArray(new LaunchDelegate[list.size()]);
1401
	}
1402
	
1403
	/**
1404
	 * Returns the listing of launch delegates that apply to the specified 
1405
	 * <code>ILaunchConfigurationType</code> id
1406
	 * @param typeid the id of the launch configuration type to get delegates for 
1407
	 * @return An array of <code>LaunchDelegate</code>s that apply to the specified launch configuration
1408
	 * type, or an empty array, never <code>null</code>
1409
	 * 
1410
	 * @since 3.3
1411
	 * 
1412
	 * EXPERIMENTAL
1413
	 */
1414
	public LaunchDelegate[] getLaunchDelegates(String typeid) {
1415
		initializeLaunchDelegates();
1416
		ArrayList list = new ArrayList();
1417
		LaunchDelegate ld = null;
1418
		for(Iterator iter = fLaunchDelegates.keySet().iterator(); iter.hasNext();) {
1419
			ld = (LaunchDelegate) fLaunchDelegates.get(iter.next());
1420
			if(ld.appliesTo(typeid)) {
1421
				list.add(ld);
1422
			}
1423
		}
1424
		return (LaunchDelegate[]) list.toArray(new LaunchDelegate[list.size()]);
1425
	}
1426
	
1427
	/**
1428
	 * Returns the listing of duplicate launch delegates in the form of a <code>HashMap</code>, with the 
1429
	 * object arrangement: 
1430
	 * <p>
1431
	 * <pre>
1432
	 * HashMap<ILaunchConfigurationType, HashMap<string, LaunchDelegate[]>>
1433
	 * </pre>
1434
	 * </p>
1435
	 * <p>
1436
	 * Where the first map is keyed based on <code>ILaunchConfigurationType</code> ids and the inner map
1437
	 * is keyed by mode.
1438
	 * </p> 
1439
	 * @return the map of <code>LaunchDelegate</code>s that are in conflict for type, mode and options
1440
	 * 
1441
	 * @since 3.3
1442
	 * 
1443
	 * EXPERIMENTAL
1444
	 */
1445
	public HashMap getDuplicateLaunchDelegates() {
1446
		initializeDuplicateLaunchDelegates();
1447
		return fDuplicateDelegates;
1448
	}
1449
	
1450
	/**
1451
	 * Lazily initializes the listing of duplicate launch delegates
1452
	 * 
1453
	 * @since 3.3
1454
	 * 
1455
	 * EXPERIMENTAL
1456
	 */
1457
	private synchronized void initializeDuplicateLaunchDelegates() {
1458
		if(fDuplicateDelegates == null) {
1459
			fDuplicateDelegates = new HashMap();
1460
			//for each delegate get the delegates[]
1461
			LaunchDelegate[] delegates = getLaunchDelegates();
1462
			LaunchDelegate[] dupes = null;
1463
			ILaunchConfigurationType type = null;
1464
			Set modes = null;
1465
			Iterator iter = null;
1466
			Set options = null;
1467
			HashMap tmp = null;
1468
			String mode = null;
1469
			for(int i = 0; i < delegates.length; i++) {
1470
				type = getLaunchConfigurationType(delegates[i].getLaunchConfigurationType());
1471
				options = delegates[i].getOptions();
1472
				modes = type.getSupportedModes();
1473
				for(iter = modes.iterator(); iter.hasNext();) {
1474
					mode = (String) iter.next();
1475
					dupes = getLaunchDelegates(type.getIdentifier(), mode, (String[])options.toArray(new String[options.size()]));
1476
					if(dupes.length > 1) {
1477
						tmp = (HashMap) fDuplicateDelegates.get(type);
1478
						if(tmp == null) {
1479
							tmp = new HashMap(dupes.length);
1480
						}
1481
						tmp.put(mode, dupes);
1482
						fDuplicateDelegates.put(type, tmp);
1483
					}
1484
				}
1485
			}
1486
		}
1487
	}
1488
	
1489
	/**
1490
	 * Initializes the listing of delegates available to the launching framework
1491
	 * 
1492
	 * <p>
1493
	 * <strong>EXPERIMENTAL</strong>. This method has been added as
1494
	 * part of a work in progress. There is no guarantee that this API will
1495
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
1496
	 * without consulting with the Platform/Debug team.
1497
	 * </p>
1498
	 * @since 3.3
1499
	 */
1500
	private synchronized void initializeLaunchDelegates() {
1501
		if(fLaunchDelegates == null) {
1502
			fLaunchDelegates = new HashMap();
1503
			//get all launch delegate contributions
1504
			IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_DELEGATES);
1505
			IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
1506
			LaunchDelegate delegate = null;
1507
			for(int i = 0; i < infos.length; i++) {
1508
				delegate = new LaunchDelegate(infos[i]);
1509
				fLaunchDelegates.put(delegate.getIdentifier(), delegate);
1510
			}
1511
			//get all delegates from launch configuration type contributions
1512
			extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES);
1513
			infos = extensionPoint.getConfigurationElements();
1514
			for(int i = 0; i < infos.length; i++) {
1515
				//must check to see if delegate is provided in contribution
1516
				if(infos[i].getAttribute(IConfigurationElementConstants.DELEGATE) != null) {
1517
					delegate = new LaunchDelegate(infos[i]);
1518
					fLaunchDelegates.put(delegate.getIdentifier(), delegate);
1519
				}
1520
			}
1521
		}
1522
	}
1523
	
1313
	/**
1524
	/**
1314
	 * Returns all launch configurations that are stored locally.
1525
	 * Returns all launch configurations that are stored locally.
1315
	 * 
1526
	 * 
Lines 1397-1405 Link Here
1397
			if (Platform.getOS().equals(Constants.OS_WIN32)) {
1608
			if (Platform.getOS().equals(Constants.OS_WIN32)) {
1398
				fgNativeEnv= new HashMap();
1609
				fgNativeEnv= new HashMap();
1399
				Iterator entries = casePreserved.entrySet().iterator();
1610
				Iterator entries = casePreserved.entrySet().iterator();
1611
				Map.Entry entry = null;
1612
				String key = null;
1400
				while (entries.hasNext()) {
1613
				while (entries.hasNext()) {
1401
					Map.Entry entry = (Entry) entries.next();
1614
					entry = (Entry) entries.next();
1402
					String key = ((String)entry.getKey()).toUpperCase();
1615
					key = ((String)entry.getKey()).toUpperCase();
1403
					fgNativeEnv.put(key, entry.getValue());
1616
					fgNativeEnv.put(key, entry.getValue());
1404
				}
1617
				}
1405
			} else {
1618
			} else {
Lines 1425-1434 Link Here
1425
	 */
1638
	 */
1426
	public IProcess[] getProcesses() {
1639
	public IProcess[] getProcesses() {
1427
		synchronized (fLaunches) {
1640
		synchronized (fLaunches) {
1428
			List allProcesses= new ArrayList(fLaunches.size());
1641
			List allProcesses = new ArrayList(fLaunches.size());
1429
			Iterator e= fLaunches.iterator();
1642
			Iterator e = fLaunches.iterator();
1643
			IProcess[] processes = null;
1430
			while (e.hasNext()) {
1644
			while (e.hasNext()) {
1431
				IProcess[] processes= ((ILaunch) e.next()).getProcesses();
1645
				processes = ((ILaunch) e.next()).getProcesses();
1432
				for (int i= 0; i < processes.length; i++) {
1646
				for (int i= 0; i < processes.length; i++) {
1433
					allProcesses.add(processes[i]);
1647
					allProcesses.add(processes[i]);
1434
				}
1648
				}
Lines 1494-1502 Link Here
1494
			IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_COMPARATORS);
1708
			IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_COMPARATORS);
1495
			IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
1709
			IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
1496
			fComparators = new HashMap(infos.length);
1710
			fComparators = new HashMap(infos.length);
1711
			IConfigurationElement configurationElement = null;
1712
			String attr = null;
1497
			for (int i= 0; i < infos.length; i++) {
1713
			for (int i= 0; i < infos.length; i++) {
1498
				IConfigurationElement configurationElement = infos[i];
1714
				configurationElement = infos[i];
1499
				String attr = configurationElement.getAttribute("attribute"); //$NON-NLS-1$			
1715
				attr = configurationElement.getAttribute("attribute"); //$NON-NLS-1$			
1500
				if (attr != null) {
1716
				if (attr != null) {
1501
					fComparators.put(attr, new LaunchConfigurationComparator(configurationElement));
1717
					fComparators.put(attr, new LaunchConfigurationComparator(configurationElement));
1502
				} else {
1718
				} else {
Lines 1508-1539 Link Here
1508
			}
1724
			}
1509
		}
1725
		}
1510
	}
1726
	}
1511
	
1727
1512
	/**
1728
	/**
1513
	 * Initializes contributed launch delegates (i.e. delegates contributed
1729
	 * Initializes the listing of <code>LaunchConfigurationType</code>s.
1514
	 * to an existing launch configuration type).
1515
	 */
1730
	 */
1516
	private synchronized void initializeContributedDelegates() {
1517
		if (fContributedDelegates == null) {
1518
			IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_DELEGATES);
1519
			IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
1520
			fContributedDelegates = new ArrayList(infos.length);
1521
			for (int i= 0; i < infos.length; i++) {		
1522
				fContributedDelegates.add(new ContributedDelegate(infos[i]));
1523
			}
1524
		}
1525
	}
1526
	
1527
	private synchronized void initializeLaunchConfigurationTypes() {
1731
	private synchronized void initializeLaunchConfigurationTypes() {
1528
		if (fLaunchConfigurationTypes == null) {
1732
		if (fLaunchConfigurationTypes == null) {
1529
			hookResourceChangeListener();
1733
			hookResourceChangeListener();
1530
			IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES);
1734
			IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES);
1531
			IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
1735
			IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
1532
			fLaunchConfigurationTypes= new ArrayList(infos.length);
1736
			fLaunchConfigurationTypes = new ArrayList(infos.length);
1533
			for (int i= 0; i < infos.length; i++) {
1737
			for (int i= 0; i < infos.length; i++) {		
1534
				IConfigurationElement configurationElement = infos[i];
1738
				fLaunchConfigurationTypes.add(new LaunchConfigurationType(infos[i]));
1535
				LaunchConfigurationType configType = new LaunchConfigurationType(configurationElement); 			
1536
				fLaunchConfigurationTypes.add(configType);
1537
			}
1739
			}
1538
		}
1740
		}
1539
	}
1741
	}
Lines 1543-1548 Link Here
1543
	 * 
1745
	 * 
1544
	 * @exception CoreException if an exception occurs reading
1746
	 * @exception CoreException if an exception occurs reading
1545
	 *  the extensions
1747
	 *  the extensions
1748
	 *  
1546
	 */
1749
	 */
1547
	private synchronized void initializeLaunchModes() {
1750
	private synchronized void initializeLaunchModes() {
1548
		if (fLaunchModes == null) {
1751
		if (fLaunchModes == null) {
Lines 1559-1584 Link Here
1559
			catch (CoreException e) {DebugPlugin.log(e);}
1762
			catch (CoreException e) {DebugPlugin.log(e);}
1560
		}
1763
		}
1561
	}
1764
	}
1562
1563
	/**
1564
	 * Initializes the listing of registered launch options. Does no work if the mapping is already populated.
1565
	 * @since 3.3  
1566
	 */
1567
	private synchronized void initializeLaunchOptions() {
1568
		if(fLaunchOptions == null) {
1569
			try {
1570
				IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_OPTIONS);
1571
				IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
1572
				fLaunchOptions = new HashMap();
1573
				ILaunchOption option = null;
1574
				for(int i =  0; i < infos.length; i++) {
1575
					option = new LaunchOption(infos[i]);
1576
					fLaunchOptions.put(option.getIdentifier(), option);
1577
				}
1578
			}
1579
			catch(CoreException ce) {DebugPlugin.log(ce);}
1580
		}
1581
	}
1582
	
1765
	
1583
	/**
1766
	/**
1584
	 * Initializes source container type and source path computer extensions.
1767
	 * Initializes source container type and source path computer extensions.
Lines 1615-1623 Link Here
1615
			IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_SOURCE_LOCATORS);
1798
			IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_SOURCE_LOCATORS);
1616
			IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
1799
			IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
1617
			fSourceLocators= new HashMap(infos.length);
1800
			fSourceLocators= new HashMap(infos.length);
1801
			IConfigurationElement configurationElement = null;
1802
			String id = null;
1618
			for (int i= 0; i < infos.length; i++) {
1803
			for (int i= 0; i < infos.length; i++) {
1619
				IConfigurationElement configurationElement = infos[i];
1804
				configurationElement = infos[i];
1620
				String id = configurationElement.getAttribute("id"); //$NON-NLS-1$			
1805
				id = configurationElement.getAttribute("id"); //$NON-NLS-1$			
1621
				if (id != null) {
1806
				if (id != null) {
1622
					fSourceLocators.put(id,configurationElement);
1807
					fSourceLocators.put(id,configurationElement);
1623
				} else {
1808
				} else {
Lines 1812-1819 Link Here
1812
		if (!configs.isEmpty()) {
1997
		if (!configs.isEmpty()) {
1813
			Iterator iterator = configs.iterator();
1998
			Iterator iterator = configs.iterator();
1814
			while (iterator.hasNext()) {
1999
			while (iterator.hasNext()) {
1815
				ILaunchConfiguration configuration = (ILaunchConfiguration)iterator.next();
2000
				launchConfigurationDeleted((ILaunchConfiguration)iterator.next());
1816
				launchConfigurationDeleted(configuration);
1817
			}
2001
			}
1818
		}
2002
		}
1819
		//bug 12134
2003
		//bug 12134
Lines 1832-1839 Link Here
1832
		if (!configs.isEmpty()) {
2016
		if (!configs.isEmpty()) {
1833
			Iterator iterator = configs.iterator();
2017
			Iterator iterator = configs.iterator();
1834
			while (iterator.hasNext()) {
2018
			while (iterator.hasNext()) {
1835
				ILaunchConfiguration config = (ILaunchConfiguration) iterator.next();
2019
				launchConfigurationAdded((ILaunchConfiguration) iterator.next());
1836
				launchConfigurationAdded(config);
1837
			}			
2020
			}			
1838
		}
2021
		}
1839
	}
2022
	}
Lines 1953-1960 Link Here
1953
        fLaunchesListeners = new ListenerList();
2136
        fLaunchesListeners = new ListenerList();
1954
        fLaunchConfigurationListeners = new ListenerList();
2137
        fLaunchConfigurationListeners = new ListenerList();
1955
		ILaunch[] launches = getLaunches();
2138
		ILaunch[] launches = getLaunches();
2139
		ILaunch launch = null;
1956
		for (int i= 0; i < launches.length; i++) {
2140
		for (int i= 0; i < launches.length; i++) {
1957
			ILaunch launch= launches[i];
2141
			launch = launches[i];
1958
			try {
2142
			try {
1959
                if (launch instanceof IDisconnect) {
2143
                if (launch instanceof IDisconnect) {
1960
                    IDisconnect disconnect = (IDisconnect)launch;
2144
                    IDisconnect disconnect = (IDisconnect)launch;
Lines 2014-2021 Link Here
2014
	 */
2198
	 */
2015
	protected void verifyConfigurations(List verify, List valid) {
2199
	protected void verifyConfigurations(List verify, List valid) {
2016
		Iterator configs = verify.iterator();
2200
		Iterator configs = verify.iterator();
2201
		ILaunchConfiguration config = null;
2017
		while (configs.hasNext()) {
2202
		while (configs.hasNext()) {
2018
			ILaunchConfiguration config = (ILaunchConfiguration)configs.next();
2203
			config = (ILaunchConfiguration)configs.next();
2019
			if (isValid(config)) {
2204
			if (isValid(config)) {
2020
				valid.add(config);
2205
				valid.add(config);
2021
			}
2206
			}
(-)core/org/eclipse/debug/internal/core/DebugCoreMessages.java (+2 lines)
Lines 27-32 Link Here
27
	public static String DebugPlugin_1;
27
	public static String DebugPlugin_1;
28
	public static String EnvironmentVariableResolver_0;
28
	public static String EnvironmentVariableResolver_0;
29
29
30
	public static String LaunchConfigurationInfo_35;
31
30
	public static String LaunchOption_0;
32
	public static String LaunchOption_0;
31
	public static String SystemPropertyResolver_0;	
33
	public static String SystemPropertyResolver_0;	
32
	public static String InputStreamMonitor_label;
34
	public static String InputStreamMonitor_label;
(-)core/org/eclipse/debug/internal/core/LaunchConfiguration.java (-6 / +62 lines)
Lines 13-22 Link Here
13
 
13
 
14
import java.io.IOException;
14
import java.io.IOException;
15
import java.io.StringReader;
15
import java.io.StringReader;
16
import com.ibm.icu.text.MessageFormat;
17
import java.util.ArrayList;
16
import java.util.ArrayList;
17
import java.util.HashSet;
18
import java.util.List;
18
import java.util.List;
19
import java.util.Map;
19
import java.util.Map;
20
import java.util.Set;
20
21
21
import javax.xml.parsers.DocumentBuilder;
22
import javax.xml.parsers.DocumentBuilder;
22
import javax.xml.parsers.DocumentBuilderFactory;
23
import javax.xml.parsers.DocumentBuilderFactory;
Lines 44-49 Link Here
44
import org.eclipse.debug.core.ILaunchConfiguration;
45
import org.eclipse.debug.core.ILaunchConfiguration;
45
import org.eclipse.debug.core.ILaunchConfigurationType;
46
import org.eclipse.debug.core.ILaunchConfigurationType;
46
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
47
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
48
import org.eclipse.debug.core.IStatusHandler;
47
import org.eclipse.debug.core.Launch;
49
import org.eclipse.debug.core.Launch;
48
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
50
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
49
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate2;
51
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate2;
Lines 55-60 Link Here
55
import org.xml.sax.SAXException;
57
import org.xml.sax.SAXException;
56
import org.xml.sax.helpers.DefaultHandler;
58
import org.xml.sax.helpers.DefaultHandler;
57
59
60
import com.ibm.icu.text.MessageFormat;
61
58
/**
62
/**
59
 * Launch configuration handle.
63
 * Launch configuration handle.
60
 * 
64
 * 
Lines 82-87 Link Here
82
	public static final String ATTR_MAPPED_RESOURCE_TYPES = DebugPlugin.getUniqueIdentifier() + ".MAPPED_RESOURCE_TYPES"; //$NON-NLS-1$
86
	public static final String ATTR_MAPPED_RESOURCE_TYPES = DebugPlugin.getUniqueIdentifier() + ".MAPPED_RESOURCE_TYPES"; //$NON-NLS-1$
83
	
87
	
84
	/**
88
	/**
89
	 * The listing of applicable launch options for this configuration.
90
	 * 
91
	 * <p>
92
	 * <strong>EXPERIMENTAL</strong>. This class has been added as
93
	 * part of a work in progress. There is no guarantee that this API will
94
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
95
	 * without consulting with the Platform/Debug team.
96
	 * </p>
97
	 * @since 3.3
98
	 */
99
	public static final String ATTR_LAUNCH_OPTIONS = DebugPlugin.getUniqueIdentifier() + ".LAUNCH_OPTIONS"; //$NON-NLS-1$
100
	
101
	/**
102
	 * Status handler to prompt in the UI thread
103
	 * 
104
	 * @since 3.3
105
	 */
106
	protected static final IStatus promptStatus = new Status(IStatus.INFO, "org.eclipse.debug.ui", 200, "", null);  //$NON-NLS-1$//$NON-NLS-2$
107
	
108
	/**
109
	 * Status handler to prompt the user to resolve the missing launch delegate issue
110
	 * @since 3.3
111
	 */
112
	protected static final IStatus delegateNotAvailable = new Status(IStatus.INFO, "org.eclipse.debug.core", 226, "", null); //$NON-NLS-1$ //$NON-NLS-2$
113
	
114
	/**
85
	 * Location this configuration is stored in. This 
115
	 * Location this configuration is stored in. This 
86
	 * is the key for a launch configuration handle.
116
	 * is the key for a launch configuration handle.
87
	 */
117
	 */
Lines 271-276 Link Here
271
		return getInfo().getListAttribute(attributeName, defaultValue);
301
		return getInfo().getListAttribute(attributeName, defaultValue);
272
	}
302
	}
273
303
304
	/**
305
	 * @see org.eclipse.debug.core.ILaunchConfiguration#getAttribute(java.lang.String, java.util.Set)
306
	 */
307
	public Set getAttribute(String attributeName, Set defaultValue) throws CoreException {
308
		return getInfo().getSetAttribute(attributeName, defaultValue);
309
	}
310
	
274
	/* (non-Javadoc)
311
	/* (non-Javadoc)
275
	 * @see org.eclipse.debug.core.ILaunchConfiguration#getAttribute(java.lang.String, java.util.Map)
312
	 * @see org.eclipse.debug.core.ILaunchConfiguration#getAttribute(java.lang.String, java.util.Map)
276
	 */
313
	 */
Lines 320-333 Link Here
320
	/**
357
	/**
321
	 * Returns the launch configuration delegate for this
358
	 * Returns the launch configuration delegate for this
322
	 * launch configuration, for the specified launch mode.
359
	 * launch configuration, for the specified launch mode.
323
	 * 
324
	 * @param mode launch mode
360
	 * @param mode launch mode
325
	 * @return launch configuration delegate
361
	 * @return launch configuration delegate
326
	 * @exception CoreException if the delegate was unable
362
	 * @exception CoreException if the delegate was unable
327
	 *  to be created
363
	 *  to be created
328
	 */
364
	 */
329
	protected ILaunchConfigurationDelegate getDelegate(String mode) throws CoreException {
365
	protected ILaunchConfigurationDelegate getDelegate(String mode, String[] options) throws CoreException {
330
		return getType().getDelegate(mode);
366
		return getType().getDelegate(mode, options);
331
	}
367
	}
332
368
333
	/* (non-Javadoc)
369
	/* (non-Javadoc)
Lines 480-485 Link Here
480
		return getLastLocationSegment();
516
		return getLastLocationSegment();
481
	}
517
	}
482
518
519
	/**
520
	 * @see org.eclipse.debug.core.ILaunchConfiguration#getOptions()
521
	 */
522
	public Set getOptions() throws CoreException {
523
		Set options = getAttribute(ATTR_LAUNCH_OPTIONS, (Set)null); 
524
		return (options != null ? new HashSet(options) : new HashSet(0));
525
	}
526
	
483
	/* (non-Javadoc)
527
	/* (non-Javadoc)
484
	 * @see org.eclipse.debug.core.ILaunchConfiguration#getType()
528
	 * @see org.eclipse.debug.core.ILaunchConfiguration#getType()
485
	 */
529
	 */
Lines 570-576 Link Here
570
     */
614
     */
571
    public ILaunch launch(String mode, IProgressMonitor monitor, boolean build, boolean register) throws CoreException {
615
    public ILaunch launch(String mode, IProgressMonitor monitor, boolean build, boolean register) throws CoreException {
572
		// bug 28245 - force the delegate to load in case it is interested in launch notifications
616
		// bug 28245 - force the delegate to load in case it is interested in launch notifications
573
		ILaunchConfigurationDelegate delegate= getDelegate(mode);
617
    	ILaunchConfigurationDelegate delegate = null;
618
    	Set options = getOptions();
619
    	try {
620
    		delegate = getDelegate(mode, (String[]) options.toArray(new String[options.size()]));
621
    	}
622
    	catch(CoreException ce) {
623
    		IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler(promptStatus);
624
    		handler.handleStatus(delegateNotAvailable, new Object[] {this, mode});
625
    		
626
    		//retry once the problem has been fixed
627
    		options = getOptions();
628
    		delegate = getDelegate(mode, (String[]) options.toArray(new String[options.size()]));
629
    	}
574
		ILaunchConfigurationDelegate2 delegate2 = null;
630
		ILaunchConfigurationDelegate2 delegate2 = null;
575
		if (delegate instanceof ILaunchConfigurationDelegate2) {
631
		if (delegate instanceof ILaunchConfigurationDelegate2) {
576
			delegate2 = (ILaunchConfigurationDelegate2) delegate;
632
			delegate2 = (ILaunchConfigurationDelegate2) delegate;
Lines 690-694 Link Here
690
		return getType().supportsMode(mode);
746
		return getType().supportsMode(mode);
691
	}
747
	}
692
	
748
	
693
}//end class
749
}
694
750
(-)core/org/eclipse/debug/internal/core/LaunchConfigurationWorkingCopy.java (-8 / +72 lines)
Lines 16-25 Link Here
16
import java.io.FileOutputStream;
16
import java.io.FileOutputStream;
17
import java.io.IOException;
17
import java.io.IOException;
18
import java.io.UnsupportedEncodingException;
18
import java.io.UnsupportedEncodingException;
19
import com.ibm.icu.text.MessageFormat;
20
import java.util.ArrayList;
19
import java.util.ArrayList;
21
import java.util.List;
20
import java.util.List;
22
import java.util.Map;
21
import java.util.Map;
22
import java.util.Set;
23
23
24
import javax.xml.parsers.ParserConfigurationException;
24
import javax.xml.parsers.ParserConfigurationException;
25
import javax.xml.transform.TransformerException;
25
import javax.xml.transform.TransformerException;
Lines 40-45 Link Here
40
import org.eclipse.debug.core.ILaunchConfigurationType;
40
import org.eclipse.debug.core.ILaunchConfigurationType;
41
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
41
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
42
42
43
import com.ibm.icu.text.MessageFormat;
44
43
/**
45
/**
44
 * A working copy launch configuration
46
 * A working copy launch configuration
45
 */
47
 */
Lines 194-200 Link Here
194
		}
196
		}
195
		// write the new file
197
		// write the new file
196
		writeNewFile();
198
		writeNewFile();
197
		resetDirty();
199
		fDirty = false;
198
	}
200
	}
199
201
200
	/**
202
	/**
Lines 350-356 Link Here
350
		LaunchConfigurationInfo info = original.getInfo();
352
		LaunchConfigurationInfo info = original.getInfo();
351
		setInfo(info.getCopy());
353
		setInfo(info.getCopy());
352
		setContainer(original.getContainer());
354
		setContainer(original.getContainer());
353
		resetDirty();
355
		fDirty = false;
354
	}
356
	}
355
	
357
	
356
	/**
358
	/**
Lines 404-416 Link Here
404
	}
406
	}
405
	
407
	
406
	/**
408
	/**
407
	 * Sets this working copy's state to not dirty.
409
	 * @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#setOptions(java.lang.String[])
408
	 */
410
	 */
409
	private void resetDirty() {
411
	public void addOption(String option) {
410
		fDirty = false;
412
		try {
413
			Set options = getOptions();
414
			if(option != null && !options.contains(option)) {
415
				options.add(option);
416
				getInfo().setAttribute(ATTR_LAUNCH_OPTIONS, options);
417
				setDirty();
418
			}
419
		} 
420
		catch (CoreException e) {DebugPlugin.log(e);}
411
	}	
421
	}	
412
		
422
		
413
	/**
423
	/**
424
	 * @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#removeOption(java.lang.String)
425
	 */
426
	public void removeOption(String option) {
427
		try {
428
			Set options = getOptions();
429
			if(options.remove(option)) {
430
				getInfo().setAttribute(ATTR_LAUNCH_OPTIONS, options);
431
				setDirty();
432
			}
433
		} 
434
		catch (CoreException e) {DebugPlugin.log(e);}
435
	}
436
	
437
	/**
438
	 * @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#setOptions(java.util.List)
439
	 */
440
	public void setOptions(Set options) {
441
		getInfo().setAttribute(ATTR_LAUNCH_OPTIONS, (options.size() > 0 ? options : null));
442
		setDirty();
443
	}
444
445
	/**
446
	 * @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#addOptions(java.util.Set)
447
	 */
448
	public void addOptions(Set options) {
449
		try {
450
			Set opts = getOptions();
451
			if(opts.addAll(options)) {
452
				getInfo().setAttribute(ATTR_LAUNCH_OPTIONS, opts);
453
				setDirty();
454
			}
455
		} 
456
		catch (CoreException e) {
457
			DebugPlugin.log(e);
458
		}
459
	}
460
	
461
	/**
462
	 * @see org.eclipse.debug.core.ILaunchConfigurationWorkingCopy#removeOptions(java.util.Set)
463
	 */
464
	public void removeOptions(Set options) {
465
		try {
466
			Set opts = getOptions();
467
			if(opts.removeAll(options)) {
468
				getInfo().setAttribute(ATTR_LAUNCH_OPTIONS, opts);
469
				setDirty();
470
			}
471
		} 
472
		catch (CoreException e) {
473
			DebugPlugin.log(e);
474
		}
475
	}
476
	
477
	/**
414
	 * @see ILaunchConfigurationWorkingCopy#rename(String)
478
	 * @see ILaunchConfigurationWorkingCopy#rename(String)
415
	 */
479
	 */
416
	public void rename(String name) {
480
	public void rename(String name) {
Lines 574-580 Link Here
574
		}
638
		}
575
		setAttribute(LaunchConfiguration.ATTR_MAPPED_RESOURCE_PATHS, paths);
639
		setAttribute(LaunchConfiguration.ATTR_MAPPED_RESOURCE_PATHS, paths);
576
		setAttribute(LaunchConfiguration.ATTR_MAPPED_RESOURCE_TYPES, types);
640
		setAttribute(LaunchConfiguration.ATTR_MAPPED_RESOURCE_TYPES, types);
577
	}//end setResource
641
	}
578
642
579
}//end class
643
}
580
644
(-)core/org/eclipse/debug/internal/core/LaunchOption.java (-51 / +3 lines)
Lines 10-35 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.debug.internal.core;
11
package org.eclipse.debug.internal.core;
12
12
13
import org.eclipse.core.runtime.CoreException;
14
import org.eclipse.core.runtime.IConfigurationElement;
13
import org.eclipse.core.runtime.IConfigurationElement;
15
import org.eclipse.core.runtime.IStatus;
16
import org.eclipse.core.runtime.Status;
17
import org.eclipse.debug.core.DebugPlugin;
18
import org.eclipse.debug.core.ILaunchOption;
14
import org.eclipse.debug.core.ILaunchOption;
19
15
20
import com.ibm.icu.text.MessageFormat;
21
22
/**
16
/**
23
 * Proxy to a launch option extension
17
 * Proxy to a launch option extension
24
 * 
18
 * 
25
 * @since 3.3
19
 * @since 3.3
26
 */
20
 */
27
public class LaunchOption implements ILaunchOption {
21
public class LaunchOption implements ILaunchOption {
28
29
	//constants for attribute names
30
	private static final String ID = "id"; //$NON-NLS-1$
31
	private static final String LABEL = "label"; //$NON-NLS-1$
32
	private static final String OPTION = "option"; //$NON-NLS-1$
33
	
22
	
34
	/**
23
	/**
35
	 * The associated configuration element
24
	 * The associated configuration element
Lines 40-97 Link Here
40
	 * Constructor
29
	 * Constructor
41
	 * @param element the element to associate this launch option with
30
	 * @param element the element to associate this launch option with
42
	 */
31
	 */
43
	public LaunchOption(IConfigurationElement element) throws CoreException {
32
	public LaunchOption(IConfigurationElement element) {
44
		fElement = element;
33
		fElement = element;
45
		verifyAttributesExist();
46
	}
34
	}
47
	
35
	
48
	/* (non-Javadoc)
36
	/* (non-Javadoc)
49
	 * @see org.eclipse.debug.core.ILaunchOption#getIdentifier()
37
	 * @see org.eclipse.debug.core.ILaunchOption#getIdentifier()
50
	 */
38
	 */
51
	public String getIdentifier() {
39
	public String getIdentifier() {
52
		return fElement.getAttribute(ID);
40
		return fElement.getAttribute(IConfigurationElementConstants.ID);
53
	}
41
	}
54
42
55
	/* (non-Javadoc)
43
	/* (non-Javadoc)
56
	 * @see org.eclipse.debug.core.ILaunchOption#getLabel()
44
	 * @see org.eclipse.debug.core.ILaunchOption#getLabel()
57
	 */
45
	 */
58
	public String getLabel() {
46
	public String getLabel() {
59
		return fElement.getAttribute(LABEL);
47
		return fElement.getAttribute(IConfigurationElementConstants.LABEL);
60
	}
61
62
	/* (non-Javadoc)
63
	 * @see org.eclipse.debug.core.ILaunchOption#getOption()
64
	 */
65
	public String getOption() {
66
		return fElement.getAttribute(OPTION);
67
	}
68
	
69
	/**
70
	 * Checks to ensure that all of the required attributes are present in the <code>IConfigurationElement</code>
71
	 * @return true if all attributes are present, throws <code>CoreException</code> otherwise
72
	 * @throws CoreException
73
	 */
74
	private void verifyAttributesExist() throws CoreException {
75
		if(fElement != null) {
76
			if(fElement.getAttribute(ID) == null) {
77
				missingAttribute(ID);
78
			}
79
			if(fElement.getAttribute(LABEL) == null) {
80
				missingAttribute(LABEL);
81
			}
82
			if(fElement.getAttribute(OPTION) == null) {
83
				missingAttribute(OPTION);
84
			}
85
		}
86
	}
87
	
88
	/**
89
	 * Throws a <code>CoreException</code> indicating the specified attribute is missing from the extension
90
	 * point definition
91
	 * @param attrName the attribute name that is missing
92
	 * @throws CoreException
93
	 */
94
	private void missingAttribute(String attrName) throws CoreException {
95
		throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.LaunchOption_0, new String[]{attrName}), null));		 
96
	}
48
	}
97
}
49
}
(-)core/org/eclipse/debug/internal/core/ContributedDelegate.java (-145 lines)
Removed Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.debug.internal.core;
12
13
import com.ibm.icu.text.MessageFormat;
14
import java.util.HashSet;
15
import java.util.Set;
16
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.core.runtime.IConfigurationElement;
18
import org.eclipse.core.runtime.IStatus;
19
import org.eclipse.core.runtime.Status;
20
import org.eclipse.debug.core.DebugPlugin;
21
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
22
23
/**
24
 * A placeholder for a launch delegate contributed for a launch mode for an
25
 * existing launch configuration type.
26
 */
27
public class ContributedDelegate {
28
29
	/**
30
	 * The configuration element of the extension.
31
	 */
32
	private IConfigurationElement fElement;
33
	
34
	/**
35
	 * Modes this delegate supports.
36
	 */
37
	private Set fModes;
38
	
39
	/**
40
	 * Delegate, or <code>null</code> if not yet instantiated.
41
	 */
42
	private ILaunchConfigurationDelegate fDelegate;
43
	
44
	/**
45
	 * Constructs a new contributed delegate on the
46
	 * given configuration element.
47
	 * 
48
	 * @param element configuration element
49
	 */
50
	protected ContributedDelegate(IConfigurationElement element) {
51
		setConfigurationElement(element);
52
	}
53
	
54
	/**
55
	 * Sets this delegate's configuration element.
56
	 * 
57
	 * @param element this delegate's configuration element
58
	 */
59
	private void setConfigurationElement(IConfigurationElement element) {
60
		fElement = element;
61
	}
62
	
63
	/**
64
	 * Returns this delegate's configuration element.
65
	 * 
66
	 * @return this delegate's configuration element
67
	 */
68
	protected IConfigurationElement getConfigurationElement() {
69
		return fElement;
70
	}	
71
	
72
	/**
73
	 * Returns the set of modes specified in the configuration data.
74
	 * 
75
	 * @return the set of modes specified in the configuration data
76
	 */
77
	protected Set getModes() {
78
		if (fModes == null) {
79
			String modes= getConfigurationElement().getAttribute("modes"); //$NON-NLS-1$
80
			if (modes == null) {
81
				return new HashSet(0);
82
			}
83
			String[] strings = modes.split(","); //$NON-NLS-1$
84
			fModes = new HashSet(3);
85
			for (int i = 0; i < strings.length; i++) {
86
				String string = strings[i];
87
				fModes.add(string.trim());
88
			}
89
		}
90
		return fModes;
91
	}
92
	
93
	/**
94
	 * Returns the type identifier of launch configuration type this delegate is
95
	 * contributed to.
96
	 */
97
	protected String getLaunchConfigurationType() {
98
		return getConfigurationElement().getAttribute("type"); //$NON-NLS-1$
99
	}
100
	
101
	protected ILaunchConfigurationDelegate getDelegate() throws CoreException {
102
		if (fDelegate == null) {
103
			Object object = getConfigurationElement().createExecutableExtension("delegate"); //$NON-NLS-1$
104
			if (object instanceof ILaunchConfigurationDelegate) {
105
				fDelegate = (ILaunchConfigurationDelegate)object;
106
			} else {
107
				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)); 
108
			}		
109
		}
110
		return fDelegate;
111
	}
112
	
113
	/**
114
	 * Returns the identifier of this extension point.
115
	 */
116
	protected String getIdentifier() {
117
		return getConfigurationElement().getAttribute("id"); //$NON-NLS-1$
118
	}	
119
	
120
	/**
121
	 * Returns the source path computer id specified by this launch delegate 
122
	 * or <code>null</code> if none.
123
	 * 
124
	 * @return the source path computer id specified by this launch delegate 
125
	 * or <code>null</code> if none
126
	 * 
127
	 * @since 3.1
128
	 */
129
	protected String getSourcePathComputerId() {
130
		return getConfigurationElement().getAttribute("sourcePathComputerId"); //$NON-NLS-1$
131
	}
132
	
133
	/**
134
	 * Returns the source locater id specified by this launch delegate 
135
	 * or <code>null</code> if none.
136
	 * 
137
	 * @return the source locater id specified by this launch delegate 
138
	 * or <code>null</code> if none
139
	 * 
140
	 * @since 3.1
141
	 */
142
	protected String getSourceLocaterId() {
143
		return getConfigurationElement().getAttribute("sourceLocatorId"); //$NON-NLS-1$
144
	}
145
}
(-)core/org/eclipse/debug/internal/core/LaunchConfigurationType.java (-151 / +131 lines)
Lines 11-24 Link Here
11
package org.eclipse.debug.internal.core;
11
package org.eclipse.debug.internal.core;
12
12
13
 
13
 
14
import com.ibm.icu.text.MessageFormat;
15
import java.util.HashSet;
14
import java.util.HashSet;
16
import java.util.Hashtable;
15
import java.util.Hashtable;
17
import java.util.Iterator;
18
import java.util.List;
19
import java.util.Map;
16
import java.util.Map;
20
import java.util.Set;
17
import java.util.Set;
21
import java.util.StringTokenizer;
18
22
import org.eclipse.core.resources.IContainer;
19
import org.eclipse.core.resources.IContainer;
23
import org.eclipse.core.runtime.CoreException;
20
import org.eclipse.core.runtime.CoreException;
24
import org.eclipse.core.runtime.IConfigurationElement;
21
import org.eclipse.core.runtime.IConfigurationElement;
Lines 34-39 Link Here
34
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
31
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
35
import org.eclipse.debug.core.sourcelookup.ISourcePathComputer;
32
import org.eclipse.debug.core.sourcelookup.ISourcePathComputer;
36
33
34
import com.ibm.icu.text.MessageFormat;
35
37
/**
36
/**
38
 * A launch configuration type wrappers a configuration
37
 * A launch configuration type wrappers a configuration
39
 * element for a <code>launchConfigurationType</code>
38
 * element for a <code>launchConfigurationType</code>
Lines 41-71 Link Here
41
 */
40
 */
42
public class LaunchConfigurationType extends PlatformObject implements ILaunchConfigurationType {
41
public class LaunchConfigurationType extends PlatformObject implements ILaunchConfigurationType {
43
	
42
	
44
	private static String MIGRATION_DELEGATE = "migrationDelegate";  //$NON-NLS-1$
45
	
46
	/**
43
	/**
47
	 * The configuration element of the extension.
44
	 * The configuration element of the extension.
48
	 */
45
	 */
49
	private IConfigurationElement fElement;
46
	private IConfigurationElement fElement;
50
	
47
	
51
	/**
48
	/**
52
	 * Base modes this type supports.
49
	 *  a listing of modes contributed to this launch configuration type
50
	 *  @since 3.3
51
	 *  
52
	 *  <p>
53
	 * <strong>EXPERIMENTAL</strong>. This field has been added as
54
	 * part of a work in progress. There is no guarantee that this API will
55
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
56
	 * without consulting with the Platform/Debug team.
57
	 * </p>
58
	 */
59
	private Set fModes = null;
60
	
61
	/**
62
	 * the default source path computer for this config type
63
	 * @since 3.3
64
	 * 
65
	 * <p>
66
	 * <strong>EXPERIMENTAL</strong>. This field has been added as
67
	 * part of a work in progress. There is no guarantee that this API will
68
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
69
	 * without consulting with the Platform/Debug team.
70
	 * </p>
53
	 */
71
	 */
54
	private Set fBaseModes;
72
	private ISourcePathComputer fSourcePathComputer = null;
55
	
73
	
56
	/**
74
	/**
57
	 * Modes that delegates have been contributed for
75
	 * The source locator id for this config type
58
	 */
76
	 */
59
	private Set fContributedModes;
77
	private String fSourceLocator = null;
60
	
78
	
61
	/**
79
	/**
62
	 * The delegates for launch configurations of this type.
80
	 * The delegates for launch configurations of this type.
63
	 * Delegates are instantiated lazily as required. There may
81
	 * Delegates are instantiated lazily as required. There may
64
	 * be different delegates for different modes (since 3.0).
82
	 * be different delegates for different modes (since 3.0).
65
	 * Map of mode -> delegate
83
	 * Map of mode to delegate
66
	 */
84
	 */
67
	private Map fDelegates;
85
	private Map fDelegates;
68
	
86
	
87
	private LaunchDelegate fSourceProvider;
88
	
69
	/**
89
	/**
70
	 * Constructs a new launch configuration type on the
90
	 * Constructs a new launch configuration type on the
71
	 * given configuration element.
91
	 * given configuration element.
Lines 73-155 Link Here
73
	 * @param element configuration element
93
	 * @param element configuration element
74
	 */
94
	 */
75
	protected LaunchConfigurationType(IConfigurationElement element) {
95
	protected LaunchConfigurationType(IConfigurationElement element) {
76
		setConfigurationElement(element);
96
		fElement = element;
77
	}
97
	}
78
	
98
	
79
	/* (non-Javadoc)
99
	/* (non-Javadoc)
80
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getAttribute(java.lang.String)
100
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getAttribute(java.lang.String)
81
	 */
101
	 */
82
	public String getAttribute(String attributeName) {
102
	public String getAttribute(String attributeName) {
83
		return getConfigurationElement().getAttribute(attributeName);
103
		return fElement.getAttribute(attributeName);
84
	}
104
	}
85
	
86
	/**
87
	 * Returns the set of modes specified in the configuration data.
88
	 * 
89
	 * @return the set of modes specified in the configuration data
90
	 */
91
	protected Set getBaseModes() {
92
		if (fBaseModes == null) {
93
			String modes= getConfigurationElement().getAttribute("modes"); //$NON-NLS-1$
94
			if (modes == null) {
95
				return new HashSet(0);
96
			}
97
			StringTokenizer tokenizer= new StringTokenizer(modes, ","); //$NON-NLS-1$
98
			fBaseModes = new HashSet(tokenizer.countTokens());
99
			while (tokenizer.hasMoreTokens()) {
100
				fBaseModes.add(tokenizer.nextToken().trim());
101
			}
102
		}
103
		return fBaseModes;
104
	}	
105
105
106
	/* (non-Javadoc)
106
	/* (non-Javadoc)
107
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getCategory()
107
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getCategory()
108
	 */
108
	 */
109
	public String getCategory() {
109
	public String getCategory() {
110
		return getConfigurationElement().getAttribute("category"); //$NON-NLS-1$
110
		return fElement.getAttribute(IConfigurationElementConstants.CATEGORY);
111
	}
112
113
	/**
114
	 * Returns this type's configuration element.
115
	 * 
116
	 * @return this type's configuration element
117
	 */
118
	protected IConfigurationElement getConfigurationElement() {
119
		return fElement;
120
	}
121
	
122
	/**
123
	 * Returns the set of modes delegates have been contributed for
124
	 * 
125
	 * @return the set of modes delegates have been contributed for
126
	 */
127
	protected Set getContributedModes() {
128
		if (fContributedModes == null) {
129
			fContributedModes = new HashSet(0);
130
			// add modes for contributed delegates
131
			List delegates = ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).getContributedDelegates();
132
			Iterator iterator = delegates.iterator();
133
			while (iterator.hasNext()) {
134
				ContributedDelegate delegate = (ContributedDelegate)iterator.next();
135
				if (delegate.getLaunchConfigurationType().equals(getIdentifier())) {
136
					fContributedModes.addAll(delegate.getModes());
137
				}
138
			}
139
		}
140
		return fContributedModes;
141
	}
111
	}
142
	
112
	
143
	/**
113
	/**
144
	 * Returns the launch configuration delegate for launch
145
	 * configurations of this type. The first time this method
146
	 * is called, the delegate is instantiated.
147
	 * 
148
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getDelegate()
114
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getDelegate()
149
	 * @return launch configuration delegate
150
	 * @exception CoreException if unable to instantiate the
151
	 *  delegate
152
	 * @deprecated use <code>getDelegate(String)</code> to specify mode
153
	 */
115
	 */
154
	public ILaunchConfigurationDelegate getDelegate() throws CoreException {
116
	public ILaunchConfigurationDelegate getDelegate() throws CoreException {
155
		return getDelegate(ILaunchManager.RUN_MODE);
117
		return getDelegate(ILaunchManager.RUN_MODE);
Lines 159-220 Link Here
159
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getDelegate(java.lang.String)
121
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getDelegate(java.lang.String)
160
	 */
122
	 */
161
	public ILaunchConfigurationDelegate getDelegate(String mode) throws CoreException {
123
	public ILaunchConfigurationDelegate getDelegate(String mode) throws CoreException {
124
		return getDelegate(mode, null); 
125
	}
126
	
127
	/**
128
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getDelegate(java.lang.String, java.lang.String[])
129
	 */
130
	public ILaunchConfigurationDelegate getDelegate(String mode, String[] options) throws CoreException {
162
		if (!supportsMode(mode)) {
131
		if (!supportsMode(mode)) {
163
			throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.LaunchConfigurationType_9, new String[] {mode, getIdentifier()}), null));  
132
			throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.LaunchConfigurationType_9, new String[] {mode, getIdentifier()}), null));  
164
		}
133
		}
165
		if (fDelegates == null) {
134
		if (fDelegates == null) {
166
			// initialize delegate table with base modes
135
			// initialize delegate table with base modes
167
			fDelegates = new Hashtable(3);
136
			fDelegates = new Hashtable();
168
		}
137
		}
169
		ILaunchConfigurationDelegate delegate = (ILaunchConfigurationDelegate)fDelegates.get(mode);
138
		ILaunchConfigurationDelegate delegate = (ILaunchConfigurationDelegate)fDelegates.get(mode);
170
		if (delegate == null) {
139
		if (delegate == null) {
171
			Set modes = getBaseModes();
140
			if(fModes.contains(mode)) {
172
			if (modes.contains(mode)) {
141
				LaunchDelegate[] delegates = ((LaunchManager) DebugPlugin.getDefault().getLaunchManager()).getLaunchDelegates(getIdentifier(), mode, options);
173
				Object object = getConfigurationElement().createExecutableExtension("delegate"); //$NON-NLS-1$
142
				if(delegates.length > 0) {
174
				if (object instanceof ILaunchConfigurationDelegate) {
143
					return delegates[0].getDelegate();
175
					Iterator iter = modes.iterator();
176
					while (iter.hasNext()) {
177
						fDelegates.put(iter.next(), object);
178
					}
179
					return (ILaunchConfigurationDelegate)object;
180
				} 
181
				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)); 
182
			} 
183
			// contributed modes
184
			List contributed = ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).getContributedDelegates();
185
			Iterator iterator = contributed.iterator();
186
			while (iterator.hasNext()) {
187
				ContributedDelegate contributedDelegate = (ContributedDelegate)iterator.next();
188
				if (getIdentifier().equals(contributedDelegate.getLaunchConfigurationType())) {
189
					modes = contributedDelegate.getModes();
190
					if (modes.contains(mode)) {
191
						delegate = contributedDelegate.getDelegate();
192
						Iterator modesIterator = modes.iterator();
193
						while (modesIterator.hasNext()) {
194
							fDelegates.put(modesIterator.next(), delegate); 
195
						}
196
						return delegate;
197
					}
198
				}
144
				}
199
			}
145
			}
200
		} else {
146
		} 
147
		else {
201
			return delegate;
148
			return delegate;
202
		}
149
		}
203
		throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.LaunchConfigurationType_10, new String[] {getIdentifier(), mode}), null)); 
150
		throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.LaunchConfigurationType_10, new String[] {getIdentifier(), mode}), null));
204
	}
151
	}
205
152
206
	/* (non-Javadoc)
153
	/* (non-Javadoc)
207
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getIdentifier()
154
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getIdentifier()
208
	 */
155
	 */
209
	public String getIdentifier() {
156
	public String getIdentifier() {
210
		return getConfigurationElement().getAttribute("id"); //$NON-NLS-1$
157
		return fElement.getAttribute(IConfigurationElementConstants.ID);
211
	}
158
	}
212
159
213
	/* (non-Javadoc)
160
	/* (non-Javadoc)
214
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getName()
161
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getName()
215
	 */
162
	 */
216
	public String getName() {
163
	public String getName() {
217
		return getConfigurationElement().getAttribute("name"); //$NON-NLS-1$
164
		return fElement.getAttribute(IConfigurationElementConstants.NAME);
218
	}
165
	}
219
166
220
	/* (non-Javadoc)
167
	/* (non-Javadoc)
Lines 228-277 Link Here
228
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getSourceLocatorId()
175
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getSourceLocatorId()
229
	 */
176
	 */
230
	public String getSourceLocatorId() {
177
	public String getSourceLocatorId() {
231
		String id = getAttribute("sourceLocatorId"); //$NON-NLS-1$
178
		if(fSourceLocator == null) {
232
		if (id == null) {
179
			fSourceLocator = getAttribute(IConfigurationElementConstants.SOURCE_LOCATOR);
233
			// check for specification by mode specific delegate
180
			//see if the cached source provider knows about it
234
			List delegates = ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).getContributedDelegates();
181
			if(fSourceProvider != null) {
235
			Iterator iterator = delegates.iterator();
182
				fSourceLocator = fSourceProvider.getSourceLocatorId();
236
			while (iterator.hasNext() && id == null) {
183
			}
237
				ContributedDelegate delegate = (ContributedDelegate)iterator.next();
184
			//if not provided check all the applicable delegates for one and record the delegate if found,
238
				if (delegate.getLaunchConfigurationType().equals(getIdentifier())) {
185
			//so it can be reused to try and find the source path computer
239
					id = delegate.getSourceLocaterId();
186
			if(fSourceLocator == null) {
187
				LaunchDelegate[] delegates = ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).getLaunchDelegates(getIdentifier());
188
				for(int i = 0; i < delegates.length; i++) {
189
					fSourceLocator = delegates[i].getSourceLocatorId();
190
					if(fSourceLocator != null) {
191
						fSourceProvider = delegates[i];
192
						return fSourceLocator;
193
					}
240
				}
194
				}
195
				fSourceProvider = null;
241
			}
196
			}
242
		}
197
		}
243
		return id;
198
		return fSourceLocator;
244
	}	
199
	}	
245
200
246
	/* (non-Javadoc)
201
	/* (non-Javadoc)
247
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getSourcePathComputer()
202
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getSourcePathComputer()
248
	 */
203
	 */
249
	public ISourcePathComputer getSourcePathComputer() {
204
	public ISourcePathComputer getSourcePathComputer() {
250
		String id = getConfigurationElement().getAttribute("sourcePathComputerId"); //$NON-NLS-1$
205
		if(fSourcePathComputer == null) {
251
		if (id == null) {
206
			//get the id
252
			// check for specification by mode specific delegate
207
			String id = fElement.getAttribute(IConfigurationElementConstants.SOURCE_PATH_COMPUTER);
253
			List delegates = ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).getContributedDelegates();
208
			//ask if the source provider knows about it
254
			Iterator iterator = delegates.iterator();
209
			if(fSourceProvider != null) {
255
			while (iterator.hasNext() && id == null) {
210
				id = fSourceProvider.getSourcePathComputerId();
256
				ContributedDelegate delegate = (ContributedDelegate)iterator.next();
211
			}
257
				if (delegate.getLaunchConfigurationType().equals(getIdentifier())) {
212
			if(id != null) {
258
					id = delegate.getSourcePathComputerId();
213
				fSourcePathComputer = DebugPlugin.getDefault().getLaunchManager().getSourcePathComputer(id);
214
			}
215
			else { 
216
			//if not provided check all the applicable delegates for one and record the delegate if found,
217
			//so it can be reused to try and find the source path computer
218
				LaunchDelegate[] delegates = ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).getLaunchDelegates(getIdentifier());
219
				for(int i = 0; i < delegates.length; i++) {
220
					id = delegates[i].getSourcePathComputerId();
221
					if(id != null) {
222
						fSourceProvider = delegates[i];
223
						fSourcePathComputer = DebugPlugin.getDefault().getLaunchManager().getSourcePathComputer(id);
224
						if(fSourcePathComputer != null) {
225
							return fSourcePathComputer;
226
						}
227
					}
259
				}
228
				}
229
				fSourceProvider = null;
260
			}
230
			}
231
			
261
		}
232
		}
262
		if (id != null && id.length() > 0) {
233
		return fSourcePathComputer;
263
			return DebugPlugin.getDefault().getLaunchManager().getSourcePathComputer(id);
264
		}
265
		return null;
266
	}
234
	}
267
235
268
	/* (non-Javadoc)
236
	/**
269
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getSupportedModes()
237
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getSupportedModes()
270
	 */
238
	 */
271
	public Set getSupportedModes() {
239
	public Set getSupportedModes() {
272
		HashSet modes = new HashSet(getBaseModes());
240
		if(fModes == null) {
273
		modes.addAll(getContributedModes());
241
			fModes = new HashSet();
274
		return modes;
242
			LaunchDelegate[] delegates = ((LaunchManager) DebugPlugin.getDefault().getLaunchManager()).getLaunchDelegates();
243
			for(int i= 0; i < delegates.length; i++) {
244
				if(delegates[i].appliesTo(getIdentifier())) {
245
					fModes.addAll(delegates[i].getModes());
246
				}
247
			}
248
		}
249
		return fModes;
275
	}
250
	}
276
251
277
	/**
252
	/**
Lines 283-296 Link Here
283
	 * @since 3.2
258
	 * @since 3.2
284
	 */
259
	 */
285
	public boolean isMigrationCandidate(ILaunchConfiguration candidate) throws CoreException {
260
	public boolean isMigrationCandidate(ILaunchConfiguration candidate) throws CoreException {
286
		if(getAttribute(MIGRATION_DELEGATE) != null) {
261
		if(getAttribute(IConfigurationElementConstants.MIGRATION_DELEGATE) != null) {
287
			if(fDelegates == null) {
262
			if(fDelegates == null) {
288
				fDelegates = new Hashtable();
263
				fDelegates = new Hashtable();
289
			}
264
			}
290
			Object delegate = fDelegates.get(MIGRATION_DELEGATE);
265
			Object delegate = fDelegates.get(IConfigurationElementConstants.MIGRATION_DELEGATE);
291
			if(delegate == null) {
266
			if(delegate == null) {
292
				delegate = getConfigurationElement().createExecutableExtension(MIGRATION_DELEGATE);
267
				delegate = fElement.createExecutableExtension(IConfigurationElementConstants.MIGRATION_DELEGATE);
293
				fDelegates.put(MIGRATION_DELEGATE, delegate);
268
				fDelegates.put(IConfigurationElementConstants.MIGRATION_DELEGATE, delegate);
294
			}
269
			}
295
			if(delegate instanceof ILaunchConfigurationMigrationDelegate) {
270
			if(delegate instanceof ILaunchConfigurationMigrationDelegate) {
296
				return ((ILaunchConfigurationMigrationDelegate)delegate).isCandidate(candidate);
271
				return ((ILaunchConfigurationMigrationDelegate)delegate).isCandidate(candidate);
Lines 303-309 Link Here
303
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#isPublic()
278
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#isPublic()
304
	 */
279
	 */
305
	public boolean isPublic() {
280
	public boolean isPublic() {
306
		String publicString = getConfigurationElement().getAttribute("public"); //$NON-NLS-1$
281
		String publicString = fElement.getAttribute(IConfigurationElementConstants.PUBLIC);
307
		if (publicString != null) {
282
		if (publicString != null) {
308
			if (publicString.equalsIgnoreCase("false")) { //$NON-NLS-1$
283
			if (publicString.equalsIgnoreCase("false")) { //$NON-NLS-1$
309
				return false;
284
				return false;
Lines 320-333 Link Here
320
	 * @since 3.2
295
	 * @since 3.2
321
	 */
296
	 */
322
	public void migrate(ILaunchConfiguration candidate) throws CoreException {
297
	public void migrate(ILaunchConfiguration candidate) throws CoreException {
323
		if(getAttribute(MIGRATION_DELEGATE) != null) { 
298
		if(getAttribute(IConfigurationElementConstants.MIGRATION_DELEGATE) != null) { 
324
			if(fDelegates == null) {
299
			if(fDelegates == null) {
325
				fDelegates = new Hashtable();
300
				fDelegates = new Hashtable();
326
			}
301
			}
327
			Object delegate = fDelegates.get(MIGRATION_DELEGATE);
302
			Object delegate = fDelegates.get(IConfigurationElementConstants.MIGRATION_DELEGATE);
328
			if(delegate == null) {
303
			if(delegate == null) {
329
				delegate = getConfigurationElement().createExecutableExtension(MIGRATION_DELEGATE);
304
				delegate = fElement.createExecutableExtension(IConfigurationElementConstants.MIGRATION_DELEGATE);
330
				fDelegates.put(MIGRATION_DELEGATE, delegate);
305
				fDelegates.put(IConfigurationElementConstants.MIGRATION_DELEGATE, delegate);
331
			}
306
			}
332
			if(delegate instanceof ILaunchConfigurationMigrationDelegate) {
307
			if(delegate instanceof ILaunchConfigurationMigrationDelegate) {
333
				((ILaunchConfigurationMigrationDelegate)delegate).migrate(candidate);
308
				((ILaunchConfigurationMigrationDelegate)delegate).migrate(candidate);
Lines 339-361 Link Here
339
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#newInstance(org.eclipse.core.resources.IContainer, java.lang.String)
314
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#newInstance(org.eclipse.core.resources.IContainer, java.lang.String)
340
	 */
315
	 */
341
	public ILaunchConfigurationWorkingCopy newInstance(IContainer container, String name) {
316
	public ILaunchConfigurationWorkingCopy newInstance(IContainer container, String name) {
342
			return new LaunchConfigurationWorkingCopy(container, name, this);
317
		return new LaunchConfigurationWorkingCopy(container, name, this);
343
	}
318
	}
344
319
345
	/**
320
	/**
346
	 * Sets this type's configuration element.
321
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#supportsMode(java.lang.String)
347
	 * 
348
	 * @param element this type's configuration element
349
	 */
322
	 */
350
	private void setConfigurationElement(IConfigurationElement element) {
323
	public boolean supportsMode(String mode) {
351
		fElement = element;
324
		return getSupportedModes().contains(mode);
352
	}
325
	}
353
326
	
354
	/**
327
	/* (non-Javadoc)
355
	 * @see ILaunchConfigurationType#supportsMode(String)
328
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getContributorName()
356
	 */
329
	 */
357
	public boolean supportsMode(String mode) {
330
	public String getContributorName() {
358
		return getBaseModes().contains(mode) || getContributedModes().contains(mode);
331
		return fElement.getContributor().getName();
332
	}
333
	
334
	/* (non-Javadoc)
335
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getImageDescriptorId()
336
	 */
337
	public String getImageDescriptorPath() {
338
		return fElement.getAttribute(IConfigurationElementConstants.ICON);
359
	}
339
	}
360
}
340
}
361
341
(-)core/org/eclipse/debug/internal/core/DebugCoreMessages.properties (-1 / +2 lines)
Lines 42-47 Link Here
42
LaunchConfigurationInfo_Invalid_launch_configuration_XML__10=Invalid launch configuration XML.
42
LaunchConfigurationInfo_Invalid_launch_configuration_XML__10=Invalid launch configuration XML.
43
LaunchConfigurationInfo_missing_type=Launch configuration type id \"{0}\" does not exist.\nPossible causes:\n\tMissing specification of a launch type (missing plug-in)\n\tIncorrect launch configuration XML
43
LaunchConfigurationInfo_missing_type=Launch configuration type id \"{0}\" does not exist.\nPossible causes:\n\tMissing specification of a launch type (missing plug-in)\n\tIncorrect launch configuration XML
44
LaunchConfigurationInfo_36=A null key has been specified for an attribute in this launch configuration
44
LaunchConfigurationInfo_36=A null key has been specified for an attribute in this launch configuration
45
LaunchConfigurationInfo_35=Attribute {0} is not of type java.util.Set.
45
LaunchConfigurationWorkingCopy__0__occurred_generating_launch_configuration_XML__1={0} occurred generating launch configuration XML.
46
LaunchConfigurationWorkingCopy__0__occurred_generating_launch_configuration_XML__1={0} occurred generating launch configuration XML.
46
LaunchConfigurationWorkingCopy_Specified_container_for_launch_configuration_does_not_exist_2=Specified container for launch configuration does not exist
47
LaunchConfigurationWorkingCopy_Specified_container_for_launch_configuration_does_not_exist_2=Specified container for launch configuration does not exist
47
LaunchConfigurationWorkingCopy_5=Unable to save launch configuration.
48
LaunchConfigurationWorkingCopy_5=Unable to save launch configuration.
Lines 63-68 Link Here
63
RuntimeProcess_Exit_value_not_available_until_process_terminates__1=Exit value not available until process terminates.
64
RuntimeProcess_Exit_value_not_available_until_process_terminates__1=Exit value not available until process terminates.
64
LaunchConfigurationType_Launch_delegate_for__0__does_not_implement_required_interface_ILaunchConfigurationDelegate__1=Launch delegate for {0} does not implement required interface ILaunchConfigurationDelegate.
65
LaunchConfigurationType_Launch_delegate_for__0__does_not_implement_required_interface_ILaunchConfigurationDelegate__1=Launch delegate for {0} does not implement required interface ILaunchConfigurationDelegate.
65
LaunchConfigurationType_9=Launch mode {0} not supported for configuration type {1}
66
LaunchConfigurationType_9=Launch mode {0} not supported for configuration type {1}
66
LaunchConfigurationType_10=Launch delegate not registered for configuration type {0}, mode {1}
67
LaunchConfigurationType_10=There is no launch delegate registered for configuration type {0}, mode {1}
67
WatchExpression_0=(Watch expressions not supported)
68
WatchExpression_0=(Watch expressions not supported)
68
NullStreamsProxy_0=Null Stream Monitor
69
NullStreamsProxy_0=Null Stream Monitor
(-)core/org/eclipse/debug/internal/core/LaunchConfigurationInfo.java (-119 / +296 lines)
Lines 12-21 Link Here
12
12
13
 
13
 
14
import java.io.IOException;
14
import java.io.IOException;
15
import com.ibm.icu.text.MessageFormat;
16
import java.util.ArrayList;
15
import java.util.ArrayList;
17
import java.util.Comparator;
16
import java.util.Comparator;
18
import java.util.HashMap;
17
import java.util.HashMap;
18
import java.util.HashSet;
19
import java.util.Iterator;
19
import java.util.Iterator;
20
import java.util.List;
20
import java.util.List;
21
import java.util.Map;
21
import java.util.Map;
Lines 34-51 Link Here
34
import org.w3c.dom.Element;
34
import org.w3c.dom.Element;
35
import org.w3c.dom.Node;
35
import org.w3c.dom.Node;
36
import org.w3c.dom.NodeList;
36
import org.w3c.dom.NodeList;
37
38
import com.ibm.icu.text.MessageFormat;
37
 
39
 
38
/**
40
/**
39
 * The information associated with a launch configuration
41
 * The information associated with a launch configuration handle.
40
 * handle.
41
 */
42
 */
42
public class LaunchConfigurationInfo {
43
public class LaunchConfigurationInfo {
43
44
	
44
	/**
45
	/**
45
	 * This configurations attribute table.
46
	 * Constants fo XML element names and attrbiutes
46
	 * Keys are <code>String</code>s and values
47
	 */
47
	 * are one of <code>String</code>, <code>Integer</code>,
48
	private static final String KEY = "key"; //$NON-NLS-1$
48
	 * or <code>Boolean</code>.
49
	private static final String VALUE = "value"; //$NON-NLS-1$
50
	private static final String SET_ENTRY = "setEntry"; //$NON-NLS-1$
51
	private static final String LAUNCH_CONFIGURATION = "launchConfiguration"; //$NON-NLS-1$
52
	private static final String MAP_ENTRY = "mapEntry"; //$NON-NLS-1$
53
	private static final String LIST_ENTRY = "listEntry"; //$NON-NLS-1$
54
	private static final String SET_ATTRIBUTE = "setAttribute"; //$NON-NLS-1$
55
	private static final String MAP_ATTRIBUTE = "mapAttribute"; //$NON-NLS-1$
56
	private static final String LIST_ATTRIBUTE = "listAttribute"; //$NON-NLS-1$
57
	private static final String BOOLEAN_ATTRIBUTE = "booleanAttribute"; //$NON-NLS-1$
58
	private static final String INT_ATTRIBUTE = "intAttribute"; //$NON-NLS-1$
59
	private static final String STRING_ATTRIBUTE = "stringAttribute"; //$NON-NLS-1$
60
	private static final String TYPE = "type"; //$NON-NLS-1$
61
	
62
	/**
63
	 * This configurations attribute table. Keys are <code>String</code>s and
64
	 * values are one of <code>String</code>, <code>Integer</code>, or
65
	 * <code>Boolean</code>.
49
	 */
66
	 */
50
	private HashMap fAttributes;
67
	private HashMap fAttributes;
51
	
68
	
Lines 88-94 Link Here
88
	/**
105
	/**
89
	 * Sets this configuration's attribute table.
106
	 * Sets this configuration's attribute table.
90
	 * 
107
	 * 
91
	 * @param table attribute table
108
	 * @param table
109
	 *            attribute table
92
	 */	
110
	 */	
93
	private void setAttributeTable(HashMap table) {
111
	private void setAttributeTable(HashMap table) {
94
		fAttributes = table;
112
		fAttributes = table;
Lines 115-127 Link Here
115
	}
133
	}
116
	
134
	
117
	/**
135
	/**
118
	 * Returns the <code>String</code> attribute with the
136
	 * Returns the <code>String</code> attribute with the given key or the
119
	 * given key or the given default value if undefined.
137
	 * given default value if undefined.
120
	 * 
138
	 * 
121
	 * @return attribute specified by given key or the defaultValue
139
	 * @return attribute specified by given key or the defaultValue if undefined
122
	 *  if undefined
140
	 * @throws CoreException
123
	 * @throws CoreException if the attribute with the given key exists
141
	 *             if the attribute with the given key exists but is not a
124
	 *  but is not a <code>String</code>
142
	 *             <code>String</code>
125
	 */
143
	 */
126
	protected String getStringAttribute(String key, String defaultValue) throws CoreException {
144
	protected String getStringAttribute(String key, String defaultValue) throws CoreException {
127
		Object attr = getAttributeTable().get(key);
145
		Object attr = getAttributeTable().get(key);
Lines 140-152 Link Here
140
	}
158
	}
141
	
159
	
142
	/**
160
	/**
143
	 * Returns the <code>int</code> attribute with the
161
	 * Returns the <code>int</code> attribute with the given key or the given
144
	 * given key or the given default value if undefined.
162
	 * default value if undefined.
145
	 * 
163
	 * 
146
	 * @return attribute specified by given key or the defaultValue
164
	 * @return attribute specified by given key or the defaultValue if undefined
147
	 *  if undefined
165
	 * @throws CoreException
148
	 * @throws CoreException if the attribute with the given key exists
166
	 *             if the attribute with the given key exists but is not an
149
	 *  but is not an <code>int</code>
167
	 *             <code>int</code>
150
	 */
168
	 */
151
	protected int getIntAttribute(String key, int defaultValue) throws CoreException {
169
	protected int getIntAttribute(String key, int defaultValue) throws CoreException {
152
		Object attr = getAttributeTable().get(key);
170
		Object attr = getAttributeTable().get(key);
Lines 165-177 Link Here
165
	}
183
	}
166
	
184
	
167
	/**
185
	/**
168
	 * Returns the <code>boolean</code> attribute with the
186
	 * Returns the <code>boolean</code> attribute with the given key or the
169
	 * given key or the given default value if undefined.
187
	 * given default value if undefined.
170
	 * 
188
	 * 
171
	 * @return attribute specified by given key or the defaultValue
189
	 * @return attribute specified by given key or the defaultValue if undefined
172
	 *  if undefined
190
	 * @throws CoreException
173
	 * @throws CoreException if the attribute with the given key exists
191
	 *             if the attribute with the given key exists but is not a
174
	 *  but is not a <code>boolean</code>
192
	 *             <code>boolean</code>
175
	 */
193
	 */
176
	protected boolean getBooleanAttribute(String key, boolean defaultValue) throws CoreException {
194
	protected boolean getBooleanAttribute(String key, boolean defaultValue) throws CoreException {
177
		Object attr = getAttributeTable().get(key);
195
		Object attr = getAttributeTable().get(key);
Lines 190-202 Link Here
190
	}
208
	}
191
	
209
	
192
	/**
210
	/**
193
	 * Returns the <code>java.util.List</code> attribute with the
211
	 * Returns the <code>java.util.List</code> attribute with the given key or
194
	 * given key or the given default value if undefined.
212
	 * the given default value if undefined.
195
	 * 
213
	 * 
196
	 * @return attribute specified by given key or the defaultValue
214
	 * @return attribute specified by given key or the defaultValue if undefined
197
	 *  if undefined
215
	 * @throws CoreException
198
	 * @throws CoreException if the attribute with the given key exists
216
	 *             if the attribute with the given key exists but is not a
199
	 *  but is not a <code>java.util.List</code>
217
	 *             <code>java.util.List</code>
200
	 */
218
	 */
201
	protected List getListAttribute(String key, List defaultValue) throws CoreException {
219
	protected List getListAttribute(String key, List defaultValue) throws CoreException {
202
		Object attr = getAttributeTable().get(key);
220
		Object attr = getAttributeTable().get(key);
Lines 215-227 Link Here
215
	}
233
	}
216
	
234
	
217
	/**
235
	/**
218
	 * Returns the <code>java.util.Map</code> attribute with the
236
	 * Returns the <code>java.util.Set</code> attribute with the given key or
219
	 * given key or the given default value if undefined.
237
	 * the given default value if undefined.
238
	 * 
239
	 * @return attribute specified by given key or the defaultValue if undefined
240
	 * @throws CoreException
241
	 *             if the attribute with the given key exists but is not a
242
	 *             <code>java.util.Set</code>
243
	 * 
244
	 * @since 3.3 EXPERIMENTAL
245
	 */
246
	protected Set getSetAttribute(String key, Set defaultValue) throws CoreException {
247
		Object attr = getAttributeTable().get(key);
248
		if (attr != null) {
249
			if (attr instanceof Set) {
250
				return (Set)attr;
251
			} 
252
			throw new DebugException(
253
				new Status(
254
				 IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
255
				 DebugException.REQUEST_FAILED, MessageFormat.format(DebugCoreMessages.LaunchConfigurationInfo_35, new String[] {key}), null 
256
				)
257
			);
258
		}
259
		return defaultValue;
260
	}
261
	
262
	/**
263
	 * Returns the <code>java.util.Map</code> attribute with the given key or
264
	 * the given default value if undefined.
220
	 * 
265
	 * 
221
	 * @return attribute specified by given key or the defaultValue
266
	 * @return attribute specified by given key or the defaultValue if undefined
222
	 *  if undefined
267
	 * @throws CoreException
223
	 * @throws CoreException if the attribute with the given key exists
268
	 *             if the attribute with the given key exists but is not a
224
	 *  but is not a <code>java.util.Map</code>
269
	 *             <code>java.util.Map</code>
225
	 */
270
	 */
226
	protected Map getMapAttribute(String key, Map defaultValue) throws CoreException {
271
	protected Map getMapAttribute(String key, Map defaultValue) throws CoreException {
227
		Object attr = getAttributeTable().get(key);
272
		Object attr = getAttributeTable().get(key);
Lines 239-254 Link Here
239
		return defaultValue;
284
		return defaultValue;
240
	}
285
	}
241
	
286
	
242
	/** 
287
	/**
243
	 * Sets this configuration's type.
288
	 * Sets this configuration's type.
244
	 * 
289
	 * 
245
	 * @param type launch configuration type
290
	 * @param type
291
	 *            launch configuration type
246
	 */
292
	 */
247
	protected void setType(ILaunchConfigurationType type) {
293
	protected void setType(ILaunchConfigurationType type) {
248
		fType = type;
294
		fType = type;
249
	}
295
	}
250
	
296
	
251
	/** 
297
	/**
252
	 * Returns this configuration's type.
298
	 * Returns this configuration's type.
253
	 * 
299
	 * 
254
	 * @return launch configuration type
300
	 * @return launch configuration type
Lines 280-290 Link Here
280
	}
326
	}
281
	
327
	
282
	/**
328
	/**
283
	 * Sets the given attribute to the given value. Only
329
	 * Sets the given attribute to the given value. Only working copy's should
284
	 * working copy's should use this API.
330
	 * use this API.
285
	 * 
331
	 * 
286
	 * @param key attribute key
332
	 * @param key
287
	 * @param value attribute value
333
	 *            attribute key
334
	 * @param value
335
	 *            attribute value
288
	 */
336
	 */
289
	protected void setAttribute(String key, Object value) {
337
	protected void setAttribute(String key, Object value) {
290
		if (value == null) {
338
		if (value == null) {
Lines 298-315 Link Here
298
	 * Returns the content of this info as XML
346
	 * Returns the content of this info as XML
299
	 * 
347
	 * 
300
	 * @return the content of this info as XML
348
	 * @return the content of this info as XML
301
	 * @throws CoreException if a attribute has been set with a null key
349
	 * @throws CoreException
302
	 * @throws IOException if an exception occurs creating the XML
350
	 *             if a attribute has been set with a null key
303
	 * @throws ParserConfigurationException if an exception occurs creating the XML
351
	 * @throws IOException
304
	 * @throws TransformerException if an exception occurs creating the XML
352
	 *             if an exception occurs creating the XML
353
	 * @throws ParserConfigurationException
354
	 *             if an exception occurs creating the XML
355
	 * @throws TransformerException
356
	 *             if an exception occurs creating the XML
305
	 */
357
	 */
306
	protected String getAsXML() throws CoreException, IOException, ParserConfigurationException, TransformerException {
358
	protected String getAsXML() throws CoreException, IOException, ParserConfigurationException, TransformerException {
307
359
308
		Document doc = LaunchManager.getDocument();
360
		Document doc = LaunchManager.getDocument();
309
		Element configRootElement = doc.createElement("launchConfiguration"); //$NON-NLS-1$
361
		Element configRootElement = doc.createElement(LAUNCH_CONFIGURATION); 
310
		doc.appendChild(configRootElement);
362
		doc.appendChild(configRootElement);
311
		
363
		
312
		configRootElement.setAttribute("type", getType().getIdentifier()); //$NON-NLS-1$
364
		configRootElement.setAttribute(TYPE, getType().getIdentifier()); 
313
		
365
		
314
		Iterator keys = getAttributeTable().keySet().iterator();
366
		Iterator keys = getAttributeTable().keySet().iterator();
315
		while (keys.hasNext()) {
367
		while (keys.hasNext()) {
Lines 330-347 Link Here
330
			String valueString = null;
382
			String valueString = null;
331
			if (value instanceof String) {
383
			if (value instanceof String) {
332
				valueString = (String)value;
384
				valueString = (String)value;
333
				element = createKeyValueElement(doc, "stringAttribute", key, valueString); //$NON-NLS-1$
385
				element = createKeyValueElement(doc, STRING_ATTRIBUTE, key, valueString); 
334
			} else if (value instanceof Integer) {
386
			} else if (value instanceof Integer) {
335
				valueString = ((Integer)value).toString();
387
				valueString = ((Integer)value).toString();
336
				element = createKeyValueElement(doc, "intAttribute", key, valueString); //$NON-NLS-1$
388
				element = createKeyValueElement(doc, INT_ATTRIBUTE, key, valueString); 
337
			} else if (value instanceof Boolean) {
389
			} else if (value instanceof Boolean) {
338
				valueString = ((Boolean)value).toString();
390
				valueString = ((Boolean)value).toString();
339
				element = createKeyValueElement(doc, "booleanAttribute", key, valueString); //$NON-NLS-1$
391
				element = createKeyValueElement(doc, BOOLEAN_ATTRIBUTE, key, valueString); 
340
			} else if (value instanceof List) {				
392
			} else if (value instanceof List) {				
341
				element = createListElement(doc, "listAttribute", key, (List)value); //$NON-NLS-1$
393
				element = createListElement(doc, LIST_ATTRIBUTE, key, (List)value); 
342
			} else if (value instanceof Map) {				
394
			} else if (value instanceof Map) {				
343
				element = createMapElement(doc, "mapAttribute", key, (Map)value); //$NON-NLS-1$
395
				element = createMapElement(doc, MAP_ATTRIBUTE, key, (Map)value); 
344
			}			
396
			} else if(value instanceof Set) {
397
				element = createSetElement(doc, SET_ATTRIBUTE, key, (Set)value); 
398
			}
345
			configRootElement.appendChild(element);
399
			configRootElement.appendChild(element);
346
		}
400
		}
347
401
Lines 349-399 Link Here
349
	}
403
	}
350
	
404
	
351
	/**
405
	/**
352
	 * Helper method that creates a 'key value' element of the specified type with the 
406
	 * Helper method that creates a 'key value' element of the specified type
353
	 * specified attribute values.
407
	 * with the specified attribute values.
354
	 */
408
	 */
355
	protected Element createKeyValueElement(Document doc, String elementType, String key, String value) {
409
	protected Element createKeyValueElement(Document doc, String elementType, String key, String value) {
356
		Element element = doc.createElement(elementType);
410
		Element element = doc.createElement(elementType);
357
		element.setAttribute("key", key); //$NON-NLS-1$
411
		element.setAttribute(KEY, key); 
358
		element.setAttribute("value", value); //$NON-NLS-1$
412
		element.setAttribute(VALUE, value);
359
		return element;
413
		return element;
360
	}
414
	}
361
	
415
	
416
	/**
417
	 * Creates a new <code>Element</code> for the specified
418
	 * <code>java.util.List</code>
419
	 * 
420
	 * @param doc the doc to add the element to
421
	 * @param elementType the type of the element
422
	 * @param setKey the key for the element
423
	 * @param list the list to fill the new element with
424
	 * @return the new element
425
	 */
362
	protected Element createListElement(Document doc, String elementType, String listKey, List list) {
426
	protected Element createListElement(Document doc, String elementType, String listKey, List list) {
363
		Element listElement = doc.createElement(elementType);
427
		Element listElement = doc.createElement(elementType);
364
		listElement.setAttribute("key", listKey); //$NON-NLS-1$
428
		listElement.setAttribute(KEY, listKey); 
365
		Iterator iterator = list.iterator();
429
		Iterator iterator = list.iterator();
366
		while (iterator.hasNext()) {
430
		while (iterator.hasNext()) {
367
			String value = (String) iterator.next();
431
			String value = (String) iterator.next();
368
			Element element = doc.createElement("listEntry"); //$NON-NLS-1$
432
			Element element = doc.createElement(LIST_ENTRY); 
369
			element.setAttribute("value", value); //$NON-NLS-1$
433
			element.setAttribute(VALUE, value);
370
			listElement.appendChild(element);
434
			listElement.appendChild(element);
371
		}		
435
		}		
372
		return listElement;
436
		return listElement;
373
	}
437
	}
374
	
438
	
439
	/**
440
	 * Creates a new <code>Element</code> for the specified
441
	 * <code>java.util.Set</code>
442
	 * 
443
	 * @param doc the doc to add the element to
444
	 * @param elementType the type of the element
445
	 * @param setKey the key for the element
446
	 * @param set the set to fill the new element with
447
	 * @return the new element
448
	 * 
449
	 * @since 3.3
450
	 */
451
	protected Element createSetElement(Document doc, String elementType, String setKey, Set set) {
452
		Element setElement = doc.createElement(elementType);
453
		setElement.setAttribute(KEY, setKey);
454
		Element element = null;
455
		for(Iterator iter = set.iterator(); iter.hasNext();) {
456
			element = doc.createElement(SET_ENTRY);
457
			element.setAttribute(VALUE, (String) iter.next());
458
			setElement.appendChild(element);
459
		}
460
		return setElement;
461
	}
462
	
463
	/**
464
	 * Creates a new <code>Element</code> for the specified
465
	 * <code>java.util.Map</code>
466
	 * 
467
	 * @param doc the doc to add the element to
468
	 * @param elementType the type of the element
469
	 * @param setKey the key for the element
470
	 * @param map the map to fill the new element with
471
	 * @return the new element
472
	 * 
473
	 */
375
	protected Element createMapElement(Document doc, String elementType, String mapKey, Map map) {
474
	protected Element createMapElement(Document doc, String elementType, String mapKey, Map map) {
376
		Element mapElement = doc.createElement(elementType);
475
		Element mapElement = doc.createElement(elementType);
377
		mapElement.setAttribute("key", mapKey); //$NON-NLS-1$
476
		mapElement.setAttribute(KEY, mapKey); 
378
		Iterator iterator = map.keySet().iterator();
477
		Iterator iterator = map.keySet().iterator();
379
		while (iterator.hasNext()) {
478
		while (iterator.hasNext()) {
380
			String key = (String) iterator.next();
479
			String key = (String) iterator.next();
381
			String value = (String) map.get(key);
480
			String value = (String) map.get(key);
382
			Element element = doc.createElement("mapEntry"); //$NON-NLS-1$
481
			Element element = doc.createElement(MAP_ENTRY); 
383
			element.setAttribute("key", key); //$NON-NLS-1$
482
			element.setAttribute(KEY, key); 
384
			element.setAttribute("value", value); //$NON-NLS-1$
483
			element.setAttribute(VALUE, value); 
385
			mapElement.appendChild(element);
484
			mapElement.appendChild(element);
386
		}		
485
		}		
387
		return mapElement;		
486
		return mapElement;		
388
	}
487
	}
389
	
488
	
489
	/**
490
	 * Initializes the mapping of attributes from the XML file
491
	 * @param root the root node from the XML document
492
	 * @throws CoreException 
493
	 */
390
	protected void initializeFromXML(Element root) throws CoreException {
494
	protected void initializeFromXML(Element root) throws CoreException {
391
		if (!root.getNodeName().equalsIgnoreCase("launchConfiguration")) { //$NON-NLS-1$
495
		if (!root.getNodeName().equalsIgnoreCase(LAUNCH_CONFIGURATION)) { 
392
			throw getInvalidFormatDebugException();
496
			throw getInvalidFormatDebugException();
393
		}
497
		}
394
		
498
		
395
		// read type
499
		// read type
396
		String id = root.getAttribute("type"); //$NON-NLS-1$
500
		String id = root.getAttribute(TYPE); 
397
		if (id == null) {
501
		if (id == null) {
398
			throw getInvalidFormatDebugException();
502
			throw getInvalidFormatDebugException();
399
		} 
503
		} 
Lines 410-515 Link Here
410
		setType(type);
514
		setType(type);
411
		
515
		
412
		NodeList list = root.getChildNodes();
516
		NodeList list = root.getChildNodes();
413
		int length = list.getLength();
517
		Node node = null;
414
		for (int i = 0; i < length; ++i) {
518
		Element element = null;
415
			Node node = list.item(i);
519
		String nodeName = null;
520
		for (int i = 0; i < list.getLength(); ++i) {
521
			node = list.item(i);
416
			short nodeType = node.getNodeType();
522
			short nodeType = node.getNodeType();
417
			if (nodeType == Node.ELEMENT_NODE) {
523
			if (nodeType == Node.ELEMENT_NODE) {
418
				Element element = (Element) node;
524
				element = (Element) node;
419
				String nodeName = element.getNodeName();
525
				nodeName = element.getNodeName();
420
				
526
				if (nodeName.equalsIgnoreCase(STRING_ATTRIBUTE)) { 
421
				if (nodeName.equalsIgnoreCase("stringAttribute")) { //$NON-NLS-1$
422
					setStringAttribute(element);
527
					setStringAttribute(element);
423
				} else if (nodeName.equalsIgnoreCase("intAttribute")) { //$NON-NLS-1$
528
				} else if (nodeName.equalsIgnoreCase(INT_ATTRIBUTE)) { 
424
					setIntegerAttribute(element);
529
					setIntegerAttribute(element);
425
				} else if (nodeName.equalsIgnoreCase("booleanAttribute"))  { //$NON-NLS-1$
530
				} else if (nodeName.equalsIgnoreCase(BOOLEAN_ATTRIBUTE))  { 
426
					setBooleanAttribute(element);
531
					setBooleanAttribute(element);
427
				} else if (nodeName.equalsIgnoreCase("listAttribute")) {   //$NON-NLS-1$
532
				} else if (nodeName.equalsIgnoreCase(LIST_ATTRIBUTE)) {   
428
					setListAttribute(element);					
533
					setListAttribute(element);					
429
				} else if (nodeName.equalsIgnoreCase("mapAttribute")) {    //$NON-NLS-1$
534
				} else if (nodeName.equalsIgnoreCase(MAP_ATTRIBUTE)) {    
430
					setMapAttribute(element);										
535
					setMapAttribute(element);										
536
				} else if(nodeName.equalsIgnoreCase(SET_ATTRIBUTE)) { 
537
					setSetAttribute(element);
431
				}
538
				}
432
			}
539
			}
433
		}
540
		}
434
	}	
541
	}	
435
	
542
	
543
	/**
544
	 * Loads a <code>String</code> from the specified element into the local attribute mapping
545
	 * @param element the element to load from
546
	 * @throws CoreException
547
	 */
436
	protected void setStringAttribute(Element element) throws CoreException {
548
	protected void setStringAttribute(Element element) throws CoreException {
437
		String key = getKeyAttribute(element);
549
		setAttribute(getKeyAttribute(element), getValueAttribute(element));
438
		String value = getValueAttribute(element);
439
		setAttribute(key, value);
440
	}
550
	}
441
	
551
	
552
	/**
553
	 * Loads an <code>Integer</code> from the specified element into the local attribute mapping
554
	 * @param element the element to load from
555
	 * @throws CoreException
556
	 */
442
	protected void setIntegerAttribute(Element element) throws CoreException {
557
	protected void setIntegerAttribute(Element element) throws CoreException {
443
		String key = getKeyAttribute(element);
558
		setAttribute(getKeyAttribute(element), new Integer(getValueAttribute(element)));
444
		String value = getValueAttribute(element);
445
		setAttribute(key, new Integer(value));
446
	}
559
	}
447
	
560
	
561
	/**
562
	 * Loads a <code>Boolean</code> from the specified element into the local attribute mapping
563
	 * @param element the element to load from
564
	 * @throws CoreException
565
	 */
448
	protected void setBooleanAttribute(Element element) throws CoreException {
566
	protected void setBooleanAttribute(Element element) throws CoreException {
449
		String key = getKeyAttribute(element);
567
		setAttribute(getKeyAttribute(element), Boolean.valueOf(getValueAttribute(element)));
450
		String value = getValueAttribute(element);
451
		setAttribute(key, Boolean.valueOf(value));
452
	}
568
	}
453
	
569
	
570
	/**
571
	 * Reads a <code>List</code> attribute from the specified XML node and
572
	 * loads it into the mapping of attributes
573
	 * 
574
	 * @param element the element to read the list attribute from
575
	 * @throws CoreException if the element has an invalid format
576
	 */
454
	protected void setListAttribute(Element element) throws CoreException {
577
	protected void setListAttribute(Element element) throws CoreException {
455
		String listKey = element.getAttribute("key");  //$NON-NLS-1$
578
		String listKey = element.getAttribute(KEY);  
456
		NodeList nodeList = element.getChildNodes();
579
		NodeList nodeList = element.getChildNodes();
457
		int entryCount = nodeList.getLength();
580
		int entryCount = nodeList.getLength();
458
		List list = new ArrayList(entryCount);
581
		List list = new ArrayList(entryCount);
582
		Node node = null;
583
		Element selement = null;
459
		for (int i = 0; i < entryCount; i++) {
584
		for (int i = 0; i < entryCount; i++) {
460
			Node node = nodeList.item(i);
585
			node = nodeList.item(i);
461
			short type = node.getNodeType();
586
			if (node.getNodeType() == Node.ELEMENT_NODE) {
462
			if (type == Node.ELEMENT_NODE) {
587
				selement = (Element) node;		
463
				Element subElement = (Element) node;
588
				if (!selement.getNodeName().equalsIgnoreCase(LIST_ENTRY)) { 
464
				String nodeName = subElement.getNodeName();				
465
				if (!nodeName.equalsIgnoreCase("listEntry")) { //$NON-NLS-1$
466
					throw getInvalidFormatDebugException();
589
					throw getInvalidFormatDebugException();
467
				}
590
				}
468
				String value = getValueAttribute(subElement);
591
				list.add(getValueAttribute(selement));
469
				list.add(value);
470
			}
592
			}
471
		}
593
		}
472
		setAttribute(listKey, list);
594
		setAttribute(listKey, list);
473
	}
595
	}
474
		
596
		
597
	/**
598
	 * Reads a <code>Set</code> attribute from the specified XML node and
599
	 * loads it into the mapping of attributes
600
	 * 
601
	 * @param element the element to read the set attribute from
602
	 * @throws CoreException if the element has an invalid format
603
	 * 
604
	 * @since 3.3
605
	 */
606
	protected void setSetAttribute(Element element) throws CoreException {
607
		String setKey = element.getAttribute(KEY);
608
		NodeList nodeList = element.getChildNodes();
609
		int entryCount = nodeList.getLength();
610
		Set set = new HashSet(entryCount);
611
		Node node = null;
612
		Element selement = null;
613
		for(int i = 0; i < entryCount; i++) {
614
			node = nodeList.item(i);
615
			if(node.getNodeType() == Node.ELEMENT_NODE) {
616
				selement = (Element)node;
617
				if(!selement.getNodeName().equalsIgnoreCase(SET_ENTRY)) { 
618
					throw getInvalidFormatDebugException();
619
				}
620
				set.add(getValueAttribute(selement));
621
			}
622
		}
623
		setAttribute(setKey, set);
624
	}
625
	
626
	/**
627
	 * Reads a <code>Map</code> attribute from the specified XML node and
628
	 * loads it into the mapping of attributes
629
	 * 
630
	 * @param element the element to read the map attribute from
631
	 * @throws CoreException if the element has an invalid format
632
	 */
475
	protected void setMapAttribute(Element element) throws CoreException {
633
	protected void setMapAttribute(Element element) throws CoreException {
476
		String mapKey = element.getAttribute("key");  //$NON-NLS-1$
634
		String mapKey = element.getAttribute(KEY);  
477
		NodeList nodeList = element.getChildNodes();
635
		NodeList nodeList = element.getChildNodes();
478
		int entryCount = nodeList.getLength();
636
		int entryCount = nodeList.getLength();
479
		Map map = new HashMap(entryCount);
637
		Map map = new HashMap(entryCount);
638
		Node node = null;
639
		Element selement = null;
480
		for (int i = 0; i < entryCount; i++) {
640
		for (int i = 0; i < entryCount; i++) {
481
			Node node = nodeList.item(i);
641
			node = nodeList.item(i);
482
			short type = node.getNodeType();
642
			if (node.getNodeType() == Node.ELEMENT_NODE) {
483
			if (type == Node.ELEMENT_NODE) {
643
				selement = (Element) node;		
484
				Element subElement = (Element) node;
644
				if (!selement.getNodeName().equalsIgnoreCase(MAP_ENTRY)) { 
485
				String nodeName = subElement.getNodeName();				
486
				if (!nodeName.equalsIgnoreCase("mapEntry")) { //$NON-NLS-1$
487
					throw getInvalidFormatDebugException();
645
					throw getInvalidFormatDebugException();
488
				}
646
				}
489
				String key = getKeyAttribute(subElement);
647
				map.put(getKeyAttribute(selement), getValueAttribute(selement));
490
				String value = getValueAttribute(subElement);
491
				map.put(key, value);
492
			}
648
			}
493
		}
649
		}
494
		setAttribute(mapKey, map);
650
		setAttribute(mapKey, map);
495
	}
651
	}
496
		
652
		
653
	/**
654
	 * Returns the <code>String</code> representation of the 'key' attribute from the specified element
655
	 * @param element the element to read from
656
	 * @return the value
657
	 * @throws CoreException
658
	 */
497
	protected String getKeyAttribute(Element element) throws CoreException {
659
	protected String getKeyAttribute(Element element) throws CoreException {
498
		String key = element.getAttribute("key");   //$NON-NLS-1$
660
		String key = element.getAttribute(KEY);
499
		if (key == null) {
661
		if (key == null) {
500
			throw getInvalidFormatDebugException();
662
			throw getInvalidFormatDebugException();
501
		}
663
		}
502
		return key;
664
		return key;
503
	}
665
	}
504
	
666
	
667
	/**
668
	 * Returns the <code>String</code> representation of the 'value' attribute from the specified element
669
	 * @param element the element to read from
670
	 * @return the value
671
	 * @throws CoreException
672
	 */
505
	protected String getValueAttribute(Element element) throws CoreException {
673
	protected String getValueAttribute(Element element) throws CoreException {
506
		String value = element.getAttribute("value");   //$NON-NLS-1$
674
		String value = element.getAttribute(VALUE);   
507
		if (value == null) {
675
		if (value == null) {
508
			throw getInvalidFormatDebugException();
676
			throw getInvalidFormatDebugException();
509
		}
677
		}
510
		return value;
678
		return value;
511
	}
679
	}
512
	
680
	
681
	/**
682
	 * Returns an invalid format exception for reuse
683
	 * @return an invalid format exception
684
	 */
513
	protected DebugException getInvalidFormatDebugException() {
685
	protected DebugException getInvalidFormatDebugException() {
514
		return 
686
		return 
515
			new DebugException(
687
			new DebugException(
Lines 521-528 Link Here
521
	}
693
	}
522
	
694
	
523
	/**
695
	/**
524
	 * Two <code>LaunchConfigurationInfo</code> objects are equal if and only if they have the
696
	 * Two <code>LaunchConfigurationInfo</code> objects are equal if and only
525
	 * same type and they have the same set of attributes with the same values.
697
	 * if they have the same type and they have the same set of attributes with
698
	 * the same values.
526
	 * 
699
	 * 
527
	 * @see Object#equals(Object)
700
	 * @see Object#equals(Object)
528
	 */
701
	 */
Lines 544-553 Link Here
544
	}
717
	}
545
	
718
	
546
	/**
719
	/**
547
	 * Returns whether the two attribute maps are equal, consulting
720
	 * Returns whether the two attribute maps are equal, consulting registered
548
	 * registered comparator extensions.
721
	 * comparator extensions.
549
	 * 
722
	 * 
550
	 * @param map1 attribute map
723
	 * @param map1  attribute map
551
	 * @param map2 attribute map
724
	 * @param map2 attribute map
552
	 * @return whether the two attribute maps are equal
725
	 * @return whether the two attribute maps are equal
553
	 */
726
	 */
Lines 566-573 Link Here
566
				if (comp == null) {
739
				if (comp == null) {
567
					if (fgIsSun14x) {
740
					if (fgIsSun14x) {
568
						if(attr2 instanceof String & attr1 instanceof String) {
741
						if(attr2 instanceof String & attr1 instanceof String) {
569
							//this is a hack for bug 110215, on SUN 1.4.x, \r is stripped off when the stream is written to the DOM
742
							// this is a hack for bug 110215, on SUN 1.4.x, \r
570
							//this is not the case for 1.5.x, so to be safe we are stripping \r off all strings before we compare for equality
743
							// is stripped off when the stream is written to the
744
							// DOM
745
							// this is not the case for 1.5.x, so to be safe we
746
							// are stripping \r off all strings before we
747
							// compare for equality
571
							attr1 = ((String)attr1).replaceAll("\\r", ""); //$NON-NLS-1$ //$NON-NLS-2$
748
							attr1 = ((String)attr1).replaceAll("\\r", ""); //$NON-NLS-1$ //$NON-NLS-2$
572
							attr2 = ((String)attr2).replaceAll("\\r", ""); //$NON-NLS-1$ //$NON-NLS-2$
749
							attr2 = ((String)attr2).replaceAll("\\r", ""); //$NON-NLS-1$ //$NON-NLS-2$
573
						}
750
						}
(-)schema/launchModes.exsd (-134 / +120 lines)
Lines 1-134 Link Here
1
<?xml version='1.0' encoding='UTF-8'?>
1
<?xml version='1.0' encoding='UTF-8'?>
2
<!-- Schema file written by PDE -->
2
<!-- Schema file written by PDE -->
3
<schema targetNamespace="org.eclipse.debug.core">
3
<schema targetNamespace="org.eclipse.debug.core">
4
<annotation>
4
<annotation>
5
      <appInfo>
5
      <appInfo>
6
         <meta.schema plugin="org.eclipse.debug.core" id="launchModes" name="Launch Modes"/>
6
         <meta.schema plugin="org.eclipse.debug.core" id="launchModes" name="Launch Modes"/>
7
      </appInfo>
7
      </appInfo>
8
      <documentation>
8
      <documentation>
9
         This extension point provides a mechanism for contributing launch modes to the debug platform. The debug platform defines modes for &quot;run&quot;, &quot;debug&quot;, and &quot;profile&quot;.
9
         This extension point provides a mechanism for contributing launch modes to the debug platform. The debug platform defines modes for &quot;run&quot;, &quot;debug&quot;, and &quot;profile&quot;.
10
      </documentation>
10
      </documentation>
11
   </annotation>
11
   </annotation>
12
12
13
   <element name="extension">
13
   <element name="extension">
14
      <complexType>
14
      <complexType>
15
         <sequence>
15
         <sequence>
16
            <element ref="launchMode" minOccurs="0" maxOccurs="unbounded"/>
16
            <element ref="launchMode" minOccurs="0" maxOccurs="unbounded"/>
17
         </sequence>
17
         </sequence>
18
         <attribute name="point" type="string" use="required">
18
         <attribute name="point" type="string" use="required">
19
            <annotation>
19
            <annotation>
20
               <documentation>
20
               <documentation>
21
                  a fully qualified identifier of the target extension point
21
                  a fully qualified identifier of the target extension point
22
               </documentation>
22
               </documentation>
23
            </annotation>
23
            </annotation>
24
         </attribute>
24
         </attribute>
25
         <attribute name="id" type="string">
25
      </complexType>
26
            <annotation>
26
   </element>
27
               <documentation>
27
28
                  an optional identifier of the extension instance
28
   <element name="launchMode">
29
               </documentation>
29
      <annotation>
30
            </annotation>
30
         <appInfo>
31
         </attribute>
31
            <meta.element labelAttribute="name"/>
32
         <attribute name="name" type="string">
32
         </appInfo>
33
            <annotation>
33
      </annotation>
34
               <documentation>
34
      <complexType>
35
                  an optional name of the extension instance
35
         <sequence>
36
               </documentation>
36
         </sequence>
37
            </annotation>
37
         <attribute name="mode" type="string" use="required">
38
         </attribute>
38
            <annotation>
39
      </complexType>
39
               <documentation>
40
   </element>
40
                  specifies a unique identifier for this launch mode. The launch modes contributed by the debug plaform are &quot;run&quot;, &quot;debug&quot;, and &quot;profile&quot;.
41
41
               </documentation>
42
   <element name="launchMode">
42
            </annotation>
43
      <annotation>
43
         </attribute>
44
         <appInfo>
44
         <attribute name="label" type="string" use="required">
45
            <meta.element labelAttribute="name"/>
45
            <annotation>
46
         </appInfo>
46
               <documentation>
47
      </annotation>
47
                  A human-readable label that describes the launch mode
48
      <complexType>
48
               </documentation>
49
         <sequence>
49
               <appInfo>
50
         </sequence>
50
                  <meta.attribute translatable="true"/>
51
         <attribute name="mode" type="string" use="required">
51
               </appInfo>
52
            <annotation>
52
            </annotation>
53
               <documentation>
53
         </attribute>
54
                  specifies a unique identifier for this launch mode. The launch modes contributed by the debug plaform are &quot;run&quot;, &quot;debug&quot;, and &quot;profile&quot;.
54
         <attribute name="launchAsLabel" type="string">
55
               </documentation>
55
            <annotation>
56
            </annotation>
56
               <documentation>
57
         </attribute>
57
                  A human-readable label to be used in a launch cascade menu. For example &quot;Run As&quot;. This attribute was added in 3.2 to allow the label to be properly externalized. When unspecified, a default label is created via concatenation.
58
         <attribute name="label" type="string" use="required">
58
               </documentation>
59
            <annotation>
59
               <appInfo>
60
               <documentation>
60
                  <meta.attribute translatable="true"/>
61
                  A human-readable label that describes the launch mode
61
               </appInfo>
62
               </documentation>
62
            </annotation>
63
               <appInfo>
63
         </attribute>
64
                  <meta.attribute translatable="true"/>
64
      </complexType>
65
               </appInfo>
65
   </element>
66
            </annotation>
66
67
         </attribute>
67
   <annotation>
68
         <attribute name="launchAsLabel" type="string">
68
      <appInfo>
69
            <annotation>
69
         <meta.section type="since"/>
70
               <documentation>
70
      </appInfo>
71
                  A human-readable label to be used in a launch cascade menu. For example &quot;Run As&quot;. This attribute was added in 3.2 to allow the label to be properly externalized. When unspecified, a default label is created via concatenation.
71
      <documentation>
72
               </documentation>
72
         3.0
73
               <appInfo>
73
      </documentation>
74
                  <meta.attribute translatable="true"/>
74
   </annotation>
75
               </appInfo>
75
76
            </annotation>
76
   <annotation>
77
         </attribute>
77
      <appInfo>
78
      </complexType>
78
         <meta.section type="examples"/>
79
   </element>
79
      </appInfo>
80
80
      <documentation>
81
   <annotation>
81
         The following is an example of a launch delegate extension point:
82
      <appInfo>
82
83
         <meta.section type="since"/>
83
&lt;p&gt;
84
      </appInfo>
84
&lt;pre&gt;
85
      <documentation>
85
 &lt;extension point=&quot;org.eclipse.debug.core.launchModes&quot;&gt;
86
         3.0
86
  &lt;launchMode
87
      </documentation>
87
   mode=&quot;profile&quot;
88
   </annotation>
88
   label=&quot;Profile&quot;&gt;
89
89
  &lt;/launchMode&gt;
90
   <annotation>
90
 &lt;/extension&gt;
91
      <appInfo>
91
&lt;/pre&gt;
92
         <meta.section type="examples"/>
92
&lt;/p&gt;
93
      </appInfo>
93
94
      <documentation>
94
In the example above, the profile launch mode is contributed.
95
         The following is an example of a launch delegate extension point:
95
      </documentation>
96
96
   </annotation>
97
&lt;p&gt;
97
98
&lt;pre&gt;
98
   <annotation>
99
 &lt;extension point=&quot;org.eclipse.debug.core.launchModes&quot;&gt;
99
      <appInfo>
100
  &lt;launchMode
100
         <meta.section type="apiInfo"/>
101
   mode=&quot;profile&quot;
101
      </appInfo>
102
   label=&quot;Profile&quot;&gt;
102
      <documentation>
103
  &lt;/launchMode&gt;
103
         
104
 &lt;/extension&gt;
104
      </documentation>
105
&lt;/pre&gt;
105
   </annotation>
106
&lt;/p&gt;
106
107
107
   <annotation>
108
In the example above, the profile launch mode is contributed.
108
      <appInfo>
109
      </documentation>
109
         <meta.section type="copyright"/>
110
   </annotation>
110
      </appInfo>
111
111
      <documentation>
112
   <annotation>
112
         Copyright (c) 2000, 2005 IBM Corporation and others.&lt;br&gt;
113
      <appInfo>
113
All rights reserved. This program and the accompanying materials are made 
114
         <meta.section type="apiInfo"/>
114
available under the terms of the Eclipse Public License v1.0 which 
115
      </appInfo>
115
accompanies this distribution, and is available at 
116
      <documentation>
116
&lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
117
         
117
      </documentation>
118
      </documentation>
118
   </annotation>
119
   </annotation>
119
120
120
</schema>
121
   <annotation>
122
      <appInfo>
123
         <meta.section type="copyright"/>
124
      </appInfo>
125
      <documentation>
126
         Copyright (c) 2000, 2005 IBM Corporation and others.&lt;br&gt;
127
All rights reserved. This program and the accompanying materials are made 
128
available under the terms of the Eclipse Public License v1.0 which 
129
accompanies this distribution, and is available at 
130
&lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
131
      </documentation>
132
   </annotation>
133
134
</schema>
(-)schema/launchConfigurationTypes.exsd (-3 / +46 lines)
Lines 60-81 Link Here
60
               </documentation>
60
               </documentation>
61
            </annotation>
61
            </annotation>
62
         </attribute>
62
         </attribute>
63
         <attribute name="delegate" type="string" use="required">
63
         <attribute name="delegate" type="string">
64
            <annotation>
64
            <annotation>
65
               <documentation>
65
               <documentation>
66
                  specifies the fully qualified name of the Java class that implements &lt;code&gt;ILaunchConfigurationDelegate&lt;/code&gt;.
66
                  specifies the fully qualified name of the Java class that implements &lt;code&gt;ILaunchConfigurationDelegate&lt;/code&gt;.
67
Launch configuration instances of this type will delegate to instances of this class to perform launching.
67
Launch configuration instances of this type will delegate to instances of this class to perform launching.
68
69
With new API changes for 3.3M3 the delegate should be contributed via the &lt;code&gt;launchDelegates&lt;/code&gt; extension point
70
&lt;p&gt;
71
&lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;. This attribute has been deprecated as
72
part of a work in progress. There is no guarantee that this API will
73
remain unchanged during the 3.3 release cycle. Please do not use this API
74
without consulting with the Platform/Debug team.
75
&lt;/p&gt;
68
               </documentation>
76
               </documentation>
69
               <appInfo>
77
               <appInfo>
70
                  <meta.attribute kind="java" basedOn="org.eclipse.debug.core.model.ILaunchConfigurationDelegate"/>
78
                  <meta.attribute kind="java" basedOn="org.eclipse.debug.core.model.ILaunchConfigurationDelegate" deprecated="true"/>
71
               </appInfo>
79
               </appInfo>
72
            </annotation>
80
            </annotation>
73
         </attribute>
81
         </attribute>
74
         <attribute name="modes" type="string" use="required">
82
         <attribute name="modes" type="string">
75
            <annotation>
83
            <annotation>
76
               <documentation>
84
               <documentation>
77
                  specifies a comma-separated list of the modes this type of lauch configuration supports - &quot;run&quot; and/or &quot;debug&quot;.
85
                  specifies a comma-separated list of the modes this type of lauch configuration supports - &quot;run&quot; and/or &quot;debug&quot;.
86
87
With new API changes for 3.3M3 the delegate should be contributed via the &lt;code&gt;launchDelegates&lt;/code&gt; extension point
88
89
&lt;p&gt;
90
&lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;. This attribute has been deprecated as
91
part of a work in progress. There is no guarantee that this API will
92
remain unchanged during the 3.3 release cycle. Please do not use this API
93
without consulting with the Platform/Debug team.
94
&lt;/p&gt;
78
               </documentation>
95
               </documentation>
96
               <appInfo>
97
                  <meta.attribute deprecated="true"/>
98
               </appInfo>
79
            </annotation>
99
            </annotation>
80
         </attribute>
100
         </attribute>
81
         <attribute name="name" type="string" use="required">
101
         <attribute name="name" type="string" use="required">
Lines 106-111 Link Here
106
            <annotation>
126
            <annotation>
107
               <documentation>
127
               <documentation>
108
                  The unique identifier of a sourcePathComputer extension that is used to compute a default source lookup path for launch configurations of this type. This atttribute was added in the 3.0 release.
128
                  The unique identifier of a sourcePathComputer extension that is used to compute a default source lookup path for launch configurations of this type. This atttribute was added in the 3.0 release.
129
130
With new API changes for 3.3M3 the sourcePathComputer id should be contributed via the &lt;code&gt;launchDelegates&lt;/code&gt; extension point
109
               </documentation>
131
               </documentation>
110
            </annotation>
132
            </annotation>
111
         </attribute>
133
         </attribute>
Lines 113-118 Link Here
113
            <annotation>
135
            <annotation>
114
               <documentation>
136
               <documentation>
115
                  The unique identifier of a sourceLocator extension that is used to create the source locator for sessions launched using launch configurations of this type. This atttribute was added in the 3.0 release.
137
                  The unique identifier of a sourceLocator extension that is used to create the source locator for sessions launched using launch configurations of this type. This atttribute was added in the 3.0 release.
138
139
With new API changes for 3.3M3 the sourceLocatorId id should be contributed via the &lt;code&gt;launchDelegates&lt;/code&gt; extension point
116
               </documentation>
140
               </documentation>
117
            </annotation>
141
            </annotation>
118
         </attribute>
142
         </attribute>
Lines 126-131 Link Here
126
               </appInfo>
150
               </appInfo>
127
            </annotation>
151
            </annotation>
128
         </attribute>
152
         </attribute>
153
         <attribute name="icon" type="string">
154
            <annotation>
155
               <documentation>
156
                  The id of the icon for this launch configuraiton type.
157
158
since 3.3
159
160
&lt;p&gt;
161
&lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;. This element has been added as
162
part of a work in progress. There is no guarantee that this API will
163
remain unchanged during the 3.3 release cycle. Please do not use this API
164
without consulting with the Platform/Debug team.
165
&lt;/p&gt;
166
               </documentation>
167
               <appInfo>
168
                  <meta.attribute kind="resource"/>
169
               </appInfo>
170
            </annotation>
171
         </attribute>
129
      </complexType>
172
      </complexType>
130
   </element>
173
   </element>
131
174
(-)schema/launchOptions.exsd (-9 / +7 lines)
Lines 8-13 Link Here
8
      <documentation>
8
      <documentation>
9
         This extension point is used to contribute launch options to the launch manager.
9
         This extension point is used to contribute launch options to the launch manager.
10
Launch options are used as modifiers when executing a launch configuration.
10
Launch options are used as modifiers when executing a launch configuration.
11
12
&lt;p&gt;&lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;. This method has been added as
13
part of a work in progress. There is no guarantee that this API will
14
remain unchanged during the 3.3 release cycle. Please do not use this API
15
without consulting with the Platform/Debug team.&lt;/p&gt;
11
      </documentation>
16
      </documentation>
12
   </annotation>
17
   </annotation>
13
18
Lines 67-79 Link Here
67
               </documentation>
72
               </documentation>
68
            </annotation>
73
            </annotation>
69
         </attribute>
74
         </attribute>
70
         <attribute name="option" type="string" use="required">
71
            <annotation>
72
               <documentation>
73
                  the name of the option itself, described as one word all lowercase e.g. debug
74
               </documentation>
75
            </annotation>
76
         </attribute>
77
      </complexType>
75
      </complexType>
78
   </element>
76
   </element>
79
77
Lines 101-107 Link Here
101
   &lt;/launchOption&gt;
99
   &lt;/launchOption&gt;
102
  &lt;/extension&gt;
100
  &lt;/extension&gt;
103
&lt;/pre&gt;
101
&lt;/pre&gt;
104
&lt;/p&gt;   
102
&lt;/p&gt;
105
      </documentation>
103
      </documentation>
106
   </annotation>
104
   </annotation>
107
105
Lines 128-134 Link Here
128
         <meta.section type="copyright"/>
126
         <meta.section type="copyright"/>
129
      </appInfo>
127
      </appInfo>
130
      <documentation>
128
      <documentation>
131
         Copyright (c) 2003, 2005 IBM Corporation and others.&lt;br&gt;
129
         Copyright (c) 2006 IBM Corporation and others.&lt;br&gt;
132
All rights reserved. This program and the accompanying materials are made 
130
All rights reserved. This program and the accompanying materials are made 
133
available under the terms of the Eclipse Public License v1.0 which 
131
available under the terms of the Eclipse Public License v1.0 which 
134
accompanies this distribution, and is available at 
132
accompanies this distribution, and is available at 
(-)schema/launchDelegates.exsd (-155 / +207 lines)
Lines 1-155 Link Here
1
<?xml version='1.0' encoding='UTF-8'?>
1
<?xml version='1.0' encoding='UTF-8'?>
2
<!-- Schema file written by PDE -->
2
<!-- Schema file written by PDE -->
3
<schema targetNamespace="org.eclipse.debug.core">
3
<schema targetNamespace="org.eclipse.debug.core">
4
<annotation>
4
<annotation>
5
      <appInfo>
5
      <appInfo>
6
         <meta.schema plugin="org.eclipse.debug.core" id="launchDelegates" name="Launch Delegates"/>
6
         <meta.schema plugin="org.eclipse.debug.core" id="launchDelegates" name="Launch Delegates"/>
7
      </appInfo>
7
      </appInfo>
8
      <documentation>
8
      <documentation>
9
         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.
9
         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.
10
      </documentation>
10
      </documentation>
11
   </annotation>
11
   </annotation>
12
12
13
   <element name="extension">
13
   <element name="extension">
14
      <complexType>
14
      <complexType>
15
         <sequence>
15
         <sequence>
16
            <element ref="launchDelegate" minOccurs="1" maxOccurs="unbounded"/>
16
            <element ref="launchDelegate" minOccurs="1" maxOccurs="unbounded"/>
17
         </sequence>
17
         </sequence>
18
         <attribute name="point" type="string" use="required">
18
         <attribute name="point" type="string" use="required">
19
            <annotation>
19
            <annotation>
20
               <documentation>
20
               <documentation>
21
                  a fully qualified identifier of the target extension point
21
                  a fully qualified identifier of the target extension point
22
               </documentation>
22
               </documentation>
23
            </annotation>
23
            </annotation>
24
         </attribute>
24
         </attribute>
25
         <attribute name="id" type="string">
25
         <attribute name="id" type="string">
26
            <annotation>
26
            <annotation>
27
               <documentation>
27
               <documentation>
28
                  an optional identifier of the extension instance
28
                  an optional identifier of the extension instance
29
               </documentation>
29
               </documentation>
30
            </annotation>
30
            </annotation>
31
         </attribute>
31
         </attribute>
32
         <attribute name="name" type="string">
32
         <attribute name="name" type="string">
33
            <annotation>
33
            <annotation>
34
               <documentation>
34
               <documentation>
35
                  an optional name of the extension instance
35
                  an optional name of the extension instance
36
               </documentation>
36
               </documentation>
37
            </annotation>
37
            </annotation>
38
         </attribute>
38
         </attribute>
39
      </complexType>
39
      </complexType>
40
   </element>
40
   </element>
41
41
42
   <element name="launchDelegate">
42
   <element name="launchDelegate">
43
      <annotation>
43
      <annotation>
44
         <appInfo>
44
         <appInfo>
45
            <meta.element labelAttribute="name"/>
45
            <meta.element labelAttribute="name"/>
46
         </appInfo>
46
         </appInfo>
47
      </annotation>
47
      </annotation>
48
      <complexType>
48
      <complexType>
49
         <sequence>
49
         <sequence minOccurs="0" maxOccurs="unbounded">
50
         </sequence>
50
         </sequence>
51
         <attribute name="id" type="string" use="required">
51
         <attribute name="id" type="string" use="required">
52
            <annotation>
52
            <annotation>
53
               <documentation>
53
               <documentation>
54
                  specifies a unique identifier for this launch delegate.
54
                  specifies a unique identifier for this launch delegate.
55
               </documentation>
55
               </documentation>
56
            </annotation>
56
            </annotation>
57
         </attribute>
57
         </attribute>
58
         <attribute name="delegate" type="string" use="required">
58
         <attribute name="name" type="string">
59
            <annotation>
59
            <annotation>
60
               <documentation>
60
               <documentation>
61
                  specifies the fully qualified name of the Java class that implements &lt;code&gt;ILaunchConfigurationDelegate&lt;/code&gt;.
61
                  specifies a human readable name for this delegate
62
Launch configuration instances of this delegate&apos;s type will delegate to instances of this class to perform launching.
62
63
               </documentation>
63
since 3.3M3
64
               <appInfo>
64
65
                  <meta.attribute kind="java" basedOn="org.eclipse.debug.core.model.ILaunchConfigurationDelegate"/>
65
&lt;p&gt;
66
               </appInfo>
66
&lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;. This attribute has been added as
67
            </annotation>
67
part of a work in progress. There is no guarantee that this API will
68
         </attribute>
68
remain unchanged during the 3.3 release cycle. Please do not use this API
69
         <attribute name="modes" type="string" use="required">
69
without consulting with the Platform/Debug team.
70
            <annotation>
70
&lt;/p&gt;
71
               <documentation>
71
               </documentation>
72
                  specifies a comma-separated list of the modes this lauch delegate supports.
72
               <appInfo>
73
               </documentation>
73
                  <meta.attribute translatable="true"/>
74
            </annotation>
74
               </appInfo>
75
         </attribute>
75
            </annotation>
76
         <attribute name="type" type="string" use="required">
76
         </attribute>
77
            <annotation>
77
         <attribute name="delegate" type="string" use="required">
78
               <documentation>
78
            <annotation>
79
                  identifier of an existing launch configuration type that this launch delegate is capable of launching.
79
               <documentation>
80
               </documentation>
80
                  specifies the fully qualified name of the Java class that implements &lt;code&gt;ILaunchConfigurationDelegate&lt;/code&gt;.
81
            </annotation>
81
Launch configuration instances of this delegate&apos;s type will delegate to instances of this class to perform launching.
82
         </attribute>
82
               </documentation>
83
         <attribute name="sourcePathComputerId" type="string">
83
               <appInfo>
84
            <annotation>
84
                  <meta.attribute kind="java" basedOn="org.eclipse.debug.core.model.ILaunchConfigurationDelegate"/>
85
               <documentation>
85
               </appInfo>
86
                  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.
86
            </annotation>
87
               </documentation>
87
         </attribute>
88
            </annotation>
88
         <attribute name="modes" type="string">
89
         </attribute>
89
            <annotation>
90
         <attribute name="sourceLocatorId" type="string">
90
               <documentation>
91
            <annotation>
91
                  specifies a comma-separated list of the modes this lauch delegate supports.
92
               <documentation>
92
               </documentation>
93
                  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.
93
            </annotation>
94
               </documentation>
94
         </attribute>
95
            </annotation>
95
         <attribute name="type" type="string">
96
         </attribute>
96
            <annotation>
97
      </complexType>
97
               <documentation>
98
   </element>
98
                  identifier of an existing launch configuration type that this launch delegate is capable of launching.
99
99
               </documentation>
100
   <annotation>
100
            </annotation>
101
      <appInfo>
101
         </attribute>
102
         <meta.section type="since"/>
102
         <attribute name="sourcePathComputerId" type="string">
103
      </appInfo>
103
            <annotation>
104
      <documentation>
104
               <documentation>
105
         3.0
105
                  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.
106
      </documentation>
106
               </documentation>
107
   </annotation>
107
            </annotation>
108
108
         </attribute>
109
   <annotation>
109
         <attribute name="sourceLocatorId" type="string">
110
      <appInfo>
110
            <annotation>
111
         <meta.section type="examples"/>
111
               <documentation>
112
      </appInfo>
112
                  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.
113
      <documentation>
113
               </documentation>
114
         The following is an example of a launch delegate extension point:
114
            </annotation>
115
115
         </attribute>
116
&lt;p&gt;
116
         <attribute name="options" type="string">
117
&lt;pre&gt;
117
            <annotation>
118
 &lt;extension point=&quot;org.eclipse.debug.core.launchDelegates&quot;&gt;
118
               <documentation>
119
  &lt;launchDelegate
119
                  This attribute allows contributors to sepcify what options this delegate can apply to other than the specified modes
120
   id=&quot;com.example.ExampleProfileDelegate&quot;
120
121
   delegate=&quot;com.example.ExampleProfileDelegate&quot;
121
since 3.3M3
122
   type=&quot;org.eclipse.jdt.launching.localJavaApplication&quot;
122
123
   modes=&quot;profile&quot;&gt;
123
&lt;p&gt;
124
  &lt;/launchDelegate&gt;
124
&lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;. This attribute has been added as
125
 &lt;/extension&gt;
125
part of a work in progress. There is no guarantee that this API will
126
&lt;/pre&gt;
126
remain unchanged during the 3.3 release cycle. Please do not use this API
127
&lt;/p&gt;
127
without consulting with the Platform/Debug team.
128
128
&lt;/p&gt;
129
In the example above, the specified launch delegate is contributed to launch Java applications in profile mode.
129
               </documentation>
130
      </documentation>
130
            </annotation>
131
   </annotation>
131
         </attribute>
132
132
      </complexType>
133
   <annotation>
133
   </element>
134
      <appInfo>
134
135
         <meta.section type="apiInfo"/>
135
   <annotation>
136
      </appInfo>
136
      <appInfo>
137
      <documentation>
137
         <meta.section type="since"/>
138
         Value of the attribute &lt;b&gt;delegate&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.debug.core.model.ILaunchConfigurationDelegate&lt;/b&gt;.
138
      </appInfo>
139
      </documentation>
139
      <documentation>
140
   </annotation>
140
         3.0
141
141
      </documentation>
142
   <annotation>
142
   </annotation>
143
      <appInfo>
143
144
         <meta.section type="copyright"/>
144
   <annotation>
145
      </appInfo>
145
      <appInfo>
146
      <documentation>
146
         <meta.section type="examples"/>
147
         Copyright (c) 2000, 2005 IBM Corporation and others.&lt;br&gt;
147
      </appInfo>
148
All rights reserved. This program and the accompanying materials are made 
148
      <documentation>
149
available under the terms of the Eclipse Public License v1.0 which 
149
         The following is an example of a launch delegate extension point:
150
accompanies this distribution, and is available at 
150
151
&lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
151
&lt;p&gt;
152
      </documentation>
152
&lt;pre&gt;
153
   </annotation>
153
 &lt;extension point=&quot;org.eclipse.debug.core.launchDelegates&quot;&gt;
154
154
  &lt;launchDelegate
155
</schema>
155
   id=&quot;com.example.ExampleProfileDelegate&quot;
156
   delegate=&quot;com.example.ExampleProfileDelegate&quot;
157
   type=&quot;org.eclipse.jdt.launching.localJavaApplication&quot;
158
   modes=&quot;profile&quot;&gt;
159
  &lt;/launchDelegate&gt;
160
 &lt;/extension&gt;
161
&lt;/pre&gt;
162
&lt;/p&gt;
163
164
In the example above, the specified launch delegate is contributed to launch Java applications in profile mode.
165
166
The previous example has been deprecated as of 3.3M3, but left in for brevity. See the following example for new usage.
167
168
&lt;p&gt;
169
&lt;pre&gt;
170
&lt;extension point=&quot;org.eclipse.debug.core.launchDelegates&quot;&gt;
171
      &lt;launchDelegate
172
            delegate=&quot;org.eclipse.jdt.launching.JavaLaunchDelegate&quot;
173
            id=&quot;org.eclipse.jdt.launching.JavaLaunchDelegate&quot;
174
            type=&quot;org.eclipse.jdt.launching.localJavaApplication&quot;
175
      modes=&quot;profile&quot;&gt;
176
      &lt;/launchDelegate&gt;
177
   &lt;/extension&gt;   
178
&lt;/pre&gt;
179
&lt;/p&gt;
180
181
In 3.3 mode-based launching has been deprecated, and in its place we have provided launching with options. Options are contributed via the &lt;code&gt;launchOptions&lt;/code&gt; 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.
182
      </documentation>
183
   </annotation>
184
185
   <annotation>
186
      <appInfo>
187
         <meta.section type="apiInfo"/>
188
      </appInfo>
189
      <documentation>
190
         Value of the attribute &lt;b&gt;delegate&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.debug.core.model.ILaunchConfigurationDelegate&lt;/b&gt;.
191
      </documentation>
192
   </annotation>
193
194
   <annotation>
195
      <appInfo>
196
         <meta.section type="copyright"/>
197
      </appInfo>
198
      <documentation>
199
         Copyright (c) 2000, 2005 IBM Corporation and others.&lt;br&gt;
200
All rights reserved. This program and the accompanying materials are made 
201
available under the terms of the Eclipse Public License v1.0 which 
202
accompanies this distribution, and is available at 
203
&lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
204
      </documentation>
205
   </annotation>
206
207
</schema>
(-)buildnotes_platform-debug.html (-5 / +36 lines)
Lines 20-32 Link Here
20
  <li>deprecated <code>IDebugUIConstants.ATTR_CONSOLE_ENCODING</code>.</li>
20
  <li>deprecated <code>IDebugUIConstants.ATTR_CONSOLE_ENCODING</code>.</li>
21
  <li>added <code>DebugUITools.getLastLaunch(String id)</code> - provides access to the last launch in
21
  <li>added <code>DebugUITools.getLastLaunch(String id)</code> - provides access to the last launch in
22
   each launch group.</li>
22
   each launch group.</li>
23
   <li>Add <code>launchOptions</code> schema -- provides a new mechanism for providing launch options to the launching framework</li>
24
   <li>Added <code>ILaunchOption</code> -- which describes a single contributed launch option within the launch manager</li>
25
   <li>Added <code>ILaunchManager.getLaunchOptions()</code> -- returns and array of all of the <code>ILaunchOptions</code> registered with the launch manager</li>
26
   <li>Added <code>ILaunchManager.getLaunchOption(String id)</code> -- returns the <code>ILaunchOption</code> associated with the given unique id, or <code>null</code></li>
27
</ul>
23
</ul>
28
24
29
<h2>Oct 3, 2006</h2>
25
<h2>Summary of Launch Option conversion changes in 3.3</h2>
26
<ul>
27
<li>Added <code>launchOptions</code> schema -- provides a new mechanism for providing launch options to the launching framework</li>
28
   <li>Added interface/class <code>ILaunchOption</code> -- which describes a single contributed launch option within the launch manager</li>
29
   <li>Added method <code>ILaunchManager.getLaunchOptions()</code> -- returns and array of all of the <code>ILaunchOptions</code> registered with the launch manager</li>
30
   <li>Added method <code>ILaunchManager.getLaunchOption(String id)</code> -- returns the <code>ILaunchOption</code> associated with the given unique id, or <code>null</code></li>
31
   <li>Added interface/class <code>ILaunchOption</code> -- which describes a single contributed launch option within the launch manager</li>
32
   <li>Added method <code>ILaunchConfiguration.getOptions()</code> -- returns the comma seperated listiong of options</li>
33
   <li>Added method <code>ILaunchConfigurationWorkingCopy.setOptions(String[] options)</code> -- allows the options to be set in the launch configuration</li>
34
   <li>Added method <code>ILaunchManager.getLaunchDelegates()</code> -- returns all of the registered launch delegates</li>
35
   <li>Added method <code>ILaunchManager.getLaunchDelegates(String typeid, String mode, String[] options)</code> -- returns the 
36
   list of delegates that apply to the the specifed mode, config type id and options (if any)</li>
37
   <li>Added constant <code>ATTR_LAUNCH_OPTIONS</code> to <code>LaunchConfiguration</code></li>
38
   <li>Added method <code>ILaunchConfigurationType.getContributorName()</code> -- returns the name of the contributor of the type</li>
39
   <li>Added method <code>ILaunchConfigurationType.getImageDescriptorPath()</code> -- returns the path of the image descriptor (if provided)</li>
40
   <li>Added method <code>ILaunchConfigurationType.getDelegate(String mode, String[] options)</code> -- returns the launch delegate for the specified mode and options</li>
41
   <li>Added class <code>ConfigurationElementConstants</code> -- contains common constants for getting child elements of <code>IConfigurationElements</code> 
42
   <li>Added internal method <code>LaunchManager.initializeLaunchDelegates()</code> -- loads the listing of delegates</li>
43
   <li>Added internal method <code>LaunchManager.initializeLaunchOptions()</code> -- loads the listing of launch options</li>
44
   <li>Deprecated method <code>ILaunchConfigurationType.getDelegate(String mode)</code> -- in favour of the new <code>getDelegate(String mode, String[] options) method</code></li>
45
   <li>Deprecated attribute 'delegate' in <code>launchConfigurationTypes</code> schema, in favour of contributing delegates via the <code>launchDelegates</code> extension point</li>
46
   <li>Deprecated attribute 'modes' in <code>launchConfigurationTypes</code> schema, in favour of contributing modes via the <code>launchDelegates</code> extension point</li>
47
   <li>Deprecated attribute 'sourcePathComputerId' in <code>launchConfigurationTypes</code> schema, in favour of contributing it via the <code>launchDelegates</code> extension point</li>
48
   <li>Deprecated attribute 'sourceLocatorId' in <code>launchConfigurationTypes</code> schema, in favour of contributing it via the <code>launchDelegates</code> extension point</li>
49
   <li>Added attrbute 'icon' in <code>launchConfigurationTypes</code> schema, in favour of contributing a seperate extension <code>launchConfigurationTypeImages</code></li>
50
   <li>Added attribute 'name' to the <code>launchDelegates</code> schema, providing a human readable name for the delegate. To be used in duplicate resolution</li>
51
   <li>Added attribute 'options' to the <code>launchDelegates</code> schema, providing the ability to specify launch options that this delegate can support</li>
52
   <li>Added interface/class <code>ILaunchConfigurationTabExtension</code> -- provides a proxy to a contributed tab <code>IConfigurationElement</code> element</li>
53
   <li>Added internal method <code>LauncConfigurationPtresentationManager.initializeContributedTabExtensions</code> -- loads contributed tabs</li>
54
   <li>Added method <code>LaunchConfigurationPresentationManager.createContributedTabs(String groupid)</code> -- lazily creates the tabs for a specified tabgroup id</li>
55
   <li>Added constant <code>EXTENSION_POINT_CONTRIBUTED_LAUNCH_TABS</code> to <code>IDebugUIConstants</code></li>
56
   <li>Added class <code>LaunchConfigurationTabGroupWrapper</code> -- which is used to wrap an existing tab group with its contributed tabs</li>
57
   <li>Deprecated <code>launchConfigurationTypeImages</code> extension point</li>
58
</ul>
59
60
h2>Oct 3, 2006</h2>
30
<h3>Problem Reports Fixed</h3>
61
<h3>Problem Reports Fixed</h3>
31
<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=158760">158760</a>: Warning in latest nightly build and integration build<br>
62
<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=158760">158760</a>: Warning in latest nightly build and integration build<br>
32
63
(-)plugin.xml (-3 / +2 lines)
Lines 164-172 Link Here
164
   <extension
164
   <extension
165
         point="org.eclipse.debug.core.launchOptions">
165
         point="org.eclipse.debug.core.launchOptions">
166
      <launchOption
166
      <launchOption
167
            id="org.eclipse.debug.core.debug"
167
            id="debug"
168
            label="Debug"
168
            label="Debug">
169
            option="debug">
170
      </launchOption>
169
      </launchOption>
171
   </extension>   
170
   </extension>   
172
171
(-)core/org/eclipse/debug/internal/core/IConfigurationElementConstants.java (+118 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.debug.internal.core;
12
13
/**
14
 * This interface provides a repository for the names of <code>IConfigurationElement</code> child node ids.
15
 * @since 3.3
16
 */
17
public interface IConfigurationElementConstants {
18
19
	/**
20
	 * The id node name for a configuration element
21
	 */
22
	public static final String ID = "id"; //$NON-NLS-1$
23
	
24
	/**
25
	 * the name node name for a configuration element
26
	 */
27
	public static final String NAME = "name"; //$NON-NLS-1$
28
	
29
	/**
30
	 * the category node name for a configuration element
31
	 */
32
	public static final String CATEGORY = "category"; //$NON-NLS-1$
33
	
34
	/**
35
	 * the launchMode node name for a configuration element
36
	 */
37
	public static final String LAUNCH_MODE = "launchMode"; //$NON-NLS-1$
38
	
39
	/**
40
	 * the label node name for a configuration element
41
	 */
42
	public static final String LABEL = "label"; //$NON-NLS-1$
43
	
44
	/**
45
	 * the description node name for a configuration element
46
	 */
47
	public static final String DESCRIPTION = "description"; //$NON-NLS-1$
48
	
49
	/**
50
	 * the helpContextId node name for a configuration element
51
	 */
52
	public static final String HELP_CONTEXT_ID = "helpContextId"; //$NON-NLS-1$
53
	
54
	/**
55
	 * the icon node name for a configuration element
56
	 */
57
	public static final String ICON = "icon"; //$NON-NLS-1$
58
	
59
	/**
60
	 * the public node name for a configuration element
61
	 */
62
	public static final String PUBLIC = "public"; //$NON-NLS-1$
63
	
64
	/**
65
	 * the perspective node name for a configuration element
66
	 */
67
	public static final String PERSPECTIVE = "perspective"; //$NON-NLS-1$
68
	
69
	/**
70
	 * the modes node name for a configuration element
71
	 */
72
	public static final String MODES = "modes"; //$NON-NLS-1$
73
	
74
	/**
75
	 * the mode node name for a configuration element
76
	 */
77
	public static final String MODE = "mode"; //$NON-NLS-1$
78
	
79
	/**
80
	 * the type node name for a configuration element
81
	 */
82
	public static final String TYPE = "type"; //$NON-NLS-1$
83
	
84
	/**
85
	 * the option node name for a configuration element
86
	 */
87
	public static final String OPTIONS = "options"; //$NON-NLS-1$
88
	
89
	/**
90
	 * the delegate node name for a configuration element
91
	 */
92
	public static final String DELEGATE = "delegate"; //$NON-NLS-1$
93
	
94
	/**
95
	 * the group node name for a configuration element
96
	 */
97
	public static final String GROUP = "group"; //$NON-NLS-1$
98
	
99
	/**
100
	 * the class node name for a configuration element
101
	 */
102
	public static final String CLASS = "class"; //$NON-NLS-1$
103
	
104
	/**
105
	 * the sourcePathComputerId node name for a configuration element
106
	 */
107
	public static final String SOURCE_PATH_COMPUTER = "sourcePathComputerId"; //$NON-NLS-1$
108
	
109
	/**
110
	 * the sourceLocatorId node name for a configuration element
111
	 */
112
	public static final String SOURCE_LOCATOR = "sourceLocatorId"; //$NON-NLS-1$
113
	
114
	/**
115
	 * the migrationDelegate node name for a configuration element
116
	 */
117
	public static final String MIGRATION_DELEGATE = "migrationDelegate";  //$NON-NLS-1$
118
}
(-)core/org/eclipse/debug/internal/core/LaunchDelegate.java (+190 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.debug.internal.core;
12
13
import java.util.HashSet;
14
import java.util.Set;
15
16
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.core.runtime.IConfigurationElement;
18
import org.eclipse.core.runtime.IStatus;
19
import org.eclipse.core.runtime.Status;
20
import org.eclipse.debug.core.DebugPlugin;
21
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
22
23
import com.ibm.icu.text.MessageFormat;
24
25
/**
26
 * Proxy to a launch delegate extension
27
 * Clients can contribute launch delegates through the <code>launchDelegates</code> extension point
28
 * 
29
 * Example contribution of the local java launch delegate
30
 * <pre>
31
 * <extension point="org.eclipse.debug.core.launchDelegates">
32
      <launchDelegate
33
            delegate="org.eclipse.jdt.launching.JavaLaunchDelegate"
34
            id="org.eclipse.jdt.launching.localJavaApplicationDelegate"
35
            modes="run, debug"
36
            name="%localJavaApplication"
37
            type="org.eclipse.jdt.launching.localJavaApplication">
38
      </launchDelegate>
39
 * </pre>
40
 * 
41
 * Clients are NOT intended to subclass this class
42
 * 
43
 * @since 3.3
44
 */
45
public final class LaunchDelegate {
46
	
47
	/**
48
	 * The configuration element for this delegate
49
	 */
50
	private IConfigurationElement fElement = null;
51
	
52
	/**
53
	 * The cached delegate. Remains null until asked for, then persisted
54
	 */
55
	private ILaunchConfigurationDelegate fDelegate = null;
56
	
57
	//lists of cached entries
58
	private HashSet fModes = null;
59
	private HashSet fOptions = null;
60
	private String fType = null;
61
	
62
	/**
63
	 * Constructor
64
	 * @param element the configuration element to associate with this launch delegate
65
	 */
66
	public LaunchDelegate(IConfigurationElement element) {
67
		fElement = element;
68
	}
69
	
70
	/**
71
	 * Returns the actual instance of the launch delegate specified 
72
	 * @return the launch delegate
73
	 */
74
	public ILaunchConfigurationDelegate getDelegate() throws CoreException {
75
		if(fDelegate == null) {
76
			Object obj = fElement.createExecutableExtension(IConfigurationElementConstants.DELEGATE);
77
			if(obj instanceof ILaunchConfigurationDelegate) {
78
				return (ILaunchConfigurationDelegate)obj;
79
			}
80
			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));
81
		}
82
		return fDelegate;
83
	}
84
85
	/**
86
	 * @return returns the unique id of the delegate
87
	 */
88
	public String getIdentifier() {
89
		return fElement.getAttribute(IConfigurationElementConstants.ID);
90
	}
91
92
	/**
93
	 * Returns the id of the associated <code>ILaunchConfigurationType</code> or <code>null</code> if none provided
94
	 * @return the id of the <code>ILaunchConfigurationType</code> associated with this delegate
95
	 */
96
	public String getLaunchConfigurationType() {
97
		if(fType == null) {
98
			//fall back to single association if no appliesTo
99
			fType = fElement.getAttribute(IConfigurationElementConstants.TYPE);
100
			if(fType == null) {
101
				//the case when we have passed a launch configuration type to the launch delegate
102
				fType = fElement.getAttribute(IConfigurationElementConstants.ID);
103
			}
104
		}
105
		return fType;
106
	}
107
108
	/**
109
	 * Returns the set of options provided to by this delegate
110
	 * @return the options associated with this delegate. If no options are specified an empty set is
111
	 * returned, never <code>null</code>.
112
	 */
113
	public Set getOptions() {
114
		if(fOptions == null) {
115
			fOptions = new HashSet();
116
			String option = fElement.getAttribute(IConfigurationElementConstants.OPTIONS);
117
			if(option != null) {
118
				String[] options = option.split(","); //$NON-NLS-1$
119
				for(int i = 0; i < options.length; i++) {
120
					fOptions.add(options[i].trim());
121
				}
122
			}
123
		}
124
		return fOptions;
125
	}
126
	
127
	/**
128
	 * This method is provided as a backward compatibility measure to allow access to modes, if mode-based
129
	 * launching is still being used.
130
	 * 
131
	 * @return a set of modes for this delegate or the empty set if none are found, never <code>null</code>.
132
	 */
133
	public Set getModes() {
134
		if (fModes == null) {
135
			fModes = new HashSet();
136
			String modes = fElement.getAttribute(IConfigurationElementConstants.MODES); 
137
			if (modes != null) {
138
				String[] strings = modes.split(","); //$NON-NLS-1$
139
				for (int i = 0; i < strings.length; i++) {
140
					fModes.add(strings[i].trim());
141
				}
142
			}
143
		}
144
		return fModes;
145
	}
146
	
147
	/**
148
	 * Returns the human readable name for this launch delegate
149
	 * @return the human readable name for this launch delegate, or <code>null</code> if none
150
	 */
151
	public String getName() {
152
		return fElement.getAttribute(IConfigurationElementConstants.NAME);
153
	}
154
	
155
	/**
156
	 * Returns the associated source locator id or <code>null</code>
157
	 * @return the associated source locator id or <code>null</code> if not provided
158
	 */
159
	public String getSourceLocatorId() {
160
		return fElement.getAttribute(IConfigurationElementConstants.SOURCE_LOCATOR);
161
	}
162
163
	/**
164
	 * Returns the associated source path computer id or <code>null</code>
165
	 * @return the associated source path computer id or <code>null</code> if not provided
166
	 */
167
	public String getSourcePathComputerId() {
168
		return fElement.getAttribute(IConfigurationElementConstants.SOURCE_PATH_COMPUTER);
169
	}
170
171
	/**
172
	 * Determines if the delegate applies to the specified launch configuration type via its id only (no expression evaluation is done)
173
	 * @param configtypeId the id of the <code>ILaunchConfigurationType</code>.
174
	 * @return true if the delegate applies to the associated config type, false otherwise
175
	 */
176
	public boolean appliesTo(String configtypeId) {
177
		return getLaunchConfigurationType().equals(configtypeId);
178
	}
179
	
180
	/**
181
	 * Determines if the delegate applies to the specified launch configuration type via its id and mode (no expression evaluation is done)
182
	 * @param configtypeId the id of the <code>ILaunchConfigurationType</code>.
183
	 * @param mode the mode
184
	 * @return true if the delegate applies to the associated config type, false otherwise
185
	 */
186
	public boolean appliesTo(String configtypeId, String mode) {
187
		return getLaunchConfigurationType().equals(configtypeId) & getModes().contains(mode);
188
	}
189
190
}

Return to bug 157059