Class IntroPart
- java.lang.Object
-
- org.eclipse.core.commands.common.EventManager
-
- org.eclipse.ui.part.IntroPart
-
- All Implemented Interfaces:
IAdaptable
,IExecutableExtension
,IIntroPart
- Direct Known Subclasses:
CustomizableIntroPart
public abstract class IntroPart extends EventManager implements IIntroPart, IExecutableExtension
Abstract base implementation of an intro part.Subclasses must implement the following methods:
createPartControl
- to create the intro part's controlssetFocus
- to accept focusstandbyStateChanged
- to change the standby mode
Subclasses may extend or reimplement the following methods as required:
setInitializationData
- extend to provide additional initialization when the intro extension is instantiatedinit(IIntroSite, IMemento)
- extend to provide additional initialization when intro is assigned its sitedispose
- extend to provide additional cleanupgetAdapter
- reimplement to make their intro adaptable
- Since:
- 3.0
-
-
Field Summary
-
Fields inherited from interface org.eclipse.ui.intro.IIntroPart
PROP_TITLE
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
IntroPart()
Creates a new intro part.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addPropertyListener(IPropertyListener l)
Adds a listener for changes to properties of this intro part.abstract void
createPartControl(Composite parent)
Creates the SWT controls for this intro part.void
dispose()
TheIntroPart
implementation of thisIIntroPart
method disposes the title image loaded bysetInitializationData
.protected void
firePropertyChange(int propertyId)
Fires a property changed event.<T> T
getAdapter(Class<T> adapter)
This implementation of the method declared byIAdaptable
passes the request along to the platform's adapter manager; roughlyPlatform.getAdapterManager().getAdapter(this, adapter)
.protected IConfigurationElement
getConfigurationElement()
Returns the configuration element for this part.protected Image
getDefaultImage()
Returns the default title image.IIntroSite
getIntroSite()
Returns the site for this intro part.String
getTitle()
Returns the title of this intro part.Image
getTitleImage()
Returns the title image of this intro part.void
init(IIntroSite site, IMemento memento)
The base implementation of thisIIntroPart
method ignores the memento and initializes the part in a fresh state.void
removePropertyListener(IPropertyListener l)
Removes the given property listener from this intro part.void
saveState(IMemento memento)
The base implementation of thisIIntroPart
method does nothing.abstract void
setFocus()
Asks this part to take focus within the workbench.void
setInitializationData(IConfigurationElement cfig, String propertyName, Object data)
TheIntroPart
implementation of thisIExecutableExtension
records the configuration element in and internal state variable (accessible viagetConfigElement
).protected void
setSite(IIntroSite site)
Sets the part site.protected void
setTitle(String titleLabel)
Set the title string for this part.protected void
setTitleImage(Image titleImage)
Sets or clears the title image of this part.-
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
-
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.intro.IIntroPart
standbyStateChanged
-
-
-
-
Method Detail
-
addPropertyListener
public void addPropertyListener(IPropertyListener l)
Description copied from interface:IIntroPart
Adds a listener for changes to properties of this intro part. Has no effect if an identical listener is already registered.The properties ids are as follows:
IIntroPart.PROP_TITLE
- Specified by:
addPropertyListener
in interfaceIIntroPart
- Parameters:
l
- a property listener
-
createPartControl
public abstract void createPartControl(Composite parent)
Description copied from interface:IIntroPart
Creates the SWT controls for this intro 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:
- Create one or more controls within the parent.
- Set the parent layout as needed.
- Register any global actions with the
IActionService
. - Register any popup menus with the
IActionService
. - Register a selection provider with the
ISelectionService
(optional).
- Specified by:
createPartControl
in interfaceIIntroPart
- Parameters:
parent
- the parent control
-
dispose
public void dispose()
TheIntroPart
implementation of thisIIntroPart
method disposes the title image loaded bysetInitializationData
. Subclasses may extend.- Specified by:
dispose
in interfaceIIntroPart
-
firePropertyChange
protected void firePropertyChange(int propertyId)
Fires a property changed event.- Parameters:
propertyId
- the id of the property that changed
-
getAdapter
public <T> T getAdapter(Class<T> adapter)
This implementation of the method declared byIAdaptable
passes the request along to the platform's adapter manager; roughlyPlatform.getAdapterManager().getAdapter(this, adapter)
. 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 interfaceIAdaptable
- Type Parameters:
T
- the class type- Parameters:
adapter
- the adapter class to look up- Returns:
- a object of the given class,
or
null
if this object does not have an adapter for the given class
-
getConfigurationElement
protected 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.- Returns:
- the configuration element for this part
-
getDefaultImage
protected Image getDefaultImage()
Returns the default title image.- Returns:
- the default image
-
getIntroSite
public final IIntroSite getIntroSite()
Description copied from interface:IIntroPart
Returns the site for this intro part.- Specified by:
getIntroSite
in interfaceIIntroPart
- Returns:
- the intro site
-
getTitleImage
public Image getTitleImage()
Description copied from interface:IIntroPart
Returns the title image of this intro part. If this value changes the part must fire a property listener event withIIntroPart.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 interfaceIIntroPart
- Returns:
- the title image
-
getTitle
public String getTitle()
Description copied from interface:IIntroPart
Returns the title of this intro part. If this value changes the part must fire a property listener event withIIntroPart.PROP_TITLE
.The title is used to populate the title bar of this part's visual container.
- Specified by:
getTitle
in interfaceIIntroPart
- Returns:
- the intro part title (not
null
)
-
init
public void init(IIntroSite site, IMemento memento) throws PartInitException
The base implementation of thisIIntroPart
method ignores the memento and initializes the part in a fresh state. Subclasses may extend to perform any state restoration, but must call the super method.- Specified by:
init
in interfaceIIntroPart
- Parameters:
site
- the intro sitememento
- the intro part state ornull
if there is no previous saved state- Throws:
PartInitException
- if this part was not initialized successfully
-
setSite
protected void setSite(IIntroSite site)
Sets the part site.Subclasses must invoke this method from
IIntroPart.init(IIntroSite, IMemento)
.- Parameters:
site
- the intro part site
-
removePropertyListener
public void removePropertyListener(IPropertyListener l)
Description copied from interface:IIntroPart
Removes the given property listener from this intro part. Has no effect if an identical listener is not registered.- Specified by:
removePropertyListener
in interfaceIIntroPart
- Parameters:
l
- a property listener
-
saveState
public void saveState(IMemento memento)
The base implementation of thisIIntroPart
method does nothing. Subclasses may override.- Specified by:
saveState
in interfaceIIntroPart
- Parameters:
memento
- a memento to receive the object state
-
setFocus
public abstract void setFocus()
Description copied from interface:IIntroPart
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
IIntroManager.showIntro(IWorkbenchWindow, boolean)
.- Specified by:
setFocus
in interfaceIIntroPart
-
setInitializationData
public void setInitializationData(IConfigurationElement cfig, String propertyName, Object data)
TheIntroPart
implementation of thisIExecutableExtension
records the configuration element in and internal state variable (accessible viagetConfigElement
). 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 interfaceIExecutableExtension
- Parameters:
cfig
- the configuration element used to trigger this execution. It can be queried by the executable extension for specific configuration propertiespropertyName
- the name of an attribute of the configuration element used on thecreateExecutableExtension(String)
call. This argument can be used in the cases where a single configuration element is used to define multiple executable extensions.data
- adapter data in the form of aString
, aHashtable
, ornull
.- See Also:
IConfigurationElement.createExecutableExtension(String)
-
setTitleImage
protected void setTitleImage(Image titleImage)
Sets or clears the title image of this part.- Parameters:
titleImage
- the title image, ornull
to clear
-
setTitle
protected void setTitle(String titleLabel)
Set the title string for this part.- Parameters:
titleLabel
- the title string. Must not benull
.- Since:
- 3.2
-
-