use of com.intellij.openapi.roots.OrderEntry in project intellij-community by JetBrains.
the class AddNewModuleLibraryAction method createTableItem.
@Override
protected ClasspathTableItem<?> createTableItem(final Library item) {
final OrderEntry[] entries = myClasspathPanel.getRootModel().getOrderEntries();
for (OrderEntry entry : entries) {
if (entry instanceof LibraryOrderEntry) {
final LibraryOrderEntry libraryOrderEntry = (LibraryOrderEntry) entry;
if (item.equals(libraryOrderEntry.getLibrary())) {
return ClasspathTableItem.createLibItem(libraryOrderEntry, myContext);
}
}
}
LOG.error("Unknown library " + item);
return null;
}
use of com.intellij.openapi.roots.OrderEntry in project intellij-community by JetBrains.
the class ChangeLibraryLevelInClasspathAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent event) {
final OrderEntry entry = myPanel.getSelectedEntry();
if (!(entry instanceof LibraryOrderEntry))
return;
LibraryOrderEntry libraryEntry = (LibraryOrderEntry) entry;
final LibraryEx library = (LibraryEx) libraryEntry.getLibrary();
if (library == null)
return;
final Library copied = doCopy(library);
if (copied == null)
return;
if (!isConvertingToModuleLibrary()) {
OrderEntryUtil.replaceLibrary(myPanel.getRootModel(), library, copied);
} else {
OrderEntryUtil.replaceLibraryEntryByAdded(myPanel.getRootModel(), libraryEntry);
}
}
use of com.intellij.openapi.roots.OrderEntry in project intellij-community by JetBrains.
the class ClasspathTableModel method getEntries.
private List<OrderEntry> getEntries() {
final int count = getRowCount();
final List<OrderEntry> entries = new ArrayList<>(count);
for (int row = 0; row < count; row++) {
final OrderEntry entry = getItem(row).getEntry();
if (entry != null) {
entries.add(entry);
}
}
return entries;
}
use of com.intellij.openapi.roots.OrderEntry in project intellij-community by JetBrains.
the class ClasspathTableModel method init.
public void init() {
final OrderEntry[] orderEntries = getModel().getOrderEntries();
boolean hasJdkOrderEntry = false;
List<ClasspathTableItem<?>> items = new ArrayList<>();
for (final OrderEntry orderEntry : orderEntries) {
if (orderEntry instanceof JdkOrderEntry) {
hasJdkOrderEntry = true;
}
items.add(ClasspathTableItem.createItem(orderEntry, myContext));
}
if (!hasJdkOrderEntry) {
items.add(0, new InvalidJdkItem());
}
setItems(items);
}
use of com.intellij.openapi.roots.OrderEntry in project intellij-community by JetBrains.
the class PsiFileNode method isNavigatableLibraryRoot.
private boolean isNavigatableLibraryRoot() {
VirtualFile jarRoot = getJarRoot();
final Project project = getProject();
if (jarRoot != null && project != null && ProjectRootsUtil.isLibraryRoot(jarRoot, project)) {
final OrderEntry orderEntry = LibraryUtil.findLibraryEntry(jarRoot, project);
return orderEntry != null && ProjectSettingsService.getInstance(project).canOpenLibraryOrSdkSettings(orderEntry);
}
return false;
}
Aggregations