Search in sources :

Example 1 with JUnitConfigurationProducer

use of com.intellij.execution.junit.JUnitConfigurationProducer 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");
}
Also used : ConfigurationType(com.intellij.execution.configurations.ConfigurationType) AndroidJUnitConfigurationType(com.android.tools.idea.testartifacts.junit.AndroidJUnitConfigurationType) JUnitConfigurationType(com.intellij.execution.junit.JUnitConfigurationType) RunConfigurationProducer(com.intellij.execution.actions.RunConfigurationProducer) AndroidJUnitConfigurationType(com.android.tools.idea.testartifacts.junit.AndroidJUnitConfigurationType) AndroidJUnitConfigurationProducer(com.android.tools.idea.testartifacts.junit.AndroidJUnitConfigurationProducer) AndroidJUnitConfigurationType(com.android.tools.idea.testartifacts.junit.AndroidJUnitConfigurationType) JUnitConfigurationType(com.intellij.execution.junit.JUnitConfigurationType) JUnitConfigurationProducer(com.intellij.execution.junit.JUnitConfigurationProducer) AndroidJUnitConfigurationProducer(com.android.tools.idea.testartifacts.junit.AndroidJUnitConfigurationProducer)

Aggregations

AndroidJUnitConfigurationProducer (com.android.tools.idea.testartifacts.junit.AndroidJUnitConfigurationProducer)1 AndroidJUnitConfigurationType (com.android.tools.idea.testartifacts.junit.AndroidJUnitConfigurationType)1 RunConfigurationProducer (com.intellij.execution.actions.RunConfigurationProducer)1 ConfigurationType (com.intellij.execution.configurations.ConfigurationType)1 JUnitConfigurationProducer (com.intellij.execution.junit.JUnitConfigurationProducer)1 JUnitConfigurationType (com.intellij.execution.junit.JUnitConfigurationType)1