use of com.intellij.execution.ui.RunContentDescriptor in project intellij-plugins by JetBrains.
the class FlexUnitTestRunner method execute.
@Override
public void execute(@NotNull final ExecutionEnvironment env, @Nullable final Callback callback) throws ExecutionException {
final Project project = env.getProject();
final RunProfileState state = env.getState();
if (state == null) {
return;
}
Runnable startRunnable = () -> {
try {
if (project.isDisposed())
return;
final RunContentDescriptor descriptor = doExecute(state, env);
if (callback != null)
callback.processStarted(descriptor);
if (descriptor != null) {
ExecutionManager.getInstance(project).getContentManager().showRunContent(env.getExecutor(), descriptor);
final ProcessHandler processHandler = descriptor.getProcessHandler();
if (processHandler != null)
processHandler.startNotify();
}
} catch (ExecutionException e) {
ExecutionUtil.handleExecutionError(env, e);
}
};
ExecutionManager.getInstance(project).compileAndRun(startRunnable, env, state, null);
}
use of com.intellij.execution.ui.RunContentDescriptor in project intellij-community by JetBrains.
the class XDebuggerManagerImpl method removeSession.
public void removeSession(@NotNull final XDebugSessionImpl session) {
XDebugSessionTab sessionTab = session.getSessionTab();
mySessions.remove(session.getDebugProcess().getProcessHandler());
if (sessionTab != null) {
RunContentDescriptor descriptor = sessionTab.getRunContentDescriptor();
if (descriptor != null) {
// in test-mode RunContentWithExecutorListener.contentRemoved events are not sent (see RunContentManagerImpl.showRunContent)
// so we make sure the mySessions and mySessionData are cleared correctly when session is disposed
Disposer.register(descriptor, () -> mySessions.remove(session.getDebugProcess().getProcessHandler()));
}
if (!myProject.isDisposed() && !ApplicationManager.getApplication().isUnitTestMode() && XDebuggerSettingManagerImpl.getInstanceImpl().getGeneralSettings().isHideDebuggerOnProcessTermination()) {
ExecutionManager.getInstance(myProject).getContentManager().hideRunContent(DefaultDebugExecutor.getDebugExecutorInstance(), descriptor);
}
}
if (myActiveSession.compareAndSet(session, null)) {
onActiveSessionChanged();
}
}
use of com.intellij.execution.ui.RunContentDescriptor in project intellij-community by JetBrains.
the class XDebugSessionTab method setSession.
private void setSession(@NotNull XDebugSessionImpl session, @Nullable ExecutionEnvironment environment, @Nullable Icon icon) {
myEnvironment = environment;
mySession = session;
mySessionData = session.getSessionData();
myConsole = session.getConsoleView();
AnAction[] restartActions;
List<AnAction> restartActionsList = session.getRestartActions();
if (ContainerUtil.isEmpty(restartActionsList)) {
restartActions = AnAction.EMPTY_ARRAY;
} else {
restartActions = restartActionsList.toArray(new AnAction[restartActionsList.size()]);
}
myRunContentDescriptor = new RunContentDescriptor(myConsole, session.getDebugProcess().getProcessHandler(), myUi.getComponent(), session.getSessionName(), icon, myRebuildWatchesRunnable, restartActions);
Disposer.register(myRunContentDescriptor, this);
Disposer.register(myProject, myRunContentDescriptor);
}
use of com.intellij.execution.ui.RunContentDescriptor in project intellij-community by JetBrains.
the class FakeRerunAction method getEnvironment.
@Nullable
protected ExecutionEnvironment getEnvironment(@NotNull AnActionEvent event) {
ExecutionEnvironment environment = event.getData(LangDataKeys.EXECUTION_ENVIRONMENT);
if (environment == null) {
Project project = event.getProject();
RunContentDescriptor contentDescriptor = project == null ? null : ExecutionManager.getInstance(project).getContentManager().getSelectedContent();
if (contentDescriptor != null) {
JComponent component = contentDescriptor.getComponent();
if (component != null) {
environment = LangDataKeys.EXECUTION_ENVIRONMENT.getData(DataManager.getInstance().getDataContext(component));
}
}
}
return environment;
}
use of com.intellij.execution.ui.RunContentDescriptor in project intellij-community by JetBrains.
the class FakeRerunAction method isEnabled.
protected boolean isEnabled(AnActionEvent event) {
RunContentDescriptor descriptor = getDescriptor(event);
ProcessHandler processHandler = descriptor == null ? null : descriptor.getProcessHandler();
ExecutionEnvironment environment = getEnvironment(event);
return environment != null && !ExecutorRegistry.getInstance().isStarting(environment) && !(processHandler != null && processHandler.isProcessTerminating());
}
Aggregations