This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 206931
Collapse All | Expand All

(-)a/java.api.common/apichanges.xml (+16 lines)
Lines 105-110 Link Here
105
105
106
    <!-- ACTUAL CHANGES BEGIN HERE: -->
106
    <!-- ACTUAL CHANGES BEGIN HERE: -->
107
    <changes>
107
    <changes>
108
        <change id="action.properties">
109
            <api name="java-api-common"/>
110
            <summary>Added ability to receive action specific properties</summary>
111
            <version major="1" minor="35"/>
112
            <date day="5" month="1" year="2011"/>
113
            <author login="yardus"/>
114
            <compatibility addition="yes"/>
115
            <description>
116
                <p>
117
                    Added ability to receive action specific properties 
118
                    when calling <code>ActionProvider.invokeAction(command,lookup)</code>
119
                </p>
120
            </description>
121
            <class package="org.netbeans.modules.java.api.common.project" name="BaseActionProvider$ActionPropertiesProvider"/>
122
            <issue number="206931"/>
123
        </change>
108
        <change id="ant-hooks">
124
        <change id="ant-hooks">
109
            <api name="java-api-common"/>
125
            <api name="java-api-common"/>
110
            <summary>Added methods to track ant invocation</summary>
126
            <summary>Added methods to track ant invocation</summary>
(-)a/java.api.common/manifest.mf (-1 / +1 lines)
Lines 1-4 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.modules.java.api.common/0
2
OpenIDE-Module: org.netbeans.modules.java.api.common/0
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/api/common/resources/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/api/common/resources/Bundle.properties
4
OpenIDE-Module-Specification-Version: 1.34
4
OpenIDE-Module-Specification-Version: 1.35
(-)a/java.api.common/src/org/netbeans/modules/java/api/common/project/BaseActionProvider.java (-2 / +42 lines)
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
    public static interface ActionPropertiesProvider {
157
        /**
158
         * Simple properties getter.
159
         * The implementor can not rely on the properties not being modified once
160
         * they are handed over - ideally an immutable or expendable copy should 
161
         * be returned.
162
         * @return additional properties applicable to certain commands
163
         */
164
        Properties getProperties();
165
    }
166
    
150
    public static final String AUTOMATIC_BUILD_TAG = ".netbeans_automatic_build";
167
    public static final String AUTOMATIC_BUILD_TAG = ".netbeans_automatic_build";
151
168
152
    private static final Logger LOG = Logger.getLogger(BaseActionProvider.class.getName());
169
    private static final Logger LOG = Logger.getLogger(BaseActionProvider.class.getName());
Lines 417-423 Link Here
417
                    return;
434
                    return;
418
                }
435
                }
419
                called.set(true);
436
                called.set(true);
420
                Properties p = new Properties();
437
                Properties p = getProperties(context);
421
                String[] targetNames;
438
                String[] targetNames;
422
439
423
                targetNames = getTargetNames(command, context, p, doJavaChecks);
440
                targetNames = getTargetNames(command, context, p, doJavaChecks);
Lines 429-435 Link Here
429
                        showBuildActionWarning(context);
446
                        showBuildActionWarning(context);
430
                        return ;
447
                        return ;
431
                    }
448
                    }
432
                    Map<String, Object> execProperties = new HashMap<String, Object>();
449
                    Map<String, Object> execProperties = getPropertiesMap(context);
433
450
434
                    copyMultiValue(ProjectProperties.RUN_JVM_ARGS, execProperties);
451
                    copyMultiValue(ProjectProperties.RUN_JVM_ARGS, execProperties);
435
                    prepareWorkDir(execProperties);
452
                    prepareWorkDir(execProperties);
Lines 1840-1843 Link Here
1840
        return result;
1857
        return result;
1841
    }
1858
    }
1842
    
1859
    
1860
    private static Properties getProperties(Lookup context) {
1861
        ActionPropertiesProvider app = context.lookup(ActionPropertiesProvider.class);
1862
        Properties props = new Properties();
1863
        if (app != null) { 
1864
            props.putAll(app.getProperties());
1865
        }
1866
        return props;
1867
    }
1868
    
1869
    private static Map<String, Object> getPropertiesMap(Lookup context) {
1870
        Properties props = getProperties(context);
1871
        
1872
        Map<String, Object> map = new HashMap<String, Object>();
1873
        for(Map.Entry<Object, Object> e : props.entrySet()) {
1874
            Object k = e.getKey();
1875
            Object v = e.getValue();
1876
            if (k != null && k instanceof String) {
1877
                map.put((String)k, v);
1878
            }
1879
        }
1880
        
1881
        return map;
1882
    }
1843
}
1883
}

Return to bug 206931