mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Run/Debug buttons stay disabled, thread hanging if external tool configured as 'before launch task' fails to start.
This commit is contained in:
@@ -84,18 +84,17 @@ public abstract class AbstractToolBeforeRunTask<ToolBeforeRunTask extends Abstra
|
||||
ApplicationManager.getApplication().invokeAndWait(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
targetDone.down();
|
||||
boolean runToolResult = ToolAction.runTool(myToolActionId, context, null, executionId, new ProcessAdapter() {
|
||||
ToolAction.runTool(myToolActionId, context, null, executionId, new ProcessAdapter() {
|
||||
public void startNotified(final ProcessEvent event) {
|
||||
targetDone.down();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processTerminated(ProcessEvent event) {
|
||||
result.set(event.getExitCode() == 0);
|
||||
targetDone.up();
|
||||
}
|
||||
});
|
||||
if (!runToolResult) {
|
||||
result.set(false);
|
||||
targetDone.up();
|
||||
}
|
||||
}
|
||||
}, ModalityState.NON_MODAL);
|
||||
}
|
||||
|
||||
@@ -266,14 +266,12 @@ public class Tool implements SchemeElement {
|
||||
return name.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>true</code> if task has been started successfully
|
||||
*/
|
||||
public boolean execute(AnActionEvent event, DataContext dataContext, long executionId, @Nullable final ProcessListener processListener) {
|
||||
public void execute(AnActionEvent event, DataContext dataContext, long executionId, @Nullable final ProcessListener processListener) {
|
||||
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
|
||||
if (project == null) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
FileDocumentManager.getInstance().saveAllDocuments();
|
||||
try {
|
||||
if (isUseConsole()) {
|
||||
@@ -294,12 +292,11 @@ public class Tool implements SchemeElement {
|
||||
}
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
GeneralCommandLine commandLine = createCommandLine(dataContext);
|
||||
if (commandLine == null) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
OSProcessHandler handler = new OSProcessHandler(commandLine.createProcess(), commandLine.getCommandLineString());
|
||||
handler.addProcessListener(new ToolProcessAdapter(project, synchronizeAfterExecution(), getName()));
|
||||
@@ -307,13 +304,11 @@ public class Tool implements SchemeElement {
|
||||
handler.addProcessListener(processListener);
|
||||
}
|
||||
handler.startNotify();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (ExecutionException ex) {
|
||||
ExecutionErrorDialog.show(ex, ToolsBundle.message("tools.process.start.error"), project);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -69,14 +69,14 @@ public class ToolAction extends AnAction implements DumbAware {
|
||||
runTool(actionId, context, null, 0L, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>true</code> if task has been started successfully
|
||||
*/
|
||||
static boolean runTool(String actionId, DataContext context, @Nullable AnActionEvent e, long executionId, @Nullable ProcessListener processListener) {
|
||||
static void runTool(String actionId,
|
||||
DataContext context,
|
||||
@Nullable AnActionEvent e,
|
||||
long executionId,
|
||||
@Nullable ProcessListener processListener) {
|
||||
Tool tool = findTool(actionId, context);
|
||||
if (tool != null) {
|
||||
return tool.execute(e, new HackyDataContext(context), executionId, processListener);
|
||||
tool.execute(e, new HackyDataContext(context), executionId, processListener);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user