mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Cleanup (dead code; duplicates; formatting)
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
package com.intellij.webcore.packaging;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ide.BrowserUtil;
|
||||
import com.intellij.ide.plugins.PluginManagerMain;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -38,19 +38,14 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.HyperlinkEvent;
|
||||
import javax.swing.event.HyperlinkListener;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import javax.swing.text.html.HTMLDocument;
|
||||
import javax.swing.text.html.HTMLFrameHyperlinkEvent;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
@@ -177,7 +172,7 @@ public class ManagePackagesDialog extends DialogWrapper {
|
||||
}
|
||||
});
|
||||
myInstallButton.setEnabled(false);
|
||||
myDescriptionTextArea.addHyperlinkListener(new MyHyperlinkListener());
|
||||
myDescriptionTextArea.addHyperlinkListener(new PluginManagerMain.MyHyperlinkListener());
|
||||
addInstallAction();
|
||||
myInstalledPackages = new HashSet<String>();
|
||||
updateInstalledPackages();
|
||||
@@ -380,8 +375,7 @@ public class ManagePackagesDialog extends DialogWrapper {
|
||||
myOptionsField.setText(optionsText);
|
||||
}
|
||||
|
||||
public class MyPackageFilter extends FilterComponent {
|
||||
|
||||
private class MyPackageFilter extends FilterComponent {
|
||||
public MyPackageFilter() {
|
||||
super("PACKAGE_FILTER", 5);
|
||||
getTextEditor().addKeyListener(new KeyAdapter() {
|
||||
@@ -470,26 +464,7 @@ public class ManagePackagesDialog extends DialogWrapper {
|
||||
return myFilter;
|
||||
}
|
||||
|
||||
public static class MyHyperlinkListener implements HyperlinkListener {
|
||||
public void hyperlinkUpdate(HyperlinkEvent e) {
|
||||
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
|
||||
JEditorPane pane = (JEditorPane)e.getSource();
|
||||
if (e instanceof HTMLFrameHyperlinkEvent) {
|
||||
HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent)e;
|
||||
HTMLDocument doc = (HTMLDocument)pane.getDocument();
|
||||
doc.processHTMLFrameHyperlinkEvent(evt);
|
||||
}
|
||||
else {
|
||||
URL url = e.getURL();
|
||||
if (url != null) {
|
||||
BrowserUtil.browse(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MyPackageSelectionListener implements ListSelectionListener {
|
||||
private class MyPackageSelectionListener implements ListSelectionListener {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent event) {
|
||||
myOptionsCheckBox.setEnabled(myPackages.getSelectedIndex() >= 0);
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.intellij.openapi.options.SearchableConfigurable;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.ui.SplitterProportionsData;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -34,16 +33,13 @@ import javax.swing.table.TableModel;
|
||||
import java.util.List;
|
||||
|
||||
public class PluginManagerConfigurable extends BaseConfigurable implements SearchableConfigurable, Configurable.NoScroll {
|
||||
@NonNls private static final String POSTPONE = "&Postpone";
|
||||
public static final String ID = "preferences.pluginManager";
|
||||
public static final String DISPLAY_NAME = IdeBundle.message("title.plugins");
|
||||
public boolean EXPANDED = false;
|
||||
public String FIND = "";
|
||||
public boolean TREE_VIEW = false;
|
||||
|
||||
protected final PluginManagerUISettings myUISettings;
|
||||
|
||||
private PluginManagerMain myPluginManagerMain;
|
||||
protected final PluginManagerUISettings myUISettings;
|
||||
protected boolean myAvailable;
|
||||
private boolean myAvailable;
|
||||
|
||||
public PluginManagerConfigurable(final PluginManagerUISettings UISettings) {
|
||||
myUISettings = UISettings;
|
||||
@@ -67,20 +63,6 @@ public class PluginManagerConfigurable extends BaseConfigurable implements Searc
|
||||
@Override
|
||||
public void reset() {
|
||||
myPluginManagerMain.reset();
|
||||
//if (myAvailable) {
|
||||
// final int column = myUISettings.AVAILABLE_SORT_MODE;
|
||||
// if (column >= 0) {
|
||||
// for (final SortOrder sortOrder : SortOrder.values()) {
|
||||
// if (sortOrder.ordinal() == myUISettings.AVAILABLE_SORT_COLUMN_ORDER) {
|
||||
// myPluginManagerMain.pluginsModel.setSortKey(new RowSorter.SortKey(column, sortOrder));
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// myPluginManagerMain.pluginsModel.setSortByStatus(myUISettings.availableSortByStatus);
|
||||
//} else {
|
||||
// myPluginManagerMain.pluginsModel.setSortByStatus(myUISettings.installedSortByStatus);
|
||||
//}
|
||||
myPluginManagerMain.pluginsModel.sort();
|
||||
getSplitterProportions().restoreSplitterProportions(myPluginManagerMain.getMainPanel());
|
||||
}
|
||||
|
||||
@@ -80,8 +80,7 @@ import static com.intellij.openapi.util.text.StringUtil.isEmptyOrSpaces;
|
||||
*/
|
||||
public abstract class PluginManagerMain implements Disposable {
|
||||
public static final String JETBRAINS_VENDOR = "JetBrains";
|
||||
public static final NotificationGroup PLUGIN_LIFECYCLE_NOTIFICATION_GROUP =
|
||||
new NotificationGroup("Plugins Lifecycle Group", NotificationDisplayType.STICKY_BALLOON, true);
|
||||
|
||||
public static Logger LOG = Logger.getInstance("#com.intellij.ide.plugins.PluginManagerMain");
|
||||
|
||||
@NonNls private static final String TEXT_PREFIX = "<html><head>" +
|
||||
@@ -254,9 +253,9 @@ public abstract class PluginManagerMain implements Disposable {
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
final IdeaPluginDescriptor[] descriptors = pluginTable.getSelectedObjects();
|
||||
pluginInfoUpdate(descriptors != null && descriptors.length == 1 ? descriptors[0] : null,
|
||||
myFilter.getFilter(), myDescriptionTextArea, myPluginHeaderPanel, this);
|
||||
IdeaPluginDescriptor[] descriptors = pluginTable.getSelectedObjects();
|
||||
IdeaPluginDescriptor plugin = descriptors != null && descriptors.length == 1 ? descriptors[0] : null;
|
||||
pluginInfoUpdate(plugin, myFilter.getFilter(), myDescriptionTextArea, myPluginHeaderPanel);
|
||||
myActionToolbar.updateActionsImmediately();
|
||||
final JComponent parent = (JComponent)myHeader.getParent();
|
||||
parent.revalidate();
|
||||
@@ -422,8 +421,7 @@ public abstract class PluginManagerMain implements Disposable {
|
||||
public static void pluginInfoUpdate(IdeaPluginDescriptor plugin,
|
||||
@Nullable String filter,
|
||||
@NotNull JEditorPane descriptionTextArea,
|
||||
@NotNull PluginHeaderPanel header, PluginManagerMain manager) {
|
||||
|
||||
@NotNull PluginHeaderPanel header) {
|
||||
if (plugin == null) {
|
||||
setTextValue(null, filter, descriptionTextArea);
|
||||
header.getPanel().setVisible(false);
|
||||
@@ -604,17 +602,11 @@ public abstract class PluginManagerMain implements Disposable {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean isAccepted(final Set<String> search,
|
||||
@NotNull final String filter,
|
||||
@NotNull final String description) {
|
||||
private static boolean isAccepted(Set<String> search, @NotNull String filter, @NotNull String description) {
|
||||
if (StringUtil.containsIgnoreCase(description, filter)) return true;
|
||||
final SearchableOptionsRegistrar optionsRegistrar = SearchableOptionsRegistrar.getInstance();
|
||||
final HashSet<String> descriptionSet = new HashSet<String>(search);
|
||||
descriptionSet.removeAll(optionsRegistrar.getProcessedWords(description));
|
||||
if (descriptionSet.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
Set<String> descriptionSet = new HashSet<String>(search);
|
||||
descriptionSet.removeAll(SearchableOptionsRegistrar.getInstance().getProcessedWords(description));
|
||||
return descriptionSet.isEmpty();
|
||||
}
|
||||
|
||||
public static void notifyPluginsUpdated(@Nullable Project project) {
|
||||
@@ -633,7 +625,6 @@ public abstract class PluginManagerMain implements Disposable {
|
||||
}
|
||||
|
||||
public class MyPluginsFilter extends FilterComponent {
|
||||
|
||||
public MyPluginsFilter() {
|
||||
super("PLUGIN_FILTER", 5);
|
||||
}
|
||||
|
||||
+1
-1
@@ -88,7 +88,7 @@ public class DetectedPluginsPanel extends OrderPanel<PluginDownloader> {
|
||||
final PluginDownloader selection = getValueAt(selectedRow);
|
||||
final IdeaPluginDescriptor descriptor = selection.getDescriptor();
|
||||
if (descriptor != null) {
|
||||
PluginManagerMain.pluginInfoUpdate(descriptor, null, myDescriptionPanel, myHeader , null);
|
||||
PluginManagerMain.pluginInfoUpdate(descriptor, null, myDescriptionPanel, myHeader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user