# com.bea.ide.lang.java.driver
JavaStructureViewDriver Class

public class JavaStructureViewDriver
extends `DefaultDocumentDriver`
implements `IStructureViewDriver`

Driver for enabling structure view support for Java source files.

Hierarchy
  `Object`
  `DefaultDocumentDriver`
  `JavaStructureViewDriver`

All Implemented Interfaces
  `IStructureViewDriver`

Direct Known Subclasses
  `ControlContainerStructureViewDriver`

## Field Summary

`public static `Icon`` | `ICON_CLASS` The Icon that is displayed next to a class in the structure view.
`public static `Icon`` | `ICON_MEMBER` The Icon that is displayed next to a member variable in the structure view.
`public static `Icon`` | `ICON_METHOD` The Icon that is displayed next to a method in the structure view.

## Constructor Summary

JavaStructureViewDriver(`ISourceDocument` file) Creates a new java structure view driver.

## Method Summary

`public int` | `compareName`(`IElement` node1, `IElement` node2) Used for case-insensitive sorting of java elements by name.
`public int` | `compareType`(`IElement` node1, `IElement` node2) Used for sorting java elements by type.
`protected `JavaVisitor`` | `createDisplayedVisitor`() Creates a visitor that defines which element types are displayed in the structure tree.
`protected `JavaVisitor`` | `createFollowedVisitor`() Creates a visitor that determines whether the data pointed to by this linked element should be followed.
`protected `JavaVisitor`` | `createIconVisitor`() Creates a visitor that defines the icons displayed by each element type in the structure tree.
`protected `JavaVisitor`` | `createLeafVisitor`() Creates a visitor that defines which element types are leaves in the structure tree.
`protected `JavaVisitor`` | `createPopupVisitor`() Creates a visitor that determines what popups should be displayed for different element types.
`public `IElement`` | `getDocumentElement`(`IElement` node) Returns the element in the structure tree that should be selected when the IDocumentView's SelectedElement property is set to the given element
`public `Icon`` | `getIcon`(`IElement` jb) Determines the icon that should be displayed for this element by asking the visitor created by `JavaStructureViewDriver.createIconVisitor()```.
`public `Object`` | `getPopupMenu`(`IElement` jb) Determines the popup that should be displayed for this element by asking the visitor created by `JavaStructureViewDriver.createPopupVisitor()```.
`public `IElement`` | `getSelectionElement`(`IElement` node) Returns the element that should be set as the selected element when the given element is selected in the structure view
`public `String`` | `getTooltip`(`IElement` node) Returns the text of the tooltip for a JavaMethod.
`public boolean` | `isDisplayed`(`IElement` jb) Determines whether a JavaElement is displayed by asking the visitor created by `JavaStructureViewDriver.createDisplayedVisitor()```.
`public boolean` | `isFollowed`(`ILinkedElement` jb) Determines whether the data pointed to by this linked element should be followed by asking the visitor created by `JavaStructureViewDriver.createFollowedVisitor()```.
`public boolean` | `isLeaf`(`IElement` jb) Determines whether a JavaElement is a leaf by asking the visitor created by `JavaStructureViewDriver.createLeafVisitor()```.
`public `Boolean`` | `not`(`Object` val) Convenience method for performing the 'not' ('!')
`public void` | `performDoubleClickAction`(`IElement` el) Handles the double-click action in the structure view by jumping to source view and selecting the element.
`public `Boolean`` | `toBoolean`(boolean val) Convenience method for converting a boolean to a Boolean object.

Methods from `com.bea.ide.sourceeditor.driver.`DefaultDocumentDriver``
``getDocument`, `setDocument``

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods from interface `com.bea.ide.ui.structureview.`IStructureViewDriver``
``compareName`, `compareType`, `getDocumentElement`, `getIcon`, `getPopupMenu`, `getSelectionElement`, `getTooltip`, `isDisplayed`, `isFollowed`, `isLeaf`, `performDoubleClickAction``

## Field Detail

### ICON_CLASS

    public static Icon ICON_CLASS

  The Icon that is displayed next to a class in the structure view.

### ICON_MEMBER

    public static Icon ICON_MEMBER

  The Icon that is displayed next to a member variable in the structure view.

### ICON_METHOD

    public static Icon ICON_METHOD

  The Icon that is displayed next to a method in the structure view.

## Constructor Detail

### JavaStructureViewDriver

    public JavaStructureViewDriver(ISourceDocument file)

  Creates a new java structure view driver.

## Method Detail

### compareName(IElement, IElement) Method

    public int compareName(IElement node1,
                           IElement node2)

Used for case-insensitive sorting of java elements by name.

#### Parameters

node1
  a node of type JavaMember.

