use of com.intellij.execution.configurations.ConfigurationType in project intellij-community by JetBrains.
the class DumpConfigurationTypesAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final Project project = e.getProject();
final ConfigurationType[] factories = RunManager.getInstance(project).getConfigurationFactories();
for (ConfigurationType factory : factories) {
System.out.println(factory.getDisplayName() + " : " + factory.getId());
}
}
use of com.intellij.execution.configurations.ConfigurationType in project intellij-community by JetBrains.
the class BaseExecuteBeforeRunDialog method buildNodes.
private DefaultMutableTreeNode buildNodes() {
DefaultMutableTreeNode root = new DefaultMutableTreeNode(new Descriptor());
RunManager runManager = RunManager.getInstance(myProject);
final ConfigurationType[] configTypes = runManager.getConfigurationFactories();
for (final ConfigurationType type : configTypes) {
final Icon icon = type.getIcon();
DefaultMutableTreeNode typeNode = new DefaultMutableTreeNode(new ConfigurationTypeDescriptor(type, icon, isConfigurationAssigned(type)));
root.add(typeNode);
final Set<String> addedNames = StringSetSpinAllocator.alloc();
try {
List<RunConfiguration> configurations = runManager.getConfigurationsList(type);
for (final RunConfiguration configuration : configurations) {
final String configurationName = configuration.getName();
if (addedNames.contains(configurationName)) {
// add only the first configuration if more than one has the same name
continue;
}
addedNames.add(configurationName);
typeNode.add(new DefaultMutableTreeNode(new ConfigurationDescriptor(configuration, isConfigurationAssigned(configuration))));
}
} finally {
StringSetSpinAllocator.dispose(addedNames);
}
}
return root;
}
use of com.intellij.execution.configurations.ConfigurationType in project intellij-community by JetBrains.
the class ProjectStartupConfigurable method createNewWrapper.
private ChooseRunConfigurationPopup.ItemWrapper<Void> createNewWrapper(final AnActionButton button) {
return new ChooseRunConfigurationPopup.ItemWrapper<Void>(null) {
@Override
public Icon getIcon() {
return IconUtil.getAddIcon();
}
@Override
public String getText() {
return UIUtil.removeMnemonic(ExecutionBundle.message("add.new.run.configuration.acrtion.name"));
}
@Override
public void perform(@NotNull final Project project, @NotNull final Executor executor, @NotNull DataContext context) {
final RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(project);
final ConfigurationType[] factories = runManager.getConfigurationFactories();
final Condition<ConfigurationType> filter = new Condition<ConfigurationType>() {
private final RunnerRegistry myRegistry = RunnerRegistry.getInstance();
@Override
public boolean value(ConfigurationType configurationType) {
ConfigurationFactory factory;
return !UnknownConfigurationType.INSTANCE.equals(configurationType) && ((factory = runManager.getFactory(configurationType.getId(), null)) != null) && myRegistry.getRunner(executor.getId(), runManager.getConfigurationTemplate(factory).getConfiguration()) != null;
}
};
final List<ConfigurationType> factoriesList = ContainerUtil.filter(Arrays.asList(factories), filter);
final ListPopup popup = NewRunConfigurationPopup.createAddPopup(factoriesList, "", factory -> ApplicationManager.getApplication().invokeLater(() -> {
final EditConfigurationsDialog dialog = new EditConfigurationsDialog(project, factory);
if (dialog.showAndGet()) {
ApplicationManager.getApplication().invokeLater(() -> {
RunnerAndConfigurationSettings configuration = RunManager.getInstance(project).getSelectedConfiguration();
if (configuration != null) {
addConfiguration(configuration);
}
}, ModalityState.any(), project.getDisposed());
}
}, ModalityState.any(), project.getDisposed()), null, EmptyRunnable.getInstance(), false);
showPopup(button, popup);
}
@Override
public boolean available(Executor executor) {
return true;
}
};
}
use of com.intellij.execution.configurations.ConfigurationType in project android by JetBrains.
the class AndroidStudioInitializer method disableIdeaJUnitConfigurations.
// JUnit original Extension JUnitConfigurationType is disabled so it can be replaced by its child class AndroidJUnitConfigurationType
private static void disableIdeaJUnitConfigurations() {
// First we unregister the ConfigurationProducers, and after the ConfigurationType
ExtensionPoint<RunConfigurationProducer> configurationProducerExtensionPoint = Extensions.getRootArea().getExtensionPoint(RunConfigurationProducer.EP_NAME);
for (RunConfigurationProducer runConfigurationProducer : configurationProducerExtensionPoint.getExtensions()) {
if (runConfigurationProducer instanceof JUnitConfigurationProducer && !(runConfigurationProducer instanceof AndroidJUnitConfigurationProducer)) {
// In AndroidStudio these ConfigurationProducer s are replaced
configurationProducerExtensionPoint.unregisterExtension(runConfigurationProducer);
}
}
ExtensionPoint<ConfigurationType> configurationTypeExtensionPoint = Extensions.getRootArea().getExtensionPoint(ConfigurationType.CONFIGURATION_TYPE_EP);
for (ConfigurationType configurationType : configurationTypeExtensionPoint.getExtensions()) {
if (configurationType instanceof JUnitConfigurationType && !(configurationType instanceof AndroidJUnitConfigurationType)) {
// In Android Studio the user is forced to use AndroidJUnitConfigurationType instead of JUnitConfigurationType
configurationTypeExtensionPoint.unregisterExtension(configurationType);
}
}
// We hide actions registered by the JUnit plugin and instead we use those registered in android-junit.xml
hideAction("excludeFromSuite");
hideAction("AddToISuite");
}
use of com.intellij.execution.configurations.ConfigurationType in project android by JetBrains.
the class PostSyncProjectSetup method setMakeStepInJunitRunConfigurations.
private void setMakeStepInJunitRunConfigurations(@NotNull String makeTaskName) {
ConfigurationType junitConfigurationType = AndroidJUnitConfigurationType.getInstance();
BeforeRunTaskProvider<BeforeRunTask>[] taskProviders = Extensions.getExtensions(BeforeRunTaskProvider.EXTENSION_POINT_NAME, myProject);
BeforeRunTaskProvider targetProvider = null;
for (BeforeRunTaskProvider<? extends BeforeRunTask> provider : taskProviders) {
if (makeTaskName.equals(provider.getName())) {
targetProvider = provider;
break;
}
}
if (targetProvider != null) {
RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(myProject);
// Set the correct "Make step" in the "JUnit Run Configuration" template.
for (ConfigurationFactory configurationFactory : junitConfigurationType.getConfigurationFactories()) {
RunnerAndConfigurationSettings template = runManager.getConfigurationTemplate(configurationFactory);
RunConfiguration runConfiguration = template.getConfiguration();
setMakeStepInJUnitConfiguration(targetProvider, runConfiguration);
}
// Set the correct "Make step" in existing JUnit Configurations.
for (RunConfiguration runConfiguration : runManager.getConfigurationsList(junitConfigurationType)) {
setMakeStepInJUnitConfiguration(targetProvider, runConfiguration);
}
}
}
Aggregations