Eclipse Platform
2.0

org.eclipse.ui
Interface IViewPart

All Superinterfaces:
IAdaptable, IWorkbenchPart
All Known Subinterfaces:
IDebugView, IResourceNavigator, ISearchResultView
All Known Implementing Classes:
AbstractDebugView, ResourceNavigator, ViewPart

public interface IViewPart
extends IWorkbenchPart

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:

  1. A view extension is contributed to the workbench registry. This extension defines the extension id and extension class.
  2. 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.

See Also:
IWorkbenchPage.showView(java.lang.String), ViewPart

Field Summary
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Method Summary
 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.ui.IWorkbenchPart
addPropertyListener, createPartControl, dispose, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener, setFocus
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Method Detail

getViewSite

public IViewSite getViewSite()
Returns the site for this view.

Returns:
the view site

init

public void init(IViewSite site)
          throws PartInitException
Initializes this view with the given view site.

This method is automatically called by the workbench shortly after part construction. 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

public 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 part construction. It marks the start of the views's lifecycle. Clients must not call this method.

Parameters:
site - the view site
memento - the IViewPart state or null if there is no previous saved state
Throws:
PartInitException - if this view was not initialized successfully

saveState

public void saveState(IMemento memento)
Saves the object state within a memento.

Parameters:
memento - a memento to receive the object state

Eclipse Platform
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.