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

(-)a/cnd.debugger.common2/nbproject/project.xml (-1 / +1 lines)
Lines 98-104 Link Here
98
                    <build-prerequisite/>
98
                    <build-prerequisite/>
99
                    <compile-dependency/>
99
                    <compile-dependency/>
100
                    <run-dependency>
100
                    <run-dependency>
101
                        <specification-version>1.3.0.1</specification-version>
101
                        <specification-version>1.26</specification-version>
102
                    </run-dependency>
102
                    </run-dependency>
103
                </dependency>
103
                </dependency>
104
                <dependency>
104
                <dependency>
(-)a/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/actions/AttachPanel.java (-2 / +1 lines)
Lines 101-107 Link Here
101
import org.openide.util.Cancellable;
101
import org.openide.util.Cancellable;
102
import org.openide.util.Lookup;
102
import org.openide.util.Lookup;
103
import org.openide.util.NbBundle;
103
import org.openide.util.NbBundle;
104
import org.openide.windows.WindowManager;
105
104
106
/**
105
/**
107
 * Panel which presents a list of available processes and lets user
106
 * Panel which presents a list of available processes and lets user
Lines 977-983 Link Here
977
                                }
976
                                }
978
                            }
977
                            }
979
                        };
978
                        };
980
                        ModalMessageDlg.runLongTask(WindowManager.getDefault().getMainWindow(), tp, cont, null, title, title);
979
                        ModalMessageDlg.runLongTask(tp, cont, null, title, title);
981
                    }
980
                    }
982
                });
981
                });
983
982
(-)a/cnd.makeproject/nbproject/project.xml (-1 / +1 lines)
Lines 80-86 Link Here
80
                    <build-prerequisite/>
80
                    <build-prerequisite/>
81
                    <compile-dependency/>
81
                    <compile-dependency/>
82
                    <run-dependency>
82
                    <run-dependency>
83
                        <specification-version>1.25</specification-version>
83
                        <specification-version>1.26</specification-version>
84
                    </run-dependency>
84
                    </run-dependency>
85
                </dependency>
85
                </dependency>
86
                <dependency>
86
                <dependency>
(-)a/cnd.makeproject/src/org/netbeans/modules/cnd/makeproject/MakeActionProvider.java (-3 / +1 lines)
Lines 44-50 Link Here
44
package org.netbeans.modules.cnd.makeproject;
44
package org.netbeans.modules.cnd.makeproject;
45
45
46
import java.awt.Dialog;
46
import java.awt.Dialog;
47
import java.awt.Frame;
48
import java.awt.event.ActionListener;
47
import java.awt.event.ActionListener;
49
import java.io.File;
48
import java.io.File;
50
import java.io.IOException;
49
import java.io.IOException;
Lines 422-431 Link Here
422
                }
421
                }
423
            };
422
            };
424
        }
423
        }
425
        Frame mainWindow = WindowManager.getDefault().getMainWindow();
426
        String msg = NbBundle.getMessage(MakeActionProvider.class, "MSG_Validate_Host", record.getDisplayName());
424
        String msg = NbBundle.getMessage(MakeActionProvider.class, "MSG_Validate_Host", record.getDisplayName());
427
        String title = NbBundle.getMessage(MakeActionProvider.class, "DLG_TITLE_Validate_Host");
425
        String title = NbBundle.getMessage(MakeActionProvider.class, "DLG_TITLE_Validate_Host");
428
        ModalMessageDlg.runLongTask(mainWindow, wrapper, null, wrapper, title, msg);
426
        ModalMessageDlg.runLongTask(wrapper, null, wrapper, title, msg);
429
    }
427
    }
430
428
431
    private void addAction(ArrayList<ProjectActionEvent> actionEvents,
429
    private void addAction(ArrayList<ProjectActionEvent> actionEvents,
(-)a/cnd.makeproject/src/org/netbeans/modules/cnd/makeproject/actions/AddExistingFolderItemsAction.java (-2 lines)
Lines 64-70 Link Here
64
import org.openide.util.HelpCtx;
64
import org.openide.util.HelpCtx;
65
import org.openide.util.NbBundle;
65
import org.openide.util.NbBundle;
66
import org.openide.util.actions.NodeAction;
66
import org.openide.util.actions.NodeAction;
67
import org.openide.windows.WindowManager;
68
67
69
public final class AddExistingFolderItemsAction extends NodeAction {
68
public final class AddExistingFolderItemsAction extends NodeAction {
70
69
Lines 163-169 Link Here
163
                    sourceFilesPanel.getSourceListData(),
162
                    sourceFilesPanel.getSourceListData(),
164
                    sourceFilesPanel.getFileFilter());
163
                    sourceFilesPanel.getFileFilter());
165
            ModalMessageDlg.runLongTask(
164
            ModalMessageDlg.runLongTask(
166
                    WindowManager.getDefault().getMainWindow(),
167
                    task, null, null,
165
                    task, null, null,
168
                    getString("AddingFilesDialogTitle"), // NOI18N
166
                    getString("AddingFilesDialogTitle"), // NOI18N
169
                    getString("AddingFilesDialogText")); // NOI18N
167
                    getString("AddingFilesDialogText")); // NOI18N
(-)a/cnd.makeproject/src/org/netbeans/modules/cnd/makeproject/api/configurations/MakeConfigurationDescriptor.java (-1 lines)
Lines 1042-1048 Link Here
1042
        SaveRunnable saveRunnable = new SaveRunnable(extraMessage);
1042
        SaveRunnable saveRunnable = new SaveRunnable(extraMessage);
1043
        if (SwingUtilities.isEventDispatchThread() && WindowManager.getDefault().getMainWindow().isVisible()) {
1043
        if (SwingUtilities.isEventDispatchThread() && WindowManager.getDefault().getMainWindow().isVisible()) {
1044
            ModalMessageDlg.runLongTask(
1044
            ModalMessageDlg.runLongTask(
1045
                    WindowManager.getDefault().getMainWindow(),
1046
                    saveRunnable, null, null,
1045
                    saveRunnable, null, null,
1047
                    getString("MakeConfigurationDescriptor.SaveConfigurationTitle"), // NOI18N
1046
                    getString("MakeConfigurationDescriptor.SaveConfigurationTitle"), // NOI18N
1048
                    getString("MakeConfigurationDescriptor.SaveConfigurationText")); // NOI18N
1047
                    getString("MakeConfigurationDescriptor.SaveConfigurationText")); // NOI18N
(-)a/cnd.toolchain/nbproject/project.xml (-1 / +1 lines)
Lines 53-59 Link Here
53
                    <build-prerequisite/>
53
                    <build-prerequisite/>
54
                    <compile-dependency/>
54
                    <compile-dependency/>
55
                    <run-dependency>
55
                    <run-dependency>
56
                        <specification-version>1.6</specification-version>
56
                        <specification-version>1.26</specification-version>
57
                    </run-dependency>
57
                    </run-dependency>
58
                </dependency>
58
                </dependency>
59
                <dependency>
59
                <dependency>
(-)a/cnd.toolchain/src/org/netbeans/modules/cnd/api/toolchain/ui/ToolsPanelSupport.java (-2 lines)
Lines 65-71 Link Here
65
import org.openide.util.NbBundle;
65
import org.openide.util.NbBundle;
66
import org.openide.util.RequestProcessor;
66
import org.openide.util.RequestProcessor;
67
import org.openide.util.WeakSet;
67
import org.openide.util.WeakSet;
68
import org.openide.windows.WindowManager;
69
68
70
/**
69
/**
71
 *
70
 *
Lines 312-318 Link Here
312
        };
311
        };
313
        if (SwingUtilities.isEventDispatchThread()) {
312
        if (SwingUtilities.isEventDispatchThread()) {
314
            ModalMessageDlg.runLongTask(
313
            ModalMessageDlg.runLongTask(
315
                    WindowManager.getDefault().getMainWindow(),
316
                    runnable, null, null,
314
                    runnable, null, null,
317
                    NbBundle.getMessage(ToolsPanelSupport.class, "RestoringToolchainsTitle"), // NOI18N
315
                    NbBundle.getMessage(ToolsPanelSupport.class, "RestoringToolchainsTitle"), // NOI18N
318
                    NbBundle.getMessage(ToolsPanelSupport.class, "RestoringToolchainsMessage")); // NOI18N
316
                    NbBundle.getMessage(ToolsPanelSupport.class, "RestoringToolchainsMessage")); // NOI18N
(-)a/cnd.toolchain/src/org/netbeans/modules/cnd/toolchain/ui/options/ToolsCacheManagerImpl.java (-5 / +1 lines)
Lines 41-47 Link Here
41
 */
