1
1
/*******************************************************************************
2
- * Copyright (c) 2000, 2015 IBM Corporation and others.
2
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
3
3
*
4
4
* This program and the accompanying materials
5
5
* are made available under the terms of the Eclipse Public License 2.0
10
10
*
11
11
* Contributors:
12
12
* IBM Corporation - initial API and implementation
13
+ * Alexander Fedorov (ArSysOp) - API to process launch configuration attributes
13
14
*******************************************************************************/
14
15
package org .eclipse .ant .internal .ui ;
15
16
20
21
import java .util .ArrayList ;
21
22
import java .util .HashMap ;
22
23
import java .util .Hashtable ;
23
- import java .util .Iterator ;
24
24
import java .util .List ;
25
25
import java .util .Map ;
26
26
import java .util .regex .Pattern ;
@@ -100,7 +100,7 @@ private AntUtil() {
100
100
101
101
/**
102
102
* Returns a single-string of the strings for storage.
103
- *
103
+ *
104
104
* @param strings
105
105
* the array of strings
106
106
* @return a single-string representation of the strings or <code>null</code> if the array is empty.
@@ -112,7 +112,7 @@ public static String combineStrings(String[] strings) {
112
112
/**
113
113
* Returns an array of targets to be run, or <code>null</code> if none are specified (indicating the default target or implicit target should be
114
114
* run).
115
- *
115
+ *
116
116
* @param configuration
117
117
* launch configuration
118
118
* @return array of target names, or <code>null</code>
@@ -126,7 +126,7 @@ public static String[] getTargetNames(ILaunchConfiguration configuration) throws
126
126
/**
127
127
* Returns a map of properties to be defined for the build, or <code>null</code> if none are specified (indicating no additional properties
128
128
* specified for the build).
129
- *
129
+ *
130
130
* @param configuration
131
131
* launch configuration
132
132
* @return map of properties (name --> value), or <code>null</code>
@@ -139,7 +139,7 @@ public static Map<String, String> getProperties(ILaunchConfiguration configurati
139
139
140
140
/**
141
141
* Returns a String specifying the Ant home to use for the build.
142
- *
142
+ *
143
143
* @param configuration
144
144
* launch configuration
145
145
* @return String specifying Ant home to use or <code>null</code>
@@ -153,7 +153,7 @@ public static String getAntHome(ILaunchConfiguration configuration) throws CoreE
153
153
/**
154
154
* Returns an array of property files to be used for the build, or <code>null</code> if none are specified (indicating no additional property
155
155
* files specified for the build).
156
- *
156
+ *
157
157
* @param configuration
158
158
* launch configuration
159
159
* @return array of property file names, or <code>null</code>
@@ -195,7 +195,7 @@ public static AntTargetNode[] getTargets(String path, ILaunchConfiguration confi
195
195
}
196
196
197
197
private static Map <String , String > getAllProperties (ILaunchConfiguration config ) throws CoreException {
198
- String allArgs = config . getAttribute ( IExternalToolConstants .ATTR_TOOL_ARGUMENTS , ( String ) null );
198
+ String allArgs = IExternalToolConstants .LAUNCH_ATTRIBUTE_ARGUMENTS . read ( config );
199
199
Map <String , String > properties = new HashMap <>();
200
200
if (allArgs != null ) {
201
201
// filter arguments to avoid resolving variables that will prompt the user
@@ -213,9 +213,7 @@ private static Map<String, String> getAllProperties(ILaunchConfiguration config)
213
213
}
214
214
Map <String , String > configProperties = getProperties (config );
215
215
if (configProperties != null ) {
216
- Iterator <String > keys = configProperties .keySet ().iterator ();
217
- while (keys .hasNext ()) {
218
- String name = keys .next ();
216
+ for (String name : configProperties .keySet ()) {
219
217
if (properties .get (name ) == null ) {
220
218
properties .put (name , configProperties .get (name ));
221
219
}
@@ -349,11 +347,11 @@ private static IDocument getDocument(File buildFile) {
349
347
350
348
/**
351
349
* Returns the list of URLs that define the custom classpath for the Ant build, or <code>null</code> if the global classpath is to be used.
352
- *
350
+ *
353
351
* @param config
354
352
* launch configuration
355
353
* @return a list of <code>URL</code>
356
- *
354
+ *
357
355
* @throws CoreException
358
356
* if file does not exist, IO problems, or invalid format.
359
357
*/
@@ -373,7 +371,7 @@ private static String expandVariableString(String variableString, String invalid
373
371
374
372
/**
375
373
* Returns the list of target names to run
376
- *
374
+ *
377
375
* @param extraAttibuteValue
378
376
* the external tool's extra attribute value for the run targets key.
379
377
* @return a list of target names
@@ -384,7 +382,7 @@ public static String[] parseRunTargets(String extraAttibuteValue) {
384
382
385
383
/**
386
384
* Returns the list of Strings that were delimiter separated.
387
- *
385
+ *
388
386
* @param delimString
389
387
* the String to be tokenized based on the delimiter
390
388
* @param delim
@@ -397,7 +395,7 @@ public static String[] parseString(String delimString, String delim) {
397
395
398
396
/**
399
397
* Returns an IFile with the given fully qualified path (relative to the workspace root). The returned IFile may or may not exist.
400
- *
398
+ *
401
399
* @param fullPath
402
400
* the path to look up
403
401
* @return the {@link IFile} which may or may not exist
@@ -446,9 +444,9 @@ public static IHyperlink getLocationLink(String path, File buildFileParent) {
446
444
/**
447
445
* Returns the workspace file associated with the given path in the local file system, or <code>null</code> if none. If the path happens to be a
448
446
* relative path, then the path is interpreted as relative to the specified parent file.
449
- *
447
+ *
450
448
* Attempts to handle linked files; the first found linked file with the correct path is returned.
451
- *
449
+ *
452
450
* @return file or <code>null</code>
453
451
* @see org.eclipse.core.resources.IWorkspaceRoot#findFilesForLocation(IPath)
454
452
*/
@@ -459,7 +457,7 @@ public static IFile getFileForLocation(String path, File buildFileParent) {
459
457
/**
460
458
* Migrates the classpath in the given configuration from the old format to the new format. The old format is not preserved. Instead, the default
461
459
* classpath will be used. However, ANT_HOME settings are preserved.
462
- *
460
+ *
463
461
* @param configuration
464
462
* a configuration to migrate
465
463
* @throws CoreException
@@ -500,7 +498,7 @@ private static int getOffset(int line, int column, ITextEditor editor) {
500
498
501
499
/**
502
500
* Opens the given editor on the buildfile of the provided node and selects that node in the editor.
503
- *
501
+ *
504
502
* @param page
505
503
* the page to open the editor in
506
504
* @param editorDescriptor
@@ -540,7 +538,7 @@ public static void openInEditor(IWorkbenchPage page, IEditorDescriptor editorDes
540
538
541
539
/**
542
540
* Opens an editor on the buildfile of the provided node and selects that node in the editor.
543
- *
541
+ *
544
542
* @param page
545
543
* the page to open the editor in
546
544
* @param node
@@ -639,9 +637,9 @@ public static boolean isKnownAntFile(IResource resource) {
639
637
640
638
/**
641
639
* Returns if the given extension is a known extension to Ant i.e. a supported content type extension.
642
- *
640
+ *
643
641
* @return true if the file extension is supported false otherwise
644
- *
642
+ *
645
643
* @since 3.8
646
644
*/
647
645
public static boolean isKnownAntFile (File file ) {
@@ -666,7 +664,7 @@ public static boolean isKnownAntFile(File file) {
666
664
667
665
/**
668
666
* Returns an array of build file names from the ant preference store
669
- *
667
+ *
670
668
* @return an array of build file names
671
669
* @since 3.6
672
670
*/
@@ -682,7 +680,7 @@ public static String[] getKnownBuildfileNames() {
682
680
683
681
/**
684
682
* Returns if the given file is a known build file name, based on the given names from the Ant > Names preference
685
- *
683
+ *
686
684
* @return true if the name of the file is given in the Ant > Names preference, false otherwise
687
685
* @since 3.6
688
686
*/
@@ -698,7 +696,7 @@ public static boolean isKnownBuildfileName(String filename) {
698
696
699
697
/**
700
698
* A helper method to extract the build filename extensions as defined in the extender of the content-types extension-point.
701
- *
699
+ *
702
700
* @return An empty array or list of filename extensions as specified in the content-types extension
703
701
* @since 3.8
704
702
*/
@@ -719,7 +717,7 @@ public static String[] getKnownBuildFileExtensions() {
719
717
720
718
/**
721
719
* A helper method to construct a RegEx pattern out of the extensions
722
- *
720
+ *
723
721
* @return A String that is a RegEx pattern representing the extensions
724
722
* @since 3.8
725
723
*/
@@ -734,7 +732,7 @@ public static String getKnownBuildFileExtensionsAsPattern() {
734
732
/**
735
733
* Returns if the given file name is known as a build file. This method consults all of the known file extensions from the Ant-defined content
736
734
* types
737
- *
735
+ *
738
736
* @return <code>true</code> if the file name matches an Ant build file pattern <code>false</code> otherwise
739
737
* @since 3.8
740
738
*/
0 commit comments