use of com.intellij.execution.actions.RunConfigurationProducer 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.actions.RunConfigurationProducer in project intellij-plugins by JetBrains.
the class CfmlRunConfigurationTest method getDefaultCfmlRunConfiguration.
public CfmlRunConfiguration getDefaultCfmlRunConfiguration() throws IOException {
final Project project = myFixture.getProject();
final Editor editor = openCfmFileInEditor(indexCfm);
final Presentation presentation = getPresentationForRunAction(editor);
assert editor != null;
final DataContext dataContext = DataManager.getInstance().getDataContext(editor.getComponent());
TestCase.assertEquals("Run 'index.cfm'", presentation.getText());
final ConfigurationContext configurationContext = ConfigurationContext.getFromContext(dataContext);
final List<RunConfigurationProducer<?>> producers = RunConfigurationProducer.getProducers(project);
List<ConfigurationFromContext> configs = new ArrayList<>();
for (RunConfigurationProducer<?> producer : producers) {
final ConfigurationFromContext configurationFromContext = producer.createConfigurationFromContext(configurationContext);
if (configurationFromContext != null)
configs.add(configurationFromContext);
}
TestCase.assertEquals(true, configs.size() == 1);
final ConfigurationFromContext defaultConfigurationFromContext = configs.get(0);
final RunConfiguration configuration = defaultConfigurationFromContext.getConfiguration();
TestCase.assertNotNull(configuration);
UsefulTestCase.assertInstanceOf(configuration, CfmlRunConfiguration.class);
return (CfmlRunConfiguration) configuration;
}
use of com.intellij.execution.actions.RunConfigurationProducer in project intellij-plugins by JetBrains.
the class JstdAssertionFrameworkLineMarkerProvider method execute.
private static void execute(@NotNull Executor executor, @NotNull final PsiElement element) {
Project project = element.getProject();
Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor();
if (editor == null) {
return;
}
DataContext dataContext = createDataContext(editor, element);
RunConfigurationProducer jstdOriginalProducer = getJstdRunConfigurationProducer();
ConfigurationContext context = ConfigurationContext.getFromContext(dataContext);
boolean created = false;
RunnerAndConfigurationSettings configuration = jstdOriginalProducer.findExistingConfiguration(context);
if (configuration == null) {
created = true;
ConfigurationFromContext fromContext = jstdOriginalProducer.createConfigurationFromContext(context);
if (fromContext != null) {
configuration = fromContext.getConfigurationSettings();
} else {
return;
}
}
execute(project, executor, configuration, created);
}
use of com.intellij.execution.actions.RunConfigurationProducer in project intellij-community by JetBrains.
the class BaseConfigurationTestCase method createJUnitConfiguration.
protected JUnitConfiguration createJUnitConfiguration(@NotNull PsiElement psiElement, @NotNull Class<? extends AbstractJavaTestConfigurationProducer> producerClass, @NotNull MapDataContext dataContext) {
ConfigurationContext context = createContext(psiElement, dataContext);
RunConfigurationProducer producer = RunConfigurationProducer.getInstance(producerClass);
assert producer != null;
ConfigurationFromContext fromContext = producer.createConfigurationFromContext(context);
assertNotNull(fromContext);
return (JUnitConfiguration) fromContext.getConfiguration();
}
Aggregations