docking.action.ToolBarData Java Examples

The following examples show how to use docking.action.ToolBarData. 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: SampleGraphProvider.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private void createActions() {

		ToggleDockingAction filterAction =
			new ToggleDockingAction(SHOW_FILTER_ACTION_NAME, plugin.getName()) {

				@Override
				public void actionPerformed(ActionContext context) {
					showFilterPanel(isSelected());
				}
			};

		filterAction.setToolBarData(new ToolBarData(Icons.CONFIGURE_FILTER_ICON, "A"));
		filterAction.setHelpLocation(SampleGraphPlugin.DEFAULT_HELP);
		addLocalAction(filterAction);

		addLayoutAction();
	}
 
Example #2
Source File: NavigateToFunctionAction.java    From ghidra with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor
 * 
 * @param provider the function comparison provider containing this action
 */
public NavigateToFunctionAction(MultiFunctionComparisonProvider provider) {
	super("Navigate To Selected Function", provider.getName());

	goToService = provider.getTool().getService(GoToService.class);

	setEnabled(true);
	setSelected(false);
	ToolBarData newToolBarData = new ToolBarData(NAV_FUNCTION_ICON);
	setToolBarData(newToolBarData);
	setDescription(
		HTMLUtilities.toHTML("Toggle <b>On</b> means to navigate to whatever " +
			"function is selected in the comparison panel, when focus changes or" +
			"a new function is selected."));
	setHelpLocation(
		new HelpLocation(MultiFunctionComparisonPanel.HELP_TOPIC, "Navigate_To_Function"));

	addFocusListeners(provider);
	addChangeListeners(provider);
}
 
Example #3
Source File: ToolBarManager.java    From ghidra with Apache License 2.0 6 votes vote down vote up
public void addAction(DockingActionIf action) {
	ToolBarData toolBarData = action.getToolBarData();
	if (toolBarData == null) {
		return;
	}

	toolBar = null; // invalidate the current toolbar

	String group = toolBarData.getToolBarGroup();
	List<ToolBarItemManager> items = groupToItemsMap.get(group);
	if (items == null) {
		items = new ArrayList<>();
		groupToItemsMap.put(group, items);
	}
	items.add(new ToolBarItemManager(action, windowManager));

	Collections.sort(items, toolBarItemComparator);
}
 
Example #4
Source File: ToolBarManager.java    From ghidra with Apache License 2.0 6 votes vote down vote up
/**
 * Removes the action from the toolbar.
 * @param action the action to be removed.
 */
public void removeAction(DockingActionIf action) {
	ToolBarData toolBarData = action.getToolBarData();
	if (toolBarData == null) {
		return;
	}

	String group = toolBarData.getToolBarGroup();
	List<ToolBarItemManager> groupItems = groupToItemsMap.get(group);
	if (groupItems == null) {
		return; // must have been cleared already
	}
	Iterator<ToolBarItemManager> it = groupItems.iterator();
	while (it.hasNext()) {
		ToolBarItemManager item = it.next();
		if (item.getAction() == action) {
			item.dispose();
			it.remove();
			toolBar = null; // trigger a rebuild of the menu
		}
	}

	if (groupItems.isEmpty()) {
		groupToItemsMap.remove(group); // no actions left
	}
}
 
Example #5
Source File: ToolBarManager.java    From ghidra with Apache License 2.0 6 votes vote down vote up
@Override
public int compare(ToolBarItemManager t1, ToolBarItemManager t2) {
	DockingActionIf action1 = t1.getAction();
	DockingActionIf action2 = t2.getAction();
	ToolBarData toolBarData1 = action1.getToolBarData();
	ToolBarData toolBarData2 = action2.getToolBarData();
	String subGroup1 = toolBarData1.getToolBarSubGroup();
	String subGroup2 = toolBarData2.getToolBarSubGroup();

	int result = subGroup1.compareTo(subGroup2);
	if (result != 0) {
		return result;
	}

	// when the group is the same, sort by the owner (this results in 
	// insertion-based sorting for actions that come from the same owner)
	String name1 = action1.getOwner();
	String name2 = action2.getOwner();
	return name1.compareTo(name2);
}
 
Example #6
Source File: InterpreterComponentProvider.java    From ghidra with Apache License 2.0 6 votes vote down vote up
/**
 * Overridden so that we can add our custom actions for transient tools.
 */
@Override
public void setTransient() {
	DockingAction disposeAction = new DockingAction("Remove Interpreter", getName()) {
		@Override
		public void actionPerformed(ActionContext context) {
			int choice = OptionDialog.showYesNoDialog(panel, "Remove Interpreter?",
				"Are you sure you want to permanently close the interpreter?");
			if (choice == OptionDialog.NO_OPTION) {
				return;
			}

			InterpreterComponentProvider.this.dispose();
		}
	};
	disposeAction.setDescription("Remove interpreter from tool");
	disposeAction.setToolBarData(new ToolBarData(Icons.STOP_ICON, null));
	disposeAction.setEnabled(true);

	addLocalAction(disposeAction);
}
 