41
 */
42
package org.netbeans.modules.cnd.toolchain.ui.options;
42
package org.netbeans.modules.cnd.toolchain.ui.options;
43
43
44
import java.awt.Frame;
45
import java.util.ArrayList;
44
import java.util.ArrayList;
46
import java.util.Collection;
45
import java.util.Collection;
47
import java.util.HashMap;
46
import java.util.HashMap;
Lines 66-74 Link Here
66
import org.netbeans.modules.nativeexecution.api.ExecutionEnvironmentFactory;
65
import org.netbeans.modules.nativeexecution.api.ExecutionEnvironmentFactory;
67
import org.netbeans.modules.nativeexecution.api.util.WindowsSupport;
66
import org.netbeans.modules.nativeexecution.api.util.WindowsSupport;
68
import org.openide.util.Cancellable;
67
import org.openide.util.Cancellable;
69
import org.openide.util.Exceptions;
70
import org.openide.util.NbBundle;
68
import org.openide.util.NbBundle;
71
import org.openide.windows.WindowManager;
72
69
73
/**
70
/**
74
 *
71
 *
Lines 266-275 Link Here
266
            }
263
            }
267
        };
264
        };
268
        if (SwingUtilities.isEventDispatchThread()) {
265
        if (SwingUtilities.isEventDispatchThread()) {
269
            Frame mainWindow = WindowManager.getDefault().getMainWindow();
270
            String title = NbBundle.getMessage(ToolsCacheManagerImpl.class, "DLG_TITLE_ApplyChanges"); // NOI18N
266
            String title = NbBundle.getMessage(ToolsCacheManagerImpl.class, "DLG_TITLE_ApplyChanges"); // NOI18N
271
            String msg = NbBundle.getMessage(ToolsCacheManagerImpl.class, "MSG_TITLE_ApplyChanges"); // NOI18N
267
            String msg = NbBundle.getMessage(ToolsCacheManagerImpl.class, "MSG_TITLE_ApplyChanges"); // NOI18N
272
            ModalMessageDlg.runLongTask(mainWindow, title, msg, runner, null);
268
            ModalMessageDlg.runLongTask(runner, null, title, msg);
273
        } else {
269
        } else {
274
            runner.doWork();
270
            runner.doWork();
275
            runner.doPostRunInEDT();
271
            runner.doPostRunInEDT();
(-)a/cnd.utils/nbproject/project.properties (-1 / +1 lines)
Lines 1-6 Link Here
1
javac.compilerargs=-Xlint -Xlint:-serial
1
javac.compilerargs=-Xlint -Xlint:-serial
2
javac.source=1.6
2
javac.source=1.6
3
spec.version.base=1.25
3
spec.version.base=1.26
4
4
5
test.config.stableBTD.includes=**/*Test.class
5
test.config.stableBTD.includes=**/*Test.class
6
test.config.stableBTD.excludes=\
6
test.config.stableBTD.excludes=\
(-)a/cnd.utils/nbproject/project.xml (+9 lines)
Lines 6-11 Link Here
6
            <code-name-base>org.netbeans.modules.cnd.utils</code-name-base>
6
            <code-name-base>org.netbeans.modules.cnd.utils</code-name-base>
7
            <module-dependencies>
7
            <module-dependencies>
8
                <dependency>
8
                <dependency>
9
                    <code-name-base>org.netbeans.api.progress</code-name-base>
10
                    <build-prerequisite/>
11
                    <compile-dependency/>
12
                    <run-dependency>
13
                        <release-version>1</release-version>
14
                        <specification-version>1.32</specification-version>
15
                    </run-dependency>
16
                </dependency>
17
                <dependency>
9
                    <code-name-base>org.netbeans.modules.dlight.libs.common</code-name-base>
18
                    <code-name-base>org.netbeans.modules.dlight.libs.common</code-name-base>
10
                    <build-prerequisite/>
19
                    <build-prerequisite/>
11
                    <compile-dependency/>
20
                    <compile-dependency/>
(-)a/cnd.utils/src/org/netbeans/modules/cnd/utils/ui/ModalMessageDlg.java (-183 / +132 lines)
Lines 43-274 Link Here
43
 */
43
 */
44
package org.netbeans.modules.cnd.utils.ui;
44
package org.netbeans.modules.cnd.utils.ui;
45
45
46
import java.awt.Dialog;
46
import java.util.concurrent.ExecutionException;
47
import java.awt.Dimension;
47
import java.util.concurrent.Future;
48
import java.awt.Frame;
49
import java.awt.Rectangle;
50
import java.awt.Toolkit;
51
import java.awt.Window;
52
import java.awt.event.WindowAdapter;
53
import java.awt.event.WindowEvent;
54
import java.util.concurrent.atomic.AtomicBoolean;
48
import java.util.concurrent.atomic.AtomicBoolean;
55
import javax.swing.JDialog;
56
import javax.swing.JPanel;
57
import javax.swing.SwingUtilities;
49
import javax.swing.SwingUtilities;
50
import org.netbeans.api.progress.ProgressHandle;
51
import org.netbeans.api.progress.ProgressRunnable;
52
import org.netbeans.api.progress.ProgressUtils;
58
import org.netbeans.modules.cnd.utils.CndUtils;
53
import org.netbeans.modules.cnd.utils.CndUtils;
59
import org.netbeans.modules.cnd.utils.NamedRunnable;
54
import org.netbeans.modules.cnd.utils.NamedRunnable;
60
import org.openide.util.Cancellable;
55
import org.openide.util.Cancellable;
56
import org.openide.util.Exceptions;
61
import org.openide.util.RequestProcessor;
57
import org.openide.util.RequestProcessor;
62
import org.openide.util.RequestProcessor.Task;
63
58
64
/**
59
/**
60
 * Utility class for displaying a modal Dialog (effectively blocking (but not
61
 * freezing) UI) while running a task in background.
62
 *
63
 * Current implementation uses org.netbeans.api.progress.ProgressUtils.
65
 *
64
 *
66
 * @author Vladimir Voskresensky
65
 * @author Vladimir Voskresensky
67
 */
