本文整理汇总了Java中com.intellij.execution.ui.actions.CloseAction类的典型用法代码示例。如果您正苦于以下问题:Java CloseAction类的具体用法?Java CloseAction怎么用?Java CloseAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CloseAction类属于com.intellij.execution.ui.actions包,在下文中一共展示了CloseAction类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: showHelperProcessRunContent
import com.intellij.execution.ui.actions.CloseAction; //导入依赖的package包/类
public static final ConsoleView showHelperProcessRunContent(String header, OSProcessHandler runHandler, Project project, Executor defaultExecutor) {
ProcessTerminatedListener.attach(runHandler);
ConsoleViewImpl consoleView = new ConsoleViewImpl(project, true);
DefaultActionGroup toolbarActions = new DefaultActionGroup();
JPanel panel = new JPanel((LayoutManager) new BorderLayout());
panel.add((Component) consoleView.getComponent(), "Center");
ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("unknown", (ActionGroup) toolbarActions, false);
toolbar.setTargetComponent(consoleView.getComponent());
panel.add((Component) toolbar.getComponent(), "West");
RunContentDescriptor runDescriptor = new RunContentDescriptor((ExecutionConsole) consoleView,
(ProcessHandler) runHandler, (JComponent) panel, header, AllIcons.RunConfigurations.Application);
AnAction[]
consoleActions = consoleView.createConsoleActions();
toolbarActions.addAll((AnAction[]) Arrays.copyOf(consoleActions, consoleActions.length));
toolbarActions.add((AnAction) new StopProcessAction("Stop process", "Stop process", (ProcessHandler) runHandler));
toolbarActions.add((AnAction) new CloseAction(defaultExecutor, runDescriptor, project));
consoleView.attachToProcess((ProcessHandler) runHandler);
// ExecutionManager.getInstance(environment.getProject()).getContentManager().showRunContent(environment.getExecutor(), runDescriptor);
showConsole(project, defaultExecutor, runDescriptor);
return (ConsoleView) consoleView;
}
开发者ID:beansoftapp,项目名称:react-native-console,代码行数:26,代码来源:RunnerUtil.java
示例2: createConsoleView
import com.intellij.execution.ui.actions.CloseAction; //导入依赖的package包/类
@NotNull
private static RunContentDescriptor createConsoleView(@NotNull Project project, @NotNull PsiFile psiFile) {
ConsoleView consoleView = TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole();
DefaultActionGroup toolbarActions = new DefaultActionGroup();
JComponent panel = new JPanel(new BorderLayout());
panel.add(consoleView.getComponent(), BorderLayout.CENTER);
ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, toolbarActions, false);
toolbar.setTargetComponent(consoleView.getComponent());
panel.add(toolbar.getComponent(), BorderLayout.WEST);
final RunContentDescriptor descriptor = new RunContentDescriptor(consoleView, null, panel, psiFile.getName()) {
@Override
public boolean isContentReuseProhibited() {
return true;
}
};
Executor executor = DefaultRunExecutor.getRunExecutorInstance();
toolbarActions.addAll(consoleView.createConsoleActions());
toolbarActions.add(new CloseAction(executor, descriptor, project));
ExecutionManager.getInstance(project).getContentManager().showRunContent(executor, descriptor);
return descriptor;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:RunIdeConsoleAction.java
示例3: patchLeftToolbar
import com.intellij.execution.ui.actions.CloseAction; //导入依赖的package包/类
private static void patchLeftToolbar(@NotNull XDebugSession session, @NotNull RunnerLayoutUi ui) {
DefaultActionGroup newLeftToolbar = new DefaultActionGroup();
DefaultActionGroup firstGroup = new DefaultActionGroup();
addActionToGroup(firstGroup, XDebuggerActions.RESUME);
addActionToGroup(firstGroup, IdeActions.ACTION_STOP_PROGRAM);
newLeftToolbar.addAll(firstGroup);
newLeftToolbar.addSeparator();
Executor executor = PyEduDebugExecutor.getInstance();
newLeftToolbar.add(new CloseAction(executor, session.getRunContentDescriptor(), session.getProject()));
//TODO: return proper helpID
newLeftToolbar.add(new ContextHelpAction(executor.getHelpId()));
ui.getOptions().setLeftToolbar(newLeftToolbar, ActionPlaces.DEBUGGER_TOOLBAR);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:PyEduDebugRunner.java
示例4: createConsoleView
import com.intellij.execution.ui.actions.CloseAction; //导入依赖的package包/类
@Nonnull
private static RunContentDescriptor createConsoleView(@Nonnull Project project, @Nonnull PsiFile psiFile) {
ConsoleView consoleView = TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole();
DefaultActionGroup toolbarActions = new DefaultActionGroup();
JComponent panel = new JPanel(new BorderLayout());
panel.add(consoleView.getComponent(), BorderLayout.CENTER);
ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, toolbarActions, false);
toolbar.setTargetComponent(consoleView.getComponent());
panel.add(toolbar.getComponent(), BorderLayout.WEST);
final RunContentDescriptor descriptor = new RunContentDescriptor(consoleView, null, panel, psiFile.getName()) {
@Override
public boolean isContentReuseProhibited() {
return true;
}
};
Executor executor = DefaultRunExecutor.getRunExecutorInstance();
toolbarActions.addAll(consoleView.createConsoleActions());
toolbarActions.add(new CloseAction(executor, descriptor, project));
ExecutionManager.getInstance(project).getContentManager().showRunContent(executor, descriptor);
return descriptor;
}
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:RunIdeConsoleAction.java
示例5: initActions
import com.intellij.execution.ui.actions.CloseAction; //导入依赖的package包/类
@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()));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:DefaultDebugUIEnvironment.java
示例6: createConsole
import com.intellij.execution.ui.actions.CloseAction; //导入依赖的package包/类
private ConsoleView createConsole(@NotNull Project project) {
TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(project);
consoleBuilder.filters(myFilterList);
final ConsoleView console = consoleBuilder.getConsole();
if (myHelpId != null) {
console.setHelpId(myHelpId);
}
Executor executor = DefaultRunExecutor.getRunExecutorInstance();
DefaultActionGroup actions = new DefaultActionGroup();
final JComponent consolePanel = createConsolePanel(console, actions);
RunContentDescriptor descriptor = new RunContentDescriptor(console, myProcess, consolePanel, myTitle);
Disposer.register(descriptor, this);
Disposer.register(descriptor, console);
actions.add(new RerunAction(consolePanel));
actions.add(new StopAction());
actions.add(new CloseAction(executor, descriptor, myProject));
ExecutionManager.getInstance(myProject).getContentManager().showRunContent(executor, descriptor);
if (myActivateToolWindow) {
activateToolWindow();
}
return console;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:RunContentExecutor.java
示例7: createActionToolbar
import com.intellij.execution.ui.actions.CloseAction; //导入依赖的package包/类
@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));
if (myExecutionResult instanceof DefaultExecutionResult) {
actionGroup.addAll(((DefaultExecutionResult)myExecutionResult).getAdditionalStopActions());
}
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;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:RunContentBuilder.java
示例8: addConsole
import com.intellij.execution.ui.actions.CloseAction; //导入依赖的package包/类
public static RunContentDescriptor addConsole(Project project,
@Nullable ConsoleFactory consoleFactory,
final String tabTitle,
String text,
@Nullable Icon icon) {
final TextConsoleBuilder builder = TextConsoleBuilderFactory.getInstance().createBuilder(project);
builder.filters(Extensions.getExtensions(EP_NAME, project));
final ConsoleView consoleView = builder.getConsole();
final DefaultActionGroup toolbarActions = new DefaultActionGroup();
JComponent consoleComponent = consoleFactory != null
? consoleFactory.createConsoleComponent(consoleView, toolbarActions)
: new MyConsolePanel(consoleView, toolbarActions);
final RunContentDescriptor descriptor =
new RunContentDescriptor(consoleView, null, consoleComponent, tabTitle, icon) {
@Override
public boolean isContentReuseProhibited() {
return true;
}
};
final Executor executor = DefaultRunExecutor.getRunExecutorInstance();
for (AnAction action: consoleView.createConsoleActions()) {
toolbarActions.add(action);
}
final ConsoleViewImpl console = (ConsoleViewImpl)consoleView;
console.getEditor().getSettings().setCaretRowShown(true);
toolbarActions.add(new AnnotateStackTraceAction(console.getEditor(), console.getHyperlinks()));
toolbarActions.add(new CloseAction(executor, descriptor, project));
ExecutionManager.getInstance(project).getContentManager().showRunContent(executor, descriptor);
consoleView.allowHeavyFilters();
if (consoleFactory == null) {
printStacktrace(consoleView, text);
}
return descriptor;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:AnalyzeStacktraceUtil.java
示例9: initActions
import com.intellij.execution.ui.actions.CloseAction; //导入依赖的package包/类
@Override
public void initActions(RunContentDescriptor content, DefaultActionGroup actionGroup) {
RestartAction restartAction = new RestartAction(myExecutor,
myRunner,
content,
myExecutionEnvironment);
actionGroup.add(restartAction, Constraints.FIRST);
restartAction.registerShortcut(content.getComponent());
actionGroup.add(new CloseAction(myExecutor, content, myProject));
actionGroup.add(new ContextHelpAction(myExecutor.getHelpId()));
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:DefaultDebugUIEnvironment.java
示例10: run
import com.intellij.execution.ui.actions.CloseAction; //导入依赖的package包/类
public void run() {
FileDocumentManager.getInstance().saveAllDocuments();
ConsoleView view = createConsole(myProject, myProcess);
if (myHelpId != null) {
view.setHelpId(myHelpId);
}
Executor executor = DefaultRunExecutor.getRunExecutorInstance();
DefaultActionGroup actions = new DefaultActionGroup();
final JComponent consolePanel = createConsolePanel(view, actions);
RunContentDescriptor descriptor = new RunContentDescriptor(view, myProcess, consolePanel, myTitle);
actions.add(new RerunAction(consolePanel));
actions.add(new StopAction());
actions.add(new CloseAction(executor, descriptor, myProject));
ExecutionManager.getInstance(myProject).getContentManager().showRunContent(executor, descriptor);
if (myActivateToolWindow) {
activateToolWindow();
}
if (myAfterCompletion != null) {
myProcess.addProcessListener(new ProcessAdapter() {
@Override
public void processTerminated(ProcessEvent event) {
SwingUtilities.invokeLater(myAfterCompletion);
}
});
}
myProcess.startNotify();
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:35,代码来源:RunContentExecutor.java
示例11: addConsole
import com.intellij.execution.ui.actions.CloseAction; //导入依赖的package包/类
public static RunContentDescriptor addConsole(Project project,
@Nullable ConsoleFactory consoleFactory,
final String tabTitle,
String text,
@Nullable Icon icon) {
final TextConsoleBuilder builder = TextConsoleBuilderFactory.getInstance().createBuilder(project);
for(Filter filter: Extensions.getExtensions(EP_NAME, project)) {
builder.addFilter(filter);
}
final ConsoleView consoleView = builder.getConsole();
final DefaultActionGroup toolbarActions = new DefaultActionGroup();
JComponent consoleComponent = consoleFactory != null
? consoleFactory.createConsoleComponent(consoleView, toolbarActions)
: new MyConsolePanel(consoleView, toolbarActions);
final RunContentDescriptor descriptor =
new RunContentDescriptor(consoleView, null, consoleComponent, tabTitle, icon) {
@Override
public boolean isContentReuseProhibited() {
return true;
}
};
final Executor executor = DefaultRunExecutor.getRunExecutorInstance();
for (AnAction action: consoleView.createConsoleActions()) {
toolbarActions.add(action);
}
toolbarActions.add(new AnnotateStackTraceAction((ConsoleViewImpl)consoleView));
toolbarActions.add(new CloseAction(executor, descriptor, project));
ExecutionManager.getInstance(project).getContentManager().showRunContent(executor, descriptor);
consoleView.allowHeavyFilters();
printStacktrace(consoleView, text);
return descriptor;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:35,代码来源:AnalyzeStacktraceUtil.java
示例12: createConsole
import com.intellij.execution.ui.actions.CloseAction; //导入依赖的package包/类
private ConsoleView createConsole(@Nonnull Project project) {
TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(project);
consoleBuilder.filters(myFilterList);
final ConsoleView console = consoleBuilder.getConsole();
if (myHelpId != null) {
console.setHelpId(myHelpId);
}
Executor executor = DefaultRunExecutor.getRunExecutorInstance();
DefaultActionGroup actions = new DefaultActionGroup();
final JComponent consolePanel = createConsolePanel(console, actions);
RunContentDescriptor descriptor = new RunContentDescriptor(console, myProcess, consolePanel, myTitle);
Disposer.register(descriptor, this);
Disposer.register(descriptor, console);
actions.add(new RerunAction(consolePanel));
actions.add(new StopAction());
actions.add(new CloseAction(executor, descriptor, myProject));
ExecutionManager.getInstance(myProject).getContentManager().showRunContent(executor, descriptor);
if (myActivateToolWindow) {
activateToolWindow();
}
return console;
}
开发者ID:consulo,项目名称:consulo,代码行数:30,代码来源:RunContentExecutor.java
示例13: createActionToolbar
import com.intellij.execution.ui.actions.CloseAction; //导入依赖的package包/类
@Nonnull
private ActionGroup createActionToolbar(@Nonnull 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));
if (myExecutionResult instanceof DefaultExecutionResult) {
actionGroup.addAll(((DefaultExecutionResult)myExecutionResult).getAdditionalStopActions());
}
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;
}
开发者ID:consulo,项目名称:consulo,代码行数:36,代码来源:RunContentBuilder.java
示例14: addConsole
import com.intellij.execution.ui.actions.CloseAction; //导入依赖的package包/类
public static RunContentDescriptor addConsole(Project project,
@Nullable ConsoleFactory consoleFactory,
final String tabTitle,
String text,
@Nullable Icon icon) {
final TextConsoleBuilder builder = TextConsoleBuilderFactory.getInstance().createBuilder(project);
builder.filters(Extensions.getExtensions(EP_NAME, project));
final ConsoleView consoleView = builder.getConsole();
final DefaultActionGroup toolbarActions = new DefaultActionGroup();
JComponent consoleComponent = consoleFactory != null
? consoleFactory.createConsoleComponent(consoleView, toolbarActions)
: new MyConsolePanel(consoleView, toolbarActions);
final RunContentDescriptor descriptor =
new RunContentDescriptor(consoleView, null, consoleComponent, tabTitle, icon) {
@Override
public boolean isContentReuseProhibited() {
return true;
}
};
final Executor executor = DefaultRunExecutor.getRunExecutorInstance();
for (AnAction action: consoleView.createConsoleActions()) {
toolbarActions.add(action);
}
toolbarActions.add(new AnnotateStackTraceAction((ConsoleViewImpl)consoleView));
toolbarActions.add(new CloseAction(executor, descriptor, project));
ExecutionManager.getInstance(project).getContentManager().showRunContent(executor, descriptor);
consoleView.allowHeavyFilters();
if (consoleFactory == null) {
printStacktrace(consoleView, text);
}
return descriptor;
}
开发者ID:consulo,项目名称:consulo,代码行数:35,代码来源:AnalyzeStacktraceUtil.java
示例15: initActions
import com.intellij.execution.ui.actions.CloseAction; //导入依赖的package包/类
@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()));
}
开发者ID:consulo,项目名称:consulo-java,代码行数:10,代码来源:DefaultDebugUIEnvironment.java
示例16: initActions
import com.intellij.execution.ui.actions.CloseAction; //导入依赖的package包/类
@Override
public void initActions(RunContentDescriptor content, DefaultActionGroup actionGroup) {
actionGroup.add(new CloseAction(myExecutionEnvironment.getExecutor(), content, myExecutionEnvironment.getProject()));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:JavaDebuggerLauncherImpl.java
示例17: attachToSession
import com.intellij.execution.ui.actions.CloseAction; //导入依赖的package包/类
private void attachToSession(@NotNull XDebugSessionImpl session) {
for (XDebugView view : myViews) {
session.addSessionListener(new XDebugViewSessionListener(view), myRunContentDescriptor);
}
XDebugTabLayouter layouter = session.getDebugProcess().createTabLayouter();
Content consoleContent = layouter.registerConsoleContent(myUi, myConsole);
attachNotificationTo(consoleContent);
layouter.registerAdditionalContent(myUi);
RunContentBuilder.addAdditionalConsoleEditorActions(myConsole, consoleContent);
if (ApplicationManager.getApplication().isUnitTestMode()) {
return;
}
DefaultActionGroup leftToolbar = new DefaultActionGroup();
final Executor debugExecutor = DefaultDebugExecutor.getDebugExecutorInstance();
if (myEnvironment != null) {
leftToolbar.add(ActionManager.getInstance().getAction(IdeActions.ACTION_RERUN));
List<AnAction> additionalRestartActions = session.getRestartActions();
if (!additionalRestartActions.isEmpty()) {
leftToolbar.addAll(additionalRestartActions);
leftToolbar.addSeparator();
}
leftToolbar.addAll(session.getExtraActions());
}
leftToolbar.addAll(getCustomizedActionGroup(XDebuggerActions.TOOL_WINDOW_LEFT_TOOLBAR_GROUP));
for (AnAction action : session.getExtraStopActions()) {
leftToolbar.add(action, new Constraints(Anchor.AFTER, IdeActions.ACTION_STOP_PROGRAM));
}
//group.addSeparator();
//addAction(group, DebuggerActions.EXPORT_THREADS);
leftToolbar.addSeparator();
leftToolbar.add(myUi.getOptions().getLayoutActions());
final AnAction[] commonSettings = myUi.getOptions().getSettingsActionsList();
DefaultActionGroup settings = new DefaultActionGroup(ActionsBundle.message("group.XDebugger.settings.text"), true);
settings.getTemplatePresentation().setIcon(myUi.getOptions().getSettingsActions().getTemplatePresentation().getIcon());
settings.addAll(commonSettings);
leftToolbar.add(settings);
leftToolbar.addSeparator();
leftToolbar.add(PinToolwindowTabAction.getPinAction());
leftToolbar.add(new CloseAction(myEnvironment != null ? myEnvironment.getExecutor() : debugExecutor, myRunContentDescriptor, myProject));
leftToolbar.add(new ContextHelpAction(debugExecutor.getHelpId()));
DefaultActionGroup topToolbar = new DefaultActionGroup();
topToolbar.addAll(getCustomizedActionGroup(XDebuggerActions.TOOL_WINDOW_TOP_TOOLBAR_GROUP));
session.getDebugProcess().registerAdditionalActions(leftToolbar, topToolbar, settings);
myUi.getOptions().setLeftToolbar(leftToolbar, ActionPlaces.DEBUGGER_TOOLBAR);
myUi.getOptions().setTopToolbar(topToolbar, ActionPlaces.DEBUGGER_TOOLBAR);
if (myEnvironment != null) {
initLogConsoles(myEnvironment.getRunProfile(), myRunContentDescriptor, myConsole);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:62,代码来源:XDebugSessionTab.java
示例18: createCloseAction
import com.intellij.execution.ui.actions.CloseAction; //导入依赖的package包/类
protected AnAction createCloseAction(final Executor defaultExecutor, final RunContentDescriptor myDescriptor) {
return new CloseAction(defaultExecutor, myDescriptor, myProject);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:AbstractConsoleRunnerWithHistory.java
示例19: createConsole
import com.intellij.execution.ui.actions.CloseAction; //导入依赖的package包/类
@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) {
processHandler.destroyProcess(); // use force
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 FileEditorManagerAdapter() {
@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;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:64,代码来源:GroovyConsole.java
示例20: createActionToolbar
import com.intellij.execution.ui.actions.CloseAction; //导入依赖的package包/类
private ActionGroup createActionToolbar(final RunContentDescriptor contentDescriptor, final JComponent component) {
final DefaultActionGroup actionGroup = new DefaultActionGroup();
final RestartAction restartAction = new RestartAction(myExecutor, myRunner, contentDescriptor, getEnvironment());
restartAction.registerShortcut(component);
actionGroup.add(restartAction);
contentDescriptor.setRestarter(new Runnable() {
@Override
public void run() {
restartAction.restart();
}
});
if (myExecutionResult instanceof DefaultExecutionResult) {
final AnAction[] actions = ((DefaultExecutionResult)myExecutionResult).getRestartActions();
if (actions != null) {
actionGroup.addAll(actions);
if (actions.length > 0) {
actionGroup.addSeparator();
}
}
}
final AnAction stopAction = ActionManager.getInstance().getAction(IdeActions.ACTION_STOP_PROGRAM);
actionGroup.add(stopAction);
if (myExecutionResult instanceof DefaultExecutionResult) {
actionGroup.addAll(((DefaultExecutionResult)myExecutionResult).getAdditionalStopActions());
}
actionGroup.addAll(myExecutionResult.getActions());
for (final 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(myExecutor, contentDescriptor, getProject()));
final String helpId = contentDescriptor.getHelpId();
actionGroup.add(new ContextHelpAction(helpId != null ? helpId : myExecutor.getHelpId()));
return actionGroup;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:50,代码来源:RunContentBuilder.java
注:本文中的com.intellij.execution.ui.actions.CloseAction类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论