use of com.intellij.execution.ui.actions.CloseAction in project intellij-community by JetBrains.
the class RunContentBuilder method createActionToolbar.
@NotNull
private ActionGroup createActionToolbar(@NotNull final RunContentDescriptor contentDescriptor) {
final DefaultActionGroup actionGroup = new DefaultActionGroup();
actionGroup.add(ActionManager.getInstance().getAction(IdeActions.ACTION_RERUN));
final AnAction[] actions = contentDescriptor.getRestartActions();
actionGroup.addAll(actions);
if (actions.length > 0) {
actionGroup.addSeparator();
}
actionGroup.add(ActionManager.getInstance().getAction(IdeActions.ACTION_STOP_PROGRAM));
actionGroup.addAll(myExecutionResult.getActions());
for (AnAction anAction : myRunnerActions) {
if (anAction != null) {
actionGroup.add(anAction);
} else {
actionGroup.addSeparator();
}
}
actionGroup.addSeparator();
actionGroup.add(myUi.getOptions().getLayoutActions());
actionGroup.addSeparator();
actionGroup.add(PinToolwindowTabAction.getPinAction());
actionGroup.add(new CloseAction(myEnvironment.getExecutor(), contentDescriptor, myProject));
final String helpId = contentDescriptor.getHelpId();
actionGroup.add(new ContextHelpAction(helpId != null ? helpId : myEnvironment.getExecutor().getHelpId()));
return actionGroup;
}
use of com.intellij.execution.ui.actions.CloseAction in project intellij-community by JetBrains.
the class DefaultDebugUIEnvironment method initActions.
@Override
public void initActions(RunContentDescriptor content, DefaultActionGroup actionGroup) {
Executor executor = myExecutionEnvironment.getExecutor();
actionGroup.add(ActionManager.getInstance().getAction(IdeActions.ACTION_RERUN), Constraints.FIRST);
actionGroup.add(new CloseAction(executor, content, myExecutionEnvironment.getProject()));
actionGroup.add(new ContextHelpAction(executor.getHelpId()));
}
use of com.intellij.execution.ui.actions.CloseAction in project intellij-community by JetBrains.
the class GroovyConsole method createConsole.
@Nullable
public static GroovyConsole createConsole(@NotNull final Project project, @NotNull final VirtualFile contentFile, @NotNull Module module) {
final ProcessHandler processHandler = createProcessHandler(module);
if (processHandler == null)
return null;
final GroovyConsoleStateService consoleStateService = GroovyConsoleStateService.getInstance(project);
consoleStateService.setFileModule(contentFile, module);
final String title = consoleStateService.getSelectedModuleTitle(contentFile);
final ConsoleViewImpl consoleView = new ConsoleViewImpl(project, true);
final RunContentDescriptor descriptor = new RunContentDescriptor(consoleView, processHandler, new JPanel(new BorderLayout()), title);
final GroovyConsole console = new GroovyConsole(project, descriptor, consoleView, processHandler);
// must call getComponent before createConsoleActions()
final JComponent consoleViewComponent = consoleView.getComponent();
final DefaultActionGroup actionGroup = new DefaultActionGroup();
actionGroup.add(new BuildAndRestartConsoleAction(module, project, defaultExecutor, descriptor, restarter(project, contentFile)));
actionGroup.addSeparator();
actionGroup.addAll(consoleView.createConsoleActions());
actionGroup.add(new CloseAction(defaultExecutor, descriptor, project) {
@Override
public void actionPerformed(AnActionEvent e) {
// use force
processHandler.destroyProcess();
super.actionPerformed(e);
}
});
final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, actionGroup, false);
toolbar.setTargetComponent(consoleViewComponent);
final JComponent ui = descriptor.getComponent();
ui.add(consoleViewComponent, BorderLayout.CENTER);
ui.add(toolbar.getComponent(), BorderLayout.WEST);
project.getMessageBus().connect().subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerListener() {
@Override
public void fileClosed(@NotNull FileEditorManager source, @NotNull VirtualFile file) {
if (file.equals(contentFile)) {
// if file was closed then kill process and hide console content
console.stop();
}
}
});
processHandler.addProcessListener(new ProcessAdapter() {
@Override
public void processTerminated(ProcessEvent event) {
if (contentFile.getUserData(GROOVY_CONSOLE) == console) {
// process terminated either by closing file or by close action
contentFile.putUserData(GROOVY_CONSOLE, null);
}
}
});
contentFile.putUserData(GROOVY_CONSOLE, console);
consoleView.attachToProcess(processHandler);
processHandler.startNotify();
ExecutionManager.getInstance(project).getContentManager().showRunContent(defaultExecutor, descriptor);
return console;
}
Aggregations