Search in sources :

Example 21 with RuntimeConfigurationError

use of com.intellij.execution.configurations.RuntimeConfigurationError in project intellij-plugins by JetBrains.

the class FlashRunnerParameters method checkCustomDescriptor.

public static void checkCustomDescriptor(final AirPackagingOptions packagingOptions, final String bcName, final String moduleName) throws RuntimeConfigurationError {
    final boolean android = packagingOptions instanceof AndroidPackagingOptions;
    final boolean ios = packagingOptions instanceof IosPackagingOptions;
    if (android && !((AndroidPackagingOptions) packagingOptions).isEnabled()) {
        throw new RuntimeConfigurationError(FlexBundle.message("android.disabled.in.bc", bcName, moduleName));
    }
    if (ios && !((IosPackagingOptions) packagingOptions).isEnabled()) {
        throw new RuntimeConfigurationError(FlexBundle.message("ios.disabled.in.bc", bcName, moduleName));
    }
    if (!packagingOptions.isUseGeneratedDescriptor()) {
        if (packagingOptions.getCustomDescriptorPath().isEmpty()) {
            final String key = android ? "bc.0.module.1.android.custom.descriptor.not.set" : ios ? "bc.0.module.1.ios.custom.descriptor.not.set" : "bc.0.module.1.custom.descriptor.not.set";
            throw new RuntimeConfigurationError(FlexBundle.message(key, bcName, moduleName));
        } else {
            final VirtualFile descriptorFile = LocalFileSystem.getInstance().findFileByPath(packagingOptions.getCustomDescriptorPath());
            if (descriptorFile == null || descriptorFile.isDirectory()) {
                final String key = android ? "bc.0.module.1.android.custom.descriptor.not.found" : ios ? "bc.0.module.1.ios.custom.descriptor.not.found" : "bc.0.module.1.custom.descriptor.not.found";
                throw new RuntimeConfigurationError(FlexBundle.message(key, bcName, moduleName, FileUtil.toSystemDependentName(packagingOptions.getCustomDescriptorPath())));
            }
        }
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError)

Example 22 with RuntimeConfigurationError

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

the class TestCategory method checkConfiguration.

@Override
public void checkConfiguration() throws RuntimeConfigurationException {
    JavaParametersUtil.checkAlternativeJRE(getConfiguration());
    ProgramParametersUtil.checkWorkingDirectoryExist(getConfiguration(), getConfiguration().getProject(), getConfiguration().getConfigurationModule().getModule());
    final String category = getConfiguration().getPersistentData().getCategory();
    if (category == null || category.isEmpty()) {
        throw new RuntimeConfigurationError("Category is not specified");
    }
    final JavaRunConfigurationModule configurationModule = getConfiguration().getConfigurationModule();
    if (getSourceScope() == null) {
        configurationModule.checkForWarning();
    }
    final Module module = configurationModule.getModule();
    if (module != null) {
        final PsiClass psiClass = JavaExecutionUtil.findMainClass(getConfiguration().getProject(), category, GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module));
        if (psiClass == null) {
            throw new RuntimeConfigurationWarning(ExecutionBundle.message("class.not.found.in.module.error.message", category, configurationModule.getModuleName()));
        }
    }
}
Also used : RuntimeConfigurationWarning(com.intellij.execution.configurations.RuntimeConfigurationWarning) JavaRunConfigurationModule(com.intellij.execution.configurations.JavaRunConfigurationModule) Module(com.intellij.openapi.module.Module) RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError) JavaRunConfigurationModule(com.intellij.execution.configurations.JavaRunConfigurationModule)

Example 23 with RuntimeConfigurationError

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

the class TestDirectory method checkConfiguration.

@Override
public void checkConfiguration() throws RuntimeConfigurationException {
    JavaParametersUtil.checkAlternativeJRE(getConfiguration());
    ProgramParametersUtil.checkWorkingDirectoryExist(getConfiguration(), getConfiguration().getProject(), getConfiguration().getConfigurationModule().getModule());
    final String dirName = getConfiguration().getPersistentData().getDirName();
    if (dirName == null || dirName.isEmpty()) {
        throw new RuntimeConfigurationError("Directory is not specified");
    }
    final VirtualFile file = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(dirName));
    if (file == null) {
        throw new RuntimeConfigurationWarning("Directory \'" + dirName + "\' is not found");
    }
    final Module module = getConfiguration().getConfigurationModule().getModule();
    if (module == null) {
        throw new RuntimeConfigurationError("Module to choose classpath from is not specified");
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) RuntimeConfigurationWarning(com.intellij.execution.configurations.RuntimeConfigurationWarning) Module(com.intellij.openapi.module.Module) RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError)

Aggregations

RuntimeConfigurationError (com.intellij.execution.configurations.RuntimeConfigurationError)23 VirtualFile (com.intellij.openapi.vfs.VirtualFile)16 Module (com.intellij.openapi.module.Module)7 File (java.io.File)7 FlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)5 RuntimeConfigurationWarning (com.intellij.execution.configurations.RuntimeConfigurationWarning)4 JSClass (com.intellij.lang.javascript.psi.ecmal4.JSClass)4 Sdk (com.intellij.openapi.projectRoots.Sdk)4 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)3 JSFile (com.intellij.lang.javascript.psi.JSFile)3 Project (com.intellij.openapi.project.Project)3 PsiElement (com.intellij.psi.PsiElement)3 PsiFile (com.intellij.psi.PsiFile)3 NotNull (org.jetbrains.annotations.NotNull)3 ExecutionException (com.intellij.execution.ExecutionException)2 RunProfile (com.intellij.execution.configurations.RunProfile)2 XmlFile (com.intellij.psi.xml.XmlFile)2 Consumer (com.intellij.util.Consumer)2 DartRunConfigurationBase (com.jetbrains.lang.dart.ide.runner.base.DartRunConfigurationBase)2 DartSdk (com.jetbrains.lang.dart.sdk.DartSdk)2