GP-1764 - Plugins - tweaked help

This commit is contained in:
dragonmacher
2022-01-18 13:50:30 -05:00
parent 82c42e648c
commit 924bf7656e
30 changed files with 1200 additions and 496 deletions

View File

@@ -70,7 +70,7 @@ import ghidra.util.task.TaskMonitor;
//@formatter:on
public class FidDebugPlugin extends ProgramPlugin implements ChangeListener {
private static final String FUNCTION_ID_DEBUG_NAME = "Function ID Debug";
static final String FUNCTION_ID_NAME = "Function ID";
private static final String MENU_GROUP_2 = "group2";
private FidService service;
@@ -132,21 +132,19 @@ public class FidDebugPlugin extends ProgramPlugin implements ChangeListener {
}
};
action.setMenuBarData(new MenuData(
new String[] { ToolConstants.MENU_TOOLS, FidPluginPackage.NAME, "Debug Search Window" },
new String[] { ToolConstants.MENU_TOOLS, FUNCTION_ID_NAME, "Debug Search Window" },
null, MENU_GROUP_2, MenuData.NO_MNEMONIC, "7"));
action.setDescription("Open a window to search the FID DBs in debug mode");
action.setHelpLocation(
new HelpLocation(FidPlugin.FID_HELP, "FunctionIDDebug"));
action.setHelpLocation(new HelpLocation(FidPlugin.FID_HELP, "FunctionIDDebug"));
tool.addAction(action);
action = new HashAction(this);
action.setMenuBarData(new MenuData(
new String[] { ToolConstants.MENU_TOOLS, FidPluginPackage.NAME,
new String[] { ToolConstants.MENU_TOOLS, FUNCTION_ID_NAME,
"Debug Search Window (Current Function)" },
null, MENU_GROUP_2, MenuData.NO_MNEMONIC, "1"));
action.setDescription("FidHashes the current function for debug purposes");
action.setHelpLocation(
new HelpLocation(FidPlugin.FID_HELP, "FunctionIDDebug"));
action.setHelpLocation(new HelpLocation(FidPlugin.FID_HELP, "FunctionIDDebug"));
tool.addAction(action);
createRawFileAction = new DockingAction("raw file", getName()) {
@@ -155,13 +153,15 @@ public class FidDebugPlugin extends ProgramPlugin implements ChangeListener {
createRawFile();
}
};
createRawFileAction.setMenuBarData(
new MenuData(new String[] { ToolConstants.MENU_TOOLS, FidPluginPackage.NAME,
"Create Read-only Database" }, null, MENU_GROUP_2, MenuData.NO_MNEMONIC, "1"));
createRawFileAction
.setMenuBarData(new MenuData(
new String[] { ToolConstants.MENU_TOOLS, FUNCTION_ID_NAME,
"Create Read-only Database" },
null, MENU_GROUP_2, MenuData.NO_MNEMONIC, "1"));
createRawFileAction.setDescription(
"Creates a raw read-only database suitable for distribution in the installation directory");
createRawFileAction.setHelpLocation(
new HelpLocation(FidPlugin.FID_HELP, "FunctionIDDebug"));
createRawFileAction
.setHelpLocation(new HelpLocation(FidPlugin.FID_HELP, "FunctionIDDebug"));
tool.addAction(createRawFileAction);
}
@@ -222,8 +222,8 @@ public class FidDebugPlugin extends ProgramPlugin implements ChangeListener {
List<FidDbViewerProvider> componentProviders =
tool.getWindowManager().getComponentProviders(FidDbViewerProvider.class);
for (ComponentProvider comp : componentProviders) {
if (((FidDbViewerProvider) comp).fidDB.getPath().equals(
fidFile.getPath())) {
if (((FidDbViewerProvider) comp).fidDB.getPath()
.equals(fidFile.getPath())) {
tool.getWindowManager().showComponent(comp, true);
return;
}
@@ -239,12 +239,11 @@ public class FidDebugPlugin extends ProgramPlugin implements ChangeListener {
}
};
action.setMenuBarData(new MenuData(new String[] { ToolConstants.MENU_TOOLS,
FidPluginPackage.NAME, "Table Viewer", fidFile.getName() }, null, MENU_GROUP_2,
FUNCTION_ID_NAME, "Table Viewer", fidFile.getName() }, null, MENU_GROUP_2,
MenuData.NO_MNEMONIC, "6"));
action.setDescription(
"Opens new DB Table Viewer to browse the database in " + fidFile.getName());
action.setHelpLocation(
new HelpLocation(FidPlugin.FID_HELP, "FunctionIDPlugin"));
action.setHelpLocation(new HelpLocation(FidPlugin.FID_HELP, "FunctionIDPlugin"));
action.setEnabled(true);
if (tool != null) {
tool.addAction(action);
@@ -253,8 +252,7 @@ public class FidDebugPlugin extends ProgramPlugin implements ChangeListener {
}
// make these appear at the bottom of the Fid Menu.
tool.setMenuGroup(
new String[] { ToolConstants.MENU_TOOLS, FidPluginPackage.NAME, "Table Viewer" },
"zzz");
new String[] { ToolConstants.MENU_TOOLS, FUNCTION_ID_NAME, "Table Viewer" }, "zzz");
}

