Interface IViewPart
-
- All Superinterfaces:
IAdaptable
,IPersistable
,IWorkbenchPart
- All Known Subinterfaces:
IConsoleView
,IDebugView
,IResourceNavigator
,ISearchResultView
,ISearchResultViewPart
,ISynchronizeView
- All Known Implementing Classes:
AbstractDebugView
,CommonNavigator
,ContentOutline
,org.eclipse.ui.internal.views.markers.ExtendedMarkersView
,MarkerSupportView
,PageBookView
,ProjectExplorer
,PropertySheet
,ResourceNavigator
,TemplatesView
,ViewPart
public interface IViewPart extends IWorkbenchPart, IPersistable
A view is a visual component within a workbench page. It is typically used to navigate a hierarchy of information (like the workspace), open an editor, or display properties for the active editor. Modifications made in a view are saved immediately (in contrast to an editor part, which conforms to a more elaborate open-save-close lifecycle).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:
- A view extension is contributed to the workbench registry. This extension defines the extension id and extension class.
- The view is included in the default layout for a perspective. Alternatively, the user may open the view from the Perspective menu.
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.
-
-
Field Summary
-
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method 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.-
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
-
Methods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, createPartControl, dispose, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener, setFocus
-
-
-
-
Method Detail
-
getViewSite
IViewSite getViewSite()
Returns the site for this view. This method is equivalent to(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.- Returns:
- the view site; this value may be
null
if the view has not yet been initialized
-
init
void init(IViewSite site) throws PartInitException
Initializes this view with the given view site.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.
- Parameters:
site
- the view site- Throws:
PartInitException
- if this view was not initialized successfully
-
init
void init(IViewSite site, IMemento memento) throws PartInitException
Initializes this view with the given view site. A memento is passed to the view which contains a snapshot of the views state from a previous session. Where possible, the view should try to recreate that state within the part controls.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.
- Parameters:
site
- the view sitememento
- the IViewPart state or null if there is no previous saved state- Throws:
PartInitException
- if this view was not initialized successfully
-
saveState
void saveState(IMemento memento)
Saves the object state within a memento.- Specified by:
saveState
in interfaceIPersistable
- Parameters:
memento
- a memento to receive the object state
-
-