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 402787 | Differences between
and this patch

Collapse All | Expand All

(-)a/tools/etfw/org.eclipse.ptp.etfw/META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 29-33 Link Here
29
Bundle-Vendor: %pluginProvider
29
Bundle-Vendor: %pluginProvider
30
Bundle-RequiredExecutionEnvironment: J2SE-1.5
30
Bundle-RequiredExecutionEnvironment: J2SE-1.5
31
Export-Package: org.eclipse.ptp.etfw,
31
Export-Package: org.eclipse.ptp.etfw,
32
 org.eclipse.ptp.etfw.internal;x-friends:="org.eclipse.ptp.etfw.tau,org.eclipse.ptp.etfw.tau.perfdmf",
32
 org.eclipse.ptp.etfw.internal;x-friends:="org.eclipse.ptp.etfw.tau,org.eclipse.ptp.etfw.tau.perfdmf,org.eclipse.ptp.etfw.tau.ui",
33
 org.eclipse.ptp.etfw.ui;x-friends:="org.eclipse.ptp.etfw.tau,org.eclipse.ptp.etfw.launch"
33
 org.eclipse.ptp.etfw.ui;x-friends:="org.eclipse.ptp.etfw.tau,org.eclipse.ptp.etfw.launch"
(-)a/tools/etfw/org.eclipse.ptp.etfw/plugin.xml (+6 lines)
Lines 72-75 Link Here
72
          type="org.eclipse.cdt.launch.applicationLaunchType">
72
          type="org.eclipse.cdt.launch.applicationLaunchType">
73
    </launchDelegate>
73
    </launchDelegate>
74
 </extension>
74
 </extension>
75
 <extension
76
       point="org.eclipse.core.runtime.preferences">
77
    <initializer
78
          class="org.eclipse.ptp.etfw.internal.PreferenceInitializer">
79
    </initializer>
80
 </extension>
75
</plugin>
81
</plugin>
(-)a/tools/etfw/org.eclipse.ptp.etfw/src/org/eclipse/ptp/etfw/IToolLaunchConfigurationConstants.java (-3 / +3 lines)
Lines 48-64 Link Here
48
	/**
48
	/**
49
	 * @since 6.0
49
	 * @since 6.0
50
	 */
50
	 */
51
	public static final String ETFW_VERSION = "ETFW_VERSION";
51
	public static final String ETFW_VERSION = "ETFW_VERSION"; //$NON-NLS-1$
52
52
53
	/**
53
	/**
54
	 * @since 6.0
54
	 * @since 6.0
55
	 */
55
	 */
56
	public static final String USE_SAX_PARSER = "sax-parser";
56
	public static final String USE_SAX_PARSER = "sax-parser"; //$NON-NLS-1$
57
57
58
	/**
58
	/**
59
	 * @since 6.0
59
	 * @since 6.0
60
	 */
60
	 */
61
	public static final String USE_JAXB_PARSER = "jaxb-parser";
61
	public static final String USE_JAXB_PARSER = "jaxb-parser"; //$NON-NLS-1$
62
	/**
62
	/**
63
	 * ID for boolean: true = keep instrumented executable
63
	 * ID for boolean: true = keep instrumented executable
64
	 */
64
	 */
(-)a/tools/etfw/org.eclipse.ptp.etfw/src/org/eclipse/ptp/etfw/PreferenceConstants.java (+11 lines)
Added Link Here
1
package org.eclipse.ptp.etfw;
2
3
/**
4
 * Preference constants for the external tools framework
5
 * 
6
 * @since 6.0
7
 * 
8
 */
9
public interface PreferenceConstants {
10
	public static final String ETFW_VERSION = "ETFW_VERSION"; //$NON-NLS-1$
11
}
(-)a/tools/etfw/org.eclipse.ptp.etfw/src/org/eclipse/ptp/etfw/Preferences.java (+511 lines)
Added Link Here
1
package org.eclipse.ptp.etfw;
2
3
import org.eclipse.core.runtime.Platform;
4
import org.eclipse.core.runtime.preferences.DefaultScope;
5
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
6
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
7
import org.eclipse.core.runtime.preferences.IScopeContext;
8
import org.eclipse.core.runtime.preferences.InstanceScope;
9
import org.eclipse.ptp.remote.core.PTPRemoteCorePlugin;
10
import org.osgi.service.prefs.BackingStoreException;
11
12
/**
13
 * Convenience class to facilitate using the new {@link IEclipsePreferences} story. Adapted from
14
 * org.eclipse.debug.internal.core.Preferences.
15
 * 
16
 * @since 6.0
17
 * @noinstantiate This class is not intended to be instantiated by clients.
18
 */
