Search in sources :

Example 1 with RuntimeConfigurationException

use of com.intellij.execution.configurations.RuntimeConfigurationException in project intellij-community by JetBrains.

the class TestNGTestClass method checkConfiguration.

@Override
public void checkConfiguration() throws RuntimeConfigurationException {
    final TestData data = myConfig.getPersistantData();
    final SourceScope scope = data.getScope().getSourceScope(myConfig);
    if (scope == null) {
        throw new RuntimeConfigurationException("Invalid scope specified");
    }
    final PsiManager manager = PsiManager.getInstance(myConfig.getProject());
    final PsiClass psiClass = ClassUtil.findPsiClass(manager, data.getMainClassName(), null, true, scope.getGlobalSearchScope());
    if (psiClass == null)
        throw new RuntimeConfigurationException("Class '" + data.getMainClassName() + "' not found");
}
Also used : SourceScope(com.intellij.execution.testframework.SourceScope) RuntimeConfigurationException(com.intellij.execution.configurations.RuntimeConfigurationException)

Example 2 with RuntimeConfigurationException

use of com.intellij.execution.configurations.RuntimeConfigurationException in project intellij-community by JetBrains.

the class TestNGTestMethod method checkConfiguration.

@Override
public void checkConfiguration() throws RuntimeConfigurationException {
    final TestData data = myConfig.getPersistantData();
    final SourceScope scope = data.getScope().getSourceScope(myConfig);
    if (scope == null) {
        throw new RuntimeConfigurationException("Invalid scope specified");
    }
    PsiClass psiClass = JavaPsiFacade.getInstance(myConfig.getProject()).findClass(data.getMainClassName(), scope.getGlobalSearchScope());
    if (psiClass == null)
        throw new RuntimeConfigurationException("Class '" + data.getMainClassName() + "' not found");
    PsiMethod[] methods = psiClass.findMethodsByName(data.getMethodName(), true);
    if (methods.length == 0) {
        throw new RuntimeConfigurationException("Method '" + data.getMethodName() + "' not found");
    }
    for (PsiMethod method : methods) {
        if (!method.hasModifierProperty(PsiModifier.PUBLIC)) {
            throw new RuntimeConfigurationException("Non public method '" + data.getMethodName() + "'specified");
        }
    }
}
Also used : SourceScope(com.intellij.execution.testframework.SourceScope) RuntimeConfigurationException(com.intellij.execution.configurations.RuntimeConfigurationException)

Example 3 with RuntimeConfigurationException

use of com.intellij.execution.configurations.RuntimeConfigurationException in project intellij-community by JetBrains.

the class TestNGTestPackage method checkConfiguration.

@Override
public void checkConfiguration() throws RuntimeConfigurationException {
    final TestData data = myConfig.getPersistantData();
    PsiPackage psiPackage = JavaPsiFacade.getInstance(myConfig.getProject()).findPackage(data.getPackageName());
    if (psiPackage == null)
        throw new RuntimeConfigurationException("Package '" + data.getPackageName() + "' not found");
}
Also used : RuntimeConfigurationException(com.intellij.execution.configurations.RuntimeConfigurationException)

Example 4 with RuntimeConfigurationException

use of com.intellij.execution.configurations.RuntimeConfigurationException in project intellij-community by JetBrains.

the class GantRunner method ensureRunnerConfigured.

@Override
public void ensureRunnerConfigured(@NotNull GroovyScriptRunConfiguration configuration) throws RuntimeConfigurationException {
    Project project = configuration.getProject();
    if (GantUtils.getSDKInstallPath(configuration.getModule(), project).isEmpty()) {
        RuntimeConfigurationException e = new RuntimeConfigurationException("Gant is not configured");
        e.setQuickFix(() -> ShowSettingsUtil.getInstance().editConfigurable(project, new GantConfigurable(project)));
        throw e;
    }
}
Also used : Project(com.intellij.openapi.project.Project) RuntimeConfigurationException(com.intellij.execution.configurations.RuntimeConfigurationException)

Example 5 with RuntimeConfigurationException

use of com.intellij.execution.configurations.RuntimeConfigurationException in project intellij-community by JetBrains.

the class DefaultGroovyScriptRunner method ensureRunnerConfigured.

@Override
public void ensureRunnerConfigured(@NotNull GroovyScriptRunConfiguration configuration) throws RuntimeConfigurationException {
    Module module = configuration.getModule();
    if (module == null) {
        throw new RuntimeConfigurationException("Module is not specified");
    }
    if (LibrariesUtil.getGroovyHomePath(module) == null) {
        RuntimeConfigurationException e = new RuntimeConfigurationException("Groovy is not configured for module '" + module.getName() + "'");
        e.setQuickFix(() -> ModulesConfigurator.showDialog(module.getProject(), module.getName(), ClasspathEditor.NAME));
        throw e;
    }
}
Also used : RuntimeConfigurationException(com.intellij.execution.configurations.RuntimeConfigurationException) Module(com.intellij.openapi.module.Module)

Aggregations

RuntimeConfigurationException (com.intellij.execution.configurations.RuntimeConfigurationException)11 ApplicationConfiguration (com.intellij.execution.application.ApplicationConfiguration)2 SourceScope (com.intellij.execution.testframework.SourceScope)2 Module (com.intellij.openapi.module.Module)2 CantRunException (com.intellij.execution.CantRunException)1 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)1 RuntimeConfigurationError (com.intellij.execution.configurations.RuntimeConfigurationError)1 ComponentSet (com.intellij.flex.model.bc.ComponentSet)1 FlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)1 JSPackageIndex (com.intellij.lang.javascript.index.JSPackageIndex)1 JSPackageIndexInfo (com.intellij.lang.javascript.index.JSPackageIndexInfo)1 JSClass (com.intellij.lang.javascript.psi.ecmal4.JSClass)1 Project (com.intellij.openapi.project.Project)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 PsiElement (com.intellij.psi.PsiElement)1 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)1 THashSet (gnu.trove.THashSet)1 File (java.io.File)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1