de.tu_berlin.cs.tfs.muvitorkit.ui
Class MuvitorPageBookView
java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.ui.part.WorkbenchPart
org.eclipse.ui.part.ViewPart
org.eclipse.ui.part.PageBookView
de.tu_berlin.cs.tfs.muvitorkit.ui.MuvitorPageBookView
- All Implemented Interfaces:
- IAdaptable, IExecutableExtension, IPartListener, IPersistable, IViewPart, IWorkbenchPart, IWorkbenchPart2, IWorkbenchPart3, IWorkbenchPartOrientation
public abstract class MuvitorPageBookView
- extends PageBookView
This is a PageBookView
for displaying some model EObject
on
an IPage
. It is merely a wrapper for the contained
MuvitorPage
implementing IPage
, as this is the only
possibility Eclipse offers to show a customized page in a workbench view. The
GraphicalViewer
s for editing are hosted in this MuvitorPage
.
The user has to implement createPageForModel(EObject)
to
instantiate a MuvitorPage
that is able to display or even edit the
model.
The model to show is determined by the following mechanism:
It is expected that this view is opened via a call
MuvitorTreeEditor.showView(String, EObject)
where
- the first string is the viewID to that this view has been registered with
in the plugin.xml.
- model is the model to be displayed.
This call sets the EObject's unique ID for the model as secondary ID of this
view. So, the model to be shown can be determined by the secondary ID.
The AbstractTreeEditor instance will hide this view when its model is being
deleted (for details see how IDUtil.getIDForModel(EObject)
employs
the Muvitor's MuvitorNotifierService
).
Additionally this view registers itself an EMF adapter to the model
EObject
that reacts on notifications of the EMF model. For this,
subclasses may override {#notifyChanged(Notification)}, especially to update
the name of this IViewPart
according to the model. For this,
calculatePartName()
must be implemented to represent the model's
name as a string.
This class is based roughly on ContentOutline but does not provide selections
e.g. to ISelectionService
s. Selection are handled by the
MuvitorPage
s.
- Rating

Methods inherited from class org.eclipse.ui.part.PageBookView |
createPartControl, dispose, doesPageExist, getAdapter, getCurrentContributingPart, getCurrentPage, getDefaultPage, getPageBook, getPageRec, getPageRec, getPageSite, getSelectionProvider, getViewAdapter, init, initPage, partClosed, partDeactivated, partHidden, partOpened, partVisible |
Methods inherited from class org.eclipse.ui.part.WorkbenchPart |
addPartPropertyListener, addPropertyListener, firePartPropertyChanged, firePropertyChange, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, getTitleImage, getTitleToolTip, removePartPropertyListener, removePropertyListener, setPartProperty, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MuvitorPageBookView
public MuvitorPageBookView()
getModel
public final EObject getModel()
- Returns:
- the model
calculatePartName
protected abstract String calculatePartName()
- Returns:
- The name this part should be set to, e.g. the name of the shown
model accessible via
getModel()
.
createPageForModel
protected abstract IPage createPageForModel(EObject forModel)
- 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:
forModel
- The model to be displayed in the page.
- Returns:
- An
IPage
displaying the passed model.
notifyChanged
protected void notifyChanged(Notification msg)
- By default,
notifyChanged(Notification)
calls
setPartName(calculatePartName())
.
Subclasses may override but must call super.
notifyChanged(Notification)
if they do not handle changing the
part name themselves.
createDefaultPage
protected final IPage createDefaultPage(PageBook book)
- Specified by:
createDefaultPage
in class PageBookView
doCreatePage
protected PageBookView.PageRec doCreatePage(IWorkbenchPart editor)
- Subclasses may override but must call super.
doCreatePage(IWorkbenchPart)
. Note that this method returns a
PageRec only once and null
afterwards!.
- Specified by:
doCreatePage
in class PageBookView
- Returns:
- A PageRec with a new Page for the model determined by the
secondaryID which is being resolved via
IDUtil
. - See Also:
#createPageForModel(Object)
doDestroyPage
protected void doDestroyPage(IWorkbenchPart part,
PageBookView.PageRec rec)
- Subclasses may override but must call super.
PageBookView.doDestroyPage(IWorkbenchPart, PageRec)
.
- Specified by:
doDestroyPage
in class PageBookView
getBootstrapPart
protected final IWorkbenchPart getBootstrapPart()
- Specified by:
getBootstrapPart
in class PageBookView
getEditor
public final IEditorPart getEditor()
- Returns:
partActivated
public final void partActivated(IWorkbenchPart part)
- Specified by:
partActivated
in interface IPartListener
- Overrides:
partActivated
in class PageBookView
partBroughtToTop
public final void partBroughtToTop(IWorkbenchPart part)
- Specified by:
partBroughtToTop
in interface IPartListener
- Overrides:
partBroughtToTop
in class PageBookView
showPageRec
protected final void showPageRec(PageBookView.PageRec pageRec)
- Overrides:
showPageRec
in class PageBookView
isImportant
protected final boolean isImportant(IWorkbenchPart part)
- Specified by:
isImportant
in class PageBookView
setFocus
public void setFocus()
- Specified by:
setFocus
in interface IWorkbenchPart
- Overrides:
setFocus
in class PageBookView