Search in sources :

Example 1 with FlexBCConfigurable

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

the class FlexBCConfigurator method createBcConfigurable.

private CompositeConfigurable createBcConfigurable(final Module module, final ModifiableFlexBuildConfiguration bc, final Runnable treeNodeNameUpdater) {
    final ProjectStructureConfigurable c = ProjectStructureConfigurable.getInstance(module.getProject());
    final Runnable bcNatureModifier = createBCNatureModifier(bc);
    return new FlexBCConfigurable(module, bc, bcNatureModifier, myConfigEditor, c.getProjectJdksModel(), c.getContext()) {

        public void apply() throws ConfigurationException {
            super.apply();
            myBCToOutputPathMap.put(bc, bc.getActualOutputFilePath());
        }

        @Override
        public void setDisplayName(final String name) {
            super.setDisplayName(name);
            treeNodeNameUpdater.run();
            myEventDispatcher.getMulticaster().buildConfigurationRenamed(this);
        }
    }.wrapInTabs();
}
Also used : ConfigurationException(com.intellij.openapi.options.ConfigurationException) FlexBCConfigurable(com.intellij.lang.javascript.flex.projectStructure.ui.FlexBCConfigurable) ProjectStructureConfigurable(com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable)

Example 2 with FlexBCConfigurable

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

the class FlexBuildConfigurationsExtension method selectOrderEntry.

@Nullable
public ActionCallback selectOrderEntry(@NotNull final Module module, @Nullable final OrderEntry entry) {
    if (ModuleType.get(module) != FlexModuleType.getInstance()) {
        return null;
    }
    if (entry instanceof LibraryOrderEntry) {
        final Library library = ((LibraryOrderEntry) entry).getLibrary();
        if (library != null && library.getTable() == null && ((LibraryEx) library).getKind() == FlexLibraryType.FLEX_LIBRARY) {
            final String libraryId = FlexProjectRootsUtil.getLibraryId(library);
            final List<CompositeConfigurable> configurables = myConfigurator.getBCConfigurables(module);
            // several build configurations may depend on the same library, here we select the first one we find
            for (CompositeConfigurable configurable : configurables) {
                final FlexBCConfigurable bcConfigurable = FlexBCConfigurable.unwrap(configurable);
                final Dependencies dependencies = bcConfigurable.getDependenciesConfigurable().getEditableObject();
                for (DependencyEntry e : dependencies.getEntries()) {
                    if (!(e instanceof ModuleLibraryEntry) || !((ModuleLibraryEntry) e).getLibraryId().equals(libraryId)) {
                        continue;
                    }
                    final Place p = FlexProjectStructureUtil.createPlace(bcConfigurable, DependenciesConfigurable.TAB_NAME);
                    final DependenciesConfigurable.Location.TableEntry tableEntry = DependenciesConfigurable.Location.TableEntry.forModuleLibrary(libraryId);
                    p.putPath(FlexBCConfigurable.LOCATION_ON_TAB, tableEntry);
                    return ProjectStructureConfigurable.getInstance(module.getProject()).navigateTo(p, true);
                }
            }
        }
    }
    return ProjectStructureConfigurable.getInstance(module.getProject()).select(module.getName(), null, true);
}
Also used : ModuleLibraryEntry(com.intellij.lang.javascript.flex.projectStructure.model.ModuleLibraryEntry) CompositeConfigurable(com.intellij.lang.javascript.flex.projectStructure.ui.CompositeConfigurable) LibraryEx(com.intellij.openapi.roots.impl.libraries.LibraryEx) LibraryOrderEntry(com.intellij.openapi.roots.LibraryOrderEntry) FlexBCConfigurable(com.intellij.lang.javascript.flex.projectStructure.ui.FlexBCConfigurable) DependencyEntry(com.intellij.lang.javascript.flex.projectStructure.model.DependencyEntry) Library(com.intellij.openapi.roots.libraries.Library) Dependencies(com.intellij.lang.javascript.flex.projectStructure.model.Dependencies) Place(com.intellij.ui.navigation.Place) Nullable(org.jetbrains.annotations.Nullable)

Example 3 with FlexBCConfigurable

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

FlexBCConfigurable (com.intellij.lang.javascript.flex.projectStructure.ui.FlexBCConfigurable)3 ConfigurationException (com.intellij.openapi.options.ConfigurationException)2 BuildConfigurationNature (com.intellij.flex.model.bc.BuildConfigurationNature)1 Dependencies (com.intellij.lang.javascript.flex.projectStructure.model.Dependencies)1 DependencyEntry (com.intellij.lang.javascript.flex.projectStructure.model.DependencyEntry)1 ModifiableFlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)1 ModuleLibraryEntry (com.intellij.lang.javascript.flex.projectStructure.model.ModuleLibraryEntry)1 AddBuildConfigurationDialog (com.intellij.lang.javascript.flex.projectStructure.ui.AddBuildConfigurationDialog)1 CompositeConfigurable (com.intellij.lang.javascript.flex.projectStructure.ui.CompositeConfigurable)1 Module (com.intellij.openapi.module.Module)1 LibraryOrderEntry (com.intellij.openapi.roots.LibraryOrderEntry)1 LibraryEx (com.intellij.openapi.roots.impl.libraries.LibraryEx)1 Library (com.intellij.openapi.roots.libraries.Library)1 ProjectStructureConfigurable (com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable)1 Place (com.intellij.ui.navigation.Place)1 Nullable (org.jetbrains.annotations.Nullable)1