Search in sources :

Example 6 with LibraryImpl

use of com.intellij.openapi.roots.impl.libraries.LibraryImpl in project intellij-community by JetBrains.

the class LibraryProjectStructureElement method getSourceOrThis.

@NotNull
private Library getSourceOrThis() {
    final InvocationHandler invocationHandler = Proxy.isProxyClass(myLibrary.getClass()) ? Proxy.getInvocationHandler(myLibrary) : null;
    final Library realLibrary = invocationHandler instanceof ModuleEditor.ProxyDelegateAccessor ? (Library) ((ModuleEditor.ProxyDelegateAccessor) invocationHandler).getDelegate() : myLibrary;
    final Library source = realLibrary instanceof LibraryImpl ? ((LibraryImpl) realLibrary).getSource() : null;
    return source != null ? source : myLibrary;
}
Also used : LibraryImpl(com.intellij.openapi.roots.impl.libraries.LibraryImpl) Library(com.intellij.openapi.roots.libraries.Library) InvocationHandler(java.lang.reflect.InvocationHandler) ModuleEditor(com.intellij.openapi.roots.ui.configuration.ModuleEditor) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

LibraryImpl (com.intellij.openapi.roots.impl.libraries.LibraryImpl)6 Module (com.intellij.openapi.module.Module)3 LibraryTable (com.intellij.openapi.roots.libraries.LibraryTable)3 OrderEntry (com.intellij.openapi.roots.OrderEntry)2 Library (com.intellij.openapi.roots.libraries.Library)2 NotNull (org.jetbrains.annotations.NotNull)2 LibraryOrderEntry (com.intellij.openapi.roots.LibraryOrderEntry)1 ModuleRootModel (com.intellij.openapi.roots.ModuleRootModel)1 ModuleLibraryOrderEntryImpl (com.intellij.openapi.roots.impl.ModuleLibraryOrderEntryImpl)1 ModuleLibraryTable (com.intellij.openapi.roots.impl.ModuleLibraryTable)1 LibraryEx (com.intellij.openapi.roots.impl.libraries.LibraryEx)1 ModuleEditor (com.intellij.openapi.roots.ui.configuration.ModuleEditor)1 ExistingLibraryEditor (com.intellij.openapi.roots.ui.configuration.libraryEditor.ExistingLibraryEditor)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 Predicate (com.intellij.util.containers.Predicate)1 InvocationHandler (java.lang.reflect.InvocationHandler)1 ArrayList (java.util.ArrayList)1