Search in sources :

Example 21 with FlexBuildConfiguration

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

the class FlashPlayerTrustUtil method updateTrustedStatus.

public static void updateTrustedStatus(final Module module, final FlexBuildConfiguration bc, final boolean isDebug, final boolean isTrusted) {
    final Collection<String> paths = new ArrayList<>();
    try {
        paths.add(new File(PathUtil.getParentPath(bc.getActualOutputFilePath())).getCanonicalPath());
    } catch (IOException e) {
    /**/
    }
    for (DependencyEntry entry : bc.getDependencies().getEntries()) {
        if (entry instanceof BuildConfigurationEntry && entry.getDependencyType().getLinkageType() == LinkageType.LoadInRuntime) {
            final FlexBuildConfiguration dependencyBC = ((BuildConfigurationEntry) entry).findBuildConfiguration();
            if (dependencyBC != null) {
                try {
                    paths.add(new File(PathUtil.getParentPath(dependencyBC.getActualOutputFilePath())).getCanonicalPath());
                } catch (IOException e) {
                /**/
                }
            }
        }
    }
    updateTrustedStatus(module.getProject(), isTrusted, isDebug, paths.toArray(new String[paths.size()]));
}
Also used : BuildConfigurationEntry(com.intellij.lang.javascript.flex.projectStructure.model.BuildConfigurationEntry) ArrayList(java.util.ArrayList) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) IOException(java.io.IOException) DependencyEntry(com.intellij.lang.javascript.flex.projectStructure.model.DependencyEntry) File(java.io.File)

Example 22 with FlexBuildConfiguration

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

the class FlashRunConfiguration method getState.

@Override
public RunProfileState getState(@NotNull final Executor executor, @NotNull final ExecutionEnvironment env) throws ExecutionException {
    final FlexBuildConfiguration config;
    try {
        config = myRunnerParameters.checkAndGetModuleAndBC(getProject()).second;
    } catch (RuntimeConfigurationError e) {
        throw new ExecutionException(e.getMessage());
    }
    final BuildConfigurationNature nature = config.getNature();
    if (nature.isDesktopPlatform() || (nature.isMobilePlatform() && myRunnerParameters.getMobileRunTarget() == AirMobileRunTarget.Emulator)) {
        return new AirRunState(getProject(), env, myRunnerParameters);
    }
    return EmptyRunProfileState.INSTANCE;
}
Also used : BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) ExecutionException(com.intellij.execution.ExecutionException)

Example 23 with FlexBuildConfiguration

use of com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration 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 24 with FlexBuildConfiguration

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

the class FlashRunConfigurationForm method initMainClassRelatedControls.

private void initMainClassRelatedControls() {
    myOverrideMainClassCheckBox.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            if (myOverrideMainClassCheckBox.isSelected()) {
                updateOutputFileName(myOutputFileNameTextField, false);
            }
            updateControls();
            if (myMainClassComponent.isEnabled()) {
                IdeFocusManager.getInstance(myProject).requestFocus(myMainClassComponent.getChildComponent(), true);
            }
        }
    });
    myMainClassComponent.addDocumentListener(new DocumentListener() {

        @Override
        public void documentChanged(final DocumentEvent e) {
            final String shortName = StringUtil.getShortName(myMainClassComponent.getText().trim());
            if (!shortName.isEmpty()) {
                myOutputFileNameTextField.setText(shortName + ".swf");
            }
        }
    });
    myOutputFileNameTextField.getDocument().addDocumentListener(new com.intellij.ui.DocumentAdapter() {

        @Override
        protected void textChanged(final javax.swing.event.DocumentEvent e) {
            final FlexBuildConfiguration bc = myBCCombo.getBC();
            if (bc != null && bc.getTargetPlatform() == TargetPlatform.Web) {
                updateBCOutputLabel(bc);
            }
        }
    });
}
Also used : DocumentListener(com.intellij.openapi.editor.event.DocumentListener) ActionEvent(java.awt.event.ActionEvent) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) DocumentEvent(com.intellij.openapi.editor.event.DocumentEvent) ActionListener(java.awt.event.ActionListener)

