org.eclipse.debug.ui.memory

## Class AbstractMemoryRendering

- java.lang.Object
- - org.eclipse.core.runtime.PlatformObject
  - - org.eclipse.debug.ui.memory.AbstractMemoryRendering

All Implemented Interfaces:
  IAdaptable, IMemoryRendering

Direct Known Subclasses:
  org.eclipse.debug.internal.ui.views.memory.renderings.AbstractBaseTableRendering

    public abstract class AbstractMemoryRendering
    extends PlatformObject
    implements IMemoryRendering

Abstract implementation of a memory rendering.

To contribute an action to a rendering, an `objectContribution` can be used on a rendering implementation class itself using a `popupMenus` extension. Additionally, the context menu created by `createPopupMenu()` is registered with an identifier of this rendering's container identifier. Actions may also be contributed to the container's context menu specifically by using a `viewerContribution` on a `popupMenus` extension that has a `targetID` referring to this rendering container's identifier.

Clients implementing memory renderings must subclass this class.

Since:
  3.1

### Constructor Summary

Constructors
Constructor and Description
`AbstractMemoryRendering(String renderingId)` Constructs a new rendering of the given type.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `activated()` Notification this rendering has become the active rendering.
`void` `addPropertyChangeListener(IPropertyChangeListener listener)` Adds a listener for property changes to this rendering.
`void` `becomesHidden()` Notification this rendering has become hidden in its container.
`void` `becomesVisible()` Notification this rendering has become visible in its container.
`protected void` `createPopupMenu(Control control)` Helper method for creating a pop up menu in the rendering for a control.
`void` `deactivated()` Notification this rendering is no longer the active rendering.
`protected Image` `decorateImage(Image image)` Decorates and returns this rendering's image.
`protected String` `decorateLabel(String label)` Decorates and returns this rendering's label.
`void` `dispose()` Disposes this rendering.
`protected void` `firePropertyChangedEvent(PropertyChangeEvent event)` Fires the given event to all registered listeners.
`Image` `getImage()` Returns an image for this rendering.
`String` `getLabel()` Returns a label for this rendering.
`IMemoryBlock` `getMemoryBlock()` Returns the memory block displayed by this rendering.
`IMemoryRenderingContainer` `getMemoryRenderingContainer()` Returns the container hosting this memory rendering.
`protected MenuManager` `getPopupMenuManager()` Returns the pop up menu manager for this rendering, or `null` if none.
`String` `getRenderingId()` Returns the identifier associated with this rendering's type.
`void` `init(IMemoryRenderingContainer container, IMemoryBlock block)` Initializes this rendering to be hosted in the given container, displaying the given memory block.
`boolean` `isVisible()` Returns whether this rendering is currently visible.
`void` `removePropertyChangeListener(IPropertyChangeListener listener)` Removes the given property change listener from this rendering.

### Methods inherited from class org.eclipse.core.runtime.PlatformObject

`getAdapter`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.eclipse.debug.ui.memory.IMemoryRendering

`createControl, getControl`

### Methods inherited from interface org.eclipse.core.runtime.IAdaptable

`getAdapter`

### Constructor Detail

#### AbstractMemoryRendering

    public AbstractMemoryRendering(String renderingId)

Constructs a new rendering of the given type.

Parameters:
  `renderingId` - memory rendering type identifier

### Method Detail

#### init

    public void init(IMemoryRenderingContainer container,
                     IMemoryBlock block)

Description copied from interface: `IMemoryRendering`
Initializes this rendering to be hosted in the given container, displaying the given memory block. This method is called before this rendering's control has been created.

Specified by:
  `init` in interface `IMemoryRendering`
Parameters:
  `container` - container hosting this rendering
  `block` - the memory block to render

#### dispose

    public void dispose()

Description copied from interface: `IMemoryRendering`
Disposes this rendering.

Specified by:
  `dispose` in interface `IMemoryRendering`

#### activated

    public void activated()

Description copied from interface: `IMemoryRendering`
Notification this rendering has become the active rendering. Only one rendering can be active at once. Generally, the active rendering is visible and has focus.

Specified by:
  `activated` in interface `IMemoryRendering`

#### deactivated

    public void deactivated()

