Class 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 controls
    • setFocus- to accept focus
    • standbyStateChanged- 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 instantiated
    • init(IIntroSite, IMemento)- extend to provide additional initialization when intro is assigned its site
    • dispose- extend to provide additional cleanup
    • getAdapter- reimplement to make their intro adaptable
    Since:
    3.0
    • Constructor Detail

      • IntroPart

        protected IntroPart()
        Creates a new intro part.
    • 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 interface IIntroPart
        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:

        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 IIntroPart
        Parameters:
        parent - the parent control
      • dispose

        public void dispose()
        The IntroPart implementation of this IIntroPart method disposes the title image loaded by setInitializationData. Subclasses may extend.
        Specified by:
        dispose in interface IIntroPart
      • 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 by IAdaptable passes the request along to the platform's adapter manager; roughly Platform.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 interface IAdaptable
        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 interface IIntroPart
        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 with IIntroPart.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 IIntroPart
        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 with IIntroPart.PROP_TITLE.

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

        Specified by:
        getTitle in interface IIntroPart
        Returns:
        the intro part title (not null)
      • init

        public void init​(IIntroSite site,
                         IMemento memento)
                  throws PartInitException
        The base implementation of this IIntroPartmethod 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 interface IIntroPart
        Parameters:
        site - the intro site
        memento - the intro part state or null if there is no previous saved state
        Throws:
        PartInitException - if this part was not initialized successfully
      • 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 interface IIntroPart
        Parameters:
        l - a property listener
      • saveState

        public void saveState​(IMemento memento)
        The base implementation of this IIntroPart method does nothing. Subclasses may override.
        Specified by:
        saveState in interface IIntroPart
        Parameters:
        memento - a memento to receive the object state
      • setInitializationData

        public void setInitializationData​(IConfigurationElement cfig,
                                          String propertyName,
                                          Object data)
        The IntroPart 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 IExecutableExtension
        Parameters:
        cfig - the configuration element used to trigger this execution. It can be queried by the executable extension for specific configuration properties
        propertyName - the name of an attribute of the configuration element used on the createExecutableExtension(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 a String, a Hashtable, or null.
        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, or null to clear
      • setTitle

        protected void setTitle​(String titleLabel)
        Set the title string for this part.
        Parameters:
        titleLabel - the title string. Must not be null.
        Since:
        3.2