66
 */
68
public class ModalMessageDlg extends javax.swing.JPanel {
67
public final class ModalMessageDlg {
69
    private static final RequestProcessor RP = new RequestProcessor(ModalMessageDlg.class.getName(), 4);
70
68
71
    /**
69
    public interface LongWorker {
72
     * allows to display modal dialog with title and message for the period of
70
73
     * long task run
71
        void doWork();
74
     * @param parent parent frame or dialog
72
75
     * @param workTask non EDT task to run
73
        void doPostRunInEDT();
76
     * @param postEDTTask EDT task to run after closing modal dialog (can be null)
77
     * @param title title of dialog
78
     * @param message message in dialog
79
     * @return
80
     */
81
    public static void runLongTask(Dialog parent,
82
            final Runnable workTask, final Runnable postEDTTask, final Cancellable canceller,
83
            String title, String message) {
84
        runLongTaskImpl(parent, workTask, postEDTTask, title, message, canceller);
85
    }
74
    }
86
75
87
    public static void runLongTask(Frame parent,
76
    private ModalMessageDlg() {
88
            final Runnable workTask, final Runnable postEDTTask, final Cancellable canceller,
89
            String title, String message) {
90
        runLongTaskImpl(parent, workTask, postEDTTask, title, message, canceller);
91
    }
77
    }
92
78
93
    /**
79
    /**
80
     * Show a modal progress dialog that blocks the main window, while running
81
     * the passed runnable on a background thread.
94
     *
82
     *
95
     * @param parent
83
     * <p> This method is thread-safe, and will block until the operation has
96
     * @param title
84
     * completed, regardless of what thread calls this method. </p>
97
     * @param message
85
     *
98
     * @param workTask if workTask is Cancellable => dialog will have Cancel button
86
     * @param workTask a Runnable to start in non-EDT thread. Unlike
99
     *                 if not => no Cancel button is shown
87
     * {@link ProgressUtils}'s operation this argument is never tested for the
88
     * {@link Cancellable} interface. Use <b>canceller</b> for the task
89
     * interruption facility.
90
     * @param postEDTTask a task to run in the EDT after the <b>workTask</b> is
91
     * processed. <code>null</code> is allowed. <b>NB:</b> The postEDTTask is
92
     * called either if this method is invoked from tests or if <b>workTask</b>
93
     * was <b>not cancelled</b> by pressing the cancel button.
94
     * @param canceller if not <code>null</code> a cancel button is displayed
95
     * while <b>workTask</b> is running. <br/> Note that once the cancel button
96
     * is pressed, no <b>postEDTTask</b> will be called.
97
     * @param title title of a dialog. If <b>message</b> is not null,
98
     * <b>title</b> is <b>not used</b>.
99
     * @param message message to display. Could be <code>null</code>. In this
100
     * case <b>title</b> is used.
101
     *
100
     */
102
     */
101
    public static void runLongTask(Window parent, String title, String message,
103
    public static void runLongTask(final Runnable workTask, final Runnable postEDTTask, final Cancellable canceller,
102
            final LongWorker workTask, final Cancellable canceller) {
104
            final String title, final String message) {
103
105
104
        final JDialog dialog = createDialog(parent, title);
106
        if (invokedFromTests()) {
107
            // The code below is just to preserve the behaviour as it was
108
            // before switchig to the ProgressUtils...
109
            Future<?> task = RequestProcessor.getDefault().submit(new NamedRunnable(title) {
110
                @Override
111
                protected void runImpl() {
112
                    workTask.run();
113
                }
114
            });
115
            try {
116
                task.get();
117
            } catch (InterruptedException ex) {
118
                Exceptions.printStackTrace(ex);
119
            } catch (ExecutionException ex) {
120
                Exceptions.printStackTrace(ex);
121
            }
122
            if (postEDTTask != null) {
123
                SwingUtilities.invokeLater(postEDTTask);
124
            }
125
        } else {
126
            final MyRP r;
105
127
106
        final Runnable finalizer = new Runnable() {
128
            if (canceller != null) {
107
            @Override
129
                r = new MyCRP(workTask, canceller, message);
108
            public void run() {
130
            } else {
109
                // hide dialog and run action if successfully connected
131
                r = new MyRP(workTask, message);
110
                dialog.setVisible(false);
111
                dialog.dispose();
112
                workTask.doPostRunInEDT();
113
            }
132
            }
114
        };
115
133
116
        JPanel panel;
134
            ProgressUtils.showProgressDialogAndRun(r, title, true);
117
        if (canceller == null) {
118
            panel = new ModalMessageDlgPane(message);
119
        } else {
120
            Cancellable wrapper = new Cancellable() {
121
                /** is invoked from a separate cancellation thread */
122
                @Override
123
                public boolean cancel() {
124
                    if (canceller.cancel()) {
125
                        // remember for return value
126
                        return true;
127
                    } else {
128
                        return false;
129
                    }
130
                }
131
            };
132
            panel = new ModalMessageDlgCancellablePane(message, wrapper);
133
        }
134
        addPanel(parent, dialog, panel);
135
135
136
        RP.post(new NamedRunnable(title) {
136
            if (postEDTTask != null && !r.wasCancelled()) {
137
            @Override
137
                SwingUtilities.invokeLater(workTask);
138
            public void runImpl() {
139
                try {
140
                    workTask.doWork();
141
                } finally {
142
                    SwingUtilities.invokeLater(finalizer);
143
                }
144
            }
138
            }
145
        });
146
        if (!CndUtils.isStandalone()) { // this means we run in tests
147
            dialog.setVisible(true);
148
        }
139
        }
149
    }
140
    }
150
141
151
    private static boolean runLongTaskImpl(Window parent, final Runnable workTask, final Runnable postEDTTask,
142
    /**
152
            final String title, String message, final Cancellable canceller) {
143
     * Show a modal progress dialog that blocks the main window, while running
153
144
     * the passed runnable on a background thread.
154
        final JDialog dialog = createDialog(parent, title);
145
     *
155
        final AtomicBoolean cancelled = new AtomicBoolean(false);
146
     * <p> This is almost the same as runLongTask(Dialog, Runnable, Runnable,
156
147
     * Cancellable, String, String), but has one significant difference! </p>
157
        final Runnable finalizer = new Runnable() {
148
     *
149
     * <p>Not only it uses a {@link LongWorker} instead of two
150
     * {@link Runnable}s, but also the {@link LongWorker#doPostRunInEDT()} is
151
     * invoked disregarding the cancellation status.</p>
152
     *
153
     * @see #runLongTask(java.lang.Runnable, java.lang.Runnable, org.openide.util.Cancellable, java.lang.String, java.lang.String) 
154
     */
155
    public static void runLongTask(final LongWorker workTask, final Cancellable canceller,
156
            final String title, final String message) {
157
        runLongTask(new Runnable() {
158
            @Override
158
            @Override
159
            public void run() {
159
            public void run() {
160
                // hide dialog and run action if successfully connected
160
                workTask.doWork();
161
                dialog.setVisible(false);
162
                dialog.dispose();
163
                if (postEDTTask != null && ! cancelled.get()) {
164
                    postEDTTask.run();
165
                }
166
            }
161
            }
167
        };
162
        }, new Runnable(){
168
163
            @Override
169
        JPanel panel;
164
            public void run() {
170
        if (canceller == null) {
165
                workTask.doPostRunInEDT();
171
            panel = new ModalMessageDlgPane(message);
166
            }
172
        } else {
167
        }, canceller, title, message);
173
            Cancellable wrapper = new Cancellable() {
174
                /** is invoked from a separate cancellation thread */
175
                @Override
176
                public boolean cancel() {
177
                    if (canceller.cancel()) {
178
                        cancelled.set(true);
179
                        SwingUtilities.invokeLater(finalizer);
180
                        return true;
181
                    } else {
182
                        return false;
183
                    }
184
                }
185
            };
186
            panel = new ModalMessageDlgCancellablePane(message, wrapper);
187
        }
188
        addPanel(parent, dialog, panel);
189
190
        final WindowAdapterImpl windowAdapterImpl = new WindowAdapterImpl(dialog, title, workTask, finalizer);
191
192
        if (CndUtils.isStandalone()) { // this means we run in tests
193
            Task task = windowAdapterImpl.submitJob();
194
            task.waitFinished();
195
        } else {
196
            dialog.addWindowListener(windowAdapterImpl);
197
            dialog.setVisible(true);
198
        }
199
        
200
        return !cancelled.get();
201
    }
168
    }
