mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-02 02:48:39 +08:00
Merge remote-tracking branch 'origin/GT-2960-dragonmacher-remove-popup-action-interface'
This commit is contained in:
+9
-9
@@ -1,6 +1,5 @@
|
|||||||
/* ###
|
/* ###
|
||||||
* IP: GHIDRA
|
* IP: GHIDRA
|
||||||
* REVIEWED: YES
|
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -16,19 +15,19 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.merge.tool;
|
package ghidra.app.merge.tool;
|
||||||
|
|
||||||
import ghidra.app.util.viewer.listingpanel.ListingPanel;
|
|
||||||
import ghidra.framework.plugintool.*;
|
|
||||||
|
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.*;
|
||||||
import docking.WindowPosition;
|
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
|
import docking.actions.PopupActionProvider;
|
||||||
|
import ghidra.app.util.viewer.listingpanel.ListingPanel;
|
||||||
|
import ghidra.framework.plugintool.*;
|
||||||
|
|
||||||
public class ListingMergePanelProvider extends ComponentProviderAdapter implements PopupListener {
|
public class ListingMergePanelProvider extends ComponentProviderAdapter
|
||||||
|
implements PopupActionProvider {
|
||||||
private ListingMergePanel mergePanel;
|
private ListingMergePanel mergePanel;
|
||||||
|
|
||||||
public ListingMergePanelProvider(PluginTool tool, Plugin plugin, String owner,
|
public ListingMergePanelProvider(PluginTool tool, Plugin plugin, String owner,
|
||||||
@@ -37,7 +36,7 @@ public class ListingMergePanelProvider extends ComponentProviderAdapter implemen
|
|||||||
setTitle("Listing Merge Tool");
|
setTitle("Listing Merge Tool");
|
||||||
setDefaultWindowPosition(WindowPosition.TOP);
|
setDefaultWindowPosition(WindowPosition.TOP);
|
||||||
this.mergePanel = mergePanel;
|
this.mergePanel = mergePanel;
|
||||||
tool.addPopupListener(this);
|
tool.addPopupActionProvider(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -52,10 +51,11 @@ public class ListingMergePanelProvider extends ComponentProviderAdapter implemen
|
|||||||
}
|
}
|
||||||
|
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
tool.removePopupActionProvider(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DockingActionIf> getPopupActions(ActionContext context) {
|
public List<DockingActionIf> getPopupActions(DockingTool tool, ActionContext context) {
|
||||||
ListingPanel resultPanel = mergePanel.getResultPanel();
|
ListingPanel resultPanel = mergePanel.getResultPanel();
|
||||||
if (resultPanel != null) {
|
if (resultPanel != null) {
|
||||||
return resultPanel.getHeaderActions(getName());
|
return resultPanel.getHeaderActions(getName());
|
||||||
|
|||||||
+6
-4
@@ -22,7 +22,9 @@ import javax.swing.Icon;
|
|||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
|
import docking.DockingTool;
|
||||||
import docking.action.*;
|
import docking.action.*;
|
||||||
|
import docking.actions.PopupActionProvider;
|
||||||
import docking.widgets.table.GTable;
|
import docking.widgets.table.GTable;
|
||||||
import ghidra.app.CorePluginPackage;
|
import ghidra.app.CorePluginPackage;
|
||||||
import ghidra.app.events.ProgramSelectionPluginEvent;
|
import ghidra.app.events.ProgramSelectionPluginEvent;
|
||||||
@@ -60,7 +62,7 @@ import resources.*;
|
|||||||
)
|
)
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
public class BookmarkPlugin extends ProgramPlugin
|
public class BookmarkPlugin extends ProgramPlugin
|
||||||
implements DomainObjectListener, PopupListener, BookmarkService {
|
implements DomainObjectListener, PopupActionProvider, BookmarkService {
|
||||||
|
|
||||||
private final static int MAX_DELETE_ACTIONS = 10;
|
private final static int MAX_DELETE_ACTIONS = 10;
|
||||||
|
|
||||||
@@ -190,7 +192,7 @@ public class BookmarkPlugin extends ProgramPlugin
|
|||||||
public synchronized void dispose() {
|
public synchronized void dispose() {
|
||||||
navUpdater.dispose();
|
navUpdater.dispose();
|
||||||
|
|
||||||
tool.removePopupListener(this);
|
tool.removePopupActionProvider(this);
|
||||||
if (repaintMgr != null) {
|
if (repaintMgr != null) {
|
||||||
repaintMgr.dispose();
|
repaintMgr.dispose();
|
||||||
}
|
}
|
||||||
@@ -227,7 +229,7 @@ public class BookmarkPlugin extends ProgramPlugin
|
|||||||
provider.setGoToService(goToService);
|
provider.setGoToService(goToService);
|
||||||
markerService = tool.getService(MarkerService.class);
|
markerService = tool.getService(MarkerService.class);
|
||||||
|
|
||||||
tool.addPopupListener(this);
|
tool.addPopupActionProvider(this);
|
||||||
|
|
||||||
navUpdater = new NavUpdater();
|
navUpdater = new NavUpdater();
|
||||||
repaintMgr = new SwingUpdateManager(500, () -> provider.repaint());
|
repaintMgr = new SwingUpdateManager(500, () -> provider.repaint());
|
||||||
@@ -492,7 +494,7 @@ public class BookmarkPlugin extends ProgramPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DockingActionIf> getPopupActions(ActionContext context) {
|
public List<DockingActionIf> getPopupActions(DockingTool tool, ActionContext context) {
|
||||||
Object contextObject = context.getContextObject();
|
Object contextObject = context.getContextObject();
|
||||||
if (!(contextObject instanceof MarkerLocation)) {
|
if (!(contextObject instanceof MarkerLocation)) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
+8
-4
@@ -29,6 +29,7 @@ import javax.swing.event.ChangeListener;
|
|||||||
|
|
||||||
import docking.*;
|
import docking.*;
|
||||||
import docking.action.*;
|
import docking.action.*;
|
||||||
|
import docking.actions.PopupActionProvider;
|
||||||
import docking.dnd.*;
|
import docking.dnd.*;
|
||||||
import docking.widgets.EventTrigger;
|
import docking.widgets.EventTrigger;
|
||||||
import docking.widgets.fieldpanel.FieldPanel;
|
import docking.widgets.fieldpanel.FieldPanel;
|
||||||
@@ -47,7 +48,8 @@ import ghidra.app.util.viewer.listingpanel.*;
|
|||||||
import ghidra.app.util.viewer.multilisting.MultiListingLayoutModel;
|
import ghidra.app.util.viewer.multilisting.MultiListingLayoutModel;
|
||||||
import ghidra.app.util.viewer.util.FieldNavigator;
|
import ghidra.app.util.viewer.util.FieldNavigator;
|
||||||
import ghidra.framework.options.SaveState;
|
import ghidra.framework.options.SaveState;
|
||||||
import ghidra.framework.plugintool.*;
|
import ghidra.framework.plugintool.NavigatableComponentProviderAdapter;
|
||||||
|
import ghidra.framework.plugintool.PluginTool;
|
||||||
import ghidra.program.model.address.*;
|
import ghidra.program.model.address.*;
|
||||||
import ghidra.program.model.listing.*;
|
import ghidra.program.model.listing.*;
|
||||||
import ghidra.program.util.*;
|
import ghidra.program.util.*;
|
||||||
@@ -57,7 +59,7 @@ import resources.ResourceManager;
|
|||||||
|
|
||||||
public class CodeViewerProvider extends NavigatableComponentProviderAdapter
|
public class CodeViewerProvider extends NavigatableComponentProviderAdapter
|
||||||
implements ProgramLocationListener, ProgramSelectionListener, Draggable, Droppable,
|
implements ProgramLocationListener, ProgramSelectionListener, Draggable, Droppable,
|
||||||
ChangeListener, StringSelectionListener, PopupListener {
|
ChangeListener, StringSelectionListener, PopupActionProvider {
|
||||||
|
|
||||||
private static final String OLD_NAME = "CodeBrowserPlugin";
|
private static final String OLD_NAME = "CodeBrowserPlugin";
|
||||||
private static final String NAME = "Listing";
|
private static final String NAME = "Listing";
|
||||||
@@ -156,7 +158,7 @@ public class CodeViewerProvider extends NavigatableComponentProviderAdapter
|
|||||||
listingPanel.addIndexMapChangeListener(this);
|
listingPanel.addIndexMapChangeListener(this);
|
||||||
|
|
||||||
codeViewerClipboardProvider = new CodeBrowserClipboardProvider(tool, this);
|
codeViewerClipboardProvider = new CodeBrowserClipboardProvider(tool, this);
|
||||||
tool.addPopupListener(this);
|
tool.addPopupActionProvider(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -226,6 +228,8 @@ public class CodeViewerProvider extends NavigatableComponentProviderAdapter
|
|||||||
public void dispose() {
|
public void dispose() {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
|
||||||
|
tool.removePopupActionProvider(this);
|
||||||
|
|
||||||
if (clipboardService != null) {
|
if (clipboardService != null) {
|
||||||
clipboardService.deRegisterClipboardContentProvider(codeViewerClipboardProvider);
|
clipboardService.deRegisterClipboardContentProvider(codeViewerClipboardProvider);
|
||||||
}
|
}
|
||||||
@@ -951,7 +955,7 @@ public class CodeViewerProvider extends NavigatableComponentProviderAdapter
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DockingActionIf> getPopupActions(ActionContext context) {
|
public List<DockingActionIf> getPopupActions(DockingTool tool, ActionContext context) {
|
||||||
if (context.getComponentProvider() == this) {
|
if (context.getComponentProvider() == this) {
|
||||||
return listingPanel.getHeaderActions(getName());
|
return listingPanel.getHeaderActions(getName());
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -557,6 +557,7 @@ public abstract class CompositeEditorPanel extends JPanel
|
|||||||
setVisible(false);
|
setVisible(false);
|
||||||
}
|
}
|
||||||
model.removeCompositeEditorModelListener(this);
|
model.removeCompositeEditorModelListener(this);
|
||||||
|
table.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createTable() {
|
private void createTable() {
|
||||||
|
|||||||
+1
@@ -64,6 +64,7 @@ public abstract class CompositeEditorProvider extends ComponentProviderAdapter
|
|||||||
super(plugin.getTool(), "Composite Editor", plugin.getName());
|
super(plugin.getTool(), "Composite Editor", plugin.getName());
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
setIcon(EDITOR_ICON);
|
setIcon(EDITOR_ICON);
|
||||||
|
setTransient();
|
||||||
listeners = WeakDataStructureFactory.createSingleThreadAccessWeakSet();
|
listeners = WeakDataStructureFactory.createSingleThreadAccessWeakSet();
|
||||||
initializeServices();
|
initializeServices();
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-5
@@ -27,7 +27,9 @@ import javax.swing.SwingUtilities;
|
|||||||
import javax.swing.tree.TreePath;
|
import javax.swing.tree.TreePath;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
|
import docking.DockingTool;
|
||||||
import docking.action.*;
|
import docking.action.*;
|
||||||
|
import docking.actions.PopupActionProvider;
|
||||||
import docking.widgets.tree.GTreeNode;
|
import docking.widgets.tree.GTreeNode;
|
||||||
import generic.jar.ResourceFile;
|
import generic.jar.ResourceFile;
|
||||||
import generic.util.Path;
|
import generic.util.Path;
|
||||||
@@ -47,7 +49,8 @@ import ghidra.framework.Application;
|
|||||||
import ghidra.framework.main.OpenVersionedFileDialog;
|
import ghidra.framework.main.OpenVersionedFileDialog;
|
||||||
import ghidra.framework.model.*;
|
import ghidra.framework.model.*;
|
||||||
import ghidra.framework.options.SaveState;
|
import ghidra.framework.options.SaveState;
|
||||||
import ghidra.framework.plugintool.*;
|
import ghidra.framework.plugintool.PluginInfo;
|
||||||
|
import ghidra.framework.plugintool.PluginTool;
|
||||||
import ghidra.framework.plugintool.util.PluginStatus;
|
import ghidra.framework.plugintool.util.PluginStatus;
|
||||||
import ghidra.program.database.DataTypeArchiveContentHandler;
|
import ghidra.program.database.DataTypeArchiveContentHandler;
|
||||||
import ghidra.program.database.data.ProgramDataTypeManager;
|
import ghidra.program.database.data.ProgramDataTypeManager;
|
||||||
@@ -78,7 +81,7 @@ import ghidra.util.task.TaskLauncher;
|
|||||||
)
|
)
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
public class DataTypeManagerPlugin extends ProgramPlugin
|
public class DataTypeManagerPlugin extends ProgramPlugin
|
||||||
implements DomainObjectListener, DataTypeManagerService, PopupListener {
|
implements DomainObjectListener, DataTypeManagerService, PopupActionProvider {
|
||||||
|
|
||||||
private static final String SEACH_PROVIDER_NAME = "Search DataTypes Provider";
|
private static final String SEACH_PROVIDER_NAME = "Search DataTypes Provider";
|
||||||
private static final int RECENTLY_USED_CACHE_SIZE = 10;
|
private static final int RECENTLY_USED_CACHE_SIZE = 10;
|
||||||
@@ -158,7 +161,7 @@ public class DataTypeManagerPlugin extends ProgramPlugin
|
|||||||
if (codeViewerService != null) {
|
if (codeViewerService != null) {
|
||||||
codeViewerService.addProgramDropProvider(new DataDropOnBrowserHandler(this));
|
codeViewerService.addProgramDropProvider(new DataDropOnBrowserHandler(this));
|
||||||
}
|
}
|
||||||
tool.addPopupListener(this);
|
tool.addPopupActionProvider(this);
|
||||||
tool.setMenuGroup(new String[] { SyncRefreshAction.MENU_NAME }, "SYNC");
|
tool.setMenuGroup(new String[] { SyncRefreshAction.MENU_NAME }, "SYNC");
|
||||||
tool.setMenuGroup(new String[] { UpdateAction.MENU_NAME }, "SYNC");
|
tool.setMenuGroup(new String[] { UpdateAction.MENU_NAME }, "SYNC");
|
||||||
tool.setMenuGroup(new String[] { CommitAction.MENU_NAME }, "SYNC");
|
tool.setMenuGroup(new String[] { CommitAction.MENU_NAME }, "SYNC");
|
||||||
@@ -263,7 +266,7 @@ public class DataTypeManagerPlugin extends ProgramPlugin
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
tool.removePopupListener(this);
|
tool.removePopupActionProvider(this);
|
||||||
provider.dispose();
|
provider.dispose();
|
||||||
close();
|
close();
|
||||||
dataTypeManagerHandler.dispose();
|
dataTypeManagerHandler.dispose();
|
||||||
@@ -699,7 +702,7 @@ public class DataTypeManagerPlugin extends ProgramPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DockingActionIf> getPopupActions(ActionContext context) {
|
public List<DockingActionIf> getPopupActions(DockingTool dockingTool, ActionContext context) {
|
||||||
if (!(context instanceof DataTypesActionContext)) {
|
if (!(context instanceof DataTypesActionContext)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-4
@@ -21,8 +21,10 @@ import java.util.*;
|
|||||||
import javax.swing.Icon;
|
import javax.swing.Icon;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
|
import docking.DockingTool;
|
||||||
import docking.action.DockingAction;
|
import docking.action.DockingAction;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
|
import docking.actions.PopupActionProvider;
|
||||||
import docking.widgets.fieldpanel.internal.FieldPanelCoordinator;
|
import docking.widgets.fieldpanel.internal.FieldPanelCoordinator;
|
||||||
import ghidra.app.util.viewer.listingpanel.ListingCodeComparisonPanel;
|
import ghidra.app.util.viewer.listingpanel.ListingCodeComparisonPanel;
|
||||||
import ghidra.app.util.viewer.listingpanel.ListingPanel;
|
import ghidra.app.util.viewer.listingpanel.ListingPanel;
|
||||||
@@ -37,7 +39,7 @@ import resources.ResourceManager;
|
|||||||
/**
|
/**
|
||||||
* This is the dockable provider that displays a FunctionComparisonPanel.
|
* This is the dockable provider that displays a FunctionComparisonPanel.
|
||||||
*/
|
*/
|
||||||
public class FunctionComparisonProvider extends ComponentProviderAdapter implements PopupListener {
|
public class FunctionComparisonProvider extends ComponentProviderAdapter implements PopupActionProvider {
|
||||||
|
|
||||||
private static final String HELP_TOPIC = "FunctionComparison";
|
private static final String HELP_TOPIC = "FunctionComparison";
|
||||||
private static final Icon ICON = ResourceManager.loadImage("images/page_white_c.png");
|
private static final Icon ICON = ResourceManager.loadImage("images/page_white_c.png");
|
||||||
@@ -120,7 +122,7 @@ public class FunctionComparisonProvider extends ComponentProviderAdapter impleme
|
|||||||
setTransient();
|
setTransient();
|
||||||
setTabText(functionComparisonPanel);
|
setTabText(functionComparisonPanel);
|
||||||
addSpecificCodeComparisonActions();
|
addSpecificCodeComparisonActions();
|
||||||
tool.addPopupListener(this);
|
tool.addPopupActionProvider(this);
|
||||||
setHelpLocation(new HelpLocation(HELP_TOPIC, "Function Comparison"));
|
setHelpLocation(new HelpLocation(HELP_TOPIC, "Function Comparison"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,7 +180,7 @@ public class FunctionComparisonProvider extends ComponentProviderAdapter impleme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeFromTool() {
|
public void removeFromTool() {
|
||||||
tool.removePopupListener(this);
|
tool.removePopupActionProvider(this);
|
||||||
|
|
||||||
super.removeFromTool();
|
super.removeFromTool();
|
||||||
}
|
}
|
||||||
@@ -220,7 +222,7 @@ public class FunctionComparisonProvider extends ComponentProviderAdapter impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DockingActionIf> getPopupActions(ActionContext context) {
|
public List<DockingActionIf> getPopupActions(DockingTool tool, ActionContext context) {
|
||||||
if (context.getComponentProvider() == this) {
|
if (context.getComponentProvider() == this) {
|
||||||
ListingCodeComparisonPanel dualListingPanel =
|
ListingCodeComparisonPanel dualListingPanel =
|
||||||
functionComparisonPanel.getDualListingPanel();
|
functionComparisonPanel.getDualListingPanel();
|
||||||
|
|||||||
+3
-4
@@ -17,12 +17,11 @@ package ghidra.app.plugin.core.instructionsearch.ui;
|
|||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
import docking.DockingWindowManager;
|
import docking.*;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.widgets.EmptyBorderButton;
|
import docking.widgets.EmptyBorderButton;
|
||||||
import ghidra.app.plugin.core.instructionsearch.InstructionSearchPlugin;
|
import ghidra.app.plugin.core.instructionsearch.InstructionSearchPlugin;
|
||||||
@@ -101,8 +100,8 @@ public class InstructionTable extends AbstractInstructionTable {
|
|||||||
* (which is all of them).
|
* (which is all of them).
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<DockingActionIf> getDockingActions() {
|
public List<DockingActionIf> getPopupActions(DockingTool tool, ActionContext context) {
|
||||||
return new ArrayList<>();
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InsertBytesWidget getInsertBytesWidget() {
|
public InsertBytesWidget getInsertBytesWidget() {
|
||||||
|
|||||||
+2
-2
@@ -136,10 +136,10 @@ public class PreviewTable extends AbstractInstructionTable {
|
|||||||
* any existing menus; it simply adds to them.
|
* any existing menus; it simply adds to them.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<DockingActionIf> getDockingActions() {
|
public List<DockingActionIf> getPopupActions(DockingTool tool, ActionContext context) {
|
||||||
|
|
||||||
// Invoke the base class method to add default menu options.
|
// Invoke the base class method to add default menu options.
|
||||||
List<DockingActionIf> list = super.getDockingActions();
|
List<DockingActionIf> list = super.getPopupActions(tool, context);
|
||||||
|
|
||||||
// And now add our own.
|
// And now add our own.
|
||||||
addCustomMenuItems(list);
|
addCustomMenuItems(list);
|
||||||
|
|||||||
+14
-13
@@ -202,6 +202,20 @@ public class TableServicePlugin extends ProgramPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void removeDialog(MyTableChooserDialog dialog) {
|
||||||
|
Iterator<Program> iter = programToDialogMap.keySet().iterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
Program p = iter.next();
|
||||||
|
List<TableChooserDialog> list = programToDialogMap.get(p);
|
||||||
|
if (list.remove(dialog)) {
|
||||||
|
if (list.size() == 0) {
|
||||||
|
programToDialogMap.remove(p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||||
updateMgr.update();
|
updateMgr.update();
|
||||||
@@ -263,17 +277,4 @@ public class TableServicePlugin extends ProgramPlugin
|
|||||||
return dialog;
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeDialog(MyTableChooserDialog dialog) {
|
|
||||||
Iterator<Program> iter = programToDialogMap.keySet().iterator();
|
|
||||||
while (iter.hasNext()) {
|
|
||||||
Program p = iter.next();
|
|
||||||
List<TableChooserDialog> list = programToDialogMap.get(p);
|
|
||||||
if (list.remove(dialog)) {
|
|
||||||
if (list.size() == 0) {
|
|
||||||
programToDialogMap.remove(p);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,6 +191,7 @@ public class TableChooserDialog extends DialogComponentProvider
|
|||||||
if (navigatable != null) {
|
if (navigatable != null) {
|
||||||
navigatable.removeNavigatableListener(this);
|
navigatable.removeNavigatableListener(this);
|
||||||
}
|
}
|
||||||
|
dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -319,6 +320,11 @@ public class TableChooserDialog extends DialogComponentProvider
|
|||||||
return rowObjects;
|
return rowObjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void dispose() {
|
||||||
|
table.dispose();
|
||||||
|
workers.forEach(w -> w.cancel(true));
|
||||||
|
}
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
// Inner Classes
|
// Inner Classes
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
|
|||||||
+41
-2
@@ -17,10 +17,15 @@ package ghidra.framework.main;
|
|||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
|
import docking.ActionContext;
|
||||||
|
import docking.action.DockingActionIf;
|
||||||
import ghidra.framework.main.datatree.VersionHistoryPanel;
|
import ghidra.framework.main.datatree.VersionHistoryPanel;
|
||||||
import ghidra.framework.model.*;
|
import ghidra.framework.model.*;
|
||||||
import ghidra.framework.plugintool.PluginTool;
|
import ghidra.framework.plugintool.PluginTool;
|
||||||
@@ -47,11 +52,13 @@ public class OpenVersionedFileDialog extends DataTreeDialog {
|
|||||||
|
|
||||||
private JSplitPane splitPane;
|
private JSplitPane splitPane;
|
||||||
private JButton historyButton;
|
private JButton historyButton;
|
||||||
private VersionHistoryPanel historyPanel;
|
|
||||||
private JPanel mainPanel;
|
private JPanel mainPanel;
|
||||||
private boolean historyIsShowing;
|
private boolean historyIsShowing;
|
||||||
private PluginTool tool;
|
private PluginTool tool;
|
||||||
|
|
||||||
|
private VersionHistoryPanel historyPanel;
|
||||||
|
private List<DockingActionIf> popupActions = Collections.emptyList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param tool tool where the file is being opened.
|
* @param tool tool where the file is being opened.
|
||||||
@@ -178,13 +185,32 @@ public class OpenVersionedFileDialog extends DataTreeDialog {
|
|||||||
super.close();
|
super.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dialogShown() {
|
||||||
|
super.dialogShown();
|
||||||
|
|
||||||
|
for (DockingActionIf action : popupActions) {
|
||||||
|
addAction(action);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dialogClosed() {
|
||||||
|
super.dialogClosed();
|
||||||
|
|
||||||
|
for (DockingActionIf action : popupActions) {
|
||||||
|
removeAction(action);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean createHistoryPanel() {
|
private boolean createHistoryPanel() {
|
||||||
try {
|
try {
|
||||||
historyPanel = new VersionHistoryPanel(tool, null);
|
historyPanel = new VersionHistoryPanel(tool, null);
|
||||||
|
popupActions = historyPanel.createPopupActions();
|
||||||
}
|
}
|
||||||
catch (IOException ioe) {
|
catch (IOException ioe) {
|
||||||
Msg.debug(getClass(),
|
Msg.debug(getClass(),
|
||||||
"Error creating history panel for versioned file: " + ioe.getMessage());
|
"Error creating history panel for versioned file: " + ioe.getMessage(), ioe);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,4 +251,17 @@ public class OpenVersionedFileDialog extends DataTreeDialog {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ActionContext getActionContext(MouseEvent event) {
|
||||||
|
ActionContext context = super.getActionContext(event);
|
||||||
|
if (context != null) {
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
ActionContext actionContext = new ActionContext(null, event.getSource(), this);
|
||||||
|
actionContext.setMouseEvent(event);
|
||||||
|
|
||||||
|
return actionContext;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class TestTool extends GhidraTool {
|
|||||||
@Override
|
@Override
|
||||||
protected DockingWindowManager createDockingWindowManager(boolean isDockable, boolean hasStatus,
|
protected DockingWindowManager createDockingWindowManager(boolean isDockable, boolean hasStatus,
|
||||||
boolean isModal) {
|
boolean isModal) {
|
||||||
return new DockingWindowManager(this, null, this, isModal, isDockable, hasStatus, null);
|
return new DockingWindowManager(this, null, isModal, isDockable, hasStatus, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -200,7 +200,6 @@ public class DeleteTableRowAction extends DockingAction {
|
|||||||
// prevent this action from appearing in the toolbar, menus, etc
|
// prevent this action from appearing in the toolbar, menus, etc
|
||||||
setToolBarData(null);
|
setToolBarData(null);
|
||||||
setPopupMenuData(null);
|
setPopupMenuData(null);
|
||||||
setKeyBindingData(null);
|
|
||||||
|
|
||||||
tool.addAction(this);
|
tool.addAction(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class ComponentProviderActionsTest extends AbstractGhidraHeadedIntegratio
|
|||||||
private final Icon ICON = ResourceManager.loadImage("images/refresh.png");
|
private final Icon ICON = ResourceManager.loadImage("images/refresh.png");
|
||||||
private static final String PROVIDER_NAME = "Test Action Provider";
|
private static final String PROVIDER_NAME = "Test Action Provider";
|
||||||
private static final KeyStroke CONTROL_T =
|
private static final KeyStroke CONTROL_T =
|
||||||
KeyStroke.getKeyStroke(Character.valueOf('T'), DockingUtils.CONTROL_KEY_MODIFIER_MASK);
|
KeyStroke.getKeyStroke(KeyEvent.VK_T, DockingUtils.CONTROL_KEY_MODIFIER_MASK);
|
||||||
|
|
||||||
private TestEnv env;
|
private TestEnv env;
|
||||||
private PluginTool tool;
|
private PluginTool tool;
|
||||||
@@ -453,8 +453,12 @@ public class ComponentProviderActionsTest extends AbstractGhidraHeadedIntegratio
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void assertProviderIsActive() {
|
private void assertProviderIsActive() {
|
||||||
assertTrue("The test provider is not showing and focused",
|
|
||||||
runSwing(() -> tool.isActive(provider)));
|
assertTrue("Component provider is not showing", runSwing(() -> tool.isVisible(provider)));
|
||||||
|
|
||||||
|
// note: we can't call 'isActive()' due to focus issues in parallel testing
|
||||||
|
//assertTrue("The test provider is not showing and focused",
|
||||||
|
// runSwing(() -> tool.isActive(provider)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertProviderIsHidden() {
|
private void assertProviderIsHidden() {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class DockingWindowManagerTest extends AbstractDockingTest {
|
|||||||
// default window position.
|
// default window position.
|
||||||
//
|
//
|
||||||
|
|
||||||
DockingWindowManager dwm = new DockingWindowManager(tool, (List<Image>) null, null);
|
DockingWindowManager dwm = new DockingWindowManager(tool, (List<Image>) null);
|
||||||
|
|
||||||
ComponentProvider providerA = addProvider(dwm, "A", "a", RIGHT);
|
ComponentProvider providerA = addProvider(dwm, "A", "a", RIGHT);
|
||||||
ComponentProvider providerB = addProvider(dwm, "B", "b", BOTTOM);
|
ComponentProvider providerB = addProvider(dwm, "B", "b", BOTTOM);
|
||||||
@@ -65,7 +65,7 @@ public class DockingWindowManagerTest extends AbstractDockingTest {
|
|||||||
// intragroup window position. Note: 'Stacked' is the default.
|
// intragroup window position. Note: 'Stacked' is the default.
|
||||||
//
|
//
|
||||||
|
|
||||||
DockingWindowManager dwm = new DockingWindowManager(tool, (List<Image>) null, null);
|
DockingWindowManager dwm = new DockingWindowManager(tool, (List<Image>) null);
|
||||||
|
|
||||||
ComponentProvider providerA1 = addProvider(dwm, "A1", "a", RIGHT, STACK);
|
ComponentProvider providerA1 = addProvider(dwm, "A1", "a", RIGHT, STACK);
|
||||||
ComponentProvider providerA2 = addProvider(dwm, "A2", "a", BOTTOM, STACK);
|
ComponentProvider providerA2 = addProvider(dwm, "A2", "a", BOTTOM, STACK);
|
||||||
@@ -83,7 +83,7 @@ public class DockingWindowManagerTest extends AbstractDockingTest {
|
|||||||
// intragroup window position.
|
// intragroup window position.
|
||||||
//
|
//
|
||||||
|
|
||||||
DockingWindowManager dwm = new DockingWindowManager(tool, (List<Image>) null, null);
|
DockingWindowManager dwm = new DockingWindowManager(tool, (List<Image>) null);
|
||||||
|
|
||||||
ComponentProvider providerA1 = addProvider(dwm, "A1", "a", RIGHT, STACK);
|
ComponentProvider providerA1 = addProvider(dwm, "A1", "a", RIGHT, STACK);
|
||||||
ComponentProvider providerA2 = addProvider(dwm, "A2", "a", LEFT, BOTTOM);
|
ComponentProvider providerA2 = addProvider(dwm, "A2", "a", LEFT, BOTTOM);
|
||||||
@@ -100,7 +100,7 @@ public class DockingWindowManagerTest extends AbstractDockingTest {
|
|||||||
// intragroup window position.
|
// intragroup window position.
|
||||||
//
|
//
|
||||||
|
|
||||||
DockingWindowManager dwm = new DockingWindowManager(tool, (List<Image>) null, null);
|
DockingWindowManager dwm = new DockingWindowManager(tool, (List<Image>) null);
|
||||||
|
|
||||||
ComponentProvider providerA1 = addProvider(dwm, "A1", "a", RIGHT, WINDOW);
|
ComponentProvider providerA1 = addProvider(dwm, "A1", "a", RIGHT, WINDOW);
|
||||||
ComponentProvider providerA2 = addProvider(dwm, "A2", "a", LEFT, WINDOW);
|
ComponentProvider providerA2 = addProvider(dwm, "A2", "a", LEFT, WINDOW);
|
||||||
@@ -121,7 +121,7 @@ public class DockingWindowManagerTest extends AbstractDockingTest {
|
|||||||
//
|
//
|
||||||
|
|
||||||
// note: the positions specified here are for default positions, not intragroup positions
|
// note: the positions specified here are for default positions, not intragroup positions
|
||||||
DockingWindowManager dwm = new DockingWindowManager(tool, (List<Image>) null, null);
|
DockingWindowManager dwm = new DockingWindowManager(tool, (List<Image>) null);
|
||||||
|
|
||||||
ComponentProvider providerA = addProvider(dwm, "A", "a", RIGHT, STACK);
|
ComponentProvider providerA = addProvider(dwm, "A", "a", RIGHT, STACK);
|
||||||
ComponentProvider providerAB = addProvider(dwm, "AB", "a.b", BOTTOM, STACK);
|
ComponentProvider providerAB = addProvider(dwm, "AB", "a.b", BOTTOM, STACK);
|
||||||
@@ -142,7 +142,7 @@ public class DockingWindowManagerTest extends AbstractDockingTest {
|
|||||||
//
|
//
|
||||||
|
|
||||||
// note: the positions specified here are for default positions, not intragroup positions
|
// note: the positions specified here are for default positions, not intragroup positions
|
||||||
DockingWindowManager dwm = new DockingWindowManager(tool, (List<Image>) null, null);
|
DockingWindowManager dwm = new DockingWindowManager(tool, (List<Image>) null);
|
||||||
|
|
||||||
ComponentProvider providerA = addProvider(dwm, "A", "a", RIGHT, BOTTOM);
|
ComponentProvider providerA = addProvider(dwm, "A", "a", RIGHT, BOTTOM);
|
||||||
ComponentProvider providerAB = addProvider(dwm, "AB", "a.b", BOTTOM, TOP);
|
ComponentProvider providerAB = addProvider(dwm, "AB", "a.b", BOTTOM, TOP);
|
||||||
@@ -180,7 +180,7 @@ public class DockingWindowManagerTest extends AbstractDockingTest {
|
|||||||
// Test that, for unrelated groups, the layout info stored in XML is re-used when providers
|
// Test that, for unrelated groups, the layout info stored in XML is re-used when providers
|
||||||
// are shown after that XML is restored--even if the window positioning changes
|
// are shown after that XML is restored--even if the window positioning changes
|
||||||
//
|
//
|
||||||
final DockingWindowManager dwm1 = new DockingWindowManager(tool, (List<Image>) null, null);
|
final DockingWindowManager dwm1 = new DockingWindowManager(tool, (List<Image>) null);
|
||||||
|
|
||||||
ComponentProvider providerA = addProvider(dwm1, "A", "a", RIGHT);
|
ComponentProvider providerA = addProvider(dwm1, "A", "a", RIGHT);
|
||||||
ComponentProvider providerB = addProvider(dwm1, "B", "b", BOTTOM);
|
ComponentProvider providerB = addProvider(dwm1, "B", "b", BOTTOM);
|
||||||
@@ -215,7 +215,7 @@ public class DockingWindowManagerTest extends AbstractDockingTest {
|
|||||||
// Test that, for related groups, the layout info stored in XML is re-used when providers
|
// Test that, for related groups, the layout info stored in XML is re-used when providers
|
||||||
// are shown after that XML is restored--even if the window positioning changes
|
// are shown after that XML is restored--even if the window positioning changes
|
||||||
//
|
//
|
||||||
DockingWindowManager dwm1 = new DockingWindowManager(tool, (List<Image>) null, null);
|
DockingWindowManager dwm1 = new DockingWindowManager(tool, (List<Image>) null);
|
||||||
|
|
||||||
ComponentProvider providerA = addProvider(dwm1, "A", "a", RIGHT);
|
ComponentProvider providerA = addProvider(dwm1, "A", "a", RIGHT);
|
||||||
ComponentProvider providerAB = addProvider(dwm1, "AB", "a.b", BOTTOM);
|
ComponentProvider providerAB = addProvider(dwm1, "AB", "a.b", BOTTOM);
|
||||||
@@ -251,7 +251,7 @@ public class DockingWindowManagerTest extends AbstractDockingTest {
|
|||||||
// and that a subgroup 'a.b' will open relative to the parent. **Make sure that this
|
// and that a subgroup 'a.b' will open relative to the parent. **Make sure that this
|
||||||
// works when the parent is the first provider open.
|
// works when the parent is the first provider open.
|
||||||
//
|
//
|
||||||
DockingWindowManager dwm = new DockingWindowManager(tool, (List<Image>) null, null);
|
DockingWindowManager dwm = new DockingWindowManager(tool, (List<Image>) null);
|
||||||
|
|
||||||
ComponentProvider providerA = addProvider(dwm, "A", "a", TOP, RIGHT);
|
ComponentProvider providerA = addProvider(dwm, "A", "a", TOP, RIGHT);
|
||||||
ComponentProvider providerAB = addProvider(dwm, "AB", "a.b", RIGHT, BOTTOM);
|
ComponentProvider providerAB = addProvider(dwm, "AB", "a.b", RIGHT, BOTTOM);
|
||||||
@@ -268,7 +268,7 @@ public class DockingWindowManagerTest extends AbstractDockingTest {
|
|||||||
// and that a subgroup 'a.b' will open relative to the parent. **Make sure that this
|
// and that a subgroup 'a.b' will open relative to the parent. **Make sure that this
|
||||||
// works when the subgroup is the first provider open.
|
// works when the subgroup is the first provider open.
|
||||||
//
|
//
|
||||||
DockingWindowManager dwm = new DockingWindowManager(tool, (List<Image>) null, null);
|
DockingWindowManager dwm = new DockingWindowManager(tool, (List<Image>) null);
|
||||||
|
|
||||||
ComponentProvider providerAB = addProvider(dwm, "AB", "a.b", RIGHT, BOTTOM);
|
ComponentProvider providerAB = addProvider(dwm, "AB", "a.b", RIGHT, BOTTOM);
|
||||||
ComponentProvider providerA = addProvider(dwm, "A", "a", TOP, RIGHT);
|
ComponentProvider providerA = addProvider(dwm, "A", "a", TOP, RIGHT);
|
||||||
@@ -286,7 +286,7 @@ public class DockingWindowManagerTest extends AbstractDockingTest {
|
|||||||
// Test that two providers that don't share an owner (the plugin) can share a group and
|
// Test that two providers that don't share an owner (the plugin) can share a group and
|
||||||
// open relative to each other.
|
// open relative to each other.
|
||||||
//
|
//
|
||||||
DockingWindowManager dwm = new DockingWindowManager(tool, (List<Image>) null, null);
|
DockingWindowManager dwm = new DockingWindowManager(tool, (List<Image>) null);
|
||||||
|
|
||||||
ComponentProvider p1 = addProvider(dwm, "Owner_1", "Name_1", "group", TOP, TOP);
|
ComponentProvider p1 = addProvider(dwm, "Owner_1", "Name_1", "group", TOP, TOP);
|
||||||
ComponentProvider p2 = addProvider(dwm, "Owner_2", "Name_2", "group", BOTTOM, RIGHT);
|
ComponentProvider p2 = addProvider(dwm, "Owner_2", "Name_2", "group", BOTTOM, RIGHT);
|
||||||
@@ -335,7 +335,7 @@ public class DockingWindowManagerTest extends AbstractDockingTest {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DockingWindowManager dwm = new DockingWindowManager(tool, (List<Image>) null, null);
|
DockingWindowManager dwm = new DockingWindowManager(tool, (List<Image>) null);
|
||||||
|
|
||||||
ComponentProvider pA = addProvider(dwm, "Owner_1", "A", "a", LEFT, LEFT);
|
ComponentProvider pA = addProvider(dwm, "Owner_1", "A", "a", LEFT, LEFT);
|
||||||
ComponentProvider pB = addProvider(dwm, "Owner_2", "B", "b", RIGHT, RIGHT);
|
ComponentProvider pB = addProvider(dwm, "Owner_2", "B", "b", RIGHT, RIGHT);
|
||||||
@@ -408,7 +408,7 @@ public class DockingWindowManagerTest extends AbstractDockingTest {
|
|||||||
|
|
||||||
private DockingWindowManager createNewDockingWindowManagerFromXML(final Element element) {
|
private DockingWindowManager createNewDockingWindowManagerFromXML(final Element element) {
|
||||||
final DockingWindowManager dwm2 =
|
final DockingWindowManager dwm2 =
|
||||||
new DockingWindowManager(new DummyTool("Tool2"), (List<Image>) null, null);
|
new DockingWindowManager(new DummyTool("Tool2"), (List<Image>) null);
|
||||||
|
|
||||||
runSwing(() -> {
|
runSwing(() -> {
|
||||||
dwm2.setVisible(true);
|
dwm2.setVisible(true);
|
||||||
|
|||||||
+1
-1
@@ -35,7 +35,7 @@ import ghidra.test.DummyTool;
|
|||||||
public class NumberInputDialogTest extends AbstractDockingTest {
|
public class NumberInputDialogTest extends AbstractDockingTest {
|
||||||
|
|
||||||
private DockingWindowManager dwm =
|
private DockingWindowManager dwm =
|
||||||
new DockingWindowManager(new DummyTool(), (List<Image>) null, null);
|
new DockingWindowManager(new DummyTool(), (List<Image>) null);
|
||||||
private NumberInputDialog dialog;
|
private NumberInputDialog dialog;
|
||||||
private JButton okButton;
|
private JButton okButton;
|
||||||
private JTextField textField;
|
private JTextField textField;
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ public class GhidraTableFilterTest extends AbstractGhidraHeadedIntegrationTest {
|
|||||||
filteredModel = filterPanel.getTableFilterModel();
|
filteredModel = filterPanel.getTableFilterModel();
|
||||||
table.setAutoLookupColumn(4);
|
table.setAutoLookupColumn(4);
|
||||||
|
|
||||||
winMgr = new DockingWindowManager(new DummyTool(), null, null);
|
winMgr = new DockingWindowManager(new DummyTool(), null);
|
||||||
winMgr.addComponent(new TestTableComponentProvider());
|
winMgr.addComponent(new TestTableComponentProvider());
|
||||||
winMgr.setVisible(true);
|
winMgr.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -544,7 +544,7 @@ public class BookmarkPluginTest extends AbstractGhidraHeadedIntegrationTest {
|
|||||||
applyCmd(program, cmd);
|
applyCmd(program, cmd);
|
||||||
|
|
||||||
List<DockingActionIf> actions = runSwing(() -> plugin.getPopupActions(
|
List<DockingActionIf> actions = runSwing(() -> plugin.getPopupActions(
|
||||||
new ActionContext(null, new MarkerLocation(null, addr("0100b6db"), 0, 0))));
|
null, new ActionContext(null, new MarkerLocation(null, addr("0100b6db"), 0, 0))));
|
||||||
assertEquals(10, actions.size());
|
assertEquals(10, actions.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-1
@@ -97,7 +97,12 @@ public class KeyBindingsTest extends AbstractGhidraHeadedIntegrationTest {
|
|||||||
// verify that the description is displayed for the selected action
|
// verify that the description is displayed for the selected action
|
||||||
|
|
||||||
selectRowForAction(action1);
|
selectRowForAction(action1);
|
||||||
assertTrue(statusPane.getText().indexOf(action1.getDescription()) != -1);
|
|
||||||
|
String actualText = statusPane.getText();
|
||||||
|
assertTrue(
|
||||||
|
"Description is not updated for action '" + action1.getName() + "'; instead the " +
|
||||||
|
"description is '" + actualText + "'",
|
||||||
|
actualText.indexOf(action1.getDescription()) != -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import org.jdom.Element;
|
|||||||
import docking.*;
|
import docking.*;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.actions.DockingToolActions;
|
import docking.actions.DockingToolActions;
|
||||||
|
import docking.actions.PopupActionProvider;
|
||||||
import ghidra.framework.model.*;
|
import ghidra.framework.model.*;
|
||||||
import ghidra.framework.options.ToolOptions;
|
import ghidra.framework.options.ToolOptions;
|
||||||
import ghidra.framework.plugintool.PluginEvent;
|
import ghidra.framework.plugintool.PluginEvent;
|
||||||
@@ -298,6 +299,16 @@ public class DummyTool implements Tool {
|
|||||||
//do nothing
|
//do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addPopupActionProvider(PopupActionProvider listener) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removePopupActionProvider(PopupActionProvider listener) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<DockingActionIf> getAllActions() {
|
public Set<DockingActionIf> getAllActions() {
|
||||||
return Collections.emptySet();
|
return Collections.emptySet();
|
||||||
@@ -348,6 +359,12 @@ public class DummyTool implements Tool {
|
|||||||
//do nothing
|
//do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMenuGroup(String[] menuPath, String group, String menuSubGroup) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void contextChanged(ComponentProvider provider) {
|
public void contextChanged(ComponentProvider provider) {
|
||||||
//do nothing
|
//do nothing
|
||||||
|
|||||||
+6
-7
@@ -28,9 +28,9 @@ import javax.swing.event.TableModelEvent;
|
|||||||
import javax.swing.event.TableModelListener;
|
import javax.swing.event.TableModelListener;
|
||||||
import javax.swing.table.JTableHeader;
|
import javax.swing.table.JTableHeader;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.*;
|
||||||
import docking.WindowPosition;
|
|
||||||
import docking.action.*;
|
import docking.action.*;
|
||||||
|
import docking.actions.PopupActionProvider;
|
||||||
import docking.menu.ActionState;
|
import docking.menu.ActionState;
|
||||||
import docking.menu.MultiStateDockingAction;
|
import docking.menu.MultiStateDockingAction;
|
||||||
import docking.widgets.EventTrigger;
|
import docking.widgets.EventTrigger;
|
||||||
@@ -52,7 +52,6 @@ import ghidra.framework.model.*;
|
|||||||
import ghidra.framework.options.Options;
|
import ghidra.framework.options.Options;
|
||||||
import ghidra.framework.options.SaveState;
|
import ghidra.framework.options.SaveState;
|
||||||
import ghidra.framework.plugintool.ComponentProviderAdapter;
|
import ghidra.framework.plugintool.ComponentProviderAdapter;
|
||||||
import ghidra.framework.plugintool.PopupListener;
|
|
||||||
import ghidra.program.model.address.Address;
|
import ghidra.program.model.address.Address;
|
||||||
import ghidra.program.model.listing.Function;
|
import ghidra.program.model.listing.Function;
|
||||||
import ghidra.program.model.listing.Program;
|
import ghidra.program.model.listing.Program;
|
||||||
@@ -67,7 +66,7 @@ import resources.ResourceManager;
|
|||||||
* Provider for the version tracking function association table.
|
* Provider for the version tracking function association table.
|
||||||
*/
|
*/
|
||||||
public class VTFunctionAssociationProvider extends ComponentProviderAdapter
|
public class VTFunctionAssociationProvider extends ComponentProviderAdapter
|
||||||
implements VTControllerListener, PopupListener {
|
implements VTControllerListener, PopupActionProvider {
|
||||||
|
|
||||||
private static final String FILTER_SETTINGS_KEY = "FUNCTION_FILTER_SETTINGS";
|
private static final String FILTER_SETTINGS_KEY = "FUNCTION_FILTER_SETTINGS";
|
||||||
private static final String BASE_TITLE = "Version Tracking Functions";
|
private static final String BASE_TITLE = "Version Tracking Functions";
|
||||||
@@ -125,7 +124,7 @@ public class VTFunctionAssociationProvider extends ComponentProviderAdapter
|
|||||||
createActions();
|
createActions();
|
||||||
addGeneralCodeComparisonActions();
|
addGeneralCodeComparisonActions();
|
||||||
controller.addListener(this);
|
controller.addListener(this);
|
||||||
tool.addPopupListener(this);
|
tool.addPopupActionProvider(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createActions() {
|
private void createActions() {
|
||||||
@@ -216,7 +215,7 @@ public class VTFunctionAssociationProvider extends ComponentProviderAdapter
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DockingActionIf> getPopupActions(ActionContext context) {
|
public List<DockingActionIf> getPopupActions(DockingTool tool, ActionContext context) {
|
||||||
if (context.getComponentProvider() == this) {
|
if (context.getComponentProvider() == this) {
|
||||||
ListingCodeComparisonPanel dualListingPanel =
|
ListingCodeComparisonPanel dualListingPanel =
|
||||||
functionComparisonPanel.getDualListingPanel();
|
functionComparisonPanel.getDualListingPanel();
|
||||||
@@ -334,7 +333,7 @@ public class VTFunctionAssociationProvider extends ComponentProviderAdapter
|
|||||||
destinationFunctionsTable.dispose();
|
destinationFunctionsTable.dispose();
|
||||||
destinationTableFilterPanel.dispose();
|
destinationTableFilterPanel.dispose();
|
||||||
|
|
||||||
tool.removePopupListener(this);
|
tool.removePopupActionProvider(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reload() {
|
public void reload() {
|
||||||
|
|||||||
+5
-5
@@ -30,6 +30,7 @@ import javax.swing.table.*;
|
|||||||
|
|
||||||
import docking.*;
|
import docking.*;
|
||||||
import docking.action.*;
|
import docking.action.*;
|
||||||
|
import docking.actions.PopupActionProvider;
|
||||||
import docking.help.HelpService;
|
import docking.help.HelpService;
|
||||||
import docking.widgets.EventTrigger;
|
import docking.widgets.EventTrigger;
|
||||||
import docking.widgets.fieldpanel.FieldPanel;
|
import docking.widgets.fieldpanel.FieldPanel;
|
||||||
@@ -56,7 +57,6 @@ import ghidra.framework.model.DomainObjectChangedEvent;
|
|||||||
import ghidra.framework.options.Options;
|
import ghidra.framework.options.Options;
|
||||||
import ghidra.framework.options.SaveState;
|
import ghidra.framework.options.SaveState;
|
||||||
import ghidra.framework.plugintool.ComponentProviderAdapter;
|
import ghidra.framework.plugintool.ComponentProviderAdapter;
|
||||||
import ghidra.framework.plugintool.PopupListener;
|
|
||||||
import ghidra.program.model.address.*;
|
import ghidra.program.model.address.*;
|
||||||
import ghidra.program.model.listing.*;
|
import ghidra.program.model.listing.*;
|
||||||
import ghidra.program.util.ProgramLocation;
|
import ghidra.program.util.ProgramLocation;
|
||||||
@@ -69,7 +69,7 @@ import resources.ResourceManager;
|
|||||||
* This provides the GUI for displaying and working with version tracking markup items.
|
* This provides the GUI for displaying and working with version tracking markup items.
|
||||||
*/
|
*/
|
||||||
public class VTMarkupItemsTableProvider extends ComponentProviderAdapter
|
public class VTMarkupItemsTableProvider extends ComponentProviderAdapter
|
||||||
implements FilterDialogModel<VTMarkupItem>, VTControllerListener, PopupListener {
|
implements FilterDialogModel<VTMarkupItem>, VTControllerListener, PopupActionProvider {
|
||||||
|
|
||||||
private static final String SHOW_COMPARISON_PANEL = "SHOW_COMPARISON_PANEL";
|
private static final String SHOW_COMPARISON_PANEL = "SHOW_COMPARISON_PANEL";
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ public class VTMarkupItemsTableProvider extends ComponentProviderAdapter
|
|||||||
iconTimer = new FilterIconFlashTimer<>(UNFILTERED_ICON, FILTERED_ICON,
|
iconTimer = new FilterIconFlashTimer<>(UNFILTERED_ICON, FILTERED_ICON,
|
||||||
ancillaryFilterDialog, ancillaryFilterButton);
|
ancillaryFilterDialog, ancillaryFilterButton);
|
||||||
|
|
||||||
tool.addPopupListener(this);
|
tool.addPopupActionProvider(this);
|
||||||
|
|
||||||
HelpLocation helpLocation = new HelpLocation("VersionTrackingPlugin", "Markup Items Table");
|
HelpLocation helpLocation = new HelpLocation("VersionTrackingPlugin", "Markup Items Table");
|
||||||
setHelpLocation(helpLocation);
|
setHelpLocation(helpLocation);
|
||||||
@@ -452,7 +452,7 @@ public class VTMarkupItemsTableProvider extends ComponentProviderAdapter
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DockingActionIf> getPopupActions(ActionContext context) {
|
public List<DockingActionIf> getPopupActions(DockingTool tool, ActionContext context) {
|
||||||
ListingCodeComparisonPanel dualListingPanel = functionComparisonPanel.getDualListingPanel();
|
ListingCodeComparisonPanel dualListingPanel = functionComparisonPanel.getDualListingPanel();
|
||||||
if (context.getComponentProvider() == this && dualListingPanel != null) {
|
if (context.getComponentProvider() == this && dualListingPanel != null) {
|
||||||
ListingPanel sourcePanel = dualListingPanel.getLeftPanel();
|
ListingPanel sourcePanel = dualListingPanel.getLeftPanel();
|
||||||
@@ -534,7 +534,7 @@ public class VTMarkupItemsTableProvider extends ComponentProviderAdapter
|
|||||||
filter.dispose();
|
filter.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
tool.removePopupListener(this);
|
tool.removePopupActionProvider(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
VTController getController() {
|
VTController getController() {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import java.util.*;
|
|||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
|
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
|
import docking.actions.PopupActionProvider;
|
||||||
import docking.actions.ToolActions;
|
import docking.actions.ToolActions;
|
||||||
import ghidra.framework.options.ToolOptions;
|
import ghidra.framework.options.ToolOptions;
|
||||||
import ghidra.util.Swing;
|
import ghidra.util.Swing;
|
||||||
@@ -123,6 +124,16 @@ public abstract class AbstractDockingTool implements DockingTool {
|
|||||||
return toolActions.getAllActions();
|
return toolActions.getAllActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addPopupActionProvider(PopupActionProvider provider) {
|
||||||
|
winMgr.addPopupActionProvider(provider);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removePopupActionProvider(PopupActionProvider provider) {
|
||||||
|
winMgr.removePopupActionProvider(provider);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<DockingActionIf> getDockingActionsByOwnerName(String owner) {
|
public Set<DockingActionIf> getDockingActionsByOwnerName(String owner) {
|
||||||
return toolActions.getActions(owner);
|
return toolActions.getActions(owner);
|
||||||
@@ -174,6 +185,25 @@ public abstract class AbstractDockingTool implements DockingTool {
|
|||||||
winMgr.updateTitle(provider);
|
winMgr.updateTitle(provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the menu group associated with a cascaded submenu. This allows
|
||||||
|
* a cascading menu item to be grouped with a specific set of actions.
|
||||||
|
* The default group for a cascaded submenu is the name of the submenu.
|
||||||
|
*
|
||||||
|
* @param menuPath menu name path where the last element corresponds
|
||||||
|
* to the specified group name.
|
||||||
|
* @param group group name
|
||||||
|
* @see #setMenuGroup(String[], String, String)
|
||||||
|
*/
|
||||||
|
public void setMenuGroup(String[] menuPath, String group) {
|
||||||
|
setMenuGroup(menuPath, group, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMenuGroup(String[] menuPath, String group, String menuSubGroup) {
|
||||||
|
winMgr.setMenuGroup(menuPath, group, menuSubGroup);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void contextChanged(ComponentProvider provider) {
|
public void contextChanged(ComponentProvider provider) {
|
||||||
winMgr.contextChanged(provider);
|
winMgr.contextChanged(provider);
|
||||||
|
|||||||
@@ -110,10 +110,6 @@ public class ActionToGuiMapper {
|
|||||||
globalActions.clear();
|
globalActions.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMenuGroup(String[] menuPath, String group) {
|
|
||||||
menuGroupMap.setMenuGroup(menuPath, group);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setMenuGroup(String[] menuPath, String group, String menuSubGroup) {
|
void setMenuGroup(String[] menuPath, String group, String menuSubGroup) {
|
||||||
menuGroupMap.setMenuGroup(menuPath, group, menuSubGroup);
|
menuGroupMap.setMenuGroup(menuPath, group, menuSubGroup);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
/* ###
|
/* ###
|
||||||
* IP: GHIDRA
|
* IP: GHIDRA
|
||||||
* REVIEWED: YES
|
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -16,7 +15,18 @@
|
|||||||
*/
|
*/
|
||||||
package docking;
|
package docking;
|
||||||
|
|
||||||
|
import java.awt.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A listener interface to know when a component has been
|
||||||
|
* made {@link Component#isDisplayable() displayable}
|
||||||
|
*/
|
||||||
public interface ComponentLoadedListener {
|
public interface ComponentLoadedListener {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the component is made displayable
|
||||||
|
*
|
||||||
|
* @param windowManager the window manager associated with the loaded component
|
||||||
|
*/
|
||||||
public void componentLoaded(DockingWindowManager windowManager);
|
public void componentLoaded(DockingWindowManager windowManager);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -807,7 +807,7 @@ public abstract class ComponentProvider implements HelpDescriptor, ActionContext
|
|||||||
|
|
||||||
DockingWindowManager myDwm = DockingWindowManager.getInstance(getComponent());
|
DockingWindowManager myDwm = DockingWindowManager.getInstance(getComponent());
|
||||||
if (myDwm == null) {
|
if (myDwm == null) {
|
||||||
// don't think this can happen
|
// this can happen when the tool loses focus
|
||||||
dockingTool.showComponentProvider(ComponentProvider.this, true);
|
dockingTool.showComponentProvider(ComponentProvider.this, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import docking.actions.ActionAdapter;
|
|||||||
import docking.actions.KeyBindingUtils;
|
import docking.actions.KeyBindingUtils;
|
||||||
import docking.event.mouse.GMouseListenerAdapter;
|
import docking.event.mouse.GMouseListenerAdapter;
|
||||||
import docking.menu.DockingToolbarButton;
|
import docking.menu.DockingToolbarButton;
|
||||||
import docking.util.*;
|
import docking.util.AnimationUtils;
|
||||||
import docking.widgets.label.GDHtmlLabel;
|
import docking.widgets.label.GDHtmlLabel;
|
||||||
import ghidra.util.*;
|
import ghidra.util.*;
|
||||||
import ghidra.util.exception.AssertException;
|
import ghidra.util.exception.AssertException;
|
||||||
@@ -43,9 +43,8 @@ import utility.function.Callback;
|
|||||||
* Base class used for creating dialogs in Ghidra. Subclass this to create a dialog provider that has
|
* Base class used for creating dialogs in Ghidra. Subclass this to create a dialog provider that has
|
||||||
* all the gui elements to appear in the dialog, then use tool.showDialog() to display your dialog.
|
* all the gui elements to appear in the dialog, then use tool.showDialog() to display your dialog.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class DialogComponentProvider
|
public class DialogComponentProvider
|
||||||
implements TaskListener, StatusListener, ActionContextProvider {
|
implements ActionContextProvider, StatusListener, TaskListener {
|
||||||
|
|
||||||
private static final Color WARNING_COLOR = new Color(0xff9900);
|
private static final Color WARNING_COLOR = new Color(0xff9900);
|
||||||
|
|
||||||
@@ -1369,5 +1368,4 @@ public class DialogComponentProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-2
@@ -73,7 +73,7 @@ public class DialogComponentProviderPopupActionManager {
|
|||||||
MenuGroupMap menuGroupMap = actionManager.getMenuGroupMap();
|
MenuGroupMap menuGroupMap = actionManager.getMenuGroupMap();
|
||||||
MenuManager menuMgr =
|
MenuManager menuMgr =
|
||||||
new MenuManager("Popup", '\0', null, true, popupMenuHandler, menuGroupMap);
|
new MenuManager("Popup", '\0', null, true, popupMenuHandler, menuGroupMap);
|
||||||
populatePopupMenuActions(actionContext, menuMgr);
|
populatePopupMenuActions(dwm, menuMgr, actionContext);
|
||||||
if (menuMgr.isEmpty()) {
|
if (menuMgr.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -85,7 +85,8 @@ public class DialogComponentProviderPopupActionManager {
|
|||||||
popupMenu.show(c, e.getX(), e.getY());
|
popupMenu.show(c, e.getX(), e.getY());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populatePopupMenuActions(ActionContext actionContext, MenuManager menuMgr) {
|
private void populatePopupMenuActions(DockingWindowManager dwm, MenuManager menuMgr,
|
||||||
|
ActionContext actionContext) {
|
||||||
|
|
||||||
Iterator<DockingActionIf> iter = popupActions.iterator();
|
Iterator<DockingActionIf> iter = popupActions.iterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
@@ -112,6 +113,18 @@ public class DialogComponentProviderPopupActionManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<DockingActionIf> tempActions = dwm.getTemporaryPopupActions(actionContext);
|
||||||
|
if (tempActions != null) {
|
||||||
|
for (DockingActionIf action : tempActions) {
|
||||||
|
MenuData popupMenuData = action.getPopupMenuData();
|
||||||
|
if (popupMenuData != null && action.isValidContext(actionContext) &&
|
||||||
|
action.isAddToPopup(actionContext)) {
|
||||||
|
action.setEnabled(action.isEnabledForContext(actionContext));
|
||||||
|
menuMgr.addAction(action);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
/* ###
|
|
||||||
* IP: GHIDRA
|
|
||||||
* REVIEWED: YES
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package docking;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import docking.action.DockingActionIf;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Listener interface for the object to be notified when the user closes the
|
|
||||||
* docking windows manager or initiates a popup menu.
|
|
||||||
*/
|
|
||||||
public interface DockWinListener {
|
|
||||||
/**
|
|
||||||
* Notification triggered when the user presses the "x" button in the main tool frame.
|
|
||||||
* Typical reaction is to dispose the dockingWindowManger and/or exit.
|
|
||||||
*/
|
|
||||||
void close();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides notification when a popup menu is about to be displayed
|
|
||||||
* and permits a list of temporary actions to be returned. Only
|
|
||||||
* those actions which have a suitable popup menu path will be
|
|
||||||
* considered.
|
|
||||||
* @param context the ActionContext
|
|
||||||
* @return list of temporary actions.
|
|
||||||
*/
|
|
||||||
List<DockingActionIf> getPopupActions(ActionContext context);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -22,6 +22,7 @@ import javax.swing.ImageIcon;
|
|||||||
|
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.actions.DockingToolActions;
|
import docking.actions.DockingToolActions;
|
||||||
|
import docking.actions.PopupActionProvider;
|
||||||
import ghidra.framework.options.ToolOptions;
|
import ghidra.framework.options.ToolOptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -103,6 +104,20 @@ public interface DockingTool {
|
|||||||
*/
|
*/
|
||||||
public void clearStatusInfo();
|
public void clearStatusInfo();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the menu group associated with a cascaded submenu. This allows
|
||||||
|
* a cascading menu item to be grouped with a specific set of actions.
|
||||||
|
* <p>
|
||||||
|
* The default group for a cascaded submenu is the name of the submenu.
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* @param menuPath menu name path where the last element corresponds to the specified group name.
|
||||||
|
* @param group group name
|
||||||
|
* @param menuSubGroup the name used to sort the cascaded menu within other menu items at
|
||||||
|
* its level
|
||||||
|
*/
|
||||||
|
public void setMenuGroup(String[] menuPath, String group, String menuSubGroup);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the action to the tool.
|
* Adds the action to the tool.
|
||||||
* @param action the action to be added.
|
* @param action the action to be added.
|
||||||
@@ -129,6 +144,19 @@ public interface DockingTool {
|
|||||||
*/
|
*/
|
||||||
public void removeLocalAction(ComponentProvider componentProvider, DockingActionIf action);
|
public void removeLocalAction(ComponentProvider componentProvider, DockingActionIf action);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the given popup action provider to this tool. This provider will be called each
|
||||||
|
* time the popup menu is about to be shown.
|
||||||
|
* @param provider the provider
|
||||||
|
*/
|
||||||
|
public void addPopupActionProvider(PopupActionProvider provider);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the given popup action provider
|
||||||
|
* @param provider the provider
|
||||||
|
*/
|
||||||
|
public void removePopupActionProvider(PopupActionProvider provider);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a set of all actions in the tool.
|
* Return a set of all actions in the tool.
|
||||||
*
|
*
|
||||||
@@ -273,4 +301,12 @@ public interface DockingTool {
|
|||||||
* @return the action manager
|
* @return the action manager
|
||||||
*/
|
*/
|
||||||
public DockingToolActions getToolActions();
|
public DockingToolActions getToolActions();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Suggests the tool to attempt to close(). This will be as though the user
|
||||||
|
* selected the close menu option on the tool or hit the closeWindow x button in
|
||||||
|
* the upper corner (Windows systems).
|
||||||
|
*/
|
||||||
|
public void close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,8 +30,7 @@ import org.apache.commons.collections4.map.LazyMap;
|
|||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
|
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.actions.DockingToolActions;
|
import docking.actions.*;
|
||||||
import docking.actions.ToolActions;
|
|
||||||
import docking.help.HelpService;
|
import docking.help.HelpService;
|
||||||
import generic.util.WindowUtilities;
|
import generic.util.WindowUtilities;
|
||||||
import ghidra.framework.OperatingSystem;
|
import ghidra.framework.OperatingSystem;
|
||||||
@@ -42,6 +41,7 @@ import ghidra.util.datastruct.*;
|
|||||||
import ghidra.util.exception.AssertException;
|
import ghidra.util.exception.AssertException;
|
||||||
import ghidra.util.task.SwingUpdateManager;
|
import ghidra.util.task.SwingUpdateManager;
|
||||||
import util.CollectionUtils;
|
import util.CollectionUtils;
|
||||||
|
import utilities.util.reflection.ReflectionUtilities;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages the "Docking" arrangement of a set of components and actions. The components can be "docked"
|
* Manages the "Docking" arrangement of a set of components and actions. The components can be "docked"
|
||||||
@@ -71,7 +71,8 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
|
|||||||
*/
|
*/
|
||||||
private static HelpService helpService = new DefaultHelpService();
|
private static HelpService helpService = new DefaultHelpService();
|
||||||
|
|
||||||
private static List<DockingWindowManager> instanceList = new ArrayList<>();
|
// we use a list to maintain order
|
||||||
|
private static List<DockingWindowManager> instances = new ArrayList<>();
|
||||||
|
|
||||||
private DockingTool tool;
|
private DockingTool tool;
|
||||||
private RootNode root;
|
private RootNode root;
|
||||||
@@ -87,9 +88,10 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
|
|||||||
|
|
||||||
private Map<String, ComponentProvider> providerNameCache = new HashMap<>();
|
private Map<String, ComponentProvider> providerNameCache = new HashMap<>();
|
||||||
private Map<String, PreferenceState> preferenceStateMap = new HashMap<>();
|
private Map<String, PreferenceState> preferenceStateMap = new HashMap<>();
|
||||||
private DockWinListener docListener;
|
|
||||||
private ActionToGuiMapper actionToGuiMapper;
|
private ActionToGuiMapper actionToGuiMapper;
|
||||||
|
|
||||||
|
private WeakSet<PopupActionProvider> popupActionProviders =
|
||||||
|
WeakDataStructureFactory.createSingleThreadAccessWeakSet();
|
||||||
private WeakSet<DockingContextListener> contextListeners =
|
private WeakSet<DockingContextListener> contextListeners =
|
||||||
WeakDataStructureFactory.createSingleThreadAccessWeakSet();
|
WeakDataStructureFactory.createSingleThreadAccessWeakSet();
|
||||||
|
|
||||||
@@ -108,10 +110,9 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
|
|||||||
* Constructs a new DockingWindowManager
|
* Constructs a new DockingWindowManager
|
||||||
* @param tool the tool
|
* @param tool the tool
|
||||||
* @param images the images to use for windows in this window manager
|
* @param images the images to use for windows in this window manager
|
||||||
* @param docListener the listener to be notified when the user closes the manager
|
|
||||||
*/
|
*/
|
||||||
public DockingWindowManager(DockingTool tool, List<Image> images, DockWinListener docListener) {
|
public DockingWindowManager(DockingTool tool, List<Image> images) {
|
||||||
this(tool, images, docListener, false, true, true, null);
|
this(tool, images, false, true, true, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -119,20 +120,18 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
|
|||||||
*
|
*
|
||||||
* @param tool the tool
|
* @param tool the tool
|
||||||
* @param images the list of icons to set on the window
|
* @param images the list of icons to set on the window
|
||||||
* @param docListener the listener to be notified when the user closes the manager
|
|
||||||
* @param modal if true then the root window will be a modal dialog instead of a frame
|
* @param modal if true then the root window will be a modal dialog instead of a frame
|
||||||
* @param isDocking true for normal operation, false to suppress docking support(removes
|
* @param isDocking true for normal operation, false to suppress docking support(removes
|
||||||
* component headers and window menu)
|
* component headers and window menu)
|
||||||
* @param hasStatusBar if true a status bar will be created for the main window
|
* @param hasStatusBar if true a status bar will be created for the main window
|
||||||
* @param factory the drop target factory
|
* @param factory the drop target factory
|
||||||
*/
|
*/
|
||||||
public DockingWindowManager(DockingTool tool, List<Image> images, DockWinListener docListener,
|
public DockingWindowManager(DockingTool tool, List<Image> images, boolean modal,
|
||||||
boolean modal, boolean isDocking, boolean hasStatusBar, DropTargetFactory factory) {
|
boolean isDocking, boolean hasStatusBar, DropTargetFactory factory) {
|
||||||
|
|
||||||
KeyBindingOverrideKeyEventDispatcher.install();
|
KeyBindingOverrideKeyEventDispatcher.install();
|
||||||
|
|
||||||
this.tool = tool;
|
this.tool = tool;
|
||||||
this.docListener = docListener;
|
|
||||||
this.isDocking = isDocking;
|
this.isDocking = isDocking;
|
||||||
this.hasStatusBar = hasStatusBar;
|
this.hasStatusBar = hasStatusBar;
|
||||||
if (images == null) {
|
if (images == null) {
|
||||||
@@ -174,16 +173,12 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
|
|||||||
return helpService;
|
return helpService;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<DockingActionIf> getTemporaryPopupActions(ActionContext context) {
|
|
||||||
return docListener.getPopupActions(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static synchronized void addInstance(DockingWindowManager winMgr) {
|
private static synchronized void addInstance(DockingWindowManager winMgr) {
|
||||||
instanceList.add(winMgr);
|
instances.add(winMgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static synchronized void removeInstance(DockingWindowManager winMgr) {
|
private static synchronized void removeInstance(DockingWindowManager winMgr) {
|
||||||
instanceList.remove(winMgr);
|
instances.remove(winMgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -197,7 +192,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator<DockingWindowManager> iter = instanceList.iterator();
|
Iterator<DockingWindowManager> iter = instances.iterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
DockingWindowManager winMgr = iter.next();
|
DockingWindowManager winMgr = iter.next();
|
||||||
if (winMgr.root.getFrame() == win) {
|
if (winMgr.root.getFrame() == win) {
|
||||||
@@ -249,8 +244,8 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
|
|||||||
// most active. Any time we change the active manager, it will be placed
|
// most active. Any time we change the active manager, it will be placed
|
||||||
// in the back of the list.
|
// in the back of the list.
|
||||||
//
|
//
|
||||||
for (int i = instanceList.size() - 1; i >= 0; i--) {
|
for (int i = instances.size() - 1; i >= 0; i--) {
|
||||||
DockingWindowManager mgr = instanceList.get(i);
|
DockingWindowManager mgr = instances.get(i);
|
||||||
if (mgr.root.isVisible()) {
|
if (mgr.root.isVisible()) {
|
||||||
return mgr;
|
return mgr;
|
||||||
}
|
}
|
||||||
@@ -263,7 +258,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
|
|||||||
* @return a new list of all DockingWindowManager instances know to exist.
|
* @return a new list of all DockingWindowManager instances know to exist.
|
||||||
*/
|
*/
|
||||||
public static synchronized List<DockingWindowManager> getAllDockingWindowManagers() {
|
public static synchronized List<DockingWindowManager> getAllDockingWindowManagers() {
|
||||||
return new ArrayList<>(instanceList);
|
return new ArrayList<>(instances);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -271,8 +266,8 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
|
|||||||
* @param mgr the window manager that became active.
|
* @param mgr the window manager that became active.
|
||||||
*/
|
*/
|
||||||
static synchronized void setActiveManager(DockingWindowManager mgr) {
|
static synchronized void setActiveManager(DockingWindowManager mgr) {
|
||||||
if (instanceList.remove(mgr)) {
|
if (instances.remove(mgr)) {
|
||||||
instanceList.add(mgr);
|
instances.add(mgr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -850,9 +845,9 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
|
|||||||
}
|
}
|
||||||
|
|
||||||
placeholder.show(visibleState);
|
placeholder.show(visibleState);
|
||||||
movePlaceholderToFront(placeholder, false);
|
|
||||||
|
|
||||||
if (visibleState) {
|
if (visibleState) {
|
||||||
|
movePlaceholderToFront(placeholder, false);
|
||||||
if (placeholder.getNode() == null) {
|
if (placeholder.getNode() == null) {
|
||||||
root.add(placeholder);
|
root.add(placeholder);
|
||||||
}
|
}
|
||||||
@@ -1084,7 +1079,7 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
|
|||||||
* the main window frame.
|
* the main window frame.
|
||||||
*/
|
*/
|
||||||
void close() {
|
void close() {
|
||||||
docListener.close();
|
tool.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isDocking() {
|
boolean isDocking() {
|
||||||
@@ -1944,26 +1939,13 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
|
|||||||
Toolkit.getDefaultToolkit().beep();
|
Toolkit.getDefaultToolkit().beep();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the menu group associated with a cascaded submenu. This allows
|
|
||||||
* a cascading menu item to be grouped with a specific set of actions.
|
|
||||||
* The default group for a cascaded submenu is the name of the submenu.
|
|
||||||
* @param menuPath menu name path where the last element corresponds
|
|
||||||
* to the specified group name.
|
|
||||||
* @param group group name
|
|
||||||
*/
|
|
||||||
public void setMenuGroup(String[] menuPath, String group) {
|
|
||||||
doSetMenuGroup(menuPath, group);
|
|
||||||
scheduleUpdate();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A version of setMenuGroup() that does *not* trigger an update. When clients call the
|
* A version of setMenuGroup() that does *not* trigger an update. When clients call the
|
||||||
* public API, an update is needed. This method is used during the rebuilding process
|
* public API, an update is needed. This method is used during the rebuilding process
|
||||||
* when we know that an update is not need, as we are in the middle of an update.
|
* when we know that an update is not need, as we are in the middle of an update.
|
||||||
*/
|
*/
|
||||||
void doSetMenuGroup(String[] menuPath, String group) {
|
void doSetMenuGroup(String[] menuPath, String group) {
|
||||||
actionToGuiMapper.setMenuGroup(menuPath, group);
|
actionToGuiMapper.setMenuGroup(menuPath, group, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2099,6 +2081,44 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
|
|||||||
actionToGuiMapper.contextChanged(placeholder);
|
actionToGuiMapper.contextChanged(placeholder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the given popup action provider to this tool. This provider will be called each
|
||||||
|
* time the popup menu is about to be shown.
|
||||||
|
* @param provider the provider
|
||||||
|
*/
|
||||||
|
public void addPopupActionProvider(PopupActionProvider provider) {
|
||||||
|
popupActionProviders.add(provider);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the given popup action provider
|
||||||
|
* @param provider the provider
|
||||||
|
*/
|
||||||
|
public void removePopupActionProvider(PopupActionProvider provider) {
|
||||||
|
popupActionProviders.remove(provider);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of temporary popup actions to be returned. Only those actions which have
|
||||||
|
* a suitable popup menu path will be considered. This mechanism allows clients to
|
||||||
|
* add transient actions to be added to the tool without the accompanying management overhead.
|
||||||
|
*
|
||||||
|
* @param context the ActionContext
|
||||||
|
* @return list of temporary actions
|
||||||
|
* @see #addPopupActionProvider(PopupActionProvider)
|
||||||
|
*/
|
||||||
|
List<DockingActionIf> getTemporaryPopupActions(ActionContext context) {
|
||||||
|
|
||||||
|
List<DockingActionIf> actionList = new ArrayList<>();
|
||||||
|
for (PopupActionProvider pl : popupActionProviders) {
|
||||||
|
List<DockingActionIf> actions = pl.getPopupActions(tool, context);
|
||||||
|
if (actions != null) {
|
||||||
|
actionList.addAll(actions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return actionList;
|
||||||
|
}
|
||||||
|
|
||||||
public void addContextListener(DockingContextListener listener) {
|
public void addContextListener(DockingContextListener listener) {
|
||||||
contextListeners.add(listener);
|
contextListeners.add(listener);
|
||||||
}
|
}
|
||||||
@@ -2118,30 +2138,44 @@ public class DockingWindowManager implements PropertyChangeListener, Placeholder
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a callback to be notified when the given component has been parented to
|
* Registers a callback to be notified when the given component has been parented to
|
||||||
* a docking window manager.
|
* a docking window manager
|
||||||
* @param component the component that will be parented in a docking window system.
|
*
|
||||||
* @param listener the listener to be notified the component was parented.
|
* @param component the component that will be parented in a docking window system
|
||||||
|
* @param listener the listener to be notified the component was parented
|
||||||
*/
|
*/
|
||||||
public static void registerComponentLoadedListener(final Component component,
|
public static void registerComponentLoadedListener(Component component,
|
||||||
final ComponentLoadedListener listener) {
|
ComponentLoadedListener listener) {
|
||||||
|
|
||||||
// We want to load our state after the column model is loaded. We are using this
|
|
||||||
// listener to know when the table has been added to the component hierarchy, as its
|
|
||||||
// model has been loaded by then.
|
|
||||||
component.addHierarchyListener(new HierarchyListener() {
|
component.addHierarchyListener(new HierarchyListener() {
|
||||||
@Override
|
@Override
|
||||||
public void hierarchyChanged(HierarchyEvent e) {
|
public void hierarchyChanged(HierarchyEvent e) {
|
||||||
long changeFlags = e.getChangeFlags();
|
long changeFlags = e.getChangeFlags();
|
||||||
if (HierarchyEvent.DISPLAYABILITY_CHANGED == (changeFlags &
|
|
||||||
HierarchyEvent.DISPLAYABILITY_CHANGED)) {
|
|
||||||
|
|
||||||
// check for the first time we are put together
|
if (HierarchyEvent.DISPLAYABILITY_CHANGED != (changeFlags &
|
||||||
boolean isDisplayable = component.isDisplayable();
|
HierarchyEvent.DISPLAYABILITY_CHANGED)) {
|
||||||
if (isDisplayable) {
|
return;
|
||||||
component.removeHierarchyListener(this);
|
}
|
||||||
DockingWindowManager windowManager = getInstance(component);
|
|
||||||
listener.componentLoaded(windowManager);
|
// check for the first time we are put together
|
||||||
}
|
boolean isDisplayable = component.isDisplayable();
|
||||||
|
if (!isDisplayable) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
component.removeHierarchyListener(this);
|
||||||
|
DockingWindowManager dwm = getInstance(component);
|
||||||
|
if (dwm != null) {
|
||||||
|
listener.componentLoaded(dwm);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unable to find the manager. This can happen during testing; only report if
|
||||||
|
// it is unexpected
|
||||||
|
if (!instances.isEmpty()) {
|
||||||
|
Msg.debug(DockingWindowManager.class,
|
||||||
|
"Unable to find Docking Window Manager for " +
|
||||||
|
component.getClass().getSimpleName(),
|
||||||
|
ReflectionUtilities.createJavaFilteredThrowable());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -24,10 +24,11 @@ import java.util.*;
|
|||||||
import javax.swing.JPopupMenu;
|
import javax.swing.JPopupMenu;
|
||||||
|
|
||||||
import docking.action.*;
|
import docking.action.*;
|
||||||
|
import docking.actions.PopupActionProvider;
|
||||||
import docking.menu.*;
|
import docking.menu.*;
|
||||||
|
|
||||||
public class PopupActionManager implements PropertyChangeListener {
|
public class PopupActionManager implements PropertyChangeListener {
|
||||||
private List<DockingActionIf> popupActions = new ArrayList<DockingActionIf>();
|
private List<DockingActionIf> popupActions = new ArrayList<>();
|
||||||
private DockingWindowManager windowManager;
|
private DockingWindowManager windowManager;
|
||||||
private MenuGroupMap menuGroupMap;
|
private MenuGroupMap menuGroupMap;
|
||||||
|
|
||||||
@@ -94,23 +95,11 @@ public class PopupActionManager implements PropertyChangeListener {
|
|||||||
popupMenu.show(c, e.getX(), e.getY());
|
popupMenu.show(c, e.getX(), e.getY());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populatePopupMenuActions(ComponentPlaceholder info,
|
private void populatePopupMenuActions(ComponentPlaceholder info, ActionContext actionContext,
|
||||||
ActionContext actionContext, MenuManager menuMgr) {
|
MenuManager menuMgr) {
|
||||||
|
|
||||||
// Include unregistered actions
|
// Unregistered actions are those used by special-needs components, on-the-fly
|
||||||
Object source = actionContext.getSourceObject();
|
addUnregisteredActions(actionContext, menuMgr);
|
||||||
if (source instanceof DockingActionProviderIf) {
|
|
||||||
DockingActionProviderIf actionProvider = (DockingActionProviderIf) source;
|
|
||||||
List<DockingActionIf> dockingActions = actionProvider.getDockingActions();
|
|
||||||
for (DockingActionIf action : dockingActions) {
|
|
||||||
MenuData popupMenuData = action.getPopupMenuData();
|
|
||||||
if (popupMenuData != null && action.isValidContext(actionContext) &&
|
|
||||||
action.isAddToPopup(actionContext)) {
|
|
||||||
action.setEnabled(action.isEnabledForContext(actionContext));
|
|
||||||
menuMgr.addAction(action);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Include temporary actions
|
// Include temporary actions
|
||||||
List<DockingActionIf> tempActions = windowManager.getTemporaryPopupActions(actionContext);
|
List<DockingActionIf> tempActions = windowManager.getTemporaryPopupActions(actionContext);
|
||||||
@@ -152,6 +141,42 @@ public class PopupActionManager implements PropertyChangeListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addUnregisteredActions(ActionContext actionContext, MenuManager menuMgr) {
|
||||||
|
|
||||||
|
Object source = actionContext.getSourceObject();
|
||||||
|
|
||||||
|
// this interface is deprecated in favor of the next block
|
||||||
|
if (source instanceof DockingActionProviderIf) {
|
||||||
|
DockingActionProviderIf actionProvider = (DockingActionProviderIf) source;
|
||||||
|
List<DockingActionIf> dockingActions = actionProvider.getDockingActions();
|
||||||
|
for (DockingActionIf action : dockingActions) {
|
||||||
|
MenuData popupMenuData = action.getPopupMenuData();
|
||||||
|
if (popupMenuData != null && action.isValidContext(actionContext) &&
|
||||||
|
action.isAddToPopup(actionContext)) {
|
||||||
|
action.setEnabled(action.isEnabledForContext(actionContext));
|
||||||
|
menuMgr.addAction(action);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// note: this is temporary; there is only one client that needs this. This will be
|
||||||
|
// removed in a future ticket when that client uses the standard tool action system
|
||||||
|
if (source instanceof PopupActionProvider) {
|
||||||
|
PopupActionProvider actionProvider = (PopupActionProvider) source;
|
||||||
|
DockingTool tool = windowManager.getTool();
|
||||||
|
List<DockingActionIf> dockingActions =
|
||||||
|
actionProvider.getPopupActions(tool, actionContext);
|
||||||
|
for (DockingActionIf action : dockingActions) {
|
||||||
|
MenuData popupMenuData = action.getPopupMenuData();
|
||||||
|
if (popupMenuData != null && action.isValidContext(actionContext) &&
|
||||||
|
action.isAddToPopup(actionContext)) {
|
||||||
|
action.setEnabled(action.isEnabledForContext(actionContext));
|
||||||
|
menuMgr.addAction(action);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isRemovingFromPopup(MenuData oldData, MenuData newData) {
|
private boolean isRemovingFromPopup(MenuData oldData, MenuData newData) {
|
||||||
return oldData != null && newData == null;
|
return oldData != null && newData == null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ package docking.action;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import docking.DockingTool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An interface for objects (really Components) to implement that signals they provide actions
|
* An interface for objects (really Components) to implement that signals they provide actions
|
||||||
* for the Docking environment. This interface will be called when the implementor is the source
|
* for the Docking environment. This interface will be called when the implementor is the source
|
||||||
@@ -26,7 +28,11 @@ import java.util.List;
|
|||||||
* When the user right-clicks on said table, then Docking system will ask this object for its
|
* When the user right-clicks on said table, then Docking system will ask this object for its
|
||||||
* actions. Further, in this example, the actions given will be inserted into the popup menu
|
* actions. Further, in this example, the actions given will be inserted into the popup menu
|
||||||
* that is shown.
|
* that is shown.
|
||||||
|
*
|
||||||
|
* @deprecated use {@link DockingTool}
|
||||||
*/
|
*/
|
||||||
|
// Note: this API is not likely used by forward-facing clients and can be removed in the next release
|
||||||
|
@Deprecated(since = "9.1", forRemoval = true)
|
||||||
public interface DockingActionProviderIf {
|
public interface DockingActionProviderIf {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
/* ###
|
||||||
|
* IP: GHIDRA
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package docking.actions;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import docking.ActionContext;
|
||||||
|
import docking.DockingTool;
|
||||||
|
import docking.action.DockingActionIf;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides notification when the popup action menu is displayed. This interface allows
|
||||||
|
* temporary/transient actions (those not registered with the tool via
|
||||||
|
* {@link DockingTool#addAction(DockingActionIf)}) to be used in the popup context menu.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* Most clients will register actions directly with the tool. However, clients that have numerous
|
||||||
|
* actions that vary greatly with the context can use this method to only create those actions
|
||||||
|
* on demand as the popup is about to be shown, and only if their context is active. This
|
||||||
|
* mechanism can reduce the tool's action management overhead. Once you have created an
|
||||||
|
* implementation of this class, you must register it with
|
||||||
|
* {@link DockingTool#addPopupActionProvider(PopupActionProvider)}.
|
||||||
|
*/
|
||||||
|
public interface PopupActionProvider {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides notification that the popup menu is about to be displayed and allows a set of
|
||||||
|
* temporary actions to be included in the popup menu. Actions returned will be
|
||||||
|
* included in the menu if they have a valid popup menu path and respond true to the
|
||||||
|
* {@link DockingActionIf#isValidContext(ActionContext)} call.
|
||||||
|
*
|
||||||
|
* @param tool the tool requesting the actions
|
||||||
|
* @param context the ActionContext
|
||||||
|
* @return list of temporary popup actions; return null if there are no popup actions
|
||||||
|
*/
|
||||||
|
public List<DockingActionIf> getPopupActions(DockingTool tool, ActionContext context);
|
||||||
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
/* ###
|
/* ###
|
||||||
* IP: GHIDRA
|
* IP: GHIDRA
|
||||||
* REVIEWED: YES
|
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -25,19 +24,8 @@ import docking.action.MenuData;
|
|||||||
* Maps menuPaths to groups
|
* Maps menuPaths to groups
|
||||||
*/
|
*/
|
||||||
public class MenuGroupMap {
|
public class MenuGroupMap {
|
||||||
private Map<String, String> preferredMenuGroups = new HashMap<String, String>();
|
private Map<String, String> preferredMenuGroups = new HashMap<>();
|
||||||
private Map<String, String> preferredMenuSubGroups = new HashMap<String, String>();
|
private Map<String, String> preferredMenuSubGroups = new HashMap<>();
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the group for the given menuPath
|
|
||||||
* @param menuPath the menuPath for which to assign a group
|
|
||||||
* @param group the name of the group for the action with the given menu path
|
|
||||||
*
|
|
||||||
* @see #setMenuGroup(String[], String, String)
|
|
||||||
*/
|
|
||||||
public void setMenuGroup(String[] menuPath, String group) {
|
|
||||||
setMenuGroup(menuPath, group, MenuData.NO_SUBGROUP);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the group for the given menuPath
|
* Sets the group for the given menuPath
|
||||||
@@ -66,6 +54,7 @@ public class MenuGroupMap {
|
|||||||
/**
|
/**
|
||||||
* Returns the group for the given menu path
|
* Returns the group for the given menu path
|
||||||
* @param menuPath the menu path for which to find its group
|
* @param menuPath the menu path for which to find its group
|
||||||
|
* @return the menu group
|
||||||
*/
|
*/
|
||||||
public String getMenuGroup(String[] menuPath) {
|
public String getMenuGroup(String[] menuPath) {
|
||||||
return preferredMenuGroups.get(getMenuPathKey(menuPath));
|
return preferredMenuGroups.get(getMenuPathKey(menuPath));
|
||||||
@@ -76,6 +65,7 @@ public class MenuGroupMap {
|
|||||||
* sorting of menu items that exist in the same group.
|
* sorting of menu items that exist in the same group.
|
||||||
*
|
*
|
||||||
* @param menuPath the menu path for which to find its group
|
* @param menuPath the menu path for which to find its group
|
||||||
|
* @return the menu sub-group
|
||||||
*/
|
*/
|
||||||
public String getMenuSubGroup(String[] menuPath) {
|
public String getMenuSubGroup(String[] menuPath) {
|
||||||
return preferredMenuSubGroups.get(getMenuPathKey(menuPath));
|
return preferredMenuSubGroups.get(getMenuPathKey(menuPath));
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import javax.swing.table.*;
|
|||||||
import docking.*;
|
import docking.*;
|
||||||
import docking.action.*;
|
import docking.action.*;
|
||||||
import docking.actions.KeyBindingUtils;
|
import docking.actions.KeyBindingUtils;
|
||||||
|
import docking.actions.PopupActionProvider;
|
||||||
import docking.widgets.OptionDialog;
|
import docking.widgets.OptionDialog;
|
||||||
import docking.widgets.dialogs.SettingsDialog;
|
import docking.widgets.dialogs.SettingsDialog;
|
||||||
import docking.widgets.filechooser.GhidraFileChooser;
|
import docking.widgets.filechooser.GhidraFileChooser;
|
||||||
@@ -69,7 +70,7 @@ import resources.ResourceManager;
|
|||||||
*
|
*
|
||||||
* @see GTableFilterPanel
|
* @see GTableFilterPanel
|
||||||
*/
|
*/
|
||||||
public class GTable extends JTable implements KeyStrokeConsumer, DockingActionProviderIf {
|
public class GTable extends JTable implements KeyStrokeConsumer, PopupActionProvider {
|
||||||
|
|
||||||
private static final String LAST_EXPORT_FILE = "LAST_EXPORT_DIR";
|
private static final String LAST_EXPORT_FILE = "LAST_EXPORT_DIR";
|
||||||
|
|
||||||
@@ -510,25 +511,12 @@ public class GTable extends JTable implements KeyStrokeConsumer, DockingActionPr
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DockingActionIf> getDockingActions() {
|
public List<DockingActionIf> getPopupActions(DockingTool tool, ActionContext context) {
|
||||||
return getDefaultDockingActions();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the default actions of this table. Normally, the Docking Windows systems uses
|
|
||||||
* {@link #getDockingActions()} to get the correct actions to show. However,
|
|
||||||
* there are some cases where clients override what appears when you click on a table (such
|
|
||||||
* as in {@link DialogComponentProvider}s. For those clients that are creating their own
|
|
||||||
* action building, they need a way to get the default actions, hence this method.
|
|
||||||
*
|
|
||||||
* @return the default actions
|
|
||||||
*/
|
|
||||||
public List<DockingActionIf> getDefaultDockingActions() {
|
|
||||||
// we want these top-level groups to all appear together, with no separator
|
// we want these top-level groups to all appear together, with no separator
|
||||||
DockingWindowManager dwm = DockingWindowManager.getInstance(this);
|
tool.setMenuGroup(new String[] { "Copy" }, actionMenuGroup, "1");
|
||||||
dwm.setMenuGroup(new String[] { "Copy" }, actionMenuGroup, "1");
|
tool.setMenuGroup(new String[] { "Export" }, actionMenuGroup, "2");
|
||||||
dwm.setMenuGroup(new String[] { "Export" }, actionMenuGroup, "2");
|
tool.setMenuGroup(new String[] { "Select All" }, actionMenuGroup, "3");
|
||||||
dwm.setMenuGroup(new String[] { "Select All" }, actionMenuGroup, "3");
|
|
||||||
|
|
||||||
List<DockingActionIf> list = new ArrayList<>();
|
List<DockingActionIf> list = new ArrayList<>();
|
||||||
list.add(copyAction);
|
list.add(copyAction);
|
||||||
@@ -1490,5 +1478,4 @@ public class GTable extends JTable implements KeyStrokeConsumer, DockingActionPr
|
|||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
|
|
||||||
import docking.action.DockingActionIf;
|
|
||||||
import docking.actions.ToolActions;
|
import docking.actions.ToolActions;
|
||||||
import docking.framework.ApplicationInformationDisplayFactory;
|
import docking.framework.ApplicationInformationDisplayFactory;
|
||||||
import ghidra.framework.options.ToolOptions;
|
import ghidra.framework.options.ToolOptions;
|
||||||
@@ -33,10 +32,9 @@ public class FakeDockingTool extends AbstractDockingTool {
|
|||||||
|
|
||||||
public FakeDockingTool() {
|
public FakeDockingTool() {
|
||||||
|
|
||||||
DockWinListener listener = new DummyListener();
|
|
||||||
List<Image> windowIcons = ApplicationInformationDisplayFactory.getWindowIcons();
|
List<Image> windowIcons = ApplicationInformationDisplayFactory.getWindowIcons();
|
||||||
winMgr = new DockingWindowManager(this, windowIcons, listener, false /*isModal*/,
|
winMgr = new DockingWindowManager(this, windowIcons, false /*isModal*/, true /*isDockable*/,
|
||||||
true /*isDockable*/, true /*hasStatus*/, null /*DropTargetFactory*/);
|
true /*hasStatus*/, null /*DropTargetFactory*/);
|
||||||
toolActions = new ToolActions(this, new ActionToGuiHelper(winMgr));
|
toolActions = new ToolActions(this, new ActionToGuiHelper(winMgr));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,16 +58,8 @@ public class FakeDockingTool extends AbstractDockingTool {
|
|||||||
return opt;
|
return opt;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DummyListener implements DockWinListener {
|
@Override
|
||||||
|
public void close() {
|
||||||
@Override
|
// stub
|
||||||
public void close() {
|
|
||||||
// stub
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DockingActionIf> getPopupActions(ActionContext context) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.framework.options;
|
package ghidra.framework.options;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.swing.KeyStroke;
|
import javax.swing.KeyStroke;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,4 +86,9 @@ class WrappedKeyStroke implements WrappedOption {
|
|||||||
public OptionType getOptionType() {
|
public OptionType getOptionType() {
|
||||||
return OptionType.KEYSTROKE_TYPE;
|
return OptionType.KEYSTROKE_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return Objects.toString(keyStroke);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ public class GenericHelpTopics {
|
|||||||
*/
|
*/
|
||||||
public final static String REPOSITORY = "Repository";
|
public final static String REPOSITORY = "Repository";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Help Topic for the version control.
|
||||||
|
*/
|
||||||
|
public final static String VERSION_CONTROL = "VersionControl";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Help Topic for tools.
|
* Help Topic for tools.
|
||||||
*/
|
*/
|
||||||
|
|||||||
+2
-3
@@ -25,8 +25,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
import docking.ActionContext;
|
import docking.*;
|
||||||
import docking.ComponentProvider;
|
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.help.Help;
|
import docking.help.Help;
|
||||||
import docking.help.HelpService;
|
import docking.help.HelpService;
|
||||||
@@ -490,7 +489,7 @@ public class ProjectDataTablePanel extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DockingActionIf> getDockingActions() {
|
public List<DockingActionIf> getPopupActions(DockingTool tool, ActionContext context) {
|
||||||
|
|
||||||
// TODO we should at least add the 'copy' action
|
// TODO we should at least add the 'copy' action
|
||||||
|
|
||||||
|
|||||||
+24
-21
@@ -16,6 +16,7 @@
|
|||||||
package ghidra.framework.main.datatree;
|
package ghidra.framework.main.datatree;
|
||||||
|
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
@@ -23,7 +24,6 @@ import javax.swing.SwingUtilities;
|
|||||||
import docking.ActionContext;
|
import docking.ActionContext;
|
||||||
import docking.DialogComponentProvider;
|
import docking.DialogComponentProvider;
|
||||||
import docking.action.DockingActionIf;
|
import docking.action.DockingActionIf;
|
||||||
import docking.action.DockingActionProviderIf;
|
|
||||||
import ghidra.app.util.GenericHelpTopics;
|
import ghidra.app.util.GenericHelpTopics;
|
||||||
import ghidra.framework.main.AppInfo;
|
import ghidra.framework.main.AppInfo;
|
||||||
import ghidra.framework.main.FrontEndTool;
|
import ghidra.framework.main.FrontEndTool;
|
||||||
@@ -31,24 +31,26 @@ import ghidra.framework.model.*;
|
|||||||
import ghidra.framework.store.FileSystem;
|
import ghidra.framework.store.FileSystem;
|
||||||
import ghidra.util.HelpLocation;
|
import ghidra.util.HelpLocation;
|
||||||
|
|
||||||
public class VersionHistoryDialog extends DialogComponentProvider
|
public class VersionHistoryDialog extends DialogComponentProvider implements ProjectListener {
|
||||||
implements ProjectListener, DockingActionProviderIf {
|
|
||||||
|
|
||||||
private VersionHistoryPanel versionPanel;
|
private VersionHistoryPanel versionPanel;
|
||||||
private MyFolderListener listener = new MyFolderListener();
|
private MyFolderListener listener = new MyFolderListener();
|
||||||
|
private List<DockingActionIf> popupActions = Collections.emptyList();
|
||||||
|
|
||||||
public VersionHistoryDialog() {
|
public VersionHistoryDialog(DomainFile domainFile) {
|
||||||
|
|
||||||
super("Version History", false);
|
super("Version History", false);
|
||||||
FrontEndTool frontEndTool = AppInfo.getFrontEndTool();
|
FrontEndTool frontEndTool = AppInfo.getFrontEndTool();
|
||||||
setHelpLocation(new HelpLocation(GenericHelpTopics.REPOSITORY, "Show_History"));
|
setHelpLocation(new HelpLocation(GenericHelpTopics.VERSION_CONTROL, "Show_History"));
|
||||||
versionPanel = new VersionHistoryPanel(frontEndTool, null, true);
|
versionPanel = new VersionHistoryPanel(frontEndTool, domainFile, true);
|
||||||
addWorkPanel(versionPanel);
|
addWorkPanel(versionPanel);
|
||||||
addDismissButton();
|
addDismissButton();
|
||||||
versionPanel.addPopupActions(this);
|
|
||||||
|
setDomainFile(domainFile);
|
||||||
|
popupActions = versionPanel.createPopupActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDomainFile(DomainFile df) {
|
private void setDomainFile(DomainFile df) {
|
||||||
|
|
||||||
versionPanel.setDomainFile(df);
|
versionPanel.setDomainFile(df);
|
||||||
|
|
||||||
@@ -59,18 +61,24 @@ public class VersionHistoryDialog extends DialogComponentProvider
|
|||||||
setTitle("Version History for " + df.getName());
|
setTitle("Version History for " + df.getName());
|
||||||
project.getProjectData().addDomainFolderChangeListener(listener);
|
project.getProjectData().addDomainFolderChangeListener(listener);
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
setTitle("Version History");
|
|
||||||
project.getProjectData().removeDomainFolderChangeListener(listener);
|
@Override
|
||||||
|
protected void dialogShown() {
|
||||||
|
super.dialogShown();
|
||||||
|
|
||||||
|
for (DockingActionIf action : popupActions) {
|
||||||
|
addAction(action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void dismissCallback() {
|
protected void dialogClosed() {
|
||||||
|
super.dialogClosed();
|
||||||
|
|
||||||
close();
|
for (DockingActionIf action : popupActions) {
|
||||||
|
removeAction(action);
|
||||||
setDomainFile(null);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -127,13 +135,8 @@ public class VersionHistoryDialog extends DialogComponentProvider
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionContext getActionContext(MouseEvent event) {
|
public ActionContext getActionContext(MouseEvent event) {
|
||||||
ActionContext actionContext = new ActionContext(null, this, this);
|
ActionContext actionContext = new ActionContext(null, versionPanel.getTable(), this);
|
||||||
actionContext.setMouseEvent(event);
|
actionContext.setMouseEvent(event);
|
||||||
return actionContext;
|
return actionContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DockingActionIf> getDockingActions() {
|
|
||||||
return versionPanel.getDockingActions();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+61
-70
@@ -31,26 +31,29 @@ import javax.swing.event.ListSelectionListener;
|
|||||||
import javax.swing.table.TableColumn;
|
import javax.swing.table.TableColumn;
|
||||||
import javax.swing.table.TableColumnModel;
|
import javax.swing.table.TableColumnModel;
|
||||||
|
|
||||||
import docking.*;
|
import docking.ActionContext;
|
||||||
import docking.action.*;
|
import docking.action.*;
|
||||||
import docking.dnd.*;
|
import docking.dnd.*;
|
||||||
import docking.widgets.OptionDialog;
|
import docking.widgets.OptionDialog;
|
||||||
import docking.widgets.table.*;
|
import docking.widgets.table.*;
|
||||||
|
import ghidra.app.util.GenericHelpTopics;
|
||||||
import ghidra.framework.client.ClientUtil;
|
import ghidra.framework.client.ClientUtil;
|
||||||
import ghidra.framework.main.GetVersionedObjectTask;
|
import ghidra.framework.main.GetVersionedObjectTask;
|
||||||
import ghidra.framework.model.*;
|
import ghidra.framework.model.*;
|
||||||
import ghidra.framework.plugintool.PluginTool;
|
import ghidra.framework.plugintool.PluginTool;
|
||||||
import ghidra.framework.store.ItemCheckoutStatus;
|
import ghidra.framework.store.ItemCheckoutStatus;
|
||||||
import ghidra.framework.store.Version;
|
import ghidra.framework.store.Version;
|
||||||
import ghidra.util.HTMLUtilities;
|
import ghidra.util.*;
|
||||||
import ghidra.util.Msg;
|
|
||||||
import ghidra.util.task.*;
|
import ghidra.util.task.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Panel that shows version history in a JTable.
|
* Panel that shows version history in a JTable
|
||||||
*/
|
*/
|
||||||
public class VersionHistoryPanel extends JPanel implements Draggable {
|
public class VersionHistoryPanel extends JPanel implements Draggable {
|
||||||
|
|
||||||
|
private static final HelpLocation HELP =
|
||||||
|
new HelpLocation(GenericHelpTopics.VERSION_CONTROL, "Show History");
|
||||||
|
|
||||||
private PluginTool tool;
|
private PluginTool tool;
|
||||||
private DomainFile domainFile;
|
private DomainFile domainFile;
|
||||||
private String domainFilePath;
|
private String domainFilePath;
|
||||||
@@ -79,7 +82,6 @@ public class VersionHistoryPanel extends JPanel implements Draggable {
|
|||||||
* @param tool tool
|
* @param tool tool
|
||||||
* @param domainFile domain file
|
* @param domainFile domain file
|
||||||
* @param enableUserInteraction if true Draggable support will be enabled
|
* @param enableUserInteraction if true Draggable support will be enabled
|
||||||
* @throws IOException
|
|
||||||
*/
|
*/
|
||||||
VersionHistoryPanel(PluginTool tool, DomainFile domainFile, boolean enableUserInteraction) {
|
VersionHistoryPanel(PluginTool tool, DomainFile domainFile, boolean enableUserInteraction) {
|
||||||
super(new BorderLayout());
|
super(new BorderLayout());
|
||||||
@@ -94,11 +96,11 @@ public class VersionHistoryPanel extends JPanel implements Draggable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the domain file to show its history.
|
* Set the domain file to show its history
|
||||||
|
* @param domainFile the file
|
||||||
*/
|
*/
|
||||||
public void setDomainFile(DomainFile domainFile) {
|
public void setDomainFile(DomainFile domainFile) {
|
||||||
this.domainFile = domainFile;
|
this.domainFile = domainFile;
|
||||||
domainFilePath = null;
|
|
||||||
if (domainFile != null) {
|
if (domainFile != null) {
|
||||||
this.domainFilePath = domainFile.getPathname();
|
this.domainFilePath = domainFile.getPathname();
|
||||||
}
|
}
|
||||||
@@ -122,21 +124,25 @@ public class VersionHistoryPanel extends JPanel implements Draggable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the list selection listener to the history table.
|
* Add the list selection listener to the history table
|
||||||
|
* @param selectionListener the listener
|
||||||
*/
|
*/
|
||||||
public void addListSelectionListener(ListSelectionListener listener1) {
|
public void addListSelectionListener(ListSelectionListener selectionListener) {
|
||||||
table.getSelectionModel().addListSelectionListener(listener1);
|
table.getSelectionModel().addListSelectionListener(selectionListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the list selection listener from history table.
|
* Remove the list selection listener from history table.
|
||||||
|
* @param selectionListener the listener
|
||||||
*/
|
*/
|
||||||
public void removeListSelectionListener(ListSelectionListener listener1) {
|
public void removeListSelectionListener(ListSelectionListener selectionListener) {
|
||||||
table.getSelectionModel().removeListSelectionListener(listener1);
|
table.getSelectionModel().removeListSelectionListener(selectionListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the domain object for the selected version.
|
* Get the domain object for the selected version.
|
||||||
|
* @param consumer the consumer
|
||||||
|
* @param readOnly true if read only
|
||||||
* @return null if there is no selection
|
* @return null if there is no selection
|
||||||
*/
|
*/
|
||||||
public DomainObject getSelectedVersion(Object consumer, boolean readOnly) {
|
public DomainObject getSelectedVersion(Object consumer, boolean readOnly) {
|
||||||
@@ -148,16 +154,10 @@ public class VersionHistoryPanel extends JPanel implements Draggable {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return whether a version is selected.
|
|
||||||
*/
|
|
||||||
public boolean isVersionSelected() {
|
public boolean isVersionSelected() {
|
||||||
return !table.getSelectionModel().isSelectionEmpty();
|
return !table.getSelectionModel().isSelectionEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the version number that was selected.
|
|
||||||
*/
|
|
||||||
public int getSelectedVersionNumber() {
|
public int getSelectedVersionNumber() {
|
||||||
int row = table.getSelectedRow();
|
int row = table.getSelectedRow();
|
||||||
if (row >= 0) {
|
if (row >= 0) {
|
||||||
@@ -167,33 +167,21 @@ public class VersionHistoryPanel extends JPanel implements Draggable {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see ghidra.util.bean.dnd.Draggable#dragCanceled()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void dragCanceled(DragSourceDropEvent event) {
|
public void dragCanceled(DragSourceDropEvent event) {
|
||||||
// no-op
|
// no-op
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see ghidra.util.bean.dnd.Draggable#getDragAction()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int getDragAction() {
|
public int getDragAction() {
|
||||||
return dragAction;
|
return dragAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see ghidra.util.bean.dnd.Draggable#getDragSourceListener()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public DragSourceListener getDragSourceListener() {
|
public DragSourceListener getDragSourceListener() {
|
||||||
return dragSourceAdapter;
|
return dragSourceAdapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see ghidra.util.bean.dnd.Draggable#getTransferable(java.awt.Point)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Transferable getTransferable(Point p) {
|
public Transferable getTransferable(Point p) {
|
||||||
int row = table.rowAtPoint(p);
|
int row = table.rowAtPoint(p);
|
||||||
@@ -204,9 +192,6 @@ public class VersionHistoryPanel extends JPanel implements Draggable {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see ghidra.util.bean.dnd.Draggable#isStartDragOk(java.awt.dnd.DragGestureEvent)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isStartDragOk(DragGestureEvent e) {
|
public boolean isStartDragOk(DragGestureEvent e) {
|
||||||
int row = table.rowAtPoint(e.getDragOrigin());
|
int row = table.rowAtPoint(e.getDragOrigin());
|
||||||
@@ -216,9 +201,6 @@ public class VersionHistoryPanel extends JPanel implements Draggable {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see ghidra.util.bean.dnd.Draggable#move()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void move() {
|
public void move() {
|
||||||
// no-op
|
// no-op
|
||||||
@@ -363,6 +345,38 @@ public class VersionHistoryPanel extends JPanel implements Draggable {
|
|||||||
openWith(null);
|
openWith(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DockingActionIf> createPopupActions() {
|
||||||
|
|
||||||
|
List<DockingActionIf> list = new ArrayList<>();
|
||||||
|
list.add(new DeleteAction());
|
||||||
|
|
||||||
|
Project project = tool.getProject();
|
||||||
|
ToolChest toolChest = project.getLocalToolChest();
|
||||||
|
if (toolChest == null) {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolTemplate[] templates = toolChest.getToolTemplates();
|
||||||
|
if (templates.length == 0) {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
list.add(new OpenDefaultAction());
|
||||||
|
for (ToolTemplate toolTemplate : templates) {
|
||||||
|
list.add(new OpenWithAction(toolTemplate.getName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
GTable getTable() {
|
||||||
|
return table;
|
||||||
|
}
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
// Inner Classes
|
||||||
|
//==================================================================================================
|
||||||
|
|
||||||
private class MyCellRenderer extends GTableCellRenderer {
|
private class MyCellRenderer extends GTableCellRenderer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -398,36 +412,11 @@ public class VersionHistoryPanel extends JPanel implements Draggable {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPopupActions(DialogComponentProvider provider) {
|
|
||||||
provider.addAction(new DeleteAction());
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<DockingActionIf> getDockingActions() {
|
|
||||||
List<DockingActionIf> list = new ArrayList<>(table.getDefaultDockingActions());
|
|
||||||
Project project = tool.getProject();
|
|
||||||
ToolChest toolChest = project.getLocalToolChest();
|
|
||||||
if (toolChest == null) {
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
ToolTemplate[] templates = toolChest.getToolTemplates();
|
|
||||||
if (templates.length == 0) {
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
ToolTemplate defaultConfig = tool.getToolServices().getDefaultToolTemplate(domainFile);
|
|
||||||
if (defaultConfig != null) {
|
|
||||||
list.add(new OpenDefaultAction());
|
|
||||||
}
|
|
||||||
for (final ToolTemplate toolTemplate : templates) {
|
|
||||||
list.add(new OpenWithAction(toolTemplate.getName()));
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
private abstract class HistoryTableAction extends DockingAction {
|
private abstract class HistoryTableAction extends DockingAction {
|
||||||
|
|
||||||
HistoryTableAction(String name) {
|
HistoryTableAction(String name) {
|
||||||
super(name, "Version History Panel", false);
|
super(name, "Version History Panel", false);
|
||||||
|
setHelpLocation(HELP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -436,6 +425,15 @@ public class VersionHistoryPanel extends JPanel implements Draggable {
|
|||||||
if (mouseEvent == null) {
|
if (mouseEvent == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (context.getContextObject() != table) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (domainFile == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int rowAtPoint = table.rowAtPoint(mouseEvent.getPoint());
|
int rowAtPoint = table.rowAtPoint(mouseEvent.getPoint());
|
||||||
return rowAtPoint >= 0;
|
return rowAtPoint >= 0;
|
||||||
}
|
}
|
||||||
@@ -479,8 +477,6 @@ public class VersionHistoryPanel extends JPanel implements Draggable {
|
|||||||
setDescription("Opens the version using the " + toolName + " tool.");
|
setDescription("Opens the version using the " + toolName + " tool.");
|
||||||
MenuData data = new MenuData(new String[] { "Open With", toolName }, "AAB");
|
MenuData data = new MenuData(new String[] { "Open With", toolName }, "AAB");
|
||||||
setPopupMenuData(data);
|
setPopupMenuData(data);
|
||||||
DockingWindowManager dwm = DockingWindowManager.getInstance(table);
|
|
||||||
dwm.setMenuGroup(new String[] { "Open With" }, "AAB", "2");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -526,9 +522,4 @@ public class VersionHistoryPanel extends JPanel implements Draggable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GTable getTable() {
|
|
||||||
return table;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-6
@@ -28,8 +28,6 @@ import ghidra.framework.plugintool.Plugin;
|
|||||||
*/
|
*/
|
||||||
public class VersionControlShowHistoryAction extends VersionControlAction {
|
public class VersionControlShowHistoryAction extends VersionControlAction {
|
||||||
|
|
||||||
private VersionHistoryDialog dialog;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an action to show the version history for a single version controlled
|
* Creates an action to show the version history for a single version controlled
|
||||||
* domain file in the repository.
|
* domain file in the repository.
|
||||||
@@ -71,13 +69,12 @@ public class VersionControlShowHistoryAction extends VersionControlAction {
|
|||||||
if (!checkRepositoryConnected()) {
|
if (!checkRepositoryConnected()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (domainFiles.size() != 1) {
|
if (domainFiles.size() != 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (dialog == null) {
|
|
||||||
dialog = new VersionHistoryDialog();
|
VersionHistoryDialog dialog = new VersionHistoryDialog(domainFiles.get(0));
|
||||||
}
|
|
||||||
dialog.setDomainFile(domainFiles.get(0));
|
|
||||||
tool.showDialog(dialog, tool.getToolFrame());
|
tool.showDialog(dialog, tool.getToolFrame());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,13 +56,6 @@ public interface Tool extends DockingTool, ToolListener {
|
|||||||
*/
|
*/
|
||||||
public void exit();
|
public void exit();
|
||||||
|
|
||||||
/**
|
|
||||||
* Suggests the tool to attempt to close(). This will be as though the user
|
|
||||||
* selected the close menu option on the tool or hit the closeWindow x button in
|
|
||||||
* the upper corner (Windows systems).
|
|
||||||
*/
|
|
||||||
public void close();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can this tool be closed?
|
* Can this tool be closed?
|
||||||
* @param isExiting true if all of Ghidra is closing, false if just this tool is closing.
|
* @param isExiting true if all of Ghidra is closing, false if just this tool is closing.
|
||||||
|
|||||||
+25
-90
@@ -22,7 +22,6 @@ import java.awt.*;
|
|||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
import java.beans.PropertyChangeSupport;
|
import java.beans.PropertyChangeSupport;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
@@ -34,6 +33,7 @@ import org.jdom.Element;
|
|||||||
|
|
||||||
import docking.*;
|
import docking.*;
|
||||||
import docking.action.*;
|
import docking.action.*;
|
||||||
|
import docking.actions.PopupActionProvider;
|
||||||
import docking.actions.ToolActions;
|
import docking.actions.ToolActions;
|
||||||
import docking.framework.AboutDialog;
|
import docking.framework.AboutDialog;
|
||||||
import docking.framework.ApplicationInformationDisplayFactory;
|
import docking.framework.ApplicationInformationDisplayFactory;
|
||||||
@@ -58,24 +58,24 @@ import ghidra.framework.plugintool.util.*;
|
|||||||
import ghidra.framework.project.ProjectDataService;
|
import ghidra.framework.project.ProjectDataService;
|
||||||
import ghidra.framework.project.tool.ToolIconURL;
|
import ghidra.framework.project.tool.ToolIconURL;
|
||||||
import ghidra.util.*;
|
import ghidra.util.*;
|
||||||
import ghidra.util.datastruct.WeakDataStructureFactory;
|
|
||||||
import ghidra.util.datastruct.WeakSet;
|
|
||||||
import ghidra.util.task.Task;
|
import ghidra.util.task.Task;
|
||||||
import ghidra.util.task.TaskLauncher;
|
import ghidra.util.task.TaskLauncher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class that is a container to manage plugins and their actions, and
|
* Base class that is a container to manage plugins and their actions, and to coordinate the
|
||||||
* to coordinate the firing of plugin events and tool events. A
|
* firing of plugin events and tool events. A PluginTool may have visible components supplied by
|
||||||
* PluginTool may have visible components supplied by
|
* <pre>ComponentProviders </pre>. These components may be docked within the tool, or moved
|
||||||
* <pre>ComponentProviders </pre>. These components may be docked within the
|
* out into their own windows.
|
||||||
* tool, or moved out into their own windows.
|
*
|
||||||
* <p>The PluginTool also manages tasks that run in the background, and
|
* <p>Plugins normally add actions via {@link #addAction(DockingActionIf)}. There is also
|
||||||
* options used by the plugins.
|
* an alternate method for getting actions to appear in the popup context menu (see
|
||||||
* </p>
|
* {@link #addPopupActionProvider(PopupActionProvider)}). The popup listener mechanism is generally not
|
||||||
|
* needed and should only be used in special circumstances (see {@link PopupActionProvider}).
|
||||||
|
*
|
||||||
|
* <p>The PluginTool also manages tasks that run in the background, and options used by the plugins.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class PluginTool extends AbstractDockingTool
|
public abstract class PluginTool extends AbstractDockingTool implements Tool, ServiceProvider {
|
||||||
implements Tool, DockWinListener, ServiceProvider {
|
|
||||||
|
|
||||||
private static final String DOCKING_WINDOWS_ON_TOP = "Docking Windows On Top";
|
private static final String DOCKING_WINDOWS_ON_TOP = "Docking Windows On Top";
|
||||||
|
|
||||||
@@ -96,8 +96,6 @@ public abstract class PluginTool extends AbstractDockingTool
|
|||||||
private DialogManager dialogMgr;
|
private DialogManager dialogMgr;
|
||||||
private PropertyChangeSupport propertyChangeMgr;
|
private PropertyChangeSupport propertyChangeMgr;
|
||||||
|
|
||||||
private WeakSet<PopupListener> popupListeners =
|
|
||||||
WeakDataStructureFactory.createSingleThreadAccessWeakSet();
|
|
||||||
private OptionsChangeListener optionsListener = new ToolOptionsListener();
|
private OptionsChangeListener optionsListener = new ToolOptionsListener();
|
||||||
protected ManagePluginsDialog manageDialog;
|
protected ManagePluginsDialog manageDialog;
|
||||||
protected ExtensionTableProvider extensionTableProvider;
|
protected ExtensionTableProvider extensionTableProvider;
|
||||||
@@ -192,7 +190,7 @@ public abstract class PluginTool extends AbstractDockingTool
|
|||||||
|
|
||||||
List<Image> windowIcons = ApplicationInformationDisplayFactory.getWindowIcons();
|
List<Image> windowIcons = ApplicationInformationDisplayFactory.getWindowIcons();
|
||||||
DockingWindowManager newManager =
|
DockingWindowManager newManager =
|
||||||
new DockingWindowManager(this, windowIcons, this, isModal, isDockable, hasStatus, null);
|
new DockingWindowManager(this, windowIcons, isModal, isDockable, hasStatus, null);
|
||||||
return newManager;
|
return newManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,17 +262,6 @@ public abstract class PluginTool extends AbstractDockingTool
|
|||||||
return winMgr.isWindowsOnTop();
|
return winMgr.isWindowsOnTop();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Add popup listener that is notified when the popup menu is about to be
|
|
||||||
* displayed.
|
|
||||||
*
|
|
||||||
* @param listener listener that is notified when the popup menu is to
|
|
||||||
* be displayed
|
|
||||||
*/
|
|
||||||
public void addPopupListener(PopupListener listener) {
|
|
||||||
popupListeners.add(listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the manage plugins dialog that is currently
|
* Returns the manage plugins dialog that is currently
|
||||||
* being used.
|
* being used.
|
||||||
@@ -308,15 +295,6 @@ public abstract class PluginTool extends AbstractDockingTool
|
|||||||
showDialog(extensionTableProvider);
|
showDialog(extensionTableProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove popup listener
|
|
||||||
* @param listener listener that is notified when the popup menu is to
|
|
||||||
* be displayed
|
|
||||||
*/
|
|
||||||
public void removePopupListener(PopupListener listener) {
|
|
||||||
popupListeners.remove(listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set whether a component's header should be shown; the header is the component that
|
* Set whether a component's header should be shown; the header is the component that
|
||||||
* is dragged in order to move the component within the tool, or out of the tool
|
* is dragged in order to move the component within the tool, or out of the tool
|
||||||
@@ -1031,18 +1009,18 @@ public abstract class PluginTool extends AbstractDockingTool
|
|||||||
action.setEnabled(true);
|
action.setEnabled(true);
|
||||||
addAction(action);
|
addAction(action);
|
||||||
|
|
||||||
DockingAction userAgreementAction =
|
DockingAction userAgreementAction = new DockingAction("User Agreement",
|
||||||
new DockingAction("User Agreement", ToolConstants.TOOL_OWNER) {
|
ToolConstants.TOOL_OWNER, KeyBindingType.UNSUPPORTED) {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionContext context) {
|
public void actionPerformed(ActionContext context) {
|
||||||
DockingWindowManager.showDialog(new UserAgreementDialog(false, false));
|
DockingWindowManager.showDialog(new UserAgreementDialog(false, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldAddToWindow(boolean isMainWindow, Set<Class<?>> contextTypes) {
|
public boolean shouldAddToWindow(boolean isMainWindow, Set<Class<?>> contextTypes) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
userAgreementAction.setMenuBarData(
|
userAgreementAction.setMenuBarData(
|
||||||
new MenuData(new String[] { ToolConstants.MENU_HELP, "&User Agreement" }, null,
|
new MenuData(new String[] { ToolConstants.MENU_HELP, "&User Agreement" }, null,
|
||||||
ToolConstants.HELP_CONTENTS_MENU_GROUP));
|
ToolConstants.HELP_CONTENTS_MENU_GROUP));
|
||||||
@@ -1102,19 +1080,6 @@ public abstract class PluginTool extends AbstractDockingTool
|
|||||||
eventMgr.clearLastEvents();
|
eventMgr.clearLastEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DockingActionIf> getPopupActions(ActionContext context) {
|
|
||||||
|
|
||||||
List<DockingActionIf> actionList = new ArrayList<>();
|
|
||||||
for (PopupListener pl : popupListeners) {
|
|
||||||
List<DockingActionIf> actions = pl.getPopupActions(context);
|
|
||||||
if (actions != null) {
|
|
||||||
actionList.addAll(actions);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return actionList;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close this tool:
|
* Close this tool:
|
||||||
* <OL>
|
* <OL>
|
||||||
@@ -1390,36 +1355,6 @@ public abstract class PluginTool extends AbstractDockingTool
|
|||||||
winMgr.showEditWindow(defaultText, comp, rect, listener);
|
winMgr.showEditWindow(defaultText, comp, rect, listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the menu group associated with a cascaded submenu. This allows
|
|
||||||
* a cascading menu item to be grouped with a specific set of actions.
|
|
||||||
* The default group for a cascaded submenu is the name of the submenu.
|
|
||||||
*
|
|
||||||
* @param menuPath menu name path where the last element corresponds
|
|
||||||
* to the specified group name.
|
|
||||||
* @param group group name
|
|
||||||
* @see #setMenuGroup(String[], String, String)
|
|
||||||
*/
|
|
||||||
public void setMenuGroup(String[] menuPath, String group) {
|
|
||||||
winMgr.setMenuGroup(menuPath, group);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the menu group associated with a cascaded submenu. This allows
|
|
||||||
* a cascading menu item to be grouped with a specific set of actions.
|
|
||||||
* <p>
|
|
||||||
* The default group for a cascaded submenu is the name of the submenu.
|
|
||||||
* <p>
|
|
||||||
*
|
|
||||||
* @param menuPath menu name path where the last element corresponds to the specified group name.
|
|
||||||
* @param group group name
|
|
||||||
* @param menuSubGroup the name used to sort the cascaded menu within other menu items at
|
|
||||||
* its level
|
|
||||||
*/
|
|
||||||
public void setMenuGroup(String[] menuPath, String group, String menuSubGroup) {
|
|
||||||
winMgr.setMenuGroup(menuPath, group, menuSubGroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel the current task in the tool.
|
* Cancel the current task in the tool.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
/* ###
|
|
||||||
* IP: GHIDRA
|
|
||||||
* REVIEWED: YES
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package ghidra.framework.plugintool;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import docking.ActionContext;
|
|
||||||
import docking.action.DockingActionIf;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <code>PopupListener</code> provides notification when the popup action
|
|
||||||
* menu is displayed.
|
|
||||||
*/
|
|
||||||
public interface PopupListener {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides notification that the popup menu is about to be displayed
|
|
||||||
* and allows a set of temporary actions to be included in the popup menu.
|
|
||||||
* Actions returned will be included in the menu if they have a valid popup
|
|
||||||
* menu path and respond true to the isValidContext method.
|
|
||||||
* @param context the ActionContext
|
|
||||||
* @return list of temporary popup actions (null may be returned)
|
|
||||||
*/
|
|
||||||
List<DockingActionIf> getPopupActions(ActionContext context);
|
|
||||||
|
|
||||||
}
|
|
||||||
+2
-1
@@ -59,7 +59,7 @@ public class KeyBindingsPanel extends JPanel {
|
|||||||
private static final int FONT_SIZE = 11;
|
private static final int FONT_SIZE = 11;
|
||||||
|
|
||||||
private JTextPane statusLabel;
|
private JTextPane statusLabel;
|
||||||
private JTable actionTable;
|
private GTable actionTable;
|
||||||
private JPanel infoPanel;
|
private JPanel infoPanel;
|
||||||
private MultiLineLabel collisionLabel;
|
private MultiLineLabel collisionLabel;
|
||||||
private KeyBindingsTableModel tableModel;
|
private KeyBindingsTableModel tableModel;
|
||||||
@@ -96,6 +96,7 @@ public class KeyBindingsPanel extends JPanel {
|
|||||||
public void dispose() {
|
public void dispose() {
|
||||||
tableFilterPanel.dispose();
|
tableFilterPanel.dispose();
|
||||||
tableModel.dispose();
|
tableModel.dispose();
|
||||||
|
actionTable.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+6
-1
@@ -25,6 +25,7 @@ import org.jdom.Element;
|
|||||||
|
|
||||||
import docking.options.editor.OptionsDialog;
|
import docking.options.editor.OptionsDialog;
|
||||||
import docking.tool.ToolConstants;
|
import docking.tool.ToolConstants;
|
||||||
|
import docking.tool.util.DockingToolConstants;
|
||||||
import ghidra.framework.options.*;
|
import ghidra.framework.options.*;
|
||||||
import ghidra.framework.plugintool.Plugin;
|
import ghidra.framework.plugintool.Plugin;
|
||||||
import ghidra.framework.plugintool.PluginTool;
|
import ghidra.framework.plugintool.PluginTool;
|
||||||
@@ -242,12 +243,16 @@ public class OptionsManager implements OptionsService, OptionsChangeListener {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Options keyBindingOptions = getOptions(DockingToolConstants.KEY_BINDINGS);
|
||||||
TreePath path = null;
|
TreePath path = null;
|
||||||
if (optionsDialog != null) {
|
if (optionsDialog != null) {
|
||||||
path = optionsDialog.getSelectedPath();
|
path = optionsDialog.getSelectedPath();
|
||||||
|
optionsDialog.dispose();
|
||||||
|
|
||||||
|
OptionsEditor oldEditor = keyBindingOptions.getOptionsEditor();
|
||||||
|
oldEditor.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
Options keyBindingOptions = getOptions(ToolConstants.KEY_BINDINGS);
|
|
||||||
keyBindingOptions.registerOptionsEditor(new KeyBindingOptionsEditor());
|
keyBindingOptions.registerOptionsEditor(new KeyBindingOptionsEditor());
|
||||||
dialog = new OptionsDialog("Options for " + tool.getName(), "Options", getEditableOptions(),
|
dialog = new OptionsDialog("Options for " + tool.getName(), "Options", getEditableOptions(),
|
||||||
null, true);
|
null, true);
|
||||||
|
|||||||
+1
-1
@@ -84,7 +84,7 @@ public class GhidraTool extends PluginTool {
|
|||||||
@Override
|
@Override
|
||||||
protected DockingWindowManager createDockingWindowManager(boolean isDockable, boolean hasStatus,
|
protected DockingWindowManager createDockingWindowManager(boolean isDockable, boolean hasStatus,
|
||||||
boolean isModal) {
|
boolean isModal) {
|
||||||
return new DockingWindowManager(this, null, this, isModal, isDockable, hasStatus,
|
return new DockingWindowManager(this, null, isModal, isDockable, hasStatus,
|
||||||
new OpenFileDropHandlerFactory(this));
|
new OpenFileDropHandlerFactory(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user