19
public final class Preferences {
20
	private static final IScopeContext[] contexts = new IScopeContext[] { DefaultScope.INSTANCE, InstanceScope.INSTANCE };
21
22
	private static final int DEFAULT_CONTEXT = 0;
23
	private static final int INSTANCE_CONTEXT = 1;
24
25
	/**
26
	 * Adds the given preference listener to the {@link DefaultScope} and the {@link InstanceScope}
27
	 * 
28
	 * @param qualifier
29
	 * @param listener
30
	 */
31
	public static void addPreferenceChangeListener(String qualifier, IPreferenceChangeListener listener) {
32
		contexts[DEFAULT_CONTEXT].getNode(qualifier).addPreferenceChangeListener(listener);
33
		contexts[INSTANCE_CONTEXT].getNode(qualifier).addPreferenceChangeListener(listener);
34
	}
35
36
	/**
37
	 * Returns whether the named preference is know in the preference store.
38
	 * 
39
	 * @param qualifier
40
	 * @param name
41
	 * @return
42
	 */
43
	public static boolean contains(String qualifier, String name) {
44
		return (contexts[INSTANCE_CONTEXT].getNode(qualifier).get(name, null) != null || contexts[DEFAULT_CONTEXT].getNode(
45
				qualifier).get(name, null) != null);
46
	}
47
48
	/**
49
	 * Returns the value in the preference store for the given key. If the key
50
	 * is not defined then return the default value. Use the canonical scope
51
	 * lookup order for finding the preference value.
52
	 * 
53
	 * @param qualifier
54
	 * @param key
55
	 * @param defaultvalue
56
	 * 
57
	 * @return the value of the preference or the given default value
58
	 */
59
	public static boolean getBoolean(String qualifier, String key) {
60
		return Platform.getPreferencesService().getBoolean(qualifier, key, false, null);
61
	}
62
63
	/**
64
	 * Returns the value in the preference store for the given key. If the key
65
	 * is not defined then return the default value. Use the canonical scope
66
	 * lookup order for finding the preference value.
67
	 * 
68
	 * @param qualifier
69
	 * @param key
70
	 * @param defaultvalue
71
	 * 
72
	 * @return the value of the preference or the given default value
73
	 */
74
	public static byte[] getByteArray(String qualifier, String key) {
75
		return Platform.getPreferencesService().getByteArray(qualifier, key, null, null);
76
	}
77
78
	/**
79
	 * Returns the default boolean value stored in the {@link DefaultScope} for
80
	 * the given key or the specified default value if the key does not appear
81
	 * in the {@link DefaultScope}
82
	 * 
83
	 * @param qualifier
84
	 * @param key
85
	 * @param defaultvalue
86
	 * 
87
	 * @return the boolean value set in the {@link DefaultScope} for the given
88
	 *         key, or the specified default value.
89
	 */
90
	public static synchronized boolean getDefaultBoolean(String qualifier, String key, boolean defaultvalue) {
91
		return contexts[DEFAULT_CONTEXT].getNode(qualifier).getBoolean(key, defaultvalue);
92
	}
93
94
	/**
95
	 * Returns the default byte array value stored in the {@link DefaultScope} for the given key or the specified default value if
96
	 * the key does not
97
	 * appear in the {@link DefaultScope}
98
	 * 
99
	 * @param qualifier
100
	 * @param key
101
	 * @param defaultvalue
102
	 * 
103
	 * @return the byte array value set in the {@link DefaultScope} for the
104
	 *         given key, or the specified default value.
105
	 */
106
	public static synchronized byte[] getDefaultByteArray(String qualifier, String key, byte[] defaultvalue) {
107
		return contexts[DEFAULT_CONTEXT].getNode(qualifier).getByteArray(key, defaultvalue);
108
	}
109
110
	/**
111
	 * Returns the default double value stored in the {@link DefaultScope} for
112
	 * the given key or the specified default value if the key does not appear
113
	 * in the {@link DefaultScope}
114
	 * 
115
	 * @param qualifier
116
	 * @param key
117
	 * @param defaultvalue
118
	 * 
119
	 * @return the double value set in the {@link DefaultScope} for the given
120
	 *         key, or the specified default value.
121
	 */
122
	public static synchronized double getDefaultDouble(String qualifier, String key, double defaultvalue) {
123
		return contexts[DEFAULT_CONTEXT].getNode(qualifier).getDouble(key, defaultvalue);
124
	}
125
126
	/**
127
	 * Returns the default float value stored in the {@link DefaultScope} for
128
	 * the given key or the specified default value if the key does not appear
129
	 * in the {@link DefaultScope}
130
	 * 
131
	 * @param qualifier
132
	 * @param key
133
	 * @param defaultvalue
134
	 * 
135
	 * @return the float value set in the {@link DefaultScope} for the given
136
	 *         key, or the specified default value.
137
	 */
138
	public static synchronized float getDefaultFloat(String qualifier, String key, float defaultvalue) {
139
		return contexts[DEFAULT_CONTEXT].getNode(qualifier).getFloat(key, defaultvalue);
140
	}
141
142
	/**
143
	 * Returns the default integer value stored in the {@link DefaultScope} for
144
	 * the given key or the specified default value if the key does not appear
145
	 * in the {@link DefaultScope}
146
	 * 
147
	 * @param qualifier
148
	 * @param key
149
	 * @param defaultvalue
150
	 * 
151
	 * @return the integer value set in the {@link DefaultScope} for the given
152
	 *         key, or the specified default value.
153
	 */
154
	public static synchronized int getDefaultInt(String qualifier, String key, int defaultvalue) {
155
		return contexts[DEFAULT_CONTEXT].getNode(qualifier).getInt(key, defaultvalue);
156
	}
157
158
	/**
159
	 * Returns the default long value stored in the {@link DefaultScope} for the
160
	 * given key or the specified default value if the key does not appear in
161
	 * the {@link DefaultScope}
162
	 * 
163
	 * @param qualifier
164
	 * @param key
165
	 * @param defaultvalue
166
	 * 
167
	 * @return the long value set in the {@link DefaultScope} for the given key,
168
	 *         or the specified default value.
169
	 */
170
	public static synchronized long getDefaultLong(String qualifier, String key, long defaultvalue) {
171
		return contexts[DEFAULT_CONTEXT].getNode(qualifier).getLong(key, defaultvalue);
172
	}
173
174
	/**
175
	 * Returns the default string value stored in the {@link DefaultScope} for
176
	 * the given key or the specified default value if the key does not appear
177
	 * in the {@link DefaultScope}
178
	 * 
179
	 * @param qualifier
180
	 * @param key
181
	 * @param defaultvalue
182
	 * 
183
	 * @return the string value set in the {@link DefaultScope} for the given
184
	 *         key, or the specified default value.
185
	 */
186
	public static synchronized String getDefaultString(String qualifier, String key, String defaultvalue) {
187
		return contexts[DEFAULT_CONTEXT].getNode(qualifier).get(key, defaultvalue);
188
	}
189
190
	/**
191
	 * Returns the value in the preference store for the given key. If the key
192
	 * is not defined then return the default value. Use the canonical scope
193
	 * lookup order for finding the preference value.
194
	 * 
195
	 * @param qualifier
196
	 * @param key
197
	 * @param defaultvalue
198
	 * 
199
	 * @return the value of the preference or the given default value
200
	 */
201
	public static double getDouble(String qualifier, String key) {
202
		return Platform.getPreferencesService().getDouble(qualifier, key, 0.0, null);
203
	}
204
205
	/**
206
	 * Returns the value in the preference store for the given key. If the key
207
	 * is not defined then return the default value. Use the canonical scope
208
	 * lookup order for finding the preference value.
209
	 * 
210
	 * @param qualifier
211
	 * @param key
212
	 * @param defaultvalue
213
	 * 
214
	 * @return the value of the preference or the given default value
215
	 */
216
	public static float getFloat(String qualifier, String key) {
217
		return Platform.getPreferencesService().getFloat(qualifier, key, 0.0f, null);
218
	}
219
220
	/**
221
	 * Returns the value in the preference store for the given key. If the key
222
	 * is not defined then return the default value. Use the canonical scope
223
	 * lookup order for finding the preference value.
224
	 * 
225
	 * @param qualifier
226
	 * @param key
227
	 * @param defaultvalue
228
	 * 
229
	 * @return the value of the preference or the given default value
230
	 */
231
	public static int getInt(String qualifier, String key) {
232
		return Platform.getPreferencesService().getInt(qualifier, key, 0, null);
233
	}
234
235
	/**
236
	 * Returns the value in the preference store for the given key. If the key
237
	 * is not defined then return the default value. Use the canonical scope
238
	 * lookup order for finding the preference value.
239
	 * 
240
	 * @param qualifier
241
	 * @param key
242
	 * @param defaultvalue
243
	 * 
244
	 * @return the value of the preference or the given default value
245
	 */
246
	public static long getLong(String qualifier, String key) {
247
		return Platform.getPreferencesService().getLong(qualifier, key, 0L, null);
248
	}
249
250
	/**
251
	 * Returns the value in the preference store for the given key. If the key
252
	 * is not defined then return the default value. Use the canonical scope
253
	 * lookup order for finding the preference value.
254
	 * 
255
	 * @param qualifier
256
	 * @param key
257
	 * @param defaultvalue
258
	 * 
259
	 * @return the value of the preference or the given default value
260
	 */
261
	public static String getString(String qualifier, String key) {
262
		return Platform.getPreferencesService().getString(qualifier, key, null, null);
263
	}
264
265
	/**
266
	 * Returns true if the named preference has the default value.
267
	 * 
268
	 * @param qualifier
269
	 * @param name
270
	 * @return
271
	 */
272
	public static boolean isDefault(String qualifier, String name) {
273
		String defVal = contexts[DEFAULT_CONTEXT].getNode(qualifier).get(name, null);
274
		if (defVal != null) {
275
			String val = contexts[INSTANCE_CONTEXT].getNode(qualifier).get(name, null);
276
			return (val != null && val.equals(defVal));
277
		}
278
		return false;
279
	}
280
281
	/**
282
	 * Removes the given preference listener from the {@link DefaultScope} and
283
	 * the {@link InstanceScope}
284
	 * 
285
	 * @param qualifier
286
	 * @param listener
287
	 */
288
	public static void removePreferenceChangeListener(String qualifier, IPreferenceChangeListener listener) {
289
		contexts[DEFAULT_CONTEXT].getNode(qualifier).removePreferenceChangeListener(listener);
290
		contexts[INSTANCE_CONTEXT].getNode(qualifier).removePreferenceChangeListener(listener);
291
	}
292
293
	/**
294
	 * Save the preferences for the given plugin identifier. It should be noted
295
	 * that all pending preference changes will be flushed with this method.
296
	 * 
297
	 * @param qualifier
298
	 */
299
	public static synchronized void savePreferences(String qualifier) {
300
		try {
301
			contexts[DEFAULT_CONTEXT].getNode(qualifier).flush();
302
			contexts[INSTANCE_CONTEXT].getNode(qualifier).flush();
303
		} catch (BackingStoreException bse) {
304
			PTPRemoteCorePlugin.log(bse);
305
		}
306
	}
307
308
	/**
309
	 * Sets a boolean preference in the {@link InstanceScope}.
310
	 * 
311
	 * @param qualifier
312
	 * @param key
313
	 *            the key
314
	 * @param value
315
	 *            the value
316
	 */
317
	public static synchronized void setBoolean(String qualifier, String key, boolean value) {
318
		contexts[INSTANCE_CONTEXT].getNode(qualifier).putBoolean(key, value);
319
	}
320
321
	/**
322
	 * Sets a byte array preference in the {@link InstanceScope}.
323
	 * 
324
	 * @param qualifier
325
	 * @param key
326
	 *            the key
327
	 * @param value
328
	 *            the value
329
	 */
330
	public static synchronized void setByteArray(String qualifier, String key, byte[] value) {
331
		contexts[INSTANCE_CONTEXT].getNode(qualifier).putByteArray(key, value);
332
	}
333
334
	/**
335
	 * Sets a boolean in the {@link DefaultScope}
336
	 * 
337
	 * @param qualifier
338
	 * @param key
339
	 *            the key
340
	 * @param value
341
	 *            the new value
342
	 */
343
	public static synchronized void setDefaultBoolean(String qualifier, String key, boolean value) {
344
		contexts[DEFAULT_CONTEXT].getNode(qualifier).putBoolean(key, value);
345
	}
346
347
	/**
348
	 * Sets a byte array in the {@link DefaultScope}
349
	 * 
350
	 * @param qualifier
351
	 * @param key
352
	 *            the key
353
	 * @param value
354
	 *            the new value
355
	 */
356
	public static synchronized void setDefaultByteArray(String qualifier, String key, byte[] value) {
357
		contexts[DEFAULT_CONTEXT].getNode(qualifier).putByteArray(key, value);
358
	}
359
360
	/**
361
	 * Sets a double in the {@link DefaultScope}
362
	 * 
363
	 * @param qualifier
364
	 * @param key
365
	 *            the key
366
	 * @param value
367
	 *            the new value
368
	 */
369
	public static synchronized void setDefaultDouble(String qualifier, String key, double value) {
370
		contexts[DEFAULT_CONTEXT].getNode(qualifier).putDouble(key, value);
371
	}
372
373
	/**
374
	 * Sets a float in the {@link DefaultScope}
375
	 * 
376
	 * @param qualifier
377
	 * @param key
378
	 *            the key
379
	 * @param value
380
	 *            the new value
381
	 */
382
	public static synchronized void setDefaultFloat(String qualifier, String key, float value) {
383
		contexts[DEFAULT_CONTEXT].getNode(qualifier).putFloat(key, value);
384
	}
385
386
	/**
387
	 * Sets a integer in the {@link DefaultScope}
388
	 * 
389
	 * @param qualifier
390
	 * @param key
391
	 *            the key
392
	 * @param value
393
	 *            the new value
394
	 */
395
	public static synchronized void setDefaultInt(String qualifier, String key, int value) {
396
		contexts[DEFAULT_CONTEXT].getNode(qualifier).putInt(key, value);
397
	}
398
399
	/**
400
	 * Sets a long in the {@link DefaultScope}
401
	 * 
402
	 * @param qualifier
403
	 * @param key
404
	 *            the key
405
	 * @param value
406
	 *            the new value
407
	 */
408
	public static synchronized void setDefaultLong(String qualifier, String key, long value) {
409
		contexts[DEFAULT_CONTEXT].getNode(qualifier).putLong(key, value);
410
	}
411
412
	/**
413
	 * Sets a string in the {@link DefaultScope}
414
	 * 
415
	 * @param qualifier
416
	 * @param key
417
	 *            the key
418
	 * @param value
419
	 *            the new value
420
	 */
421
	public static synchronized void setDefaultString(String qualifier, String key, String value) {
422
		contexts[DEFAULT_CONTEXT].getNode(qualifier).put(key, value);
423
	}
424
425
	/**
426
	 * Sets a double preference in the {@link InstanceScope}.
427
	 * 
428
	 * @param qualifier
429
	 * @param key
430
	 *            the key
431
	 * @param value
432
	 *            the value
433
	 */
434
	public static synchronized void setDouble(String qualifier, String key, double value) {
435
		contexts[INSTANCE_CONTEXT].getNode(qualifier).putDouble(key, value);
436
	}
437
438
	/**
439
	 * Sets a float preference in the {@link InstanceScope}.
440
	 * 
441
	 * @param qualifier
442
	 * @param key
443
	 *            the key
444
	 * @param value
445
	 *            the value
446
	 */
447
	public static synchronized void setFloat(String qualifier, String key, float value) {
448
		contexts[INSTANCE_CONTEXT].getNode(qualifier).putFloat(key, value);
449
	}
450
451
	/**
452
	 * Sets a integer preference in the {@link InstanceScope}.
453
	 * 
454
	 * @param qualifier
455
	 * @param key
456
	 *            the key
457
	 * @param value
458
	 *            the value
459
	 */
460
	public static synchronized void setInt(String qualifier, String key, int value) {
461
		contexts[INSTANCE_CONTEXT].getNode(qualifier).putInt(key, value);
462
	}
463
464
	/**
465
	 * Sets a long preference in the {@link InstanceScope}.
466
	 * 
467
	 * @param qualifier
468
	 * @param key
469
	 *            the key
470
	 * @param value
471
	 *            the value
472
	 */
473
	public static synchronized void setLong(String qualifier, String key, long value) {
474
		contexts[INSTANCE_CONTEXT].getNode(qualifier).putLong(key, value);
475
	}
476
477
	/**
478
	 * Sets a string preference in the {@link InstanceScope}.
479
	 * 
480
	 * @param qualifier
481
	 * @param key
482
	 *            the key
483
	 * @param value
484
	 *            the value
485
	 */
486
	public static synchronized void setString(String qualifier, String key, String value) {
487
		contexts[INSTANCE_CONTEXT].getNode(qualifier).put(key, value);
488
	}
489
490
	/**
491
	 * Sets the given preference to its default value. This is done by removing
492
	 * any set value from the {@link InstanceScope}. Has no effect if the given
493
	 * key is <code>null</code>.
494
	 * 
495
	 * @param qualifier
496
	 * @param key
497
	 *            the key for the preference
498
	 */
499
	public static synchronized void setToDefault(String qualifier, String key) {
500
		if (key != null) {
501
			contexts[INSTANCE_CONTEXT].getNode(qualifier).remove(key);
502
		}
503
	}
504
505
	/**
506
	 * Constructor
507
	 */
508
	private Preferences() {
509
		// no direct instantiation
510
	}
511
}
(-)a/tools/etfw/org.eclipse.ptp.etfw/src/org/eclipse/ptp/etfw/internal/PreferenceInitializer.java (+20 lines)
Added Link Here
1
package org.eclipse.ptp.etfw.internal;
2
3
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
4
import org.eclipse.ptp.etfw.Activator;
5
import org.eclipse.ptp.etfw.IToolLaunchConfigurationConstants;
6
import org.eclipse.ptp.etfw.PreferenceConstants;
7
import org.eclipse.ptp.etfw.Preferences;
8
9
/**
10
 * Initializes default preferences for the external tools framework
11
 * 
12
 */
