Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.ui.part
Class WorkbenchPart  view WorkbenchPart download WorkbenchPart.java

java.lang.Object
  extended byorg.eclipse.ui.part.WorkbenchPart
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.IExecutableExtension, org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.IWorkbenchPart2
Direct Known Subclasses:
EditorPart, ViewPart

public abstract class WorkbenchPart
extends java.lang.Object
implements org.eclipse.ui.IWorkbenchPart2, org.eclipse.core.runtime.IExecutableExtension

Abstract base implementation of all workbench parts.

This class is not intended to be subclassed by clients outside this package; clients should instead subclass ViewPart or EditorPart.


Field Summary
private  org.eclipse.core.runtime.IConfigurationElement configElement
           
private  java.lang.String contentDescription
           
private  org.eclipse.jface.resource.ImageDescriptor imageDescriptor
           
private  java.lang.String partName
           
private  org.eclipse.ui.IWorkbenchPartSite partSite
           
private  org.eclipse.jface.util.ListenerList propChangeListeners
           
private  java.lang.String title
           
private  org.eclipse.swt.graphics.Image titleImage
           
private  java.lang.String toolTip
           
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Constructor Summary
protected WorkbenchPart()
          Creates a new workbench part.
 
Method Summary
 void addPropertyListener(org.eclipse.ui.IPropertyListener l)
          Adds a listener for changes to properties of this workbench part.
abstract  void createPartControl(org.eclipse.swt.widgets.Composite parent)
          Creates the SWT controls for this workbench part.
 void dispose()
          The WorkbenchPart implementation of this IWorkbenchPart method disposes the title image loaded by setInitializationData.