Example 25 with FlexBuildConfiguration

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

the class FlashRunConfigurationForm method updateControls.

private void updateControls() {
    final FlexBuildConfiguration bc = myBCCombo.getBC();
    final Module module = myBCCombo.getModule();
    final boolean overrideMainClass = myOverrideMainClassCheckBox.isSelected();
    myMainClassComponent.setEnabled(overrideMainClass);
    myOutputFileNameLabel.setEnabled(overrideMainClass);
    myOutputFileNameTextField.setEnabled(overrideMainClass);
    if (!overrideMainClass && bc != null && module != null) {
        final InfoFromConfigFile info = FlexCompilerConfigFileUtil.getInfoFromConfigFile(bc.getCompilerOptions().getAdditionalConfigFilePath());
        myMainClassComponent.setText(StringUtil.notNullize(info.getMainClass(module), bc.getMainClass()));
        myOutputFileNameTextField.setText(StringUtil.notNullize(info.getOutputFileName(), bc.getOutputFileName()));
    }
    final boolean web = bc != null && bc.getTargetPlatform() == TargetPlatform.Web;
    final boolean desktop = bc != null && bc.getTargetPlatform() == TargetPlatform.Desktop;
    final boolean mobile = bc != null && bc.getTargetPlatform() == TargetPlatform.Mobile;
    myLaunchPanel.setVisible(web);
    myWebOptionsPanel.setVisible(web);
    myDesktopOptionsPanel.setVisible(desktop);
    myMobileRunPanel.setVisible(mobile);
    myMobileOptionsPanel.setVisible(mobile);
    if (web) {
        updateBCOutputLabel(bc);
        myUrlOrFileTextWithBrowse.setEnabled(myUrlOrFileRadioButton.isSelected());
        myLauncherParametersTextWithBrowse.getTextField().setText(myLauncherParameters.getPresentableText());
        myRunTrustedCheckBox.setEnabled(!myUrlOrFileRadioButton.isSelected());
    }
    if (mobile) {
        final boolean runOnEmulator = myOnEmulatorRadioButton.isSelected();
        final boolean app = bc.getOutputType() == OutputType.Application;
        myEmulatorCombo.setEnabled(runOnEmulator);
        UIUtil.setEnabled(myEmulatorScreenSizePanel, runOnEmulator, true);
        myFastPackagingCheckBox.setEnabled(myOnIOSDeviceRadioButton.isSelected());
        myEmulatorAdlOptionsLabel.setEnabled(runOnEmulator);
        myEmulatorAdlOptionsEditor.setEnabled(runOnEmulator);
        myAppDescriptorForEmulatorLabel.setEnabled(app && runOnEmulator);
        myAppDescriptorForEmulatorCombo.setEnabled(app && runOnEmulator);
        if (runOnEmulator) {
            updateEmulatorRelatedControls();
        }
        myIOSSimulatorSdkTextWithBrowse.setEnabled(myOnIOSSimulatorRadioButton.isSelected());
        if (myIOSSimulatorSdkTextWithBrowse.isEnabled() && myIOSSimulatorSdkTextWithBrowse.getText().isEmpty() && SystemInfo.isMac) {
            final String latestSelected = PropertiesComponent.getInstance().getValue(LATEST_SELECTED_IOS_SIMULATOR_SDK_PATH_KEY);
            myIOSSimulatorSdkTextWithBrowse.setText(FileUtil.toSystemDependentName(StringUtil.notNullize(latestSelected, guessIosSimulatorSdkPath())));
        }
        updateDebugTransportRelatedControls();
    }
}
Also used : FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) Module(com.intellij.openapi.module.Module) InfoFromConfigFile(com.intellij.lang.javascript.flex.build.InfoFromConfigFile)

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