13
public class PreferenceInitializer extends AbstractPreferenceInitializer {
14
15
	@Override
16
	public void initializeDefaultPreferences() {
17
		Preferences.setDefaultString(Activator.PLUGIN_ID, PreferenceConstants.ETFW_VERSION,
18
				IToolLaunchConfigurationConstants.USE_JAXB_PARSER);
19
	}
20
}
(-)a/tools/etfw/org.eclipse.ptp.etfw/src/org/eclipse/ptp/etfw/messages/Messages.java (+2 lines)
Lines 75-84 Link Here
75
	public static String ParametricParameterTab_SelectPerfExScript;
75
	public static String ParametricParameterTab_SelectPerfExScript;
76
	public static String ParametricParameterTab_Values;
76
	public static String ParametricParameterTab_Values;
77
	public static String ExternalToolPreferencePage_Add;
77
	public static String ExternalToolPreferencePage_Add;
78
	public static String ExternalToolPreferencePage_ETFW_PARSER;
78
	public static String ExternalToolPreferencePage_ExToolConf;
79
	public static String ExternalToolPreferencePage_ExToolConf;
79
	public static String ExternalToolPreferencePage_Remove;
80
	public static String ExternalToolPreferencePage_Remove;
80
	public static String ExternalToolPreferencePage_SelectToolDefXML;
