Search in sources :

Example 1 with ProjectStructureDaemonAnalyzer

use of com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureDaemonAnalyzer in project intellij-community by JetBrains.

the class ModuleStructureConfigurable method addModuleNode.

private void addModuleNode(final Module module) {
    final TreePath selectionPath = myTree.getSelectionPath();
    MyNode parent = null;
    if (selectionPath != null) {
        MyNode selected = (MyNode) selectionPath.getLastPathComponent();
        final Object o = selected.getConfigurable().getEditableObject();
        if (o instanceof ModuleGroup) {
            myContext.myModulesConfigurator.getModuleModel().setModuleGroupPath(module, ((ModuleGroup) o).getGroupPath());
            parent = selected;
        } else if (o instanceof Module) {
            //create near selected
            final ModifiableModuleModel modifiableModuleModel = myContext.myModulesConfigurator.getModuleModel();
            final String[] groupPath = modifiableModuleModel.getModuleGroupPath((Module) o);
            if (groupPath != null) {
                modifiableModuleModel.setModuleGroupPath(module, groupPath);
                parent = findNodeByObject(myRoot, new ModuleGroup(Arrays.asList(groupPath)));
            }
        }
    }
    if (parent == null)
        parent = myRoot;
    MyNode node = createModuleNode(module, getModuleGrouper());
    TreeUtil.insertNode(node, parent, getTreeModel(), getNodeComparator());
    selectNodeInTree(node);
    final ProjectStructureDaemonAnalyzer daemonAnalyzer = myContext.getDaemonAnalyzer();
    daemonAnalyzer.queueUpdate(new ModuleProjectStructureElement(myContext, module));
    //missing modules added
    daemonAnalyzer.queueUpdateForAllElementsWithErrors();
}
Also used : ProjectStructureDaemonAnalyzer(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureDaemonAnalyzer) ModuleProjectStructureElement(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement) ModuleGroup(com.intellij.ide.projectView.impl.ModuleGroup)

Example 2 with ProjectStructureDaemonAnalyzer

use of com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureDaemonAnalyzer 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 ProjectStructureDaemonAnalyzer

use of com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureDaemonAnalyzer 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 ProjectStructureDaemonAnalyzer

use of com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureDaemonAnalyzer in project intellij-community by JetBrains.

the class ProjectStructureElementRenderer method customizeCellRenderer.

@Override
public void customizeCellRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
    if (value instanceof MasterDetailsComponent.MyNode) {
        final MasterDetailsComponent.MyNode node = (MasterDetailsComponent.MyNode) value;
        final NamedConfigurable namedConfigurable = node.getConfigurable();
        if (namedConfigurable == null) {
            return;
        }
        final String displayName = node.getDisplayName();
        final Icon icon = namedConfigurable.getIcon(expanded);
        setIcon(icon);
        setToolTipText(null);
        setFont(UIUtil.getTreeFont());
        SimpleTextAttributes textAttributes = SimpleTextAttributes.REGULAR_ATTRIBUTES;
        if (node.isDisplayInBold()) {
            textAttributes = SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES;
        } else if (namedConfigurable instanceof ProjectStructureElementConfigurable) {
            final ProjectStructureElement projectStructureElement = ((ProjectStructureElementConfigurable) namedConfigurable).getProjectStructureElement();
            if (projectStructureElement != null) {
                final ProjectStructureDaemonAnalyzer daemonAnalyzer = myContext.getDaemonAnalyzer();
                final ProjectStructureProblemsHolderImpl problemsHolder = daemonAnalyzer.getProblemsHolder(projectStructureElement);
                if (problemsHolder != null && problemsHolder.containsProblems()) {
                    final boolean isUnused = problemsHolder.containsProblems(ProjectStructureProblemType.Severity.UNUSED);
                    final boolean haveWarnings = problemsHolder.containsProblems(ProjectStructureProblemType.Severity.WARNING);
                    final boolean haveErrors = problemsHolder.containsProblems(ProjectStructureProblemType.Severity.ERROR);
                    Color foreground = isUnused ? UIUtil.getInactiveTextColor() : null;
                    final int style = haveWarnings || haveErrors ? SimpleTextAttributes.STYLE_WAVED : -1;
                    final Color waveColor = haveErrors ? JBColor.RED : haveWarnings ? JBColor.GRAY : null;
                    textAttributes = textAttributes.derive(style, foreground, null, waveColor);
                    setToolTipText(problemsHolder.composeTooltipMessage());
                }
                append(displayName, textAttributes);
                String description = projectStructureElement.getDescription();
                if (description != null) {
                    append(" (" + description + ")", SimpleTextAttributes.GRAY_ATTRIBUTES, false);
                }
                return;
            }
        }
        append(displayName, textAttributes);
    }
}
Also used : ProjectStructureDaemonAnalyzer(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureDaemonAnalyzer) ProjectStructureProblemsHolderImpl(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureProblemsHolderImpl) NamedConfigurable(com.intellij.openapi.ui.NamedConfigurable) SimpleTextAttributes(com.intellij.ui.SimpleTextAttributes) JBColor(com.intellij.ui.JBColor) MasterDetailsComponent(com.intellij.openapi.ui.MasterDetailsComponent) ProjectStructureElement(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureElement)

Example 5 with ProjectStructureDaemonAnalyzer

use of com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureDaemonAnalyzer in project intellij-community by JetBrains.

the class BaseLibrariesConfigurable method createLibraryNode.

public void createLibraryNode(Library library) {
    final LibraryTable table = library.getTable();
    if (table != null) {
        final String level = table.getTableLevel();
        final LibraryConfigurable configurable = new LibraryConfigurable(myContext.createModifiableModelProvider(level), library, myContext, TREE_UPDATER);
        final MyNode node = new MyNode(configurable);
        addNode(node, myRoot);
        final ProjectStructureDaemonAnalyzer daemonAnalyzer = myContext.getDaemonAnalyzer();
        daemonAnalyzer.queueUpdate(new LibraryProjectStructureElement(myContext, library));
        daemonAnalyzer.queueUpdateForAllElementsWithErrors();
    }
}
Also used : ProjectStructureDaemonAnalyzer(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureDaemonAnalyzer) LibraryTable(com.intellij.openapi.roots.libraries.LibraryTable) LibraryProjectStructureElement(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement)

Aggregations

ProjectStructureDaemonAnalyzer (com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureDaemonAnalyzer)5 CompositeConfigurable (com.intellij.lang.javascript.flex.projectStructure.ui.CompositeConfigurable)2 ModuleGroup (com.intellij.ide.projectView.impl.ModuleGroup)1 ModifiableFlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)1 LibraryTable (com.intellij.openapi.roots.libraries.LibraryTable)1 LibraryProjectStructureElement (com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement)1 ModuleProjectStructureElement (com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement)1 ProjectStructureElement (com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureElement)1 ProjectStructureProblemsHolderImpl (com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureProblemsHolderImpl)1 MasterDetailsComponent (com.intellij.openapi.ui.MasterDetailsComponent)1 NamedConfigurable (com.intellij.openapi.ui.NamedConfigurable)1 JBColor (com.intellij.ui.JBColor)1 SimpleTextAttributes (com.intellij.ui.SimpleTextAttributes)1