Search in sources :

Example 26 with ConfigurationContext

use of com.intellij.execution.actions.ConfigurationContext in project intellij-plugins by JetBrains.

the class CfmlRunConfigurationTest method getContextRunConfiguration.

private static CfmlRunConfiguration getContextRunConfiguration(Editor editor) {
    final DataContext dataContext = DataManager.getInstance().getDataContext(editor.getComponent());
    final ConfigurationContext configurationContext = ConfigurationContext.getFromContext(dataContext);
    //this block emulates RunContextAction.perform()
    RunnerAndConfigurationSettings configuration = configurationContext.findExisting();
    if (configuration == null) {
        configuration = configurationContext.getConfiguration();
        if (configuration == null) {
            return null;
        }
        ((RunManagerEx) configurationContext.getRunManager()).setTemporaryConfiguration(configuration);
    }
    //end of the emulated block
    return (CfmlRunConfiguration) configuration.getConfiguration();
}
Also used : ConfigurationContext(com.intellij.execution.actions.ConfigurationContext) RunManagerEx(com.intellij.execution.RunManagerEx) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) CfmlRunConfiguration(com.intellij.coldFusion.UI.runner.CfmlRunConfiguration)

Aggregations

ConfigurationContext (com.intellij.execution.actions.ConfigurationContext)26 PsiFile (com.intellij.psi.PsiFile)9 PsiElement (com.intellij.psi.PsiElement)7 GotestRunConfigurationProducer (com.goide.runconfig.testing.frameworks.gotest.GotestRunConfigurationProducer)5 ConfigurationFromContext (com.intellij.execution.actions.ConfigurationFromContext)5 InheritorChooser (com.intellij.execution.junit.InheritorChooser)5 List (java.util.List)5 RunConfigurationProducer (com.intellij.execution.actions.RunConfigurationProducer)4 Project (com.intellij.openapi.project.Project)4 Location (com.intellij.execution.Location)3 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)3 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)3 MethodLocation (com.intellij.execution.junit2.info.MethodLocation)3 ExternalSystemRunConfiguration (com.intellij.openapi.externalSystem.service.execution.ExternalSystemRunConfiguration)3 PsiClass (com.intellij.psi.PsiClass)3 PsiMethod (com.intellij.psi.PsiMethod)3 GoApplicationConfiguration (com.goide.runconfig.application.GoApplicationConfiguration)2 GoApplicationRunConfigurationProducer (com.goide.runconfig.application.GoApplicationRunConfigurationProducer)2 GoRunFileConfiguration (com.goide.runconfig.file.GoRunFileConfiguration)2 GoRunFileConfigurationProducer (com.goide.runconfig.file.GoRunFileConfigurationProducer)2