mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-55107 UTE at LibraryTableEditor
This commit is contained in:
+15
-1
@@ -30,12 +30,17 @@ import com.intellij.openapi.project.ProjectBundle;
|
||||
import com.intellij.openapi.projectRoots.ui.Util;
|
||||
import com.intellij.openapi.roots.AnnotationOrderRootType;
|
||||
import com.intellij.openapi.roots.JavadocOrderRootType;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.impl.libraries.LibraryEx;
|
||||
import com.intellij.openapi.roots.impl.libraries.LibraryImpl;
|
||||
import com.intellij.openapi.roots.impl.libraries.LibraryTableImplUtil;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.roots.libraries.LibraryTable;
|
||||
import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar;
|
||||
import com.intellij.openapi.roots.libraries.LibraryUtil;
|
||||
import com.intellij.openapi.roots.ui.configuration.LibraryTableModifiableModelProvider;
|
||||
import com.intellij.openapi.roots.ui.configuration.ModuleEditor;
|
||||
import com.intellij.openapi.roots.ui.configuration.PathUIUtils;
|
||||
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.BaseLibrariesConfigurable;
|
||||
@@ -72,6 +77,8 @@ import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1057,7 +1064,14 @@ public class LibraryTableEditor implements Disposable, LibraryEditorListener {
|
||||
final NullableComputable<Library.ModifiableModel> computable = new NullableComputable<Library.ModifiableModel>() {
|
||||
public Library.ModifiableModel compute() {
|
||||
if (myTreeBuilder == null) {
|
||||
final Library.ModifiableModel model = library.getModifiableModel();
|
||||
// The following lines were born in severe pain & suffering, please respect
|
||||
final InvocationHandler invocationHandler = Proxy.isProxyClass(library.getClass())? Proxy.getInvocationHandler(library) : null;
|
||||
final Library realLibrary = invocationHandler instanceof ModuleEditor.ProxyDelegateAccessor? (Library)((ModuleEditor.ProxyDelegateAccessor)invocationHandler)
|
||||
.getDelegate() : library;
|
||||
final Module module = realLibrary instanceof LibraryImpl && ((LibraryImpl)realLibrary).isDisposed()? ((LibraryImpl)realLibrary).getModule() : null;
|
||||
if (module != null && module.isDisposed()) return null; // no way
|
||||
final Library targetLibrary = module != null? LibraryUtil.findLibrary(module, realLibrary.getName()) : realLibrary;
|
||||
final Library.ModifiableModel model = targetLibrary.getModifiableModel();
|
||||
modelRef.set(model);
|
||||
return model;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user