use of com.intellij.openapi.roots.ui.configuration.artifacts.nodes.ArtifactsTreeNode 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;
}
Aggregations