roneditor
Class AbstractPageBookView

java.lang.Object
  extended by org.eclipse.core.commands.common.EventManager
      extended by org.eclipse.ui.part.WorkbenchPart
          extended by org.eclipse.ui.part.ViewPart
              extended by org.eclipse.ui.part.PageBookView
                  extended by roneditor.AbstractPageBookView
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.IExecutableExtension, org.eclipse.emf.common.notify.Adapter, org.eclipse.ui.IPartListener, org.eclipse.ui.IPersistable, org.eclipse.ui.IViewPart, org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.IWorkbenchPart2, org.eclipse.ui.part.IWorkbenchPartOrientation
Direct Known Subclasses:
ObjectNetPageBookView, RONPageBookView, RulePageBookView

public abstract class AbstractPageBookView
extends org.eclipse.ui.part.PageBookView
implements org.eclipse.emf.common.notify.Adapter

This is a PageBookView for displaying some model EObject on an IPage.

The model to show is determined by the following mechanism:
It is expected that this view is opened via a call activePage.showView(viewID, editor.createIDForModel(model), IWorkbenchPage.VIEW_ACTIVATE); where

So this call sets an unique ID for the model as secondary ID of this view.
The active editor is being asked to resolve the ID to the model determined by the previously set secondary ID.

The AbstractTreeEditor instance will hide this view when its model is being deleted (i.e. eContainer is set to null somehow).

The user has to implement getPageForModel(EObject) to create a page (e.g. an AbstractPageWithFlyoutPalette) that is able to display or even edit the model.

Additionally this view registers itself as an eAdapter of the model EObject that can react on notifications of the EMF model. For this, subclasses may implement Adapter.notifyChanged(org.eclipse.emf.common.notify.Notification), especially to update the name of this IViewPart according to the model. calculatePartName() must be implemented to represent e.g. the model's name as a string.

This class is based roughly on ContentOutline but does not provide selections e.g. to ISelectionServices.

Author:
Tony Modica

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.ui.part.PageBookView
org.eclipse.ui.part.PageBookView.PageRec, org.eclipse.ui.part.PageBookView.SelectionProvider
 
Nested classes/interfaces inherited from interface org.eclipse.emf.common.notify.Adapter
org.eclipse.emf.common.notify.Adapter.Internal
 
Field Summary
private  org.eclipse.emf.ecore.EObject model
          The model to be displayed in the view's page.
private  org.eclipse.emf.common.notify.Notifier target
          Target field for Adapter implementation.
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Constructor Summary
AbstractPageBookView()
           
 
Method Summary
protected abstract  java.lang.String calculatePartName()
           
protected  org.eclipse.ui.part.IPage createDefaultPage(org.eclipse.ui.part.PageBook book)
           
protected  org.eclipse.ui.part.PageBookView.PageRec doCreatePage(org.eclipse.ui.IWorkbenchPart editor)
           
protected  void doDestroyPage(org.eclipse.ui.IWorkbenchPart part, org.eclipse.ui.part.PageBookView.PageRec rec)
           
protected  org.eclipse.ui.IWorkbenchPart getBootstrapPart()
           
 org.eclipse.emf.ecore.EObject getModel()
           
protected abstract  org.eclipse.ui.part.IPage getPageForModel(org.eclipse.emf.ecore.EObject model)
          Subclasses must implement this method to create a IPage that displays the model.
 org.eclipse.emf.common.notify.Notifier getTarget()
           
 boolean isAdapterForType(java.lang.Object type)
           
protected  boolean isImportant(org.eclipse.ui.IWorkbenchPart part)
           
 void partBroughtToTop(org.eclipse.ui.IWorkbenchPart part)
          Treat this the same as part activation.
 void setTarget(org.eclipse.emf.common.notify.Notifier newTarget)
           
 
Methods inherited from class org.eclipse.ui.part.PageBookView
createPartControl, dispose, doesPageExist, getAdapter, getCurrentContributingPart, getCurrentPage, getDefaultPage, getPageBook, getPageRec, getPageRec, getPageSite, getSelectionProvider, getViewAdapter, init, initPage, partActivated, partClosed, partDeactivated, partOpened, setFocus, showPageRec
 
Methods inherited from class org.eclipse.ui.part.ViewPart
checkSite, getViewSite, init, saveState, setContentDescription, setInitializationData, setPartName
 
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPropertyListener, firePropertyChange, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy
 
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.emf.common.notify.Adapter
notifyChanged
 
Methods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener
 

Field Detail

model

private org.eclipse.emf.ecore.EObject model
The model to be displayed in the view's page.


target

private org.eclipse.emf.common.notify.Notifier target
Target field for Adapter implementation.

Constructor Detail

AbstractPageBookView

public AbstractPageBookView()
Method Detail

getModel

public org.eclipse.emf.ecore.EObject getModel()
Returns:
the model

calculatePartName

protected abstract java.lang.String calculatePartName()
Returns:
The name this part should be set to, e.g. the name of the model.

getPageForModel

protected abstract org.eclipse.ui.part.IPage getPageForModel(org.eclipse.emf.ecore.EObject model)
Subclasses must implement this method to create a IPage that displays the model. It may be advisable to ensure the model being an instance of the intended class(es) here.

Parameters:
model - The model to be displayed in the page.
Returns:
An IPage displaying the passed model.

createDefaultPage

protected org.eclipse.ui.part.IPage createDefaultPage(org.eclipse.ui.part.PageBook book)
Specified by:
createDefaultPage in class org.eclipse.ui.part.PageBookView

doCreatePage

protected org.eclipse.ui.part.PageBookView.PageRec doCreatePage(org.eclipse.ui.IWorkbenchPart editor)
Specified by:
doCreatePage in class org.eclipse.ui.part.PageBookView
Returns:
A PageRec with a new Page for the model determined by the secondaryID which is being resolved via the editor.
See Also:
#getPageForModel(Object)

doDestroyPage

protected void doDestroyPage(org.eclipse.ui.IWorkbenchPart part,
                             org.eclipse.ui.part.PageBookView.PageRec rec)
Specified by:
doDestroyPage in class org.eclipse.ui.part.PageBookView

getBootstrapPart

protected org.eclipse.ui.IWorkbenchPart getBootstrapPart()
Specified by:
getBootstrapPart in class org.eclipse.ui.part.PageBookView

isImportant

protected boolean isImportant(org.eclipse.ui.IWorkbenchPart part)
Specified by:
isImportant in class org.eclipse.ui.part.PageBookView

partBroughtToTop

public void partBroughtToTop(org.eclipse.ui.IWorkbenchPart part)
Treat this the same as part activation.

Specified by:
partBroughtToTop in interface org.eclipse.ui.IPartListener
Overrides:
partBroughtToTop in class org.eclipse.ui.part.PageBookView

isAdapterForType

public boolean isAdapterForType(java.lang.Object type)
Specified by:
isAdapterForType in interface org.eclipse.emf.common.notify.Adapter

setTarget

public void setTarget(org.eclipse.emf.common.notify.Notifier newTarget)
Specified by:
setTarget in interface org.eclipse.emf.common.notify.Adapter

getTarget

public org.eclipse.emf.common.notify.Notifier getTarget()
Specified by:
getTarget in interface org.eclipse.emf.common.notify.Adapter