Search in sources :

Example 1 with FlashRunnerParameters

use of com.intellij.lang.javascript.flex.run.FlashRunnerParameters in project intellij-plugins by JetBrains.

the class FlexTestUtils method createFlashRunConfig.

public static void createFlashRunConfig(final RunManager runManager, final Module module, final String configName, final String className, boolean generatedName) {
    final RunnerAndConfigurationSettings settings = runManager.createRunConfiguration(configName, FlashRunConfigurationType.getFactory());
    runManager.addConfiguration(settings, false);
    final FlashRunnerParameters params = ((FlashRunConfiguration) settings.getConfiguration()).getRunnerParameters();
    params.setModuleName(module.getName());
    params.setBCName(FlexBuildConfigurationManager.getInstance(module).getActiveConfiguration().getName());
    params.setOverrideMainClass(true);
    params.setOverriddenMainClass(className);
    if (generatedName) {
        ((FlashRunConfiguration) settings.getConfiguration()).setGeneratedName();
    }
}
Also used : FlashRunConfiguration(com.intellij.lang.javascript.flex.run.FlashRunConfiguration) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) FlashRunnerParameters(com.intellij.lang.javascript.flex.run.FlashRunnerParameters)

Example 2 with FlashRunnerParameters

use of com.intellij.lang.javascript.flex.run.FlashRunnerParameters in project intellij-plugins by JetBrains.

the class FlashRunConfigurationForm method doResetEditorFrom.

private void doResetEditorFrom(final FlashRunConfiguration configuration) {
    final FlashRunnerParameters params = configuration.getRunnerParameters();
    // must be before myBCsCombo.setModel()
    myLauncherParameters = params.getLauncherParameters().clone();
    myBCCombo.resetFrom(params);
    myOverrideMainClassCheckBox.setSelected(params.isOverrideMainClass());
    if (params.isOverrideMainClass()) {
        myMainClassComponent.setText(params.getOverriddenMainClass());
        myOutputFileNameTextField.setText(params.getOverriddenOutputFileName());
    }
    myBCOutputRadioButton.setSelected(!params.isLaunchUrl());
    myUrlOrFileRadioButton.setSelected(params.isLaunchUrl());
    final String url = params.getUrl();
    final boolean windowsLocalFile = SystemInfo.isWindows && url.length() >= 2 && Character.isLetter(url.charAt(0)) && ':' == url.charAt(1);
    myUrlOrFileTextWithBrowse.setText(windowsLocalFile ? FileUtil.toSystemDependentName(url) : url);
    myRunTrustedCheckBox.setSelected(params.isRunTrusted());
    myAdlOptionsEditor.setText(params.getAdlOptions());
    myAirProgramParametersEditor.setText(params.getAirProgramParameters());
    myOnEmulatorRadioButton.setSelected(params.getMobileRunTarget() == AirMobileRunTarget.Emulator);
    myEmulatorCombo.setSelectedItem(params.getEmulator());
    if (params.getEmulator().adlAlias == null) {
        myScreenWidth.setText(String.valueOf(params.getScreenWidth()));
        myScreenHeight.setText(String.valueOf(params.getScreenHeight()));
        myFullScreenWidth.setText(String.valueOf(params.getFullScreenWidth()));
        myFullScreenHeight.setText(String.valueOf(params.getFullScreenHeight()));
        myScreenDpi.setText(params.getScreenDpi() > 0 ? String.valueOf(params.getScreenDpi()) : "");
    }
    myOnAndroidDeviceRadioButton.setSelected(params.getMobileRunTarget() == AirMobileRunTarget.AndroidDevice);
    myOnIOSSimulatorRadioButton.setSelected(params.getMobileRunTarget() == AirMobileRunTarget.iOSSimulator);
    myIOSSimulatorSdkTextWithBrowse.setText(FileUtil.toSystemDependentName(params.getIOSSimulatorSdkPath()));
    myOnIOSDeviceRadioButton.setSelected(params.getMobileRunTarget() == AirMobileRunTarget.iOSDevice);
    myFastPackagingCheckBox.setSelected(params.isFastPackaging());
    myDebugOverNetworkRadioButton.setSelected(params.getDebugTransport() == AirMobileDebugTransport.Network);
    myDebugOverUSBRadioButton.setSelected(params.getDebugTransport() == AirMobileDebugTransport.USB);
    myUsbDebugPortTextField.setText(String.valueOf(params.getUsbDebugPort()));
    myEmulatorAdlOptionsEditor.setText(params.getEmulatorAdlOptions());
    myAppDescriptorForEmulatorCombo.setSelectedItem(params.getAppDescriptorForEmulator());
    final FlexBuildConfiguration bc = myBCCombo.getBC();
    mySdkForDebuggingCombo.setBCSdk(bc == null ? null : bc.getSdk());
    mySdkForDebuggingCombo.setSelectedSdkRaw(params.getDebuggerSdkRaw());
    updateControls();
}
Also used : FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) FlashRunnerParameters(com.intellij.lang.javascript.flex.run.FlashRunnerParameters)