Example #7
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 #8
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 #9
Source File: FilterAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
FilterAction(DataWindowPlugin plugin) {
	super("Filter Data Types", plugin.getName());
	this.plugin = plugin;
	setDescription("Filters table so only specified types are displayed");
	setEnabled(true);
	setToolBarData(new ToolBarData(Icons.CONFIGURE_FILTER_ICON));
	setSelected(false);
}
 
Example #10
Source File: FilterPointersAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public FilterPointersAction(DataTypeManagerPlugin plugin) {
	super("Filter Pointers", plugin.getName());

	this.setToolBarData(new ToolBarData(FILTER_POINTERS_ICON, "filters"));

	setDescription(HTMLUtilities.toHTML(
		"Toggle whether or not Pointers are\n" + "displayed in the Data Type Manager tree."));
	setSelected(true);
	setEnabled(true);
}
 
Example #11
Source File: FilterArraysAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public FilterArraysAction(DataTypeManagerPlugin plugin) {
	super("Filter Arrays", plugin.getName());

	this.setToolBarData(new ToolBarData(FILTER_ARRAYS_ICON, "filters"));

	setDescription(HTMLUtilities.toHTML(
		"Toggle whether or not Arrays are\n" + "displayed in the Data Type Manager tree."));
	setSelected(true);
	setEnabled(true);
}
 
Example #12
Source File: SetExternalProgramAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public SetExternalProgramAction(SymbolTreePlugin plugin, SymbolTreeProvider provider) {
	super("Set External Program", plugin.getName());
	this.plugin = plugin;
	this.provider = provider;
	this.setPopupMenuData(
		new MenuData(new String[] { "Set External Program" }, EDIT_ICON, "0External"));

	this.setToolBarData(new ToolBarData(EDIT_ICON, null));

	setEnabled(false);
}
 
Example #13
Source File: GoToToggleAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public GoToToggleAction(SymbolTreePlugin plugin) {
	super("Navigation", plugin.getName());

	setEnabled(true);
	this.setToolBarData(new ToolBarData(Icons.NAVIGATE_ON_INCOMING_EVENT_ICON, null));

	setSelected(false);
	setDescription(HTMLUtilities.toHTML("Toggle <b>On</b> means to select the symbol\n" +
		"that corresponds to the current location."));
}
 
Example #14
Source File: InterpreterComponentProvider.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private void createActions() {

		DockingAction clearAction = new DockingAction("Clear Interpreter", getName()) {
			@Override
			public void actionPerformed(ActionContext context) {
				clear();
			}
		};
		clearAction.setDescription("Clear Interpreter");
		clearAction.setToolBarData(new ToolBarData(ResourceManager.loadImage(CLEAR_GIF), null));
		clearAction.setEnabled(true);

		addLocalAction(clearAction);
	}
 
Example #15
Source File: AbstractSelectionNavigationAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
protected AbstractSelectionNavigationAction(String name, String owner, JTable table) {
	super(name, owner, false);
	this.table = table;

	selectionListener = new SelectionListener();

	setToolBarData(new ToolBarData(ICON));
	setDescription(HTMLUtilities.toHTML("Toggle <b>on</b> means to navigate to the location\n" +
		"in the program that corresponds to the selected row,\n as the selection changes."));
	setHelpLocation(new HelpLocation("Search", "Selection_Navigation"));
	setEnabled(true);
	setSelected(true); // toggle button; enabled by default

	initialize();
}
 
