uk.ac.kcl.cch.jb.pliny.containmentView
Class ContainmentViewPage

java.lang.Object
  extended byorg.eclipse.ui.part.Page
      extended byuk.ac.kcl.cch.jb.pliny.containmentView.ContainmentViewPage
All Implemented Interfaces:
org.eclipse.gef.commands.CommandStackListener, org.eclipse.gef.EditPartFactory, org.eclipse.core.runtime.IAdaptable, org.eclipse.ui.part.IPage, org.eclipse.ui.part.IPageBookViewPage, org.eclipse.jface.viewers.ISelectionChangedListener

public class ContainmentViewPage
extends org.eclipse.ui.part.Page
implements org.eclipse.core.runtime.IAdaptable, org.eclipse.gef.commands.CommandStackListener, org.eclipse.jface.viewers.ISelectionChangedListener, org.eclipse.gef.EditPartFactory

generates a page to be used by the ContainmentView to display containment information for the given resource.

Note that the ContainmentView page display is managed by GEF, so has a GEF-oriented design. In particular, this class also implements code for GEF's EditPartFactory: the function GEF needs to map parts of the model it is given to work with with GEF EditParts.

All the model information that this object managers is accessed through its ContainmentSet object, which it creates for the given Resource. This page object also has to handle situations where the Editor it is synchronised with can change its resource.

Author:
John Bradley

Constructor Summary
ContainmentViewPage(Resource resource, org.eclipse.ui.part.PageBook book, ContainmentView view)
           
 
Method Summary
 void commandStackChanged(EventObject event)
           
 void createControl(org.eclipse.swt.widgets.Composite parent)
           
 org.eclipse.gef.EditPart createEditPart(org.eclipse.gef.EditPart context, Object model)
          implements code required by GEF's EditPartFactory to map model elements to GEF's editParts.
 void dispose()
           
 Object getAdapter(Class adapter)
           
 org.eclipse.gef.commands.CommandStack getCommandStack()
          Returns the CommandStack of this view Page.
 ContainmentSet getContainmentSet()
          gets the ContainmentSet this page is using as the basis for its display.
 org.eclipse.swt.widgets.Control getControl()
           
 org.eclipse.gef.EditDomain getEditDomain()
          Returns the EditDomain of this view Page.
 org.eclipse.gef.GraphicalViewer getGraphicalViewer()
          Returns the GraphicalViewer of this view Page.
 Vector getSelectedContainmentItems()
           
 IncludedTypeManager getTypeManager()
          returns the IncludedTypeManager applicable to this page.
 void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
           
 void setFocus()
           
 void updateCommandStackActions()
           
 void updateResource(Resource newResource)
          invoked by ContainmentView if the Editor it is currently connected to is a IResourceChangeablePart, and that editor has just changed its resource.
 void updateUndoActions()
           
 
Methods inherited from class org.eclipse.ui.part.Page
getSite, init, makeContributions, setActionBars
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContainmentViewPage

public ContainmentViewPage(Resource resource,
                           org.eclipse.ui.part.PageBook book,
                           ContainmentView view)
Method Detail

getTypeManager

public IncludedTypeManager getTypeManager()
returns the IncludedTypeManager applicable to this page. Since all pages share a single IncludedTypeManager, this method actually gets it from the ContainmentView, which holds the single instance for all Pages to use.

Returns:
IncludedTypeManager the current Manager.

dispose

public void dispose()
Specified by:
dispose in interface org.eclipse.ui.part.IPage

createControl

public void createControl(org.eclipse.swt.widgets.Composite parent)
Specified by:
createControl in interface org.eclipse.ui.part.IPage

getGraphicalViewer

public org.eclipse.gef.GraphicalViewer getGraphicalViewer()
Returns the GraphicalViewer of this view Page.

Returns:
the GraphicalViewer

getEditDomain

public org.eclipse.gef.EditDomain getEditDomain()
Returns the EditDomain of this view Page.

Returns:
the EditDomain

getCommandStack

public org.eclipse.gef.commands.CommandStack getCommandStack()
Returns the CommandStack of this view Page.

Returns:
the CommandStack

getControl

public org.eclipse.swt.widgets.Control getControl()
Specified by:
getControl in interface org.eclipse.ui.part.IPage

setFocus

public void setFocus()
Specified by:
setFocus in interface org.eclipse.ui.part.IPage

getContainmentSet

public ContainmentSet getContainmentSet()
gets the ContainmentSet this page is using as the basis for its display.

Returns:
ContainmentSet the page's ContainmentSet.

updateCommandStackActions

public void updateCommandStackActions()

updateUndoActions

public void updateUndoActions()

getAdapter

public Object getAdapter(Class adapter)
Specified by:
getAdapter in interface org.eclipse.core.runtime.IAdaptable

commandStackChanged

public void commandStackChanged(EventObject event)
Specified by:
commandStackChanged in interface org.eclipse.gef.commands.CommandStackListener

selectionChanged

public void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
Specified by:
selectionChanged in interface org.eclipse.jface.viewers.ISelectionChangedListener

createEditPart

public org.eclipse.gef.EditPart createEditPart(org.eclipse.gef.EditPart context,
                                               Object model)
implements code required by GEF's EditPartFactory to map model elements to GEF's editParts.

Specified by:
createEditPart in interface org.eclipse.gef.EditPartFactory
See Also:
EditPartFactory

getSelectedContainmentItems

public Vector getSelectedContainmentItems()

updateResource

public void updateResource(Resource newResource)
invoked by ContainmentView if the Editor it is currently connected to is a IResourceChangeablePart, and that editor has just changed its resource.

Parameters:
newResource - the New resource to display.
See Also:
IResourceChangeablePart