Search in sources :

Example 1 with SdkEntry

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

the class FlexBCConfigurator method addConfiguration.

public void addConfiguration(final Module module, final Runnable treeNodeNameUpdater) {
    if (module == null) {
        return;
    }
    final String title = FlexBundle.message("add.build.configuration.title", module.getName());
    final AddBuildConfigurationDialog dialog = new AddBuildConfigurationDialog(module.getProject(), title, getUsedNames(module), BuildConfigurationNature.DEFAULT, true);
    if (!dialog.showAndGet()) {
        return;
    }
    final ModifiableFlexBuildConfiguration bc = myConfigEditor.createConfiguration(module);
    final String bcName = dialog.getBCName();
    final String fileName = PathUtil.suggestFileName(bcName);
    final BuildConfigurationNature nature = dialog.getNature();
    bc.setName(bcName);
    bc.setNature(nature);
    final ModifiableFlexBuildConfiguration someExistingConfig = myConfigEditor.getConfigurations(module)[0];
    bc.setOutputFileName(fileName + (bc.getOutputType() == OutputType.Library ? ".swc" : ".swf"));
    bc.setOutputFolder(someExistingConfig.getOutputFolder());
    updatePackageFileName(bc, fileName);
    if (nature.isApp() && nature.isMobilePlatform()) {
        bc.getAndroidPackagingOptions().setEnabled(dialog.isAndroidEnabled());
        bc.getIosPackagingOptions().setEnabled(dialog.isIOSEnabled());
    }
    final SdkEntry sdkEntry = someExistingConfig.getDependencies().getSdkEntry();
    final SdkEntry newSdkEntry;
    if (sdkEntry != null && FlexSdkUtils.findFlexOrFlexmojosSdk(sdkEntry.getName()) != null) {
        newSdkEntry = Factory.createSdkEntry(sdkEntry.getName());
    } else {
        newSdkEntry = findAnySdk();
    }
    bc.getDependencies().setSdkEntry(newSdkEntry);
    createConfigurableNode(bc, module, treeNodeNameUpdater);
}
Also used : BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration) AddBuildConfigurationDialog(com.intellij.lang.javascript.flex.projectStructure.ui.AddBuildConfigurationDialog) SdkEntry(com.intellij.lang.javascript.flex.projectStructure.model.SdkEntry)

Example 2 with SdkEntry

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

the class FlexSdkStep method selectSdkUsedByOtherModules.

private static void selectSdkUsedByOtherModules(@Nullable final Project project, final FlexSdkComboBoxWithBrowseButton combo) {
    if (project == null) {
        return;
    }
    final FlexProjectConfigurationEditor currentEditor = FlexBuildConfigurationsExtension.getInstance().getConfigurator().getConfigEditor();
    if (currentEditor != null) {
        final Module[] modules = ModuleStructureConfigurable.getInstance(project).getModules();
        for (Module module : modules) {
            if (ModuleType.get(module) != FlexModuleType.getInstance()) {
                continue;
            }
            for (ModifiableFlexBuildConfiguration c : currentEditor.getConfigurations(module)) {
                SdkEntry sdkEntry = c.getDependencies().getSdkEntry();
                Sdk sdk;
                if (sdkEntry != null && (sdk = FlexSdkUtils.findFlexOrFlexmojosSdk(sdkEntry.getName())) != null && sdk.getSdkType() == FlexSdkType2.getInstance()) {
                    combo.setSelectedSdkRaw(sdk.getName());
                    return;
                }
            }
        }
    } else {
        for (final Module module : ModuleManager.getInstance(project).getModules()) {
            if (ModuleType.get(module) == FlexModuleType.getInstance()) {
                for (FlexBuildConfiguration bc : FlexBuildConfigurationManager.getInstance(module).getBuildConfigurations()) {
                    Sdk sdk = bc.getSdk();
                    if (sdk != null) {
                        combo.setSelectedSdkRaw(sdk.getName());
                        return;
                    }
                }
            }
        }
    }
}
Also used : FlexProjectConfigurationEditor(com.intellij.lang.javascript.flex.projectStructure.model.impl.FlexProjectConfigurationEditor) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) Sdk(com.intellij.openapi.projectRoots.Sdk) Module(com.intellij.openapi.module.Module) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration) SdkEntry(com.intellij.lang.javascript.flex.projectStructure.model.SdkEntry)

Aggregations

ModifiableFlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)2 SdkEntry (com.intellij.lang.javascript.flex.projectStructure.model.SdkEntry)2 BuildConfigurationNature (com.intellij.flex.model.bc.BuildConfigurationNature)1 FlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)1 FlexProjectConfigurationEditor (com.intellij.lang.javascript.flex.projectStructure.model.impl.FlexProjectConfigurationEditor)1 AddBuildConfigurationDialog (com.intellij.lang.javascript.flex.projectStructure.ui.AddBuildConfigurationDialog)1 Module (com.intellij.openapi.module.Module)1 Sdk (com.intellij.openapi.projectRoots.Sdk)1