202
169
203
    private static JDialog createDialog(Window parent, String title) {
170
    private static boolean invokedFromTests() {
204
        JDialog dialog;
171
        return CndUtils.isStandalone();
205
        if (parent == null) {
206
            dialog = new JDialog();
207
        } else if (parent instanceof Frame) {
208
            dialog = new JDialog((Frame)parent);
209
        } else {
210
            assert (parent instanceof Dialog);
211
            dialog = new JDialog((Dialog)parent);
212
        }
213
        dialog.setTitle(title);
214
        dialog.setModal(true);
215
        return dialog;
216
    }
172
    }
217
173
218
    private static void addPanel(Window parent, JDialog dialog, JPanel panel){
174
    private static class MyRP implements ProgressRunnable<Void> {
219
        dialog.getContentPane().add(panel);
220
        dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); //make sure the dialog is not closed during the project open
221
        dialog.pack();
222
175
223
        Rectangle bounds = (parent == null) ?
176
        private final Runnable task;
224
            new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()) : parent.getBounds();
177
        private final String message;
225
178
226
        int middleX = bounds.x + bounds.width / 2;
179
        public MyRP(final Runnable task, final String message) {
227
        int middleY = bounds.y + bounds.height / 2;
180
            this.task = task;
228
181
            this.message = message;
229
        Dimension size = dialog.getPreferredSize();
230
231
        dialog.setBounds(middleX - size.width / 2, middleY - size.height / 2, size.width, size.height);
232
    }
233
234
    public interface LongWorker {
235
        void doWork();
236
        void doPostRunInEDT();
237
    }
238
239
    private static class WindowAdapterImpl extends WindowAdapter {
240
241
        private final String title;
242
        private final Runnable workTask;
243
        private final Runnable finalizer;
244
        private final JDialog dialog;
245
        
246
        public WindowAdapterImpl(JDialog dialog, String title, Runnable workTask, Runnable finalizer) {
247
            this.title = title;
248
            this.workTask = workTask;
249
            this.finalizer = finalizer;
250
            this.dialog = dialog;
251
        }
182
        }
252
183
253
        @Override
184
        @Override
254
        public void windowOpened(WindowEvent e) {
185
        public Void run(final ProgressHandle handle) {
255
            dialog.removeWindowListener(this);
186
            if (message != null) {
256
            submitJob();
187
                handle.setDisplayName(message);
188
            }
189
            task.run();
190
            return null;
257
        }
191
        }
258
192
259
        private Task submitJob() {
193
        public boolean wasCancelled() {
260
            Task task = RP.post(new NamedRunnable(title) {
194
            return false;
195
        }
196
    }
261
197
262
                @Override
198
    private static final class MyCRP extends MyRP implements Cancellable {
263
                public void runImpl() {
199
264
                    try {
200
        private final Cancellable canceller;
265
                        workTask.run();
201
        private final AtomicBoolean wasCancelled = new AtomicBoolean(false);
266
                    } finally {
202
267
                        SwingUtilities.invokeLater(finalizer);
203
        public MyCRP(final Runnable task, final Cancellable canceller, final String message) {
268
                    }
204
            super(task, message);
269
                }
205
            this.canceller = canceller;
270
            });
206
        }
271
            return task;
207
208
        @Override
209
        public boolean cancel() {
210
            if(canceller.cancel()) {
211
                wasCancelled.set(true);
212
                return true;
213
            } else {
214
                return false;
215
            }
216
        }
217
218
        @Override
219
        public boolean wasCancelled() {
220
            return wasCancelled.get();
272
        }
221
        }
273
    }
222
    }
274
}
223
}
(-)a/cnd.utils/src/org/netbeans/modules/cnd/utils/ui/ModalMessageDlgCancellablePane.form (-60 lines)
Lines 1-60 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
2
3
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <AuxValues>
5
    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
6
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
7
    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
8
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
9
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
10
    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
11
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
12
    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
13
    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
14
  </AuxValues>
15
16
  <Layout>
17
    <DimensionLayout dim="0">
18
      <Group type="103" groupAlignment="0" attributes="0">
19
          <Group type="102" attributes="0">
20
              <EmptySpace max="-2" attributes="0"/>
21
              <Group type="103" groupAlignment="0" attributes="0">
22
                  <Group type="102" attributes="0">
23
                      <Component id="lblMessage" pref="350" max="32767" attributes="0"/>
24
                      <EmptySpace max="-2" attributes="0"/>
25
                  </Group>
26
                  <Group type="102" alignment="1" attributes="0">
27
                      <Component id="btnCancel" min="-2" max="-2" attributes="0"/>