81
	public static String ExternalToolPreferencePage_SelectToolDefXML;
81
	public static String ExternalToolPreferencePage_ToolDefFile;
82
	public static String ExternalToolPreferencePage_ToolDefFile;
83
	public static String ExternalToolPreferencePage_ToolParser;
82
	public static String ToolLocationPreferencePage_BinDir;
84
	public static String ToolLocationPreferencePage_BinDir;
83
	public static String ToolLocationPreferencePage_BinDirectory;
85
	public static String ToolLocationPreferencePage_BinDirectory;
84
	public static String ToolLocationPreferencePage_Browse;
86
	public static String ToolLocationPreferencePage_Browse;
(-)a/tools/etfw/org.eclipse.ptp.etfw/src/org/eclipse/ptp/etfw/messages/messages.properties (+2 lines)
Lines 69-78 Link Here
69
ParametricParameterTab_SelectPerfExScript=Select a PerfExplorer script
69
ParametricParameterTab_SelectPerfExScript=Select a PerfExplorer script
70
ParametricParameterTab_Values=Values
70
ParametricParameterTab_Values=Values
71
ExternalToolPreferencePage_Add=Add
71
ExternalToolPreferencePage_Add=Add
72
ExternalToolPreferencePage_ETFW_PARSER=ETFW Parser:
72
ExternalToolPreferencePage_ExToolConf=External Tool Configuration
73
ExternalToolPreferencePage_ExToolConf=External Tool Configuration
73
ExternalToolPreferencePage_Remove=Remove
74
ExternalToolPreferencePage_Remove=Remove
74
ExternalToolPreferencePage_SelectToolDefXML=Select tool definition xml file
75
ExternalToolPreferencePage_SelectToolDefXML=Select tool definition xml file
75
ExternalToolPreferencePage_ToolDefFile=Tool Definition File:
76
ExternalToolPreferencePage_ToolDefFile=Tool Definition File:
77
ExternalToolPreferencePage_ToolParser=External Tool Parser
76
ToolLocationPreferencePage_BinDir=\ Bin Directory:
78
ToolLocationPreferencePage_BinDir=\ Bin Directory:
77
ToolLocationPreferencePage_BinDirectory=\ Bin Directory
79
ToolLocationPreferencePage_BinDirectory=\ Bin Directory
78
ToolLocationPreferencePage_Browse=Browse
80
ToolLocationPreferencePage_Browse=Browse
(-)a/tools/etfw/org.eclipse.ptp.etfw/src/org/eclipse/ptp/etfw/preferences/ExternalToolPreferencePage.java (-10 / +51 lines)
Lines 36-42 Link Here
36
import org.eclipse.jface.util.PropertyChangeEvent;
36
import org.eclipse.jface.util.PropertyChangeEvent;
37
import org.eclipse.ptp.etfw.Activator;
37
import org.eclipse.ptp.etfw.Activator;
38
import org.eclipse.ptp.etfw.IToolLaunchConfigurationConstants;
38
import org.eclipse.ptp.etfw.IToolLaunchConfigurationConstants;
39
import org.eclipse.ptp.etfw.PreferenceConstants;
39
import org.eclipse.ptp.etfw.messages.Messages;
40
import org.eclipse.ptp.etfw.messages.Messages;
41
import org.eclipse.ptp.remote.core.Preferences;
40
import org.eclipse.swt.SWT;
42
import org.eclipse.swt.SWT;
41
import org.eclipse.swt.events.ModifyEvent;
43
import org.eclipse.swt.events.ModifyEvent;
42
import org.eclipse.swt.events.ModifyListener;
44
import org.eclipse.swt.events.ModifyListener;
Lines 45-50 Link Here
45
import org.eclipse.swt.layout.GridData;
47
import org.eclipse.swt.layout.GridData;
46
import org.eclipse.swt.layout.GridLayout;
48
import org.eclipse.swt.layout.GridLayout;
47
import org.eclipse.swt.widgets.Button;
49
import org.eclipse.swt.widgets.Button;
50
import org.eclipse.swt.widgets.Combo;
48
import org.eclipse.swt.widgets.Composite;
51
import org.eclipse.swt.widgets.Composite;
49
import org.eclipse.swt.widgets.Control;
52
import org.eclipse.swt.widgets.Control;
50
import org.eclipse.swt.widgets.FileDialog;
53
import org.eclipse.swt.widgets.FileDialog;
Lines 68-73 Link Here
68
	protected List XMLLocs = null;
