4961 restore leaking this in constructors of HexView and RejTreeView so it will work

This commit is contained in:
William Schaefer
2019-05-10 14:29:36 -04:00
parent 2d07ea6160
commit 1fcc0e7a78
4 changed files with 4 additions and 15 deletions
@@ -155,18 +155,14 @@ final class HexView extends JPanel implements CaretListener {
this._offsetView.setText(offsetSB.toString());
this._hexView.setText(hexSB.toString());
this._asciiView.setText(asciiSB.toString());
this._hexView.addCaretListener(this);
this._asciiView.addCaretListener(this);
this._asciiView.setSelectedTextColor(this._asciiView.getForeground());
this._hexView.setSelectedTextColor(this._asciiView.getForeground());
this._highlightColor = this._hexView.getSelectionColor();
this._highlighterPainter = new DefaultHighlighter.DefaultHighlightPainter(this._highlightColor);
}
void addCaretListeners() {
this._hexView.addCaretListener(this);
this._asciiView.addCaretListener(this);
}
/**
* clearHighlight removes any colors applied to the text views.
*/
@@ -124,7 +124,6 @@ public final class RejTreeValueView extends RejTreeNodeView {
}
default: {
HexView hexView = new HexView(data.getAsRawData());
hexView.addCaretListeners();
hexView.setBorder(BorderFactory.createTitledBorder(Bundle.RejTreeValueView_valueBorder_title()));
valueComponent = hexView;
break;
@@ -63,7 +63,8 @@ final class RejTreeView extends JScrollPane implements TreeExpansionListener, Tr
this._tree_model.setAsksAllowsChildren(true);
this._tree = new JTree(this._tree_model);
this._tree.addTreeExpansionListener(this);
this._tree.addTreeSelectionListener(this);
// here's a bit of a hack to force the children to be loaded and shown
this._tree.collapsePath(new TreePath(rootNode.getPath()));
this._tree.expandPath(new TreePath(rootNode.getPath()));
@@ -72,11 +73,6 @@ final class RejTreeView extends JScrollPane implements TreeExpansionListener, Tr
setPreferredSize(new Dimension(250, 400));
}
void addTreeListeners() {
this._tree.addTreeExpansionListener(this);
this._tree.addTreeSelectionListener(this);
}
/**
* getTreeNode creates a TreeNode from a RejTreeNode, settings the
* appropriate fields.
@@ -41,7 +41,6 @@ public final class RejView extends JPanel implements RejTreeNodeSelectionListene
this._hive = hive;
// have to do these cause they're final
this._tree_view = new RejTreeView(this._hive);
this._tree_view.addTreeListeners();
this._splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
this._tree_view, new JPanel());
this.setupUI();
@@ -53,7 +52,6 @@ public final class RejView extends JPanel implements RejTreeNodeSelectionListene
// have to do these cause they're final
this._tree_view = new RejTreeView(this._hive);
this._tree_view.addTreeListeners();
this._splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
this._tree_view, new JPanel());
this.setupUI();