Search in sources :

Example 1 with FlashProjectStructureProblem

use of com.intellij.lang.javascript.flex.build.FlashProjectStructureProblem in project intellij-plugins by JetBrains.

the class FlashRunnerParameters method reportWarnings.

public void reportWarnings(final Project project) throws RuntimeConfigurationWarning {
    try {
        final Pair<Module, FlexBuildConfiguration> moduleAndBC = super.checkAndGetModuleAndBC(project);
        final Module module = moduleAndBC.first;
        final FlexBuildConfiguration bc = moduleAndBC.second;
        final Ref<String> errorMessageRef = new Ref<>(null);
        final Consumer<FlashProjectStructureProblem> consumer = problem -> errorMessageRef.set(problem.errorMessage);
        if (bc.getTargetPlatform() == TargetPlatform.Desktop) {
            checkAirVersionIfCustomDescriptor(module, bc.getSdk(), bc.getAirDesktopPackagingOptions(), consumer, true, getBCName());
        } else if (bc.getTargetPlatform() == TargetPlatform.Mobile) {
            switch(myMobileRunTarget) {
                case Emulator:
                    switch(myAppDescriptorForEmulator) {
                        case Android:
                            checkAirVersionIfCustomDescriptor(module, bc.getSdk(), bc.getAndroidPackagingOptions(), consumer, true, getBCName());
                            break;
                        case IOS:
                            checkAirVersionIfCustomDescriptor(module, bc.getSdk(), bc.getIosPackagingOptions(), consumer, true, getBCName());
                            break;
                    }
                    break;
                case AndroidDevice:
                    checkAirVersionIfCustomDescriptor(module, bc.getSdk(), bc.getAndroidPackagingOptions(), consumer, true, getBCName());
                    break;
                case iOSSimulator:
                case iOSDevice:
                    checkAirVersionIfCustomDescriptor(module, bc.getSdk(), bc.getIosPackagingOptions(), consumer, true, getBCName());
                    break;
            }
        }
        if (!errorMessageRef.isNull()) {
            throw new RuntimeConfigurationWarning(errorMessageRef.get());
        }
    } catch (RuntimeConfigurationError e) {
    /* should be already checked somewhere else */
    }
}
Also used : RunConfiguration(com.intellij.execution.configurations.RunConfiguration) OutputType(com.intellij.flex.model.bc.OutputType) ArrayUtil(com.intellij.util.ArrayUtil) RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError) XmlFile(com.intellij.psi.xml.XmlFile) VirtualFile(com.intellij.openapi.vfs.VirtualFile) TargetPlatform(com.intellij.flex.model.bc.TargetPlatform) ActionScriptClassResolver(com.intellij.javascript.flex.resolve.ActionScriptClassResolver) PsiManager(com.intellij.psi.PsiManager) FlexCommonUtils(com.intellij.flex.FlexCommonUtils) AirPackagingConfigurableBase(com.intellij.lang.javascript.flex.projectStructure.ui.AirPackagingConfigurableBase) BCUtils(com.intellij.lang.javascript.flex.projectStructure.options.BCUtils) Factory(com.intellij.lang.javascript.flex.projectStructure.model.impl.Factory) FlexmojosSdkType(com.intellij.lang.javascript.flex.sdk.FlexmojosSdkType) PsiElement(com.intellij.psi.PsiElement) Project(com.intellij.openapi.project.Project) PsiFile(com.intellij.psi.PsiFile) FileUtil(com.intellij.openapi.util.io.FileUtil) FlexSdkUtils(com.intellij.lang.javascript.flex.sdk.FlexSdkUtils) Module(com.intellij.openapi.module.Module) ProjectStructureProblemType(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureProblemType) FlexCommonBundle(com.intellij.flex.FlexCommonBundle) EnumSet(java.util.EnumSet) XmlTag(com.intellij.psi.xml.XmlTag) FlexSdkComboBoxWithBrowseButton(com.intellij.lang.javascript.flex.sdk.FlexSdkComboBoxWithBrowseButton) MalformedURLException(java.net.MalformedURLException) StringUtil(com.intellij.openapi.util.text.StringUtil) BrowserUtil(com.intellij.ide.BrowserUtil) FlexBundle(com.intellij.lang.javascript.flex.FlexBundle) com.intellij.lang.javascript.flex.projectStructure.model(com.intellij.lang.javascript.flex.projectStructure.model) Sdk(com.intellij.openapi.projectRoots.Sdk) SystemInfo(com.intellij.openapi.util.SystemInfo) LocalFileSystem(com.intellij.openapi.vfs.LocalFileSystem) File(java.io.File) LinkageType(com.intellij.flex.model.bc.LinkageType) FlashProjectStructureProblem(com.intellij.lang.javascript.flex.build.FlashProjectStructureProblem) Nullable(org.jetbrains.annotations.Nullable) AirPackageUtil(com.intellij.lang.javascript.flex.actions.airpackage.AirPackageUtil) List(java.util.List) JSClass(com.intellij.lang.javascript.psi.ecmal4.JSClass) Pair(com.intellij.openapi.util.Pair) RuntimeConfigurationWarning(com.intellij.execution.configurations.RuntimeConfigurationWarning) NotNull(org.jetbrains.annotations.NotNull) Ref(com.intellij.openapi.util.Ref) Collections(java.util.Collections) Consumer(com.intellij.util.Consumer) Ref(com.intellij.openapi.util.Ref) RuntimeConfigurationWarning(com.intellij.execution.configurations.RuntimeConfigurationWarning) FlashProjectStructureProblem(com.intellij.lang.javascript.flex.build.FlashProjectStructureProblem) Module(com.intellij.openapi.module.Module) RuntimeConfigurationError(com.intellij.execution.configurations.RuntimeConfigurationError)

