Class CategoryPathSelectionEditor

java.lang.Object
javax.swing.AbstractCellEditor
ghidra.app.util.datatype.CategoryPathSelectionEditor
All Implemented Interfaces:
Serializable, CellEditor

public class CategoryPathSelectionEditor extends AbstractCellEditor
An editor that is used to show the DropDownSelectionTextField for the entering of category paths by name and offers the user of a completion window. This editor also provides a browse button that when pressed will show a data type tree so that the user may browse a tree of known category paths.

Stand Alone Usage
In order to use this component directly you need to call getEditorComponent(). This will give you a Component for editing.

In order to know when changes are made to the component you need to add a DocumentListener via the addDocumentListener(DocumentListener) method. The added listener will be notified as the user enters text into the editor's text field.

See Also:
  • Constructor Details

    • CategoryPathSelectionEditor

      public CategoryPathSelectionEditor(ServiceProvider serviceProvider)
      Creates a new instance.
      Parameters:
      serviceProvider - ServiceProvider
  • Method Details

    • setConsumeEnterKeyPress

      public void setConsumeEnterKeyPress(boolean consume)
      Sets whether this editor should consumer Enter key presses
      Parameters:
      consume - true to consume
      See Also:
    • createDropDownSelectionTextField

      protected DropDownSelectionTextField<CategoryPath> createDropDownSelectionTextField(ghidra.app.util.datatype.CategoryPathSelectionEditor.CategoryPathDropDownSelectionDataModel model)
    • getCellEditorValue

      public CategoryPath getCellEditorValue()
      Retrieve the value in the cell.
      Returns:
      categoryPath of the selected value from the drop-down
    • getCellEditorValueAsCategoryPath

      public CategoryPath getCellEditorValueAsCategoryPath()
      If a path was selected from the drop-down list, it is already well-formed and cannot be null.
      Returns:
      the selected category path as CategoryPath
    • getCellEditorValueAsText

      public String getCellEditorValueAsText()
      Returns the text value of the editor's text field.
      Returns:
      the text value of the editor's text field.
    • getEditorComponent

      public JComponent getEditorComponent()
      Returns the component that allows the user to edit.
      Returns:
      the component that allows the user to edit.
    • getDropDownTextField

      public DropDownSelectionTextField<CategoryPath> getDropDownTextField()
      Retrieve the drop-down text field that holds the category path collection.
      Returns:
      CategoryPath drop-down selection text field object
    • getBrowseButton

      public JButton getBrowseButton()
      The browse button which opens a menu with the Category Path collection from the data manager.
      Returns:
      browseButton
    • setDefaultSelectedTreePath

      public void setDefaultSelectedTreePath(TreePath path)
      Sets the initially selected node in the data type tree that the user can choose to show.
      Parameters:
      path - The path to set
    • requestFocus

      public void requestFocus()
      Place focus on the selectionField.
    • setCellEditorValueAsText

      public void setCellEditorValueAsText(String text)
      Sets the cell editor value as the entered String text.
      Parameters:
      text - String input
    • setCellEditorValue

      public void setCellEditorValue(CategoryPath path)
      Sets the value to be edited on this cell editor.
      Parameters:
      path - The data type which is to be edited.
    • addDocumentListener

      public void addDocumentListener(DocumentListener listener)
      Adds a document listener to the text field editing component of this editor so that users can be notified when the text contents of the editor change.
      Parameters:
      listener - the listener to add.
    • removeDocumentListener

      public void removeDocumentListener(DocumentListener listener)
      Removes a previously added document listener.
      Parameters:
      listener - the listener to remove.
    • addFocusListener

      public void addFocusListener(FocusListener listener)
      Add the provided FocusListener to the selectionField.
      Parameters:
      listener - FocusListener
    • removeFocusListener

      public void removeFocusListener(FocusListener listener)
      Remove the provided FocusListener from the selectionField.
      Parameters:
      listener - FocusListener
    • setTabCommitsEdit

      public void setTabCommitsEdit(boolean doesCommit)
      Toggle Tab key commits an edit. Sets the traversal key enabled field of the selectionField.
      Parameters:
      doesCommit - Boolean
    • getNavigationDirection

      public NavigationDirection getNavigationDirection()
      Returns the direction of the user triggered navigation; null if the user did not trigger navigation out of this component.
      Returns:
      the direction
    • setEnabled

      public void setEnabled(boolean createStructureByName)
      Enable or disable the Category Path Text Field.
      Parameters:
      createStructureByName - Boolean
    • isEnabled

      public boolean isEnabled()
      Determine whether the Category Path Text Field is enabled.
      Returns:
      isEnabled boolean