use of com.intellij.execution.ui.RunContentDescriptor in project intellij-community by JetBrains.
the class RunDashboardManagerImpl method getRunConfigurations.
@Override
public List<Pair<RunnerAndConfigurationSettings, RunContentDescriptor>> getRunConfigurations() {
List<Pair<RunnerAndConfigurationSettings, RunContentDescriptor>> result = new ArrayList<>();
List<RunnerAndConfigurationSettings> configurations = RunManager.getInstance(myProject).getAllSettings().stream().filter(runConfiguration -> RunDashboardContributor.isShowInDashboard(runConfiguration.getType())).collect(Collectors.toList());
//noinspection ConstantConditions ???
ExecutionManagerImpl executionManager = ExecutionManagerImpl.getInstance(myProject);
configurations.forEach(configurationSettings -> {
List<RunContentDescriptor> descriptors = executionManager.getDescriptors(settings -> Comparing.equal(settings.getConfiguration(), configurationSettings.getConfiguration()));
if (descriptors.isEmpty()) {
result.add(Pair.create(configurationSettings, null));
} else {
descriptors.forEach(descriptor -> result.add(Pair.create(configurationSettings, descriptor)));
}
});
// It is possible that run configuration was deleted, but there is running content descriptor for such run configuration.
// It should be shown in he dashboard tree.
List<RunConfiguration> storedConfigurations = configurations.stream().map(RunnerAndConfigurationSettings::getConfiguration).collect(Collectors.toList());
List<RunContentDescriptor> notStoredDescriptors = executionManager.getRunningDescriptors(settings -> {
RunConfiguration configuration = settings.getConfiguration();
return RunDashboardContributor.isShowInDashboard(settings.getType()) && !storedConfigurations.contains(configuration);
});
notStoredDescriptors.forEach(descriptor -> {
Set<RunnerAndConfigurationSettings> settings = executionManager.getConfigurations(descriptor);
settings.forEach(setting -> result.add(Pair.create(setting, descriptor)));
});
return result;
}
use of com.intellij.execution.ui.RunContentDescriptor in project intellij-community by JetBrains.
the class ExecutorAction method doActionPerformed.
@Override
protected void doActionPerformed(DashboardRunConfigurationNode node) {
RunContentDescriptor descriptor = node.getDescriptor();
ExecutionManager.getInstance(node.getProject()).restartRunProfile(node.getProject(), getExecutor(), ExecutionTargetManager.getActiveTarget(node.getProject()), node.getConfigurationSettings(), descriptor == null ? null : descriptor.getProcessHandler());
}
use of com.intellij.execution.ui.RunContentDescriptor in project intellij-community by JetBrains.
the class EOFAction method update.
@Override
public void update(AnActionEvent e) {
RunContentDescriptor descriptor = StopAction.getRecentlyStartedContentDescriptor(e.getDataContext());
ProcessHandler handler = descriptor != null ? descriptor.getProcessHandler() : null;
e.getPresentation().setEnabledAndVisible(e.getData(LangDataKeys.CONSOLE_VIEW) != null && e.getData(CommonDataKeys.EDITOR) != null && handler != null && !handler.isProcessTerminated());
}
use of com.intellij.execution.ui.RunContentDescriptor in project intellij-community by JetBrains.
the class ExecutionManagerTest method getProcessHandler.
@NotNull
private static FakeProcessHandler getProcessHandler(@NotNull ExecutionManagerImpl executionManager) {
RunContentDescriptor descriptor = ExecutionTestUtil.getSingleRunContentDescriptor(executionManager);
ProcessHandler processHandler = descriptor.getProcessHandler();
assertNotNull(processHandler);
return (FakeProcessHandler) processHandler;
}
use of com.intellij.execution.ui.RunContentDescriptor in project intellij-community by JetBrains.
the class ExecutionTestUtil method getSingleRunContentDescriptor.
@NotNull
public static RunContentDescriptor getSingleRunContentDescriptor(@NotNull ExecutionManager executionManager) {
List<RunContentDescriptor> descriptors = ((ExecutionManagerImpl) executionManager).getRunningDescriptors(Conditions.alwaysTrue());
String actualDescriptorsMsg = stringifyDescriptors(descriptors);
Assert.assertEquals(actualDescriptorsMsg, 1, descriptors.size());
RunContentDescriptor descriptor = ContainerUtil.getFirstItem(descriptors);
return ObjectUtils.notNull(descriptor);
}
Aggregations