Lines 137-142
Link Here
|
137 |
import org.netbeans.modules.nativeexecution.api.util.ShellValidationSupport.ShellValidationStatus; |
137 |
import org.netbeans.modules.nativeexecution.api.util.ShellValidationSupport.ShellValidationStatus; |
138 |
import org.netbeans.modules.nativeexecution.api.util.WindowsSupport; |
138 |
import org.netbeans.modules.nativeexecution.api.util.WindowsSupport; |
139 |
import org.netbeans.modules.remote.spi.FileSystemProvider; |
139 |
import org.netbeans.modules.remote.spi.FileSystemProvider; |
|
|
140 |
import org.netbeans.spi.project.ActionProgress; |
140 |
import org.openide.LifecycleManager; |
141 |
import org.openide.LifecycleManager; |
141 |
import org.openide.filesystems.FileObject; |
142 |
import org.openide.filesystems.FileObject; |
142 |
import org.openide.filesystems.FileSystem; |
143 |
import org.openide.filesystems.FileSystem; |
Lines 203-208
Link Here
|
203 |
private static final String DEBUG_TEST_STEP = "debug-test"; // NOI18N |
204 |
private static final String DEBUG_TEST_STEP = "debug-test"; // NOI18N |
204 |
private static final String DEBUG_STEPINTO_TEST_STEP = "debug-stepinto-test"; // NOI18N |
205 |
private static final String DEBUG_STEPINTO_TEST_STEP = "debug-stepinto-test"; // NOI18N |
205 |
private static final RequestProcessor RP = new RequestProcessor("Make Action RP", 1);// NOI18N |
206 |
private static final RequestProcessor RP = new RequestProcessor("Make Action RP", 1);// NOI18N |
|
|
207 |
private static final boolean PARALLEL_POST = "true".equals(System.getProperty("org.netbeans.modules.cnd.makeproject.parallel-build", "false")); |
206 |
|
208 |
|
207 |
public MakeActionProviderImpl(MakeProject project) { |
209 |
public MakeActionProviderImpl(MakeProject project) { |
208 |
this.project = project; |
210 |
this.project = project; |
Lines 312-335
Link Here
|
312 |
confs.add(activeConf); |
314 |
confs.add(activeConf); |
313 |
} |
315 |
} |
314 |
final String finalCommand = command; |
316 |
final String finalCommand = command; |
|
|
317 |
ActionProgress progress; |
318 |
if (PARALLEL_POST) { |
319 |
progress = null; |
320 |
} else { |
321 |
progress = ActionProgress.start(context); |
322 |
} |
315 |
|
323 |
|
316 |
CancellableTask actionWorker = new CancellableTask() { |
324 |
CancellableTask actionWorker = new CancellableTask(progress) { |
317 |
|
325 |
|
318 |
@Override |
326 |
@Override |
319 |
protected void runImpl() { |
327 |
protected void runImpl() { |
320 |
final ArrayList<ProjectActionEvent> actionEvents = new ArrayList<>(); |
328 |
final ArrayList<ProjectActionEvent> actionEvents = new ArrayList<>(); |
321 |
for (MakeConfiguration conf : confs) { |
329 |
for (MakeConfiguration conf : confs) { |
322 |
addAction(actionEvents, pd, conf, finalCommand, context, cancelled); |
330 |
if (!addAction(actionEvents, pd, conf, finalCommand, context, getCancelled())) { |
|
|
331 |
if (!getCancelled().isCanceled()) { |
332 |
getCancelled().getActionProgress().finished(false); |
333 |
} |
334 |
return; |
335 |
} |
323 |
} |
336 |
} |
324 |
// Execute actions |
337 |
// Execute actions |
325 |
if (actionEvents.size() > 0 && !cancelled.isCanceled()) { |
338 |
if (!getCancelled().isCanceled()) { |
326 |
RP.post(new NamedRunnable("Make Project Action Worker") { //NOI18N |
339 |
if (actionEvents.size() > 0) { |
327 |
|
340 |
RP.post(new NamedRunnable("Make Project Action Worker") { //NOI18N |
328 |
@Override |
341 |
@Override |
329 |
protected void runImpl() { |
342 |
protected void runImpl() { |
330 |
ProjectActionSupport.getInstance().fireActionPerformed(actionEvents.toArray(new ProjectActionEvent[actionEvents.size()])); |
343 |
ProjectActionSupport.getInstance().fireActionPerformed(actionEvents.toArray(new ProjectActionEvent[actionEvents.size()]),null, getCancelled().getActionProgress()); |
331 |
} |
344 |
} |
332 |
}); |
345 |
}); |
|
|
346 |
} else { |
347 |
getCancelled().getActionProgress().finished(false); |
348 |
} |
333 |
} |
349 |
} |
334 |
} |
350 |
} |
335 |
}; |
351 |
}; |
Lines 344-355
Link Here
|
344 |
} |
360 |
} |
345 |
|
361 |
|
346 |
public void invokeCustomAction(final MakeConfigurationDescriptor pd, final MakeConfiguration conf, final ProjectActionHandler customProjectActionHandler) { |
362 |
public void invokeCustomAction(final MakeConfigurationDescriptor pd, final MakeConfiguration conf, final ProjectActionHandler customProjectActionHandler) { |
347 |
CancellableTask actionWorker = new CancellableTask() { |
363 |
CancellableTask actionWorker = new CancellableTask(null) { |
348 |
|
364 |
|
349 |
@Override |
365 |
@Override |
350 |
protected void runImpl() { |
366 |
protected void runImpl() { |
351 |
ArrayList<ProjectActionEvent> actionEvents = new ArrayList<>(); |
367 |
ArrayList<ProjectActionEvent> actionEvents = new ArrayList<>(); |
352 |
addAction(actionEvents, pd, conf, MakeActionProviderImpl.COMMAND_CUSTOM_ACTION, null, cancelled); |
368 |
addAction(actionEvents, pd, conf, MakeActionProviderImpl.COMMAND_CUSTOM_ACTION, null, getCancelled()); |
353 |
ProjectActionSupport.getInstance().fireActionPerformed( |
369 |
ProjectActionSupport.getInstance().fireActionPerformed( |
354 |
actionEvents.toArray(new ProjectActionEvent[actionEvents.size()]), |
370 |
actionEvents.toArray(new ProjectActionEvent[actionEvents.size()]), |
355 |
customProjectActionHandler); |
371 |
customProjectActionHandler); |
Lines 380-386
Link Here
|
380 |
} |
396 |
} |
381 |
} |
397 |
} |
382 |
// start validation phase |
398 |
// start validation phase |
383 |
wrapper = new CancellableTask() { |
399 |
wrapper = new CancellableTask(actionWorker.getCancelled().getActionProgress()) { |
384 |
|
400 |
|
385 |
@Override |
401 |
@Override |
386 |
public boolean cancel() { |
402 |
public boolean cancel() { |
Lines 419-430
Link Here
|
419 |
NbBundle.getMessage(MakeActionProviderImpl.class, "MSG_Validate_Host", record.getDisplayName())); |
435 |
NbBundle.getMessage(MakeActionProviderImpl.class, "MSG_Validate_Host", record.getDisplayName())); |
420 |
} |
436 |
} |
421 |
|
437 |
|
422 |
private void addAction(ArrayList<ProjectActionEvent> actionEvents, |
438 |
private boolean addAction(ArrayList<ProjectActionEvent> actionEvents, |
423 |
MakeConfigurationDescriptor pd, MakeConfiguration conf, String command, Lookup context, |
439 |
MakeConfigurationDescriptor pd, MakeConfiguration conf, String command, Lookup context, |
424 |
CanceledState cancelled) throws IllegalArgumentException { |
440 |
CanceledState cancelled) throws IllegalArgumentException { |
425 |
|
441 |
|
426 |
if (cancelled.isCanceled()) { |
442 |
if (cancelled.isCanceled()) { |
427 |
return; |
443 |
return false; |
428 |
} |
444 |
} |
429 |
|
445 |
|
430 |
AtomicBoolean validated = new AtomicBoolean(false); |
446 |
AtomicBoolean validated = new AtomicBoolean(false); |
Lines 432-438
Link Here
|
432 |
|
448 |
|
433 |
String[] targetNames = getTargetNames(command, conf, context); |
449 |
String[] targetNames = getTargetNames(command, conf, context); |
434 |
if (targetNames == null || targetNames.length == 0) { |
450 |
if (targetNames == null || targetNames.length == 0) { |
435 |
return; |
451 |
return false; |
436 |
} |
452 |
} |
437 |
|
453 |
|
438 |
for (int i = 0; i < targetNames.length; i++) { |
454 |
for (int i = 0; i < targetNames.length; i++) { |
Lines 454-459
Link Here
|
454 |
} |
470 |
} |
455 |
} |
471 |
} |
456 |
} |
472 |
} |
|
|
473 |
return true; |
457 |
} |
474 |
} |
458 |
|
475 |
|
459 |
private boolean addTarget(String targetName, ArrayList<ProjectActionEvent> actionEvents, |
476 |
private boolean addTarget(String targetName, ArrayList<ProjectActionEvent> actionEvents, |