docking.action.MenuData Java Examples

The following examples show how to use docking.action.MenuData. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Hcs12DisassembleAction.java    From ghidra with Apache License 2.0 6 votes vote down vote up
public Hcs12DisassembleAction(DisassemblerPlugin plugin, String groupName, boolean disassembleXgate) {
	super("Disassemble " + (disassembleXgate ? "HCS12" : "XGate"), plugin.getName());
	
	this.plugin = plugin;
	this.disassembleXgate = disassembleXgate;

	// Need to override the default help location since this action doesn't have its own
	// section in the help.
	HelpLocation location = new HelpLocation("DisassemblerPlugin", "Disassemble");
	this.setHelpLocation(location);
	
	setPopupMenuData( new MenuData( 
		new String[]{"Disassemble - "+ (disassembleXgate ? "XGate" : "HCS12") }, 
		null, 
		groupName ) );
	
	int keyEvent = (disassembleXgate ? KeyEvent.VK_F12 : KeyEvent.VK_F11);
	setKeyBindingData( new KeyBindingData( keyEvent, 0 ) );
}
 
Example #2
Source File: GhidraTool.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private void addCloseAction() {
	DockingAction closeAction = new DockingAction("Close Tool", ToolConstants.TOOL_OWNER) {
		@Override
		public void actionPerformed(ActionContext context) {
			close();
		}
	};
	closeAction.setHelpLocation(
		new HelpLocation(ToolConstants.TOOL_HELP_TOPIC, closeAction.getName()));
	closeAction.setEnabled(true);

	closeAction.setMenuBarData(
		new MenuData(new String[] { ToolConstants.MENU_FILE, "Close Tool" }, null, "Window_A"));

	addAction(closeAction);
}
 
Example #3
Source File: FindReferencesToDataTypeAction.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private void updateMenuName(DataType type) {

		if (type == null) {
			return; // not sure if this can happen
		}

		String typeName = type.getName();
		String menuName = "Find Uses of " + typeName;

		String fieldName = getDataTypeField();
		if (fieldName != null) {
			menuName += '.' + fieldName;
		}

		MenuData data = getPopupMenuData().cloneData();
		data.setMenuPath(new String[] { LocationReferencesService.MENU_GROUP, menuName });
		setPopupMenuData(data);
	}
 
Example #4
Source File: InstructionSearchPlugin.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private void createActions() {
	searchAction = new NavigatableContextAction(SEARCH_ACTION_NAME, getName()) {
		@Override
		public void actionPerformed(NavigatableActionContext context) {
			showSearchDialog(context);
		}

		@Override
		protected boolean isEnabledForContext(NavigatableActionContext context) {
			return !(context instanceof RestrictedAddressSetContext);
		}

	};
	searchAction.setHelpLocation(new HelpLocation("Search", "Instruction_Pattern_Search"));
	searchAction.setMenuBarData(
		new MenuData(new String[] { ToolConstants.MENU_SEARCH, "For Instruction Patterns" },
			null, "search for"));
	searchAction.setDescription("Construct searches using selected instructions");
	tool.addAction(searchAction);
}
 
Example #5
Source File: MenuManager.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private String getPullRightMenuGroup(MenuData menuData) {

		// note: currently, the client can specify the group for the pull-right menu only for
		//       the immediate parent of the menu item.  We can change this later if we find
		//       we have a need for a multi-level cascaded menu that needs to specify groups for
		//       each pull-right in the menu path

		String[] actionMenuPath = menuData.getMenuPath();
		int leafLevel = actionMenuPath.length - 1;
		boolean isParentOfLeaf = level == (leafLevel - 1);
		if (!isParentOfLeaf) {
			return null;
		}

		return menuData.getParentMenuGroup();
	}
 
Example #6
Source File: ProcessorListPlugin.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private void setupActions() {

		processorListAction = new DockingAction(ACTION_NAME, PLUGIN_NAME) {
			@Override
			public void actionPerformed(ActionContext context) {
				showProcessorList();
			}
		};

		processorListAction.setEnabled(true);

		processorListAction.setMenuBarData(
			new MenuData(new String[] { ToolConstants.MENU_HELP, ACTION_NAME }, null, "AAAZ"));

		processorListAction.setHelpLocation(new HelpLocation(HelpTopics.ABOUT, "ProcessorList"));
		processorListAction.setDescription(getPluginDescription().getDescription());
		tool.addAction(processorListAction);
	}
 
