use of com.intellij.execution.RunnerAndConfigurationSettings in project intellij-community by JetBrains.
the class ConfigurationSettingsEditorWrapper method doApply.
private void doApply(final RunnerAndConfigurationSettings settings) {
final RunConfiguration runConfiguration = settings.getConfiguration();
final RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(runConfiguration.getProject());
runManager.setBeforeRunTasks(runConfiguration, myBeforeRunStepsPanel.getTasks(true), false);
RunnerAndConfigurationSettings runManagerSettings = runManager.getSettings(runConfiguration);
if (runManagerSettings != null) {
runManagerSettings.setEditBeforeRun(myBeforeRunStepsPanel.needEditBeforeRun());
runManagerSettings.setActivateToolWindowBeforeRun(myBeforeRunStepsPanel.needActivateToolWindowBeforeRun());
} else {
settings.setEditBeforeRun(myBeforeRunStepsPanel.needEditBeforeRun());
settings.setActivateToolWindowBeforeRun(myBeforeRunStepsPanel.needActivateToolWindowBeforeRun());
}
}
use of com.intellij.execution.RunnerAndConfigurationSettings in project intellij-community by JetBrains.
the class CompoundRunConfigurationSettingsEditor method canBeAdded.
private boolean canBeAdded(@NotNull RunConfiguration candidate, @NotNull final CompoundRunConfiguration root) {
if (candidate.getType() == root.getType() && candidate.getName().equals(root.getName()))
return false;
List<BeforeRunTask> tasks = myRunManager.getBeforeRunTasks(candidate);
for (BeforeRunTask task : tasks) {
if (task instanceof RunConfigurationBeforeRunProvider.RunConfigurableBeforeRunTask) {
RunConfigurationBeforeRunProvider.RunConfigurableBeforeRunTask runTask = (RunConfigurationBeforeRunProvider.RunConfigurableBeforeRunTask) task;
RunnerAndConfigurationSettings settings = runTask.getSettings();
if (settings != null) {
if (!canBeAdded(settings.getConfiguration(), root))
return false;
}
}
}
if (candidate instanceof CompoundRunConfiguration) {
Set<RunConfiguration> set = ((CompoundRunConfiguration) candidate).getSetToRun();
for (RunConfiguration configuration : set) {
if (!canBeAdded(configuration, root))
return false;
}
}
return true;
}
use of com.intellij.execution.RunnerAndConfigurationSettings in project intellij-community by JetBrains.
the class BaseRunConfigurationAction method canBePerformed.
@Override
public boolean canBePerformed(DataContext dataContext) {
Project project = CommonDataKeys.PROJECT.getData(dataContext);
if (project != null && DumbService.isDumb(project)) {
return false;
}
final ConfigurationContext context = ConfigurationContext.getFromContext(dataContext);
final RunnerAndConfigurationSettings existing = context.findExisting();
if (existing == null) {
final List<ConfigurationFromContext> fromContext = getConfigurationsFromContext(context);
return fromContext.size() <= 1;
}
return true;
}
use of com.intellij.execution.RunnerAndConfigurationSettings in project intellij-community by JetBrains.
the class BaseRunConfigurationAction method perform.
private void perform(final ConfigurationFromContext configurationFromContext, final ConfigurationContext context) {
RunnerAndConfigurationSettings configurationSettings = configurationFromContext.getConfigurationSettings();
context.setConfiguration(configurationSettings);
configurationFromContext.onFirstRun(context, () -> perform(context));
}
use of com.intellij.execution.RunnerAndConfigurationSettings in project intellij-community by JetBrains.
the class BaseRunConfigurationAction method update.
@Override
public void update(final AnActionEvent event) {
final ConfigurationContext context = ConfigurationContext.getFromContext(event.getDataContext());
final Presentation presentation = event.getPresentation();
final RunnerAndConfigurationSettings existing = context.findExisting();
RunnerAndConfigurationSettings configuration = existing;
if (configuration == null) {
configuration = context.getConfiguration();
}
if (configuration == null) {
presentation.setEnabled(false);
presentation.setVisible(false);
} else {
presentation.setEnabled(true);
presentation.setVisible(true);
final List<ConfigurationFromContext> fromContext = getConfigurationsFromContext(context);
if (existing == null && !fromContext.isEmpty()) {
//todo[nik,anna] it's dirty fix. Otherwise wrong configuration will be returned from context.getConfiguration()
context.setConfiguration(fromContext.get(0).getConfigurationSettings());
}
final String name = suggestRunActionName((LocatableConfiguration) configuration.getConfiguration());
updatePresentation(presentation, existing != null || fromContext.size() <= 1 ? name : "", context);
}
}
Aggregations