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 71515
Collapse All | Expand All

(-)a/ant.freeform/nbproject/project.xml (-1 / +1 lines)
Lines 82-88 Link Here
82
                    <compile-dependency/>
82
                    <compile-dependency/>
83
                    <run-dependency>
83
                    <run-dependency>
84
                        <release-version>1</release-version>
84
                        <release-version>1</release-version>
85
                        <specification-version>1.31</specification-version>
85
                        <specification-version>1.43</specification-version>
86
                    </run-dependency>
86
                    </run-dependency>
87
                </dependency>
87
                </dependency>
88
                <dependency>
88
                <dependency>
(-)a/ant.freeform/src/org/netbeans/modules/ant/freeform/Actions.java (-3 / +13 lines)
Lines 72-78 Link Here
72
import javax.swing.JSeparator;
72
import javax.swing.JSeparator;
73
import org.apache.tools.ant.module.api.support.ActionUtils;
73
import org.apache.tools.ant.module.api.support.ActionUtils;
74
import org.netbeans.api.project.ProjectManager;
74
import org.netbeans.api.project.ProjectManager;
75
import org.netbeans.modules.ant.freeform.ui.TargetMappingPanel;
75
import org.netbeans.modules.ant.freeform.ui.UnboundTargetAlert;
76
import org.netbeans.modules.ant.freeform.ui.UnboundTargetAlert;
77
import org.netbeans.spi.project.ActionProgress;
76
import org.netbeans.spi.project.ActionProvider;
78
import org.netbeans.spi.project.ActionProvider;
77
import org.netbeans.spi.project.SingleMethod;
79
import org.netbeans.spi.project.SingleMethod;
78
import org.netbeans.spi.project.support.ant.AntProjectHelper;
80
import org.netbeans.spi.project.support.ant.AntProjectHelper;
Lines 85-90 Link Here
85
import org.openide.awt.ActionReference;
87
import org.openide.awt.ActionReference;
86
import org.openide.awt.ActionRegistration;
88
import org.openide.awt.ActionRegistration;
87
import org.openide.awt.DynamicMenuContent;
89
import org.openide.awt.DynamicMenuContent;
90
import org.openide.execution.ExecutorTask;
88
import org.openide.filesystems.FileObject;
91
import org.openide.filesystems.FileObject;
89
import org.openide.filesystems.FileUtil;
92
import org.openide.filesystems.FileUtil;
90
import org.openide.loaders.DataObject;
93
import org.openide.loaders.DataObject;
Lines 92-97 Link Here
92
import org.openide.util.Lookup;
95
import org.openide.util.Lookup;
93
import org.openide.util.Mutex;
96
import org.openide.util.Mutex;
94
import org.openide.util.NbBundle;
97
import org.openide.util.NbBundle;
98
import org.openide.util.Task;
99
import org.openide.util.TaskListener;
95
import org.openide.util.Union2;
100
import org.openide.util.Union2;
96
import org.openide.util.actions.Presenter;
101
import org.openide.util.actions.Presenter;
97
import org.openide.xml.XMLUtil;
102
import org.openide.xml.XMLUtil;
Lines 479-485 Link Here
479
                // Run default target.
484
                // Run default target.
480
                targetNameArray = null;
485
                targetNameArray = null;
481
            }
486
            }
482
            TARGET_RUNNER.runTarget(scriptFile.first(), targetNameArray, props);
487
            TARGET_RUNNER.runTarget(scriptFile.first(), targetNameArray, props, ActionProgress.start(context));
483
        } else {
488
        } else {
484
            assert scriptFile.hasSecond();
489
            assert scriptFile.hasSecond();
485
            //#57011: if the script does not exist, show a warning:
490
            //#57011: if the script does not exist, show a warning:
Lines 618-628 Link Here
618
    
623
    
619
    static class TargetRunner {
624
    static class TargetRunner {
620
        public TargetRunner() {}
625
        public TargetRunner() {}
621
        public void runTarget(FileObject scriptFile, String[] targetNameArray, Properties props) {
626
        public void runTarget(FileObject scriptFile, String[] targetNameArray, Properties props, final ActionProgress listener) {
622
            try {
627
            try {
623
                ActionUtils.runTarget(scriptFile, targetNameArray, props);
628
                ActionUtils.runTarget(scriptFile, targetNameArray, props).addTaskListener(new TaskListener() {
629
                    @Override public void taskFinished(Task task) {
630
                        listener.finished(((ExecutorTask) task).result() == 0);
631
                    }
632
                });
624
            } catch (IOException e) {
633
            } catch (IOException e) {
625
                ErrorManager.getDefault().notify(e);
634
                ErrorManager.getDefault().notify(e);
635
                listener.finished(false);
626
            }
636
            }
627
        }
637
        }
628
    }
638
    }
(-)a/ant.freeform/test/unit/src/org/netbeans/modules/ant/freeform/ActionsTest.java (-1 / +2 lines)
Lines 56-61 Link Here
56
import java.util.TreeSet;
56
import java.util.TreeSet;
57
import javax.swing.Action;
57
import javax.swing.Action;
58
import org.netbeans.api.project.Project;
58
import org.netbeans.api.project.Project;
59
import org.netbeans.spi.project.ActionProgress;
59
import org.netbeans.spi.project.ActionProvider;
60
import org.netbeans.spi.project.ActionProvider;
60
import org.netbeans.spi.project.ui.LogicalViewProvider;
61
import org.netbeans.spi.project.ui.LogicalViewProvider;
61
import org.openide.filesystems.FileObject;
62
import org.openide.filesystems.FileObject;
Lines 116-122 Link Here
116
    
117
    
117
    static {
118
    static {
118
        Actions.TARGET_RUNNER = new Actions.TargetRunner() {
119
        Actions.TARGET_RUNNER = new Actions.TargetRunner() {
119
            public void runTarget(FileObject scriptFile, String[] targetNameArray, Properties props) {
120
            public void runTarget(FileObject scriptFile, String[] targetNameArray, Properties props, ActionProgress listener) {
120
                targetsRun.add(new AntTargetInvocation(scriptFile, targetNameArray,
121
                targetsRun.add(new AntTargetInvocation(scriptFile, targetNameArray,
121
                        NbCollections.checkedMapByFilter(props, String.class, String.class, true)));
122
                        NbCollections.checkedMapByFilter(props, String.class, String.class, true)));
122
            }
123
            }
(-)a/ant.freeform/test/unit/src/org/netbeans/modules/ant/freeform/LookupMergerImplTest.java (-1 / +2 lines)
Lines 52-57 Link Here
52
import java.util.TreeMap;
52
import java.util.TreeMap;
53
import org.netbeans.api.project.ProjectManager;
53
import org.netbeans.api.project.ProjectManager;
54
import org.netbeans.junit.NbTestCase;
54
import org.netbeans.junit.NbTestCase;
55
import org.netbeans.spi.project.ActionProgress;
55
import org.netbeans.spi.project.ActionProvider;
56
import org.netbeans.spi.project.ActionProvider;
56
import org.netbeans.spi.project.support.ant.AntProjectHelper;
57
import org.netbeans.spi.project.support.ant.AntProjectHelper;
57
import org.openide.filesystems.FileObject;
58
import org.openide.filesystems.FileObject;
Lines 70-76 Link Here
70
    private static List<String> targetsRun = new ArrayList<String>();
71
    private static List<String> targetsRun = new ArrayList<String>();
71
    static {
72
    static {
72
        Actions.TARGET_RUNNER = new Actions.TargetRunner() {
73
        Actions.TARGET_RUNNER = new Actions.TargetRunner() {
73
            public void runTarget(FileObject scriptFile, String[] targetNameArray, Properties props) {
74
            public void runTarget(FileObject scriptFile, String[] targetNameArray, Properties props, ActionProgress listener) {
74
                targetsRun.add(scriptFile.getNameExt() + ":" + Arrays.toString(targetNameArray) + ":" + new TreeMap<Object,Object>(props));
75
                targetsRun.add(scriptFile.getNameExt() + ":" + Arrays.toString(targetNameArray) + ":" + new TreeMap<Object,Object>(props));
75
            }
76
            }
76
        };
77
        };
(-)a/apisupport.ant/nbproject/project.xml (-1 / +1 lines)
Lines 202-208 Link Here
202
                    <compile-dependency/>
202
                    <compile-dependency/>
203
                    <run-dependency>
203
                    <run-dependency>
204
                        <release-version>1</release-version>
204
                        <release-version>1</release-version>
205
                        <specification-version>1.35</specification-version>
205
                        <specification-version>1.43</specification-version>
206
                    </run-dependency>
206
                    </run-dependency>
207
                </dependency>
207
                </dependency>
208
                <dependency>
208
                <dependency>
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/ModuleActions.java (-4 / +29 lines)
Lines 56-61 Link Here
56
import java.util.Map.Entry;
56
import java.util.Map.Entry;
57
import java.util.Properties;
57
import java.util.Properties;
58
import java.util.Set;
58
import java.util.Set;
59
import java.util.concurrent.atomic.AtomicReference;
59
import java.util.regex.Pattern;
60
import java.util.regex.Pattern;
60
import javax.lang.model.element.TypeElement;
61
import javax.lang.model.element.TypeElement;
61
import javax.swing.Action;
62
import javax.swing.Action;
Lines 85-90 Link Here
85
import org.netbeans.modules.apisupport.project.ui.customizer.SuiteUtils;
86
import org.netbeans.modules.apisupport.project.ui.customizer.SuiteUtils;
86
import org.netbeans.modules.apisupport.project.universe.HarnessVersion;
87
import org.netbeans.modules.apisupport.project.universe.HarnessVersion;
87
import org.netbeans.modules.apisupport.project.universe.NbPlatform;
88
import org.netbeans.modules.apisupport.project.universe.NbPlatform;
89
import org.netbeans.spi.project.ActionProgress;
88
import org.netbeans.spi.project.ActionProvider;
90
import org.netbeans.spi.project.ActionProvider;
89
import org.netbeans.spi.project.SingleMethod;
91
import org.netbeans.spi.project.SingleMethod;
90
import org.netbeans.spi.project.support.ant.AntProjectHelper;
92
import org.netbeans.spi.project.support.ant.AntProjectHelper;
Lines 100-105 Link Here
100
import org.openide.awt.ActionID;
102
import org.openide.awt.ActionID;
101
import org.openide.awt.ActionReference;
103
import org.openide.awt.ActionReference;
102
import org.openide.awt.ActionRegistration;
104
import org.openide.awt.ActionRegistration;
105
import org.openide.execution.ExecutorTask;
103
import org.openide.filesystems.FileObject;
106
import org.openide.filesystems.FileObject;
104
import org.openide.filesystems.FileUtil;
107
import org.openide.filesystems.FileUtil;
105
import org.openide.util.Exceptions;
108
import org.openide.util.Exceptions;
Lines 108-113 Link Here
108
import org.openide.util.NbBundle.Messages;
111
import org.openide.util.NbBundle.Messages;
109
import org.openide.util.RequestProcessor;
112
import org.openide.util.RequestProcessor;
110
import org.openide.util.Task;
113
import org.openide.util.Task;
114
import org.openide.util.TaskListener;
111
import org.openide.util.lookup.Lookups;
115
import org.openide.util.lookup.Lookups;
112
116
113
public final class ModuleActions implements ActionProvider, ExecProject {
117
public final class ModuleActions implements ActionProvider, ExecProject {
Lines 367-374 Link Here
367
            return;
371
            return;
368
        }
372
        }
369
373
374
        // XXX prefer to call just if and when actually starting target, but that is hard to calculate here
375
        final ActionProgress listener = ActionProgress.start(context);
370
        Runnable runnable = new Runnable() {
376
        Runnable runnable = new Runnable() {
371
            public void run() {
377
            ExecutorTask task;
378
            @Override public void run() {
379
                try {
380
                    doRun();
381
                } finally {
382
                    if (task != null) {
383
                        task.addTaskListener(new TaskListener() {
384
                            @Override public void taskFinished(Task _) {
385
                                listener.finished(task.result() == 0);
386
                            }
387
                        });
388
                    } else {
389
                        listener.finished(false);
390
                    }
391
                }
392
            }
393
            void doRun() {
372
                Properties p = new Properties();
394
                Properties p = new Properties();
373
                String[] targetNames;
395
                String[] targetNames;
374
                if (command.equals(COMMAND_COMPILE_SINGLE)) {
396
                if (command.equals(COMMAND_COMPILE_SINGLE)) {
Lines 402-408 Link Here
402
//            if (    Boolean.parseBoolean(enableQuickTest)
424
//            if (    Boolean.parseBoolean(enableQuickTest)
403
//                 && "unit".equals(testSources.testType) // NOI18N
425
//                 && "unit".equals(testSources.testType) // NOI18N
404
//                 && !hasTestUnitDataDir()) { // NOI18N
426
//                 && !hasTestUnitDataDir()) { // NOI18N
405
//                if (bypassAntBuildScript(command, testSources.sources)) {
427
//                AtomicReference<ExecutorTask> _task = new AtomicReference<ExecutorTask>();
428
//                if (bypassAntBuildScript(command, testSources.sources, _task)) {
429
//                    task = _task.get();
406
//                    return ;
430
//                    return ;
407
//                }
431
//                }
408
//            }
432
//            }
Lines 472-477 Link Here
472
                    }
496
                    }
473
                }
497
                }
474
                try {
498
                try {
499
                    task =
475
                    ActionUtils.runTarget(findBuildXml(project), targetNames, p);
500
                    ActionUtils.runTarget(findBuildXml(project), targetNames, p);
476
                } catch (IOException e) {
501
                } catch (IOException e) {
477
                    Util.err.notify(e);
502
                    Util.err.notify(e);
Lines 619-625 Link Here
619
        return new String[] {"debug-test-single-nb"}; // NOI18N
644
        return new String[] {"debug-test-single-nb"}; // NOI18N
620
    }
645
    }
621
    
646
    
622
    private boolean bypassAntBuildScript(String command, FileObject[] files) throws IllegalArgumentException {
647
    private boolean bypassAntBuildScript(String command, FileObject[] files, AtomicReference<ExecutorTask> task) throws IllegalArgumentException {
623
        FileObject toRun = null;
648
        FileObject toRun = null;
624
649
625
        if (COMMAND_RUN_SINGLE.equals(command) || COMMAND_DEBUG_SINGLE.equals(command)) {
650
        if (COMMAND_RUN_SINGLE.equals(command) || COMMAND_DEBUG_SINGLE.equals(command)) {
Lines 638-644 Link Here
638
663
639
                properties.put(JavaRunner.PROP_EXECUTE_FILE, toRun);
664
                properties.put(JavaRunner.PROP_EXECUTE_FILE, toRun);
640
665
641
                JavaRunner.execute(commandToExecute, properties);
666
                task.set(JavaRunner.execute(commandToExecute, properties));
642
            } catch (IOException ex) {
667
            } catch (IOException ex) {
643
                Exceptions.printStackTrace(ex);
668
                Exceptions.printStackTrace(ex);
644
            }
669
            }
(-)a/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/SuiteActions.java (-13 / +10 lines)
Lines 59-64 Link Here
59
import javax.swing.JMenu;
59
import javax.swing.JMenu;
60
import javax.swing.JMenuItem;
60
import javax.swing.JMenuItem;
61
import org.apache.tools.ant.module.api.support.ActionUtils;
61
import org.apache.tools.ant.module.api.support.ActionUtils;
62
import org.netbeans.api.annotations.common.CheckForNull;
62
import org.netbeans.api.project.Project;
63
import org.netbeans.api.project.Project;
63
import org.netbeans.modules.apisupport.project.NbModuleProject;
64
import org.netbeans.modules.apisupport.project.NbModuleProject;
64
import org.netbeans.modules.apisupport.project.api.BrandingUtils;
65
import org.netbeans.modules.apisupport.project.api.BrandingUtils;
Lines 73-78 Link Here
73
import org.netbeans.modules.apisupport.project.ui.customizer.SuiteUtils;
74
import org.netbeans.modules.apisupport.project.ui.customizer.SuiteUtils;
74
import org.netbeans.modules.apisupport.project.universe.HarnessVersion;
75
import org.netbeans.modules.apisupport.project.universe.HarnessVersion;
75
import org.netbeans.modules.apisupport.project.universe.NbPlatform;
76
import org.netbeans.modules.apisupport.project.universe.NbPlatform;
77
import org.netbeans.spi.project.ActionProgress;
76
import org.netbeans.spi.project.ActionProvider;
78
import org.netbeans.spi.project.ActionProvider;
77
import org.netbeans.spi.project.SubprojectProvider;
79
import org.netbeans.spi.project.SubprojectProvider;
78
import org.netbeans.spi.project.support.ant.AntProjectHelper;
80
import org.netbeans.spi.project.support.ant.AntProjectHelper;
Lines 92-97 Link Here
92
import org.openide.util.Lookup;
94
import org.openide.util.Lookup;
93
import org.openide.util.NbBundle.Messages;
95
import org.openide.util.NbBundle.Messages;
94
import org.openide.util.Task;
96
import org.openide.util.Task;
97
import org.openide.util.TaskListener;
95
import org.openide.util.actions.Presenter;
98
import org.openide.util.actions.Presenter;
96
99
97
/**
100
/**
Lines 395-418 Link Here
395
                }
398
                }
396
            }
399
            }
397
            ExecutorTask task = null;
400
            ExecutorTask task = null;
398
            ActionEvent ev;
399
            try {
401
            try {
400
                task = invokeActionImpl(command, context);
402
                task = invokeActionImpl(command, context);
401
            } catch (IOException e) {
403
            } catch (IOException e) {
402
                Util.err.notify(e);
404
                Util.err.notify(e);
403
            }
405
            }
404
            if (
406
            if (task != null) {
405
                task != null &&
407
                final ActionProgress listener = ActionProgress.start(context);
406
                (ev = context.lookup(ActionEvent.class)) != null &&
408
                task.addTaskListener(new TaskListener() {
407
                "waitFinished".equals(ev.getActionCommand()) // NOI18N
409
                    @Override public void taskFinished(Task task) {
408
            ) {
410
                        listener.finished(((ExecutorTask) task).result() == 0);
409
                task.waitFinished();
410
                if (ev.getSource() instanceof ExecutorTask[]) {
411
                    ExecutorTask[] arr = (ExecutorTask[])ev.getSource();
412
                    if (arr.length > 0) {
413
                        arr[0] = task;
414
                    }
411
                    }
415
                }
412
                });
416
            }
413
            }
417
        }
414
        }
418
    }
415
    }
Lines 420-426 Link Here
420
    /** Used from tests to start the build script and get task that allows to track its progress.
417
    /** Used from tests to start the build script and get task that allows to track its progress.
421
     * @return null or task that was started
418
     * @return null or task that was started
422
     */
419
     */
423
    public ExecutorTask invokeActionImpl(String command, Lookup context) throws IllegalArgumentException, IOException {
420
    public @CheckForNull ExecutorTask invokeActionImpl(String command, Lookup context) throws IllegalArgumentException, IOException {
424
        String[] targetNames;
421
        String[] targetNames;
425
        Properties p = new Properties();
422
        Properties p = new Properties();
426
423
(-)a/apisupport.ant/test/unit/src/org/netbeans/modules/apisupport/project/suite/BuildZipDistributionTest.java (-10 / +3 lines)
Lines 44-50 Link Here
44
44
45
package org.netbeans.modules.apisupport.project.suite;
45
package org.netbeans.modules.apisupport.project.suite;
46
46
47
import java.awt.event.ActionEvent;
48
import java.io.File;
47
import java.io.File;
49
import java.io.FileOutputStream;
48
import java.io.FileOutputStream;
50
import java.io.IOException;
49
import java.io.IOException;
Lines 75-82 Link Here
75
import org.openide.filesystems.FileUtil;
74
import org.openide.filesystems.FileUtil;
76
import org.openide.util.NbCollections;
75
import org.openide.util.NbCollections;
77
import org.openide.util.Utilities;
76
import org.openide.util.Utilities;
78
import org.openide.util.lookup.Lookups;
79
import org.openide.util.lookup.ProxyLookup;
80
77
81
/**
78
/**
82
 * Checks building of ZIP support.
79
 * Checks building of ZIP support.
Lines 156-168 Link Here
156
        
153
        
157
        DialogDisplayerImpl.returnFromNotify(DialogDescriptor.NO_OPTION);
154
        DialogDisplayerImpl.returnFromNotify(DialogDescriptor.NO_OPTION);
158
155
159
        ExecutorTask[] taskHolder = new ExecutorTask[1];
156
        ExecutorTask task = p.invokeActionImpl("build-zip", suite.getLookup());
160
        ActionEvent ev = new ActionEvent(taskHolder, 0, "waitFinished"); // NOI18N
157
        assertNotNull("Task was started", task);
161
        ProxyLookup lkp = new ProxyLookup(suite.getLookup(), Lookups.singleton(ev));
158
        assertEquals("Finished ok", 0, task.result());
162
        p.invokeAction("build-zip", lkp);
163
        assertNotNull("Task was started", taskHolder[0]);
164
        assertTrue("Finished already", taskHolder[0].isFinished());
165
        assertEquals("Finished ok", 0, taskHolder[0].result());
166
        
159
        
167
        FileObject[] arr = suite.getProjectDirectory().getChildren();
160
        FileObject[] arr = suite.getProjectDirectory().getChildren();
168
        List<FileObject> subobj = new ArrayList<FileObject>(Arrays.asList(arr));
161
        List<FileObject> subobj = new ArrayList<FileObject>(Arrays.asList(arr));
(-)a/coherence/nbproject/project.xml (-35 / +2 lines)
Lines 6-20 Link Here
6
            <code-name-base>org.netbeans.modules.coherence</code-name-base>
6
            <code-name-base>org.netbeans.modules.coherence</code-name-base>
7
            <module-dependencies>
7
            <module-dependencies>
8
                <dependency>
8
                <dependency>
9
                    <code-name-base>org.apache.tools.ant.module</code-name-base>
10
                    <build-prerequisite/>
11
                    <compile-dependency/>
12
                    <run-dependency>
13
                        <release-version>3</release-version>
14
                        <specification-version>3.52</specification-version>
15
                    </run-dependency>
16
                </dependency>
17
                <dependency>
18
                    <code-name-base>org.jdesktop.beansbinding</code-name-base>
9
                    <code-name-base>org.jdesktop.beansbinding</code-name-base>
19
                    <build-prerequisite/>
10
                    <build-prerequisite/>
20
                    <compile-dependency/>
11
                    <compile-dependency/>
Lines 162-168 Link Here
162
                    <compile-dependency/>
153
                    <compile-dependency/>
163
                    <run-dependency>
154
                    <run-dependency>
164
                        <release-version>1</release-version>
155
                        <release-version>1</release-version>
165
                        <specification-version>1.41</specification-version>
156
                        <specification-version>1.43</specification-version>
166
                    </run-dependency>
157
                    </run-dependency>
167
                </dependency>
158
                </dependency>
168
                <dependency>
159
                <dependency>
Lines 228-241 Link Here
228
                    </run-dependency>
219
                    </run-dependency>
229
                </dependency>
220
                </dependency>
230
                <dependency>
221
                <dependency>
231
                    <code-name-base>org.openide.actions</code-name-base>
232
                    <build-prerequisite/>
233
                    <compile-dependency/>
234
                    <run-dependency>
235
                        <specification-version>6.16.1</specification-version>
236
                    </run-dependency>
237
                </dependency>
238
                <dependency>
239
                    <code-name-base>org.openide.awt</code-name-base>
222
                    <code-name-base>org.openide.awt</code-name-base>
240
                    <build-prerequisite/>
223
                    <build-prerequisite/>
241
                    <compile-dependency/>
224
                    <compile-dependency/>
Lines 252-265 Link Here
252
                    </run-dependency>
235
                    </run-dependency>
253
                </dependency>
236
                </dependency>
254
                <dependency>
237
                <dependency>
255
                    <code-name-base>org.openide.execution</code-name-base>
256
                    <build-prerequisite/>
257
                    <compile-dependency/>
258
                    <run-dependency>
259
                        <specification-version>1.25</specification-version>
260
                    </run-dependency>
261
                </dependency>
262
                <dependency>
263
                    <code-name-base>org.openide.explorer</code-name-base>
238
                    <code-name-base>org.openide.explorer</code-name-base>
264
                    <build-prerequisite/>
239
                    <build-prerequisite/>
265
                    <compile-dependency/>
240
                    <compile-dependency/>
Lines 276-289 Link Here
276
                    </run-dependency>
251
                    </run-dependency>
277
                </dependency>
252
                </dependency>
278
                <dependency>
253
                <dependency>
279
                    <code-name-base>org.openide.io</code-name-base>
280
                    <build-prerequisite/>
281
                    <compile-dependency/>
282
                    <run-dependency>
283
                        <specification-version>1.23.1</specification-version>
284
                    </run-dependency>
285
                </dependency>
286
                <dependency>
287
                    <code-name-base>org.openide.loaders</code-name-base>
254
                    <code-name-base>org.openide.loaders</code-name-base>
288
                    <build-prerequisite/>
255
                    <build-prerequisite/>
289
                    <compile-dependency/>
256
                    <compile-dependency/>
Lines 296-302 Link Here
296
                    <build-prerequisite/>
263
                    <build-prerequisite/>
297
                    <compile-dependency/>
264
                    <compile-dependency/>
298
                    <run-dependency>
265
                    <run-dependency>
299
                        <specification-version>7.16.1</specification-version>
266
                        <specification-version>7.23</specification-version>
300
                    </run-dependency>
267
                    </run-dependency>
301
                </dependency>
268
                </dependency>
302
                <dependency>
269
                <dependency>
(-)a/coherence/src/org/netbeans/modules/coherence/project/actions/RunOnCoherence.java (-34 / +26 lines)
Lines 43-57 Link Here
43
43
44
import java.awt.event.ActionEvent;
44
import java.awt.event.ActionEvent;
45
import java.io.File;
45
import java.io.File;
46
import java.io.IOException;
47
import java.net.URI;
46
import java.net.URI;
48
import java.util.ArrayList;
47
import java.util.ArrayList;
48
import java.util.Arrays;
49
import java.util.List;
49
import java.util.List;
50
import java.util.Properties;
51
import java.util.concurrent.atomic.AtomicBoolean;
50
import java.util.concurrent.atomic.AtomicBoolean;
51
import java.util.logging.Level;
52
import java.util.logging.Logger;
52
import javax.swing.AbstractAction;
53
import javax.swing.AbstractAction;
53
import javax.swing.Action;
54
import javax.swing.Action;
54
import org.apache.tools.ant.module.api.support.ActionUtils;
55
import org.netbeans.api.java.project.JavaProjectConstants;
55
import org.netbeans.api.java.project.JavaProjectConstants;
56
import org.netbeans.api.project.Project;
56
import org.netbeans.api.project.Project;
57
import org.netbeans.api.project.ant.AntArtifact;
57
import org.netbeans.api.project.ant.AntArtifact;
Lines 60-77 Link Here
60
import org.netbeans.modules.coherence.server.CoherenceInstance;
60
import org.netbeans.modules.coherence.server.CoherenceInstance;
61
import org.netbeans.modules.coherence.server.CoherenceInstanceProvider;
61
import org.netbeans.modules.coherence.server.CoherenceInstanceProvider;
62
import org.netbeans.modules.coherence.server.util.ClasspathPropertyUtils;
62
import org.netbeans.modules.coherence.server.util.ClasspathPropertyUtils;
63
import org.netbeans.spi.project.support.ant.GeneratedFilesHelper;
63
import org.netbeans.spi.project.ActionProgress;
64
import org.netbeans.spi.project.ActionProvider;
64
import org.openide.awt.ActionID;
65
import org.openide.awt.ActionID;
65
import org.openide.awt.ActionReference;
66
import org.openide.awt.ActionReference;
66
import org.openide.awt.ActionReferences;
67
import org.openide.awt.ActionReferences;
67
import org.openide.awt.ActionRegistration;
68
import org.openide.awt.ActionRegistration;
68
import org.openide.awt.DynamicMenuContent;
69
import org.openide.awt.DynamicMenuContent;
69
import org.openide.filesystems.FileObject;
70
import org.openide.filesystems.FileUtil;
70
import org.openide.filesystems.FileUtil;
71
import org.openide.util.ContextAwareAction;
71
import org.openide.util.ContextAwareAction;
72
import org.openide.util.Exceptions;
73
import org.openide.util.Lookup;
72
import org.openide.util.Lookup;
74
import org.openide.util.NbBundle;
73
import org.openide.util.NbBundle;
74
import org.openide.util.lookup.Lookups;
75
75
76
@ActionID(id="org.netbeans.modules.coherence.project.actions.RunOnCoherence", category="Project")
76
@ActionID(id="org.netbeans.modules.coherence.project.actions.RunOnCoherence", category="Project")
77
@ActionRegistration(displayName="#LBL_RunOnCoherence", lazy=false)
77
@ActionRegistration(displayName="#LBL_RunOnCoherence", lazy=false)
Lines 82-87 Link Here
82
})
82
})
83
public class RunOnCoherence extends AbstractAction implements ContextAwareAction {
83
public class RunOnCoherence extends AbstractAction implements ContextAwareAction {
84
84
85
    private static final Logger LOG = Logger.getLogger(RunOnCoherence.class.getName());
86
85
    @Override
87
    @Override
86
    public void actionPerformed(ActionEvent e) {
88
    public void actionPerformed(ActionEvent e) {
87
        assert false;
89
        assert false;
Lines 112-151 Link Here
112
                if (artifactLocs.length > 0) {
114
                if (artifactLocs.length > 0) {
113
                    URI jarLocation = artifactLocs[0];
115
                    URI jarLocation = artifactLocs[0];
114
                    File baseJar = new File(FileUtil.toFile(project.getProjectDirectory()), jarLocation.toString());
116
                    File baseJar = new File(FileUtil.toFile(project.getProjectDirectory()), jarLocation.toString());
115
                    List<CoherenceInstance> relatedInstances = getRelatedInstances(baseJar.getAbsolutePath());
117
                    final List<CoherenceInstance> relatedInstances = getRelatedInstances(baseJar.getAbsolutePath());
116
//                    ActionProvider ap = project.getLookup().lookup(ActionProvider.class);
118
                    ActionProvider ap = project.getLookup().lookup(ActionProvider.class);
117
119
                    if (ap != null && Arrays.asList(ap.getSupportedActions()).contains(ActionProvider.COMMAND_BUILD) && ap.isActionEnabled(ActionProvider.COMMAND_BUILD, Lookup.EMPTY)) {
118
                    // Should be replaced by some blocking method of ActionProvider once
120
                        final AtomicBoolean started = new AtomicBoolean();
119
                    //  similar method will be introduced there. See issue #71515.
121
                        ap.invokeAction(ActionProvider.COMMAND_BUILD, Lookups.singleton(new ActionProgress() {
120
                    AtomicBoolean targetResult = new AtomicBoolean(false);
122
                            @Override public void started() {
121
                    try {
123
                                started.set(true);
122
                        Properties properties = new Properties();
124
                            }
123
                        org.openide.execution.ExecutorTask runTarget = ActionUtils.runTarget(
125
                            @Override public void finished(boolean success) {
124
                                getBuildXml(project),
126
                                if (success) {
125
                                new String[] {"jar"}, //NOI18N
127
                                    for (CoherenceInstance coherenceInstance : relatedInstances) {
126
                                properties);
128
                                        coherenceInstance.getServer().restart();
127
                        if (runTarget.result() == 0) {
129
                                    }
128
                            targetResult.set(true);
130
                                }
129
                        }
131
                            }
130
                    } catch (IOException ex) {
132
                        }));
131
                        Exceptions.printStackTrace(ex);
133
                        if (!started.get()) {
132
                    } catch (IllegalArgumentException ex) {
134
                            LOG.log(Level.WARNING, "ActionProgress not supported by {0}", project);
133
                        Exceptions.printStackTrace(ex);
134
                    }
135
136
                    if (targetResult.get()) {
137
                        for (CoherenceInstance coherenceInstance : relatedInstances) {
138
                            coherenceInstance.getServer().restart();
139
                        }
135
                        }
140
                    }
136
                    }
141
                }
137
                }
142
            }
138
            }
143
        }
139
        }
144
140
145
        private static FileObject getBuildXml(Project project) {
146
            return project.getProjectDirectory().getFileObject(GeneratedFilesHelper.BUILD_XML_PATH);
147
        }
148
149
        private static List<CoherenceInstance> getRelatedInstances(String location) {
141
        private static List<CoherenceInstance> getRelatedInstances(String location) {
150
            List<CoherenceInstance> related = new ArrayList<CoherenceInstance>();
142
            List<CoherenceInstance> related = new ArrayList<CoherenceInstance>();
151
            List<CoherenceInstance> allinstances = CoherenceInstanceProvider.getCoherenceProvider().getCoherenceInstances();
143
            List<CoherenceInstance> allinstances = CoherenceInstanceProvider.getCoherenceProvider().getCoherenceInstances();
(-)a/j2ee.earproject/nbproject/project.xml (-1 / +1 lines)
Lines 231-237 Link Here
231
                    <compile-dependency/>
231
                    <compile-dependency/>
232
                    <run-dependency>
232
                    <run-dependency>
233
                        <release-version>1</release-version>
233
                        <release-version>1</release-version>
234
                        <specification-version>1.12</specification-version>
234
                        <specification-version>1.43</specification-version>
235
                    </run-dependency>
235
                    </run-dependency>
236
                </dependency>
236
                </dependency>
237
                <dependency>
237
                <dependency>
(-)a/j2ee.earproject/src/org/netbeans/modules/j2ee/earproject/EarActionProvider.java (-7 / +6 lines)
Lines 54-60 Link Here
54
import org.netbeans.api.debugger.DebuggerManager;
54
import org.netbeans.api.debugger.DebuggerManager;
55
import org.netbeans.api.debugger.Session;
55
import org.netbeans.api.debugger.Session;
56
import org.netbeans.api.debugger.jpda.AttachingDICookie;
56
import org.netbeans.api.debugger.jpda.AttachingDICookie;
57
import org.netbeans.api.j2ee.core.Profile;
58
import org.netbeans.api.project.Project;
57
import org.netbeans.api.project.Project;
59
import org.netbeans.modules.j2ee.api.ejbjar.EjbProjectConstants;
58
import org.netbeans.modules.j2ee.api.ejbjar.EjbProjectConstants;
60
import org.netbeans.modules.j2ee.common.project.ui.DeployOnSaveUtils;
59
import org.netbeans.modules.j2ee.common.project.ui.DeployOnSaveUtils;
Lines 70-80 Link Here
70
import org.netbeans.modules.java.api.common.ant.UpdateHelper;
69
import org.netbeans.modules.java.api.common.ant.UpdateHelper;
71
import org.netbeans.modules.web.api.webmodule.WebModule;
70
import org.netbeans.modules.web.api.webmodule.WebModule;
72
import org.netbeans.modules.web.spi.webmodule.WebModuleProvider;
71
import org.netbeans.modules.web.spi.webmodule.WebModuleProvider;
72
import org.netbeans.spi.project.ActionProgress;
73
import org.netbeans.spi.project.ActionProvider;
73
import org.netbeans.spi.project.ActionProvider;
74
import org.netbeans.spi.project.SubprojectProvider;
74
import org.netbeans.spi.project.SubprojectProvider;
75
import org.netbeans.spi.project.ui.support.DefaultProjectOperations;
75
import org.netbeans.spi.project.ui.support.DefaultProjectOperations;
76
import org.openide.DialogDisplayer;
76
import org.openide.DialogDisplayer;
77
import org.openide.NotifyDescriptor;
77
import org.openide.NotifyDescriptor;
78
import org.openide.execution.ExecutorTask;
78
import org.openide.filesystems.FileObject;
79
import org.openide.filesystems.FileObject;
79
import org.openide.filesystems.FileUtil;
80
import org.openide.filesystems.FileUtil;
80
import org.openide.util.Exceptions;
81
import org.openide.util.Exceptions;
Lines 182-189 Link Here
182
        }
183
        }
183
        
184
        
184
        final String commandToExecute = realCommand;
185
        final String commandToExecute = realCommand;
185
        Runnable action = new Runnable () {
186
            public void run () {
187
                Properties p = new Properties();
186
                Properties p = new Properties();
188
                String[] targetNames;
187
                String[] targetNames;
189
188
Lines 198-203 Link Here
198
                    p = null;
197
                    p = null;
199
                }
198
                }
200
                final J2eeApplicationProvider app = EarActionProvider.this.project.getAppModule();
199
                final J2eeApplicationProvider app = EarActionProvider.this.project.getAppModule();
200
                final ActionProgress listener = ActionProgress.start(context);
201
                try {
201
                try {
202
                    Deployment.getDefault().suspendDeployOnSave(app);
202
                    Deployment.getDefault().suspendDeployOnSave(app);
203
                    ActionUtils.runTarget(findBuildXml(), targetNames, p).addTaskListener(new TaskListener() {
203
                    ActionUtils.runTarget(findBuildXml(), targetNames, p).addTaskListener(new TaskListener() {
Lines 205-223 Link Here
205
                        @Override
205
                        @Override
206
                        public void taskFinished(Task task) {
206
                        public void taskFinished(Task task) {
207
                            Deployment.getDefault().resumeDeployOnSave(app);
207
                            Deployment.getDefault().resumeDeployOnSave(app);
208
                            listener.finished(((ExecutorTask) task).result() == 0);
208
                        }
209
                        }
209
                    });
210
                    });
210
                } catch (IOException e) {
211
                } catch (IOException e) {
211
                    Deployment.getDefault().resumeDeployOnSave(app);
212
                    Deployment.getDefault().resumeDeployOnSave(app);
212
                    Exceptions.printStackTrace(e);
213
                    Exceptions.printStackTrace(e);
214
                    listener.finished(false);
213
                } catch (RuntimeException ex) {
215
                } catch (RuntimeException ex) {
214
                    Deployment.getDefault().resumeDeployOnSave(app);
216
                    Deployment.getDefault().resumeDeployOnSave(app);
217
                    listener.finished(false);
215
                    throw ex;
218
                    throw ex;
216
                }
219
                }
217
            }
218
        };
219
        
220
        action.run();
221
    }
220
    }
222
221
223
    /**
222
    /**
(-)a/java.api.common/nbproject/project.xml (-1 / +1 lines)
Lines 126-132 Link Here
126
                    <compile-dependency/>
126
                    <compile-dependency/>
127
                    <run-dependency>
127
                    <run-dependency>
128
                        <release-version>1</release-version>
128
                        <release-version>1</release-version>
129
                        <specification-version>1.14</specification-version>
129
                        <specification-version>1.43</specification-version>
130
                    </run-dependency>
130
                    </run-dependency>
131
                </dependency>
131
                </dependency>
132
                <dependency>
132
                <dependency>
(-)a/java.api.common/src/org/netbeans/modules/java/api/common/project/BaseActionProvider.java (-7 / +36 lines)
Lines 114-119 Link Here
114
import org.netbeans.modules.java.api.common.util.CommonProjectUtils;
114
import org.netbeans.modules.java.api.common.util.CommonProjectUtils;
115
import org.netbeans.spi.java.classpath.ClassPathProvider;
115
import org.netbeans.spi.java.classpath.ClassPathProvider;
116
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
116
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
117
import org.netbeans.spi.project.ActionProgress;
117
import org.netbeans.spi.project.ActionProvider;
118
import org.netbeans.spi.project.ActionProvider;
118
import org.netbeans.spi.project.ProjectConfiguration;
119
import org.netbeans.spi.project.ProjectConfiguration;
119
import org.netbeans.spi.project.SingleMethod;
120
import org.netbeans.spi.project.SingleMethod;
Lines 406-411 Link Here
406
        final boolean isCompileOnSaveEnabled = isCompileOnSaveEnabled();
407
        final boolean isCompileOnSaveEnabled = isCompileOnSaveEnabled();
407
        final AtomicReference<Thread> caller = new AtomicReference<Thread>(Thread.currentThread());
408
        final AtomicReference<Thread> caller = new AtomicReference<Thread>(Thread.currentThread());
408
        final AtomicBoolean called = new AtomicBoolean(false);
409
        final AtomicBoolean called = new AtomicBoolean(false);
410
        // XXX prefer to call just if and when actually starting target, but that is hard to calculate here
411
        final ActionProgress listener = ActionProgress.start(context);
409
412
410
        class  Action implements Runnable {
413
        class  Action implements Runnable {
411
414
Lines 418-423 Link Here
418
             * the default values (possibly incorrect) are used.
421
             * the default values (possibly incorrect) are used.
419
             */
422
             */
420
            private boolean doJavaChecks = true;
423
            private boolean doJavaChecks = true;
424
            ExecutorTask task;
421
425
422
            @Override
426
            @Override
423
            public void run () {
427
            public void run () {
Lines 425-430 Link Here
425
                    return;
429
                    return;
426
                }
430
                }
427
                called.set(true);
431
                called.set(true);
432
                try {
433
                    doRun();
434
                } finally {
435
                    if (task != null) {
436
                        task.addTaskListener(new TaskListener() {
437
                            @org.netbeans.api.annotations.common.SuppressWarnings("UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR")
438
                            @Override public void taskFinished(Task _) {
439
                                listener.finished(task.result() == 0);
440
                            }
441
                        });
442
                    } else {
443
                        listener.finished(false);
444
                    }
445
                }
446
            }
447
448
            void doRun() {
428
                Properties p = new Properties();
449
                Properties p = new Properties();
429
                String[] targetNames;
450
                String[] targetNames;
430
451
Lines 465-470 Link Here
465
                                execProperties.put("applet.url", url);
486
                                execProperties.put("applet.url", url);
466
                                execProperties.put(JavaRunner.PROP_EXECUTE_FILE, file);
487
                                execProperties.put(JavaRunner.PROP_EXECUTE_FILE, file);
467
                                prepareSystemProperties(execProperties, false);
488
                                prepareSystemProperties(execProperties, false);
489
                                task =
468
                                JavaRunner.execute(targetNames[0], execProperties);
490
                                JavaRunner.execute(targetNames[0], execProperties);
469
                            }
491
                            }
470
                        } catch (IOException ex) {
492
                        } catch (IOException ex) {
Lines 474-480 Link Here
474
                    }
496
                    }
475
                    if (!isServerExecution() && (COMMAND_RUN.equals(command) || COMMAND_DEBUG.equals(command) || COMMAND_DEBUG_STEP_INTO.equals(command))) {
497
                    if (!isServerExecution() && (COMMAND_RUN.equals(command) || COMMAND_DEBUG.equals(command) || COMMAND_DEBUG_STEP_INTO.equals(command))) {
476
                        prepareSystemProperties(execProperties, false);
498
                        prepareSystemProperties(execProperties, false);
477
                        bypassAntBuildScript(command, context, execProperties);
499
                        AtomicReference<ExecutorTask> _task = new AtomicReference<ExecutorTask>();
500
                        bypassAntBuildScript(command, context, execProperties, _task);
501
                        task = _task.get();
478
                        return ;
502
                        return ;
479
                    }
503
                    }
480
                    // for example RUN_SINGLE Java file with Servlet must be run on server and not locally
504
                    // for example RUN_SINGLE Java file with Servlet must be run on server and not locally
Lines 487-493 Link Here
487
                        } else {
511
                        } else {
488
                            execProperties.put(JavaRunner.PROP_CLASSNAME, p.getProperty("debug.class"));
512
                            execProperties.put(JavaRunner.PROP_CLASSNAME, p.getProperty("debug.class"));
489
                        }
513
                        }
490
                        bypassAntBuildScript(command, context, execProperties);
514
                        AtomicReference<ExecutorTask> _task = new AtomicReference<ExecutorTask>();
515
                        bypassAntBuildScript(command, context, execProperties, _task);
516
                        task = _task.get();
491
                        return;
517
                        return;
492
                    }
518
                    }
493
                    if (COMMAND_TEST_SINGLE.equals(command) || COMMAND_DEBUG_TEST_SINGLE.equals(command)) {
519
                    if (COMMAND_TEST_SINGLE.equals(command) || COMMAND_DEBUG_TEST_SINGLE.equals(command)) {
Lines 497-502 Link Here
497
                            execProperties.put(JavaRunner.PROP_EXECUTE_FILE, files[0]);
523
                            execProperties.put(JavaRunner.PROP_EXECUTE_FILE, files[0]);
498
                            execProperties.put("tmp.dir", updateHelper.getAntProjectHelper().resolvePath(evaluator.getProperty(ProjectProperties.BUILD_DIR)));   //NOI18N
524
                            execProperties.put("tmp.dir", updateHelper.getAntProjectHelper().resolvePath(evaluator.getProperty(ProjectProperties.BUILD_DIR)));   //NOI18N
499
                            updateJavaRunnerClasspath(command, execProperties);
525
                            updateJavaRunnerClasspath(command, execProperties);
526
                            task =
500
                            JavaRunner.execute(COMMAND_TEST_SINGLE.equals(command) ? JavaRunner.QUICK_TEST : JavaRunner.QUICK_TEST_DEBUG, execProperties);
527
                            JavaRunner.execute(COMMAND_TEST_SINGLE.equals(command) ? JavaRunner.QUICK_TEST : JavaRunner.QUICK_TEST_DEBUG, execProperties);
501
                        } catch (IOException ex) {
528
                        } catch (IOException ex) {
502
                            Exceptions.printStackTrace(ex);
529
                            Exceptions.printStackTrace(ex);
Lines 510-515 Link Here
510
                            execProperties.put(JavaRunner.PROP_EXECUTE_FILE, methodSpec.getFile());
537
                            execProperties.put(JavaRunner.PROP_EXECUTE_FILE, methodSpec.getFile());
511
                            execProperties.put("tmp.dir",updateHelper.getAntProjectHelper().resolvePath(evaluator.getProperty(ProjectProperties.BUILD_DIR)));   //NOI18N
538
                            execProperties.put("tmp.dir",updateHelper.getAntProjectHelper().resolvePath(evaluator.getProperty(ProjectProperties.BUILD_DIR)));   //NOI18N
512
                            updateJavaRunnerClasspath(command, execProperties);
539
                            updateJavaRunnerClasspath(command, execProperties);
540
                            task =
513
                            JavaRunner.execute(command.equals(SingleMethod.COMMAND_RUN_SINGLE_METHOD) ? JavaRunner.QUICK_TEST : JavaRunner.QUICK_TEST_DEBUG,
541
                            JavaRunner.execute(command.equals(SingleMethod.COMMAND_RUN_SINGLE_METHOD) ? JavaRunner.QUICK_TEST : JavaRunner.QUICK_TEST_DEBUG,
514
                                                  execProperties);
542
                                                  execProperties);
515
                        } catch (IOException ex) {
543
                        } catch (IOException ex) {
Lines 547-553 Link Here
547
                            cb2.antTargetInvocationStarted(command, context);
575
                            cb2.antTargetInvocationStarted(command, context);
548
                        }
576
                        }
549
                        try {
577
                        try {
550
                            ActionUtils.runTarget(buildFo, targetNames, p).addTaskListener(new TaskListener() {
578
                            task = ActionUtils.runTarget(buildFo, targetNames, p);
579
                            task.addTaskListener(new TaskListener() {
551
                                @Override
580
                                @Override
552
                                public void taskFinished(Task task) {
581
                                public void taskFinished(Task task) {
553
                                    try {
582
                                    try {
Lines 1352-1358 Link Here
1352
        return srcDir;
1381
        return srcDir;
1353
    }
1382
    }
1354
1383
1355
    private void bypassAntBuildScript(String command, Lookup context, Map<String, Object> p) throws IllegalArgumentException {
1384
    private void bypassAntBuildScript(String command, Lookup context, Map<String, Object> p, AtomicReference<ExecutorTask> task) throws IllegalArgumentException {
1356
        boolean run = true;
1385
        boolean run = true;
1357
        boolean hasMainMethod = true;
1386
        boolean hasMainMethod = true;
1358
1387
Lines 1386-1397 Link Here
1386
            updateJavaRunnerClasspath(command, p);
1415
            updateJavaRunnerClasspath(command, p);
1387
            if (run) {
1416
            if (run) {
1388
                copyMultiValue(ProjectProperties.APPLICATION_ARGS, p);
1417
                copyMultiValue(ProjectProperties.APPLICATION_ARGS, p);
1389
                JavaRunner.execute(debug ? JavaRunner.QUICK_DEBUG : JavaRunner.QUICK_RUN, p);
1418
                task.set(JavaRunner.execute(debug ? JavaRunner.QUICK_DEBUG : JavaRunner.QUICK_RUN, p));
1390
            } else {
1419
            } else {
1391
                if (hasMainMethod) {
1420
                if (hasMainMethod) {
1392
                    JavaRunner.execute(debug ? JavaRunner.QUICK_DEBUG : JavaRunner.QUICK_RUN, p);
1421
                    task.set(JavaRunner.execute(debug ? JavaRunner.QUICK_DEBUG : JavaRunner.QUICK_RUN, p));
1393
                } else {
1422
                } else {
1394
                    JavaRunner.execute(debug ? JavaRunner.QUICK_TEST_DEBUG : JavaRunner.QUICK_TEST, p);
1423
                    task.set(JavaRunner.execute(debug ? JavaRunner.QUICK_TEST_DEBUG : JavaRunner.QUICK_TEST, p));
1395
                }
1424
                }
1396
            }
1425
            }
1397
        } catch (IOException ex) {
1426
        } catch (IOException ex) {
(-)a/javafx2.project/nbproject/project.xml (-1 / +1 lines)
Lines 143-149 Link Here
143
                    <compile-dependency/>
143
                    <compile-dependency/>
144
                    <run-dependency>
144
                    <run-dependency>
145
                        <release-version>1</release-version>
145
                        <release-version>1</release-version>
146
                        <specification-version>1.34</specification-version>
146
                        <specification-version>1.43</specification-version>
147
                    </run-dependency>
147
                    </run-dependency>
148
                </dependency>
148
                </dependency>
149
                <dependency>
149
                <dependency>
(-)a/javafx2.project/src/org/netbeans/modules/javafx2/project/JFXActionProvider.java (-9 / +13 lines)
Lines 44-64 Link Here
44
import java.io.IOException;
44
import java.io.IOException;
45
import java.util.HashMap;
45
import java.util.HashMap;
46
import java.util.Map;
46
import java.util.Map;
47
import java.util.Properties;
48
import org.apache.tools.ant.module.api.support.ActionUtils;
47
import org.apache.tools.ant.module.api.support.ActionUtils;
49
import org.netbeans.api.annotations.common.CheckForNull;
48
import org.netbeans.api.annotations.common.CheckForNull;
50
import org.netbeans.api.annotations.common.NonNull;
49
import org.netbeans.api.annotations.common.NonNull;
51
import org.netbeans.api.project.Project;
50
import org.netbeans.api.project.Project;
52
import org.netbeans.modules.java.j2seproject.api.J2SEPropertyEvaluator;
51
import org.netbeans.modules.java.j2seproject.api.J2SEPropertyEvaluator;
52
import org.netbeans.spi.project.ActionProgress;
53
import org.netbeans.spi.project.ActionProvider;
53
import org.netbeans.spi.project.ActionProvider;
54
import org.netbeans.spi.project.LookupProvider;
54
import org.netbeans.spi.project.LookupProvider;
55
import org.netbeans.spi.project.ProjectServiceProvider;
55
import org.netbeans.spi.project.ProjectServiceProvider;
56
import org.netbeans.spi.project.support.ant.GeneratedFilesHelper;
56
import org.netbeans.spi.project.support.ant.GeneratedFilesHelper;
57
import org.netbeans.spi.project.support.ant.PropertyEvaluator;
57
import org.netbeans.spi.project.support.ant.PropertyEvaluator;
58
import org.openide.execution.ExecutorTask;
58
import org.openide.filesystems.FileObject;
59
import org.openide.filesystems.FileObject;
59
import org.openide.util.Exceptions;
60
import org.openide.util.Exceptions;
60
import org.openide.util.Lookup;
61
import org.openide.util.Lookup;
61
import org.openide.util.Parameters;
62
import org.openide.util.Parameters;
63
import org.openide.util.Task;
64
import org.openide.util.TaskListener;
62
65
63
/**
66
/**
64
 * Skeleton of JFX Action Provider
67
 * Skeleton of JFX Action Provider
Lines 90-121 Link Here
90
93
91
    @Override
94
    @Override
92
    public void invokeAction(@NonNull String command, @NonNull Lookup context) throws IllegalArgumentException {
95
    public void invokeAction(@NonNull String command, @NonNull Lookup context) throws IllegalArgumentException {
93
        String target;
96
        if (command != null) {
94
        if ((target=(command))!=null) {
95
            FileObject buildFo = findBuildXml();
97
            FileObject buildFo = findBuildXml();
96
            assert buildFo != null && buildFo.isValid();
98
            assert buildFo != null && buildFo.isValid();
97
            String runAs = JFXProjectUtils.getFXProjectRunAs(prj);
99
            String runAs = JFXProjectUtils.getFXProjectRunAs(prj);
98
            if(runAs == null) {
100
            if(runAs == null) {
99
                runAs = JFXProjectProperties.RunAsType.STANDALONE.getString();
101
                runAs = JFXProjectProperties.RunAsType.STANDALONE.getString();
100
            }
102
            }
103
            final ActionProgress listener = ActionProgress.start(context);
101
            try {
104
            try {
105
                String target;
102
                if(runAs.equalsIgnoreCase(JFXProjectProperties.RunAsType.STANDALONE.getString())) {
106
                if(runAs.equalsIgnoreCase(JFXProjectProperties.RunAsType.STANDALONE.getString())) {
103
                    target = "jfxsa-".concat(command); //NOI18N
107
                    target = "jfxsa-".concat(command); //NOI18N
104
                    final Properties p = new Properties();
105
                    ActionUtils.runTarget(buildFo, new String[] {target}, p);    //NOI18N
106
                } else {
108
                } else {
107
                    if(runAs.equalsIgnoreCase(JFXProjectProperties.RunAsType.ASWEBSTART.getString())) {
109
                    if(runAs.equalsIgnoreCase(JFXProjectProperties.RunAsType.ASWEBSTART.getString())) {
108
                        target = "jfxws-".concat(command); //NOI18N
110
                        target = "jfxws-".concat(command); //NOI18N
109
                        final Properties p = new Properties();
110
                        ActionUtils.runTarget(buildFo, new String[] {target}, p);    //NOI18N
111
                    } else { //JFXProjectProperties.RunAsType.INBROWSER
111
                    } else { //JFXProjectProperties.RunAsType.INBROWSER
112
                        target = "jfxbe-".concat(command); //NOI18N
112
                        target = "jfxbe-".concat(command); //NOI18N
113
                        final Properties p = new Properties();
114
                        ActionUtils.runTarget(buildFo, new String[] {target}, p);    //NOI18N
115
                    }
113
                    }
116
                }
114
                }
115
                ActionUtils.runTarget(buildFo, new String[] {target}, null).addTaskListener(new TaskListener() {
116
                    @Override public void taskFinished(Task task) {
117
                        listener.finished(((ExecutorTask) task).result() == 0);
118
                    }
119
                });
117
            } catch (IOException ex) {
120
            } catch (IOException ex) {
118
                Exceptions.printStackTrace(ex);
121
                Exceptions.printStackTrace(ex);
122
                listener.finished(false);
119
            }
123
            }
120
        } else {
124
        } else {
121
            throw new IllegalArgumentException(command);
125
            throw new IllegalArgumentException(command);
(-)a/javawebstart/nbproject/project.xml (-1 / +1 lines)
Lines 143-149 Link Here
143
                    <compile-dependency/>
143
                    <compile-dependency/>
144
                    <run-dependency>
144
                    <run-dependency>
145
                        <release-version>1</release-version>
145
                        <release-version>1</release-version>
146
                        <specification-version>1.12</specification-version>
146
                        <specification-version>1.43</specification-version>
147
                    </run-dependency>
147
                    </run-dependency>
148
                </dependency>
148
                </dependency>
149
                <dependency>
149
                <dependency>
(-)a/javawebstart/src/org/netbeans/modules/javawebstart/RunJavaws.java (+16 lines)
Lines 41-51 Link Here
41
import java.io.IOException;
41
import java.io.IOException;
42
import java.util.Collection;
42
import java.util.Collection;
43
import org.netbeans.api.java.platform.JavaPlatform;
43
import org.netbeans.api.java.platform.JavaPlatform;
44
import org.netbeans.spi.project.ActionProgress;
44
import org.netbeans.spi.project.ActionProvider;
45
import org.netbeans.spi.project.ActionProvider;
45
import org.openide.filesystems.FileUtil;
46
import org.openide.filesystems.FileUtil;
46
import org.openide.loaders.DataObject;
47
import org.openide.loaders.DataObject;
47
import org.openide.util.Exceptions;
48
import org.openide.util.Exceptions;
48
import org.openide.util.Lookup;
49
import org.openide.util.Lookup;
50
import org.openide.util.RequestProcessor;
49
import org.openide.util.lookup.ServiceProvider;
51
import org.openide.util.lookup.ServiceProvider;
50
52
51
/**
53
/**
Lines 54-59 Link Here
54
@ServiceProvider(service=ActionProvider.class)
56
@ServiceProvider(service=ActionProvider.class)
55
public class RunJavaws implements ActionProvider {
57
public class RunJavaws implements ActionProvider {
56
58
59
    private static final RequestProcessor RP = new RequestProcessor(RunJavaws.class.getName(), Integer.MAX_VALUE);
60
57
    @Override public String[] getSupportedActions() {
61
    @Override public String[] getSupportedActions() {
58
        return new String[] {COMMAND_RUN_SINGLE};
62
        return new String[] {COMMAND_RUN_SINGLE};
59
    }
63
    }
Lines 65-75 Link Here
65
    }
69
    }
66
70
67
    @Override public void invokeAction(String command, Lookup context) throws IllegalArgumentException {
71
    @Override public void invokeAction(String command, Lookup context) throws IllegalArgumentException {
72
        final ActionProgress listener = ActionProgress.start(context);
68
        try {
73
        try {
74
            final Process p =
69
            new ProcessBuilder(FileUtil.toFile(JavaPlatform.getDefault().findTool("javaws")).getAbsolutePath(),
75
            new ProcessBuilder(FileUtil.toFile(JavaPlatform.getDefault().findTool("javaws")).getAbsolutePath(),
70
                    context.lookup(DataObject.class).getPrimaryFile().getURL().toString()).start();
76
                    context.lookup(DataObject.class).getPrimaryFile().getURL().toString()).start();
77
            RP.post(new Runnable() {
78
                @Override public void run() {
79
                    try {
80
                        listener.finished(p.waitFor() == 0);
81
                    } catch (InterruptedException x) {
82
                        listener.finished(false);
83
                    }
84
                }
85
            });
71
        } catch (IOException x) {
86
        } catch (IOException x) {
72
            Exceptions.printStackTrace(x);
87
            Exceptions.printStackTrace(x);
88
            listener.finished(false);
73
        }
89
        }
74
    }
90
    }
75
91
(-)a/maven/nbproject/project.xml (-1 / +1 lines)
Lines 240-246 Link Here
240
                    <compile-dependency/>
240
                    <compile-dependency/>
241
                    <run-dependency>
241
                    <run-dependency>
242
                        <release-version>1</release-version>
242
                        <release-version>1</release-version>
243
                        <specification-version>1.40</specification-version>
243
                        <specification-version>1.43</specification-version>
244
                    </run-dependency>
244
                    </run-dependency>
245
                </dependency>
245
                </dependency>
246
                <dependency>
246
                <dependency>
(-)a/maven/src/org/netbeans/modules/maven/ActionProviderImpl.java (-1 / +15 lines)
Lines 82-87 Link Here
82
import org.netbeans.modules.maven.spi.actions.ActionConvertor;
82
import org.netbeans.modules.maven.spi.actions.ActionConvertor;
83
import org.netbeans.modules.maven.spi.actions.MavenActionsProvider;
83
import org.netbeans.modules.maven.spi.actions.MavenActionsProvider;
84
import org.netbeans.modules.maven.spi.actions.ReplaceTokenProvider;
84
import org.netbeans.modules.maven.spi.actions.ReplaceTokenProvider;
85
import org.netbeans.spi.project.ActionProgress;
85
import org.netbeans.spi.project.ActionProvider;
86
import org.netbeans.spi.project.ActionProvider;
86
import org.netbeans.spi.project.ProjectServiceProvider;
87
import org.netbeans.spi.project.ProjectServiceProvider;
87
import org.netbeans.spi.project.SingleMethod;
88
import org.netbeans.spi.project.SingleMethod;
Lines 95-105 Link Here
95
import org.openide.awt.ActionRegistration;
96
import org.openide.awt.ActionRegistration;
96
import org.openide.awt.DynamicMenuContent;
97
import org.openide.awt.DynamicMenuContent;
97
import org.openide.awt.StatusDisplayer;
98
import org.openide.awt.StatusDisplayer;
99
import org.openide.execution.ExecutorTask;
98
import org.openide.loaders.DataObject;
100
import org.openide.loaders.DataObject;
99
import org.openide.util.ContextAwareAction;
101
import org.openide.util.ContextAwareAction;
100
import org.openide.util.Lookup;
102
import org.openide.util.Lookup;
101
import org.openide.util.NbBundle.Messages;
103
import org.openide.util.NbBundle.Messages;
102
import org.openide.util.RequestProcessor;
104
import org.openide.util.RequestProcessor;
105
import org.openide.util.Task;
106
import org.openide.util.TaskListener;
103
import org.openide.util.actions.Presenter;
107
import org.openide.util.actions.Presenter;
104
import org.openide.util.lookup.Lookups;
108
import org.openide.util.lookup.Lookups;
105
import org.openide.util.lookup.ProxyLookup;
109
import org.openide.util.lookup.ProxyLookup;
Lines 236-242 Link Here
236
240
237
        } else {
241
        } else {
238
            setupTaskName(action, rc, lookup);
242
            setupTaskName(action, rc, lookup);
239
            RunUtils.run(rc);
243
            final ActionProgress listener = ActionProgress.start(lookup);
244
            final ExecutorTask task = RunUtils.run(rc);
245
            if (task != null) {
246
                task.addTaskListener(new TaskListener() {
247
                    @Override public void taskFinished(Task _) {
248
                        listener.finished(task.result() == 0);
249
                    }
250
                });
251
            } else {
252
                listener.finished(false);
253
            }
240
        }
254
        }
241
    }
255
    }
242
256
(-)a/projectapi/apichanges.xml (+22 lines)
Lines 108-113 Link Here
108
108
109
    <changes>
109
    <changes>
110
110
111
        <change id="ActionProgress">
112
            <api name="general"/>
113
            <summary>Added <code>ActionProgress</code></summary>
114
            <version major="1" minor="43"/>
115
            <date year="2012" month="3" day="20"/>
116
            <author login="jglick"/>
117
            <compatibility addition="yes">
118
                <p>
119
                    <code>ActionProvider</code> implementations should call the
120
                    new progress listener if possible.
121
                </p>
122
            </compatibility>
123
            <description>
124
                <p>
125
                    A new callback was added permitting the invoker of a project
126
                    action to be notified when the action completes.
127
                </p>
128
            </description>
129
            <class package="org.netbeans.spi.project" name="ActionProgress"/>
130
            <issue number="71515"/>
131
        </change>
132
111
        <change id="SourceGroup.contains.IAE">
133
        <change id="SourceGroup.contains.IAE">
112
            <api name="general"/>
134
            <api name="general"/>
113
            <summary><code>SourceGroup.contains</code> no longer throws <code>IllegalArgumentException</code></summary>
135
            <summary><code>SourceGroup.contains</code> no longer throws <code>IllegalArgumentException</code></summary>
(-)a/projectapi/manifest.mf (-1 / +1 lines)
Lines 1-7 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.modules.projectapi/1
2
OpenIDE-Module: org.netbeans.modules.projectapi/1
3
OpenIDE-Module-Install: org/netbeans/modules/projectapi/Installer.class
3
OpenIDE-Module-Install: org/netbeans/modules/projectapi/Installer.class
4
OpenIDE-Module-Specification-Version: 1.42
4
OpenIDE-Module-Specification-Version: 1.43
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/projectapi/Bundle.properties
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/projectapi/Bundle.properties
6
OpenIDE-Module-Layer: org/netbeans/modules/projectapi/layer.xml
6
OpenIDE-Module-Layer: org/netbeans/modules/projectapi/layer.xml
7
7
(-)a/projectapi/nbproject/project.xml (+9 lines)
Lines 50-55 Link Here
50
            <code-name-base>org.netbeans.modules.projectapi</code-name-base>
50
            <code-name-base>org.netbeans.modules.projectapi</code-name-base>
51
            <module-dependencies>
51
            <module-dependencies>
52
                <dependency>
52
                <dependency>
53
                    <code-name-base>org.netbeans.api.annotations.common</code-name-base>
54
                    <build-prerequisite/>
55
                    <compile-dependency/>
56
                    <run-dependency>
57
                        <release-version>1</release-version>
58
                        <specification-version>1.13</specification-version>
59
                    </run-dependency>
60
                </dependency>
61
                <dependency>
53
                    <code-name-base>org.netbeans.modules.queries</code-name-base>
62
                    <code-name-base>org.netbeans.modules.queries</code-name-base>
54
                    <build-prerequisite/>
63
                    <build-prerequisite/>
55
                    <compile-dependency/>
64
                    <compile-dependency/>
(-)a/projectapi/src/org/netbeans/spi/project/ActionProgress.java (+139 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.spi.project;
44
45
import org.netbeans.api.annotations.common.NonNull;
46
import org.openide.util.Lookup;
47
48
/**
49
 * Permits the invoker of an action to follow its progress.
50
 * <p>An implementation may be added by a caller to the {@code context}
51
 * of {@link ActionProvider#invokeAction}.
52
 * If the action provider supports this interface, it should call {@link #start}
53
 * <em>before returning</em> from {@code invokeAction}, and at some subsequent
54
 * point (possibly still within {@code invokeAction} but generally later from
55
 * a separate task thread) call {@link #finished} once on the result.
56
 * <p>It is best if the provider only calls {@code start} if and when it is actually
57
 * attempting to run an action at this time, avoiding {@code ActionProgress} entirely
58
 * when the action is being skipped—for example, if some precondition is unsatisfied
59
 * and a warning dialog is displayed rather than building or running anything. However
60
 * when it would be cumbersome or impossible to determine within the dynamic scope of
61
 * {@code invokeAction} whether or not any real action should be run, for example
62
 * because those checks are time-consuming and should not block the event thread,
63
 * the provider may call {@code start} and later {@code finished(false)} to signify
64
 * that the action was not successfully run.
65
 * <p>SPI example using Ant:
66
 * <pre>
67
 * {@code @}Override public void invokeAction(String command, Lookup context) {
68
 *     FileObject buildXml = ...;
69
 *     String[] antTargets = ...decide on targets using command...;
70
 *     if (antTargets == null) { // wrong conditions, not even pretending to run this action
71
 *         showWarningDialog();
72
 *         return;
73
 *     }
74
 *     <b>final ActionProgress listener = ActionProgress.start(context);</b>
75
 *     try {
76
 *         ActionUtils.runTarget(buildXml, antTargets, null)<b>.addTaskListener(new TaskListener() {
77
 *             {@code @}Override public void taskFinished(Task task) {
78
 *                 listener.finished(((ExecutorTask) task).result() == 0);
79
 *             }
80
 *         })</b>;
81
 *     } catch (IOException x) {
82
 *         LOG.log(Level.FINE, "could not start program", x);
83
 *         <b>listener.finished(false);</b>
84
 *     }
85
 * }
86
 * </pre>
87
 * @since 1.43
88
 */
89
public abstract class ActionProgress {
90
    
91
    /**
92
     * Locates a progress listener in an action context.
93
     * {@link #started} is called on the listener immediately.
94
     * If none was defined by the caller, a dummy implementation is provided
95
     * so that the {@link ActionProvider} need not do a null check.
96
     * @param context a context as supplied to {@link ActionProvider#invokeAction}
97
     * @return a progress listener (or dummy stub)
98
     */
99
    public static @NonNull ActionProgress start(@NonNull Lookup context) {
100
        ActionProgress ap = context.lookup(ActionProgress.class);
101
        if (ap != null) {
102
            ap.started();
103
            return ap;
104
        } else {
105
            return new ActionProgress() {
106
                @Override public void started() {}
107
                @Override public void finished(boolean success) {}
108
            };
109
        }
110
    }
111
112
    /** Constructor for subclasses. */
113
    protected ActionProgress() {}
114
115
    /**
116
     * Called when the action is started.
117
     * Serves no purpose other than confirming to the caller that this action
118
     * provider does in fact support this interface and that it should wait
119
     * for action completion. If this method is not called, the caller will
120
     * not know when the action is truly finished.
121
     * Called automatically by {@link #start}, so action providers need not pay attention.
122
     */
123
    protected abstract void started();
124
125
    /**
126
     * Called when the action has completed.
127
     * <p>The meaning of the {@code success} parameter depends on the action and may vary
128
     * from implementation to implementation, but a caller may expect that an action
129
     * such as {@link ActionProvider#COMMAND_BUILD} will fail if the project could not be built;
130
     * and an action such as {@link ActionProvider#COMMAND_RUN} will fail if the program could not
131
     * even be started (but perhaps also if it ran and terminated with an erroneous
132
     * exit code). Some callers may ignore this parameter,
133
     * but callers which intend to run multiple actions in succession (on the same or
134
     * different projects) may abort the chain in case one fails.
135
     * @param success true if the action ran normally, false if it somehow failed
136
     */
137
    public abstract void finished(boolean success);
138
139
}
(-)a/projectapi/src/org/netbeans/spi/project/ActionProvider.java (+1 lines)
Lines 175-180 Link Here
175
     * @param context any action context, e.g. for a node selection
175
     * @param context any action context, e.g. for a node selection
176
     *                (as in {@link ContextAwareAction})
176
     *                (as in {@link ContextAwareAction})
177
     * @throws IllegalArgumentException if the requested command is not supported
177
     * @throws IllegalArgumentException if the requested command is not supported
178
     * @see ActionProgress
178
     */
179
     */
179
    void invokeAction(String command, Lookup context) throws IllegalArgumentException;
180
    void invokeAction(String command, Lookup context) throws IllegalArgumentException;
180
    
181
    

Return to bug 71515