protected  void firePropertyChange(int propertyId)
          Fires a property changed event.
 java.lang.Object getAdapter(java.lang.Class adapter)
          null Subclasses may override this method (however, if they do so, they should invoke the method on their superclass to ensure that the Platform's adapter manager is consulted).
protected  org.eclipse.core.runtime.IConfigurationElement getConfigurationElement()
          Returns the configuration element for this part.
 java.lang.String getContentDescription()
          null
protected  org.eclipse.swt.graphics.Image getDefaultImage()
          Returns the default title image.
 java.lang.String getPartName()
          null
 org.eclipse.ui.IWorkbenchPartSite getSite()
          Returns the site for this workbench part.
 java.lang.String getTitle()
          null
 org.eclipse.swt.graphics.Image getTitleImage()
          Returns the title image of this workbench part.
 java.lang.String getTitleToolTip()
          Returns the title tool tip text of this workbench part.
(package private)  void internalSetContentDescription(java.lang.String description)
           
(package private)  void internalSetPartName(java.lang.String partName)
           
 void removePropertyListener(org.eclipse.ui.IPropertyListener l)
          Removes the given property listener from this workbench part.
protected  void setContentDescription(java.lang.String description)
          Sets the content description for this part.
(package private)  void setDefaultTitle()
           
abstract  void setFocus()
          Asks this part to take focus within the workbench.
 void setInitializationData(org.eclipse.core.runtime.IConfigurationElement cfig, java.lang.String propertyName, java.lang.Object data)
          null The WorkbenchPart implementation of this IExecutableExtension records the configuration element in and internal state variable (accessible via getConfigElement).
protected  void setPartName(java.lang.String partName)
          Sets the name of this part.
protected  void setSite(org.eclipse.ui.IWorkbenchPartSite site)
          Sets the part site.
protected  void setTitle(java.lang.String title)
          Deprecated. new code should use setPartName and setContentDescription
protected  void setTitleImage(org.eclipse.swt.graphics.Image titleImage)
          Sets or clears the title image of this part.
protected  void setTitleToolTip(java.lang.String toolTip)
          Sets or clears the title tool tip text of this part.
 void showBusy(boolean busy)
          Show that this part is busy due to a Job running that it is listening to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

title

private java.lang.String title

imageDescriptor

private org.eclipse.jface.resource.ImageDescriptor imageDescriptor

titleImage

private org.eclipse.swt.graphics.Image titleImage

toolTip

private java.lang.String toolTip

configElement

private org.eclipse.core.runtime.IConfigurationElement configElement

partSite

private org.eclipse.ui.IWorkbenchPartSite partSite

propChangeListeners

private org.eclipse.jface.util.ListenerList propChangeListeners

partName

private java.lang.String partName

contentDescription

private java.lang.String contentDescription
Constructor Detail

WorkbenchPart

protected WorkbenchPart()
Creates a new workbench part.

Method Detail

addPropertyListener

public void addPropertyListener(org.eclipse.ui.IPropertyListener l)
Description copied from interface: org.eclipse.ui.IWorkbenchPart
Adds a listener for changes to properties of this workbench part. Has no effect if an identical listener is already registered.

The property ids are defined in org.eclipse.ui.IWorkbenchPartConstants.

Specified by:
addPropertyListener in interface org.eclipse.ui.IWorkbenchPart

createPartControl

public abstract void createPartControl(org.eclipse.swt.widgets.Composite parent)
Description copied from interface: org.eclipse.ui.IWorkbenchPart
Creates the SWT controls for this workbench part.

Clients should not call this method (the workbench calls this method when it needs to, which may be never).

For implementors this is a multi-step process:

  1. Create one or more controls within the parent.
  2. Set the parent layout as needed.
  3. Register any global actions with the IActionService.
  4. Register any popup menus with the IActionService.
  5. Register a selection provider with the ISelectionService (optional).

Specified by:
createPartControl in interface org.eclipse.ui.IWorkbenchPart

dispose

public void dispose()
The WorkbenchPart implementation of this IWorkbenchPart method disposes the title image loaded by setInitializationData. Subclasses may extend.

Specified by:
dispose in interface org.eclipse.ui.IWorkbenchPart

firePropertyChange

protected void firePropertyChange(int propertyId)
Fires a property changed event.


getAdapter

public java.lang.Object getAdapter(java.lang.Class adapter)
null Subclasses may override this method (however, if they do so, they should invoke the method on their superclass to ensure that the Platform's adapter manager is consulted).

Specified by:
getAdapter in interface org.eclipse.core.runtime.IAdaptable

getConfigurationElement

protected org.eclipse.core.runtime.IConfigurationElement getConfigurationElement()
Returns the configuration element for this part. The configuration element comes from the plug-in registry entry for the extension defining this part.


getDefaultImage

protected org.eclipse.swt.graphics.Image getDefaultImage()
Returns the default title image.


getSite

public org.eclipse.ui.IWorkbenchPartSite getSite()
Description copied from interface: org.eclipse.ui.IWorkbenchPart
Returns the site for this workbench part. The site can be null while the workbench part is being initialized. After the initialization is complete, this value must be non-null for the remainder of the part's life cycle.

Specified by:
getSite in interface org.eclipse.ui.IWorkbenchPart

getTitle

public java.lang.String getTitle()
null

It is considered bad practise to overload or extend this method. Parts should set their title by calling setPartName and/or setContentDescription.

Specified by:
getTitle in interface org.eclipse.ui.IWorkbenchPart

getTitleImage

public org.eclipse.swt.graphics.Image getTitleImage()
Description copied from interface: org.eclipse.ui.IWorkbenchPart
Returns the title image of this workbench part. If this value changes the part must fire a property listener event with PROP_TITLE.

The title image is usually used to populate the title bar of this part's visual container. Since this image is managed by the part itself, callers must not dispose the returned image.

Specified by:
getTitleImage in interface org.eclipse.ui.IWorkbenchPart

getTitleToolTip

public java.lang.String getTitleToolTip()
Description copied from interface: org.eclipse.ui.IWorkbenchPart
Returns the title tool tip text of this workbench part. An empty string result indicates no tool tip. If this value changes the part must fire a property listener event with PROP_TITLE.

The tool tip text is used to populate the title bar of this part's visual container.

Specified by:
getTitleToolTip in interface org.eclipse.ui.IWorkbenchPart

removePropertyListener

public void removePropertyListener(org.eclipse.ui.IPropertyListener l)
Description copied from interface: org.eclipse.ui.IWorkbenchPart
Removes the given property listener from this workbench part. Has no affect if an identical listener is not registered.

Specified by:
removePropertyListener in interface org.eclipse.ui.IWorkbenchPart

setFocus

public abstract void setFocus()
Description copied from interface: org.eclipse.ui.IWorkbenchPart
Asks this part to take focus within the workbench.

Clients should not call this method (the workbench calls this method at appropriate times). To have the workbench activate a part, use IWorkbenchPage.activate(IWorkbenchPart) instead.

Specified by:
setFocus in interface org.eclipse.ui.IWorkbenchPart

setInitializationData

public void setInitializationData(org.eclipse.core.runtime.IConfigurationElement cfig,
                                  java.lang.String propertyName,
                                  java.lang.Object data)
null 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.

Specified by:
setInitializationData in interface org.eclipse.core.runtime.IExecutableExtension

setSite

protected void setSite(org.eclipse.ui.IWorkbenchPartSite site)
Sets the part site.

Subclasses must invoke this method from IEditorPart.init and IViewPart.init.


setTitle

protected void setTitle(java.lang.String title)
Deprecated. new code should use setPartName and setContentDescription

Sets or clears the title of this part. Clients should call this method instead of overriding getTitle.

This may change a title that was previously set using setPartName or setContentDescription.


setTitleImage

protected void setTitleImage(org.eclipse.swt.graphics.Image titleImage)
Sets or clears the title image of this part.


setTitleToolTip

protected void setTitleToolTip(java.lang.String toolTip)
Sets or clears the title tool tip text of this part. Clients should call this method instead of overriding getTitleToolTip


showBusy

public void showBusy(boolean busy)
Show that this part is busy due to a Job running that it is listening to.

Since:
3.0

getPartName

public java.lang.String getPartName()
null

It is considered bad practise to overload or extend this method. Parts should call setPartName to change their part name.

Specified by:
getPartName in interface org.eclipse.ui.IWorkbenchPart2

setPartName

protected void setPartName(java.lang.String partName)
Sets the name of this part. The name will be shown in the tab area for the part. Clients should call this method instead of overriding getPartName. Setting this to the empty string will cause a default part name to be used.

setPartName and setContentDescription are intended to replace setTitle. This may change a value that was previously set using setTitle.

Since:
3.0

setDefaultTitle

void setDefaultTitle()

getContentDescription

public java.lang.String getContentDescription()
null

It is considered bad practise to overload or extend this method. Parts should call setContentDescription to change their content description.

Specified by:
getContentDescription in interface org.eclipse.ui.IWorkbenchPart2

setContentDescription

protected void setContentDescription(java.lang.String description)
Sets the content description for this part. The content description is typically a short string describing the current contents of the part. Setting this to the empty string will cause a default content description to be used. Clients should call this method instead of overriding getContentDescription(). For views, the content description is shown (by default) in a line near the top of the view. For editors, the content description is shown beside the part name when showing a list of editors. If the editor is open on a file, this typically contains the path to the input file, without the filename or trailing slash.

This may overwrite a value that was previously set in setTitle

Since:
3.0

internalSetContentDescription

void internalSetContentDescription(java.lang.String description)

internalSetPartName

void internalSetPartName(java.lang.String partName)