use of com.intellij.execution.configurations.RunConfiguration in project intellij-community by JetBrains.
the class AntConfigurationImpl method convertToBeforeRunTask.
private static void convertToBeforeRunTask(Project project, String buildFileUrl, String targetName, String configType, String configName) {
if (buildFileUrl == null || targetName == null || configType == null) {
return;
}
final RunManagerImpl runManager = (RunManagerImpl) RunManagerEx.getInstanceEx(project);
final ConfigurationType type = runManager.getConfigurationType(configType);
if (type == null) {
return;
}
if (configName != null) {
for (RunConfiguration configuration : runManager.getConfigurationsList(type)) {
if (configName.equals(configuration.getName())) {
final List<AntBeforeRunTask> tasks = runManager.getBeforeRunTasks(configuration, AntBeforeRunTaskProvider.ID);
if (!tasks.isEmpty()) {
//This is legacy code, we had only one task that time
AntBeforeRunTask task = tasks.get(0);
task.setEnabled(true);
task.setTargetName(targetName);
task.setAntFileUrl(buildFileUrl);
}
}
}
} else {
for (ConfigurationFactory factory : type.getConfigurationFactories()) {
final RunConfiguration template = runManager.getConfigurationTemplate(factory).getConfiguration();
final List<AntBeforeRunTask> tasks = runManager.getBeforeRunTasks(template, AntBeforeRunTaskProvider.ID);
if (!tasks.isEmpty()) {
//This is legacy code, we had only one task that time
AntBeforeRunTask task = tasks.get(0);
task.setEnabled(true);
task.setTargetName(targetName);
task.setAntFileUrl(buildFileUrl);
}
}
}
}
use of com.intellij.execution.configurations.RunConfiguration in project intellij-community by JetBrains.
the class TestsUIUtil method getData.
@Nullable
public static Object getData(final AbstractTestProxy testProxy, final String dataId, final TestFrameworkRunningModel model) {
final TestConsoleProperties properties = model.getProperties();
final Project project = properties.getProject();
if (testProxy == null)
return null;
if (AbstractTestProxy.DATA_KEY.is(dataId))
return testProxy;
if (CommonDataKeys.NAVIGATABLE.is(dataId))
return getOpenFileDescriptor(testProxy, model);
if (CommonDataKeys.PSI_ELEMENT.is(dataId)) {
final Location location = testProxy.getLocation(project, properties.getScope());
if (location != null) {
final PsiElement element = location.getPsiElement();
return element.isValid() ? element : null;
} else {
return null;
}
}
if (Location.DATA_KEY.is(dataId))
return testProxy.getLocation(project, properties.getScope());
if (RunConfiguration.DATA_KEY.is(dataId)) {
final RunProfile configuration = properties.getConfiguration();
if (configuration instanceof RunConfiguration) {
return configuration;
}
}
return null;
}
use of com.intellij.execution.configurations.RunConfiguration in project intellij-community by JetBrains.
the class TemplateModuleBuilder method fixModuleName.
private void fixModuleName(Module module) {
List<RunConfiguration> configurations = RunManager.getInstance(module.getProject()).getAllConfigurationsList();
for (RunConfiguration configuration : configurations) {
if (configuration instanceof ModuleBasedConfiguration) {
((ModuleBasedConfiguration) configuration).getConfigurationModule().setModule(module);
}
}
ModifiableRootModel model = ModuleRootManager.getInstance(module).getModifiableModel();
for (WizardInputField field : myAdditionalFields) {
ProjectTemplateParameterFactory factory = WizardInputField.getFactoryById(field.getId());
factory.applyResult(field.getValue(), model);
}
model.commit();
}
use of com.intellij.execution.configurations.RunConfiguration in project intellij-community by JetBrains.
the class RunConfigurationRefactoringElementListenerProvider method getListener.
@Override
public RefactoringElementListener getListener(final PsiElement element) {
RefactoringElementListenerComposite composite = null;
final List<RunConfiguration> configurations = RunManager.getInstance(element.getProject()).getAllConfigurationsList();
for (RunConfiguration configuration : configurations) {
if (configuration instanceof RefactoringListenerProvider) {
// todo: perhaps better way to handle listeners?
RefactoringElementListener listener;
try {
listener = ((RefactoringListenerProvider) configuration).getRefactoringElementListener(element);
} catch (Exception e) {
LOG.error(e);
continue;
}
if (listener != null) {
if (configuration instanceof LocatableConfiguration) {
listener = new NameGeneratingListenerDecorator((LocatableConfiguration) configuration, listener);
}
if (composite == null) {
composite = new RefactoringElementListenerComposite();
}
composite.addListener(listener);
}
}
}
return composite;
}
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();
}
Aggregations