public class ShapeTreeContentProvider extends java.lang.Object implements org.eclipse.jface.viewers.ITreeContentProvider, IShapeVisitor
Provides IShape objects for a TreeViewer, given a parent IShape
Modifier and Type | Class and Description |
---|---|
class |
ShapeTreeContentProvider.BlankShape
The blank state item to display in the shape TreeViewer when a
ComplexShape has no children
|
Constructor and Description |
---|
ShapeTreeContentProvider() |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
(non-Javadoc)
|
java.lang.Object[] |
getChildren(java.lang.Object parentElement)
Returns the child shapes of the given parent shape, if any
|
java.lang.Object[] |
getElements(java.lang.Object inputElement)
Returns the child shape elements of a root GeometryComponent when the
input of the shape TreeViewer is set or reset
|
java.lang.Object |
getParent(java.lang.Object element)
Returns the parent of the element if it exists
|
boolean |
hasChildren(java.lang.Object element)
Returns whether the given element has children
|
void |
inputChanged(org.eclipse.jface.viewers.Viewer viewer,
java.lang.Object oldInput,
java.lang.Object newInput)
(non-Javadoc)
|
void |
visit(ComplexShape complexShape)
(non-Javadoc)
|
void |
visit(PrimitiveShape primitiveShape)
(non-Javadoc)
|
public java.lang.Object[] getChildren(java.lang.Object parentElement)
Returns the child shapes of the given parent shape, if any
If a PrimitiveShape, an empty ComplexShape, or null is passed, this operation returns an empty array of Objects.
getChildren
in interface org.eclipse.jface.viewers.ITreeContentProvider
parentElement
- The parent IShape element
The child IShapes
public java.lang.Object[] getElements(java.lang.Object inputElement)
Returns the child shape elements of a root GeometryComponent when the input of the shape TreeViewer is set or reset
getElements
in interface org.eclipse.jface.viewers.IStructuredContentProvider
getElements
in interface org.eclipse.jface.viewers.ITreeContentProvider
inputElement
- The input GeometryComponent
The child IShapes
public java.lang.Object getParent(java.lang.Object element)
Returns the parent of the element if it exists
getParent
in interface org.eclipse.jface.viewers.ITreeContentProvider
element
- The child IShape
The parent IShape
public boolean hasChildren(java.lang.Object element)
Returns whether the given element has children
In this implementation, there are no optimizations to quickly retrieve whether the element has children, so the array of child objects is found and counted.
hasChildren
in interface org.eclipse.jface.viewers.ITreeContentProvider
element
- The IShape to check for children
Represents whether the element has children
public void dispose()
dispose
in interface org.eclipse.jface.viewers.IContentProvider
IContentProvider.dispose()
public void inputChanged(org.eclipse.jface.viewers.Viewer viewer, java.lang.Object oldInput, java.lang.Object newInput)
inputChanged
in interface org.eclipse.jface.viewers.IContentProvider
IContentProvider.inputChanged(Viewer viewer, Object oldInput, Object
newInput)
public void visit(ComplexShape complexShape)
visit
in interface IShapeVisitor
IShapeVisitor.visit(ComplexShape complexShape)
public void visit(PrimitiveShape primitiveShape)
visit
in interface IShapeVisitor
IShapeVisitor.visit(PrimitiveShape primitiveShape)