Java Code Examples for docking.action.MenuData#setMenuSubGroup()

The following examples show how to use docking.action.MenuData#setMenuSubGroup() . 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: PdbSymbolServerPlugin.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private void createActions() {
	ProgramContextAction downloadPdbAction =
		new ProgramContextAction("Download_PDB_File", this.getName()) {

			@Override
			public boolean isEnabledForContext(ProgramActionContext context) {
				return context.getProgram() != null;
			}

			@Override
			protected void actionPerformed(ProgramActionContext programContext) {
				downloadPDB();
			}
		};

	MenuData menuData =
		new MenuData(new String[] { "&File", "Download PDB File..." }, null, "Import PDB");
	menuData.setMenuSubGroup("4");
	downloadPdbAction.setMenuBarData(menuData);

	downloadPdbAction.setEnabled(false);
	downloadPdbAction.setHelpLocation(new HelpLocation("Pdb", downloadPdbAction.getName()));
	tool.addAction(downloadPdbAction);
}
 
Example 2
Source File: PdbPlugin.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private void createActions() {
	loadPdbAction = new ProgramContextAction("Load PDB File", this.getName()) {

		@Override
		public boolean isEnabledForContext(ProgramActionContext context) {
			return context.getProgram() != null;
		}

		@Override
		protected void actionPerformed(ProgramActionContext programContext) {
			loadPDB();
		}
	};

	MenuData menuData =
		new MenuData(new String[] { "&File", "Load PDB File..." }, null, "Import PDB");
	menuData.setMenuSubGroup("3"); // below the major actions in the "Import/Export" group
	loadPdbAction.setMenuBarData(menuData);

	loadPdbAction.setEnabled(false);
	loadPdbAction.setHelpLocation(new HelpLocation("ImporterPlugin", loadPdbAction.getName()));
	tool.addAction(loadPdbAction);
}
 
Example 3
Source File: SelectBlockPlugin.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private void createActions() {

		toolBarAction = new NavigatableContextAction("SelectBlock", getName()) {
			@Override
			public void actionPerformed(NavigatableActionContext context) {
				showDialog(context.getComponentProvider(), context.getNavigatable());
			}

			@Override
			public boolean isEnabledForContext(ActionContext context) {
				updateNavigatable(context);
				return super.isEnabledForContext(context);
			}
		};
		MenuData menuData =
			new MenuData(new String[] { ToolConstants.MENU_SELECTION, "Bytes..." }, null, "Select");
		menuData.setMenuSubGroup("1");
		toolBarAction.setMenuBarData(menuData);

		toolBarAction.setEnabled(false);
		toolBarAction.setDescription("Allows user to select blocks of data.");
		toolBarAction.setHelpLocation(new HelpLocation("SelectBlockPlugin", "Select_Block_Help"));
		tool.addAction(toolBarAction);
	}
 
Example 4
Source File: CParserPlugin.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private void createActions() {
	DockingAction parseAction = new DockingAction(PARSE_ACTION_NAME, getName()) {
		@Override
		public void actionPerformed(ActionContext context) {
			showParseDialog();
		}
	};
	String[] menuPath = { ToolConstants.MENU_FILE, "Parse C Source..." };
	MenuData menuData = new MenuData(menuPath, "Import/Export");
	menuData.setMenuSubGroup("d"); // below the major actions in the "Import/Export" group
	parseAction.setMenuBarData(menuData);
	parseAction.setDescription(DESCRIPTION);
	parseAction.setHelpLocation(new HelpLocation(this.getName(), "Parse_C_Source"));
	parseAction.setEnabled(true);
	tool.addAction(parseAction);
}
 
Example 5
Source File: GotoPreviousFunctionAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public GotoPreviousFunctionAction(PluginTool tool, String owner) {
	super("Go to previous function", owner);
	this.tool = tool;

	MenuData menuData =
		new MenuData(new String[] { ToolConstants.MENU_NAVIGATION, "Go To Previous Function" },
			null, "GoTo");
	menuData.setMenuSubGroup("zb");
	setMenuBarData(menuData);
	KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.CTRL_DOWN_MASK);
	setKeyBindingData(new KeyBindingData(keyStroke));
	setHelpLocation(new HelpLocation(HelpTopics.NAVIGATION, "Next_Previous_Function"));
}
 
Example 6
Source File: GotoNextFunctionAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public GotoNextFunctionAction(PluginTool tool, String owner) {
	super("Go to next function", owner);
	this.tool = tool;

	MenuData menuData =
		new MenuData(new String[] { ToolConstants.MENU_NAVIGATION, "Go To Next Function" },
			null, "GoTo");
	menuData.setMenuSubGroup("za");
	setMenuBarData(menuData);
	KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.CTRL_DOWN_MASK);
	setKeyBindingData(new KeyBindingData(keyStroke));
	setHelpLocation(new HelpLocation(HelpTopics.NAVIGATION, "Next_Previous_Function"));
}
 