Aggregations

RunConfiguration (com.intellij.execution.configurations.RunConfiguration)1 RuntimeConfigurationError (com.intellij.execution.configurations.RuntimeConfigurationError)1 RuntimeConfigurationWarning (com.intellij.execution.configurations.RuntimeConfigurationWarning)1 FlexCommonBundle (com.intellij.flex.FlexCommonBundle)1 FlexCommonUtils (com.intellij.flex.FlexCommonUtils)1 LinkageType (com.intellij.flex.model.bc.LinkageType)1 OutputType (com.intellij.flex.model.bc.OutputType)1 TargetPlatform (com.intellij.flex.model.bc.TargetPlatform)1 BrowserUtil (com.intellij.ide.BrowserUtil)1 ActionScriptClassResolver (com.intellij.javascript.flex.resolve.ActionScriptClassResolver)1 FlexBundle (com.intellij.lang.javascript.flex.FlexBundle)1 AirPackageUtil (com.intellij.lang.javascript.flex.actions.airpackage.AirPackageUtil)1 FlashProjectStructureProblem (com.intellij.lang.javascript.flex.build.FlashProjectStructureProblem)1 com.intellij.lang.javascript.flex.projectStructure.model (com.intellij.lang.javascript.flex.projectStructure.model)1 Factory (com.intellij.lang.javascript.flex.projectStructure.model.impl.Factory)1 BCUtils (com.intellij.lang.javascript.flex.projectStructure.options.BCUtils)1 AirPackagingConfigurableBase (com.intellij.lang.javascript.flex.projectStructure.ui.AirPackagingConfigurableBase)1 FlexSdkComboBoxWithBrowseButton (com.intellij.lang.javascript.flex.sdk.FlexSdkComboBoxWithBrowseButton)1 FlexSdkUtils (com.intellij.lang.javascript.flex.sdk.FlexSdkUtils)1 FlexmojosSdkType (com.intellij.lang.javascript.flex.sdk.FlexmojosSdkType)1