mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[vcs-log] cache Selection in table to only calculate it when its changed
This commit is contained in:
@@ -93,6 +93,7 @@ public class VcsLogGraphTable extends JBTable implements DataProvider, CopyProvi
|
||||
@NotNull private final TableCellRenderer myDummyRenderer = new DefaultTableCellRenderer();
|
||||
@NotNull private final GraphCommitCellRender myGraphCommitCellRenderer;
|
||||
private boolean myColumnsSizeInitialized = false;
|
||||
@Nullable private Selection mySelection = null;
|
||||
|
||||
@NotNull private final Collection<VcsLogHighlighter> myHighlighters = ContainerUtil.newArrayList();
|
||||
|
||||
@@ -121,6 +122,8 @@ public class VcsLogGraphTable extends JBTable implements DataProvider, CopyProvi
|
||||
addMouseMotionListener(mouseAdapter);
|
||||
addMouseListener(mouseAdapter);
|
||||
|
||||
getSelectionModel().addListSelectionListener(new MyListSelectionListener());
|
||||
|
||||
PopupHandler.installPopupHandler(this, VcsLogActionPlaces.POPUP_ACTION_GROUP, VcsLogActionPlaces.VCS_LOG_TABLE_PLACE);
|
||||
ScrollingUtil.installActions(this, false);
|
||||
|
||||
@@ -463,7 +466,8 @@ public class VcsLogGraphTable extends JBTable implements DataProvider, CopyProvi
|
||||
|
||||
@NotNull
|
||||
public Selection getSelection() {
|
||||
return new Selection(this);
|
||||
if (mySelection == null) mySelection = new Selection(this);
|
||||
return mySelection;
|
||||
}
|
||||
|
||||
private static class Selection {
|
||||
@@ -917,4 +921,11 @@ public class VcsLogGraphTable extends JBTable implements DataProvider, CopyProvi
|
||||
mouseInputListener.mouseMoved(convertMouseEvent(e));
|
||||
}
|
||||
}
|
||||
|
||||
private class MyListSelectionListener implements ListSelectionListener {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
mySelection = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user