use of com.intellij.execution.Executor in project intellij-community by JetBrains.
the class XDebugSessionTab method attachToSession.
private void attachToSession(@NotNull XDebugSessionImpl session) {
for (XDebugView view : myViews.values()) {
attachViewToSession(session, view);
}
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);
}
}
use of com.intellij.execution.Executor in project android by JetBrains.
the class HotswapAction method doPerform.
@Override
protected void doPerform(@NotNull AnActionEvent e, @NotNull Project project) {
RunnerAndConfigurationSettings settings = RunManager.getInstance(project).getSelectedConfiguration();
if (settings == null) {
InstantRunManager.LOG.warn("Hotswap Action could not locate current run config settings");
return;
}
AndroidSessionInfo session = getAndroidSessionInfo(project, settings);
if (session == null) {
InstantRunManager.LOG.warn("Hotswap Action could not locate an existing session for selected run config.");
return;
}
Executor executor = getExecutor(session.getExecutorId());
if (executor == null) {
InstantRunManager.LOG.warn("Hotswap Action could not identify executor");
return;
}
ExecutionEnvironmentBuilder builder = ExecutionEnvironmentBuilder.createOrNull(executor, settings);
if (builder == null) {
InstantRunManager.LOG.warn("Hotswap Action could not construct an env");
return;
}
ExecutionEnvironment env = builder.activeTarget().dataContext(e.getDataContext()).build();
InstantRunUtils.setInvokedViaHotswapAction(env, true);
InstantRunManager.LOG.info("Invoking hotswap launch");
ProgramRunnerUtil.executeConfiguration(env, false, true);
}
use of com.intellij.execution.Executor in project android by JetBrains.
the class AndroidDebuggerImplBase method activateDebugSessionWindow.
protected static boolean activateDebugSessionWindow(@NotNull Project project, @NotNull RunContentDescriptor descriptor) {
final ProcessHandler processHandler = descriptor.getProcessHandler();
final Content content = descriptor.getAttachedContent();
if (processHandler == null || content == null) {
return false;
}
final Executor executor = DefaultDebugExecutor.getDebugExecutorInstance();
if (processHandler.isProcessTerminated()) {
ExecutionManager.getInstance(project).getContentManager().removeRunContent(executor, descriptor);
return false;
}
content.getManager().setSelectedContent(content);
ToolWindow window = ToolWindowManager.getInstance(project).getToolWindow(executor.getToolWindowId());
window.activate(null, false, true);
return true;
}
use of com.intellij.execution.Executor in project buck by facebook.
the class TestExecutionState method attachDebugger.
private void attachDebugger(String title, String port) {
final RemoteConnection remoteConnection = new RemoteConnection(/* useSockets */
true, "localhost", port, /* serverMode */
false);
final RemoteStateState state = new RemoteStateState(mProject, remoteConnection);
final String name = title + " debugger (" + port + ")";
final ConfigurationFactory cfgFactory = ConfigurationTypeUtil.findConfigurationType("Remote").getConfigurationFactories()[0];
RunnerAndConfigurationSettings runSettings = RunManager.getInstance(mProject).createRunConfiguration(name, cfgFactory);
final Executor debugExecutor = DefaultDebugExecutor.getDebugExecutorInstance();
final ExecutionEnvironment env = new ExecutionEnvironmentBuilder(mProject, debugExecutor).runProfile(runSettings.getConfiguration()).build();
final int pollTimeout = 3000;
final DebugEnvironment environment = new DefaultDebugEnvironment(env, state, remoteConnection, pollTimeout);
ApplicationManager.getApplication().invokeLater(() -> {
try {
final DebuggerSession debuggerSession = DebuggerManagerEx.getInstanceEx(mProject).attachVirtualMachine(environment);
if (debuggerSession == null) {
return;
}
XDebuggerManager.getInstance(mProject).startSessionAndShowTab(name, null, new XDebugProcessStarter() {
@Override
@NotNull
public XDebugProcess start(@NotNull XDebugSession session) {
return JavaDebugProcess.create(session, debuggerSession);
}
});
} catch (ExecutionException e) {
LOG.error("failed to attach to debugger on port " + port + " with polling timeout " + pollTimeout);
}
});
}
use of com.intellij.execution.Executor in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoEventsConverterTestCase method doTest.
protected void doTest() {
Executor executor = new DefaultRunExecutor();
GoTestRunConfiguration runConfig = new GoTestRunConfiguration(myFixture.getProject(), "", GoTestRunConfigurationType.getInstance());
runConfig.setTestFramework(getTestFramework());
GoTestConsoleProperties consoleProperties = new GoTestConsoleProperties(runConfig, executor);
GoTestEventsConverterBase converter = (GoTestEventsConverterBase) consoleProperties.createTestEventsConverter("gotest", consoleProperties);
LoggingServiceMessageVisitor serviceMessageVisitor = new LoggingServiceMessageVisitor();
try {
for (String line : FileUtil.loadLines(new File(getTestDataPath(), getTestName(true) + ".txt"), CharsetToolkit.UTF8)) {
converter.processServiceMessages(line + "\n", ProcessOutputTypes.STDOUT, serviceMessageVisitor);
}
} catch (IOException | ParseException e) {
throw new RuntimeException(e);
}
((OutputToGeneralTestEventsConverter) converter).flushBufferBeforeTerminating();
Disposer.dispose((OutputToGeneralTestEventsConverter) converter);
assertSameLinesWithFile(getTestDataPath() + "/" + getTestName(true) + "-expected.txt", serviceMessageVisitor.getLog());
}
Aggregations