Example #16
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 #17
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 #18
Source File: MatchTableSelectionAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public MatchTableSelectionAction(VTMatchTableProvider matchTableProvider) {
	super(NAME, VTPlugin.OWNER);
	this.matchTableProvider = matchTableProvider;

	setToolBarData(new ToolBarData(null, MENU_GROUP));
	setDescription("Adjust the Apply Mark-up Settings for Applying Matches");
	setEnabled(true);
	setPerformActionOnPrimaryButtonClick(false); // pressing button shows drop-down

	HelpLocation helpLocation =
		new HelpLocation("VersionTrackingPlugin", "Match_Table_Selection");
	setHelpLocation(helpLocation);

	Icon noSelectionTrackingIcon = ResourceManager.loadImage("images/table_delete.png");
	Icon trackMatchSelectionIcon = ResourceManager.loadImage("images/table_go.png");
	Icon trackRowIndexSelectionIcon = ResourceManager.loadImage("images/table_gear.png");

	ActionState<TableSelectionTrackingState> trackSelectedIndexActionState =
		new ActionState<TableSelectionTrackingState>("Track Selected Index",
			trackRowIndexSelectionIcon, MAINTAIN_SELECTED_ROW_INDEX);
	trackSelectedIndexActionState.setHelpLocation(helpLocation);

	ActionState<TableSelectionTrackingState> trackMatchSelectionActionState =
		new ActionState<TableSelectionTrackingState>("Track Selected Match",
			trackMatchSelectionIcon, MAINTAIN_SELECTED_ROW_VALUE);
	trackMatchSelectionActionState.setHelpLocation(helpLocation);

	ActionState<TableSelectionTrackingState> noSelectionTrackingActionState =
		new ActionState<TableSelectionTrackingState>("No Selection Tracking",
			noSelectionTrackingIcon, NO_SELECTION_TRACKING);
	noSelectionTrackingActionState.setHelpLocation(helpLocation);

	addActionState(trackSelectedIndexActionState);
	addActionState(trackMatchSelectionActionState);
	addActionState(noSelectionTrackingActionState);

	setCurrentActionState(trackSelectedIndexActionState); // default
}
 
Example #19
Source File: DomainFolderChangesDisplayComponentProvider.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private void createAction() {
	clearAction = new DockingAction("Clear Display", getName()) {
		@Override
		public void actionPerformed(ActionContext context) {
			clear();
		}
	};
	clearAction.setEnabled(true);
	ImageIcon icon = ResourceManager.loadImage("images/erase16.png");
	clearAction.setToolBarData(new ToolBarData(icon));
	addLocalAction(clearAction);
}
 
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: DontCareMarkupItemAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public DontCareMarkupItemAction(VTController controller, boolean addToToolbar) {
	super(controller, "Don't Care");

	if (addToToolbar) {
		setToolBarData(new ToolBarData(DONT_CARE_ICON, MENU_GROUP));
	}
	MenuData menuData = new MenuData(new String[] { "Don't Care" }, DONT_CARE_ICON, MENU_GROUP);
	setPopupMenuData(menuData);
	setEnabled(false);
	setHelpLocation(new HelpLocation("VersionTrackingPlugin", "Tag_Markup_Item_Dont_Care"));
}
 
Example #22
Source File: DontKnowMarkupItemAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public DontKnowMarkupItemAction(VTController controller, boolean addToToolbar) {
	super(controller, "Don't Know");

	if (addToToolbar) {
		setToolBarData(new ToolBarData(DONT_KNOW_ICON, MENU_GROUP));
	}
	MenuData menuData = new MenuData(new String[] { "Don't Know" }, DONT_KNOW_ICON, MENU_GROUP);
	setPopupMenuData(menuData);
	setEnabled(false);
	setHelpLocation(new HelpLocation("VersionTrackingPlugin", "Tag_Markup_Item_Dont_Know"));
}
 
Example #23
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"));
}
 
Example #24
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 #25
Source File: ProviderToggleAction.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public ProviderToggleAction( ComponentProviderAdapter provider ) {
    super( "Show " + provider.getTitle(), provider.getOwner(), false );
    this.componentProvider = provider;
    
    setSelected( true );
    setToolBarData( new ToolBarData( provider.getIcon(), TOOL_BAR_GROUP ) );
    
    installVisibilityTracker( provider );
}
 
Example #26
Source File: ShowInfoComponentProvider.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private void createActions() {
	clearAction = new DockingAction("Clear Text Area", getName()) {
		@Override
		public void actionPerformed(ActionContext context) {
			textArea.setText("");
		}
	};
	clearAction.setToolBarData(new ToolBarData(CLEAR_ICON, null));

	clearAction.setEnabled(true);
	tool.addLocalAction(this, clearAction);
}
 
Example #27
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 #28
Source File: SkeletonPlugin.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private void createActions() {
	action = new DockingAction("My Action", getName()) {
		@Override
		public void actionPerformed(ActionContext context) {
			Msg.showInfo(getClass(), panel, "Custom Action", "Hello!");
		}
	};
	action.setToolBarData(new ToolBarData(Icons.ADD_ICON, null));
	action.setEnabled(true);
	action.markHelpUnnecessary();
	dockingTool.addLocalAction(this, action);
}
 
Example #29
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 #30
Source File: EmptyBorderToggleButton.java    From ghidra with Apache License 2.0 5 votes vote down vote up
protected void initFromAction(DockingActionIf action) {
	if (action == null) {
		return;
	}
	ToolBarData toolBarData = action.getToolBarData();
	Icon icon = toolBarData == null ? null : toolBarData.getIcon();
	setIcon(icon);
	String tt = action.getDescription();
	if (tt == null || tt.length() == 0) {
		tt = action.getName();
	}
	setToolTipText(tt);
	setEnabled(action.isEnabled());
}