Search in sources :

Example 1 with LibraryProjectStructureElement

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

the class UsageInArtifact method replaceElement.

@Override
public void replaceElement(final ProjectStructureElement newElement) {
    Library library = ((LibraryProjectStructureElement) newElement).getLibrary();
    PackagingElement<?> newLibraryElement = PackagingElementFactory.getInstance().createLibraryFiles(library.getName(), library.getTable().getTableLevel(), null);
    replaceElement(newLibraryElement);
}
Also used : Library(com.intellij.openapi.roots.libraries.Library) LibraryProjectStructureElement(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement)

Example 2 with LibraryProjectStructureElement

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

the class SourceItemFindUsagesAction method getSelectedElement.

@Override
protected ProjectStructureElement getSelectedElement() {
    final List<SourceItemNode> nodes = myTree.getSelectedSourceItemNodes();
    if (nodes.size() != 1)
        return null;
    ArtifactsTreeNode node = nodes.get(0);
    if (!(node instanceof SourceItemNode)) {
        return null;
    }
    PackagingSourceItem sourceItem = ((SourceItemNode) node).getSourceItem();
    if (sourceItem == null)
        return null;
    final StructureConfigurableContext context = getContext();
    if (sourceItem instanceof ModuleOutputSourceItem) {
        return new ModuleProjectStructureElement(context, ((ModuleOutputSourceItem) sourceItem).getModule());
    } else if (sourceItem instanceof LibrarySourceItem) {
        return new LibraryProjectStructureElement(context, ((LibrarySourceItem) sourceItem).getLibrary());
    } else if (sourceItem instanceof ArtifactSourceItem) {
        return myArtifactContext.getOrCreateArtifactElement(((ArtifactSourceItem) sourceItem).getArtifact());
    }
    return null;
}
Also used : PackagingSourceItem(com.intellij.packaging.ui.PackagingSourceItem) ModuleProjectStructureElement(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement) StructureConfigurableContext(com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext) ArtifactsStructureConfigurableContext(com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactsStructureConfigurableContext) ArtifactsTreeNode(com.intellij.openapi.roots.ui.configuration.artifacts.nodes.ArtifactsTreeNode) LibraryProjectStructureElement(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement)

Example 3 with LibraryProjectStructureElement

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

the class AddLibraryToModuleDependenciesAction method update.

@Override
public void update(AnActionEvent e) {
    final ProjectStructureElement element = myConfigurable.getSelectedElement();
    boolean visible = false;
    if (element instanceof LibraryProjectStructureElement) {
        final LibraryEx library = (LibraryEx) ((LibraryProjectStructureElement) element).getLibrary();
        visible = !LibraryEditingUtil.getSuitableModules(ModuleStructureConfigurable.getInstance(myProject), library.getKind(), library).isEmpty();
    }
    e.getPresentation().setVisible(visible);
}
Also used : LibraryProjectStructureElement(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement) ProjectStructureElement(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureElement) LibraryEx(com.intellij.openapi.roots.impl.libraries.LibraryEx) LibraryProjectStructureElement(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement)

Example 4 with LibraryProjectStructureElement

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

the class BaseLibrariesConfigurable method removeLibraries.

public void removeLibraries(@NotNull List<LibraryProjectStructureElement> libraries) {
    List<TreePath> pathsToRemove = new ArrayList<>();
    for (LibraryProjectStructureElement element : libraries) {
        getModelProvider().getModifiableModel().removeLibrary(element.getLibrary());
        MyNode node = findNodeByObject(myRoot, element.getLibrary());
        if (node != null) {
            pathsToRemove.add(TreeUtil.getPathFromRoot(node));
        }
    }
    myContext.getDaemonAnalyzer().removeElements(libraries);
    removePaths(pathsToRemove.toArray(new TreePath[pathsToRemove.size()]));
}
Also used : TreePath(javax.swing.tree.TreePath) LibraryProjectStructureElement(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement)

Example 5 with LibraryProjectStructureElement

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

LibraryProjectStructureElement (com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement)7 Library (com.intellij.openapi.roots.libraries.Library)3 LibraryEx (com.intellij.openapi.roots.impl.libraries.LibraryEx)2 ProjectStructureElement (com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureElement)2 LibraryTable (com.intellij.openapi.roots.libraries.LibraryTable)1 ArtifactsStructureConfigurableContext (com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactsStructureConfigurableContext)1 ArtifactsTreeNode (com.intellij.openapi.roots.ui.configuration.artifacts.nodes.ArtifactsTreeNode)1 StructureConfigurableContext (com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext)1 ModuleProjectStructureElement (com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement)1 ProjectStructureDaemonAnalyzer (com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureDaemonAnalyzer)1 ProjectStructureElementUsage (com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureElementUsage)1 PackagingSourceItem (com.intellij.packaging.ui.PackagingSourceItem)1 TreePath (javax.swing.tree.TreePath)1