Example 3 with FlashRunnerParameters

use of com.intellij.lang.javascript.flex.run.FlashRunnerParameters in project intellij-plugins by JetBrains.

the class FlashRunConfigurationForm method applyEditorTo.

@Override
protected void applyEditorTo(@NotNull final FlashRunConfiguration configuration) throws ConfigurationException {
    final FlashRunnerParameters params = configuration.getRunnerParameters();
    myBCCombo.applyTo(params);
    final boolean overrideMainClass = myOverrideMainClassCheckBox.isSelected();
    params.setOverrideMainClass(overrideMainClass);
    params.setOverriddenMainClass(overrideMainClass ? myMainClassComponent.getText().trim() : "");
    params.setOverriddenOutputFileName(overrideMainClass ? myOutputFileNameTextField.getText().trim() : "");
    params.setLaunchUrl(myUrlOrFileRadioButton.isSelected());
    final String url = myUrlOrFileTextWithBrowse.getText().trim();
    final boolean windowsLocalFile = SystemInfo.isWindows && url.length() >= 2 && Character.isLetter(url.charAt(0)) && ':' == url.charAt(1);
    params.setUrl(windowsLocalFile ? FileUtil.toSystemIndependentName(url) : url);
    params.setLauncherParameters(myLauncherParameters);
    params.setRunTrusted(myRunTrustedCheckBox.isSelected());
    params.setAdlOptions(myAdlOptionsEditor.getText().trim());
    params.setAirProgramParameters(myAirProgramParametersEditor.getText().trim());
    final AirMobileRunTarget mobileRunTarget = myOnEmulatorRadioButton.isSelected() ? AirMobileRunTarget.Emulator : myOnAndroidDeviceRadioButton.isSelected() ? AirMobileRunTarget.AndroidDevice : myOnIOSSimulatorRadioButton.isSelected() ? AirMobileRunTarget.iOSSimulator : AirMobileRunTarget.iOSDevice;
    params.setMobileRunTarget(mobileRunTarget);
    final Emulator emulator = (Emulator) myEmulatorCombo.getSelectedItem();
    params.setEmulator(emulator);
    if (emulator.adlAlias == null) {
        try {
            params.setScreenWidth(Integer.parseInt(myScreenWidth.getText().trim()));
            params.setScreenHeight(Integer.parseInt(myScreenHeight.getText().trim()));
            params.setFullScreenWidth(Integer.parseInt(myFullScreenWidth.getText().trim()));
            params.setFullScreenHeight(Integer.parseInt(myFullScreenHeight.getText().trim()));
        } catch (NumberFormatException e) {
        /**/
        }
        try {
            params.setScreenDpi(Integer.parseInt(myScreenDpi.getText().trim()));
        } catch (NumberFormatException e) {
            params.setScreenDpi(0);
        }
    }
    final FlexBuildConfiguration bc = myBCCombo.getBC();
    if (SystemInfo.isMac && bc != null && bc.getTargetPlatform() == TargetPlatform.Mobile && myOnIOSSimulatorRadioButton.isSelected()) {
        final String path = FileUtil.toSystemIndependentName(myIOSSimulatorSdkTextWithBrowse.getText().trim());
        if (!path.isEmpty()) {
            PropertiesComponent.getInstance().setValue(LATEST_SELECTED_IOS_SIMULATOR_SDK_PATH_KEY, path);
        }
    }
    params.setIOSSimulatorSdkPath(FileUtil.toSystemIndependentName(myIOSSimulatorSdkTextWithBrowse.getText().trim()));
    params.setFastPackaging(myFastPackagingCheckBox.isSelected());
    params.setDebugTransport(myDebugOverNetworkRadioButton.isSelected() ? AirMobileDebugTransport.Network : AirMobileDebugTransport.USB);
    try {
        final int port = Integer.parseInt(myUsbDebugPortTextField.getText().trim());
        if (port > 0 && port < 65535) {
            params.setUsbDebugPort(port);
        }
    } catch (NumberFormatException ignore) {
    /*ignore*/
    }
    params.setEmulatorAdlOptions(myEmulatorAdlOptionsEditor.getText().trim());
    params.setAppDescriptorForEmulator((AppDescriptorForEmulator) myAppDescriptorForEmulatorCombo.getSelectedItem());
    params.setDebuggerSdkRaw(mySdkForDebuggingCombo.getSelectedSdkRaw());
}
Also used : FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) FlashRunnerParameters(com.intellij.lang.javascript.flex.run.FlashRunnerParameters)

