get rid of RowSorters to fix a few exceptions. New Plugin UI has its own table header without swing's row sorters

This commit is contained in:
Konstantin Bulenkov
2014-06-05 21:19:07 +02:00
parent e5541c8bf0
commit 22db3a858a
3 changed files with 15 additions and 36 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -74,20 +74,20 @@ public class PluginManagerConfigurable extends BaseConfigurable implements Searc
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.AVAILABLE_SORT_BY_STATUS);
} else {
myPluginManagerMain.pluginsModel.setSortByStatus(myUISettings.INSTALLED_SORT_BY_STATUS);
}
//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.AVAILABLE_SORT_BY_STATUS);
//} else {
// myPluginManagerMain.pluginsModel.setSortByStatus(myUISettings.INSTALLED_SORT_BY_STATUS);
//}
myPluginManagerMain.pluginsModel.sort();
getSplitterProportions().restoreSplitterProportions(myPluginManagerMain.getMainPanel());
}
@@ -272,11 +272,6 @@ public abstract class PluginManagerMain implements Disposable {
protected void modifyPluginsList(List<IdeaPluginDescriptor> list) {
IdeaPluginDescriptor[] selected = pluginTable.getSelectedObjects();
pluginsModel.updatePluginsList(list);
final RowSorter.SortKey key = pluginsModel.getDefaultSortKey();
if (key != null) {
pluginTable.getRowSorter().setSortKeys(Collections.singletonList(key));
}
//pluginsModel.sort();
pluginsModel.filter(myFilter.getFilter().toLowerCase());
if (selected != null) {
select(selected);
@@ -29,10 +29,7 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableModel;
import javax.swing.table.TableRowSorter;
import java.awt.datatransfer.Transferable;
import java.util.List;
/**
* Created by IntelliJ IDEA.
@@ -98,19 +95,6 @@ public class PluginTable extends JBTable {
column.setMaxWidth(width);
}
@Override
protected TableRowSorter<TableModel> createRowSorter(TableModel model) {
return new DefaultColumnInfoBasedRowSorter(model){
@Override
public void setSortKeys(List<? extends SortKey> sortKeys) {
if (sortKeys != null && !sortKeys.isEmpty()) {
((PluginTableModel)getModel()).setSortKey(sortKeys.get(0));
}
super.setSortKeys(sortKeys);
}
};
}
@Override
protected boolean isSortOnUpdates() {
return false;