GT-2925 - Key Bindings - Support Window Menu Provider Key Bindings -

Step 4 - cleanup of old getIcon() overridden methods
This commit is contained in:
dragonmacher 2019-06-26 16:31:50 -04:00
parent fa75f7dff6
commit ff4b3736b9
3 changed files with 13 additions and 33 deletions

View file

@ -17,7 +17,6 @@ package ghidra.app.plugin.debug;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import javax.swing.ImageIcon;
import javax.swing.JComponent; import javax.swing.JComponent;
import db.DBHandle; import db.DBHandle;
@ -34,14 +33,14 @@ public class DbViewerProvider extends ComponentProviderAdapter {
private DBHandle dbh; private DBHandle dbh;
private String dbName; private String dbName;
private Plugin plugin;
private ImageIcon icon;
private DbViewerComponent comp; private DbViewerComponent comp;
public DbViewerProvider(Plugin plugin) { public DbViewerProvider(Plugin plugin) {
super(plugin.getTool(), "Database Viewer", plugin.getName()); super(plugin.getTool(), "Database Viewer", plugin.getName());
setIcon(ResourceManager.loadImage(ICON_IMAGE));
setDefaultWindowPosition(WindowPosition.BOTTOM); setDefaultWindowPosition(WindowPosition.BOTTOM);
this.plugin = plugin;
setHelpLocation(new HelpLocation(plugin.getName(), "DbViewer")); setHelpLocation(new HelpLocation(plugin.getName(), "DbViewer"));
} }
@ -93,13 +92,4 @@ public class DbViewerProvider extends ComponentProviderAdapter {
} }
return comp; return comp;
} }
@Override
public ImageIcon getIcon() {
if (icon == null) {
icon = ResourceManager.loadImage(ICON_IMAGE);
}
return icon;
}
} }

View file

@ -23,8 +23,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import javax.swing.tree.TreeSelectionModel; import javax.swing.tree.TreeSelectionModel;
@ -65,22 +63,21 @@ class FileSystemBrowserComponentProvider extends ComponentProviderAdapter {
*/ */
public FileSystemBrowserComponentProvider(FileSystemBrowserPlugin plugin, FileSystemRef fsRef) { public FileSystemBrowserComponentProvider(FileSystemBrowserPlugin plugin, FileSystemRef fsRef) {
super(plugin.getTool(), fsRef.getFilesystem().getName(), plugin.getName()); super(plugin.getTool(), fsRef.getFilesystem().getName(), plugin.getName());
setTransient();
this.plugin = plugin; this.plugin = plugin;
this.rootNode = new FSBRootNode(fsRef); this.rootNode = new FSBRootNode(fsRef);
setTransient();
setIcon(ImageManager.PHOTO);
gTree = new GTree(rootNode); gTree = new GTree(rootNode);
gTree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); gTree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
gTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() { gTree.getSelectionModel().addTreeSelectionListener(e -> {
@Override tool.contextChanged(FileSystemBrowserComponentProvider.this);
public void valueChanged(TreeSelectionEvent e) { TreePath[] paths = gTree.getSelectionPaths();
tool.contextChanged(FileSystemBrowserComponentProvider.this); if (paths.length == 1) {
TreePath[] paths = gTree.getSelectionPaths(); GTreeNode clickedNode = (GTreeNode) paths[0].getLastPathComponent();
if (paths.length == 1) { handleSingleClick(clickedNode);
GTreeNode clickedNode = (GTreeNode) paths[0].getLastPathComponent();
handleSingleClick(clickedNode);
}
} }
}); });
gTree.addMouseListener(new MouseAdapter() { gTree.addMouseListener(new MouseAdapter() {
@ -301,11 +298,6 @@ class FileSystemBrowserComponentProvider extends ComponentProviderAdapter {
return WindowPosition.WINDOW; return WindowPosition.WINDOW;
} }
@Override
public Icon getIcon() {
return ImageManager.PHOTO;
}
void dispose() { void dispose() {
if (actionManager != null) { if (actionManager != null) {
actionManager.dispose(); actionManager.dispose();

View file

@ -559,8 +559,6 @@ public abstract class ComponentProvider implements HelpDescriptor, ActionContext
Fix: Fix:
-Update key binding methods to use an enum for: no management / full management / shared management -Update key binding methods to use an enum for: no management / full management / shared management
-remove superfluous overrides of getIcon()
*/ */
dockingTool.getWindowManager().setIcon(this, icon); dockingTool.getWindowManager().setIcon(this, icon);