28
                      <EmptySpace min="-2" pref="136" max="-2" attributes="0"/>
29
                  </Group>
30
              </Group>
31
          </Group>
32
      </Group>
33
    </DimensionLayout>
34
    <DimensionLayout dim="1">
35
      <Group type="103" groupAlignment="0" attributes="0">
36
          <Group type="102" alignment="1" attributes="0">
37
              <EmptySpace pref="20" max="32767" attributes="0"/>
38
              <Component id="lblMessage" min="-2" max="-2" attributes="0"/>
39
              <EmptySpace type="separate" max="-2" attributes="0"/>
40
              <Component id="btnCancel" min="-2" max="-2" attributes="0"/>
41
              <EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
42
          </Group>
43
      </Group>
44
    </DimensionLayout>
45
  </Layout>
46
  <SubComponents>
47
    <Component class="javax.swing.JLabel" name="lblMessage">
48
    </Component>
49
    <Component class="javax.swing.JButton" name="btnCancel">
50
      <Properties>
51
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
52
          <ResourceString bundle="org/netbeans/modules/cnd/utils/ui/Bundle.properties" key="ModalMessageDlgCancellablePane.btnCancel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
53
        </Property>
54
      </Properties>
55
      <Events>
56
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnCancelActionPerformed"/>
57
      </Events>
58
    </Component>
59
  </SubComponents>
60
</Form>
(-)a/cnd.utils/src/org/netbeans/modules/cnd/utils/ui/ModalMessageDlgCancellablePane.java (-137 lines)
Lines 1-137 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 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
 * Contributor(s):
28
 *
29
 * The Original Software is NetBeans. The Initial Developer of the Original
30
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2008 Sun
31
 * Microsystems, Inc. All Rights Reserved.
32
 *
33
 * If you wish your version of this file to be governed by only the CDDL
34
 * or only the GPL Version 2, indicate your decision by adding
35
 * "[Contributor] elects to include this software in this distribution
36
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
37
 * single choice of license, a recipient has the option to distribute
38
 * your version of this file under either the CDDL, the GPL Version 2 or
39
 * to extend the choice of license to its licensees as provided above.
40
 * However, if you add GPL Version 2 code and therefore, elected the GPL
41
 * Version 2 license, then the option applies only if the new code is
42
 * made subject to such option by the copyright holder.
43
 */
44
package org.netbeans.modules.cnd.utils.ui;
45
46
import javax.swing.SwingUtilities;
47
import org.openide.util.Cancellable;
48
import org.openide.util.NbBundle;
49
50
/**
51
 *
52
 * @author Vladimir Voskresensky
53
 */
54
/* package-local */
55
class ModalMessageDlgCancellablePane extends javax.swing.JPanel {
56
57
    private final Cancellable cancellable;
58
    private final String message;
59
60
    /** Creates new form ModalMessageDlg */
61
    /* package-local*/
62
    ModalMessageDlgCancellablePane(String message, Cancellable cancellable) {
63
        this.cancellable = cancellable;
64
        this.message = message;
65
        initComponents();
66
        lblMessage.setText(message);
67
    }
68
69
    /** This method is called from within the constructor to
70
     * initialize the form.
71
     * WARNING: Do NOT modify this code. The content of this method is
72
     * always regenerated by the Form Editor.
73
     */
74
    @SuppressWarnings("unchecked")
75
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
76
    private void initComponents() {
77
78
        lblMessage = new javax.swing.JLabel();
79
        btnCancel = new javax.swing.JButton();
80
81
        btnCancel.setText(org.openide.util.NbBundle.getMessage(ModalMessageDlgCancellablePane.class, "ModalMessageDlgCancellablePane.btnCancel.text")); // NOI18N
82
        btnCancel.addActionListener(new java.awt.event.ActionListener() {
83
            public void actionPerformed(java.awt.event.ActionEvent evt) {
84
                btnCancelActionPerformed(evt);
85
            }
86
        });
87
88
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
89
        this.setLayout(layout);
90
        layout.setHorizontalGroup(
91
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
92
            .addGroup(layout.createSequentialGroup()
93
                .addContainerGap()
94
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
95
                    .addGroup(layout.createSequentialGroup()
96
                        .addComponent(lblMessage, javax.swing.GroupLayout.DEFAULT_SIZE, 350, Short.MAX_VALUE)
97
                        .addContainerGap())
98
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
99
                        .addComponent(btnCancel)
100
                        .addGap(136, 136, 136))))
101
        );
102
        layout.setVerticalGroup(
103
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
104
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
105
                .addContainerGap(20, Short.MAX_VALUE)
106
                .addComponent(lblMessage)
107
                .addGap(18, 18, 18)
108
                .addComponent(btnCancel)
109
                .addGap(6, 6, 6))
110
        );
111
    }// </editor-fold>//GEN-END:initComponents
112
113
    private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed
114
        lblMessage.setText(NbBundle.getMessage(getClass(), "MSG_Cancelling"));
115
        btnCancel.setEnabled(false);
116
        Thread thread = new Thread(new Runnable() {
117
            @Override
118
            public void run() {
119
                if (!cancellable.cancel()) {
120
                    SwingUtilities.invokeLater(new Runnable() {
121
                        @Override
122
                        public void run() {
123
                            if (ModalMessageDlgCancellablePane.this.isVisible()) {
124
                                lblMessage.setText(NbBundle.getMessage(getClass(), "MSG_CancelFailed", message));
125
                            }
126
                        }
127
                    });
128
                }
129
            }
130
        }, ModalMessageDlg.class.getSimpleName() + " cancellation thread"); //NOI18N
131
        thread.start();
132
}//GEN-LAST:event_btnCancelActionPerformed
133
    // Variables declaration - do not modify//GEN-BEGIN:variables
134
    private javax.swing.JButton btnCancel;
135
    private javax.swing.JLabel lblMessage;
136
    // End of variables declaration//GEN-END:variables
137
}
(-)a/cnd.utils/src/org/netbeans/modules/cnd/utils/ui/ModalMessageDlgPane.form (-40 lines)
Lines 1-40 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
2
3
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <AuxValues>
5
    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
6
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
7
    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
8
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
9
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
10
    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
11
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
12
    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
13
    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
14
  </AuxValues>
15
16
  <Layout>
17
    <DimensionLayout dim="0">
18
      <Group type="103" groupAlignment="0" attributes="0">
19
          <Group type="102" alignment="0" attributes="0">
20
              <EmptySpace max="-2" attributes="0"/>
21
              <Component id="lblMessage" pref="350" max="32767" attributes="0"/>
22
              <EmptySpace max="-2" attributes="0"/>
23
          </Group>
24
      </Group>
25
    </DimensionLayout>
26
    <DimensionLayout dim="1">
27
      <Group type="103" groupAlignment="0" attributes="0">
28
          <Group type="102" alignment="1" attributes="0">
29
              <EmptySpace pref="28" max="32767" attributes="0"/>
30
              <Component id="lblMessage" min="-2" max="-2" attributes="0"/>
31
              <EmptySpace max="-2" attributes="0"/>
32
          </Group>
33
      </Group>
34
    </DimensionLayout>
35
  </Layout>
36
  <SubComponents>
37
    <Component class="javax.swing.JLabel" name="lblMessage">
38
    </Component>
39
  </SubComponents>
40
</Form>
(-)a/cnd.utils/src/org/netbeans/modules/cnd/utils/ui/ModalMessageDlgPane.java (-94 lines)
Lines 1-94 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 1997-2010 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
 * Contributor(s):
28
 *
29
 * The Original Software is NetBeans. The Initial Developer of the Original
30
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2008 Sun
31
 * Microsystems, Inc. All Rights Reserved.
32
 *
33
 * If you wish your version of this file to be governed by only the CDDL
34
 * or only the GPL Version 2, indicate your decision by adding
35
 * "[Contributor] elects to include this software in this distribution
36
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
37
 * single choice of license, a recipient has the option to distribute
38
 * your version of this file under either the CDDL, the GPL Version 2 or
39
 * to extend the choice of license to its licensees as provided above.
40
 * However, if you add GPL Version 2 code and therefore, elected the GPL
41
 * Version 2 license, then the option applies only if the new code is
42
 * made subject to such option by the copyright holder.
43
 */
44
package org.netbeans.modules.cnd.utils.ui;
45
46
/**
47
 *
48
 * @author Vladimir Voskresensky
49
 */
50
/* package-local */
51
class ModalMessageDlgPane extends javax.swing.JPanel {
52
53
    /** Creates new form ModalMessageDlg */
54
    /* package-local*/
55
    ModalMessageDlgPane(String message) {
56
        initComponents();
57
        lblMessage.setText(message);
58
    }
59
60
    /** This method is called from within the constructor to
61
     * initialize the form.
62
     * WARNING: Do NOT modify this code. The content of this method is
63
     * always regenerated by the Form Editor.
64
     */
65
    @SuppressWarnings("unchecked")
66
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
67
    private void initComponents() {
68
69
        lblMessage = new javax.swing.JLabel();
70
71
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
72
        this.setLayout(layout);
73
        layout.setHorizontalGroup(
74
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
75
            .addGroup(layout.createSequentialGroup()
76
                .addContainerGap()
77
                .addComponent(lblMessage, javax.swing.GroupLayout.DEFAULT_SIZE, 350, Short.MAX_VALUE)
78
                .addContainerGap())
79
        );
80
        layout.setVerticalGroup(
81
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
82
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
83
                .addContainerGap(28, Short.MAX_VALUE)
84
                .addComponent(lblMessage)
85
                .addContainerGap())
86
        );
87
    }// </editor-fold>//GEN-END:initComponents
88
89
90
    // Variables declaration - do not modify//GEN-BEGIN:variables
91
    private javax.swing.JLabel lblMessage;
92
    // End of variables declaration//GEN-END:variables
93
94
}
(-)a/cnd.utils/test/unit/src/org/netbeans/modules/cnd/utils/ui/ModalMessageDlgTestCase.java (-19 / +35 lines)
Lines 42-53 Link Here
42
42
43
package org.netbeans.modules.cnd.utils.ui;
43
package org.netbeans.modules.cnd.utils.ui;
44
44
45
import java.awt.Dialog;
45
import java.util.concurrent.atomic.AtomicBoolean;
46
import org.junit.AfterClass;
46
import org.junit.AfterClass;
47
import org.junit.BeforeClass;
47
import org.junit.BeforeClass;
48
import org.junit.Test;
48
import org.junit.Test;
49
import org.openide.util.Cancellable;
49
import org.openide.util.Cancellable;
50
import org.openide.util.Exceptions;
50
import org.openide.util.Exceptions;
51
import org.openide.util.RequestProcessor;
51
52
52
/**
53
/**
53
 *
54
 *
Lines 55-75 Link Here
55
 */
56
 */
56
public class ModalMessageDlgTestCase {
57
public class ModalMessageDlgTestCase {
57
58
58
    private Runnable runner = new Runnable() {
59
        @Override
60
        public void run() {
61
            int cycle = 0;
62
            while (true) {
63
                try {
64
                    Thread.sleep(1000);
65
                } catch (InterruptedException ex) {
66
                    Exceptions.printStackTrace(ex);
67
                }
68
                System.err.printf("Running %d\n", cycle++);
69
            }
70
        }
71
    };
72
73
    public ModalMessageDlgTestCase() {
59
    public ModalMessageDlgTestCase() {
74
    }
60
    }
75
61
Lines 83-100 Link Here
83
69
84
    @Test
70
    @Test
85
    public void testRunLongTask() {
71
    public void testRunLongTask() {
86
        Dialog parent = null;
87
        Runnable postEDTTask = null;
72
        Runnable postEDTTask = null;
88
        Cancellable canceller = new Cancellable() {
73
        final AtomicBoolean wasCanceled = new AtomicBoolean(false);
74
        final Cancellable canceller = new Cancellable() {
89
            @Override
75
            @Override
90
            public boolean cancel() {
76
            public boolean cancel() {
91
                System.err.printf("CANCELLER\n");
77
                System.err.printf("CANCELLER\n");
78
                wasCanceled.set(true);
92
                return true;
79
                return true;
93
            }
80
            }
94
81
95
        };
82
        };
83
        Runnable runner = new Runnable() {
84
            @Override
85
            public void run() {
86
                int cycle = 0;
87
                while (true) {
88
                    if (wasCanceled.get()) {
89
                        return;
90
                    }
91
                    System.err.printf("Running %d\n", cycle++);
92
                    try {
93
                        Thread.sleep(1000);
94
                    } catch (InterruptedException ex) {
95
                        Exceptions.printStackTrace(ex);
96
                    }
97
                }
98
            }
99
        };
100
        
101
        RequestProcessor.getDefault().post(new Runnable() {
102
103
            @Override
104
            public void run() {
105
                try {
106
                    Thread.sleep(3000);
107
                } catch (InterruptedException ex) {
108
                }
109
                canceller.cancel();
110
            }
111
        });
96
        String title = "Running long task";
112
        String title = "Running long task";
97
        String message = "Running... and running...";
113
        String message = "Running... and running...";
98
        ModalMessageDlg.runLongTask(parent, runner, postEDTTask, canceller, title, message);
114
        ModalMessageDlg.runLongTask(runner, postEDTTask, canceller, title, message);
99
    }
115
    }
100
}
116
}
(-)a/cnd/nbproject/project.xml (-1 / +1 lines)
Lines 62-68 Link Here
62
                    <build-prerequisite/>
62
                    <build-prerequisite/>
63
                    <compile-dependency/>
63
                    <compile-dependency/>
64
                    <run-dependency>
64
                    <run-dependency>
65
                        <specification-version>1.17.1</specification-version>
65
                        <specification-version>1.26</specification-version>
66
                    </run-dependency>
66
                    </run-dependency>
