Java Code Examples for ghidra.framework.options.Options#getColor()
The following examples show how to use
ghidra.framework.options.Options#getColor() .
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: MnemonicFieldFactory.java From ghidra with Apache License 2.0 | 6 votes |
/** * Constructor * @param model the model that the field belongs to. * @param hsProvider the HightLightStringProvider. * @param displayOptions the Options for display properties. * @param fieldOptions the Options for field specific properties. */ private MnemonicFieldFactory(FieldFormatModel model, HighlightProvider hsProvider, Options displayOptions, ToolOptions fieldOptions) { super(FIELD_NAME, model, hsProvider, displayOptions, fieldOptions); overrideColor = displayOptions.getColor(OVERRIDE_COLOR_OPTION, OVERRIDE_COLOR); HelpLocation hl = new HelpLocation("CodeBrowserPlugin", "Mnemonic_Field"); fieldOptions.getOptions("Mnemonic Fields").setOptionsHelpLocation(hl); fieldOptions.registerOption(SHOW_UNDERLINE_FOR_REFERENCES, true, hl, "Shows an underline on mnemonic " + "fields that have references."); underliningEnabled = fieldOptions.getBoolean(SHOW_UNDERLINE_FOR_REFERENCES, true); // Create code unit format and associated options - listen for changes codeUnitFormat = new BrowserCodeUnitFormat(fieldOptions, true); codeUnitFormat.addChangeListener(codeUnitFormatListener); }
Example 2
Source File: AbstractVariableFieldFactory.java From ghidra with Apache License 2.0 | 6 votes |
protected void initDisplayOptions(Options displayOptions) { // display options for local variables handled by FieldFactory base class colorOptionName = "Variable Color"; styleOptionName = "Variable Style"; super.initDisplayOptions(); parameterFieldOptions = new ParameterFieldOptions[2]; parameterFieldOptions[CUSTOM_PARAM_INDEX] = new ParameterFieldOptions(OptionsGui.PARAMETER_CUSTOM); parameterFieldOptions[DYNAMIC_PARAM_INDEX] = new ParameterFieldOptions(OptionsGui.PARAMETER_DYNAMIC); for (int i = 0; i < 2; i++) { parameterFieldOptions[i].color = displayOptions.getColor(parameterFieldOptions[i].getColorOptionName(), parameterFieldOptions[i].getDefaultColor()); parameterFieldOptions[i].style = displayOptions.getInt(parameterFieldOptions[i].getStyleOptionName(), -1); setMetrics(baseFont, parameterFieldOptions[i]); } }
Example 3
Source File: FunctionSignatureFieldFactory.java From ghidra with Apache License 2.0 | 6 votes |
@Override public void displayOptionsChanged(Options options, String optionName, Object oldValue, Object newValue) { super.displayOptionsChanged(options, optionName, oldValue, newValue); funRetColor = options.getColor(OptionsGui.FUN_RET_TYPE.getColorOptionName(), Color.BLACK); funNameColor = options.getColor(OptionsGui.FUN_NAME.getColorOptionName(), Color.BLACK); unresolvedThunkRefColor = displayOptions.getColor(OptionsGui.BAD_REF_ADDR.getColorOptionName(), OptionsGui.BAD_REF_ADDR.getDefaultColor()); resolvedThunkRefColor = displayOptions.getColor(OptionsGui.EXT_REF_RESOLVED.getColorOptionName(), OptionsGui.EXT_REF_RESOLVED.getDefaultColor()); funParamsColor = options.getColor(OptionsGui.FUN_PARAMS.getColorOptionName(), Color.BLACK); autoParamColor = options.getColor(OptionsGui.FUN_AUTO_PARAMS.getColorOptionName(), Color.GRAY); literalColor = options.getColor(OptionsGui.SEPARATOR.getColorOptionName(), Color.BLACK); }
Example 4
Source File: PreCommentFieldFactory.java From ghidra with Apache License 2.0 | 6 votes |
/** * Constructor * @param model the model that the field belongs to. * @param hlProvider the HightLightStringProvider. * @param displayOptions the Options for display properties. * @param fieldOptions the Options for field specific properties. */ private PreCommentFieldFactory(FieldFormatModel model, HighlightProvider hlProvider, Options displayOptions, Options fieldOptions) { super(FIELD_NAME, model, hlProvider, displayOptions, fieldOptions); fieldOptions.registerOption(FLAG_FUNCTION_ENTRY_OPTION, false, null, "Toggles the display of a pre-comment for a function entry"); fieldOptions.registerOption(FLAG_SUBROUTINE_ENTRY_OPTION, false, null, "Toggles the display of a pre-comment for a sub-routine entry"); flagFunctionEntry = fieldOptions.getBoolean(FLAG_FUNCTION_ENTRY_OPTION, false); flagSubroutineEntry = fieldOptions.getBoolean(FLAG_SUBROUTINE_ENTRY_OPTION, false); automaticCommentColor = displayOptions.getColor(OptionsGui.COMMENT_AUTO.getColorOptionName(), OptionsGui.COMMENT_AUTO.getDefaultColor()); automaticCommentStyle = displayOptions.getInt(OptionsGui.COMMENT_AUTO.getStyleOptionName(), -1); init(fieldOptions); }
Example 5
Source File: RegisterFieldFactory.java From ghidra with Apache License 2.0 | 6 votes |
private RegisterFieldFactory(FieldFormatModel model, HighlightProvider highlightProvider, Options displayOptions, Options fieldOptions) { super(FIELD_NAME, model, highlightProvider, displayOptions, fieldOptions); regComp = new RegComparator(); initDisplayOptions(); fieldOptions.registerOption(DISPLAY_HIDDEN_REGISTERS_OPTION_NAME, false, null, "Shows/hides context registers"); fieldOptions.registerOption(DISPLAY_DEFAULT_REGISTER_VALUES_OPTION_NAME, false, null, "Shows/hides default register values"); regColor = displayOptions.getColor(OptionsGui.REGISTERS.getColorOptionName(), getDefaultColor()); showHiddenRegisters = fieldOptions.getBoolean(DISPLAY_HIDDEN_REGISTERS_OPTION_NAME, false); showDefaultValues = fieldOptions.getBoolean(DISPLAY_DEFAULT_REGISTER_VALUES_OPTION_NAME, false); }
Example 6
Source File: PostCommentFieldFactory.java From ghidra with Apache License 2.0 | 6 votes |
/** * Constructor * @param model the model that the field belongs to. * @param hlProvider the HightLightStringProvider. * @param displayOptions the Options for display properties. * @param fieldOptions the Options for field specific properties. */ private PostCommentFieldFactory(FieldFormatModel model, HighlightProvider hlProvider, Options displayOptions, Options fieldOptions) { super(FIELD_NAME, model, hlProvider, displayOptions, fieldOptions); fieldOptions.registerOption(FLAG_FUNCTION_EXIT_OPTION, false, null, "Toggles the display of a post-comment for a function exit"); fieldOptions.registerOption(FLAG_TERMINATOR_OPTION, false, null, "Toggles the display of a jump/return post-comments"); fieldOptions.registerOption(LINES_AFTER_BLOCKS_OPTION, 0, null, "The number of lines to display after basic blocks"); flagFunctionExits = fieldOptions.getBoolean(FLAG_FUNCTION_EXIT_OPTION, false); flagJMPsRETs = fieldOptions.getBoolean(FLAG_TERMINATOR_OPTION, false); nLinesAfterBlocks = fieldOptions.getInt(LINES_AFTER_BLOCKS_OPTION, 0); automaticCommentColor = displayOptions.getColor(OptionsGui.COMMENT_AUTO.getColorOptionName(), OptionsGui.COMMENT_AUTO.getDefaultColor()); automaticCommentStyle = displayOptions.getInt(OptionsGui.COMMENT_AUTO.getStyleOptionName(), -1); init(fieldOptions); }
Example 7
Source File: FunctionCallFixupFieldFactory.java From ghidra with Apache License 2.0 | 5 votes |
@Override public void displayOptionsChanged(Options options, String optionName, Object oldValue, Object newValue) { super.displayOptionsChanged(options, optionName, oldValue, newValue); literalColor = options.getColor(OptionsGui.FUN_CALL_FIXUP.getColorOptionName(), OptionsGui.FUN_CALL_FIXUP.getDefaultColor()); fixupColor = options.getColor(OptionsGui.FUN_CALL_FIXUP.getColorOptionName(), OptionsGui.FUN_CALL_FIXUP.getDefaultColor()); }
Example 8
Source File: FunctionCallFixupFieldFactory.java From ghidra with Apache License 2.0 | 5 votes |
/** * Constructor * @param model the model that the field belongs to. * @param hlProvider the HightLightProvider. * @param displayOptions the Options for display properties. * @param fieldOptions the Options for field specific properties. */ public FunctionCallFixupFieldFactory(FieldFormatModel model, HighlightProvider hlProvider, Options displayOptions, Options fieldOptions) { super(FIELD_NAME, model, hlProvider, displayOptions, fieldOptions); literalColor = displayOptions.getColor(OptionsGui.SEPARATOR.getColorOptionName(), OptionsGui.SEPARATOR.getDefaultColor()); fixupColor = displayOptions.getColor(OptionsGui.FUN_CALL_FIXUP.getColorOptionName(), OptionsGui.FUN_CALL_FIXUP.getDefaultColor()); }
Example 9
Source File: OperandFieldHelper.java From ghidra with Apache License 2.0 | 5 votes |
/** * Called when the fonts are first initialized or when one of the options * changes. It looks up all the color settings and resets the its values. */ private void setOptions(Options options) { separatorAttributes.colorAttribute = options.getColor( OptionsGui.SEPARATOR.getColorOptionName(), OptionsGui.SEPARATOR.getDefaultColor()); separatorAttributes.styleAttribute = options.getInt(OptionsGui.SEPARATOR.getStyleOptionName(), -1); scalarAttributes.colorAttribute = options.getColor(OptionsGui.CONSTANT.getColorOptionName(), OptionsGui.CONSTANT.getDefaultColor()); scalarAttributes.styleAttribute = options.getInt(OptionsGui.CONSTANT.getStyleOptionName(), -1); variableRefAttributes.colorAttribute = options.getColor( OptionsGui.VARIABLE.getColorOptionName(), OptionsGui.VARIABLE.getDefaultColor()); variableRefAttributes.styleAttribute = options.getInt(OptionsGui.VARIABLE.getStyleOptionName(), -1); addressAttributes.colorAttribute = options.getColor(OptionsGui.ADDRESS.getColorOptionName(), OptionsGui.ADDRESS.getDefaultColor()); addressAttributes.styleAttribute = options.getInt(OptionsGui.ADDRESS.getStyleOptionName(), -1); externalRefAttributes.colorAttribute = options.getColor(OptionsGui.EXT_REF_RESOLVED.getColorOptionName(), OptionsGui.EXT_REF_RESOLVED.getDefaultColor()); externalRefAttributes.styleAttribute = options.getInt(OptionsGui.EXT_REF_RESOLVED.getStyleOptionName(), -1); badRefAttributes.colorAttribute = options.getColor(OptionsGui.BAD_REF_ADDR.getColorOptionName(), OptionsGui.BAD_REF_ADDR.getDefaultColor()); badRefAttributes.styleAttribute = options.getInt(OptionsGui.BAD_REF_ADDR.getStyleOptionName(), -1); registerAttributes.colorAttribute = options.getColor( OptionsGui.REGISTERS.getColorOptionName(), OptionsGui.REGISTERS.getDefaultColor()); registerAttributes.styleAttribute = options.getInt(OptionsGui.REGISTERS.getStyleOptionName(), -1); }
Example 10
Source File: ThunkedFunctionFieldFactory.java From ghidra with Apache License 2.0 | 5 votes |
@Override public void displayOptionsChanged(Options options, String optionName, Object oldValue, Object newValue) { super.displayOptionsChanged(options, optionName, oldValue, newValue); literalColor = options.getColor(OptionsGui.FUN_CALL_FIXUP.getColorOptionName(), OptionsGui.FUN_CALL_FIXUP.getDefaultColor()); unresolvedThunkRefColor = displayOptions.getColor(OptionsGui.BAD_REF_ADDR.getColorOptionName(), OptionsGui.BAD_REF_ADDR.getDefaultColor()); resolvedThunkRefColor = displayOptions.getColor(OptionsGui.EXT_REF_RESOLVED.getColorOptionName(), OptionsGui.EXT_REF_RESOLVED.getDefaultColor()); }
Example 11
Source File: FunctionSignatureSourceFieldFactory.java From ghidra with Apache License 2.0 | 5 votes |
/** * Constructor * @param model the model that the field belongs to. * @param hlProvider the HightLightProvider. * @param displayOptions the Options for display properties. * @param fieldOptions the Options for field specific properties. */ public FunctionSignatureSourceFieldFactory(FieldFormatModel model, HighlightProvider hlProvider, Options displayOptions, Options fieldOptions) { super(FIELD_NAME, model, hlProvider, displayOptions, fieldOptions); literalColor = displayOptions.getColor(OptionsGui.SEPARATOR.getColorOptionName(), OptionsGui.SEPARATOR.getDefaultColor()); }
Example 12
Source File: FunctionPurgeFieldFactory.java From ghidra with Apache License 2.0 | 5 votes |
private FunctionPurgeFieldFactory(FieldFormatModel model, HighlightProvider hlProvider, Options displayOptions, Options fieldOptions) { super(FIELD_NAME, model, hlProvider, displayOptions, fieldOptions); color = displayOptions.getColor(OptionsGui.BYTES.getColorOptionName(), OptionsGui.BYTES.getDefaultColor()); }
Example 13
Source File: FunctionSignatureFieldFactory.java From ghidra with Apache License 2.0 | 5 votes |
/** * Constructor * @param model the model that the field belongs to. * @param hlProvider the HightLightProvider. * @param displayOptions the Options for display properties. * @param fieldOptions the Options for field specific properties. */ public FunctionSignatureFieldFactory(FieldFormatModel model, HighlightProvider hlProvider, Options displayOptions, Options fieldOptions) { super(FIELD_NAME, model, hlProvider, displayOptions, fieldOptions); fieldOptions.registerOption(DISPLAY_NAMESPACE, false, null, "Prepends namespaces to labels that are not in the global namespace."); displayFunctionScope = fieldOptions.getBoolean(DISPLAY_NAMESPACE, false); funRetColor = displayOptions.getColor(OptionsGui.FUN_RET_TYPE.getColorOptionName(), OptionsGui.FUN_RET_TYPE.getDefaultColor()); funNameColor = displayOptions.getColor(OptionsGui.FUN_NAME.getColorOptionName(), OptionsGui.FUN_NAME.getDefaultColor()); unresolvedThunkRefColor = displayOptions.getColor(OptionsGui.BAD_REF_ADDR.getColorOptionName(), OptionsGui.BAD_REF_ADDR.getDefaultColor()); resolvedThunkRefColor = displayOptions.getColor(OptionsGui.EXT_REF_RESOLVED.getColorOptionName(), OptionsGui.EXT_REF_RESOLVED.getDefaultColor()); funParamsColor = displayOptions.getColor(OptionsGui.FUN_PARAMS.getColorOptionName(), OptionsGui.FUN_PARAMS.getDefaultColor()); autoParamColor = displayOptions.getColor(OptionsGui.FUN_AUTO_PARAMS.getColorOptionName(), OptionsGui.FUN_PARAMS.getDefaultColor()); literalColor = displayOptions.getColor(OptionsGui.SEPARATOR.getColorOptionName(), OptionsGui.SEPARATOR.getDefaultColor()); }
Example 14
Source File: StackDepthFieldFactory.java From ghidra with Apache License 2.0 | 5 votes |
private StackDepthFieldFactory(FieldFormatModel model, HighlightProvider hsProvider, Options displayOptions, Options fieldOptions) { super(FIELD_NAME, model, hsProvider, displayOptions, fieldOptions); color = displayOptions.getColor(OptionsGui.BYTES.getColorOptionName(), OptionsGui.BYTES.getDefaultColor()); }
Example 15
Source File: PcodeFieldFactory.java From ghidra with Apache License 2.0 | 5 votes |
public PcodeFieldFactory(String name, FieldFormatModel model, HighlightProvider highlightProvider, Options displayOptions, Options fieldOptions) { super(name, model, highlightProvider, displayOptions, fieldOptions); setWidth(300); color = displayOptions.getColor(OptionsGui.BYTES.getColorOptionName(), OptionsGui.BYTES.getDefaultColor()); style = displayOptions.getInt(OptionsGui.BYTES.getStyleOptionName(), -1); formatter = new PcodeFormatter(); setColors(displayOptions); setOptions(fieldOptions); }
Example 16
Source File: DecompileOptions.java From ghidra with Apache License 2.0 | 5 votes |
private void grabFromToolOptions(Plugin ownerPlugin) { if (ownerPlugin == null) { return; } PluginTool tool = ownerPlugin.getTool(); Options toolOptions = tool.getOptions(CATEGORY_BROWSER_FIELDS); middleMouseHighlightColor = toolOptions.getColor(HIGHLIGHT_COLOR_NAME, HIGHLIGHT_MIDDLE_MOUSE_DEF); CURSOR_MOUSE_BUTTON_NAMES mouseEvent = toolOptions.getEnum(CURSOR_HIGHLIGHT_BUTTON_NAME, CURSOR_MOUSE_BUTTON_NAMES.MIDDLE); middleMouseHighlightButton = mouseEvent.getMouseEventID(); }
Example 17
Source File: FunctionSignatureSourceFieldFactory.java From ghidra with Apache License 2.0 | 4 votes |
@Override public void displayOptionsChanged(Options options, String optionName, Object oldValue, Object newValue) { super.displayOptionsChanged(options, optionName, oldValue, newValue); literalColor = options.getColor(OptionsGui.SEPARATOR.getColorOptionName(), Color.BLACK); }
Example 18
Source File: DisassembledViewPluginTest.java From ghidra with Apache License 2.0 | 4 votes |
/** * Tests the plugin's response to changes in the user display preferences * as they are changed in the Options for the code browser. * * @throws Exception If there is a problem opening the program. */ @Test public void testDisplayConfiguration() throws Exception { // test that the display characteristics change with the Options // values openProgram("notepad"); tool.showComponentProvider(componentProvider, true); waitForPostedSwingRunnables(); String[] fieldNames = { "selectedAddressColor", "addressForegroundColor", "backgroundColor", "font" }; // get the current display options Map<String, Object> optionsMap = new HashMap<>(); for (String fieldName : fieldNames) { optionsMap.put(fieldName, getInstanceField(fieldName, componentProvider)); } // change the global options for the plugin's display options Options opt = tool.getOptions(GhidraOptions.CATEGORY_BROWSER_FIELDS); // get and change each options of interest String optionToChange = GhidraOptions.OPTION_SELECTION_COLOR; Color currentColor = opt.getColor(optionToChange, (Color) optionsMap.get("selectedAddressColor")); opt.setColor(optionToChange, deriveNewColor(currentColor)); // the rest of the options to change are stored under a different // options node opt = tool.getOptions(GhidraOptions.CATEGORY_BROWSER_DISPLAY); optionToChange = (String) getInstanceField("ADDRESS_COLOR_OPTION", componentProvider); currentColor = opt.getColor(optionToChange, (Color) optionsMap.get("addressForegroundColor")); opt.setColor(optionToChange, deriveNewColor(currentColor)); optionToChange = (String) getInstanceField("BACKGROUND_COLOR_OPTION", componentProvider); currentColor = opt.getColor(optionToChange, (Color) optionsMap.get("backgroundColor")); opt.setColor(optionToChange, deriveNewColor(currentColor)); optionToChange = (String) getInstanceField("ADDRESS_FONT_OPTION", componentProvider); Font currentFont = opt.getFont(optionToChange, (Font) optionsMap.get("font")); opt.setFont(optionToChange, currentFont.deriveFont((float) currentFont.getSize() + 1)); // now make sure that the changes have been propogated for (int i = 0; i < fieldNames.length; i++) { Object newValue = getInstanceField(fieldNames[i], componentProvider); assertTrue("The old value has not changed in response to " + "changing the options. Value: " + fieldNames[i], !(newValue.equals(optionsMap.get(fieldNames[i])))); } }
Example 19
Source File: FunctionGraphOptions.java From ghidra with Apache License 2.0 | 4 votes |
public void loadOptions(Options options) { conditionalJumpEdgeColor = options.getColor(EDGE_COLOR_CONDITIONAL_JUMP_KEY, conditionalJumpEdgeColor); unconditionalJumpEdgeColor = options.getColor(EDGE_UNCONDITIONAL_JUMP_COLOR_KEY, unconditionalJumpEdgeColor); fallthroughEdgeColor = options.getColor(EDGE_FALLTHROUGH_COLOR_KEY, fallthroughEdgeColor); conditionalJumpEdgeHighlightColor = options.getColor( EDGE_CONDITIONAL_JUMP_HIGHLIGHT_COLOR_KEY, conditionalJumpEdgeHighlightColor); unconditionalJumpEdgeHighlightColor = options.getColor( EDGE_UNCONDITIONAL_JUMP_HIGHLIGHT_COLOR_KEY, unconditionalJumpEdgeHighlightColor); fallthroughEdgeHighlightColor = options.getColor(EDGE_FALLTHROUGH_HIGHLIGHT_COLOR_KEY, fallthroughEdgeHighlightColor); relayoutOption = options.getEnum(RELAYOUT_OPTIONS_KEY, relayoutOption); navigationHistoryChoice = options.getEnum(NAVIGATION_HISTORY_KEY, NavigationHistoryChoices.VERTEX_CHANGES); useAnimation = options.getBoolean(SHOW_ANIMATION_OPTIONS_KEY, useAnimation); useMouseRelativeZoom = options.getBoolean(USE_MOUSE_RELATIVE_ZOOM_KEY, useMouseRelativeZoom); useCondensedLayout = options.getBoolean(USE_CONDENSED_LAYOUT_KEY, useCondensedLayout); useFullSizeTooltip = options.getBoolean(USE_FULL_SIZE_TOOLTIP_KEY, useFullSizeTooltip); viewRestoreOption = options.getEnum(VIEW_RESTORE_OPTIONS_KEY, ViewRestoreOption.START_FULLY_ZOOMED_OUT); scrollWheelPans = options.getBoolean(SCROLL_WHEEL_PANS_KEY, scrollWheelPans); defaultGroupBackgroundColor = options.getColor(DEFAULT_GROUP_BACKGROUND_COLOR_KEY, DEFAULT_GROUP_BACKGROUND_COLOR); updateGroupColorsAutomatically = options.getBoolean(UPDATE_GROUP_AND_UNGROUP_COLORS, updateGroupColorsAutomatically); Set<Entry<String, FGLayoutOptions>> entries = layoutOptionsByName.entrySet(); for (Entry<String, FGLayoutOptions> entry : entries) { String layoutName = entry.getKey(); FGLayoutOptions layoutOptions = entry.getValue(); Options layoutToolOptions = options.getOptions(layoutName); layoutOptions.loadOptions(layoutToolOptions); } }
Example 20
Source File: FunctionTagFieldFactory.java From ghidra with Apache License 2.0 | 3 votes |
/** * Constructor * * @param model the model that the field belongs to. * @param hsProvider the HightLightStringProvider. * @param displayOptions the Options for display properties. * @param fieldOptions the Options for field specific properties. * @param serviceProvider the provider for services. */ private FunctionTagFieldFactory(FieldFormatModel model, HighlightProvider hlProvider, Options displayOptions, Options fieldOptions) { super(FIELD_NAME, model, hlProvider, displayOptions, fieldOptions); color = displayOptions.getColor(OptionsGui.FUN_TAG.getColorOptionName(), OptionsGui.FUN_TAG.getDefaultColor()); literalColor = displayOptions.getColor(OptionsGui.SEPARATOR.getColorOptionName(), OptionsGui.SEPARATOR.getDefaultColor()); }