Class DataTypeSelectionEditor
- java.lang.Object
- 
- javax.swing.AbstractCellEditor
- 
- ghidra.app.util.datatype.DataTypeSelectionEditor
 
 
- 
- All Implemented Interfaces:
- java.io.Serializable,- javax.swing.CellEditor
 
 public class DataTypeSelectionEditor extends javax.swing.AbstractCellEditorAn editor that is used to show theDropDownSelectionTextFieldfor the entering of data types 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 data types.The typical usage of this class is in conjunction with the DataTypeChooserDialog. The dialog uses this editor as part of its DataType selection process. Users seeking a dialog that allows users to choose DataTypes are encouraged to use that dialog. If you wish to add this editor to a widget directly, then see below.Stand Alone Usage 
 In order to use this component directly you need to callgetEditorComponent(). 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. Then, to determine when there is as valid DataType in the field you may callvalidateUserSelection().- See Also:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description DataTypeSelectionEditor(DataTypeManagerService service, int maxSize, DataTypeParser.AllowedDataTypes allowedDataTypes)DataTypeSelectionEditor(ServiceProvider serviceProvider, int maxSize, DataTypeParser.AllowedDataTypes allowedDataTypes)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDocumentListener(javax.swing.event.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.voidaddFocusListener(java.awt.event.FocusListener listener)booleancontainsValidDataType()javax.swing.JButtongetBrowseButton()java.lang.ObjectgetCellEditorValue()DataTypegetCellEditorValueAsDataType()java.lang.StringgetCellEditorValueAsText()Returns the text value of the editor's text field.DropDownSelectionTextField<DataType>getDropDownTextField()javax.swing.JComponentgetEditorComponent()Returns the component that allows the user to edit.NavigationDirectiongetNavigationDirection()Returns the direction of the user triggered navigation; null if the user did not trigger navigation out of this component.voidremoveDocumentListener(javax.swing.event.DocumentListener listener)Removes a previously added document listener.voidremoveFocusListener(java.awt.event.FocusListener listener)voidrequestFocus()voidsetCellEditorValue(DataType dataType)Sets the value to be edited on this cell editor.voidsetCellEditorValueAsText(java.lang.String text)voidsetConsumeEnterKeyPress(boolean consume)voidsetDefaultSelectedTreePath(javax.swing.tree.TreePath path)Sets the initially selected node in the data type tree that the user can choose to show.voidsetPreferredDataTypeManager(DataTypeManager dataTypeManager)Sets theDataTypeManagerto use when the chooser is forced to parse the given data type text to resolve the data type.voidsetTabCommitsEdit(boolean doesCommit)booleanvalidateUserSelection()Returns true if the current value of the data type editor is a know data type.
 
- 
- 
- 
Constructor Detail- 
DataTypeSelectionEditorpublic DataTypeSelectionEditor(ServiceProvider serviceProvider, int maxSize, DataTypeParser.AllowedDataTypes allowedDataTypes) 
 - 
DataTypeSelectionEditorpublic DataTypeSelectionEditor(DataTypeManagerService service, int maxSize, DataTypeParser.AllowedDataTypes allowedDataTypes) 
 
- 
 - 
Method Detail- 
setPreferredDataTypeManagerpublic void setPreferredDataTypeManager(DataTypeManager dataTypeManager) Sets theDataTypeManagerto use when the chooser is forced to parse the given data type text to resolve the data type. If the users chooses a type, then this value is not used. Note that setting this value does not restrict the parser to just the given value, but rather the given value is the preferred manager and is thus searched first.- Parameters:
- dataTypeManager- the preferred data type manager
 
 - 
setConsumeEnterKeyPresspublic void setConsumeEnterKeyPress(boolean consume) 
 - 
getCellEditorValuepublic java.lang.Object getCellEditorValue() - See Also:
- CellEditor.getCellEditorValue()
 
 - 
getCellEditorValueAsDataTypepublic DataType getCellEditorValueAsDataType() 
 - 
getCellEditorValueAsTextpublic java.lang.String getCellEditorValueAsText() Returns the text value of the editor's text field.- Returns:
- the text value of the editor's text field.
 
 - 
getEditorComponentpublic javax.swing.JComponent getEditorComponent() Returns the component that allows the user to edit.- Returns:
- the component that allows the user to edit.
 
 - 
getDropDownTextFieldpublic DropDownSelectionTextField<DataType> getDropDownTextField() 
 - 
getBrowseButtonpublic javax.swing.JButton getBrowseButton() 
 - 
setDefaultSelectedTreePathpublic void setDefaultSelectedTreePath(javax.swing.tree.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
 
 - 
requestFocuspublic void requestFocus() 
 - 
setCellEditorValuepublic void setCellEditorValue(DataType dataType) Sets the value to be edited on this cell editor.- Parameters:
- dataType- The data type which is to be edited.
 
 - 
setCellEditorValueAsTextpublic void setCellEditorValueAsText(java.lang.String text) 
 - 
addDocumentListenerpublic void addDocumentListener(javax.swing.event.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. You may verify whether the text changes represent a valid DataType by callingvalidateUserSelection().- Parameters:
- listener- the listener to add.
- See Also:
- validateUserSelection()
 
 - 
removeDocumentListenerpublic void removeDocumentListener(javax.swing.event.DocumentListener listener) Removes a previously added document listener.- Parameters:
- listener- the listener to remove.s
 
 - 
addFocusListenerpublic void addFocusListener(java.awt.event.FocusListener listener) 
 - 
removeFocusListenerpublic void removeFocusListener(java.awt.event.FocusListener listener) 
 - 
setTabCommitsEditpublic void setTabCommitsEdit(boolean doesCommit) 
 - 
getNavigationDirectionpublic NavigationDirection getNavigationDirection() Returns the direction of the user triggered navigation; null if the user did not trigger navigation out of this component.
 - 
validateUserSelectionpublic boolean validateUserSelection() throws InvalidDataTypeExceptionReturns true if the current value of the data type editor is a know data type.- Returns:
- true if the current value of the data type editor is a know data type.
- Throws:
- InvalidDataTypeException- If the current text in the editor's text field could not be parsed into a valid DataType
 
 - 
containsValidDataTypepublic boolean containsValidDataType() 
 
- 
 
-