View File

@@ -28,6 +28,8 @@ import docking.action.DockingAction;
import docking.action.MenuData;
import docking.tool.ToolConstants;
import docking.widgets.filechooser.GhidraFileChooser;
import docking.widgets.filechooser.GhidraFileChooserMode;
import ghidra.app.CorePluginPackage;
import ghidra.app.plugin.PluginCategoryNames;
import ghidra.app.plugin.ProgramPlugin;
import ghidra.app.script.AskDialog;
@@ -39,7 +41,6 @@ import ghidra.framework.plugintool.PluginTool;
import ghidra.framework.plugintool.util.PluginStatus;
import ghidra.util.HelpLocation;
import ghidra.util.Msg;
import ghidra.util.exception.CancelledException;
import ghidra.util.exception.DuplicateFileException;
/**
@@ -51,17 +52,16 @@ import ghidra.util.exception.DuplicateFileException;
//@formatter:off
@PluginInfo(
status = PluginStatus.RELEASED,
packageName = FidPluginPackage.NAME,
packageName = CorePluginPackage.NAME,
category = PluginCategoryNames.SEARCH,
shortDescription = FidPlugin.FUNCTION_ID_NAME,
description = "This plugin is for creating and maintaining function identification libraries."
)
//@formatter:on
public class FidPlugin extends ProgramPlugin implements ChangeListener {
private static final String MENU_GROUP_1 = "group1";
static final String FUNCTION_ID_NAME = "Function ID";
public static final String FID_HELP = "FunctionID";
private FidService service;
@@ -115,9 +115,9 @@ public class FidPlugin extends ProgramPlugin implements ChangeListener {
chooseActiveFidDbs();
}
};
action.setMenuBarData(
new MenuData(new String[] { ToolConstants.MENU_TOOLS, FidPluginPackage.NAME,
"Choose active FidDbs..." }, null, MENU_GROUP_1, MenuData.NO_MNEMONIC, "1"));
action.setMenuBarData(new MenuData(
new String[] { ToolConstants.MENU_TOOLS, FUNCTION_ID_NAME, "Choose active FidDbs..." },
null, MENU_GROUP_1, MenuData.NO_MNEMONIC, "1"));
action.setDescription("Select which FidDbs are used during Fid Search");
action.setHelpLocation(new HelpLocation(FID_HELP, "chooseactivemenu"));
tool.addAction(action);
@@ -130,7 +130,7 @@ public class FidPlugin extends ProgramPlugin implements ChangeListener {
}
};
action.setMenuBarData(
new MenuData(new String[] { ToolConstants.MENU_TOOLS, FidPluginPackage.NAME,
new MenuData(new String[] { ToolConstants.MENU_TOOLS, FUNCTION_ID_NAME,
"Create new empty FidDb..." }, null, MENU_GROUP_1, MenuData.NO_MNEMONIC, "2"));
action.setDescription("Create a new, empty FidDb file in your file system");
action.setHelpLocation(new HelpLocation(FID_HELP, "createemptyfid"));
@@ -143,9 +143,9 @@ public class FidPlugin extends ProgramPlugin implements ChangeListener {
attachFidDb();
}
};
action.setMenuBarData(
new MenuData(new String[] { ToolConstants.MENU_TOOLS, FidPluginPackage.NAME,
"Attach existing FidDb..." }, null, MENU_GROUP_1, MenuData.NO_MNEMONIC, "3"));
action.setMenuBarData(new MenuData(
new String[] { ToolConstants.MENU_TOOLS, FUNCTION_ID_NAME, "Attach existing FidDb..." },
null, MENU_GROUP_1, MenuData.NO_MNEMONIC, "3"));
action.setDescription("Attach an existing FidDb file from your file system");
action.setHelpLocation(new HelpLocation(FID_HELP, "attachfid"));
tool.addAction(action);
@@ -157,9 +157,9 @@ public class FidPlugin extends ProgramPlugin implements ChangeListener {
removeFidFile();
}
};
action.setMenuBarData(
new MenuData(new String[] { ToolConstants.MENU_TOOLS, FidPluginPackage.NAME,
"Detach attached FidDb..." }, null, MENU_GROUP_1, MenuData.NO_MNEMONIC, "4"));
action.setMenuBarData(new MenuData(
new String[] { ToolConstants.MENU_TOOLS, FUNCTION_ID_NAME, "Detach attached FidDb..." },
null, MENU_GROUP_1, MenuData.NO_MNEMONIC, "4"));
action.setDescription("Detach an already attached FidDb");
action.setHelpLocation(new HelpLocation(FID_HELP, "detachfid"));
tool.addAction(action);
@@ -173,7 +173,7 @@ public class FidPlugin extends ProgramPlugin implements ChangeListener {
}
};
action.setMenuBarData(new MenuData(
new String[] { ToolConstants.MENU_TOOLS, FidPluginPackage.NAME,
new String[] { ToolConstants.MENU_TOOLS, FUNCTION_ID_NAME,
"Populate FidDb from programs..." },
null, MENU_GROUP_1, MenuData.NO_MNEMONIC, "5"));
action.setDescription("Populate an existing FidDb with all programs under a domain folder");
@@ -266,7 +266,7 @@ public class FidPlugin extends ProgramPlugin implements ChangeListener {
final GhidraFileChooser chooser = new GhidraFileChooser(tool.getActiveWindow());
chooser.setApproveButtonText(approveButtonText);
chooser.setTitle(title);
chooser.setFileSelectionMode(GhidraFileChooser.FILES_ONLY);
chooser.setFileSelectionMode(GhidraFileChooserMode.FILES_ONLY);
return chooser.getSelectedFile();
}
@@ -277,7 +277,6 @@ public class FidPlugin extends ProgramPlugin implements ChangeListener {
* @param choices array of choices for the users
* @param defaultValue the default value to select
* @return the user's choice, or null
* @throws CancelledException if the user cancels
*/
private <T> T askChoice(String title, String message, List<T> choices, T defaultValue) {
AskDialog<T> dialog =

View File

@@ -1,31 +0,0 @@
/* ###
* 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 ghidra.feature.fid.plugin;
import ghidra.framework.plugintool.util.PluginPackage;
import resources.ResourceManager;
/**
* Plugin package for the FID plugin.
*/
public class FidPluginPackage extends PluginPackage {
public static final String NAME = "Function ID";
public FidPluginPackage() {
super(NAME, ResourceManager.loadImage("images/vcard.png"),
"These plugins are for creating, maintaining, and debugging function identification libraries.");
}
}