Class AbstractConsole

java.lang.Object
org.eclipse.ui.console.AbstractConsole
All Implemented Interfaces:
IConsole
Direct Known Subclasses:
TextConsole

public abstract class AbstractConsole extends Object implements IConsole
Common function for consoles.

Clients implementing consoles should subclass this class.

Since:
3.0
  • Constructor Details

    • AbstractConsole

      public AbstractConsole(String name, ImageDescriptor imageDescriptor, boolean autoLifecycle)
      Constructs a new console with the given name and image.
      Parameters:
      name - console name, cannot be null
      imageDescriptor - image descriptor, or null if none
      autoLifecycle - whether this console's lifecycle methods should be called automatically when it is added (initialize()) and removed (destroy()) from the console manager. When false, clients are responsible for calling the lifecycle methods.
      Since:
      3.1
    • AbstractConsole

      public AbstractConsole(String name, String type, ImageDescriptor imageDescriptor, boolean autoLifecycle)
      Constructs a new console with the given name, type, image and lifecycle.
      Parameters:
      name - console name, cannot be null
      type - console type identifier or null
      imageDescriptor - image descriptor, or null if none
      autoLifecycle - whether this console's lifecycle methods should be called automatically when it is added (initialize()) and removed (destroy()) from the console manager. When false, clients are responsible for calling the lifecycle methods.
      Since:
      3.1
    • AbstractConsole

      public AbstractConsole(String name, ImageDescriptor imageDescriptor)
      Constructs a new console with the given name and image. The console's lifecycle methods init() and dispose() will be called when the console is added and removed from the console manager.
      Parameters:
      name - console name, cannot be null
      imageDescriptor - image descriptor, or null if none
  • Method Details

    • getName

      public String getName()
      Description copied from interface: IConsole
      Returns the name of this console.
      Specified by:
      getName in interface IConsole
      Returns:
      the name of this console
    • setName

      protected void setName(String name)
      Sets the name of this console to the specified value and notifies property listeners of the change.
      Parameters:
      name - the new name
    • getImageDescriptor

      public ImageDescriptor getImageDescriptor()
      Description copied from interface: IConsole
      Returns an image descriptor for this console, or null if none.
      Specified by:
      getImageDescriptor in interface IConsole
      Returns:
      an image descriptor for this console, or null if none
    • setImageDescriptor

      protected void setImageDescriptor(ImageDescriptor imageDescriptor)
      Sets the image descriptor for this console to the specified value and notifies property listeners of the change.
      Parameters:
      imageDescriptor - the new image descriptor
    • addPropertyChangeListener

      public void addPropertyChangeListener(IPropertyChangeListener listener)
      Description copied from interface: IConsole
      Adds a listener for changes to properties of this console. Has no effect if an identical listener is already registered.

      The changes supported by the console view are as follows:

      • IBasicPropertyConstants.P_TEXT - indicates the name of a console has changed
      • IBasicPropertyConstants.P_IMAGE - indicates the image of a console has changed

      Consoles may define additional properties as required.

      Specified by:
      addPropertyChangeListener in interface IConsole
      Parameters:
      listener - a property change listener
    • removePropertyChangeListener

      public void removePropertyChangeListener(IPropertyChangeListener listener)
      Description copied from interface: IConsole
      Removes the given property listener from this console page. Has no effect if an identical listener is not already registered.
      Specified by:
      removePropertyChangeListener in interface IConsole
      Parameters:
      listener - a property listener
    • firePropertyChange

      public void firePropertyChange(Object source, String property, Object oldValue, Object newValue)
      Notify all listeners that the given property has changed.
      Parameters:
      source - the object on which a property has changed
      property - identifier of the property that has changed
      oldValue - the old value of the property, or null
      newValue - the new value of the property, or null
    • initialize

      public final void initialize()
      Initializes this console. This method should only be called by clients managing a console's lifecycle, otherwise this method will be called automatically when this console is added to the console manager. The method is called once to initialize this console, marking the beginning of its lifecycle.
      Since:
      3.1
    • init

      protected void init()
      Called when this console is added to the console manager. Default implementation does nothing. Subclasses may override.

      Since 3.1, this method is only called automatically if this console was created with an automatic lifecycle.

    • destroy

      public final void destroy()
      Disposes this console. This method should only be called by clients managing a console's lifecycle, otherwise this method will be called automatically when this console is removed from the console manager. The method is called once to dispose this console, after which this console will no longer be used.
      Since:
      3.1
    • dispose

      protected void dispose()
      Called when this console is removed from the console manager. Default implementation does nothing. Subclasses may override.

      Since 3.1, this methods is only called automatically if this console was created with an automatic lifecycle.

    • activate

      public void activate()
      Shows this console in all console views. This console will be become visible if another console is currently pinned.
      Since:
      3.1
    • setType

      protected void setType(String typeIdentifier)
      Sets this console's type identifier.
      Parameters:
      typeIdentifier - the type identifier for this console
      Since:
      3.1
    • getType

      public String getType()
      Description copied from interface: IConsole
      Returns a unique identifier for this console's type, or null if unspecified.
      Specified by:
      getType in interface IConsole
      Returns:
      a unique identifier for this console's type, or null
      Since:
      3.1
    • getHelpContextId

      public String getHelpContextId()
      Returns the help context identifier for this console, or null if none. When a non-null value is returned the associated help will be installed for this console.
      Returns:
      help context id or null
      Since:
      3.2