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);
}
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;
}
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);
}
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()]));
}
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();
}
}
Aggregations