67
                </dependency>
67
                </dependency>
68
                <dependency>
68
                <dependency>
(-)a/cnd/src/org/netbeans/modules/cnd/actions/CMakeAction.java (-4 / +1 lines)
Lines 42-48 Link Here
42
42
43
package org.netbeans.modules.cnd.actions;
43
package org.netbeans.modules.cnd.actions;
44
44
45
import java.awt.Frame;
46
import java.io.IOException;
45
import java.io.IOException;
47
import java.io.Writer;
46
import java.io.Writer;
48
import java.util.List;
47
import java.util.List;
Lines 71-77 Link Here
71
import org.openide.nodes.Node;
70
import org.openide.nodes.Node;
72
import org.openide.windows.IOProvider;
71
import org.openide.windows.IOProvider;
73
import org.openide.windows.InputOutput;
72
import org.openide.windows.InputOutput;
74
import org.openide.windows.WindowManager;
75
73
76
/**
74
/**
77
 *
75
 *
Lines 115-124 Link Here
115
                    }
113
                    }
116
                }
114
                }
117
            };
115
            };
118
            Frame mainWindow = WindowManager.getDefault().getMainWindow();
119
            String title = getString("DLG_TITLE_Prepare", "cmake"); // NOI18N
116
            String title = getString("DLG_TITLE_Prepare", "cmake"); // NOI18N
120
            String msg = getString("MSG_TITLE_Prepare", "cmake"); // NOI18N
117
            String msg = getString("MSG_TITLE_Prepare", "cmake"); // NOI18N
121
            ModalMessageDlg.runLongTask(mainWindow, title, msg, runner, null);
118
            ModalMessageDlg.runLongTask(runner, null, title, msg);
122
        } else {
119
        } else {
123
            NativeExecutionService es = prepare(node, listener, outputListener, project, inputOutput);
120
            NativeExecutionService es = prepare(node, listener, outputListener, project, inputOutput);
124
            if (es != null) {
121
            if (es != null) {
(-)a/cnd/src/org/netbeans/modules/cnd/actions/CompileAction.java (-11 / +1 lines)
Lines 41-48 Link Here
41
 */
41
 */
42
package org.netbeans.modules.cnd.actions;
42
package org.netbeans.modules.cnd.actions;
43
43
44
import java.awt.Frame;
45
import java.io.File;
46
import java.io.IOException;
44
import java.io.IOException;
47
import java.io.Writer;
45
import java.io.Writer;
48
import java.util.List;
46
import java.util.List;
Lines 64-79 Link Here
64
import org.netbeans.modules.cnd.utils.ui.ModalMessageDlg;
62
import org.netbeans.modules.cnd.utils.ui.ModalMessageDlg;
65
import org.netbeans.modules.nativeexecution.api.ExecutionEnvironment;
63
import org.netbeans.modules.nativeexecution.api.ExecutionEnvironment;
66
import org.netbeans.modules.nativeexecution.api.ExecutionListener;
64
import org.netbeans.modules.nativeexecution.api.ExecutionListener;
67
import org.netbeans.modules.nativeexecution.api.HostInfo;
68
import org.netbeans.modules.nativeexecution.api.NativeProcessBuilder;
65
import org.netbeans.modules.nativeexecution.api.NativeProcessBuilder;
69
import org.netbeans.modules.nativeexecution.api.execution.NativeExecutionDescriptor;
66
import org.netbeans.modules.nativeexecution.api.execution.NativeExecutionDescriptor;
70
import org.netbeans.modules.nativeexecution.api.execution.NativeExecutionService;
67
import org.netbeans.modules.nativeexecution.api.execution.NativeExecutionService;
71
import org.netbeans.modules.nativeexecution.api.execution.PostMessageDisplayer;
68
import org.netbeans.modules.nativeexecution.api.execution.PostMessageDisplayer;
72
import org.netbeans.modules.nativeexecution.api.util.ConnectionManager.CancellationException;
73
import org.netbeans.modules.nativeexecution.api.util.HostInfoUtils;
74
import org.netbeans.modules.nativeexecution.api.util.LinkSupport;
75
import org.netbeans.modules.nativeexecution.api.util.MacroMap;
69
import org.netbeans.modules.nativeexecution.api.util.MacroMap;
76
import org.netbeans.modules.nativeexecution.api.util.WindowsSupport;
77
import org.netbeans.modules.remote.spi.FileSystemProvider;
70
import org.netbeans.modules.remote.spi.FileSystemProvider;
78
import org.netbeans.spi.project.ActionProvider;
71
import org.netbeans.spi.project.ActionProvider;
79
import org.openide.LifecycleManager;
72
import org.openide.LifecycleManager;
Lines 84-95 Link Here
84
import org.openide.filesystems.FileObject;
77
import org.openide.filesystems.FileObject;
85
import org.openide.loaders.DataObject;
78
import org.openide.loaders.DataObject;
86
import org.openide.nodes.Node;
79
import org.openide.nodes.Node;
87
import org.openide.util.Exceptions;
88
import org.openide.util.Utilities;
80
import org.openide.util.Utilities;
89
import org.openide.util.lookup.Lookups;
81
import org.openide.util.lookup.Lookups;
90
import org.openide.windows.IOProvider;
82
import org.openide.windows.IOProvider;
91
import org.openide.windows.InputOutput;
83
import org.openide.windows.InputOutput;
92
import org.openide.windows.WindowManager;
93
84
94
/**
85
/**
95
 * Project less compile action
86
 * Project less compile action
Lines 155-164 Link Here
155
                    }
146
                    }
156
                }
147
                }
157
            };
148
            };
158
            Frame mainWindow = WindowManager.getDefault().getMainWindow();
159
            String title = getString("DLG_TITLE_Prepare",node.getName()); // NOI18N
149
            String title = getString("DLG_TITLE_Prepare",node.getName()); // NOI18N
160
            String msg = getString("MSG_TITLE_Prepare",node.getName()); // NOI18N
150
            String msg = getString("MSG_TITLE_Prepare",node.getName()); // NOI18N
161
            ModalMessageDlg.runLongTask(mainWindow, title, msg, runner, null);
151
            ModalMessageDlg.runLongTask(runner, null, title, msg);
162
        } else {
152
        } else {
163
            NativeExecutionService es = prepare(node, project);
153
            NativeExecutionService es = prepare(node, project);
164
            if (es != null) {
154
            if (es != null) {
(-)a/cnd/src/org/netbeans/modules/cnd/actions/CompileRunActionBase.java (-4 / +1 lines)
Lines 41-47 Link Here
41
 */
41
 */
