Search in sources :

Example 6 with LibraryProjectStructureElement

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

the class ChangeLibraryLevelAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    final ProjectStructureElement selectedElement = mySourceConfigurable.getSelectedElement();
    if (!(selectedElement instanceof LibraryProjectStructureElement))
        return;
    final StructureConfigurableContext context = mySourceConfigurable.myContext;
    final LibraryProjectStructureElement libraryElement = (LibraryProjectStructureElement) selectedElement;
    final LibraryEx oldLibrary = (LibraryEx) context.getLibrary(libraryElement.getLibrary().getName(), mySourceConfigurable.getLevel());
    LOG.assertTrue(oldLibrary != null);
    final Library newLibrary = doCopy(oldLibrary);
    if (newLibrary == null)
        return;
    final Collection<ProjectStructureElementUsage> usages = context.getDaemonAnalyzer().getUsages(libraryElement);
    for (ProjectStructureElementUsage usage : usages) {
        usage.replaceElement(new LibraryProjectStructureElement(context, newLibrary));
    }
    if (!myCopy) {
        mySourceConfigurable.removeLibrary(libraryElement);
    }
    ProjectStructureConfigurable.getInstance(myProject).selectProjectOrGlobalLibrary(newLibrary, true);
}
Also used : ProjectStructureElementUsage(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureElementUsage) 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) Library(com.intellij.openapi.roots.libraries.Library) LibraryProjectStructureElement(com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement)

Example 7 with LibraryProjectStructureElement

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

the class AddLibraryToModuleDependenciesAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    final LibraryProjectStructureElement element = (LibraryProjectStructureElement) myConfigurable.getSelectedElement();
    if (element == null)
        return;
    final Library library = element.getLibrary();
    LibraryEditingUtil.showDialogAndAddLibraryToDependencies(library, myProject, false);
}
Also used : Library(com.intellij.openapi.roots.libraries.Library) 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