public interface IViewPart extends IWorkbenchPart, IPersistable
Only one instance of a particular view type may exist within a workbench page. This policy is designed to simplify part management for a user.
This interface may be implemented directly. For convenience, a base
implementation is defined in ViewPart
.
A view is added to the workbench in two steps:
Views implement the IAdaptable
interface; extensions are
managed by the platform's adapter manager.
As of 3.4, views may optionally adapt to ISizeProvider
if they have
a preferred size. The default presentation will make a best effort to
allocate the preferred size to a view if it is the only part in a stack. If
there is more than one part in the stack, the constraints will be disabled
for that stack. The size constraints are adjusted for the size of the tab and
border trim. Note that this is considered to be a hint to the presentation,
and not all presentations may honor size constraints.
PROP_TITLE
Modifier and Type | Method and Description |
---|---|
IViewSite |
getViewSite()
Returns the site for this view.
|
void |
init(IViewSite site)
Initializes this view with the given view site.
|
void |
init(IViewSite site,
IMemento memento)
Initializes this view with the given view site.
|
void |
saveState(IMemento memento)
Saves the object state within a memento.
|
addPropertyListener, createPartControl, dispose, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener, setFocus
getAdapter
IViewSite getViewSite()
(IViewSite) getSite()
.
The site can be null
while the view is being initialized.
After the initialization is complete, this value must be non-null
for the remainder of the view's life cycle.
null
if the view
has not yet been initializedvoid init(IViewSite site) throws PartInitException
This method is automatically called by the workbench shortly after the part is instantiated. It marks the start of the views's lifecycle. Clients must not call this method.
site
- the view sitePartInitException
- if this view was not initialized successfullyvoid init(IViewSite site, IMemento memento) throws PartInitException
This method is automatically called by the workbench shortly after the part is instantiated. It marks the start of the views's lifecycle. Clients must not call this method.
site
- the view sitememento
- the IViewPart state or null if there is no previous saved statePartInitException
- if this view was not initialized successfullyvoid saveState(IMemento memento)
saveState
in interface IPersistable
memento
- a memento to receive the object state
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.