|
Eclipse Platform Release 3.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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:
Subclasses may extend or reimplement the following methods as required:
Field Summary |
Fields inherited from interface org.eclipse.ui.IWorkbenchPart |
PROP_TITLE |
Constructor Summary | |
protected | ViewPart()
Creates a new view. |
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. |
protected void | setContentDescription(String description)
Sets the content description for this part. |
void | setInitializationData(IConfigurationElement cfig,
String propertyName,
Object data)
This method is called by the implementation of the method IConfigurationElement.createExecutableExtension on a newly constructed extension, passing it its relevant configuration information. Most executable extensions only make use of the first two call arguments. Regular executable extensions specify their Java implementation class name as an attribute of the configuration element for the extension. For example <action run="com.example.BaseAction"/>In the above example, this method would be called with a reference to the <action> element (first argument), and "run" as the name of the attribute that defined this executable extension (second argument). The last parameter is for the specific use of extension adapters and is typically not used by regular executable extensions. There are two supported ways of associating additional adapter-specific data with the configuration in a way that is transparent to the extension point implementor: (1) by specifying adapter data as part of the implementation class attribute value. The Java class name can be followed by a ":" separator, followed by any adapter data in string form. For example, if the extension point specifies an attribute "run" to contain the name of the extension implementation, an adapter can be configured as <action run="com.example.ExternalAdapter:./cmds/util.exe -opt 3"/> (2) by converting the attribute used to specify the executable extension to a child element of the original configuration element, and specifying the adapter data in the form of xml markup. Using this form, the example above would become <action> < Form (2) will typically only be used for extension points that anticipate the majority of extensions configured into it will in fact be in the form of adapters. In either case, the specified adapter class is instantiated using its 0-argument public constructor. The adapter data is passed as the last argument of this method. The data argument is defined as Object. It can have the following values:
The 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. 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, 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 |
Methods inherited from interface org.eclipse.core.runtime.IAdaptable |
getAdapter |
Constructor Detail |
protected ViewPart()
Method Detail |
public IViewSite getViewSite()
public void 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.
public void 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.
public void saveState(IMemento memento)
protected void setPartName(String partName)
setPartName and setContentDescription are intended to replace setTitle. This may change a value that was previously set using setTitle.
protected void setContentDescription(String description)
This may overwrite a value that was previously set in setTitle
public void setInitializationData(IConfigurationElement cfig, String propertyName, Object data)
Regular executable extensions specify their Java implementation class name as an attribute of the configuration element for the extension. For example
<action run="com.example.BaseAction"/>In the above example, this method would be called with a reference to the <action> element (first argument), and "run" as the name of the attribute that defined this executable extension (second argument).
The last parameter is for the specific use of extension adapters and is typically not used by regular executable extensions.
There are two supported ways of associating additional adapter-specific data with the configuration in a way that is transparent to the extension point implementor:
(1) by specifying adapter data as part of the implementation class attribute value. The Java class name can be followed by a ":" separator, followed by any adapter data in string form. For example, if the extension point specifies an attribute "run" to contain the name of the extension implementation, an adapter can be configured as
<action run="com.example.ExternalAdapter:./cmds/util.exe -opt 3"/>
(2) by converting the attribute used to specify the executable extension to a child element of the original configuration element, and specifying the adapter data in the form of xml markup. Using this form, the example above would become
<action> <run class="com.xyz.ExternalAdapter"> <parameter name="exec" value="./cmds/util.exe"/> <parameter name="opt" value="3"/> </run > </action>
Form (2) will typically only be used for extension points that anticipate the majority of extensions configured into it will in fact be in the form of adapters.
In either case, the specified adapter class is instantiated using its 0-argument public constructor. The adapter data is passed as the last argument of this method. The data argument is defined as Object. It can have the following values:
The 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.
|
Eclipse Platform Release 3.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.