Search in sources :

Example 31 with FlexBuildConfiguration

use of com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration in project intellij-plugins by JetBrains.

the class FlexBaseRunner method doExecute.

@Override
@Nullable
protected RunContentDescriptor doExecute(@NotNull final RunProfileState state, @NotNull final ExecutionEnvironment env) throws ExecutionException {
    FileDocumentManager.getInstance().saveAllDocuments();
    final RunProfile runProfile = env.getRunProfile();
    final boolean isDebug = this instanceof FlexDebugRunner;
    try {
        if (runProfile instanceof RunProfileWithCompileBeforeLaunchOption) {
            checkMakeBeforeRunEnabled(env.getProject(), runProfile);
        }
        if (runProfile instanceof RemoteFlashRunConfiguration) {
            final RemoteFlashRunnerParameters params = ((RemoteFlashRunConfiguration) runProfile).getRunnerParameters();
            final Pair<Module, FlexBuildConfiguration> moduleAndBC = params.checkAndGetModuleAndBC(env.getProject());
            if (params.getDebugTransport() == FlashRunnerParameters.AirMobileDebugTransport.USB) {
                final Sdk sdk = moduleAndBC.second.getSdk();
                assert sdk != null;
                if (params.getRemoteDebugTarget() == RemoteDebugTarget.AndroidDevice) {
                    if (!AirPackageUtil.startAdbServer(env.getProject(), sdk) || !AirPackageUtil.scanAndroidDevices(env.getProject(), sdk, params) || !AirPackageUtil.androidForwardTcpPort(env.getProject(), sdk, params.getDeviceInfo(), params.getUsbDebugPort())) {
                        return null;
                    }
                } else if (params.getRemoteDebugTarget() == RemoteDebugTarget.iOSDevice) {
                    final String adtVersion = AirPackageUtil.getAdtVersion(env.getProject(), sdk);
                    if (!AirPackageUtil.checkAdtVersionForPackaging(env.getProject(), adtVersion, "3.4", sdk.getName(), FlexBundle.message("air.ios.debug.via.usb.requires.3.4"))) {
                        return null;
                    }
                    if (!AirPackageUtil.scanIosDevices(env.getProject(), sdk, params)) {
                        return null;
                    }
                    final DeviceInfo device = params.getDeviceInfo();
                    final int deviceHandle = device == null ? -1 : device.IOS_HANDLE;
                    if (deviceHandle < 0) {
                        return null;
                    }
                    if (!AirPackageUtil.iosForwardTcpPort(env.getProject(), sdk, params.getUsbDebugPort(), deviceHandle)) {
                        return null;
                    }
                }
            }
            return launchDebugProcess(moduleAndBC.first, moduleAndBC.second, params, env);
        }
        if (runProfile instanceof FlexUnitRunConfiguration) {
            final FlexUnitRunnerParameters params = ((FlexUnitRunConfiguration) runProfile).getRunnerParameters();
            final Pair<Module, FlexBuildConfiguration> moduleAndConfig = params.checkAndGetModuleAndBC(env.getProject());
            final Module module = moduleAndConfig.first;
            final FlexBuildConfiguration bc = moduleAndConfig.second;
            if (bc.getTargetPlatform() == TargetPlatform.Web) {
                FlashPlayerTrustUtil.updateTrustedStatus(module, bc, isDebug, params.isTrusted());
                return launchWebFlexUnit(env.getProject(), env.getContentToReuse(), env, params, bc.getActualOutputFilePath());
            } else {
                return launchAirFlexUnit(env.getProject(), state, env.getContentToReuse(), env, params);
            }
        }
        if (runProfile instanceof FlashRunConfiguration) {
            final FlashRunnerParameters params = ((FlashRunConfiguration) runProfile).getRunnerParameters();
            params.setDeviceInfo(null);
            final Pair<Module, FlexBuildConfiguration> moduleAndConfig = params.checkAndGetModuleAndBC(env.getProject());
            final Module module = moduleAndConfig.first;
            final FlexBuildConfiguration bc = moduleAndConfig.second;
            if (bc.isSkipCompile()) {
                showBCCompilationSkippedWarning(module, bc);
            }
            if (isDebug && SystemInfo.isMac && bc.getTargetPlatform() == TargetPlatform.Web) {
                checkDebuggerFromSdk4(env.getProject(), runProfile, params, bc);
            }
            if (bc.getTargetPlatform() == TargetPlatform.Web && !params.isLaunchUrl()) {
                FlashPlayerTrustUtil.updateTrustedStatus(module, bc, isDebug, params.isRunTrusted());
            }
            return launchFlexConfig(module, bc, params, state, env.getContentToReuse(), env);
        }
    } catch (RuntimeConfigurationError e) {
        throw new ExecutionException(e.getMessage());
    }
    return null;
}
Also used : FlexDebugRunner(com.intellij.lang.javascript.flex.debug.FlexDebugRunner) FlexUnitRunConfiguration(com.intellij.lang.javascript.flex.flexunit.FlexUnitRunConfiguration) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) FlexUnitRunnerParameters(com.intellij.lang.javascript.flex.flexunit.FlexUnitRunnerParameters) DeviceInfo(com.intellij.lang.javascript.flex.actions.airpackage.DeviceInfo) Sdk(com.intellij.openapi.projectRoots.Sdk) Module(com.intellij.openapi.module.Module) Nullable(org.jetbrains.annotations.Nullable)

Example 32 with FlexBuildConfiguration

use of com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration in project intellij-plugins by JetBrains.

the class DeclareConditionalCompilerDefinitionFix method applyFix.

