use of com.intellij.execution.impl.ExecutionManagerImpl 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.impl.ExecutionManagerImpl in project intellij-community by JetBrains.
the class CompoundRunConfiguration method hasRunningSingletones.
protected boolean hasRunningSingletones() {
Project project = getProject();
if (project.isDisposed())
return false;
final ExecutionManagerImpl executionManager = ExecutionManagerImpl.getInstance(project);
return executionManager.getRunningDescriptors(s -> {
RunManagerImpl manager = RunManagerImpl.getInstanceImpl(project);
for (RunConfiguration runConfiguration : mySetToRun) {
if (runConfiguration instanceof CompoundRunConfiguration && ((CompoundRunConfiguration) runConfiguration).hasRunningSingletones()) {
return true;
}
RunnerAndConfigurationSettings settings = manager.findConfigurationByTypeAndName(runConfiguration.getType().getId(), runConfiguration.getName());
if (settings != null && settings.isSingleton() && runConfiguration.equals(s.getConfiguration())) {
return true;
}
}
return false;
}).size() > 0;
}
use of com.intellij.execution.impl.ExecutionManagerImpl in project intellij-community by JetBrains.
the class RunConfigurationsComboBoxAction method setConfigurationIcon.
private static void setConfigurationIcon(final Presentation presentation, final RunnerAndConfigurationSettings settings, final Project project) {
try {
Icon icon = RunManagerEx.getInstanceEx(project).getConfigurationIcon(settings);
ExecutionManagerImpl executionManager = ExecutionManagerImpl.getInstance(project);
List<RunContentDescriptor> runningDescriptors = executionManager.getRunningDescriptors(s -> s == settings);
if (runningDescriptors.size() == 1) {
icon = ExecutionUtil.getLiveIndicator(icon);
}
if (runningDescriptors.size() > 1) {
icon = IconUtil.addText(icon, String.valueOf(runningDescriptors.size()));
}
presentation.setIcon(icon);
} catch (IndexNotReadyException ignored) {
}
}
use of com.intellij.execution.impl.ExecutionManagerImpl in project intellij-community by JetBrains.
the class ShowRunningListAction method getCurrentState.
private static Pair<? extends JComponent, String> getCurrentState(@NotNull List<Project> projects) {
NonOpaquePanel panel = new NonOpaquePanel(new GridLayout(0, 1, 10, 10));
StringBuilder state = new StringBuilder();
for (int i = 0; i < projects.size(); i++) {
Project project = projects.get(i);
final ExecutionManagerImpl executionManager = ExecutionManagerImpl.getInstance(project);
List<RunContentDescriptor> runningDescriptors = executionManager.getRunningDescriptors(Condition.TRUE);
if (!runningDescriptors.isEmpty() && projects.size() > 1) {
state.append(project.getName());
panel.add(new JLabel("<html><body><b>Project '" + project.getName() + "'</b></body></html>"));
}
for (RunContentDescriptor descriptor : runningDescriptors) {
Set<Executor> executors = executionManager.getExecutors(descriptor);
for (Executor executor : executors) {
state.append(System.identityHashCode(descriptor.getAttachedContent())).append("@").append(System.identityHashCode(executor.getIcon())).append(";");
ProcessHandler processHandler = descriptor.getProcessHandler();
Icon icon = (processHandler instanceof KillableProcess && processHandler.isProcessTerminating()) ? AllIcons.Debugger.KillProcess : executor.getIcon();
JLabel label = new JLabel("<html><body><a href=\"\">" + descriptor.getDisplayName() + "</a></body></html>", icon, SwingConstants.LEADING);
label.setIconTextGap(JBUI.scale(2));
label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
label.putClientProperty(KEY, Trinity.create(project, executor, descriptor));
panel.add(label);
}
}
}
if (panel.getComponentCount() == 0) {
panel.setBorder(JBUI.Borders.empty(10));
panel.add(new JLabel(ExecutionBundle.message("show.running.list.balloon.nothing"), SwingConstants.CENTER));
} else {
panel.setBorder(JBUI.Borders.empty(10, 10, 0, 10));
JLabel label = new JLabel(ExecutionBundle.message("show.running.list.balloon.hint"));
label.setFont(JBUI.Fonts.miniFont());
panel.add(label);
}
return Pair.create(panel, state.toString());
}
Aggregations