Description copied from interface: `IMemoryRendering`
Notification this rendering is no longer the active rendering.

Specified by:
  `deactivated` in interface `IMemoryRendering`

#### becomesVisible

    public void becomesVisible()

Description copied from interface: `IMemoryRendering`
Notification this rendering has become visible in its container. Note that a rendering does not have to be active to be visible.

Specified by:
  `becomesVisible` in interface `IMemoryRendering`

#### becomesHidden

    public void becomesHidden()

Description copied from interface: `IMemoryRendering`
Notification this rendering has become hidden in its container.

Specified by:
  `becomesHidden` in interface `IMemoryRendering`

#### getMemoryBlock

    public IMemoryBlock getMemoryBlock()

Description copied from interface: `IMemoryRendering`
Returns the memory block displayed by this rendering.

Specified by:
  `getMemoryBlock` in interface `IMemoryRendering`
Returns:
  the memory block displayed by this rendering

#### getRenderingId

    public String getRenderingId()

Description copied from interface: `IMemoryRendering`
Returns the identifier associated with this rendering's type.

Specified by:
  `getRenderingId` in interface `IMemoryRendering`
Returns:
  the identifier associated with this rendering's type
See Also:
  `IMemoryRenderingType`

#### addPropertyChangeListener

    public void addPropertyChangeListener(IPropertyChangeListener listener)

Description copied from interface: `IMemoryRendering`
Adds a listener for property changes to this rendering. Has no effect if an identical listener is already registered.

Specified by:
  `addPropertyChangeListener` in interface `IMemoryRendering`
Parameters:
  `listener` - a property change listener

#### removePropertyChangeListener

    public void removePropertyChangeListener(IPropertyChangeListener listener)

Description copied from interface: `IMemoryRendering`
Removes the given property change listener from this rendering. Has no effect if the identical listener is not registered.

Specified by:
  `removePropertyChangeListener` in interface `IMemoryRendering`
Parameters:
  `listener` - a property change listener

#### getImage

    public Image getImage()

Description copied from interface: `IMemoryRendering`
Returns an image for this rendering. Clients should not dispose this image. This rendering will dispose the image if required when this rendering is disposed.

Specified by:
  `getImage` in interface `IMemoryRendering`
Returns:
  an image for this rendering

#### decorateImage

    protected Image decorateImage(Image image)

Decorates and returns this rendering's image.

Parameters:
  `image` - base image
Returns:
  decorated image
Since:
  3.2

#### getLabel

    public String getLabel()

Description copied from interface: `IMemoryRendering`
Returns a label for this rendering.

Specified by:
  `getLabel` in interface `IMemoryRendering`
Returns:
  a label for this rendering

#### decorateLabel

    protected String decorateLabel(String label)

Decorates and returns this rendering's label.

Parameters:
  `label` - base label
Returns:
  decorated label
Since:
  3.2

#### createPopupMenu

    protected void createPopupMenu(Control control)

Helper method for creating a pop up menu in the rendering for a control. Call this method when a context menu is required for a control in a rendering.

To contribute an action to a rendering, an `objectContribution` can be used on a rendering implementation class itself using a `popupMenus` extension. Additionally, the context menu created by this method is registered with an identifier of this rendering's container. Actions may also be contributed to the context menu specifically by using a `viewerContribution` on a `popupMenus` extension that has a `targetID` referring to this rendering container's identifier.

Clients are expected to become a menu listener for their pop up menu if they require to fill the context menu for the rendering.

Parameters:
  `control` - - control to create the pop up menu for

#### getPopupMenuManager

    protected MenuManager getPopupMenuManager()

Returns the pop up menu manager for this rendering, or `null` if none.

Returns:
  the pop up menu manager for this rendering, or `null`

#### firePropertyChangedEvent

    protected void firePropertyChangedEvent(PropertyChangeEvent event)

Fires the given event to all registered listeners.

Parameters:
  `event` - the event to fire

#### getMemoryRenderingContainer

    public IMemoryRenderingContainer getMemoryRenderingContainer()

Returns the container hosting this memory rendering.

Returns:
  the container hosting this memory rendering

#### isVisible

    public boolean isVisible()

Returns whether this rendering is currently visible.

Returns:
  whether this rendering is currently visible