protected void applyFix(final Project project, final PsiElement psiElement, final PsiFile file, final Editor editor) {
    final ProjectStructureConfigurable configurable = ProjectStructureConfigurable.getInstance(project);
    ShowSettingsUtil.getInstance().editConfigurable(project, configurable, () -> {
        final FlexBuildConfiguration bc = FlexBuildConfigurationManager.getInstance(myModule).getActiveConfiguration();
        final Place place = FlexBuildConfigurationsExtension.getInstance().getConfigurator().getPlaceFor(myModule, bc.getName()).putPath(CompositeConfigurable.TAB_NAME, CompilerOptionsConfigurable.TAB_NAME).putPath(FlexBCConfigurable.LOCATION_ON_TAB, CompilerOptionsConfigurable.Location.ConditionalCompilerDefinition).putPath(CompilerOptionsConfigurable.CONDITIONAL_COMPILER_DEFINITION_NAME, myConditionalCompilerDefinitionName);
        configurable.navigateTo(place, true);
    });
}
Also used : FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) Place(com.intellij.ui.navigation.Place) ProjectStructureConfigurable(com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable)

Example 33 with FlexBuildConfiguration

use of com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration in project intellij-plugins by JetBrains.

the class CreateFlexComponentFix method getAllowedBuiltInTemplates.

public static String[] getAllowedBuiltInTemplates(final Module module) {
    FlexBuildConfiguration c = FlexBuildConfigurationManager.getInstance(module).getActiveConfiguration();
    if (c.isPureAs()) {
        return ArrayUtil.EMPTY_STRING_ARRAY;
    }
    Sdk sdk = c.getSdk();
    if (sdk != null && StringUtil.compareVersionNumbers(sdk.getVersionString(), "4") < 0) {
        return new String[] { FLEX3_COMPONENT_TEMPLATE_NAME };
    }
    return new String[] { FLEX4_COMPONENT_TEMPLATE_NAME };
}
Also used : FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) Sdk(com.intellij.openapi.projectRoots.Sdk)

Example 34 with FlexBuildConfiguration

use of com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration in project intellij-plugins by JetBrains.

the class FlexBCTree method iterateRecursively.

private static void iterateRecursively(final CheckedTreeNode node, final boolean iterateChecked, final Consumer<Pair<Module, FlexBuildConfiguration>> consumer) {
    if (node.isLeaf()) {
        if (node.isChecked() == iterateChecked && node.getParent() instanceof CheckedTreeNode) {
            final Object userObject = node.getUserObject();
            final Object parentUserObject = ((CheckedTreeNode) node.getParent()).getUserObject();
            if (userObject instanceof FlexBuildConfiguration && parentUserObject instanceof Module) {
                consumer.consume(Pair.create((Module) parentUserObject, (FlexBuildConfiguration) userObject));
            }
        }
    } else {
        // do not try to optimize asking non-leaf node about its checked status - it may give unexpected result!
        final Enumeration children = node.children();
        while (children.hasMoreElements()) {
            iterateRecursively((CheckedTreeNode) children.nextElement(), iterateChecked, consumer);
        }
    }
}
Also used : Enumeration(java.util.Enumeration) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) CheckedTreeNode(com.intellij.ui.CheckedTreeNode) Module(com.intellij.openapi.module.Module)

Example 35 with FlexBuildConfiguration

use of com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration in project intellij-plugins by JetBrains.

the class FlexBCTree method installSpeedSearch.

protected void installSpeedSearch() {
    new TreeSpeedSearch(this, path -> {
        final CheckedTreeNode node = (CheckedTreeNode) path.getLastPathComponent();
        final Object userObject = node.getUserObject();
        if (userObject instanceof Project) {
            return ((Project) userObject).getName();
        } else if (userObject instanceof Module) {
            return ((Module) userObject).getName();
        } else if (userObject instanceof FlexBuildConfiguration) {
            return ((FlexBuildConfiguration) userObject).getName();
        }
        return null;
    });
}
Also used : Project(com.intellij.openapi.project.Project) TreeSpeedSearch(com.intellij.ui.TreeSpeedSearch) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) CheckedTreeNode(com.intellij.ui.CheckedTreeNode) Module(com.intellij.openapi.module.Module)

Aggregations

FlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)52 Module (com.intellij.openapi.module.Module)30 Sdk (com.intellij.openapi.projectRoots.Sdk)9 Pair (com.intellij.openapi.util.Pair)7 ArrayList (java.util.ArrayList)7 BuildConfigurationNature (com.intellij.flex.model.bc.BuildConfigurationNature)6 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)5 RuntimeConfigurationError (com.intellij.execution.configurations.RuntimeConfigurationError)5 FlexBuildConfigurationManager (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfigurationManager)5 JSClass (com.intellij.lang.javascript.psi.ecmal4.JSClass)4 Project (com.intellij.openapi.project.Project)4 FlexModuleType (com.intellij.lang.javascript.flex.FlexModuleType)3 FlexUnitRunConfiguration (com.intellij.lang.javascript.flex.flexunit.FlexUnitRunConfiguration)3 ModifiableFlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)3 FlashRunConfiguration (com.intellij.lang.javascript.flex.run.FlashRunConfiguration)3 FlashRunnerParameters (com.intellij.lang.javascript.flex.run.FlashRunnerParameters)3 ConfigurationException (com.intellij.openapi.options.ConfigurationException)3 ProjectStructureConfigurable (com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable)3 CheckedTreeNode (com.intellij.ui.CheckedTreeNode)3 Place (com.intellij.ui.navigation.Place)3