Java Code Examples for ghidra.framework.options.Options#DELIMITER

The following examples show how to use ghidra.framework.options.Options#DELIMITER . 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: DomainObjectAdapterDB.java    From ghidra with Apache License 2.0 4 votes vote down vote up
/**
 * @see ghidra.framework.model.DomainObject#getOptions(java.lang.String)
 */
@Override
public Options getOptions(String propertyListName) {
	return new SubOptions(options, propertyListName, propertyListName + Options.DELIMITER);
}
 
Example 4
Source File: UnionEditorProviderTest.java    From ghidra with Apache License 2.0 4 votes vote down vote up
@Test
public void testChangeHexNumbersOption() throws Exception {
	init(complexUnion, pgmTestCat, false);
	DataType oldDt = model.viewComposite.clone(null);

	Options options = tool.getOptions("Editors");
	String hexNumbersName = "Union Editor" + Options.DELIMITER + "Show Numbers In Hex";

	// Get the hex length option value
	boolean hexLength = options.getBoolean(hexNumbersName, false);
	assertEquals(false, hexLength);
	// Check the length value is in decimal
	assertEquals(false, model.isShowingNumbersInHex());
	assertEquals("29", model.getValueAt(15, model.getLengthColumn()));
	assertEquals("87", model.getLengthAsString());

	// Set the hex length option value to Hex
	options.setBoolean(hexNumbersName, true);

	// Get the hex length option value
	hexLength = options.getBoolean(hexNumbersName, false);
	assertEquals(true, hexLength);
	// Check the value (length should still be decimal in editor)
	assertEquals(false, model.isShowingNumbersInHex());
	assertEquals("29", model.getValueAt(15, model.getLengthColumn()));
	assertEquals("87", model.getLengthAsString());

	// Close the editor
	Swing.runLater(() -> provider.closeComponent());
	waitForSwing();
	// Editor should be closed.
	assertFalse(tool.isVisible(provider));
	assertTrue(complexUnion.isEquivalent(oldDt));
	// Re-open the editor
	init(complexUnion, pgmTestCat, true);

	// Get the hex option value (length should now be hexadecimal in editor)
	hexLength = options.getBoolean(hexNumbersName, false);
	assertEquals(true, hexLength);
	// Check the value is in hexadecimal
	assertEquals(true, model.isShowingNumbersInHex());
	assertEquals("0x1d", model.getValueAt(15, model.getLengthColumn()));
	assertEquals("0x57", model.getLengthAsString());

	// Set the hex length option value to decimal
	options.setBoolean(hexNumbersName, false);

	// Get the hex option value
	hexLength = options.getBoolean(hexNumbersName, false);
	assertEquals(false, hexLength);
	// Check the value (length should still be hexadecimal in editor)
	assertEquals(true, model.isShowingNumbersInHex());
	assertEquals("0x1d", model.getValueAt(15, model.getLengthColumn()));
	assertEquals("0x57", model.getLengthAsString());

	// Close the editor
	Swing.runLater(() -> provider.closeComponent());
	waitForSwing();
	// Editor should be closed.
	assertFalse(tool.isVisible(provider));
	assertTrue(complexUnion.isEquivalent(oldDt));

	// Re-open the editor
	init(complexUnion, pgmTestCat, false);

	// Get the hex option value (length should now be decimal in editor)
	hexLength = options.getBoolean(hexNumbersName, false);
	assertEquals(false, hexLength);
	// Check the value is in hexadecimal
	assertEquals(false, model.isShowingNumbersInHex());
	assertEquals("29", model.getValueAt(15, model.getLengthColumn()));
	assertEquals("87", model.getLengthAsString());
}