|
Eclipse eRCP Release 1.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.ui.part.WorkbenchPart
org.eclipse.ui.part.ViewPart
Abstract base implementation of all workbench views.
This class should be subclassed by clients wishing to define new views.
The name of the subclass should be given as the "class"
attribute in a view
extension contributed to the workbench's
view extension point (named "org.eclipse.ui.views"
).
For example, the plug-in's XML markup might contain:
<extension point="org.eclipse.ui.views"> <view id="com.example.myplugin.view" name="My View" class="com.example.myplugin.MyView" icon="images/eview.gif" /> </extension>where
com.example.myplugin.MyView
is the name of the
ViewPart
subclass.
Subclasses must implement the following methods:
createPartControl
- to create the view's controls setFocus
- to accept focusSubclasses may extend or reimplement the following methods as required:
setInitializationData
- extend to provide additional
initialization when view extension is instantiatedinit(IWorkbenchPartSite)
- extend to provide additional
initialization when view is assigned its sitedispose
- extend to provide additional cleanupgetAdapter
- reimplement to make their view adaptable
Field Summary |
---|
Fields inherited from interface org.eclipse.ui.IWorkbenchPart |
---|
PROP_TITLE |
Constructor Summary | |
---|---|
protected |
ViewPart()
Creates a new view. |
Method Summary | |
---|---|
protected void |
checkSite(IWorkbenchPartSite site)
Checks that the given site is valid for this type of part. |
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. |
protected void |
setContentDescription(String description)
Sets the content description for this part. |
void |
setInitializationData(IConfigurationElement cfig,
String propertyName,
Object data)
{@inheritDoc} The WorkbenchPart implementation of this
IExecutableExtension records the configuration element in
and internal state variable (accessible via getConfigElement ).
|
protected void |
setPartName(String partName)
Sets the name of this part. |
Methods inherited from class org.eclipse.ui.part.WorkbenchPart |
---|
addPropertyListener, createPartControl, dispose, firePropertyChange, getAdapter, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener, setFocus, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.eclipse.ui.IWorkbenchPart |
---|
addPropertyListener, createPartControl, dispose, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener, setFocus |
Constructor Detail |
protected ViewPart()
Method Detail |
public IViewSite getViewSite()
IViewPart
(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.
getViewSite
in interface IViewPart
null
if the view
has not yet been initializedpublic void init(IViewSite site) throws PartInitException
IViewPart
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.
init
in interface IViewPart
site
- the view site
PartInitException
- if this view was not initialized successfullypublic void init(IViewSite site, IMemento memento) throws PartInitException
IViewPart
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.
init
in interface IViewPart
site
- the view sitememento
- the IViewPart state or null if there is no previous saved state
PartInitException
- if this view was not initialized successfullypublic void saveState(IMemento memento)
IViewPart
saveState
in interface IViewPart
memento
- a memento to receive the object stateprotected void setPartName(String partName)
WorkbenchPart
setPartName and setContentDescription are intended to replace setTitle. This may change a value that was previously set using setTitle.
setPartName
in class WorkbenchPart
partName
- the part name, as it should be displayed in tabs.protected void setContentDescription(String description)
WorkbenchPart
This may overwrite a value that was previously set in setTitle
setContentDescription
in class WorkbenchPart
description
- the content descriptionpublic void setInitializationData(IConfigurationElement cfig, String propertyName, Object data)
WorkbenchPart
WorkbenchPart
implementation of this
IExecutableExtension
records the configuration element in
and internal state variable (accessible via getConfigElement
).
It also loads the title image, if one is specified in the configuration element.
Subclasses may extend.
Should not be called by clients. It is called by the core plugin when creating
this executable extension.
setInitializationData
in class WorkbenchPart
protected final void checkSite(IWorkbenchPartSite site)
IViewSite
.
checkSite
in class WorkbenchPart
site
- the site to check
|
Eclipse eRCP Release 1.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |