use of com.intellij.execution.configurations.RunConfiguration in project intellij-community by JetBrains.
the class RunDialog method editConfiguration.
public static boolean editConfiguration(final Project project, final RunnerAndConfigurationSettings configuration, final String title, @Nullable final Executor executor) {
final SingleConfigurationConfigurable<RunConfiguration> configurable = SingleConfigurationConfigurable.editSettings(configuration, executor);
final SingleConfigurableEditor dialog = new SingleConfigurableEditor(project, configurable, IdeModalityType.IDE) {
{
if (executor != null)
setOKButtonText(executor.getActionName());
if (executor != null)
setOKButtonIcon(executor.getIcon());
}
};
dialog.setTitle(title);
return dialog.showAndGet();
}
use of com.intellij.execution.configurations.RunConfiguration in project intellij-community by JetBrains.
the class BeforeRunStepsPanel method getAllRunBeforeRuns.
private void getAllRunBeforeRuns(BeforeRunTask task, Set<RunConfiguration> configurationSet) {
if (task instanceof RunConfigurationBeforeRunProvider.RunConfigurableBeforeRunTask) {
RunConfigurationBeforeRunProvider.RunConfigurableBeforeRunTask runTask = (RunConfigurationBeforeRunProvider.RunConfigurableBeforeRunTask) task;
RunConfiguration configuration = runTask.getSettings().getConfiguration();
List<BeforeRunTask> tasks = RunManagerImpl.getInstanceImpl(configuration.getProject()).getBeforeRunTasks(configuration);
for (BeforeRunTask beforeRunTask : tasks) {
if (beforeRunTask instanceof RunConfigurationBeforeRunProvider.RunConfigurableBeforeRunTask) {
if (configurationSet.add(((RunConfigurationBeforeRunProvider.RunConfigurableBeforeRunTask) beforeRunTask).getSettings().getConfiguration()))
getAllRunBeforeRuns(beforeRunTask, configurationSet);
}
}
}
}
use of com.intellij.execution.configurations.RunConfiguration in project intellij-community by JetBrains.
the class BeforeRunStepsPanel method doAddAction.
void doAddAction(AnActionButton button) {
if (isUnknown()) {
return;
}
final JBPopupFactory popupFactory = JBPopupFactory.getInstance();
final BeforeRunTaskProvider<BeforeRunTask>[] providers = Extensions.getExtensions(BeforeRunTaskProvider.EXTENSION_POINT_NAME, myRunConfiguration.getProject());
Set<Key> activeProviderKeys = getActiveProviderKeys();
DefaultActionGroup actionGroup = new DefaultActionGroup(null, false);
for (final BeforeRunTaskProvider<BeforeRunTask> provider : providers) {
if (provider.createTask(myRunConfiguration) == null)
continue;
if (activeProviderKeys.contains(provider.getId()) && provider.isSingleton())
continue;
AnAction providerAction = new AnAction(provider.getName(), null, provider.getIcon()) {
@Override
public void actionPerformed(AnActionEvent e) {
BeforeRunTask task = provider.createTask(myRunConfiguration);
if (task != null) {
provider.configureTask(myRunConfiguration, task);
if (!provider.canExecuteTask(myRunConfiguration, task))
return;
} else {
return;
}
task.setEnabled(true);
Set<RunConfiguration> configurationSet = new HashSet<>();
getAllRunBeforeRuns(task, configurationSet);
if (configurationSet.contains(myRunConfiguration)) {
JOptionPane.showMessageDialog(BeforeRunStepsPanel.this, ExecutionBundle.message("before.launch.panel.cyclic_dependency_warning", myRunConfiguration.getName(), provider.getDescription(task)), ExecutionBundle.message("warning.common.title"), JOptionPane.WARNING_MESSAGE);
return;
}
addTask(task);
myListener.fireStepsBeforeRunChanged();
}
};
actionGroup.add(providerAction);
}
final ListPopup popup = popupFactory.createActionGroupPopup(ExecutionBundle.message("add.new.run.configuration.acrtion.name"), actionGroup, SimpleDataContext.getProjectContext(myRunConfiguration.getProject()), false, false, false, null, -1, Conditions.<AnAction>alwaysTrue());
popup.show(button.getPreferredPopupPoint());
}
use of com.intellij.execution.configurations.RunConfiguration in project intellij-community by JetBrains.
the class AbstractRunConfigurationTypeUsagesCollector method getProjectUsages.
@NotNull
@Override
public final Set<UsageDescriptor> getProjectUsages(@NotNull final Project project) {
final Set<String> runConfigurationTypes = new HashSet<>();
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
@Override
public void run() {
if (project.isDisposed())
return;
final RunManager runManager = RunManager.getInstance(project);
for (RunnerAndConfigurationSettings settings : runManager.getAllSettings()) {
RunConfiguration runConfiguration = settings.getConfiguration();
if (runConfiguration != null && isApplicable(runManager, settings)) {
final ConfigurationFactory configurationFactory = runConfiguration.getFactory();
final ConfigurationType configurationType = configurationFactory.getType();
final StringBuilder keyBuilder = new StringBuilder();
keyBuilder.append(configurationType.getId());
if (configurationType.getConfigurationFactories().length > 1) {
keyBuilder.append(".").append(configurationFactory.getName());
}
runConfigurationTypes.add(keyBuilder.toString());
}
}
}
});
return ContainerUtil.map2Set(runConfigurationTypes, runConfigurationType -> new UsageDescriptor(runConfigurationType, 1));
}
use of com.intellij.execution.configurations.RunConfiguration in project intellij-community by JetBrains.
the class ModuleRunConfigurationManager method readExternal.
public void readExternal(@NotNull final Element element) {
LOG.debug("readExternal(" + myModule + ")");
myUnloadedElements = null;
final Set<String> existing = new HashSet<>();
for (final Element child : element.getChildren()) {
final RunnerAndConfigurationSettings configuration = myManager.loadConfiguration(child, true);
if (configuration == null && Comparing.strEqual(element.getName(), RunManagerImpl.CONFIGURATION)) {
if (myUnloadedElements == null)
myUnloadedElements = new ArrayList<>(2);
myUnloadedElements.add(element);
}
if (configuration != null) {
existing.add(configuration.getUniqueID());
}
}
for (final RunConfiguration configuration : myManager.getAllConfigurationsList()) {
if (!usesMyModule(configuration)) {
RunnerAndConfigurationSettings settings = myManager.getSettings(configuration);
if (settings != null) {
existing.add(settings.getUniqueID());
}
}
}
myManager.removeNotExistingSharedConfigurations(existing);
// IDEA-60004: configs may never be sorted before write, so call it manually after shared configs read
myManager.setOrdered(false);
myManager.getSortedConfigurations();
}
Aggregations