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

(-)schema/launchDelegates.exsd (-3 / +187 lines)
Lines 46-52 Link Here
46
         </appInfo>
46
         </appInfo>
47
      </annotation>
47
      </annotation>
48
      <complexType>
48
      <complexType>
49
         <sequence>
49
         <sequence minOccurs="0" maxOccurs="unbounded">
50
            <element ref="appliesTo"/>
50
         </sequence>
51
         </sequence>
51
         <attribute name="id" type="string" use="required">
52
         <attribute name="id" type="string" use="required">
52
            <annotation>
53
            <annotation>
Lines 55-60 Link Here
55
               </documentation>
56
               </documentation>
56
            </annotation>
57
            </annotation>
57
         </attribute>
58
         </attribute>
59
         <attribute name="name" type="string">
60
            <annotation>
61
               <documentation>
62
                  specifies a human readable name for this delegate
63
64
since 3.3M3
65
66
&lt;p&gt;
67
&lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;. This attribute has been added as
68
part of a work in progress. There is no guarantee that this API will
69
remain unchanged during the 3.3 release cycle. Please do not use this API
70
without consulting with the Platform/Debug team.
71
&lt;/p&gt;
72
               </documentation>
73
               <appInfo>
74
                  <meta.attribute translatable="true"/>
75
               </appInfo>
76
            </annotation>
77
         </attribute>
58
         <attribute name="delegate" type="string" use="required">
78
         <attribute name="delegate" type="string" use="required">
59
            <annotation>
79
            <annotation>
60
               <documentation>
80
               <documentation>
Lines 66-83 Link Here
66
               </appInfo>
86
               </appInfo>
67
            </annotation>
87
            </annotation>
68
         </attribute>
88
         </attribute>
69
         <attribute name="modes" type="string" use="required">
89
         <attribute name="modes" type="string">
70
            <annotation>
90
            <annotation>
71
               <documentation>
91
               <documentation>
72
                  specifies a comma-separated list of the modes this lauch delegate supports.
92
                  specifies a comma-separated list of the modes this lauch delegate supports.
93
94
Deprecated for 3.3M3. Instead make use of appliesTo and option expressions.
95
96
&lt;p&gt;
97
&lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;. This attribute has been deprecated as
98
part of a work in progress. There is no guarantee that this API will
99
remain unchanged during the 3.3 release cycle. Please do not use this API
100
without consulting with the Platform/Debug team.
101
&lt;/p&gt;
73
               </documentation>
102
               </documentation>
103
               <appInfo>
104
                  <meta.attribute deprecated="true"/>
105
               </appInfo>
74
            </annotation>
106
            </annotation>
75
         </attribute>
107
         </attribute>
76
         <attribute name="type" type="string" use="required">
108
         <attribute name="type" type="string">
77
            <annotation>
109
            <annotation>
78
               <documentation>
110
               <documentation>
79
                  identifier of an existing launch configuration type that this launch delegate is capable of launching.
111
                  identifier of an existing launch configuration type that this launch delegate is capable of launching.
112
113
Deprecated for 3.3M3. Instead use appliesTo to indicate what launch configuration type this delegate can launch
114
115
&lt;p&gt;
116
&lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;. This attribute has been deprecated as
117
part of a work in progress. There is no guarantee that this API will
118
remain unchanged during the 3.3 release cycle. Please do not use this API
119
without consulting with the Platform/Debug team.
120
&lt;/p&gt;
80
               </documentation>
121
               </documentation>
122
               <appInfo>
123
                  <meta.attribute deprecated="true"/>
124
               </appInfo>
81
            </annotation>
125
            </annotation>
82
         </attribute>
126
         </attribute>
83
         <attribute name="sourcePathComputerId" type="string">
127
         <attribute name="sourcePathComputerId" type="string">
Lines 97-102 Link Here
97
      </complexType>
141
      </complexType>
98
   </element>
142
   </element>
99
143
144
   <element name="appliesTo">
145
      <annotation>
146
         <documentation>
147
            The appliesTo node abstracts the type parameter from the delegate definition itself. this way we can simply have a listing of type that this delegate applies to defined with the delegate, removing the need for multiple launch delegate declarations for different launch configuration types.
148
149
&lt;p&gt;
150
&lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;. This element has been added as
151
part of a work in progress. There is no guarantee that this API will
152
remain unchanged during the 3.3 release cycle. Please do not use this API
153
without consulting with the Platform/Debug team.
154
&lt;/p&gt;
155
         </documentation>
156
      </annotation>
157
      <complexType>
158
         <sequence>
159
            <choice>
160
               <element ref="and"/>
161
               <element ref="or"/>
162
            </choice>
163
         </sequence>
164
         <attribute name="type" type="string" use="required">
165
            <annotation>
166
               <documentation>
167
                  refers to the unique id of the launch configuration type this delegate can launch
168
               </documentation>
169
            </annotation>
170
         </attribute>
171
      </complexType>
172
   </element>
173
174
   <element name="and">
175
      <annotation>
176
         <documentation>
177
            A node indicating all child elements should be iterated over and anded together in a boolean expression
178
179
&lt;p&gt;
180
&lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;. This element has been added as
181
part of a work in progress. There is no guarantee that this API will
182
remain unchanged during the 3.3 release cycle. Please do not use this API
183
without consulting with the Platform/Debug team.
184
&lt;/p&gt;
185
         </documentation>
186
      </annotation>
187
      <complexType>
188
         <sequence minOccurs="1" maxOccurs="unbounded">
189
            <choice>
190
               <element ref="option"/>
191
               <element ref="or"/>
192
            </choice>
193
         </sequence>
194
      </complexType>
195
   </element>
196
197
   <element name="or">
198
      <annotation>
199
         <documentation>
200
            A node indicating that all elements should be iterated over and ored together in a boolean expression
201
202
&lt;p&gt;
203
&lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;. This element has been added as
204
part of a work in progress. There is no guarantee that this API will
205
remain unchanged during the 3.3 release cycle. Please do not use this API
206
without consulting with the Platform/Debug team.
207
&lt;/p&gt;
208
         </documentation>
209
      </annotation>
210
      <complexType>
211
         <sequence minOccurs="1" maxOccurs="unbounded">
212
            <choice>
213
               <element ref="option"/>
214
               <element ref="and"/>
215
            </choice>
216
         </sequence>
217
      </complexType>
218
   </element>
219
220
   <element name="option">
221
      <annotation>
222
         <documentation>
223
            A node that describes the option to be associated with the type this delegate applies to. The &apos;option&apos; field is from the launch option contribution
224
225
&lt;p&gt;
226
&lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;. This element has been added as
227
part of a work in progress. There is no guarantee that this API will
228
remain unchanged during the 3.3 release cycle. Please do not use this API
229
without consulting with the Platform/Debug team.
230
&lt;/p&gt;
231
         </documentation>
232
      </annotation>
233
      <complexType>
234
         <attribute name="option" type="string" use="required">
235
            <annotation>
236
               <documentation>
237
                  the option field from the launch option contribution that this delegate applies to
238
               </documentation>
239
            </annotation>
240
         </attribute>
241
      </complexType>
242
   </element>
243
100
   <annotation>
244
   <annotation>
101
      <appInfo>
245
      <appInfo>
102
         <meta.section type="since"/>
246
         <meta.section type="since"/>
Lines 127-132 Link Here
127
&lt;/p&gt;
271
&lt;/p&gt;
128
272
129
In the example above, the specified launch delegate is contributed to launch Java applications in profile mode.
273
In the example above, the specified launch delegate is contributed to launch Java applications in profile mode.
274
275
The previous example has been deprecated as of 3.3M3, but left in for brevity. See the following example for new usage.
276
277
&lt;p&gt;
278
&lt;pre&gt;
279
&lt;extension point=&quot;org.eclipse.debug.core.launchDelegates&quot;&gt;
280
      &lt;launchDelegate
281
            delegate=&quot;org.eclipse.jdt.launching.JavaLaunchDelegate&quot;
282
            id=&quot;org.eclipse.jdt.launching.JavaLaunchDelegate&quot;&gt;
283
         &lt;appliesTo type=&quot;org.eclipse.jdt.launching.localJavaApplication&quot;&gt;
284
             &lt;or&gt;
285
               &lt;option option=&quot;debug&quot;/&gt;
286
            &lt;/or&gt;
287
         &lt;/appliesTo&gt;
288
      &lt;/launchDelegate&gt;
289
   &lt;/extension&gt;   
290
&lt;/pre&gt;
291
&lt;/p&gt;
292
293
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.
294
295
For example if you had a delegate that could support debugging and tracing or debugging and profiling your appliesTo section might look like the following:
296
297
&lt;p&gt;
298
&lt;pre&gt;
299
...
300
&lt;appliesTo type=&quot;org.eclipse.jdt.launching.localJavaApplication&quot;&gt;
301
  &lt;and&gt;
302
    &lt;option option=&quot;debug&quot;/&gt;
303
    &lt;or&gt;
304
      &lt;option option=&quot;tracing&quot;/&gt;
305
      &lt;option option=&quot;profiling&quot;/&gt;
306
    &lt;/or&gt;
307
  &lt;/and&gt;
308
&lt;/appliesTo&gt;
309
...
310
&lt;/pre&gt;
311
&lt;/p&gt;
312
313
With the seperation of the type from the delegate definition itself, you can now specify that this one delegate applies to more than one launch configuration type without having to redefine it for each type. Furthermore, each launch configuration type that you specify can have its own independent expression for options.
130
      </documentation>
314
      </documentation>
131
   </annotation>
315
   </annotation>
132
316
(-)schema/launchModes.exsd (-2 / +17 lines)
Lines 7-16 Link Here
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
11
&lt;p&gt;
12
&lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;. This extension point has been deprecated 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.
16
&lt;/p&gt;
10
      </documentation>
17
      </documentation>
11
   </annotation>
18
   </annotation>
12
19
13
   <element name="extension">
20
   <element name="extension">
21
      <annotation>
22
         <appInfo>
23
            <meta.element deprecated="true"/>
24
         </appInfo>
25
      </annotation>
14
      <complexType>
26
      <complexType>
15
         <sequence>
27
         <sequence>
16
            <element ref="launchMode" minOccurs="0" maxOccurs="unbounded"/>
28
            <element ref="launchMode" minOccurs="0" maxOccurs="unbounded"/>
Lines 53-58 Link Here
53
               <documentation>
65
               <documentation>
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;.
66
                  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;.
55
               </documentation>
67
               </documentation>
68
               <appInfo>
69
                  <meta.attribute deprecated="true"/>
70
               </appInfo>
56
            </annotation>
71
            </annotation>
57
         </attribute>
72
         </attribute>
58
         <attribute name="label" type="string" use="required">
