From 225d617946651925d545606224beee9693813bd8 Mon Sep 17 00:00:00 2001 From: nik Date: Thu, 24 Nov 2011 11:26:24 +0400 Subject: [PATCH] unused class removed --- .../LibraryRootsComponentForm.form | 14 +-- .../libraryEditor/LibraryRootsComponent.java | 116 +----------------- .../LibraryTableAttachHandler.java | 37 ------ resources/src/idea/RichPlatformPlugin.xml | 2 - 4 files changed, 6 insertions(+), 163 deletions(-) delete mode 100644 java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryTableAttachHandler.java diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/LibraryRootsComponentForm.form b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/LibraryRootsComponentForm.form index 059094879905..c21924c3246f 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/LibraryRootsComponentForm.form +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/LibraryRootsComponentForm.form @@ -8,7 +8,7 @@ - + @@ -18,23 +18,15 @@ - + - - - - - - - - - + diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryRootsComponent.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryRootsComponent.java index c9f405ea9542..18a4a6687de1 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryRootsComponent.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryRootsComponent.java @@ -26,23 +26,16 @@ import com.intellij.openapi.module.Module; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectBundle; import com.intellij.openapi.roots.OrderRootType; -import com.intellij.openapi.roots.impl.libraries.LibraryImpl; -import com.intellij.openapi.roots.libraries.*; +import com.intellij.openapi.roots.libraries.LibraryKind; +import com.intellij.openapi.roots.libraries.LibraryProperties; +import com.intellij.openapi.roots.libraries.LibraryType; import com.intellij.openapi.roots.libraries.ui.*; import com.intellij.openapi.roots.libraries.ui.impl.RootDetectionUtil; -import com.intellij.openapi.roots.ui.configuration.ModuleEditor; import com.intellij.openapi.roots.ui.configuration.libraries.LibraryPresentationManager; -import com.intellij.openapi.roots.ui.configuration.projectRoot.ModuleStructureConfigurable; import com.intellij.openapi.ui.VerticalFlowLayout; import com.intellij.openapi.ui.ex.MultiLineLabel; -import com.intellij.openapi.ui.popup.JBPopupFactory; -import com.intellij.openapi.ui.popup.ListPopup; -import com.intellij.openapi.ui.popup.PopupStep; -import com.intellij.openapi.ui.popup.util.BaseListPopupStep; import com.intellij.openapi.util.Computable; import com.intellij.openapi.util.Disposer; -import com.intellij.openapi.util.NullableComputable; -import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.JarFileSystem; import com.intellij.openapi.vfs.VirtualFile; @@ -62,8 +55,6 @@ import javax.swing.tree.TreePath; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Proxy; import java.util.*; import java.util.List; @@ -77,7 +68,6 @@ public class LibraryRootsComponent implements Disposable, LibraryEditorComponent private JPanel myPanel; private JButton myRemoveButton; private JPanel myTreePanel; - private JButton myAttachMoreButton; private MultiLineLabel myPropertiesLabel; private JPanel myPropertiesPanel; private JPanel myAttachButtonsPanel; @@ -168,16 +158,6 @@ public class LibraryRootsComponent implements Disposable, LibraryEditorComponent myAttachButtonsPanel.add(buttonsPanel, BorderLayout.CENTER); myRemoveButton.addActionListener(new RemoveAction()); - final LibraryTableAttachHandler[] handlers = LibraryTableAttachHandler.EP_NAME.getExtensions(); - if (handlers.length == 0 || myProject == null || getLibraryEditor().getType() != null) { - myAttachMoreButton.setVisible(false); - } - else { - myAttachMoreButton.addActionListener(new AttachMoreAction(handlers)); - if (handlers.length == 1) { - myAttachMoreButton.setText(handlers[0].getLongName()); - } - } treeSelectionListener.updateButtons(); Disposer.register(this, myTreeBuilder); @@ -485,94 +465,4 @@ public class LibraryRootsComponent implements Disposable, LibraryEditorComponent return cls; } } - - private class AttachMoreAction implements ActionListener { - private final LibraryTableAttachHandler[] myHandlers; - - public AttachMoreAction(LibraryTableAttachHandler[] handlers) { - myHandlers = handlers; - } - - public void actionPerformed(ActionEvent e) { - final LibraryEditor libraryEditor = getLibraryEditor(); - final Ref modelRef = Ref.create(null); - final NullableComputable computable; - if (libraryEditor instanceof ExistingLibraryEditor) { - final ExistingLibraryEditor existingLibraryEditor = (ExistingLibraryEditor)libraryEditor; - //todo[nik, greg] actually we cannot reliable find target library if the editor is closed so jars are downloaded under the modal progress dialog now - computable = new NullableComputable() { - public Library.ModifiableModel compute() { - if (myTreeBuilder == null) { - // The following lines were born in severe pain & suffering, please respect - final Library library = existingLibraryEditor.getLibrary(); - 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; - } - else { - return existingLibraryEditor.getModel(); - } - } - }; - } - else { - computable = null; - } - - final Runnable successRunnable = new Runnable() { - public void run() { - if (modelRef.get() != null) { - modelRef.get().commit(); - } - ApplicationManager.getApplication().invokeLater(new Runnable() { - public void run() { - if (myTreeBuilder != null) myTreeBuilder.queueUpdate(); - if (myProject != null && libraryEditor instanceof ExistingLibraryEditor) { - ModuleStructureConfigurable.getInstance(myProject).fireItemsChangeListener(((ExistingLibraryEditor)libraryEditor).getLibrary()); - } - } - }); - } - }; - final Runnable rejectRunnable = new Runnable() { - public void run() { - if (modelRef.get() != null) { - Disposer.dispose(modelRef.get()); - } - } - }; - if (myHandlers.length == 1) { - myHandlers[0].performAttach(myProject, libraryEditor, computable).doWhenDone(successRunnable).doWhenRejected(rejectRunnable); - } - else { - final ListPopup popup = JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep(null, myHandlers) { - @NotNull - public String getTextFor(final LibraryTableAttachHandler handler) { - return handler.getShortName(); - } - - public Icon getIconFor(final LibraryTableAttachHandler handler) { - return handler.getIcon(); - } - - public PopupStep onChosen(final LibraryTableAttachHandler handler, final boolean finalChoice) { - ApplicationManager.getApplication().invokeLater(new Runnable() { - public void run() { - handler.performAttach(myProject, libraryEditor, computable).doWhenProcessed(successRunnable).doWhenRejected(rejectRunnable); - } - }); - return PopupStep.FINAL_CHOICE; - } - }); - popup.showUnderneathOf(myAttachMoreButton); - - } - } - } } diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryTableAttachHandler.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryTableAttachHandler.java deleted file mode 100644 index 71d4430ac2a2..000000000000 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/LibraryTableAttachHandler.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2000-2010 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.openapi.roots.ui.configuration.libraryEditor; - -import com.intellij.openapi.extensions.ExtensionPointName; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.roots.libraries.Library; -import com.intellij.openapi.util.ActionCallback; -import com.intellij.openapi.util.NullableComputable; - -import javax.swing.*; - -/** - * @author Gregory.Shrago - */ -public interface LibraryTableAttachHandler { - ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.libraryTable.attachHandler"); - - String getLongName(); - String getShortName(); - Icon getIcon(); - - ActionCallback performAttach(Project project, LibraryEditor libraryEditor, NullableComputable modelProvider); -} diff --git a/resources/src/idea/RichPlatformPlugin.xml b/resources/src/idea/RichPlatformPlugin.xml index fb60707ba41c..4d0722c1aa5b 100644 --- a/resources/src/idea/RichPlatformPlugin.xml +++ b/resources/src/idea/RichPlatformPlugin.xml @@ -78,8 +78,6 @@ - -