Example 7
Source File: ApplyAndReplaceMarkupItemAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public ApplyAndReplaceMarkupItemAction(VTController controller, boolean addToToolbar) {
	super(controller, "Apply (Replace)");

	if (addToToolbar) {
		setToolBarData(new ToolBarData(APPLY_REPLACE_MENU_ICON, MENU_GROUP));
	}
	MenuData menuData =
		new MenuData(new String[] { "Apply (Replace)" }, APPLY_REPLACE_MENU_ICON, MENU_GROUP);
	menuData.setMenuSubGroup("2");
	setPopupMenuData(menuData);
	setEnabled(false);
	setHelpLocation(new HelpLocation("VersionTrackingPlugin", "Replace_Markup_Item"));
}
 
Example 8
Source File: ApplyAndAddMarkupItemAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public ApplyAndAddMarkupItemAction(VTController controller, boolean addToToolbar) {
	super(controller, "Apply (Add)");

	if (addToToolbar) {
		setToolBarData(new ToolBarData(APPLY_ADD_MENU_ICON, MENU_GROUP));
	}
	MenuData menuData =
		new MenuData(new String[] { "Apply (Add)" }, APPLY_ADD_MENU_ICON, MENU_GROUP);
	menuData.setMenuSubGroup("1");
	setPopupMenuData(menuData);
	setEnabled(false);
	setHelpLocation(new HelpLocation("VersionTrackingPlugin", "Add_Markup_Item"));
}
 
Example 9
Source File: ReplaceFirstMarkupItemAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor for action to only replace the first item (i.e. defined data at the 
 * destination address, but don't replace if other defined data beyond the destination 
 * address would be overwritten.)
 * @param controller the version tracking session controller
 * @param addToToolbar true indicates this action's icon should be added to the 
 * window provider's toolbar.
 */
public ReplaceFirstMarkupItemAction(VTController controller, boolean addToToolbar) {
	super(controller, "Apply (Replace First Only)");

	Icon replacedIcon = VTPlugin.REPLACED_ICON;
	ImageIcon warningIcon = ResourceManager.loadImage("images/warning_obj.png");
	warningIcon = ResourceManager.getScaledIcon(warningIcon, 12, 12);
	MultiIcon multiIcon = new MultiIcon(replacedIcon, false);
	int refreshIconWidth = replacedIcon.getIconWidth();
	int refreshIconHeight = replacedIcon.getIconHeight();
	int warningIconWidth = warningIcon.getIconWidth();
	int warningIconHeight = warningIcon.getIconHeight();

	int x = refreshIconWidth - warningIconWidth;
	int y = refreshIconHeight - warningIconHeight;

	TranslateIcon translateIcon = new TranslateIcon(warningIcon, x, y);
	multiIcon.addIcon(translateIcon);

	if (addToToolbar) {
		setToolBarData(new ToolBarData(multiIcon, MENU_GROUP));
	}
	MenuData menuData =
		new MenuData(new String[] { "Apply (Replace First Only)" }, replacedIcon, MENU_GROUP);
	menuData.setMenuSubGroup("2");
	setPopupMenuData(menuData);
	setEnabled(false);
	setHelpLocation(new HelpLocation("VersionTrackingPlugin", "Replace_First_Markup_Item"));
}
 
Example 10
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 11
Source File: ReplaceDefaultMarkupItemAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public ReplaceDefaultMarkupItemAction(VTController controller, boolean addToToolbar) {
	super(controller, "Apply (Replace Default Only)");

	Icon replacedIcon = VTPlugin.REPLACED_ICON;
	ImageIcon warningIcon = ResourceManager.loadImage("images/warning.png");
	warningIcon = ResourceManager.getScaledIcon(warningIcon, 12, 12);
	int warningIconWidth = warningIcon.getIconWidth();
	int warningIconHeight = warningIcon.getIconHeight();

	MultiIcon multiIcon = new MultiIcon(replacedIcon);
	int refreshIconWidth = replacedIcon.getIconWidth();
	int refreshIconHeight = replacedIcon.getIconHeight();

	int x = refreshIconWidth - warningIconWidth;
	int y = refreshIconHeight - warningIconHeight;

	TranslateIcon translateIcon = new TranslateIcon(warningIcon, x, y);
	multiIcon.addIcon(translateIcon);

	if (addToToolbar) {
		setToolBarData(new ToolBarData(multiIcon, MENU_GROUP));
	}
	MenuData menuData =
		new MenuData(new String[] { "Apply (Replace Default Only)" }, replacedIcon, MENU_GROUP);
	menuData.setMenuSubGroup("2");
	setPopupMenuData(menuData);
	setEnabled(false);
	setHelpLocation(new HelpLocation("VersionTrackingPlugin", "Replace_Default_Markup_Item"));
}