mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 18:29:37 +02:00
GT-2925 - Key Bindings - Support Window Menu Provider Key Bindings -
Step 4 - cleanup of old getIcon() overridden methods
This commit is contained in:
parent
fa75f7dff6
commit
ff4b3736b9
3 changed files with 13 additions and 33 deletions
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,23 +63,22 @@ 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
|
|
||||||
public void valueChanged(TreeSelectionEvent e) {
|
|
||||||
tool.contextChanged(FileSystemBrowserComponentProvider.this);
|
tool.contextChanged(FileSystemBrowserComponentProvider.this);
|
||||||
TreePath[] paths = gTree.getSelectionPaths();
|
TreePath[] paths = gTree.getSelectionPaths();
|
||||||
if (paths.length == 1) {
|
if (paths.length == 1) {
|
||||||
GTreeNode clickedNode = (GTreeNode) paths[0].getLastPathComponent();
|
GTreeNode clickedNode = (GTreeNode) paths[0].getLastPathComponent();
|
||||||
handleSingleClick(clickedNode);
|
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();
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue