Java Code Examples for docking.action.DockingAction#setHelpLocation()

The following examples show how to use docking.action.DockingAction#setHelpLocation() . 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: 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 2
Source File: DiffDetailsProvider.java    From ghidra with Apache License 2.0 6 votes vote down vote up
public void addActions() {
		DockingAction refreshDetailsAction =
			new DockingAction("Refresh Diff Details", plugin.getName()) {
				@Override
				public void actionPerformed(ActionContext context) {
					refreshDetails(plugin.getCurrentLocation());
				}
			};

		refreshDetailsAction.setDescription(
			"Refresh the details to show any differences at the current location.");
		refreshDetailsAction.setEnabled(true);

		refreshDetailsAction.setToolBarData(new ToolBarData(REFRESH_ICON, "Diff"));
		refreshDetailsAction.setHelpLocation(
			new HelpLocation(HelpTopics.DIFF, "Refresh Diff Details"));
		plugin.getTool().addLocalAction(this, refreshDetailsAction);
//		plugin.getTool().addLocalAction(this, new DiffIgnoreAllAction(this));
	}
 
Example 3
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 4
Source File: RestoreSelectionPlugin.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private void createActions() {        
        DockingAction action = new DockingAction( RESTORE_SELECTION_ACTION_NAME, getName() ) {
            @Override
            public void actionPerformed( ActionContext context ) {
                SelectionState programSelectionState = programToSelectionMap.get( currentProgram );
                firePluginEvent( new ProgramSelectionPluginEvent( 
                    RestoreSelectionPlugin.this.getName(), 
                    programSelectionState.getSelectionToRestore(), currentProgram ) );
            }
        };
// ACTIONS - auto generated
        action.setMenuBarData( new MenuData( 
        	new String[]{ToolConstants.MENU_SELECTION, 
RESTORE_SELECTION_ACTION_NAME}, 
        	null, 
        	"SelectUtils" ) );


        action.setHelpLocation(new HelpLocation(HelpTopics.SELECTION, RESTORE_SELECTION_ACTION_NAME));
        action.setEnabled( false );
        
        tool.addAction( action );
        
        restoreSelectionAction = action;
    }
 
Example 5
Source File: TipOfTheDayPlugin.java    From ghidra with Apache License 2.0 6 votes vote down vote up
@Override
protected void init() {
	action = new DockingAction("Tips of the day", getName()) {
		@Override
		public void actionPerformed(ActionContext context) {
			dialog.doShow(tool.getToolFrame());
		}
	};
	action.setMenuBarData(new MenuData(new String[] { "Help", "Tip of the Day" },
		ToolConstants.HELP_CONTENTS_MENU_GROUP));

	action.setEnabled(true);
	action.setHelpLocation(new HelpLocation(ToolConstants.TOOL_HELP_TOPIC, "Tip_of_the_day"));
	tool.addAction(action);

	List<String> tips = null;
	try {
		tips = loadTips();
	}
	catch (IOException e) {
		tips = new ArrayList<>();
	}
	dialog = new TipOfTheDayDialog(this, tips);

	readPreferences();
}
 
Example 6
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 7
Source File: TableChooserDialog.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private void createActions() {
	String owner = getClass().getSimpleName();

	DockingAction selectAction = new MakeProgramSelectionAction(owner, table) {
		@Override
		protected ProgramSelection makeSelection(ActionContext context) {
			ProgramSelection selection = table.getProgramSelection();
			if (navigatable != null) {
				navigatable.goTo(program,
					new ProgramLocation(program, selection.getMinAddress()));
				navigatable.setSelection(selection);
				navigatable.requestFocus();
			}
			return selection;
		}
	};

	DockingAction selectionNavigationAction = new SelectionNavigationAction(owner, table);
	selectionNavigationAction.setHelpLocation(
		new HelpLocation(HelpTopics.SEARCH, "Selection_Navigation"));

	addAction(selectAction);
	addAction(selectionNavigationAction);
}
 
Example 8
Source File: TemplateProgramPlugin.java    From ghidra with Apache License 2.0 6 votes vote down vote up
/**
* Set up Actions
*/
private void setupActions() {

	//
	// Function 1
	//
	action = new DockingAction("Function 1 Code", getName()) {
		@Override
		public void actionPerformed(ActionContext e) {
			Function_1();
		}

		@Override
		public boolean isValidContext(ActionContext context) {
			return context instanceof ListingActionContext;
		}
	};
	action.setEnabled(false);

	action.setMenuBarData(
		new MenuData(new String[] { "Misc", "Menu", "Menu item 1" }, null, null));

	action.setHelpLocation(
		new HelpLocation("SampleHelpTopic", "TemplateProgramPlugin_Anchor_Name"));
	tool.addAction(action);
}
 
Example 9
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 10
Source File: SampleGraphPlugin.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private void createActions() {
	DockingAction showProviderAction = new DockingAction(SHOW_PROVIDER_ACTION_NAME, getName()) {
		@Override
		public void actionPerformed(ActionContext context) {
			showProvider();
		}
	};

	ImageIcon icon = ResourceManager.loadImage("images/applications-development.png");
	showProviderAction.setToolBarData(new ToolBarData(icon, "View"));
	showProviderAction.setHelpLocation(DEFAULT_HELP);
	tool.addAction(showProviderAction);
}
 
Example 11
Source File: SelectByScopedFlowPlugin.java    From ghidra with Apache License 2.0 4 votes vote down vote up
private void createActions() {
	DockingAction action =
		new NavigatableContextAction("Select Forward Scoped Flow", getName()) {
			@Override
			public void actionPerformed(NavigatableActionContext context) {
				FunctionManager functionManager = currentProgram.getFunctionManager();
				Function function =
					functionManager.getFunctionContaining(currentLocation.getAddress());

				if (!isValidFunction(function)) {
					Msg.showWarn(this, null, "Cursor Must Be In a Function",
						"Selecting scoped flow requires the cursor to be " +
							"inside of a function");
					return;
				}

				try {
					ProgramSelection selection = makeForwardScopedSelection(function,
						currentProgram, currentLocation, new TaskMonitorAdapter(true));
					updateStatusText(selection);
					setSelection(selection);
				}
				catch (CancelledException e) {
					Msg.debug(this, "Calculating Forward Scoped Flow cancelled", e);
				}
			}
		};
	action.setMenuBarData(new MenuData(
		new String[] { ToolConstants.MENU_SELECTION, "Scoped Flow", "Forward Scoped Flow" },
		null, "Select"));

	action.setDescription("Allows user to select scoped flow from current location.");
	action.setHelpLocation(new HelpLocation("FlowSelection", "Scoped_Flow"));
	tool.addAction(action);

	action = new NavigatableContextAction("Select Reverse Scoped Flow", getName()) {
		@Override
		public void actionPerformed(NavigatableActionContext context) {
			FunctionManager functionManager = currentProgram.getFunctionManager();
			Function function =
				functionManager.getFunctionContaining(currentLocation.getAddress());

			if (!isValidFunction(function)) {
				Msg.showWarn(this, null, "Cursor Must Be In a Function",
					"Selecting scoped flow requires the cursor to be " +
						"inside of a function");
				return;
			}

			try {
				ProgramSelection selection = makeReverseScopedSelection(function,
					currentProgram, currentLocation, new TaskMonitorAdapter(true));
				updateStatusText(selection);
				setSelection(selection);
			}
			catch (CancelledException e) {
				Msg.debug(this, "Calculating Reverse Scoped Flow cancelled", e);
			}
		}
	};
	action.setMenuBarData(new MenuData(
		new String[] { ToolConstants.MENU_SELECTION, "Scoped Flow", "Reverse Scoped Flow" },
		null, "Select"));

	action.setDescription("Allows user to select scoped flow to the current location.");
	action.setHelpLocation(new HelpLocation("FlowSelection", "Scoped_Flow"));
	tool.addAction(action);
}