Example 4 with FlashRunnerParameters

use of com.intellij.lang.javascript.flex.run.FlashRunnerParameters in project intellij-plugins by JetBrains.

the class FlexModuleBuilder method createRunConfiguration.

public static void createRunConfiguration(final Module module, final FlexBuildConfiguration bc) {
    final RunManager runManager = RunManagerEx.getInstance(module.getProject());
    final List<RunConfiguration> existingConfigurations = runManager.getConfigurationsList(FlashRunConfigurationType.getInstance());
    for (RunConfiguration configuration : existingConfigurations) {
        final FlashRunnerParameters parameters = ((FlashRunConfiguration) configuration).getRunnerParameters();
        if (module.getName().equals(parameters.getModuleName()) && bc.getName().equals(parameters.getBCName())) {
            //already exists
            return;
        }
    }
    final RunnerAndConfigurationSettings settings = runManager.createConfiguration("", FlashRunConfigurationType.getFactory());
    final FlashRunConfiguration runConfiguration = (FlashRunConfiguration) settings.getConfiguration();
    final FlashRunnerParameters params = runConfiguration.getRunnerParameters();
    params.setModuleName(module.getName());
    params.setBCName(bc.getName());
    if (bc.getNature().isMobilePlatform()) {
        if (bc.getAndroidPackagingOptions().isEnabled()) {
            params.setAppDescriptorForEmulator(FlashRunnerParameters.AppDescriptorForEmulator.Android);
        } else if (bc.getIosPackagingOptions().isEnabled()) {
            params.setAppDescriptorForEmulator(FlashRunnerParameters.AppDescriptorForEmulator.IOS);
        }
    }
    settings.setName(params.suggestUniqueName(existingConfigurations));
    settings.setTemporary(false);
    runManager.addConfiguration(settings, false);
    runManager.setSelectedConfiguration(settings);
}
Also used : RunConfiguration(com.intellij.execution.configurations.RunConfiguration) FlashRunConfiguration(com.intellij.lang.javascript.flex.run.FlashRunConfiguration) FlashRunConfiguration(com.intellij.lang.javascript.flex.run.FlashRunConfiguration) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) RunManager(com.intellij.execution.RunManager) FlashRunnerParameters(com.intellij.lang.javascript.flex.run.FlashRunnerParameters)

Example 5 with FlashRunnerParameters

use of com.intellij.lang.javascript.flex.run.FlashRunnerParameters in project intellij-plugins by JetBrains.

the class ValidateFlashConfigurationsPrecompileTask method getProblems.

