use of com.intellij.execution.RunnerAndConfigurationSettings in project intellij-community by JetBrains.
the class BaseRunConfigurationAction method getChildren.
private AnAction[] getChildren(DataContext dataContext) {
final ConfigurationContext context = ConfigurationContext.getFromContext(dataContext);
final RunnerAndConfigurationSettings existing = context.findExisting();
if (existing == null) {
final List<ConfigurationFromContext> producers = getConfigurationsFromContext(context);
if (producers.size() > 1) {
final AnAction[] children = new AnAction[producers.size()];
int childIdx = 0;
for (final ConfigurationFromContext fromContext : producers) {
final ConfigurationType configurationType = fromContext.getConfigurationType();
final RunConfiguration configuration = fromContext.getConfiguration();
final String actionName = childActionName(configurationType, configuration);
final AnAction anAction = new AnAction(actionName, configurationType.getDisplayName(), configuration.getIcon()) {
@Override
public void actionPerformed(AnActionEvent e) {
perform(fromContext, context);
}
};
anAction.getTemplatePresentation().setText(actionName, false);
children[childIdx++] = anAction;
}
return children;
}
}
return EMPTY_ARRAY;
}
use of com.intellij.execution.RunnerAndConfigurationSettings in project intellij-community by JetBrains.
the class CreateAction method choosePolicy.
private static BaseCreatePolicy choosePolicy(final ConfigurationContext context) {
final RunnerAndConfigurationSettings configuration = context.findExisting();
if (configuration == null)
return CREATE_AND_EDIT;
final RunManager runManager = context.getRunManager();
if (runManager.getSelectedConfiguration() != configuration)
return SELECT;
if (configuration.isTemporary())
return SAVE;
return SELECTED_STABLE;
}
use of com.intellij.execution.RunnerAndConfigurationSettings in project intellij-community by JetBrains.
the class CopyConfigurationAction method doActionPerformed.
@Override
@SuppressWarnings("unchecked")
protected void doActionPerformed(DashboardRunConfigurationNode node) {
RunManagerEx runManager = RunManagerEx.getInstanceEx(node.getProject());
RunnerAndConfigurationSettings settings = node.getConfigurationSettings();
RunnerAndConfigurationSettings copiedSettings = ((RunnerAndConfigurationSettingsImpl) settings).clone();
runManager.setUniqueNameIfNeed(copiedSettings);
copiedSettings.setFolderName(settings.getFolderName());
final ConfigurationFactory factory = settings.getFactory();
if (factory instanceof ConfigurationFactoryEx) {
((ConfigurationFactoryEx) factory).onConfigurationCopied(settings.getConfiguration());
}
if (RunDialog.editConfiguration(node.getProject(), copiedSettings, ExecutionBundle.message("run.dashboard.edit.configuration.dialog.title"))) {
runManager.addConfiguration(copiedSettings, runManager.isConfigurationShared(settings), runManager.getBeforeRunTasks(settings.getConfiguration()), false);
}
}
use of com.intellij.execution.RunnerAndConfigurationSettings in project intellij-community by JetBrains.
the class RunConfigurationNode method update.
@Override
protected void update(PresentationData presentation) {
RunnerAndConfigurationSettings configurationSettings = getConfigurationSettings();
boolean isStored = RunManager.getInstance(getProject()).getAllConfigurationsList().contains(configurationSettings.getConfiguration());
presentation.addText(configurationSettings.getName(), isStored ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.GRAY_ATTRIBUTES);
RunDashboardContributor contributor = RunDashboardContributor.getContributor(configurationSettings.getType());
Icon icon = null;
if (contributor != null) {
DashboardRunConfigurationStatus status = contributor.getStatus(this);
if (DashboardRunConfigurationStatus.STARTED.equals(status)) {
icon = getExecutorIcon();
} else if (DashboardRunConfigurationStatus.FAILED.equals(status)) {
icon = status.getIcon();
}
}
if (icon == null) {
icon = RunManagerEx.getInstanceEx(getProject()).getConfigurationIcon(configurationSettings);
}
presentation.setIcon(isStored ? icon : IconLoader.getDisabledIcon(icon));
if (contributor != null) {
contributor.updatePresentation(presentation, this);
}
}
use of com.intellij.execution.RunnerAndConfigurationSettings in project intellij-community by JetBrains.
the class CompoundRunConfigurationSettingsEditor method createEditor.
@NotNull
@Override
protected JComponent createEditor() {
final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myList);
return decorator.disableUpDownActions().setAddAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
final List<RunConfiguration> all = new ArrayList<>();
for (ConfigurationType type : myRunManager.getConfigurationFactories()) {
if (!(type instanceof UnknownConfigurationType)) {
for (RunnerAndConfigurationSettings settings : myRunManager.getConfigurationSettingsList(type)) {
all.add(settings.getConfiguration());
}
}
}
final List<RunConfiguration> configurations = ContainerUtil.filter(all, configuration -> !mySnapshot.getSetToRun().contains(configuration) && canBeAdded(configuration, mySnapshot));
JBPopupFactory.getInstance().createListPopup(new MultiSelectionListPopupStep<RunConfiguration>(null, configurations) {
@Nullable
@Override
public ListSeparator getSeparatorAbove(RunConfiguration value) {
int i = configurations.indexOf(value);
if (i < 1)
return null;
RunConfiguration previous = configurations.get(i - 1);
return value.getType() != previous.getType() ? new ListSeparator() : null;
}
@Override
public Icon getIconFor(RunConfiguration value) {
return value.getType().getIcon();
}
@Override
public boolean isSpeedSearchEnabled() {
return true;
}
@NotNull
@Override
public String getTextFor(RunConfiguration value) {
return value.getName();
}
@Override
public PopupStep<?> onChosen(List<RunConfiguration> selectedValues, boolean finalChoice) {
myList.clearSelection();
myModel.addAll(selectedValues);
return FINAL_CHOICE;
}
}).showUnderneathOf(decorator.getActionsPanel());
}
}).setEditAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
int index = myList.getSelectedIndex();
if (index == -1)
return;
RunConfiguration configuration = myModel.get(index);
RunConfigurationSelector selector = RunConfigurationSelector.KEY.getData(DataManager.getInstance().getDataContext(button.getContextComponent()));
if (selector != null) {
selector.select(configuration);
}
}
}).setToolbarPosition(ActionToolbarPosition.TOP).createPanel();
}
Aggregations