unused class removed

This commit is contained in:
nik
2011-11-24 11:26:24 +04:00
parent b23de45f73
commit 225d617946
4 changed files with 6 additions and 163 deletions
@@ -8,7 +8,7 @@
<properties/>
<border type="none"/>
<children>
<grid id="1f4da" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="0" vgap="6">
<grid id="1f4da" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="0" vgap="6">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="0" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -18,23 +18,15 @@
<children>
<vspacer id="3da7">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="56f78" class="javax.swing.JButton" binding="myRemoveButton">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/ProjectBundle" key="library.detach.action"/>
</properties>
</component>
<component id="1134d" class="javax.swing.JButton" binding="myAttachMoreButton" default-binding="true">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/ProjectBundle" key="module.libraries.attach.more.button"/>
<text resource-bundle="messages/ProjectBundle" key="library.detach.action"/>
</properties>
</component>
<grid id="2f9aa" binding="myAttachButtonsPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
@@ -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<Library.ModifiableModel> modelRef = Ref.create(null);
final NullableComputable<Library.ModifiableModel> 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<Library.ModifiableModel>() {
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<LibraryTableAttachHandler>(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);
}
}
}
}
@@ -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<LibraryTableAttachHandler> EP_NAME = ExtensionPointName.create("com.intellij.libraryTable.attachHandler");
String getLongName();
String getShortName();
Icon getIcon();
ActionCallback performAttach(Project project, LibraryEditor libraryEditor, NullableComputable<Library.ModifiableModel> modelProvider);
}
@@ -78,8 +78,6 @@
<extensionPoint name="attachSourcesProvider" interface="com.intellij.codeInsight.AttachSourcesProvider"/>
<extensionPoint name="libraryTable.attachHandler" interface="com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryTableAttachHandler"/>
<extensionPoint name="java.compiler" area="IDEA_PROJECT"
interface="com.intellij.compiler.impl.javaCompiler.BackendCompiler"/>