static Collection<Trinity<Module, FlexBuildConfiguration, FlashProjectStructureProblem>> getProblems(final CompileScope scope, final Collection<Pair<Module, FlexBuildConfiguration>> modulesAndBCsToCompile) {
    final Collection<Trinity<Module, FlexBuildConfiguration, FlashProjectStructureProblem>> problems = new ArrayList<>();
    for (final Pair<Module, FlexBuildConfiguration> moduleAndBC : modulesAndBCsToCompile) {
        final Module module = moduleAndBC.first;
        final FlexBuildConfiguration bc = moduleAndBC.second;
        final Consumer<FlashProjectStructureProblem> errorConsumer = problem -> problems.add(Trinity.create(module, bc, problem));
        checkConfiguration(module, bc, false, errorConsumer);
        final RunConfiguration runConfig = CompileStepBeforeRun.getRunConfiguration(scope);
        if (bc.getNature().isApp() && runConfig instanceof FlashRunConfiguration) {
            final FlashRunnerParameters params = ((FlashRunConfiguration) runConfig).getRunnerParameters();
            if (module.getName().equals(params.getModuleName()) && bc.getName().equals(params.getBCName())) {
                if (bc.getNature().isDesktopPlatform()) {
                    FlashRunnerParameters.checkAirVersionIfCustomDescriptor(module, bc.getSdk(), bc.getAirDesktopPackagingOptions(), errorConsumer, false, "does not matter");
                } else if (bc.getNature().isMobilePlatform()) {
                    switch(params.getMobileRunTarget()) {
                        case Emulator:
                            switch(params.getAppDescriptorForEmulator()) {
                                case Android:
                                    FlashRunnerParameters.checkAirVersionIfCustomDescriptor(module, bc.getSdk(), bc.getAndroidPackagingOptions(), errorConsumer, false, "does not matter");
                                    break;
                                case IOS:
                                    FlashRunnerParameters.checkAirVersionIfCustomDescriptor(module, bc.getSdk(), bc.getIosPackagingOptions(), errorConsumer, false, "does not matter");
                                    break;
                            }
                            break;
                        case AndroidDevice:
                            checkPackagingOptions(module, bc.getSdk(), bc.getAndroidPackagingOptions(), false, PathUtil.getParentPath(bc.getActualOutputFilePath()), errorConsumer);
                            break;
                        case iOSSimulator:
                            checkPackagingOptions(module, bc.getSdk(), bc.getIosPackagingOptions(), true, PathUtil.getParentPath(bc.getActualOutputFilePath()), errorConsumer);
                            break;
                        case iOSDevice:
                            checkPackagingOptions(module, bc.getSdk(), bc.getIosPackagingOptions(), false, PathUtil.getParentPath(bc.getActualOutputFilePath()), errorConsumer);
                            break;
                    }
                }
            }
        }
    }
    checkSimilarOutputFiles(modulesAndBCsToCompile, trinity -> problems.add(trinity));
    return problems;
}
Also used : Trinity(com.intellij.openapi.util.Trinity) HyperlinkEvent(javax.swing.event.HyperlinkEvent) VirtualFile(com.intellij.openapi.vfs.VirtualFile) THashSet(gnu.trove.THashSet) THashMap(gnu.trove.THashMap) TargetPlatform(com.intellij.flex.model.bc.TargetPlatform) ReadAction(com.intellij.openapi.application.ReadAction) FlexCommonUtils(com.intellij.flex.FlexCommonUtils) BCUtils(com.intellij.lang.javascript.flex.projectStructure.options.BCUtils) FlexmojosSdkType(com.intellij.lang.javascript.flex.sdk.FlexmojosSdkType) Map(java.util.Map) FileUtil(com.intellij.openapi.util.io.FileUtil) Module(com.intellij.openapi.module.Module) ProjectStructureProblemType(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureProblemType) FlexBuildConfigurationsExtension(com.intellij.lang.javascript.flex.projectStructure.FlexBuildConfigurationsExtension) com.intellij.openapi.compiler(com.intellij.openapi.compiler) Collection(java.util.Collection) Set(java.util.Set) FlexBundle(com.intellij.lang.javascript.flex.FlexBundle) NotificationListener(com.intellij.notification.NotificationListener) LocalFileSystem(com.intellij.openapi.vfs.LocalFileSystem) NotificationType(com.intellij.notification.NotificationType) Notification(com.intellij.notification.Notification) Nullable(org.jetbrains.annotations.Nullable) ModuleRootManager(com.intellij.openapi.roots.ModuleRootManager) CompilerWorkspaceConfiguration(com.intellij.compiler.CompilerWorkspaceConfiguration) ConfigurationException(com.intellij.openapi.options.ConfigurationException) NotNull(org.jetbrains.annotations.NotNull) Consumer(com.intellij.util.Consumer) FlexUtils(com.intellij.lang.javascript.flex.FlexUtils) RunConfiguration(com.intellij.execution.configurations.RunConfiguration) OutputType(com.intellij.flex.model.bc.OutputType) ShowSettingsUtil(com.intellij.openapi.options.ShowSettingsUtil) CompileStepBeforeRun(com.intellij.compiler.options.CompileStepBeforeRun) ArrayList(java.util.ArrayList) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) com.intellij.lang.javascript.flex.projectStructure.ui(com.intellij.lang.javascript.flex.projectStructure.ui) Project(com.intellij.openapi.project.Project) FlexSdkUtils(com.intellij.lang.javascript.flex.sdk.FlexSdkUtils) FlexCommonBundle(com.intellij.flex.FlexCommonBundle) VfsUtilCore(com.intellij.openapi.vfs.VfsUtilCore) StringUtil(com.intellij.openapi.util.text.StringUtil) FlashRunConfiguration(com.intellij.lang.javascript.flex.run.FlashRunConfiguration) com.intellij.lang.javascript.flex.projectStructure.model(com.intellij.lang.javascript.flex.projectStructure.model) FlashRunnerParameters(com.intellij.lang.javascript.flex.run.FlashRunnerParameters) Sdk(com.intellij.openapi.projectRoots.Sdk) SystemInfo(com.intellij.openapi.util.SystemInfo) File(java.io.File) BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) Place(com.intellij.ui.navigation.Place) Pair(com.intellij.openapi.util.Pair) ProjectStructureConfigurable(com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable) Navigatable(com.intellij.pom.Navigatable) PathUtil(com.intellij.util.PathUtil) Trinity(com.intellij.openapi.util.Trinity) RunConfiguration(com.intellij.execution.configurations.RunConfiguration) FlashRunConfiguration(com.intellij.lang.javascript.flex.run.FlashRunConfiguration) ArrayList(java.util.ArrayList) FlashRunConfiguration(com.intellij.lang.javascript.flex.run.FlashRunConfiguration) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) Module(com.intellij.openapi.module.Module) FlashRunnerParameters(com.intellij.lang.javascript.flex.run.FlashRunnerParameters)