71
	protected List XMLLocs = null;
69
	protected Button browseXMLButton = null;
72
	protected Button browseXMLButton = null;
70
	protected Button removeItemButton = null;
73
	protected Button removeItemButton = null;
74
	protected Combo parser = null;
71
75
72
	// protected Button checkAutoOpts=null;
76
	// protected Button checkAutoOpts=null;
73
	// protected Button checkAixOpts=null;
77
	// protected Button checkAixOpts=null;
Lines 111-120 Link Here
111
		composite.setLayout(createGridLayout(1, true, 0, 0));
115
		composite.setLayout(createGridLayout(1, true, 0, 0));
112
		composite.setLayoutData(spanGridData(GridData.FILL_HORIZONTAL, 2));
116
		composite.setLayoutData(spanGridData(GridData.FILL_HORIZONTAL, 2));
113
117
118
		createParserSelection(composite);
114
		createTauConf(composite);
119
		createTauConf(composite);
115
		loadSaved();
120
		loadSaved();
116
		defaultSetting();
121
		defaultSetting();
117
		return composite;
122
		return composite;
123
	}
124
125
	private void createParserSelection(Composite parent) {
126
		Group group = new Group(parent, SWT.SHADOW_ETCHED_IN);
127
		group.setLayout(createGridLayout(1, true, 10, 10));
128
		group.setLayoutData(spanGridData(GridData.FILL_HORIZONTAL, 2));
129
		group.setText(Messages.ExternalToolPreferencePage_ToolParser);
130
131
		Composite content = new Composite(group, SWT.NONE);
132
		content.setLayout(createGridLayout(2, false, 0, 0));
133
		content.setLayoutData(spanGridData(GridData.FILL_HORIZONTAL, SWT.WRAP));
134
135
		Label parserLbl = new Label(content, SWT.NONE);
136
		parserLbl.setText(Messages.ExternalToolPreferencePage_ETFW_PARSER);
137
138
		parser = new Combo(content, SWT.READ_ONLY);
139
		parser.add(USE_SAX_PARSER);
140
		parser.add(USE_JAXB_PARSER);
141
		// Text parser = new Text(content, SWT.BORDER);
142
		// parser.setLayoutData(spanGridData(GridData.FILL_HORIZONTAL, 1));
118
	}
