Java Code Examples for ghidra.framework.options.Options#getCustomOption()

The following examples show how to use ghidra.framework.options.Options#getCustomOption() . 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: HeaderTest.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private void initializeOptions() {
	Options options = tool.getOptions(GhidraOptions.CATEGORY_BROWSER_FIELDS);
	String optionsName = "Address Field" + Options.DELIMITER + "Address Display Options";
	AddressFieldOptionsWrappedOption afowo =
		(AddressFieldOptionsWrappedOption) options.getCustomOption(optionsName, null);
	afowo.setRightJustify(false);
	options.setCustomOption(optionsName, afowo);

}
 
Example 2
Source File: HeaderActionsTest.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private void initializeOptions() {
	Options options = tool.getOptions(GhidraOptions.CATEGORY_BROWSER_FIELDS);
	String optionsName = "Address Field" + Options.DELIMITER + "Address Display Options";
	AddressFieldOptionsWrappedOption afowo =
		(AddressFieldOptionsWrappedOption) options.getCustomOption(optionsName, null);
	afowo.setRightJustify(false);
	options.setCustomOption(optionsName, afowo);
}
 
Example 3
Source File: CodeBrowserOptionsTest.java    From ghidra with Apache License 2.0 4 votes vote down vote up
@Test
public void testAddressFieldOptions() throws Exception {

	showTool(tool);
	loadProgram();
	Options options = tool.getOptions(GhidraOptions.CATEGORY_BROWSER_FIELDS);
	List<String> names = getOptionNames(options, "Address Field");
	assertEquals(1, names.size());
	assertEquals("Address Field.Address Display Options", names.get(0));
	AddressFieldOptionsWrappedOption afowo =
		(AddressFieldOptionsWrappedOption) options.getCustomOption(names.get(0), null);
	afowo.setShowBlockName(true);
	options.setCustomOption(names.get(0), afowo);

	cb.updateNow();
	cb.goToField(addr("0x1001000"), "Address", 0, 0);
	ListingTextField btf = (ListingTextField) cb.getCurrentField();
	String s = btf.getText();
	assertTrue(s.indexOf(":") > 0);
	afowo.setShowBlockName(false);
	options.setCustomOption(names.get(0), afowo);
	cb.updateNow();
	btf = (ListingTextField) cb.getCurrentField();
	s = btf.getText();
	assertTrue(s.indexOf(":") < 0);

	afowo.setMinimumHexDigits(4);
	options.setCustomOption(names.get(0), afowo);
	cb.updateNow();
	btf = (ListingTextField) cb.getCurrentField();
	s = btf.getText();
	assertEquals("1001000", s);

	afowo.setMinimumHexDigits(8);
	options.setCustomOption(names.get(0), afowo);
	cb.updateNow();
	btf = (ListingTextField) cb.getCurrentField();
	s = btf.getText();
	assertEquals("01001000", s);

}