Aggregations

FlashRunnerParameters (com.intellij.lang.javascript.flex.run.FlashRunnerParameters)6 FlashRunConfiguration (com.intellij.lang.javascript.flex.run.FlashRunConfiguration)4 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)3 FlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)3 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)2 CompilerWorkspaceConfiguration (com.intellij.compiler.CompilerWorkspaceConfiguration)1 CompileStepBeforeRun (com.intellij.compiler.options.CompileStepBeforeRun)1 RunManager (com.intellij.execution.RunManager)1 FlexCommonBundle (com.intellij.flex.FlexCommonBundle)1 FlexCommonUtils (com.intellij.flex.FlexCommonUtils)1 BuildConfigurationNature (com.intellij.flex.model.bc.BuildConfigurationNature)1 OutputType (com.intellij.flex.model.bc.OutputType)1 TargetPlatform (com.intellij.flex.model.bc.TargetPlatform)1 FlexBundle (com.intellij.lang.javascript.flex.FlexBundle)1 FlexUtils (com.intellij.lang.javascript.flex.FlexUtils)1 FlexBuildConfigurationsExtension (com.intellij.lang.javascript.flex.projectStructure.FlexBuildConfigurationsExtension)1 com.intellij.lang.javascript.flex.projectStructure.model (com.intellij.lang.javascript.flex.projectStructure.model)1 BCUtils (com.intellij.lang.javascript.flex.projectStructure.options.BCUtils)1 com.intellij.lang.javascript.flex.projectStructure.ui (com.intellij.lang.javascript.flex.projectStructure.ui)1 FlexSdkUtils (com.intellij.lang.javascript.flex.sdk.FlexSdkUtils)1