42
package org.netbeans.modules.cnd.actions;
42
package org.netbeans.modules.cnd.actions;
43
43
44
import java.awt.Frame;
45
import java.io.IOException;
44
import java.io.IOException;
46
import java.io.Writer;
45
import java.io.Writer;
47
import java.util.List;
46
import java.util.List;
Lines 75-81 Link Here
75
import org.openide.nodes.Node;
74
import org.openide.nodes.Node;
76
import org.openide.windows.IOProvider;
75
import org.openide.windows.IOProvider;
77
import org.openide.windows.InputOutput;
76
import org.openide.windows.InputOutput;
78
import org.openide.windows.WindowManager;
79
77
80
/**
78
/**
81
 *
79
 *
Lines 121-130 Link Here
121
                    }
119
                    }
122
                }
120
                }
123
            };
121
            };
124
            Frame mainWindow = WindowManager.getDefault().getMainWindow();
125
            String title = getString("DLG_TITLE_Prepare",node.getName()); // NOI18N
122
            String title = getString("DLG_TITLE_Prepare",node.getName()); // NOI18N
126
            String msg = getString("MSG_TITLE_Prepare",node.getName()); // NOI18N
123
            String msg = getString("MSG_TITLE_Prepare",node.getName()); // NOI18N
127
            ModalMessageDlg.runLongTask(mainWindow, title, msg, runner, null);
124
            ModalMessageDlg.runLongTask(runner, null, title, msg);
128
        } else {
125
        } else {
129
            NativeExecutionService es = prepare(node, project);
126
            NativeExecutionService es = prepare(node, project);
130
            if (es != null) {
127
            if (es != null) {
(-)a/cnd/src/org/netbeans/modules/cnd/actions/MakeBaseAction.java (-4 / +1 lines)
Lines 44-50 Link Here
44
44
45
package org.netbeans.modules.cnd.actions;
45
package org.netbeans.modules.cnd.actions;
46
46
47
import java.awt.Frame;
48
import java.io.IOException;
47
import java.io.IOException;
49
import java.io.Writer;
48
import java.io.Writer;
50
import java.util.List;
49
import java.util.List;
Lines 80-86 Link Here
80
import org.openide.util.Exceptions;
79
import org.openide.util.Exceptions;
81
import org.openide.windows.IOProvider;
80
import org.openide.windows.IOProvider;
82
import org.openide.windows.InputOutput;
81
import org.openide.windows.InputOutput;
83
import org.openide.windows.WindowManager;
84
82
85
/**
83
/**
86
 * Base class for Make Actions ...
84
 * Base class for Make Actions ...
Lines 119-128 Link Here
119
                    }
117
                    }
120
                }
118
                }
121
            };
119
            };
122
            Frame mainWindow = WindowManager.getDefault().getMainWindow();
123
            String title = getString("DLG_TITLE_Prepare", "make"); // NOI18N
120
            String title = getString("DLG_TITLE_Prepare", "make"); // NOI18N
124
            String msg = getString("MSG_TITLE_Prepare", "make"); // NOI18N
121
            String msg = getString("MSG_TITLE_Prepare", "make"); // NOI18N
125
            ModalMessageDlg.runLongTask(mainWindow, title, msg, runner, null);
122
            ModalMessageDlg.runLongTask(runner, null, title, msg);
126
        } else {
123
        } else {
127
            NativeExecutionService es = prepare(node, target, listener, outputListener, project, additionalEnvironment, inputOutput);
124
            NativeExecutionService es = prepare(node, target, listener, outputListener, project, additionalEnvironment, inputOutput);
128
            if (es != null) {
125
            if (es != null) {
(-)a/cnd/src/org/netbeans/modules/cnd/actions/QMakeAction.java (-4 / +1 lines)
Lines 42-48 Link Here
42
42
43
package org.netbeans.modules.cnd.actions;
43
package org.netbeans.modules.cnd.actions;
44
44
45
import java.awt.Frame;
46
import java.io.IOException;
45
import java.io.IOException;
47
import java.io.Writer;
46
import java.io.Writer;
48
import java.util.List;
47
import java.util.List;
Lines 71-77 Link Here
71
import org.openide.nodes.Node;
70
import org.openide.nodes.Node;
72
import org.openide.windows.IOProvider;
71
import org.openide.windows.IOProvider;
73
import org.openide.windows.InputOutput;
72
import org.openide.windows.InputOutput;
74
import org.openide.windows.WindowManager;
75
73
76
/**
74
/**
77
 *
75
 *
Lines 115-124 Link Here
115
                    }
113
                    }
116
                }
114
                }
117
            };
115
            };
118
            Frame mainWindow = WindowManager.getDefault().getMainWindow();
119
            String title = getString("DLG_TITLE_Prepare","qmake"); // NOI18N
116
            String title = getString("DLG_TITLE_Prepare","qmake"); // NOI18N
120
            String msg = getString("MSG_TITLE_Prepare","qmake"); // NOI18N
117
            String msg = getString("MSG_TITLE_Prepare","qmake"); // NOI18N
121
            ModalMessageDlg.runLongTask(mainWindow, title, msg, runner, null);
118
            ModalMessageDlg.runLongTask(runner, null, title, msg);
122
        } else {
119
        } else {
123
            NativeExecutionService es = prepare(node, listener, outputListener, project, inputOutput);
120
            NativeExecutionService es = prepare(node, listener, outputListener, project, inputOutput);
124
            if (es != null) {
121
            if (es != null) {
(-)a/cnd/src/org/netbeans/modules/cnd/actions/ShellRunAction.java (-4 / +1 lines)
Lines 44-50 Link Here
44
44
45
package org.netbeans.modules.cnd.actions;
45
package org.netbeans.modules.cnd.actions;
46
46
47
import java.awt.Frame;
48
import java.io.File;
47
import java.io.File;
49
import java.io.IOException;
48
import java.io.IOException;
50
import java.io.Writer;
49
import java.io.Writer;
Lines 82-88 Link Here
82
import org.openide.nodes.Node;
81
import org.openide.nodes.Node;
83
import org.openide.windows.IOProvider;
82
import org.openide.windows.IOProvider;
84
import org.openide.windows.InputOutput;
83
import org.openide.windows.InputOutput;
85
import org.openide.windows.WindowManager;
86
84
87
/**
85
/**
88
 * Base class for Make Actions ...
86
 * Base class for Make Actions ...
Lines 129-138 Link Here
129
                    }
127
                    }
130
                }
128
                }
131
            };
129
            };
132
            Frame mainWindow = WindowManager.getDefault().getMainWindow();
133
            String title = getString("DLG_TITLE_Prepare",node.getName()); // NOI18N
130
            String title = getString("DLG_TITLE_Prepare",node.getName()); // NOI18N
134
            String msg = getString("MSG_TITLE_Prepare",node.getName()); // NOI18N
131
            String msg = getString("MSG_TITLE_Prepare",node.getName()); // NOI18N
135
            ModalMessageDlg.runLongTask(mainWindow, title, msg, runner, null);
132
            ModalMessageDlg.runLongTask(runner, null, title, msg);
136
        } else {
133
        } else {
137
            NativeExecutionService es = prepare(node, listener, outputListener, project, inputOutput);
134
            NativeExecutionService es = prepare(node, listener, outputListener, project, inputOutput);
138
            if (es != null) {
135
            if (es != null) {

Return to bug 223810