Example #7
Source File: MatchActionWrapper.java    From ghidra with Apache License 2.0 6 votes vote down vote up
public MatchActionWrapper(VTPlugin plugin, DockingAction action) {
	super("Wrapped Match Action: " + action.getName(), VTPlugin.OWNER);
	this.plugin = plugin;
	this.wrappedAction = action;

	// put this action in the menu in the same fashion as the wrapped action
	Icon icon = null;
	String menuGroup = null;
	MenuData popupMenuData = wrappedAction.getPopupMenuData();
	if (popupMenuData != null) {
		icon = popupMenuData.getMenuIcon();
		menuGroup = popupMenuData.getMenuGroup();
	}

	setPopupMenuData(new MenuData(
		new String[] { VTPlugin.MATCH_POPUP_MENU_NAME, action.getName() }, icon, menuGroup));

	HelpLocation helpLocation = DockingWindowManager.getHelpService().getHelpLocation(action);
	if (helpLocation != null) {
		setHelpLocation(helpLocation);
	}
}
 
Example #8
Source File: HorizontalRuleAction.java    From ghidra with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor
 * 
 * @param owner the action owner
 * @param topName the name that will appear above the separator bar
 * @param bottomName the name that will appear below the separator bar
 */
public HorizontalRuleAction(String owner, String topName, String bottomName) {
	super("HorizontalRuleAction: " + ++idCount, owner, false);
	setEnabled(false);

	// The menu name is both names, one over the other, in a small, light grayish font.
	setMenuBarData(new MenuData(new String[] { "<HTML><CENTER><FONT SIZE=2 COLOR=SILVER>" +
		fixupFirstAmp(
			HTMLUtilities.escapeHTML(topName) + "<BR>" + HTMLUtilities.escapeHTML(bottomName)) +
		"</FONT></CENTER>" }));

	// the description is meant to be used for the tooltip and is larger
	String padding = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
	setDescription("<HTML><CENTER><B>" + padding + HTMLUtilities.escapeHTML(topName) + padding +
		"<B><HR><B>" + padding + HTMLUtilities.escapeHTML(bottomName) + padding +
		"</B></CENTER>");
}
 
Example #9
Source File: MenuManager.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private MenuManager getSubMenu(MenuData menuData) {

		String[] fullPath = menuData.getMenuPath();
		String displayName = fullPath[level];
		char mnemonic = getMnemonicKey(displayName);
		String realName = stripMnemonicAmp(displayName);
		MenuManager subMenu = subMenus.get(realName);
		if (subMenu != null) {
			return subMenu;
		}

		int subMenuLevel = level + 1;
		String[] subMenuPath = new String[subMenuLevel];
		System.arraycopy(fullPath, 0, subMenuPath, 0, subMenuLevel);

		String subMenuGroup = getSubMenuGroup(menuData, realName, subMenuPath);
		subMenu = new MenuManager(realName, subMenuPath, mnemonic, subMenuLevel, subMenuGroup,
			usePopupPath, menuHandler, menuGroupMap);
		subMenus.put(realName, subMenu);
		managedMenuItems.add(subMenu);

		return subMenu;
	}
 
Example #10
Source File: MenuManager.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private String getSubMenuGroup(MenuData menuData, String menuName, String[] subMenuPath) {

		// prefer the group defined in the menu data, if any
		String pullRightGroup = getPullRightMenuGroup(menuData);
		if (pullRightGroup != null) {
			return pullRightGroup;
		}

		// check the global registry
		pullRightGroup = menuGroupMap.getMenuGroup(subMenuPath);
		if (pullRightGroup != null) {
			return pullRightGroup;
		}

		// default to the menu name
		return menuName;
	}
 
Example #11
Source File: DiffIgnoreAllAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
/**
 * @param provider the provider using this action
 */
public DiffIgnoreAllAction(DiffApplySettingsProvider provider) {
	super("Set All To Ignore", provider.getPlugin().getName());
	this.provider = provider;
	setMenuBarData( new MenuData( menuPath, GROUP_NAME ) );
       setPopupMenuData( new MenuData( popupPath, GROUP_NAME ) );
	
	setDescription(DESCRIPTION);
}
 
Example #12
Source File: EditArchivePathAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public EditArchivePathAction(DataTypeManagerPlugin plugin) {
		super("Edit Archive Paths", plugin.getName());
		this.plugin = plugin;

// ACTIONS - auto generated
		setMenuBarData(new MenuData(new String[] { "Edit Archive Paths..." }, null, "R2"));

		setDescription("Opens the options editor for adding paths that will be searched when " +
			"attempting to locate archive files.");
		setEnabled(true);
		setHelpLocation(new HelpLocation(plugin.getName(), "Edit_Archive_Paths"));
	}
 
Example #13
Source File: RemoveAllSecondaryHighlightsAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public RemoveAllSecondaryHighlightsAction() {
	super(NAME);

	setPopupMenuData(new MenuData(
		new String[] { "Secondary Highlight", "Remove All Highlights" }, "Decompile"));
	setHelpLocation(new HelpLocation("DecompilePlugin", getName()));
}
 
