Search in sources :

Example 1 with AddBuildConfigurationDialog

use of com.intellij.lang.javascript.flex.projectStructure.ui.AddBuildConfigurationDialog 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 AddBuildConfigurationDialog

use of com.intellij.lang.javascript.flex.projectStructure.ui.AddBuildConfigurationDialog in project intellij-plugins by JetBrains.

the class FlexBCConfigurator method copy.

public void copy(final CompositeConfigurable configurable, final Runnable treeNodeNameUpdater) {
    try {
        configurable.apply();
    } catch (ConfigurationException ignored) {
    /**/
    }
    ModifiableFlexBuildConfiguration existingBC = myConfigurablesMap.getKeysByValue(configurable).get(0);
    FlexBCConfigurable unwrapped = FlexBCConfigurable.unwrap(configurable);
    final String title = FlexBundle.message("copy.build.configuration", existingBC.getName(), unwrapped.getModule().getName());
    Module module = unwrapped.getModule();
    AddBuildConfigurationDialog dialog = new AddBuildConfigurationDialog(module.getProject(), title, getUsedNames(module), existingBC.getNature(), true);
    dialog.reset("", existingBC.getAndroidPackagingOptions().isEnabled(), existingBC.getIosPackagingOptions().isEnabled());
    if (!dialog.showAndGet()) {
        return;
    }
    final String newBCName = dialog.getBCName();
    final String fileName = PathUtil.suggestFileName(newBCName);
    final BuildConfigurationNature newNature = dialog.getNature();
    ModifiableFlexBuildConfiguration newBC = myConfigEditor.copyConfiguration(existingBC, newNature);
    newBC.setName(newBCName);
    newBC.setOutputFileName(fileName + (newBC.getOutputType() == OutputType.Library ? ".swc" : ".swf"));
    updatePackageFileName(newBC, fileName);
    if (newNature.isApp() && newNature.isMobilePlatform()) {
        newBC.getAndroidPackagingOptions().setEnabled(dialog.isAndroidEnabled());
        newBC.getIosPackagingOptions().setEnabled(dialog.isIOSEnabled());
    }
    createConfigurableNode(newBC, unwrapped.getModule(), treeNodeNameUpdater);
}
Also used : BuildConfigurationNature(com.intellij.flex.model.bc.BuildConfigurationNature) ConfigurationException(com.intellij.openapi.options.ConfigurationException) FlexBCConfigurable(com.intellij.lang.javascript.flex.projectStructure.ui.FlexBCConfigurable) Module(com.intellij.openapi.module.Module) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration) AddBuildConfigurationDialog(com.intellij.lang.javascript.flex.projectStructure.ui.AddBuildConfigurationDialog)

Aggregations

BuildConfigurationNature (com.intellij.flex.model.bc.BuildConfigurationNature)2 ModifiableFlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)2 AddBuildConfigurationDialog (com.intellij.lang.javascript.flex.projectStructure.ui.AddBuildConfigurationDialog)2 SdkEntry (com.intellij.lang.javascript.flex.projectStructure.model.SdkEntry)1 FlexBCConfigurable (com.intellij.lang.javascript.flex.projectStructure.ui.FlexBCConfigurable)1 Module (com.intellij.openapi.module.Module)1 ConfigurationException (com.intellij.openapi.options.ConfigurationException)1