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