GP-1014 - Function Call Graph - add option to change background color;

consolidated graph options.
This commit is contained in:
dragonmacher
2021-06-30 16:48:51 -04:00
parent 6962885c3e
commit 9112a84f63
22 changed files with 301 additions and 247 deletions

View File

@@ -60,12 +60,12 @@ import ghidra.util.*;
import ghidra.util.task.*;
/**
* Base class that is a container to manage plugins and their actions, and to coordinate the
* Base class that is a container to manage plugins and their actions, and to coordinate the
* firing of plugin events and tool events. A 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 tool, or moved
* out into their own windows.
*
* <p>Plugins normally add actions via {@link #addAction(DockingActionIf)}. There is also
* <p>Plugins normally add actions via {@link #addAction(DockingActionIf)}. There is also
* an alternate method for getting actions to appear in the popup context menu (see
* {@link #addPopupActionProvider(PopupActionProvider)}). The popup listener mechanism is generally not
* needed and should only be used in special circumstances (see {@link PopupActionProvider}).
@@ -710,11 +710,6 @@ public abstract class PluginTool extends AbstractDockingTool {
new TaskLauncher(task, winMgr.getActiveWindow());
}
/**
* Get the options for the given category name; if no options exist with
* the given name, then one is created.
*/
@Override
public ToolOptions getOptions(String categoryName) {
return optionsMgr.getOptions(categoryName);
@@ -1103,7 +1098,7 @@ public abstract class PluginTool extends AbstractDockingTool {
return configChangedFlag; // ignore the window layout changes
}
/**
/**
* Called when it is time to save the tool. Handles auto-saving logic.
* @return true if a save happened
*/

View File

@@ -58,12 +58,9 @@ public class OptionsManager implements OptionsService, OptionsChangeListener {
optionsMap.values().forEach(options -> options.dispose());
}
/**
* Get the options for the given category name.
* @param category name of category
*/
@Override
public ToolOptions getOptions(String category) {
ToolOptions opt = optionsMap.get(category);
if (opt == null) {
opt = new ToolOptions(category);
@@ -87,20 +84,11 @@ public class OptionsManager implements OptionsService, OptionsChangeListener {
}
}
/**
* Return whether an Options object exists for the given category.
* @param category name of the category
* @return true if an Options object exists
*/
@Override
public boolean hasOptions(String category) {
return optionsMap.containsKey(category);
}
/**
* Shows Options Dialog with the section called 'category' being displayed
* @param category The category of options to have displayed
*/
@Override
public void showOptionsDialog(String category, String filterText) {
if (optionsDialog != null && optionsDialog.isVisible()) {
@@ -112,9 +100,6 @@ public class OptionsManager implements OptionsService, OptionsChangeListener {
tool.showDialog(optionsDialog);
}
/**
* Get the list of options for all categories.
*/
@Override
public ToolOptions[] getOptions() {
ToolOptions[] opt = new ToolOptions[optionsMap.size()];
@@ -134,7 +119,6 @@ public class OptionsManager implements OptionsService, OptionsChangeListener {
* remove the options from the map.
* @param ownerPlugin the owner plugin
*/
//TODO anyone using this Or should they be?
public void deregisterOwner(Plugin ownerPlugin) {
List<String> deleteList = new ArrayList<>();
Iterator<String> iter = optionsMap.keySet().iterator();
@@ -211,9 +195,6 @@ public class OptionsManager implements OptionsService, OptionsChangeListener {
}
}
/**
* Show the dialog to edit options.
*/
public void editOptions() {
if (optionsMap.isEmpty()) {
Msg.showInfo(getClass(), tool.getToolFrame(), "No Options",
@@ -234,9 +215,6 @@ public class OptionsManager implements OptionsService, OptionsChangeListener {
}
}
/**
* Create the options dialog.
*/
private OptionsDialog createOptionsDialog() {
OptionsDialog dialog = null;
if (optionsMap.size() == 0) {
@@ -275,37 +253,20 @@ public class OptionsManager implements OptionsService, OptionsChangeListener {
}
private class OptionsComparator implements Comparator<ToolOptions> {
/**
* Compares its two arguments for order. Returns a negative integer,
* zero, or a positive integer as the first argument is less than, equal
* to, or greater than the second.<p>
*
* @param o1 the first object to be compared.
* @param o2 the second object to be compared.
* @return a negative integer, zero, or a positive integer as the
* first argument is less than, equal to, or greater than the
* second.
* @throws ClassCastException if the arguments' types prevent them from
* being compared by this Comparator.
*/
@Override
public int compare(ToolOptions o1, ToolOptions o2) {
return o1.getName().compareTo(o2.getName());
}
}
/////////////////////////////////////////////////////////////////////
private class KeyBindingOptionsEditor implements OptionsEditor {
private KeyBindingsPanel panel;
KeyBindingOptionsEditor() {
panel = new KeyBindingsPanel(tool, getOptions(ToolConstants.KEY_BINDINGS));
panel = new KeyBindingsPanel(tool, getOptions(DockingToolConstants.KEY_BINDINGS));
}
/**
* Apply the changes.
*/
@Override
public void apply() {
panel.apply();
@@ -326,9 +287,6 @@ public class OptionsManager implements OptionsService, OptionsChangeListener {
panel.dispose();
}
/**
* Get the editor component.
*/
@Override
public JComponent getEditorComponent(Options options,
EditorStateFactory editorStateFactory) {
@@ -339,12 +297,10 @@ public class OptionsManager implements OptionsService, OptionsChangeListener {
public void setOptionsPropertyChangeListener(PropertyChangeListener listener) {
panel.setOptionsPropertyChangeListener(listener);
}
}
@Override
public void optionsChanged(ToolOptions options, String name, Object oldValue, Object newValue) {
tool.setConfigChanged(true);
}
}

View File

@@ -19,53 +19,59 @@ import ghidra.framework.options.Options;
import ghidra.framework.options.ToolOptions;
/**
* Provides a service interface that allows the user to get Options and to check for the
* Provides a service interface that allows the user to get Options and to check for the
* existence of options.
*/
public interface OptionsService {
/**
* Get the list of options for all categories.
* @return the list of options for all categories.
*/
public Options[] getOptions();
/**
* Get the options for the given category name.
* @param category name of category
* @return the options for the given category name.
*/
public ToolOptions getOptions(String category);
/**
* Return whether an Options object exists for the given category.
* @param category name of the category
* @return true if an Options object exists
*/
public boolean hasOptions(String category);
/**
* Shows Options Dialog with the node denoted by "category" being displayed. The value is
* expected to be the name of a node in the options tree, residing under the root node. You
* may also provide the name of such a node, followed by the options delimiter, followed by
* the name of a child node under that node. For example, suppose in the options tree exists
* a node {@literal Root->Foo} You may pass the value "Foo" to get that node. Or, suppose
* in the options tree exists a node {@literal Root->Foo->childNode1} In this case, you may
* pass the value "Foo.childNode1", where the '.' character is the delimiter of the
* {@link ToolOptions} class (this is the value at the time of writing this documentation).
*
* <p>
* The filter text parameter is used to set the contents filter text of the options. You may
* use this parameter to filter the tree; for example, to show only the node in the tree that
* you want the user to see.
*
* @param category The category of options to have displayed
* @param filterText An optional value used to filter the nodes visible in the options tree.
* You may pass <code>null</code> or the empty string <code>""</code> here if you
* do not desire filtering.
* @throws IllegalArgumentException if the given <code>category</code> value does not exist in
* the tree of options.
*/
public void showOptionsDialog(String category, String filterText);
/**
* Get the list of options for all categories.
* @return the list of options for all categories.
*/
public Options[] getOptions();
/**
* Get the options for the given category name. If no options exist with the given name,
* then a new options object is created.
*
* <p>Note: the given name should not contains options path separator characters. Any
* sub-options needed must be retrieved from the ToolOptions object returned from this
* method.
*
* @param category name of category
* @return the options for the given category name.
*/
public ToolOptions getOptions(String category);
/**
* Return whether an Options object exists for the given category.
* @param category name of the category
* @return true if an Options object exists
*/
public boolean hasOptions(String category);
/**
* Shows Options Dialog with the node denoted by "category" being displayed. The value is
* expected to be the name of a node in the options tree, residing under the root node. You
* may also provide the name of such a node, followed by the options delimiter, followed by
* the name of a child node under that node. For example, suppose in the options tree exists
* a node {@literal Root->Foo} You may pass the value "Foo" to get that node. Or, suppose
* in the options tree exists a node {@literal Root->Foo->childNode1} In this case, you may
* pass the value "Foo.childNode1", where the '.' character is the delimiter of the
* {@link ToolOptions} class (this is the value at the time of writing this documentation).
*
* <p>
* The filter text parameter is used to set the contents filter text of the options. You may
* use this parameter to filter the tree; for example, to show only the node in the tree that
* you want the user to see.
*
* @param category The category of options to have displayed
* @param filterText An optional value used to filter the nodes visible in the options tree.
* You may pass <code>null</code> or the empty string <code>""</code> here if you
* do not desire filtering.
* @throws IllegalArgumentException if the given <code>category</code> value does not exist in
* the tree of options.
*/
public void showOptionsDialog(String category, String filterText);
}