73
         <attribute name="label" type="string" use="required">
Lines 61-67 Link Here
61
                  A human-readable label that describes the launch mode
76
                  A human-readable label that describes the launch mode
62
               </documentation>
77
               </documentation>
63
               <appInfo>
78
               <appInfo>
64
                  <meta.attribute translatable="true"/>
79
                  <meta.attribute translatable="true" deprecated="true"/>
65
               </appInfo>
80
               </appInfo>
66
            </annotation>
81
            </annotation>
67
         </attribute>
82
         </attribute>
Lines 71-77 Link Here
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.
86
                  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.
72
               </documentation>
87
               </documentation>
73
               <appInfo>
88
               <appInfo>
74
                  <meta.attribute translatable="true"/>
89
                  <meta.attribute translatable="true" deprecated="true"/>
75
               </appInfo>
90
               </appInfo>
76
            </annotation>
91
            </annotation>
77
         </attribute>
92
         </attribute>
(-)schema/launchConfigurationTypes.exsd (-3 / +39 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
&lt;p&gt;
70
&lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;. This attribute has been deprecated as
71
part of a work in progress. There is no guarantee that this API will
72
remain unchanged during the 3.3 release cycle. Please do not use this API
73
without consulting with the Platform/Debug team.
74
&lt;/p&gt;
68
               </documentation>
75
               </documentation>
69
               <appInfo>
76
               <appInfo>
70
                  <meta.attribute kind="java" basedOn="org.eclipse.debug.core.model.ILaunchConfigurationDelegate"/>
77
                  <meta.attribute kind="java" basedOn="org.eclipse.debug.core.model.ILaunchConfigurationDelegate" deprecated="true"/>
71
               </appInfo>
78
               </appInfo>
72
            </annotation>
79
            </annotation>
73
         </attribute>
80
         </attribute>
74
         <attribute name="modes" type="string" use="required">
81
         <attribute name="modes" type="string">
75
            <annotation>
82
            <annotation>
76
               <documentation>
83
               <documentation>
77
                  specifies a comma-separated list of the modes this type of lauch configuration supports - &quot;run&quot; and/or &quot;debug&quot;.
84
                  specifies a comma-separated list of the modes this type of lauch configuration supports - &quot;run&quot; and/or &quot;debug&quot;.
85
86
&lt;p&gt;
87
&lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;. This attribute has been deprecated as
88
part of a work in progress. There is no guarantee that this API will
89
remain unchanged during the 3.3 release cycle. Please do not use this API
90
without consulting with the Platform/Debug team.
91
&lt;/p&gt;
78
               </documentation>
92
               </documentation>
93
               <appInfo>
94
                  <meta.attribute deprecated="true"/>
95
               </appInfo>
79
            </annotation>
96
            </annotation>
80
         </attribute>
97
         </attribute>
81
         <attribute name="name" type="string" use="required">
98
         <attribute name="name" type="string" use="required">
Lines 126-131 Link Here
126
               </appInfo>
143
               </appInfo>
127
            </annotation>
144
            </annotation>
128
         </attribute>
145
         </attribute>
146
         <attribute name="icon" type="string">
147
            <annotation>
148
               <documentation>
149
                  The id of the icon for this launch configuraiton type.
150
151
since 3.3
152
153
&lt;p&gt;
154
&lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;. This element has been added as
155
part of a work in progress. There is no guarantee that this API will
156
remain unchanged during the 3.3 release cycle. Please do not use this API
157
without consulting with the Platform/Debug team.
158
&lt;/p&gt;
159
               </documentation>
160
               <appInfo>
161
                  <meta.attribute kind="resource"/>
162
               </appInfo>
163
            </annotation>
164
         </attribute>
129
      </complexType>
165
      </complexType>
130
   </element>
166
   </element>
131
167
(-)core/org/eclipse/debug/core/ILaunchManager.java (-2 / +33 lines)
Lines 213-218 Link Here
213
	 * @param mode mode identifier
213
	 * @param mode mode identifier
214
	 * @return launch mode or <code>null</code>
214
	 * @return launch mode or <code>null</code>
215
	 * @since 3.0
215
	 * @since 3.0
216
	 * 
217
	 * @deprecated launch modes are removed for 3.3M3 in favour of launching with options
218
	 * <p>
219
	 * <strong>EXPERIMENTAL</strong>. This method has been deprecated as
220
	 * part of a work in progress. There is no guarantee that this API will
221
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
222
	 * without consulting with the Platform/Debug team.
223
	 * </p>
216
	 */
224
	 */
217
	public ILaunchMode getLaunchMode(String mode);
225
	public ILaunchMode getLaunchMode(String mode);
218
	
226
	
Lines 221-226 Link Here
221
	 * 
229
	 * 
222
	 * @return all registered launch modes
230
	 * @return all registered launch modes
223
	 * @since 3.0
231
	 * @since 3.0
232
	 * 
233
	 * @deprecated launch modes are removed for 3.3M3 in favour of launching with options
234
	 * <p>
235
	 * <strong>EXPERIMENTAL</strong>. This method has been deprecated as
236
	 * part of a work in progress. There is no guarantee that this API will
237
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
238
	 * without consulting with the Platform/Debug team.
239
	 * </p>
224
	 */
240
	 */
225
	public ILaunchMode[] getLaunchModes();
241
	public ILaunchMode[] getLaunchModes();
226
	
242
	
Lines 229-235 Link Here
229
	 * @param optionId the unique id of the launch option
245
	 * @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
246
	 * @return the lauch option associated with ther specified id or <code>null</code> if not found
231
	 * <p>
247
	 * <p>
232
	 * <strong>EXPERIMENTAL</strong>. This ,method has been added as
248
	 * <strong>EXPERIMENTAL</strong>. This method has been added as
233
	 * part of a work in progress. There is no guarantee that this API will
249
	 * 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
250
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
235
	 * without consulting with the Platform/Debug team.
251
	 * without consulting with the Platform/Debug team.
Lines 242-248 Link Here
242
	 * Returns all registered launch options
258
	 * Returns all registered launch options
243
	 * @return all registered launch options
259
	 * @return all registered launch options
244
	 * <p>
260
	 * <p>
245
	 * <strong>EXPERIMENTAL</strong>. This ,method has been added as
261
	 * <strong>EXPERIMENTAL</strong>. This method has been added as
246
	 * part of a work in progress. There is no guarantee that this API will
262
	 * 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
263
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
248
	 * without consulting with the Platform/Debug team.
264
	 * without consulting with the Platform/Debug team.
Lines 252-257 Link Here
252
	public ILaunchOption[] getLaunchOptions();
268
	public ILaunchOption[] getLaunchOptions();
253
	
269
	
254
	/**
270
	/**
271
	 * Returns all of the launch delegates. The rturned listing of delegates cannot be directly used to launch,
272
	 * instead the method <code>IlaunchDelegate.getDelegate</code> must be used to acquire an executable form of
273
	 * the delegate, allowing us to maintain lazy loading of the delegates themselves.
274
	 * @return all of the launch delegates
275
	 * @since 3.3
276
	 * <p>
277
	 * <strong>EXPERIMENTAL</strong>. This method has been added as
278
	 * part of a work in progress. There is no guarantee that this API will
279
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
280
	 * without consulting with the Platform/Debug team.
281
	 * </p>
282
	 */
283
	public ILaunchDelegate[] getLaunchDelegates();
284
	
285
	/**
255
	 * Returns a collection of launch configurations that required migration to be
286
	 * Returns a collection of launch configurations that required migration to be
256
	 * compatible with current tooling.
287
	 * compatible with current tooling.
257
	 * 
288
	 * 
(-)core/org/eclipse/debug/core/ILaunchConfigurationType.java (+45 lines)
Lines 181-186 Link Here
181
	 * 
181
	 * 
182
	 * @return the set of all supported modes
182
	 * @return the set of all supported modes
183
	 * @since 3.2
183
	 * @since 3.2
184
	 * @deprecated launch modes are removed for 3.3M3 in favour of launching with options
185
	 * <p>
186
	 * <strong>EXPERIMENTAL</strong>. This method has been deprecated as
187
	 * part of a work in progress. There is no guarantee that this API will
188
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
189
	 * without consulting with the Platform/Debug team.
190
	 * </p>
184
	 */
191
	 */
185
	public Set getSupportedModes();
192
	public Set getSupportedModes();
186
	
193
	
Lines 222-227 Link Here
222
	 *  <code>DEBUG_MODE</code>.
229
	 *  <code>DEBUG_MODE</code>.
223
	 * @return whether this kind of launch configuration supports the
230
	 * @return whether this kind of launch configuration supports the
224
	 *  specified mode
231
	 *  specified mode
232
	 *  
233
	 *  @deprecated launch modes are removed for 3.3M3 in favour of launching with options
234
	 * <p>
235
	 * <strong>EXPERIMENTAL</strong>. This method has been deprecated as
236
	 * part of a work in progress. There is no guarantee that this API will
237
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
238
	 * without consulting with the Platform/Debug team.
239
	 * </p>
225
	 */
240
	 */
226
	public boolean supportsMode(String mode);
241
	public boolean supportsMode(String mode);
242
	
243
	/**
244
	 * Returns the simple name of the plugin that contributed this launch configuration type
245
	 * @return the name of the contributor
246
	 * @since 3.3
247
	 * 
248
	 * <p>
249
	 * <strong>EXPERIMENTAL</strong>. This method has been added as
250
	 * part of a work in progress. There is no guarantee that this API will
251
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
252
	 * without consulting with the Platform/Debug team.
253
	 * </p>
254
	 */
255
	public String getContributorName();
256
	
257
	/**
258
	 * Returns the path of the image descriptor for this launch configuration type, which in turn 
259
	 * is used in <code>DebugPluginImages</code> to load the image registry with config images.
260
	 * NOTE: the path could be only a fragment, and might require qualification via the bundle of the contributor.
261
	 * @return the id of the image for this config type
262
	 * @since 3.3
263
	 * 
264
	 * <p>
265
	 * <strong>EXPERIMENTAL</strong>. This method has been added as
266
	 * part of a work in progress. There is no guarantee that this API will
267
	 * remain unchanged during the 3.3 release cycle. Please do not use this API
268
	 * without consulting with the Platform/Debug team.
269
	 * </p>
270
	 */
271
	public String getImageDescriptorPath();
227
}
272
}
(-)core/org/eclipse/debug/internal/core/LaunchConfigurationType.java (-139 / +99 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 30-39 Link Here
30
import org.eclipse.debug.core.ILaunchConfigurationMigrationDelegate;
27
import org.eclipse.debug.core.ILaunchConfigurationMigrationDelegate;
31
import org.eclipse.debug.core.ILaunchConfigurationType;
28
import org.eclipse.debug.core.ILaunchConfigurationType;
32
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
29
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
30
import org.eclipse.debug.core.ILaunchDelegate;
33
import org.eclipse.debug.core.ILaunchManager;
31
import org.eclipse.debug.core.ILaunchManager;
34
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
32
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
35
import org.eclipse.debug.core.sourcelookup.ISourcePathComputer;
33
import org.eclipse.debug.core.sourcelookup.ISourcePathComputer;
36
34
35
import com.ibm.icu.text.MessageFormat;
36
37
/**
37
/**
38
 * A launch configuration type wrappers a configuration
38
 * A launch configuration type wrappers a configuration
39
 * element for a <code>launchConfigurationType</code>
39
 * element for a <code>launchConfigurationType</code>
Lines 41-62 Link Here
41
 */
41
 */
42
public class LaunchConfigurationType extends PlatformObject implements ILaunchConfigurationType {
42
public class LaunchConfigurationType extends PlatformObject implements ILaunchConfigurationType {
43
	
43
	
44
	private static String MIGRATION_DELEGATE = "migrationDelegate";  //$NON-NLS-1$
45
	
46
	/**
44
	/**
47
	 * The configuration element of the extension.
45
	 * The configuration element of the extension.
48
	 */
46
	 */
49
	private IConfigurationElement fElement;
47
	private IConfigurationElement fElement;
50
	
48
	
51
	/**
49
	/**
52
	 * Base modes this type supports.
50
	 *  a listing of modes contributed to this launch configuration type
51
	 *  @since 3.3
52
	 */
53
	private Set fModes = null;
54
	
55
	/**
56
	 * the default source path computer for this config type
57
	 * @since 3.3
53
	 */
58
	 */
54
	private Set fBaseModes;
59
	private ISourcePathComputer fSourcePathComputer = null;
55
	
60
	
56
	/**
61
	/**
57
	 * Modes that delegates have been contributed for
62
	 * The source locator id for this config type
58
	 */
63
	 */
59
	private Set fContributedModes;
64
	private String fSourceLocator = null;
60
	
65
	
61
	/**
66
	/**
62
	 * The delegates for launch configurations of this type.
67
	 * The delegates for launch configurations of this type.
Lines 73-143 Link Here
73
	 * @param element configuration element
78
	 * @param element configuration element
74
	 */
79
	 */
75
	protected LaunchConfigurationType(IConfigurationElement element) {
80
	protected LaunchConfigurationType(IConfigurationElement element) {
76
		setConfigurationElement(element);
81
		fElement = element;
77
	}
82
	}
78
	
83
	
79
	/* (non-Javadoc)
84
	/* (non-Javadoc)
80
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getAttribute(java.lang.String)
85
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getAttribute(java.lang.String)
81
	 */
86
	 */
82
	public String getAttribute(String attributeName) {
87
	public String getAttribute(String attributeName) {
83
		return getConfigurationElement().getAttribute(attributeName);
88
		return fElement.getAttribute(attributeName);
84
	}
89
	}
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
90
106
	/* (non-Javadoc)
91
	/* (non-Javadoc)
107
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getCategory()
92
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getCategory()
108
	 */
93
	 */
109
	public String getCategory() {
94
	public String getCategory() {
110
		return getConfigurationElement().getAttribute("category"); //$NON-NLS-1$
95
		return fElement.getAttribute(ConfigurationElementConstants.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
	}
96
	}
142
	
97
	
143
	/**
98
	/**
Lines 164-203 Link Here
164
		}
119
		}
165
		if (fDelegates == null) {
120
		if (fDelegates == null) {
166
			// initialize delegate table with base modes
121
			// initialize delegate table with base modes
167
			fDelegates = new Hashtable(3);
122
			fDelegates = new Hashtable();
168
		}
123
		}
169
		ILaunchConfigurationDelegate delegate = (ILaunchConfigurationDelegate)fDelegates.get(mode);
124
		ILaunchConfigurationDelegate delegate = (ILaunchConfigurationDelegate)fDelegates.get(mode);
170
		if (delegate == null) {
125
		if (delegate == null) {
171
			Set modes = getBaseModes();
126
			if(fModes.contains(mode)) {
172
			if (modes.contains(mode)) {
127
				ILaunchDelegate[] delegates = ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).getLaunchDelegates();
173
				Object object = getConfigurationElement().createExecutableExtension("delegate"); //$NON-NLS-1$
128
				for(int i = 0; i < delegates.length; i++) {
174
				if (object instanceof ILaunchConfigurationDelegate) {
129
					if(delegates[i].appliesTo(getIdentifier(), mode)) {
175
					Iterator iter = modes.iterator();
130
						delegate = delegates[i].getDelegate();
176
					while (iter.hasNext()) {
131
						fDelegates.put(mode, delegate);
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;
132
						return delegate;
197
					}
133
					}
198
				}
134
				}
199
			}
135
			}
200
		} else {
136
		} 
137
		else {
201
			return delegate;
138
			return delegate;
202
		}
139
		}
203
		throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.LaunchConfigurationType_10, new String[] {getIdentifier(), mode}), null)); 
140
		throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, MessageFormat.format(DebugCoreMessages.LaunchConfigurationType_10, new String[] {getIdentifier(), mode}), null)); 
Lines 207-220 Link Here
207
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getIdentifier()
144
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getIdentifier()
208
	 */
145
	 */
209
	public String getIdentifier() {
146
	public String getIdentifier() {
210
		return getConfigurationElement().getAttribute("id"); //$NON-NLS-1$
147
		return fElement.getAttribute(ConfigurationElementConstants.ID);
211
	}
148
	}
212
149
213
	/* (non-Javadoc)
150
	/* (non-Javadoc)
214
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getName()
151
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getName()
215
	 */
152
	 */
216
	public String getName() {
153
	public String getName() {
217
		return getConfigurationElement().getAttribute("name"); //$NON-NLS-1$
154
		return fElement.getAttribute(ConfigurationElementConstants.NAME);
218
	}
155
	}
219
156
220
	/* (non-Javadoc)
157
	/* (non-Javadoc)
Lines 228-277 Link Here
228
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getSourceLocatorId()
165
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getSourceLocatorId()
229
	 */
166
	 */
230
	public String getSourceLocatorId() {
167
	public String getSourceLocatorId() {
231
		String id = getAttribute("sourceLocatorId"); //$NON-NLS-1$
168
		if(fSourceLocator == null) {
232
		if (id == null) {
169
			//try the type itself
233
			// check for specification by mode specific delegate
170
			fSourceLocator = getAttribute(ConfigurationElementConstants.SOURCE_LOCATOR);
234
			List delegates = ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).getContributedDelegates();
171
			if(fSourceLocator == null) {
235
			Iterator iterator = delegates.iterator();
172
				//try from launch manager
236
			while (iterator.hasNext() && id == null) {
173
				ILaunchDelegate[] delegates = ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).getLaunchDelegates();
237
				ContributedDelegate delegate = (ContributedDelegate)iterator.next();
174
				for(int i = 0; i < delegates.length; i++) {
238
				if (delegate.getLaunchConfigurationType().equals(getIdentifier())) {
175
					if(delegates[i].appliesTo(getIdentifier())) {
239
					id = delegate.getSourceLocaterId();
176
						fSourceLocator = delegates[i].getSourceLocatorId();
177
						if(fSourceLocator != null) {
178
							return fSourceLocator;
179
						}
180
					}
240
				}
181
				}
241
			}
182
			}
242
		}
183
		}
243
		return id;
184
		return fSourceLocator;
244
	}	
185
	}	
245
186
246
	/* (non-Javadoc)
187
	/* (non-Javadoc)
247
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getSourcePathComputer()
188
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getSourcePathComputer()
248
	 */
189
	 */
249
	public ISourcePathComputer getSourcePathComputer() {
190
	public ISourcePathComputer getSourcePathComputer() {
250
		String id = getConfigurationElement().getAttribute("sourcePathComputerId"); //$NON-NLS-1$
191
		if(fSourcePathComputer == null) {
251
		if (id == null) {
192
			//get the id
252
			// check for specification by mode specific delegate
193
			String id = fElement.getAttribute(ConfigurationElementConstants.SOURCE_PATH_COMPUTER);
253
			List delegates = ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).getContributedDelegates();
194
			LaunchManager lmgr = (LaunchManager)DebugPlugin.getDefault().getLaunchManager();
254
			Iterator iterator = delegates.iterator();
195
			if(id == null) {
255
			while (iterator.hasNext() && id == null) {
196
				//try from the launch manager
256
				ContributedDelegate delegate = (ContributedDelegate)iterator.next();
197
				ILaunchDelegate[] delegates = lmgr.getLaunchDelegates();
257
				if (delegate.getLaunchConfigurationType().equals(getIdentifier())) {
198
				for(int i = 0; i < delegates.length; i++) {
258
					id = delegate.getSourcePathComputerId();
199
					if(delegates[i].appliesTo(getIdentifier())) {
200
						id = delegates[i].getSourcePathComputerId();
201
						if(id != null) {
202
							break;
203
						}
204
					}
259
				}
205
				}
260
			}
206
			}
207
			if(id != null) {
208
				fSourcePathComputer = lmgr.getSourcePathComputer(id);
209
			}
261
		}
210
		}
262
		if (id != null && id.length() > 0) {
211
		return fSourcePathComputer;
263
			return DebugPlugin.getDefault().getLaunchManager().getSourcePathComputer(id);
264
		}
265
		return null;
266
	}
212
	}
267
213
268
	/* (non-Javadoc)
214
	/**
269
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getSupportedModes()
215
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getSupportedModes()
216
	 * @deprecated launch modes are removed for 3.3M3 in favour of launching with options
270
	 */
217
	 */
271
	public Set getSupportedModes() {
218
	public Set getSupportedModes() {
272
		HashSet modes = new HashSet(getBaseModes());
219
		if(fModes == null) {
273
		modes.addAll(getContributedModes());
220
			fModes = new HashSet();
274
		return modes;
221
			ILaunchDelegate[] delegates = ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).getLaunchDelegates();
222
			for(int i= 0; i < delegates.length; i++) {
223
				if(delegates[i].appliesTo(getIdentifier())) {
224
					fModes.addAll(delegates[i].getModes());
225
				}
226
			}
227
		}
228
		return fModes;
275
	}
229
	}
276
230
277
	/**
231
	/**
Lines 283-296 Link Here
283
	 * @since 3.2
237
	 * @since 3.2
284
	 */
238
	 */
285
	public boolean isMigrationCandidate(ILaunchConfiguration candidate) throws CoreException {
239
	public boolean isMigrationCandidate(ILaunchConfiguration candidate) throws CoreException {
286
		if(getAttribute(MIGRATION_DELEGATE) != null) {
240
		if(getAttribute(ConfigurationElementConstants.MIGRATION_DELEGATE) != null) {
287
			if(fDelegates == null) {
241
			if(fDelegates == null) {
288
				fDelegates = new Hashtable();
242
				fDelegates = new Hashtable();
289
			}
243
			}
290
			Object delegate = fDelegates.get(MIGRATION_DELEGATE);
244
			Object delegate = fDelegates.get(ConfigurationElementConstants.MIGRATION_DELEGATE);
291
			if(delegate == null) {
245
			if(delegate == null) {
292
				delegate = getConfigurationElement().createExecutableExtension(MIGRATION_DELEGATE);
246
				delegate = fElement.createExecutableExtension(ConfigurationElementConstants.MIGRATION_DELEGATE);
293
				fDelegates.put(MIGRATION_DELEGATE, delegate);
247
				fDelegates.put(ConfigurationElementConstants.MIGRATION_DELEGATE, delegate);
294
			}
248
			}
295
			if(delegate instanceof ILaunchConfigurationMigrationDelegate) {
249
			if(delegate instanceof ILaunchConfigurationMigrationDelegate) {
296
				return ((ILaunchConfigurationMigrationDelegate)delegate).isCandidate(candidate);
250
				return ((ILaunchConfigurationMigrationDelegate)delegate).isCandidate(candidate);
Lines 303-309 Link Here
303
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#isPublic()
257
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#isPublic()
304
	 */
258
	 */
305
	public boolean isPublic() {
259
	public boolean isPublic() {
306
		String publicString = getConfigurationElement().getAttribute("public"); //$NON-NLS-1$
260
		String publicString = fElement.getAttribute(ConfigurationElementConstants.PUBLIC);
307
		if (publicString != null) {
261
		if (publicString != null) {
308
			if (publicString.equalsIgnoreCase("false")) { //$NON-NLS-1$
262
			if (publicString.equalsIgnoreCase("false")) { //$NON-NLS-1$
309
				return false;
263
				return false;
Lines 320-333 Link Here
320
	 * @since 3.2
274
	 * @since 3.2
321
	 */
275
	 */
322
	public void migrate(ILaunchConfiguration candidate) throws CoreException {
276
	public void migrate(ILaunchConfiguration candidate) throws CoreException {
323
		if(getAttribute(MIGRATION_DELEGATE) != null) { 
277
		if(getAttribute(ConfigurationElementConstants.MIGRATION_DELEGATE) != null) { 
324
			if(fDelegates == null) {
278
			if(fDelegates == null) {
325
				fDelegates = new Hashtable();
279
				fDelegates = new Hashtable();
326
			}
280
			}
327
			Object delegate = fDelegates.get(MIGRATION_DELEGATE);
281
			Object delegate = fDelegates.get(ConfigurationElementConstants.MIGRATION_DELEGATE);
328
			if(delegate == null) {
282
			if(delegate == null) {
329
				delegate = getConfigurationElement().createExecutableExtension(MIGRATION_DELEGATE);
283
				delegate = fElement.createExecutableExtension(ConfigurationElementConstants.MIGRATION_DELEGATE);
330
				fDelegates.put(MIGRATION_DELEGATE, delegate);
284
				fDelegates.put(ConfigurationElementConstants.MIGRATION_DELEGATE, delegate);
331
			}
285
			}
332
			if(delegate instanceof ILaunchConfigurationMigrationDelegate) {
286
			if(delegate instanceof ILaunchConfigurationMigrationDelegate) {
333
				((ILaunchConfigurationMigrationDelegate)delegate).migrate(candidate);
287
				((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)
293
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#newInstance(org.eclipse.core.resources.IContainer, java.lang.String)
340
	 */
294
	 */
341
	public ILaunchConfigurationWorkingCopy newInstance(IContainer container, String name) {
295
	public ILaunchConfigurationWorkingCopy newInstance(IContainer container, String name) {
342
			return new LaunchConfigurationWorkingCopy(container, name, this);
296
		return new LaunchConfigurationWorkingCopy(container, name, this);
343
	}
297
	}
344
298
345
	/**
299
	/**
346
	 * Sets this type's configuration element.
300
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#supportsMode(java.lang.String)
347
	 * 
301
	 * @deprecated launch modes are removed for 3.3M3 in favour of launching with options
348
	 * @param element this type's configuration element
349
	 */
302
	 */
350
	private void setConfigurationElement(IConfigurationElement element) {
303
	public boolean supportsMode(String mode) {
351
		fElement = element;
304
		return getSupportedModes().contains(mode);
352
	}
305
	}
353
306
	
354
	/**
307
	/* (non-Javadoc)
355
	 * @see ILaunchConfigurationType#supportsMode(String)
308
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getContributorName()
356
	 */
309
	 */
357
	public boolean supportsMode(String mode) {
310
	public String getContributorName() {
358
		return getBaseModes().contains(mode) || getContributedModes().contains(mode);
311
		return fElement.getContributor().getName();
312
	}
313
	
314
	/* (non-Javadoc)
315
	 * @see org.eclipse.debug.core.ILaunchConfigurationType#getImageDescriptorId()
316
	 */
317
	public String getImageDescriptorPath() {
318
		return fElement.getAttribute(ConfigurationElementConstants.ICON);
359
	}
319
	}
360
}
320
}
361
321
(-)core/org/eclipse/debug/internal/core/LaunchManager.java (-109 / +166 lines)
Lines 76-81 Link Here
76
import org.eclipse.debug.core.ILaunchConfiguration;
76
import org.eclipse.debug.core.ILaunchConfiguration;
77
import org.eclipse.debug.core.ILaunchConfigurationListener;
77
import org.eclipse.debug.core.ILaunchConfigurationListener;
78
import org.eclipse.debug.core.ILaunchConfigurationType;
78
import org.eclipse.debug.core.ILaunchConfigurationType;
79
import org.eclipse.debug.core.ILaunchDelegate;
79
import org.eclipse.debug.core.ILaunchListener;
80
import org.eclipse.debug.core.ILaunchListener;
80
import org.eclipse.debug.core.ILaunchManager;
81
import org.eclipse.debug.core.ILaunchManager;
81
import org.eclipse.debug.core.ILaunchMode;
82
import org.eclipse.debug.core.ILaunchMode;
Lines 507-523 Link Here
507
	 * @throws IOException if the encoding attempted to be used is not supported
508
	 * @throws IOException if the encoding attempted to be used is not supported
508
	 */
509
	 */
509
	public static String serializeDocument(Document doc) throws TransformerException, IOException {
510
	public static String serializeDocument(Document doc) throws TransformerException, IOException {
510
		ByteArrayOutputStream s= new ByteArrayOutputStream();
511
		ByteArrayOutputStream s = new ByteArrayOutputStream();
511
		
512
		TransformerFactory factory = TransformerFactory.newInstance();
512
		TransformerFactory factory= TransformerFactory.newInstance();
513
		Transformer transformer = factory.newTransformer();
513
		Transformer transformer= factory.newTransformer();
514
		transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
514
		transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
515
		transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
515
		transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
516
		
516
		DOMSource source = new DOMSource(doc);
517
		DOMSource source= new DOMSource(doc);
517
		StreamResult outputTarget = new StreamResult(s);
518
		StreamResult outputTarget= new StreamResult(s);
519
		transformer.transform(source, outputTarget);
518
		transformer.transform(source, outputTarget);
520
		
521
		return s.toString("UTF8"); //$NON-NLS-1$			
519
		return s.toString("UTF8"); //$NON-NLS-1$			
522
	}
520
	}
523
	
521
	
Lines 564-571 Link Here
564
	private HashMap fLaunchOptions = null;
562
	private HashMap fLaunchOptions = null;
565
	
563
	
566
	/**
564
	/**
565
	 * A map of ILaunchDelegate objects stored by id of delegate, or launch config type
566
	 */
567
	private HashMap fLaunchDelegates = null;
568
	
569
	/**
567
	 * List of contributed launch delegates (delegates contributed for existing
570
	 * List of contributed launch delegates (delegates contributed for existing
568
	 * launch configuration types).
571
	 * launch configuration types).
572
	 * 
573
	 * @deprecated as of 3.3M3, all delegates are treated as simply <code>ILaunchDelegate</code>s. there is no distinction 
574
	 * between them (those contributd via the launch config type and those contributed via a <code>launchDelegates</code> contribution.
569
	 */
575
	 */
570
	private List fContributedDelegates = null;
576
	private List fContributedDelegates = null;
571
577
Lines 830-837 Link Here
830
		}
836
		}
831
		Iterator iter = list.iterator();
837
		Iterator iter = list.iterator();
832
		List configs = new ArrayList(list.size());
838
		List configs = new ArrayList(list.size());
839
		IFile file = null;
833
		while (iter.hasNext()) {
840
		while (iter.hasNext()) {
834
			IFile file = (IFile)iter.next();
841
			file = (IFile)iter.next();
835
			configs.add(getLaunchConfiguration(file));
842
			configs.add(getLaunchConfiguration(file));
836
		}
843
		}
837
		return configs;
844
		return configs;
Lines 856-863 Link Here
856
				}
863
				}
857
			};
864
			};
858
			String[] files = directory.list(filter);
865
			String[] files = directory.list(filter);
866
			LaunchConfiguration config = null;
859
			for (int i = 0; i < files.length; i++) {
867
			for (int i = 0; i < files.length; i++) {
860
				LaunchConfiguration config = new LaunchConfiguration(containerPath.append(files[i]));
868
				config = new LaunchConfiguration(containerPath.append(files[i]));
861
				configs.add(config);
869
				configs.add(config);
862
			}
870
			}
863
		}
871
		}
Lines 893-905 Link Here
893
				try {
901
				try {
894
					index = Integer.parseInt(trailer);
902
					index = Integer.parseInt(trailer);
895
					baseName = baseName.substring(0, copyIndex);
903
					baseName = baseName.substring(0, copyIndex);
896
				} catch (NumberFormatException nfe) {
904
				} 
897
				}
905
				catch (NumberFormatException nfe) {}
898
			}
906
			}
899
		} 
907
		} 
900
		String newName = baseName;
908
		String newName = baseName;
901
		
909
		
902
		StringBuffer buffer= null;
910
		StringBuffer buffer = null;
903
		while (isExistingLaunchConfigurationName(newName)) {
911
		while (isExistingLaunchConfigurationName(newName)) {
904
			buffer = new StringBuffer(baseName);
912
			buffer = new StringBuffer(baseName);
905
			buffer.append(" ("); //$NON-NLS-1$
913
			buffer.append(" ("); //$NON-NLS-1$
Lines 995-1010 Link Here
995
		List configs = new ArrayList(4);	
1003
		List configs = new ArrayList(4);	
996
		NodeList list = root.getChildNodes();
1004
		NodeList list = root.getChildNodes();
997
		int length = list.getLength();
1005
		int length = list.getLength();
1006
		Node node = null;
1007
		Element entry = null;
1008
		String memento = null;
998
		for (int i = 0; i < length; ++i) {
1009
		for (int i = 0; i < length; ++i) {
999
			Node node = list.item(i);
1010
			node = list.item(i);
1000
			short type = node.getNodeType();
1011
			short type = node.getNodeType();
1001
			if (type == Node.ELEMENT_NODE) {
1012
			if (type == Node.ELEMENT_NODE) {
1002
				Element entry = (Element) node;
1013
				entry = (Element) node;
1003
				String nodeName = entry.getNodeName();
1014
				if (!entry.getNodeName().equals("launchConfiguration")) { //$NON-NLS-1$
1004
				if (!nodeName.equals("launchConfiguration")) { //$NON-NLS-1$
1005
					throw invalidFormat;
1015
					throw invalidFormat;
1006
				}
1016
				}
1007
				String memento = entry.getAttribute("memento"); //$NON-NLS-1$
1017
				memento = entry.getAttribute("memento"); //$NON-NLS-1$
1008
				if (memento == null) {
1018
				if (memento == null) {
1009
					throw invalidFormat;
1019
					throw invalidFormat;
1010
				}
1020
				}
Lines 1016-1033 Link Here
1016
	
1026
	
1017
	protected ConfigurationNotifier getConfigurationNotifier() {
1027
	protected ConfigurationNotifier getConfigurationNotifier() {
1018
		return new ConfigurationNotifier();
1028
		return new ConfigurationNotifier();
1019
	}	
1029
	}			
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
	
1030
	
1032
	/**
1031
	/**
1033
	 * @see ILaunchManager#getDebugTargets()
1032
	 * @see ILaunchManager#getDebugTargets()
Lines 1036-1044 Link Here
1036
		synchronized (fLaunches) {
1035
		synchronized (fLaunches) {
1037
			List allTargets= new ArrayList(fLaunches.size());
1036
			List allTargets= new ArrayList(fLaunches.size());
1038
			if (fLaunches.size() > 0) {
1037
			if (fLaunches.size() > 0) {
1039
				Iterator e= fLaunches.iterator();
1038
				Iterator e = fLaunches.iterator();
1039
				IDebugTarget[] targets = null;
1040
				while (e.hasNext()) {
1040
				while (e.hasNext()) {
1041
					IDebugTarget[] targets= ((ILaunch) e.next()).getDebugTargets();
1041
					targets = ((ILaunch) e.next()).getDebugTargets();
1042
					for (int i = 0; i < targets.length; i++) {
1042
					for (int i = 0; i < targets.length; i++) {
1043
						allTargets.add(targets[i]);
1043
						allTargets.add(targets[i]);
1044
					}
1044
					}
Lines 1073-1082 Link Here
1073
		if (configEnv == null) {
1073
		if (configEnv == null) {
1074
			return null;
1074
			return null;
1075
		}
1075
		}
1076
		Map env = null;
1076
		Map env = new HashMap();
1077
		// build base environment
1077
		// build base environment
1078
		env= new HashMap();
1078
		boolean append = configuration.getAttribute(ATTR_APPEND_ENVIRONMENT_VARIABLES, true);
1079
		boolean append= configuration.getAttribute(ATTR_APPEND_ENVIRONMENT_VARIABLES, true);
1080
		if (append) {
1079
		if (append) {
1081
			env.putAll(getNativeEnvironmentCasePreserved());
1080
			env.putAll(getNativeEnvironmentCasePreserved());
1082
		}
1081
		}
Lines 1084-1093 Link Here
1084
		// Add variables from config
1083
		// Add variables from config
1085
		Iterator iter= configEnv.entrySet().iterator();
1084
		Iterator iter= configEnv.entrySet().iterator();
1086
		boolean win32= Platform.getOS().equals(Constants.OS_WIN32);
1085
		boolean win32= Platform.getOS().equals(Constants.OS_WIN32);
1086
		Map.Entry entry = null;
1087
		String key = null;
1088
		String value = null;
1089
		Object nativeValue = null;
1090
		Iterator envIter = null;
1091
		Map.Entry nativeEntry = null;
1092
		String nativeKey = null;
1087
		while (iter.hasNext()) {
1093
		while (iter.hasNext()) {
1088
			Map.Entry entry= (Map.Entry) iter.next();
1094
			entry = (Map.Entry) iter.next();
1089
			String key= (String) entry.getKey();
1095
			key = (String) entry.getKey();
1090
            String value = (String) entry.getValue();
1096
            value = (String) entry.getValue();
1091
            // translate any string substitution variables
1097
            // translate any string substitution variables
1092
            if (value != null) {
1098
            if (value != null) {
1093
                value = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(value);
1099
                value = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(value);
Lines 1095-1101 Link Here
1095
            boolean added= false;
1101
            boolean added= false;
1096
			if (win32) {
1102
			if (win32) {
1097
                // First, check if the key is an exact match for an existing key.
1103
                // First, check if the key is an exact match for an existing key.
1098
                Object nativeValue= env.get(key);
1104
				nativeValue = env.get(key);
1099
                if (nativeValue != null) {
1105
                if (nativeValue != null) {
1100
                    // If an exact match is found, just replace the value
1106
                    // If an exact match is found, just replace the value
1101
                    env.put(key, value);
1107
                    env.put(key, value);
Lines 1103-1115 Link Here
1103
                    // Win32 vars are case-insensitive. If an exact match isn't found, iterate to
1109
                    // 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),
1110
                    // 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").
1111
                    // but do a case-insensitive comparison (for example, "pAtH" will still override "PATH").
1106
                    Iterator envIter= env.entrySet().iterator();
1112
                    envIter = env.entrySet().iterator();
1107
                    while (envIter.hasNext()) {
1113
                    while (envIter.hasNext()) {
1108
                        Map.Entry nativeEntry = (Map.Entry) envIter.next();
1114
                        nativeEntry = (Map.Entry) envIter.next();
1109
                        String nativeKey= (String) (nativeEntry).getKey();
1115
                        nativeKey = (String) (nativeEntry).getKey();
1110
                        if (nativeKey.equalsIgnoreCase(key)) {
1116
                        if (nativeKey.equalsIgnoreCase(key)) {
1111
                            nativeEntry.setValue(value);
1117
                            nativeEntry.setValue(value);
1112
                            added= true;
1118
                            added = true;
1113
                            break;
1119
                            break;
1114
                        }
1120
                        }
1115
                    }
1121
                    }
Lines 1120-1130 Link Here
1120
            }
1126
            }
1121
		}		
1127
		}		
1122
		
1128
		
1123
		iter= env.entrySet().iterator();
1129
		iter = env.entrySet().iterator();
1124
		List strings= new ArrayList(env.size());
1130
		List strings = new ArrayList(env.size());
1131
		StringBuffer buffer = null;
1125
		while (iter.hasNext()) {
1132
		while (iter.hasNext()) {
1126
			Map.Entry entry = (Map.Entry) iter.next();
1133
			entry = (Map.Entry) iter.next();
1127
			StringBuffer buffer= new StringBuffer((String) entry.getKey());
1134
			buffer = new StringBuffer((String) entry.getKey());
1128
			buffer.append('=').append((String) entry.getValue());
1135
			buffer.append('=').append((String) entry.getValue());
1129
			strings.add(buffer.toString());
1136
			strings.add(buffer.toString());
1130
		}
1137
		}
Lines 1215-1222 Link Here
1215
	public ILaunchConfiguration[] getLaunchConfigurations(ILaunchConfigurationType type) throws CoreException {
1222
	public ILaunchConfiguration[] getLaunchConfigurations(ILaunchConfigurationType type) throws CoreException {
1216
		Iterator iter = getAllLaunchConfigurations().iterator();
1223
		Iterator iter = getAllLaunchConfigurations().iterator();
1217
		List configs = new ArrayList();
1224
		List configs = new ArrayList();
1225
		ILaunchConfiguration config = null;
1218
		while (iter.hasNext()) {
1226
		while (iter.hasNext()) {
1219
			ILaunchConfiguration config = (ILaunchConfiguration)iter.next();
1227
			config = (ILaunchConfiguration)iter.next();
1220
			if (config.getType().equals(type)) {
1228
			if (config.getType().equals(type)) {
1221
				configs.add(config);
1229
				configs.add(config);
1222
			}
1230
			}
Lines 1224-1230 Link Here
1224
		return (ILaunchConfiguration[])configs.toArray(new ILaunchConfiguration[configs.size()]);
1232
		return (ILaunchConfiguration[])configs.toArray(new ILaunchConfiguration[configs.size()]);
1225
	}
1233
	}
1226
	
1234
	
1227
	
1228
	/**
1235
	/**
1229
	 * Returns all launch configurations that are stored as resources
1236
	 * Returns all launch configurations that are stored as resources
1230
	 * in the given project.
1237
	 * in the given project.
Lines 1236-1244 Link Here
1236
	protected List getLaunchConfigurations(IProject project) {
1243
	protected List getLaunchConfigurations(IProject project) {
1237
		Iterator iter = getAllLaunchConfigurations().iterator();
1244
		Iterator iter = getAllLaunchConfigurations().iterator();
1238
		List configs = new ArrayList();
1245
		List configs = new ArrayList();
1246
		ILaunchConfiguration config = null;
1247
		IFile file = null;
1239
		while (iter.hasNext()) {
1248
		while (iter.hasNext()) {
1240
			ILaunchConfiguration config = (ILaunchConfiguration)iter.next();
1249
			config = (ILaunchConfiguration)iter.next();
1241
			IFile file = config.getFile();
1250
			file = config.getFile();
1242
			if (file != null && file.getProject().equals(project)) {
1251
			if (file != null && file.getProject().equals(project)) {
1243
				configs.add(config);
1252
				configs.add(config);
1244
			}
1253
			}
Lines 1276-1291 Link Here
1276
		}
1285
		}
1277
	}
1286
	}
1278
	
1287
	
1279
	/* (non-Javadoc)
1288
	/**)
1280
	 * @see org.eclipse.debug.core.ILaunchManager#getLaunchMode(java.lang.String)
1289
	 * @see org.eclipse.debug.core.ILaunchManager#getLaunchMode(java.lang.String)
1290
	 * @deprecated launch modes are removed for 3.3M3 in favour of launching with options
1281
	 */
1291
	 */
1282
	public ILaunchMode getLaunchMode(String mode) {
1292
	public ILaunchMode getLaunchMode(String mode) {
1283
		initializeLaunchModes();
1293
		initializeLaunchModes();
1284
		return (ILaunchMode) fLaunchModes.get(mode);
1294
		return (ILaunchMode) fLaunchModes.get(mode);
1285
	}
1295
	}
1286
	
1296
	
1287
	/* (non-Javadoc)
1297
	/**
1288
	 * @see org.eclipse.debug.core.ILaunchManager#getLaunchModes()
1298
	 * @see org.eclipse.debug.core.ILaunchManager#getLaunchModes()
1299
	 * @deprecated launch modes are removed for 3.3M3 in favour of launching with options
1289
	 */
1300
	 */
1290
	public ILaunchMode[] getLaunchModes() {
1301
	public ILaunchMode[] getLaunchModes() {
1291
		initializeLaunchModes();
1302
		initializeLaunchModes();
Lines 1309-1315 Link Here
1309
		Collection col = fLaunchOptions.values();
1320
		Collection col = fLaunchOptions.values();
1310
		return (ILaunchOption[])col.toArray(new ILaunchOption[col.size()]);
1321
		return (ILaunchOption[])col.toArray(new ILaunchOption[col.size()]);
1311
	}
1322
	}
1312
		
1323
	
1324
	/**
1325
	 * Initializes the listing of registered launch options. Does no work if the mapping is already populated.
1326
	 * @since 3.3  
1327
	 */
1328
	private synchronized void initializeLaunchOptions() {
1329
		if(fLaunchOptions == null) {
1330
			try {
1331
				IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_OPTIONS);
1332
				IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
1333
				fLaunchOptions = new HashMap();
1334
				ILaunchOption option = null;
1335
				for(int i =  0; i < infos.length; i++) {
1336
					option = new LaunchOption(infos[i]);
1337
					fLaunchOptions.put(option.getIdentifier(), option);
1338
				}
1339
			}
1340
			catch(CoreException ce) {DebugPlugin.log(ce);}
1341
		}
1342
	}
1343
	
1344
	/**
1345
	 * @return the listing of launch delegates available to the launching framework
1346
	 * @since 3.3
1347
	 */
1348
	public ILaunchDelegate[] getLaunchDelegates() {
1349
		initializeLaunchDelegates();
1350
		Collection col = fLaunchDelegates.values();
1351
		return (ILaunchDelegate[]) col.toArray(new ILaunchDelegate[col.size()]);
1352
	}
1353
	
1354
	/**
1355
	 * Finds a launch delegate associated with the specified id. For backwards compatibility id can be either
1356
	 * the id provided in a <code>launchDelegates</code> contribution, or the id provided in a 
1357
	 * <code>launchConfigurationTypes</code> contribution.
1358
	 * @param configtypeId the id of the delegate to search for
1359
	 * @return the <code>ILaunchDelegate</code> associated with the specifed id or <code>null</code> if no
1360
	 * mapping exists
1361
	 * @since 3.3
1362
	 */
1363
	public ILaunchDelegate getLaunchDelegate(String id) {
1364
		initializeLaunchDelegates();
1365
		return (ILaunchDelegate) fLaunchDelegates.get(id);
1366
	}
1367
	
1368
	/**
1369
	 * Initializes the listing of delegates available to the launching framework
1370
	 * @since 3.3
1371
	 */
1372
	private synchronized void initializeLaunchDelegates() {
1373
		if(fLaunchDelegates == null) {
1374
			fLaunchDelegates = new HashMap();
1375
			//get all launch delegate contributions
1376
			IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_DELEGATES);
1377
			IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
1378
			ILaunchDelegate delegate = null;
1379
			for(int i = 0; i < infos.length; i++) {
1380
				delegate = new LaunchDelegate(infos[i]);
1381
				fLaunchDelegates.put(delegate.getIdentifier(), delegate);
1382
			}
1383
			//get all delegates from launch configuration type contributions
1384
			extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES);
1385
			infos = extensionPoint.getConfigurationElements();
1386
			for(int i = 0; i < infos.length; i++) {
1387
				//must check to see if delegate is provided in contribution
1388
				if(infos[i].getAttribute("delegate") != null) { //$NON-NLS-1$
1389
					delegate = new LaunchDelegate(infos[i]);
1390
					fLaunchDelegates.put(delegate.getIdentifier(), delegate);
1391
				}
1392
			}
1393
		}
1394
	}
1395
	
1313
	/**
1396
	/**
1314
	 * Returns all launch configurations that are stored locally.
1397
	 * Returns all launch configurations that are stored locally.
1315
	 * 
1398
	 * 
Lines 1397-1405 Link Here
1397
			if (Platform.getOS().equals(Constants.OS_WIN32)) {
1480
			if (Platform.getOS().equals(Constants.OS_WIN32)) {
1398
				fgNativeEnv= new HashMap();
1481
				fgNativeEnv= new HashMap();
1399
				Iterator entries = casePreserved.entrySet().iterator();
1482
				Iterator entries = casePreserved.entrySet().iterator();
1483
				Map.Entry entry = null;
1484
				String key = null;
1400
				while (entries.hasNext()) {
1485
				while (entries.hasNext()) {
1401
					Map.Entry entry = (Entry) entries.next();
1486
					entry = (Entry) entries.next();
1402
					String key = ((String)entry.getKey()).toUpperCase();
1487
					key = ((String)entry.getKey()).toUpperCase();
1403
					fgNativeEnv.put(key, entry.getValue());
1488
					fgNativeEnv.put(key, entry.getValue());
1404
				}
1489
				}
1405
			} else {
1490
			} else {
Lines 1425-1434 Link Here
1425
	 */
1510
	 */
1426
	public IProcess[] getProcesses() {
1511
	public IProcess[] getProcesses() {
1427
		synchronized (fLaunches) {
1512
		synchronized (fLaunches) {
1428
			List allProcesses= new ArrayList(fLaunches.size());
1513
			List allProcesses = new ArrayList(fLaunches.size());
1429
			Iterator e= fLaunches.iterator();
1514
			Iterator e = fLaunches.iterator();
1515
			IProcess[] processes = null;
1430
			while (e.hasNext()) {
1516
			while (e.hasNext()) {
1431
				IProcess[] processes= ((ILaunch) e.next()).getProcesses();
1517
				processes = ((ILaunch) e.next()).getProcesses();
1432
				for (int i= 0; i < processes.length; i++) {
1518
				for (int i= 0; i < processes.length; i++) {
1433
					allProcesses.add(processes[i]);
1519
					allProcesses.add(processes[i]);
1434
				}
1520
				}
Lines 1494-1502 Link Here
1494
			IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_COMPARATORS);
1580
			IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_COMPARATORS);
1495
			IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
1581
			IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
1496
			fComparators = new HashMap(infos.length);
1582
			fComparators = new HashMap(infos.length);
1583
			IConfigurationElement configurationElement = null;
1584
			String attr = null;
1497
			for (int i= 0; i < infos.length; i++) {
1585
			for (int i= 0; i < infos.length; i++) {
1498
				IConfigurationElement configurationElement = infos[i];
1586
				configurationElement = infos[i];
1499
				String attr = configurationElement.getAttribute("attribute"); //$NON-NLS-1$			
1587
				attr = configurationElement.getAttribute("attribute"); //$NON-NLS-1$			
1500
				if (attr != null) {
1588
				if (attr != null) {
1501
					fComparators.put(attr, new LaunchConfigurationComparator(configurationElement));
1589
					fComparators.put(attr, new LaunchConfigurationComparator(configurationElement));
1502
				} else {
1590
				} else {
Lines 1508-1539 Link Here
1508
			}
1596
			}
1509
		}
1597
		}
1510
	}
1598
	}
1511
	
1599
1512
	/**
1600
	/**
1513
	 * Initializes contributed launch delegates (i.e. delegates contributed
1601
	 * Initializes the listing of <code>LaunchConfigurationType</code>s.
1514
	 * to an existing launch configuration type).
1515
	 */
1602
	 */
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() {
1603
	private synchronized void initializeLaunchConfigurationTypes() {
1528
		if (fLaunchConfigurationTypes == null) {
1604
		if (fLaunchConfigurationTypes == null) {
1529
			hookResourceChangeListener();
1605
			hookResourceChangeListener();
1530
			IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES);
1606
			IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_LAUNCH_CONFIGURATION_TYPES);
1531
			IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
1607
			IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
1532
			fLaunchConfigurationTypes= new ArrayList(infos.length);
1608
			fLaunchConfigurationTypes = new ArrayList(infos.length);
1533
			for (int i= 0; i < infos.length; i++) {
1609
			for (int i= 0; i < infos.length; i++) {		
1534
				IConfigurationElement configurationElement = infos[i];
1610
				fLaunchConfigurationTypes.add(new LaunchConfigurationType(infos[i]));
1535
				LaunchConfigurationType configType = new LaunchConfigurationType(configurationElement); 			
1536
				fLaunchConfigurationTypes.add(configType);
1537
			}
1611
			}
1538
		}
1612
		}
1539
	}
1613
	}
Lines 1543-1548 Link Here
1543
	 * 
1617
	 * 
1544
	 * @exception CoreException if an exception occurs reading
1618
	 * @exception CoreException if an exception occurs reading
1545
	 *  the extensions
1619
	 *  the extensions
1620
	 *  
1546
	 */
1621
	 */
1547
	private synchronized void initializeLaunchModes() {
1622
	private synchronized void initializeLaunchModes() {
1548
		if (fLaunchModes == null) {
1623
		if (fLaunchModes == null) {
Lines 1559-1584 Link Here
1559
			catch (CoreException e) {DebugPlugin.log(e);}
1634
			catch (CoreException e) {DebugPlugin.log(e);}
1560
		}
1635
		}
1561
	}
1636
	}
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
	
1637
	
1583
	/**
1638
	/**
1584
	 * Initializes source container type and source path computer extensions.
1639
	 * 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);
1670
			IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_SOURCE_LOCATORS);
1616
			IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
1671
			IConfigurationElement[] infos= extensionPoint.getConfigurationElements();
1617
			fSourceLocators= new HashMap(infos.length);
1672
			fSourceLocators= new HashMap(infos.length);
1673
			IConfigurationElement configurationElement = null;
1674
			String id = null;
1618
			for (int i= 0; i < infos.length; i++) {
1675
			for (int i= 0; i < infos.length; i++) {
1619
				IConfigurationElement configurationElement = infos[i];
1676
				configurationElement = infos[i];
1620
				String id = configurationElement.getAttribute("id"); //$NON-NLS-1$			
1677
				id = configurationElement.getAttribute("id"); //$NON-NLS-1$			
1621
				if (id != null) {
1678
				if (id != null) {
1622
					fSourceLocators.put(id,configurationElement);
1679
					fSourceLocators.put(id,configurationElement);
1623
				} else {
1680
				} else {
Lines 1812-1819 Link Here
1812
		if (!configs.isEmpty()) {
1869
		if (!configs.isEmpty()) {
1813
			Iterator iterator = configs.iterator();
1870
			Iterator iterator = configs.iterator();
1814
			while (iterator.hasNext()) {
1871
			while (iterator.hasNext()) {
1815
				ILaunchConfiguration configuration = (ILaunchConfiguration)iterator.next();
1872
				launchConfigurationDeleted((ILaunchConfiguration)iterator.next());
1816
				launchConfigurationDeleted(configuration);
1817
			}
1873
			}
1818
		}
1874
		}
1819
		//bug 12134
1875
		//bug 12134
Lines 1832-1839 Link Here
1832
		if (!configs.isEmpty()) {
1888
		if (!configs.isEmpty()) {
1833
			Iterator iterator = configs.iterator();
1889
			Iterator iterator = configs.iterator();
1834
			while (iterator.hasNext()) {
1890
			while (iterator.hasNext()) {
1835
				ILaunchConfiguration config = (ILaunchConfiguration) iterator.next();
1891
				launchConfigurationAdded((ILaunchConfiguration) iterator.next());
1836
				launchConfigurationAdded(config);
1837
			}			
1892
			}			
1838
		}
1893
		}
1839
	}
1894
	}
Lines 1953-1960 Link Here
1953
        fLaunchesListeners = new ListenerList();
2008
        fLaunchesListeners = new ListenerList();
1954
        fLaunchConfigurationListeners = new ListenerList();
2009
        fLaunchConfigurationListeners = new ListenerList();
1955
		ILaunch[] launches = getLaunches();
2010
		ILaunch[] launches = getLaunches();
2011
		ILaunch launch = null;
1956
		for (int i= 0; i < launches.length; i++) {
2012
		for (int i= 0; i < launches.length; i++) {
1957
			ILaunch launch= launches[i];
2013
			launch = launches[i];
1958
			try {
2014
			try {
1959
                if (launch instanceof IDisconnect) {
2015
                if (launch instanceof IDisconnect) {
1960
                    IDisconnect disconnect = (IDisconnect)launch;
2016
                    IDisconnect disconnect = (IDisconnect)launch;
Lines 2014-2021 Link Here
2014
	 */
2070
	 */
2015
	protected void verifyConfigurations(List verify, List valid) {
2071
	protected void verifyConfigurations(List verify, List valid) {
2016
		Iterator configs = verify.iterator();
2072
		Iterator configs = verify.iterator();
2073
		ILaunchConfiguration config = null;
2017
		while (configs.hasNext()) {
2074
		while (configs.hasNext()) {
2018
			ILaunchConfiguration config = (ILaunchConfiguration)configs.next();
2075
			config = (ILaunchConfiguration)configs.next();
2019
			if (isValid(config)) {
2076
			if (isValid(config)) {
2020
				valid.add(config);
2077
				valid.add(config);
2021
			}
2078
			}
(-)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
}
(-)buildnotes_platform-debug.html (+12 lines)
Lines 24-29 Link Here
24
   <li>Added <code>ILaunchOption</code> -- which describes a single contributed launch option within the launch manager</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>
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>
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
   <li>Added <code>launchDelegates</code> extension point atribute: name</li>
28
   <li>Added <code>launchDelegates</code> extension point sub-elements: and, or, appliesTo and option</li>
29
   <li>Added <code>launchConfigurationTypes</code> extension point attribute: icon</li>
30
   <li>Deprecated <code>launchConfigurationTypes</code> extension point attributes: delegate and modes</li>
31
   <li>Deprecated <code>launchModes</code> extension point</li>
32
   <li>Deprecated <code>ILaunchConfigurationType.getSupportedModes</code></li>
33
   <li>Deprecated <code>ILaunchConfigurationType.supportsMode(String)</code></li>
34
   <li>Deprecated <code>ILaunchManager.getLaunchMode(String)</code></li>
35
   <li>Deprecated <code>ILaunchManager.getLaunchModes()</code></li>
36
   <li>Deprecated <code>launchDelegates</code> extension point attributes: modes and type</li>
37
   <li>Deprecated <code>launchConfigurationTypeImages</code> extension point</li>
38
	
27
</ul>
39
</ul>
28
40
29
<h2>Sep 12, 2006</h2>
41
<h2>Sep 12, 2006</h2>
(-)core/org/eclipse/debug/core/ILaunchDelegate.java (+97 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.core;
12
13
import java.util.Set;
14
15
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
17
18
/**
19
 * This interface describes a launch delegate
20
 * Clients can contribute launch delegate through the <code>launchDelegates</code> extension point
21
 * 
22
 * Example contribution of the local java launch delegate
23
 * <pre>
24
 * <launchDelegate
25
            delegate="org.eclipse.jdt.launching.JavaLaunchDelegate"
26
            id="org.eclipse.jdt.launching.JavaLaunchDelegate">
27
         <appliesTo
28
               type="org.eclipse.jdt.launching.localJavaApplication">
29
            <option
30
                  option="debug">
31
            </option>
32
         </appliesTo>
33
      </launchDelegate>
34
 * </pre>
35
 * 
36
 * Clients are NOT intended to implement this interface
37
 * @since 3.3
38
 */
39
public interface ILaunchDelegate {
40
41
	/**
42
	 * @return returns the unique id of the delegate
43
	 */
44
	public String getIdentifier();
45
	
46
	/**
47
	 * @return the launch delegate
48
	 */
49
	public ILaunchConfigurationDelegate getDelegate() throws CoreException;
50
	
51
	/**
52
	 * One delegate definition can now be associated with more than on launch configuration type.
53
	 * In this case we need to return them all. In the deprecated case when one delegate is associated
54
	 * with one type, we only need return the one (a set of only one element)
55
	 * @return the set of associated launch configuration type ids (String) or the empty set, never <code>null</code>
56
	 */
57
	public Set getLaunchConfigurationTypes();
58
	
59
	/**
60
	 * @return the associated source locator id or <code>null</code> if not provided
61
	 */
62
	public String getSourceLocatorId();
63
	
64
	/**
65
	 * @return the associated source path computer id or <code>null</code> if not provided
66
	 */
67
	public String getSourcePathComputerId();
68
	
69
	/**
70
	 * @return the options associated with this delegate. If no options are specified an empty set is
71
	 * returned, never <code>null</code>.
72
	 */
73
	public Set getOptions();
74
	
75
	/**
76
	 * This method is provided as a backward compatibility measure to allow access to modes, if mode-based
77
	 * launching is still being used.
78
	 * 
79
	 * @return a set of modes for this delegate or the empty set if none are found, never <code>null</code>.
80
	 */
81
	public Set getModes();
82
	
83
	/**
84
	 * used to determine if the delegate applies to the specified launch configuration type via its id only (no expression evaluation is done)
85
	 * @param configtypeId the id of the <code>ILaunchConfigurationType</code>.
86
	 * @return true if the delegate applies to the associated config type, false otherwise
87
	 */
88
	public boolean appliesTo(String configtypeId);
89
	
90
	/**
91
	 * used to determine if the delegate applies to the specified launch configuration type via its id and mode (no expression evaluation is done)
92
	 * @param configtypeId the id of the <code>ILaunchConfigurationType</code>.
93
	 * @param mode the mode
94
	 * @return true if the delegate applies to the associated config type, false otherwise
95
	 */
96
	public boolean appliesTo(String configtypeId, String mode);
97
}
(-)core/org/eclipse/debug/internal/core/ConfigurationElementConstants.java (+89 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 class provides a repository for the names of <code>IConfigurationElement</code> child node ids.
15
 * @since 3.3
16
 * <p>
17
 * <strong>EXPERIMENTAL</strong>. This class has been added as
18
 * part of a work in progress. There is no guarantee that this API will
19
 * remain unchanged during the 3.3 release cycle. Please do not use this API
20
 * without consulting with the Platform/Debug team.
21
 * </p>
22
 */
23
public class ConfigurationElementConstants {
24
25
	/**
26
	 * The id node name for a configuration element
27
	 */
28
	public static String ID = "id"; //$NON-NLS-1$
29
	
30
	/**
31
	 * the name node name for a configuration element
32
	 */
33
	public static String NAME = "name"; //$NON-NLS-1$
34
	
35
	/**
36
	 * the category node name for a configuration element
37
	 */
38
	public static String CATEGORY = "category"; //$NON-NLS-1$
39
	
40
	/**
41
	 * the icon node name for a configuration element
42
	 */
43
	public static String ICON = "icon"; //$NON-NLS-1$
44
	
45
	/**
46
	 * the public node name for a configuration element
47
	 */
48
	public static String PUBLIC = "public"; //$NON-NLS-1$
49
	
50
	/**
51
	 * the modes node name for a configuration element
52
	 */
53
	public static String MODES = "modes"; //$NON-NLS-1$
54
	
55
	/**
56
	 * the type node name for a configuration element
57
	 */
58
	public static final String TYPE = "type"; //$NON-NLS-1$
59
	
60
	/**
61
	 * the option node name for a configuration element
62
	 */
63
	public static final String OPTION = "option"; //$NON-NLS-1$
64
	
65
	/**
66
	 * the delegate node name for a configuration element
67
	 */
68
	public static final String DELEGATE = "delegate"; //$NON-NLS-1$
69
	
70
	/**
71
	 * the appliesTo node name for a configuration element
72
	 */
73
	public static final String APPLIES_TO = "appliesTo"; //$NON-NLS-1$
74
	
75
	/**
76
	 * the sourcePathComputerId node name for a configuration element
77
	 */
78
	public static final String SOURCE_PATH_COMPUTER = "sourcePathComputerId"; //$NON-NLS-1$
79
	
80
	/**
81
	 * the sourceLocatorId node name for a configuration element
82
	 */
83
	public static final String SOURCE_LOCATOR = "sourceLocatorId"; //$NON-NLS-1$
84
	
85
	/**
86
	 * the migrationDelegate node name for a configuration element
87
	 */
88
	public static String MIGRATION_DELEGATE = "migrationDelegate";  //$NON-NLS-1$
89
}
(-)core/org/eclipse/debug/internal/core/LaunchDelegate.java (+180 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.ILaunchDelegate;
22
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
23
24
import com.ibm.icu.text.MessageFormat;
25
26
/**
27
 * Proxy to a launch delegate extension
28
 * 
29
 * @since 3.3
30
 */
31
public class LaunchDelegate implements ILaunchDelegate {
32
	
33
	/**
34
	 * The configuration element for this delegate
35
	 */
36
	private IConfigurationElement fElement = null;
37
	
38
	/**
39
	 * The cached delegate. Remains null until asked for, then persisted
40
	 */
41
	private ILaunchConfigurationDelegate fDelegate = null;
42
	
43
	//lists of cached entries
44
	private HashSet fModes = null;
45
	private HashSet fOptions = null;
46
	private HashSet fTypes = null;
47
	
48
	/**
49
	 * Constructor
50
	 * @param element the configuration element to associate with this launch delegate
51
	 */
52
	public LaunchDelegate(IConfigurationElement element) {
53
		fElement = element;
54
	}
55
	
56
	/* (non-Javadoc)
57
	 * @see org.eclipse.debug.core.ILaunchDelegate#getDelegate()
58
	 */
59
	public ILaunchConfigurationDelegate getDelegate() throws CoreException {
60
		if(fDelegate == null) {
61
			Object obj = fElement.createExecutableExtension(ConfigurationElementConstants.DELEGATE);
62
			if(obj instanceof ILaunchConfigurationDelegate) {
63
				return (ILaunchConfigurationDelegate)obj;
64
			}
65
			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));
66
		}
67
		return fDelegate;
68
	}
69
70
	/* (non-Javadoc)
71
	 * @see org.eclipse.debug.core.ILaunchDelegate#getIdentifier()
72
	 */
73
	public String getIdentifier() {
74
		return fElement.getAttribute(ConfigurationElementConstants.ID);
75
	}
76
77
	/* (non-Javadoc)
78
	 * @see org.eclipse.debug.core.ILaunchDelegate#getLaunchConfigurationType()
79
	 */
80
	public Set getLaunchConfigurationTypes() {
81
		if(fTypes == null) {
82
			fTypes = new HashSet();
83
			//try for appliesTo first off
84
			IConfigurationElement[] types = fElement.getChildren(ConfigurationElementConstants.APPLIES_TO);
85
			for(int i = 0; i < types.length; i++) {
86
				fTypes.add(types[i].getAttribute(ConfigurationElementConstants.TYPE));
87
			}
88
			if(fTypes.size() < 1) {
89
			//fall back to single association if no appliesTo
90
				String type = fElement.getAttribute(ConfigurationElementConstants.TYPE);
91
				if(type == null) {
92
					//the case when we have passed a launch configuration type to the launch delegate
93
					type = fElement.getAttribute(ConfigurationElementConstants.ID);
94
				}
95
				fTypes.add(type);
96
			}
97
		}
98
		return fTypes;
99
	}
100
101
	/* (non-Javadoc)
102
	 * @see org.eclipse.debug.core.ILaunchDelegate#getOptions()
103
	 */
104
	public Set getOptions() {
105
		if(fOptions == null) {
106
			fOptions = new HashSet();
107
			IConfigurationElement[] applies = fElement.getChildren(ConfigurationElementConstants.APPLIES_TO);
108
			if(applies.length > 0) {
109
				findAllOptions(applies, fOptions);
110
			}
111
		}
112
		return fOptions;
113
	}
114
115
	/**
116
	 * Recursively finds all option for the given launch delegate
117
	 * @param infos the root listing of infos to search
118
	 * @param list the listing to add found options to
119
	 */
120
	private void findAllOptions(IConfigurationElement[] infos, HashSet list) {
121
		IConfigurationElement[] children = null;
122
		String option = null;
123
		for(int i = 0; i < infos.length; i++) {
124
			children = infos[i].getChildren();
125
			if(children.length > 0) {
126
				findAllOptions(children, list);
127
			}
128
			option = infos[i].getAttribute(ConfigurationElementConstants.OPTION);
129
			if(option != null) {
130
				list.add(option);
131
			}
132
		}
133
	}
134
	
135
	/* (non-Javadoc)
136
	 * @see org.eclipse.debug.core.ILaunchDelegate#getModes()
137
	 */
138
	public Set getModes() {
139
		if (fModes == null) {
140
			fModes = new HashSet();
141
			String modes = fElement.getAttribute("modes"); //$NON-NLS-1$
142
			if (modes != null) {
143
				String[] strings = modes.split(","); //$NON-NLS-1$
144
				for (int i = 0; i < strings.length; i++) {
145
					fModes.add(strings[i].trim());
146
				}
147
			}
148
		}
149
		return fModes;
150
	}
151
	
152
	/* (non-Javadoc)
153
	 * @see org.eclipse.debug.core.ILaunchDelegate#getSourceLocatorId()
154
	 */
155
	public String getSourceLocatorId() {
156
		return fElement.getAttribute(ConfigurationElementConstants.SOURCE_LOCATOR);
157
	}
158
159
	/* (non-Javadoc)
160
	 * @see org.eclipse.debug.core.ILaunchDelegate#getSourcePathComputerId()
161
	 */
162
	public String getSourcePathComputerId() {
163
		return fElement.getAttribute(ConfigurationElementConstants.SOURCE_PATH_COMPUTER);
164
	}
165
166
	/* (non-Javadoc)
167
	 * @see org.eclipse.debug.core.ILaunchDelegate#appliesTo(java.lang.String)
168
	 */
169
	public boolean appliesTo(String configtypeId) {
170
		return getLaunchConfigurationTypes().contains(configtypeId);
171
	}
172
	
173
	/* (non-Javadoc)
174
	 * @see org.eclipse.debug.core.ILaunchDelegate#appliesTo(java.lang.String, java.lang.String)
175
	 */
176
	public boolean appliesTo(String configtypeId, String mode) {
177
		return getLaunchConfigurationTypes().contains(configtypeId) & getModes().contains(mode);
178
	}
179
180
}
(-)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/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.ConfigurationElementConstants;
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(ConfigurationElementConstants.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
(-)schema/launchConfigurationTypeImages.exsd (-19 / +39 lines)
Lines 2-16 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
11
</annotation>
11
&lt;p&gt;
12
&lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;. This extension point has been deprecated 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.
16
&lt;/p&gt;
17
      </documentation>
18
   </annotation>
12
19
13
   <element name="extension">
20
   <element name="extension">
21
      <annotation>
22
         <appInfo>
23
            <meta.element deprecated="true"/>
24
         </appInfo>
25
      </annotation>
14
      <complexType>
26
      <complexType>
15
         <sequence>
27
         <sequence>
16
            <element ref="launchConfigurationTypeImage" minOccurs="0" maxOccurs="unbounded"/>
28
            <element ref="launchConfigurationTypeImage" minOccurs="0" maxOccurs="unbounded"/>
Lines 32-38 Link Here
32
         <attribute name="name" type="string">
44
         <attribute name="name" type="string">
33
            <annotation>
45
            <annotation>
34
               <documentation>
46
               <documentation>
35
                 an optional name of the extension instance
47
                  an optional name of the extension instance
36
               </documentation>
48
               </documentation>
37
            </annotation>
49
            </annotation>
38
         </attribute>
50
         </attribute>
Lines 46-67 Link Here
46
               <documentation>
58
               <documentation>
47
                  specifies a unique identifier for this launch configuration type image.
59
                  specifies a unique identifier for this launch configuration type image.
48
               </documentation>
60
               </documentation>
61
               <appInfo>
62
                  <meta.attribute deprecated="true"/>
63
               </appInfo>
49
            </annotation>
64
            </annotation>
50
         </attribute>
65
         </attribute>
51
         <attribute name="configTypeID" type="string" use="required">
66
         <attribute name="configTypeID" type="string" use="required">
52
            <annotation>
67
            <annotation>
53
               <documentation>
68
               <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).
69
                  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>
70
               </documentation>
71
               <appInfo>
72
                  <meta.attribute deprecated="true"/>
73
               </appInfo>
56
            </annotation>
74
            </annotation>
57
         </attribute>
75
         </attribute>
58
         <attribute name="icon" type="string" use="required">
76
         <attribute name="icon" type="string" use="required">
59
            <annotation>
77
            <annotation>
60
               <documentation>
78
               <documentation>
61
                  specifies the plugin-relative path of an image file.
79
                  specifies the plugin-relative path of an image file.
80
81
&lt;br&gt;&lt;b&gt;To supply an image to the specified launch configuration type, it should be done in the launch configuration type definition.&lt;/b&gt;
62
               </documentation>
82
               </documentation>
63
               <appInfo>
83
               <appInfo>
64
                  <meta.attribute kind="resource"/>
84
                  <meta.attribute kind="resource" deprecated="true"/>
65
               </appInfo>
85
               </appInfo>
66
            </annotation>
86
            </annotation>
67
         </attribute>
87
         </attribute>
Lines 77-100 Link Here
77
97
78
&lt;p&gt;
98
&lt;p&gt;
79
&lt;pre&gt;
99
&lt;pre&gt;
80
	&lt;extension point="org.eclipse.debug.ui.launchConfigurationTypeImages"&gt;
100
 &lt;extension point=&quot;org.eclipse.debug.ui.launchConfigurationTypeImages&quot;&gt;
81
		&lt;launchConfigurationTypeImage
101
  &lt;launchConfigurationTypeImage
82
			  id="com.example.FirstLaunchConfigurationTypeImage"
102
     id=&quot;com.example.FirstLaunchConfigurationTypeImage&quot;
83
			  configTypeID="com.example.FirstLaunchConfigurationType"
103
     configTypeID=&quot;com.example.FirstLaunchConfigurationType&quot;
84
			  icon="icons/FirstLaunchConfigurationType.gif"&gt;
104
     icon=&quot;icons/FirstLaunchConfigurationType.gif&quot;&gt;
85
		&lt;/launchConfigurationTypeImage&gt;
105
  &lt;/launchConfigurationTypeImage&gt;
86
	&lt;/extension&gt;
106
 &lt;/extension&gt;
87
&lt;/pre&gt;
107
&lt;/pre&gt;
88
&lt;/p&gt;
108
&lt;/p&gt;
89
      </documentation>
109
      </documentation>
90
   </annotation>
110
   </annotation>
91
   
111
92
   <annotation>
112
   <annotation>
93
      <appInfo>
113
      <appInfo>
94
         <meta.section type="copyright"/>
114
         <meta.section type="copyright"/>
95
      </appInfo>
115
      </appInfo>
96
      <documentation>
116
      <documentation>
97
Copyright (c) 2000, 2005 IBM Corporation and others.&lt;br&gt;
117
         Copyright (c) 2000, 2005 IBM Corporation and others.&lt;br&gt;
98
All rights reserved. This program and the accompanying materials are made 
118
All rights reserved. This program and the accompanying materials are made 
99
available under the terms of the Eclipse Public License v1.0 which 
119
available under the terms of the Eclipse Public License v1.0 which 
100
accompanies this distribution, and is available at 
120
accompanies this distribution, and is available at 

Return to bug 157059