use of com.intellij.execution.Executor in project intellij-community by JetBrains.
the class AbstractTerminalRunner method initConsoleUI.
private void initConsoleUI(final T process) {
final Executor defaultExecutor = DefaultRunExecutor.getRunExecutorInstance();
final DefaultActionGroup toolbarActions = new DefaultActionGroup();
final ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, toolbarActions, false);
final JPanel panel = new JPanel(new BorderLayout());
panel.add(actionToolbar.getComponent(), BorderLayout.WEST);
actionToolbar.setTargetComponent(panel);
ProcessHandler processHandler = createProcessHandler(process);
final RunContentDescriptor contentDescriptor = new RunContentDescriptor(null, processHandler, panel, getTerminalConnectionName(process));
contentDescriptor.setAutoFocusContent(true);
toolbarActions.add(createCloseAction(defaultExecutor, contentDescriptor));
final JBTerminalSystemSettingsProvider provider = new JBTerminalSystemSettingsProvider();
TerminalWidget widget = new JBTabbedTerminalWidget(myProject, provider, new Predicate<Pair<TerminalWidget, String>>() {
@Override
public boolean apply(Pair<TerminalWidget, String> widget) {
openSessionInDirectory(widget.getFirst(), widget.getSecond());
return true;
}
}, contentDescriptor);
createAndStartSession(widget, createTtyConnector(process));
panel.add(widget.getComponent(), BorderLayout.CENTER);
showConsole(defaultExecutor, contentDescriptor, widget.getComponent());
processHandler.startNotify();
}
use of com.intellij.execution.Executor in project intellij-community by JetBrains.
the class GradleRerunFailedTestsAction method getRunProfile.
@Nullable
@Override
protected MyRunProfile getRunProfile(@NotNull ExecutionEnvironment environment) {
ExternalSystemRunConfiguration configuration = (ExternalSystemRunConfiguration) myConsoleProperties.getConfiguration();
final List<AbstractTestProxy> failedTests = getFailedTests(configuration.getProject());
return new MyRunProfile(configuration) {
@NotNull
@Override
public Module[] getModules() {
return Module.EMPTY_ARRAY;
}
@Nullable
@Override
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment environment) throws ExecutionException {
ExternalSystemRunConfiguration runProfile = ((ExternalSystemRunConfiguration) getPeer()).clone();
Project project = runProfile.getProject();
Set<String> scriptParameters = ContainerUtil.newLinkedHashSet();
Set<String> tasksToRun = ContainerUtil.newLinkedHashSet();
boolean useResolvedTasks = true;
for (AbstractTestProxy test : failedTests) {
if (test instanceof GradleSMTestProxy) {
String testName = test.getName();
String className = ((GradleSMTestProxy) test).getClassName();
scriptParameters.add(TestMethodGradleConfigurationProducer.createTestFilter(className, testName));
if (!useResolvedTasks)
continue;
if (className == null) {
useResolvedTasks = false;
continue;
}
final PsiClass psiClass = JavaPsiFacade.getInstance(project).findClass(className, GlobalSearchScope.projectScope(project));
if (psiClass == null) {
useResolvedTasks = false;
continue;
}
final PsiFile psiFile = psiClass.getContainingFile();
if (psiFile == null) {
useResolvedTasks = false;
continue;
}
final Module moduleForFile = ProjectFileIndex.SERVICE.getInstance(project).getModuleForFile(psiFile.getVirtualFile());
if (moduleForFile == null) {
useResolvedTasks = false;
continue;
}
ContainerUtil.addAllNotNull(tasksToRun, GradleTestRunConfigurationProducer.getTasksToRun(moduleForFile));
}
}
runProfile.getSettings().setScriptParameters(StringUtil.join(scriptParameters, " "));
if (useResolvedTasks && !tasksToRun.isEmpty()) {
runProfile.getSettings().setTaskNames(ContainerUtil.newArrayList(tasksToRun));
}
return runProfile.getState(executor, environment);
}
};
}
use of com.intellij.execution.Executor in project intellij-community by JetBrains.
the class RerunFailedTestsAction method getRunProfile.
@Override
protected MyRunProfile getRunProfile(@NotNull ExecutionEnvironment environment) {
final TestNGConfiguration configuration = (TestNGConfiguration) myConsoleProperties.getConfiguration();
final List<AbstractTestProxy> failedTests = getFailedTests(configuration.getProject());
return new MyRunProfile(configuration) {
@Override
@NotNull
public Module[] getModules() {
return configuration.getModules();
}
@Override
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) {
return new TestNGRunnableState(env, configuration) {
@Override
public SearchingForTestsTask createSearchingForTestsTask() {
return new SearchingForTestsTask(myServerSocket, getConfiguration(), myTempFile) {
@Override
protected void fillTestObjects(final Map<PsiClass, Map<PsiMethod, List<String>>> classes) throws CantRunException {
final HashMap<PsiClass, Map<PsiMethod, List<String>>> fullClassList = ContainerUtil.newHashMap();
super.fillTestObjects(fullClassList);
for (final PsiClass aClass : fullClassList.keySet()) {
if (!ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
@Override
public Boolean compute() {
return TestNGUtil.hasTest(aClass);
}
})) {
classes.put(aClass, fullClassList.get(aClass));
}
}
final GlobalSearchScope scope = getConfiguration().getConfigurationModule().getSearchScope();
final Project project = getConfiguration().getProject();
for (final AbstractTestProxy proxy : failedTests) {
ApplicationManager.getApplication().runReadAction(() -> includeFailedTestWithDependencies(classes, scope, project, proxy));
}
}
};
}
};
}
};
}
use of com.intellij.execution.Executor in project intellij-community by JetBrains.
the class PyCharmEduInitialConfigurator method patchProjectAreaExtensions.
private static void patchProjectAreaExtensions(@NotNull final Project project) {
Executor debugExecutor = DefaultDebugExecutor.getDebugExecutorInstance();
unregisterAction(debugExecutor.getId(), ExecutorRegistryImpl.RUNNERS_GROUP);
unregisterAction(debugExecutor.getContextActionId(), ExecutorRegistryImpl.RUN_CONTEXT_GROUP);
ExtensionsArea projectArea = Extensions.getArea(project);
for (SelectInTarget target : Extensions.getExtensions(SelectInTarget.EP_NAME, project)) {
if (ToolWindowId.FAVORITES_VIEW.equals(target.getToolWindowId()) || ToolWindowId.STRUCTURE_VIEW.equals(target.getToolWindowId())) {
projectArea.getExtensionPoint(SelectInTarget.EP_NAME).unregisterExtension(target);
}
}
for (AbstractProjectViewPane pane : Extensions.getExtensions(AbstractProjectViewPane.EP_NAME, project)) {
if (pane.getId().equals(ScopeViewPane.ID)) {
Disposer.dispose(pane);
projectArea.getExtensionPoint(AbstractProjectViewPane.EP_NAME).unregisterExtension(pane);
}
}
}
use of com.intellij.execution.Executor in project intellij-community by JetBrains.
the class PyDataViewToolWindowFactory method createToolWindowContent.
@Override
public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
PyDataView.getInstance(project).init(toolWindow);
final MessageBusConnection connection = project.getMessageBus().connect(project);
connection.subscribe(XDebuggerManager.TOPIC, new ChangeContentXDebuggerManagerListener(project));
connection.subscribe(RunContentManager.TOPIC, new RunContentWithExecutorListener() {
@Override
public void contentSelected(@Nullable RunContentDescriptor descriptor, @NotNull Executor executor) {
if (!(executor instanceof DefaultDebugExecutor)) {
return;
}
if (descriptor == null) {
return;
}
ProcessHandler handler = descriptor.getProcessHandler();
if (handler == null) {
return;
}
PyDataView.getInstance(project).updateTabs(handler);
}
@Override
public void contentRemoved(@Nullable RunContentDescriptor descriptor, @NotNull Executor executor) {
}
});
addPythonConsoleListener(project);
((ToolWindowEx) toolWindow).setAdditionalGearActions(new DefaultActionGroup(new ColoredByDefaultAction()));
}
Aggregations