Example #14
Source File: AlignAllDataTypesAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public AlignAllDataTypesAction(DataTypeManagerPlugin plugin) {
	super("Align All Data Types", plugin.getName());
	this.plugin = plugin;

	setPopupMenuData(new MenuData(new String[] { "Align All..." }, "Edit"));
	setHelpLocation(new HelpLocation(plugin.getName(), getName()));
}
 
Example #15
Source File: RejectMarkupItemAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public RejectMarkupItemAction(VTController controller, boolean addToToolbar) {
	super(controller, "Reject");

	if (addToToolbar) {
		setToolBarData(new ToolBarData(REJECTED_ICON, MENU_GROUP));
	}
	MenuData menuData = new MenuData(new String[] { "Reject" }, REJECTED_ICON, MENU_GROUP);
	setPopupMenuData(menuData);
	setEnabled(false);
	setHelpLocation(new HelpLocation("VersionTrackingPlugin", "Tag_Markup_Item_Rejected"));
}
 
Example #16
Source File: EditAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public EditAction(DataTypeManagerPlugin plugin) {
	super("Edit", plugin.getName());
	this.plugin = plugin;

	setPopupMenuData(new MenuData(new String[] { "Edit" }, null, "Edit"));
	setHelpLocation(new HelpLocation("DataTypeManagerPlugin", "Edit_Data_Type"));
	setEnabled(true);
}
 
Example #17
Source File: FindReferencesToSymbolAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private void updateMenuName(Symbol symbol) {

		if (symbol == null) {
			return; // not sure if this can happen
		}

		String symbolName = symbol.getName(false);
		String menuName = MENU_ITEM_TEXT + ' ' + symbolName;

		MenuData data = getPopupMenuData().cloneData();
		data.setMenuPath(new String[] { LocationReferencesService.MENU_GROUP, menuName });
		setPopupMenuData(data);
	}
 
Example #18
Source File: FindPossibleReferencesPlugin.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private void createLocalActions(ProgramLocationActionContext context, ComponentProvider p,
		FindReferencesTableModel model) {

	addLocalAlignment(p, model, 1);
	addLocalAlignment(p, model, 2);
	addLocalAlignment(p, model, 3);
	addLocalAlignment(p, model, 4);
	addLocalAlignment(p, model, 8);

	final ProgramSelection selection = context.getSelection();
	final Program pgm = context.getProgram();
	DockingAction localAction = new DockingAction(RESTORE_SELECTION_ACTION_NAME, getName()) {
		@Override
		public void actionPerformed(ActionContext actionContext) {
			restoreSearchSelection(selection, pgm);
		}
	};
	localAction.setEnabled(false);
	localAction.setHelpLocation(
		new HelpLocation(HelpTopics.SEARCH, RESTORE_SELECTION_ACTION_NAME));
	String group = "selection";
	localAction.setMenuBarData(
		new MenuData(new String[] { "Restore Search Selection" }, group));
	localAction.setPopupMenuData(
		new MenuData(new String[] { "Restore Search Selection" }, group));

	localAction.setDescription(
		"Sets the program selection back to the selection this search was based upon.");
	if (selection != null && !selection.isEmpty()) {
		localAction.setEnabled(true);
		tool.addLocalAction(p, localAction);
	}
}
 
Example #19
Source File: ProjectDataOpenToolAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public ProjectDataOpenToolAction(String owner, String group, String toolName, Icon icon) {
	super("Open" + toolName, owner);
	this.toolName = toolName;
	String[] menuPath = { "Open With", HTMLUtilities.escapeHTML(toolName) };
	setPopupMenuData(new MenuData(menuPath, icon, "Open"));
	setHelpLocation(new HelpLocation(owner, "Open_File_With"));

}
 
Example #20
Source File: ApplyAndAddAsPrimaryMarkupItemAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public ApplyAndAddAsPrimaryMarkupItemAction(VTController controller, boolean addToToolbar) {
	super(controller, "Apply (Add As Primary)");

	if (addToToolbar) {
		setToolBarData(new ToolBarData(APPLY_ADD_MENU_ICON, MENU_GROUP));
	}
	MenuData menuData = new MenuData(new String[] { "Apply (Add As Primary)" },
		APPLY_ADD_MENU_ICON, MENU_GROUP);
	menuData.setMenuSubGroup("1");
	setPopupMenuData(menuData);
	setEnabled(false);
	setHelpLocation(new HelpLocation("VersionTrackingPlugin", "Add_As_Primary_Markup_Item"));
}
 
Example #21
Source File: UnlockArchiveAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public UnlockArchiveAction(DataTypeManagerPlugin plugin) {
	super(ACTION_NAME, plugin.getName());
	this.plugin = plugin;

	setPopupMenuData(new MenuData(new String[] { "Close For Editing" }, null, "FileEdit"));

	setEnabled(true);
}
 
