Search in sources :

Example 1 with CompositeConfigurable

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

the class FlexBCConfigurator method createConfigurableNode.

private void createConfigurableNode(ModifiableFlexBuildConfiguration bc, Module module, Runnable treeNodeNameUpdater) {
    CompositeConfigurable wrapped = createBcConfigurable(module, bc, treeNodeNameUpdater);
    myConfigurablesMap.put(bc, wrapped);
    final MasterDetailsComponent.MyNode node = new BuildConfigurationNode(wrapped);
    final ModuleStructureConfigurable moduleStructureConfigurable = ModuleStructureConfigurable.getInstance(module.getProject());
    moduleStructureConfigurable.addNode(node, moduleStructureConfigurable.findModuleNode(module));
    Place place = new Place().putPath(ProjectStructureConfigurable.CATEGORY, moduleStructureConfigurable).putPath(MasterDetailsComponent.TREE_OBJECT, bc);
    ProjectStructureConfigurable.getInstance(module.getProject()).navigateTo(place, true);
}
Also used : ModuleStructureConfigurable(com.intellij.openapi.roots.ui.configuration.projectRoot.ModuleStructureConfigurable) CompositeConfigurable(com.intellij.lang.javascript.flex.projectStructure.ui.CompositeConfigurable) MasterDetailsComponent(com.intellij.openapi.ui.MasterDetailsComponent) Place(com.intellij.ui.navigation.Place)

Example 2 with CompositeConfigurable

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

the class FlexBCConfigurator method removeConfiguration.

public void removeConfiguration(final ModifiableFlexBuildConfiguration bc) {
    CompositeConfigurable configurable = myConfigurablesMap.remove(bc);
    myBCToOutputPathMap.remove(bc);
    final ProjectStructureDaemonAnalyzer daemonAnalyzer = ProjectStructureConfigurable.getInstance(myConfigEditor.getProject()).getContext().getDaemonAnalyzer();
    daemonAnalyzer.removeElement(configurable.getProjectStructureElement());
    daemonAnalyzer.queueUpdateForAllElementsWithErrors();
    myEventDispatcher.getMulticaster().buildConfigurationRemoved(FlexBCConfigurable.unwrap(configurable));
}
Also used : ProjectStructureDaemonAnalyzer(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureDaemonAnalyzer) CompositeConfigurable(com.intellij.lang.javascript.flex.projectStructure.ui.CompositeConfigurable)

Example 3 with CompositeConfigurable

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

the class FlexBCConfigurator method moduleRemoved.

public void moduleRemoved(final Module module) {
    if (ModuleType.get(module) != FlexModuleType.getInstance()) {
        return;
    }
    // config editor will handle event and update modifiable model on its own, we just need to update configurables
    Collection<ModifiableFlexBuildConfiguration> configsToRemove = ContainerUtil.findAll(myConfigurablesMap.keySet(), bc -> myConfigEditor.getModule(bc) == module);
    final ProjectStructureDaemonAnalyzer daemonAnalyzer = ProjectStructureConfigurable.getInstance(myConfigEditor.getProject()).getContext().getDaemonAnalyzer();
    for (ModifiableFlexBuildConfiguration bc : configsToRemove) {
        CompositeConfigurable configurable = myConfigurablesMap.remove(bc);
        myBCToOutputPathMap.remove(bc);
        daemonAnalyzer.removeElement(configurable.getProjectStructureElement());
        daemonAnalyzer.queueUpdateForAllElementsWithErrors();
        configurable.disposeUIResources();
    }
    myEventDispatcher.getMulticaster().moduleRemoved(module);
}
Also used : ProjectStructureDaemonAnalyzer(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureDaemonAnalyzer) CompositeConfigurable(com.intellij.lang.javascript.flex.projectStructure.ui.CompositeConfigurable) ModifiableFlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)

Example 4 with CompositeConfigurable

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

the class FlexBCConfigurator method reset.

public void reset(Project project) {
    myModifiableModelInitializer.ensureInitialized(project);
    ModuleStructureConfigurable moduleStructureConfigurable = ModuleStructureConfigurable.getInstance(project);
    for (final CompositeConfigurable configurable : myConfigurablesMap.values()) {
        moduleStructureConfigurable.ensureInitialized(configurable);
    }
}
Also used : ModuleStructureConfigurable(com.intellij.openapi.roots.ui.configuration.projectRoot.ModuleStructureConfigurable) CompositeConfigurable(com.intellij.lang.javascript.flex.projectStructure.ui.CompositeConfigurable)

Example 5 with CompositeConfigurable

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

Aggregations

CompositeConfigurable (com.intellij.lang.javascript.flex.projectStructure.ui.CompositeConfigurable)7 ModuleStructureConfigurable (com.intellij.openapi.roots.ui.configuration.projectRoot.ModuleStructureConfigurable)3 ModifiableFlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)2 ProjectStructureDaemonAnalyzer (com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureDaemonAnalyzer)2 Place (com.intellij.ui.navigation.Place)2 Dependencies (com.intellij.lang.javascript.flex.projectStructure.model.Dependencies)1 DependencyEntry (com.intellij.lang.javascript.flex.projectStructure.model.DependencyEntry)1 ModuleLibraryEntry (com.intellij.lang.javascript.flex.projectStructure.model.ModuleLibraryEntry)1 FlexBCConfigurable (com.intellij.lang.javascript.flex.projectStructure.ui.FlexBCConfigurable)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 MasterDetailsComponent (com.intellij.openapi.ui.MasterDetailsComponent)1 Nullable (org.jetbrains.annotations.Nullable)1