modesteditor.core
Class ModestContentProvider

java.lang.Object
  extended by modesteditor.core.ModestContentProvider
All Implemented Interfaces:
org.eclipse.jface.viewers.IContentProvider, org.eclipse.jface.viewers.IStructuredContentProvider, org.eclipse.jface.viewers.ITreeContentProvider

public class ModestContentProvider
extends java.lang.Object
implements org.eclipse.jface.viewers.ITreeContentProvider

This class provides the outline page's internal tree viewer with information about the actual model tree. The tree viewer expects to be given arbitrary Objects as input, so it depends on a content provider to find out the nodes in the tree. In our case, the viewer is given a ModestSimulation, and calls getElements on it to get the top-level elements in the tree, then getChildren on them to find their children, and so on.


Constructor Summary
ModestContentProvider()
           
 
Method Summary
 void dispose()
           
 java.lang.Object[] getChildren(java.lang.Object element)
          Returns the children models of the given Model (only processes can have children).
 java.lang.Object[] getElements(java.lang.Object inputElement)
          Returns the top-level models of the given program (which is conceptually the root of the tree, but is not displayed in the view).
 java.lang.Object getParent(java.lang.Object element)
          Returns the parent model of the given model.
 boolean hasChildren(java.lang.Object element)
          Returns whether the given model has any children.
 void inputChanged(org.eclipse.jface.viewers.Viewer viewer, java.lang.Object oldInput, java.lang.Object newInput)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModestContentProvider

public ModestContentProvider()
Method Detail

getChildren

public java.lang.Object[] getChildren(java.lang.Object element)
Returns the children models of the given Model (only processes can have children).

Specified by:
getChildren in interface org.eclipse.jface.viewers.ITreeContentProvider

getParent

public java.lang.Object getParent(java.lang.Object element)
Returns the parent model of the given model.

Specified by:
getParent in interface org.eclipse.jface.viewers.ITreeContentProvider

hasChildren

public boolean hasChildren(java.lang.Object element)
Returns whether the given model has any children.

Specified by:
hasChildren in interface org.eclipse.jface.viewers.ITreeContentProvider

getElements

public java.lang.Object[] getElements(java.lang.Object inputElement)
Returns the top-level models of the given program (which is conceptually the root of the tree, but is not displayed in the view). This method is called only on the object given to the tree viewer in setInput().

Specified by:
getElements in interface org.eclipse.jface.viewers.IStructuredContentProvider

dispose

public void dispose()
Specified by:
dispose in interface org.eclipse.jface.viewers.IContentProvider

inputChanged

public void inputChanged(org.eclipse.jface.viewers.Viewer viewer,
                         java.lang.Object oldInput,
                         java.lang.Object newInput)
Specified by:
inputChanged in interface org.eclipse.jface.viewers.IContentProvider