# com.bea.ide.debug
IDebugExpressionView Interface

public interface IDebugExpressionView
extends `MutableTreeNode`

Debugger views are responsible for displaying, editing, and populating the children of an expression in the locals and watch windows. They can add, remove, or completely specify which fields to show, and provide custom renderers and editors for its values.

Implementing classes class MUST have a no-arg constructor, as they will be instantiated using `Class.newInstance()`. Mappings between types and which views they should use are done in extension.xml, which is documented in `DebugSvc```.

Views are also used to render the hovering value tooltip in the source editor when debugging. The default view is always used for these tooltips.

When inserting a view, it is first instantiated using `Class.newInstance()`, then `init()` is called, and it is then added to its parent in the tree.

If there are exceptions thrown when instantiating a debugger view, they will be logged to the ide.log file, and the matching view with the next highest priority will be instantiated. Common causes of problems include classpath issues that prevent the class from being found by the classloader, not having a public no-arg constructor, or having an exception thrown in the view's constructor.

All Known Implementing Classes
  `AbstractChildlessExpressionView`

All Superinterfaces
  `MutableTreeNode`, `TreeNode`

## Nested Class Summary

`public static class` | `IDebugExpressionView.ArrayEnumeration` Helper class that wraps an array in an Enumeration
`public static class` | `IDebugExpressionView.IteratorEnumeration` Helper class that wraps an Iterator in an Enumeration
`public static class` | `IDebugExpressionView.ViewInfo` Contains data about views as specified in extension.xml.

## Field Summary

`public static final `ResourceSvc.IResourcePkg`` | `_pkg` The static resource package for getting generic debug expression strings.
`public static final `IDebugExpressionView.ViewInfo`` | `NO_VIEWS` A static used to denote no views are on a debug expression.

## Method Summary

`public `String`` | `getDisplayValue`() Gets the expression's value as a String.
`public `IDebugExpressionView.ViewInfo`[]` | `getMatchingViews`() A list of all the views that can be applied to the current expression.
`public `String`` | `getName`() Gets the name of the expression.
`public `String`` | `getPrimaryExpression`() Gets the expression to be evaluated for a view.
`public `TableCellEditor`` | `getValueEditor`() The editor for this value should be suitable for what kind of value it is, and enforce that the value makes sense.
`public `TableCellRenderer`` | `getValueRenderer`() To match the rest of the debugger GUI, this renderer should consider the following conventions: Stale values (IDebugExpression.isStale()) are shown as "..."
`public void` | `init`(`String` primaryExpression, `JTree` tree, `String` name) Called shortly after construction to initialize the view.
`public boolean` | `isEditable`() Determines whether this view supports editing the given expression.
`public void` | `refresh`() Called by the view's owner to indicate that it should re-request its data from the IDebugData
`public void` | `setValue`(`Object` value) Called with the result of the editor's getEditorValue().
`public `String`` | `toString`() Standard implementations return the field or method name, relative to the parent.

Methods from interface `javax.swing.tree.`MutableTreeNode``
`insert, remove, remove, removeFromParent, setParent, setUserObject`

Methods from interface `javax.swing.tree.`TreeNode``
`children, getAllowsChildren, getChildAt, getChildCount, getIndex, getParent, isLeaf`

## Field Detail

### _pkg

    public static final ResourceSvc.IResourcePkg _pkg

  The static resource package for getting generic debug expression strings.

### NO_VIEWS

    public static final IDebugExpressionView.ViewInfo NO_VIEWS

  A static used to denote no views are on a debug expression.

## Method Detail

### getDisplayValue() Method

    public String getDisplayValue()

Gets the expression's value as a String. Used for copying the value from the locals or watch windows to the clipboard, for the hovering values tooltips in the source editor, and other similar purposes when the view's renderer will not be used.

#### Returns

the display value.

### getMatchingViews() Method

    public IDebugExpressionView.ViewInfo[] getMatchingViews()

A list of all the views that can be applied to the current expression. The view has control over this so that it can filter the list of registered views, or completely ignore them. This is useful in the case when a view is showing a type as something other than its underlying type, like converting a long to Date and then formatting that Date as a string.

#### Returns

an array of the `IDebugExpressionView.ViewInfo``` that match this expression view.

### getName() Method

    public String getName()

Gets the name of the expression.

#### Returns

name for this node if set, null if it isn't. If not set, this view will derive its name based on its position in the tree.

### getPrimaryExpression() Method

    public String getPrimaryExpression()

Gets the expression to be evaluated for a view.

#### Returns

the primary expression that this view is showing, should be a string that the proxy can evaluate

### getValueEditor() Method

    public TableCellEditor getValueEditor()

The editor for this value should be suitable for what kind of value it is, and enforce that the value makes sense. For example, a combobox with true/false values is a suitable editor for booleans, while an editor for the ints should do client-side validation that the value parses correctly. The editor MUST return a java.lang.String from getCellEditorValue(), which will be stuffed back into the underlying IDebugExpression.

#### Returns

editor to be used in the locals and watch windows for expression values

### getValueRenderer() Method

    public TableCellRenderer getValueRenderer()

To match the rest of the debugger GUI, this renderer should consider the following conventions:

- Stale values (IDebugExpression.isStale()) are shown as "..."
- Values that have changed since the last time they were fetched are shown in red.

#### Returns

renderer to be used in the locals and watch windows for expression values

### init(String, JTree, String) Method

    public void init(String primaryExpression,
                     JTree tree,
                     String name)

Called shortly after construction to initialize the view. The view should use the JTree to inform the model (always an instance of DefaultTreeModel) of changes to the underlying data, and to expand or collapse nodes.

#### Parameters

primaryExpression
  expression this view represents in the tree. The view may choose to use other expressions as well.

tree
  JTree of which this node is a part

name
  if not null, the String that should be used in the tree hierarchy to describe this node

### isEditable() Method

    public boolean isEditable()

Determines whether this view supports editing the given expression. Implementations should respect the isEditable() status of the expression, but may elect to not support editing at all.

#### Returns

a boolean saying whether this view supports editing and the underlying expression is editable

### refresh() Method

    public void refresh()

Called by the view's owner to indicate that it should re-request its data from the IDebugData

### setValue(Object) Method

    public void setValue(Object value)

Called with the result of the editor's getEditorValue(). The view is responsible for setting the value on the current IDebugData.

#### Parameters

value
  the new value the expression view should be set to.

### toString() Method

    public String toString()

Standard implementations return the field or method name, relative to the parent. Usually this entails removing the parent expression's name. For implementations that create their own custom list of child expressions, the name might be a description instead of a field or method name.

Overrides
  `Object.toString()`

#### Returns

the name for the expression node in the tree.