node2
  a node of type JavaMember.

#### Returns

a negative integer, zero, or a positive integer as the name of node2 is greater than, equal to, or less than the name of node1, ignoring case considerations.

### compareType(IElement, IElement) Method

    public int compareType(IElement node1,
                           IElement node2)

Used for sorting java elements by type.

#### Parameters

node1
  a node of type JavaElement

node2
  a node of type JavaElement

#### Returns

a negative integer, zero, or a positive integer as the type of node2 is greater than, equal to, or less than the type of node1.

### createDisplayedVisitor() Method

    protected JavaVisitor createDisplayedVisitor()

Creates a visitor that defines which element types are displayed in the structure tree.

#### Returns

A new JavaVisitor.

### createFollowedVisitor() Method

    protected JavaVisitor createFollowedVisitor()

Creates a visitor that determines whether the data pointed to by this linked element should be followed.

#### Returns

A new JavaVisitor, possibly null.

### createIconVisitor() Method

    protected JavaVisitor createIconVisitor()

Creates a visitor that defines the icons displayed by each element type in the structure tree.

#### Returns

A new JavaVisitor.

### createLeafVisitor() Method

    protected JavaVisitor createLeafVisitor()

Creates a visitor that defines which element types are leaves in the structure tree.

#### Returns

A new JavaVisitor.

### createPopupVisitor() Method

    protected JavaVisitor createPopupVisitor()

Creates a visitor that determines what popups should be displayed for different element types.

#### Returns

A new JavaVisitor, possibly null.

### getDocumentElement(IElement) Method

    public IElement getDocumentElement(IElement node)

Description copied from `IStructureViewDriver.getDocumentElement(IElement)`
Returns the element in the structure tree that should be selected when the IDocumentView's SelectedElement property is set to the given element

Related Topics

``IStructureViewDriver.getDocumentElement(IElement)``

### getIcon(IElement) Method

    public Icon getIcon(IElement jb)

Determines the icon that should be displayed for this element by asking the visitor created by `JavaStructureViewDriver.createIconVisitor()```.

#### Parameters

jb
  a JavaElement

#### Returns

Icon this element's Icon, possibly null.

### getPopupMenu(IElement) Method

    public Object getPopupMenu(IElement jb)

Determines the popup that should be displayed for this element by asking the visitor created by `JavaStructureViewDriver.createPopupVisitor()```.

#### Parameters

jb
  a JavaElement

#### Returns

The JPopupMenu that should be displayed, possibly null.

### getSelectionElement(IElement) Method

    public IElement getSelectionElement(IElement node)

Description copied from `IStructureViewDriver.getSelectionElement(IElement)`
Returns the element that should be set as the selected element when the given element is selected in the structure view

Related Topics

``IStructureViewDriver.getSelectionElement(IElement)``

### getTooltip(IElement) Method

    public String getTooltip(IElement node)

Returns the text of the tooltip for a JavaMethod.

#### Parameters

node
  an IElement

#### Returns

a descriptive string for this element

### isDisplayed(IElement) Method

    public boolean isDisplayed(IElement jb)

Determines whether a JavaElement is displayed by asking the visitor created by `JavaStructureViewDriver.createDisplayedVisitor()```.

#### Parameters

jb
  a JavaElement

#### Returns

boolean indicating whether this element is displayed.

### isFollowed(ILinkedElement) Method

    public boolean isFollowed(ILinkedElement jb)

Determines whether the data pointed to by this linked element should be followed by asking the visitor created by `JavaStructureViewDriver.createFollowedVisitor()```.

#### Parameters

jb
  a JavaElement

#### Returns

boolean indicating whether the data pointed to by this linked element should be followed.

### isLeaf(IElement) Method

    public boolean isLeaf(IElement jb)

Determines whether a JavaElement is a leaf by asking the visitor created by `JavaStructureViewDriver.createLeafVisitor()```.

#### Parameters

jb
  a JavaElement

#### Returns

boolean indicating whether this element is a leaf.

### not(Object) Method

    public Boolean not(Object val)

Convenience method for performing the 'not' ('!') operation on a Boolean object.

#### Parameters

val
  A Boolean object

#### Returns

a Boolean object with value opposite that of the supplied argument.

### performDoubleClickAction(IElement) Method

    public void performDoubleClickAction(IElement el)

Handles the double-click action in the structure view by jumping to source view and selecting the element.

#### Parameters

el
  The element that has been double-clicked.

### toBoolean(boolean) Method

    public Boolean toBoolean(boolean val)

Convenience method for converting a boolean to a Boolean object.

#### Parameters

val
  a boolean primitive

#### Returns

a Boolean object, with value equal to that passed to the method.