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 protectedIntroPart()Creates a new intro part.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddPropertyListener(IPropertyListener l)Adds a listener for changes to properties of this intro part.abstract voidcreatePartControl(Composite parent)Creates the SWT controls for this intro part.voiddispose()TheIntroPartimplementation of thisIIntroPartmethod disposes the title image loaded bysetInitializationData.protected voidfirePropertyChange(int propertyId)Fires a property changed event.<T> TgetAdapter(Class<T> adapter)This implementation of the method declared byIAdaptablepasses the request along to the platform's adapter manager; roughlyPlatform.getAdapterManager().getAdapter(this, adapter).protected IConfigurationElementgetConfigurationElement()Returns the configuration element for this part.protected ImagegetDefaultImage()Returns the default title image.IIntroSitegetIntroSite()Returns the site for this intro part.StringgetTitle()Returns the title of this intro part.ImagegetTitleImage()Returns the title image of this intro part.voidinit(IIntroSite site, IMemento memento)The base implementation of thisIIntroPartmethod ignores the memento and initializes the part in a fresh state.voidremovePropertyListener(IPropertyListener l)Removes the given property listener from this intro part.voidsaveState(IMemento memento)The base implementation of thisIIntroPartmethod does nothing.abstract voidsetFocus()Asks this part to take focus within the workbench.voidsetInitializationData(IConfigurationElement cfig, String propertyName, Object data)TheIntroPartimplementation of thisIExecutableExtensionrecords the configuration element in and internal state variable (accessible viagetConfigElement).protected voidsetSite(IIntroSite site)Sets the part site.protected voidsetTitle(String titleLabel)Set the title string for this part.protected voidsetTitleImage(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:IIntroPartAdds 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:
addPropertyListenerin interfaceIIntroPart- Parameters:
l- a property listener
-
createPartControl
public abstract void createPartControl(Composite parent)
Description copied from interface:IIntroPartCreates 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:
createPartControlin interfaceIIntroPart- Parameters:
parent- the parent control
-
dispose
public void dispose()
TheIntroPartimplementation of thisIIntroPartmethod disposes the title image loaded bysetInitializationData. Subclasses may extend.- Specified by:
disposein 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 byIAdaptablepasses 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:
getAdapterin interfaceIAdaptable- Type Parameters:
T- the class type- Parameters:
adapter- the adapter class to look up- Returns:
- a object of the given class,
or
nullif 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:IIntroPartReturns the site for this intro part.- Specified by:
getIntroSitein interfaceIIntroPart- Returns:
- the intro site
-
getTitleImage
public Image getTitleImage()
Description copied from interface:IIntroPartReturns 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:
getTitleImagein interfaceIIntroPart- Returns:
- the title image
-
getTitle
public String getTitle()
Description copied from interface:IIntroPartReturns 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:
getTitlein interfaceIIntroPart- Returns:
- the intro part title (not
null)
-
init
public void init(IIntroSite site, IMemento memento) throws PartInitException
The base implementation of thisIIntroPartmethod 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:
initin interfaceIIntroPart- Parameters:
site- the intro sitememento- the intro part state ornullif 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:IIntroPartRemoves the given property listener from this intro part. Has no effect if an identical listener is not registered.- Specified by:
removePropertyListenerin interfaceIIntroPart- Parameters:
l- a property listener
-
saveState
public void saveState(IMemento memento)
The base implementation of thisIIntroPartmethod does nothing. Subclasses may override.- Specified by:
saveStatein interfaceIIntroPart- Parameters:
memento- a memento to receive the object state
-
setFocus
public abstract void setFocus()
Description copied from interface:IIntroPartAsks 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:
setFocusin interfaceIIntroPart
-
setInitializationData
public void setInitializationData(IConfigurationElement cfig, String propertyName, Object data)
TheIntroPartimplementation of thisIExecutableExtensionrecords 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:
setInitializationDatain 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, ornullto 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
-
-