diff -r 42eecb057a9a java.api.common/apichanges.xml --- a/java.api.common/apichanges.xml Wed Jan 04 15:05:50 2012 +0100 +++ b/java.api.common/apichanges.xml Thu Jan 05 13:29:11 2012 +0100 @@ -105,6 +105,22 @@ + + + Added ability to receive action specific properties + + + + + +

+ Added ability to receive action specific properties + when calling ActionProvider.invokeAction(command,lookup) +

+
+ + +
Added methods to track ant invocation diff -r 42eecb057a9a java.api.common/manifest.mf --- a/java.api.common/manifest.mf Wed Jan 04 15:05:50 2012 +0100 +++ b/java.api.common/manifest.mf Thu Jan 05 13:29:11 2012 +0100 @@ -1,4 +1,4 @@ Manifest-Version: 1.0 OpenIDE-Module: org.netbeans.modules.java.api.common/0 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/api/common/resources/Bundle.properties -OpenIDE-Module-Specification-Version: 1.34 +OpenIDE-Module-Specification-Version: 1.35 diff -r 42eecb057a9a java.api.common/src/org/netbeans/modules/java/api/common/project/BaseActionProvider.java --- a/java.api.common/src/org/netbeans/modules/java/api/common/project/BaseActionProvider.java Wed Jan 04 15:05:50 2012 +0100 +++ b/java.api.common/src/org/netbeans/modules/java/api/common/project/BaseActionProvider.java Thu Jan 05 13:29:11 2012 +0100 @@ -147,6 +147,23 @@ * @since org.netbeans.modules.java.api.common/1 1.20 */ public abstract class BaseActionProvider implements ActionProvider { + /** + * Provides access to additional properties required for execution of certain + * commands. + * This provider is to be implemented and passed over in the context + * of {@linkplain BaseActionProvider#invokeAction(java.lang.String, org.openide.util.Lookup) method call. + */ + public static interface ActionPropertiesProvider { + /** + * Simple properties getter. + * The implementor can not rely on the properties not being modified once + * they are handed over - ideally an immutable or expendable copy should + * be returned. + * @return additional properties applicable to certain commands + */ + Properties getProperties(); + } + public static final String AUTOMATIC_BUILD_TAG = ".netbeans_automatic_build"; private static final Logger LOG = Logger.getLogger(BaseActionProvider.class.getName()); @@ -417,7 +434,7 @@ return; } called.set(true); - Properties p = new Properties(); + Properties p = getProperties(context); String[] targetNames; targetNames = getTargetNames(command, context, p, doJavaChecks); @@ -429,7 +446,7 @@ showBuildActionWarning(context); return ; } - Map execProperties = new HashMap(); + Map execProperties = getPropertiesMap(context); copyMultiValue(ProjectProperties.RUN_JVM_ARGS, execProperties); prepareWorkDir(execProperties); @@ -1840,4 +1857,27 @@ return result; } + private static Properties getProperties(Lookup context) { + ActionPropertiesProvider app = context.lookup(ActionPropertiesProvider.class); + Properties props = new Properties(); + if (app != null) { + props.putAll(app.getProperties()); + } + return props; + } + + private static Map getPropertiesMap(Lookup context) { + Properties props = getProperties(context); + + Map map = new HashMap(); + for(Map.Entry e : props.entrySet()) { + Object k = e.getKey(); + Object v = e.getValue(); + if (k != null && k instanceof String) { + map.put((String)k, v); + } + } + + return map; + } }