Example #22
Source File: ResetToolAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public ResetToolAction(VTController controller, VTSubToolManager toolManager) {
	super("Reset Sub Tools", VTPlugin.OWNER);
	this.controller = controller;
	this.toolManager = toolManager;
	String[] menuPath = { ToolConstants.MENU_EDIT, "Reset Source and Destination Tools" };
	setMenuBarData(new MenuData(menuPath));
	setDescription("Resets source and destination program tools back to default configurations.");
	setHelpLocation(new HelpLocation("VersionTrackingPlugin", "Reset_Tools"));
}
 
Example #23
Source File: RemoveSecondaryHighlightAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public RemoveSecondaryHighlightAction() {
	super(NAME);

	setPopupMenuData(
		new MenuData(new String[] { "Secondary Highlight", "Remove Highlight" }, "Decompile"));
	setHelpLocation(new HelpLocation("DecompilePlugin", getName()));
}
 
Example #24
Source File: FindReferencesToSymbolAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public FindReferencesToSymbolAction() {
	super(NAME);

	setPopupMenuData(
		new MenuData(new String[] { LocationReferencesService.MENU_GROUP, MENU_ITEM_TEXT }));
	setHelpLocation(new HelpLocation(HelpTopics.FIND_REFERENCES, HelpTopics.FIND_REFERENCES));
}
 
Example #25
Source File: FindCheckoutsAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public FindCheckoutsAction(String owner, Plugin plugin) {
	super("Find Checkouts", owner);
	this.plugin = plugin;
	String group = "Repository";
	Icon searchIcon = ResourceManager.loadImage("images/magnifier.png");
	Icon smallCheckIcon = ResourceManager.loadImage("images/check.png");
	MultiIcon icon = new MultiIcon(searchIcon);
	icon.addIcon(smallCheckIcon);
	setToolBarData(new ToolBarData(icon, group));
	setPopupMenuData(new MenuData(new String[] { "Find Checkouts..." }, icon, "Repository"));
	setDescription("Find my checkouts recursively");
	setHelpLocation(new HelpLocation("VersionControl", "Find_Checkouts"));
	setEnabled(false);
}
 
Example #26
Source File: RefreshAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public RefreshAction(DataTypeManagerPlugin plugin) {
	super("Refresh BuiltInTypes", plugin.getName());
	this.plugin = plugin;

	setMenuBarData(new MenuData(new String[] { "Refresh BuiltInTypes" }, null, "R2"));

	setDescription("Searches the class path to refresh the list of Ghidra BuiltIn data types.");
	setEnabled(true);
}
 
Example #27
Source File: EditThunkFunctionAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
/**
 * Create a new action, to edit a thunk function at the current location
 * @param functionPlugin does checking for this action
 */
public EditThunkFunctionAction(FunctionPlugin plugin) {
	super("Set Thunked Function", plugin.getName());
	this.funcPlugin = plugin;

	// top-level item usable only on a function
	setPopupMenuData(new MenuData(
		new String[] { FunctionPlugin.FUNCTION_MENU_PULLRIGHT, "Set Thunked Function..." },
		null, FunctionPlugin.THUNK_FUNCTION_MENU_SUBGROUP));

	setHelpLocation(new HelpLocation("FunctionPlugin", "ThunkFunctions"));

	setEnabled(true);
}
 
Example #28
Source File: LabelHistoryAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public LabelHistoryAction(PluginTool tool, String owner) {
	super("Show Label History", owner);
	this.tool = tool;
	setPopupMenuData(new MenuData(new String[] { "Show Label History..." }, null, "Label"));
	setKeyBindingData(new KeyBindingData(KeyEvent.VK_H, 0));

}
 
Example #29
Source File: ExpandAllDataAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public ExpandAllDataAction(CodeViewerProvider provider) {
	super("Expand All Data", provider.getOwner());
	this.provider = provider;

	setPopupMenuData(new MenuData(new String[] { "Expand All Data" }, null, "Structure"));
	setDescription("Open all data recursively from the current location downward.");

	setHelpLocation(new HelpLocation("CodeBrowserPlugin", "ExpandCollapseActions"));

	setEnabled(true);
}
 
Example #30
Source File: RemoveMatchAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public RemoveMatchAction(VTController controller) {
		super("Remove", VTPlugin.OWNER);
		this.controller = controller;

//		setToolBarData(new ToolBarData(ICON, MENU_GROUP));
		setPopupMenuData(new MenuData(new String[] { "Remove Match" }, ICON, MENU_GROUP));
		setEnabled(false);
		setHelpLocation(new HelpLocation("VersionTrackingPlugin", "Remove_Match"));
	}