143
	}
119
144
120
	/**
145
	/**
Lines 191-200 Link Here
191
				// TODO Auto-generated catch block
216
				// TODO Auto-generated catch block
192
217
193
				path = EFS.getLocalFileSystem().getStore(new Path(correctPath));
218
				path = EFS.getLocalFileSystem().getStore(new Path(correctPath));
194
				//e.printStackTrace();
219
				// e.printStackTrace();
195
			}
220
			}
196
			if (path!=null&&path.fetchInfo().exists())
221
			if (path != null && path.fetchInfo().exists())
197
				dialog.setFilterPath(!path.fetchInfo().isDirectory() ? correctPath : path.getParent().toURI().getPath()); //TODO: This may be bad
222
				dialog.setFilterPath(!path.fetchInfo().isDirectory() ? correctPath : path.getParent().toURI().getPath()); // TODO:
223
																															// This
224
																															// may
225
																															// be
226
																															// bad
198
		}
227
		}
199
228
200
		// String tlpath = correctPath+File.separator+"lib";
229
		// String tlpath = correctPath+File.separator+"lib";
Lines 215-221 Link Here
215
		String out = getFieldContent(dialog.open());
244
		String out = getFieldContent(dialog.open());
216
245
217
		if (out != null) {
246
		if (out != null) {
218
			IFileStore test = EFS.getLocalFileSystem().getStore(new Path(out));//new IFFile(out);
247
			IFileStore test = EFS.getLocalFileSystem().getStore(new Path(out));// new IFFile(out);
219
			if (test.fetchInfo().exists() && !test.fetchInfo().isDirectory()) {
248
			if (test.fetchInfo().exists() && !test.fetchInfo().isDirectory()) {
220
				XMLLocs.add(out);
249
				XMLLocs.add(out);
221
			} else {
250
			} else {
Lines 247-260 Link Here
247
	}
276
	}
248
277
249
	private void loadSaved() {
278
	private void loadSaved() {
250
		
279
251
		//Preferences preferences = Activator.getDefault().getPluginPreferences();
280
		// Preferences preferences = Activator.getDefault().getPluginPreferences();
252
		IPreferencesService service = Platform.getPreferencesService();
281
		IPreferencesService service = Platform.getPreferencesService();
253
		String fiList = service.getString(Activator.PLUGIN_ID, XMLLOCID, "", null);//.getString(XMLLOCID);
282
		String fiList = service.getString(Activator.PLUGIN_ID, XMLLOCID, EMPTY_STRING, null);// .getString(XMLLOCID);
254
283
255
		String[] files = fiList.split(",,,"); //$NON-NLS-1$
284
		String[] files = fiList.split(",,,"); //$NON-NLS-1$
256
		for (String s : files) {
285
		for (String s : files) {
257
			XMLLocs.add(s);// setText(preferences.getString(XMLLOCID));
286
			XMLLocs.add(s);// setText(preferences.getString(XMLLOCID));
287
		}
288
289
		String etfwVersion = Preferences.getString(Activator.PLUGIN_ID, PreferenceConstants.ETFW_VERSION);
290
		for (int index = 0; index < parser.getItemCount(); index++) {
291
			if (parser.getItem(index).equals(etfwVersion)) {
292
				parser.select(index);
293
				break;
294
			}
258
		}
295
		}
259
		// TODO: Add checks
296
		// TODO: Add checks
260
		// checkAutoOpts.setSelection(preferences.getBoolean(ITAULaunchConfigurationConstants.TAU_CHECK_AUTO_OPT));
297
		// checkAutoOpts.setSelection(preferences.getBoolean(ITAULaunchConfigurationConstants.TAU_CHECK_AUTO_OPT));
Lines 262-273 Link Here
262
		// checkAixOpts.setSelection(preferences.getBoolean(ITAULaunchConfigurationConstants.TAU_CHECK_AIX_OPT));
299
		// checkAixOpts.setSelection(preferences.getBoolean(ITAULaunchConfigurationConstants.TAU_CHECK_AIX_OPT));
263
	}
300
	}
264
301
302
	@Override
265
	public boolean performOk() {
303
	public boolean performOk() {
266
		 //Activator.getDefault().getPluginPreferences();
304
		// Activator.getDefault().getPluginPreferences();
267
305
268
		
269
		IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
306
		IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
270
		
307
271
		String fiList = ""; //$NON-NLS-1$
308
		String fiList = ""; //$NON-NLS-1$
272
309
273
		for (int i = 0; i < XMLLocs.getItemCount(); i++) {
310
		for (int i = 0; i < XMLLocs.getItemCount(); i++) {
Lines 284-289 Link Here
284
			e.printStackTrace();
321
			e.printStackTrace();
285
		}
322
		}
286
		Activator.getDefault().refreshTools();
323
		Activator.getDefault().refreshTools();
324
325
		Preferences.setString(Activator.PLUGIN_ID, PreferenceConstants.ETFW_VERSION, parser.getItem(parser.getSelectionIndex()));
287
		// TODO: Add checks
326
		// TODO: Add checks
288
		// preferences.setValue(ITAULaunchConfigurationConstants.TAU_CHECK_AUTO_OPT,
327
		// preferences.setValue(ITAULaunchConfigurationConstants.TAU_CHECK_AUTO_OPT,
289
		// checkAutoOpts.getSelection());
328
		// checkAutoOpts.getSelection());
Lines 313-322 Link Here
313
	protected void defaultSetting() {
352
	protected void defaultSetting() {
314
	}
353
	}
315
354
355
	@Override
316
	public void dispose() {
356
	public void dispose() {
317
		super.dispose();
357
		super.dispose();
318
	}
358
	}
319
359
360
	@Override
320
	public void performDefaults() {
361
	public void performDefaults() {
321
		defaultSetting();
362
		defaultSetting();
322
		updateApplyButton();
363
		updateApplyButton();

Return to bug 402787