Lines 147-152
Link Here
|
147 |
* @since org.netbeans.modules.java.api.common/1 1.20 |
147 |
* @since org.netbeans.modules.java.api.common/1 1.20 |
148 |
*/ |
148 |
*/ |
149 |
public abstract class BaseActionProvider implements ActionProvider { |
149 |
public abstract class BaseActionProvider implements ActionProvider { |
|
|
150 |
/** |
151 |
* Provides access to additional properties required for execution of certain |
152 |
* commands. |
153 |
* This provider is to be implemented and passed over in the context |
154 |
* of {@linkplain BaseActionProvider#invokeAction(java.lang.String, org.openide.util.Lookup) method call. |
155 |
* |
156 |
* @since org.netbeans.modules.java.api.common/1 1.35 |
157 |
*/ |
158 |
public interface ActionPropertiesProvider { |
159 |
/** |
160 |
* Simple properties getter. |
161 |
* The implementor can not rely on the properties not being modified once |
162 |
* they are handed over -> an expendable copy should be returned. |
163 |
* @return additional properties applicable to certain commands |
164 |
*/ |
165 |
Map<String, String> getProperties(); |
166 |
} |
167 |
|
150 |
public static final String AUTOMATIC_BUILD_TAG = ".netbeans_automatic_build"; |
168 |
public static final String AUTOMATIC_BUILD_TAG = ".netbeans_automatic_build"; |
151 |
|
169 |
|
152 |
private static final Logger LOG = Logger.getLogger(BaseActionProvider.class.getName()); |
170 |
private static final Logger LOG = Logger.getLogger(BaseActionProvider.class.getName()); |
Lines 417-423
Link Here
|
417 |
return; |
435 |
return; |
418 |
} |
436 |
} |
419 |
called.set(true); |
437 |
called.set(true); |
420 |
Properties p = new Properties(); |
438 |
Properties p = getProperties(context); |
421 |
String[] targetNames; |
439 |
String[] targetNames; |
422 |
|
440 |
|
423 |
targetNames = getTargetNames(command, context, p, doJavaChecks); |
441 |
targetNames = getTargetNames(command, context, p, doJavaChecks); |
Lines 429-435
Link Here
|
429 |
showBuildActionWarning(context); |
447 |
showBuildActionWarning(context); |
430 |
return ; |
448 |
return ; |
431 |
} |
449 |
} |
432 |
Map<String, Object> execProperties = new HashMap<String, Object>(); |
450 |
Map<String, Object> execProperties = getPropertiesMap(context); |
433 |
|
451 |
|
434 |
copyMultiValue(ProjectProperties.RUN_JVM_ARGS, execProperties); |
452 |
copyMultiValue(ProjectProperties.RUN_JVM_ARGS, execProperties); |
435 |
prepareWorkDir(execProperties); |
453 |
prepareWorkDir(execProperties); |
Lines 1840-1843
Link Here
|
1840 |
return result; |
1858 |
return result; |
1841 |
} |
1859 |
} |
1842 |
|
1860 |
|
|
|
1861 |
private static Properties getProperties(Lookup context) { |
1862 |
ActionPropertiesProvider app = context.lookup(ActionPropertiesProvider.class); |
1863 |
Properties props = new Properties(); |
1864 |
if (app != null) { |
1865 |
props.putAll(app.getProperties()); |
1866 |
} |
1867 |
return props; |
1868 |
} |
1869 |
|
1870 |
private static Map<String, Object> getPropertiesMap(Lookup context) { |
1871 |
Properties props = getProperties(context); |
1872 |
|
1873 |
Map<String, Object> map = new HashMap<String, Object>(); |
1874 |
for(Map.Entry<Object, Object> e : props.entrySet()) { |
1875 |
Object k = e.getKey(); |
1876 |
Object v = e.getValue(); |
1877 |
if (k != null && k instanceof String) { |
1878 |
map.put((String)k, v); |
1879 |
} |
1880 |
} |
1881 |
|
1882 |
return map; |
1883 |
} |
1843 |
} |
1884 |
} |