Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.debug.ui
Class AbstractDebugView

    java.lang.Object
      org.eclipse.ui.part.WorkbenchPart
          org.eclipse.ui.part.ViewPart
              org.eclipse.ui.part.PageBookView
                  org.eclipse.debug.ui.AbstractDebugView

All Implemented Interfaces:
  IAdaptable, IDebugView, IDoubleClickListener, IExecutableExtension, IPartListener, IViewPart, IWorkbenchPart, IWorkbenchPart2

public abstract class AbstractDebugView
extends PageBookView
implements IDebugView, IDoubleClickListener

Common function for views related to debugging. Clients implementing views for a debugger should subclass this class. Common function includes:

- Debug view adpater implementation - `IDebugView`
- Action registry - actions can be stored in this view with a key. Actions that implement `IUpdate` are updated when `updateActions()` is called.
- Hooks the context menu associated with this view's underlying viewer and registers the menu with this view's site, such that other plug-ins may contribute.
- Hooks a key press listener, and invokes the `REMOVE_ACTION` when the delete key is pressed.
- Hooks a double-click listener, and invokes the `DOUBLE_CLICK_ACTION` when the mouse is double-clicked.
- Provides a mechanism for displaying an error message in the view, via the `PageBookView` mechanism. By default, a page book is created with a page showing this view's viewer. A message page is also created and shown when `showMessage(String)` is called.

This class may be subclassed.

Since:
  2.0

Nested Class Summary

Nested classes inherited from class org.eclipse.ui.part.PageBookView
`PageBookView.PageRec, PageBookView.SelectionProvider`

Field Summary

Fields inherited from interface org.eclipse.debug.ui.IDebugView
`COPY_ACTION, CUT_ACTION, DOUBLE_CLICK_ACTION, FIND_ACTION, PASTE_ACTION, REMOVE_ACTION, SELECT_ALL_ACTION`

Fields inherited from interface org.eclipse.ui.IWorkbenchPart
`PROP_TITLE`

Constructor Summary
`AbstractDebugView()` Constructs a new debug view.

Method Summary
`void` | `add(IUpdate updatable)` Adds the given IUpdate to this view's collection of updatable objects.
`void` | `addContextMenuManager(IMenuManager contextMenuManager)` Adds a context menu manager that is relevant to this view.
`void` | `asyncExec(Runnable r)` Registers the given runnable with the display associated with this view's control, if any.
`protected void` | `becomesHidden()` Notification this view is now hidden.
`protected void` | `becomesVisible()` Notification this view is now visible.
`protected abstract void` | `configureToolBar(IToolBarManager tbm)` Subclasses implement this menu to contribute actions to the toolbar.
`protected abstract void` | `createActions()` Creates this view's actions.
`protected void` | `createContextMenu(Control menuControl)` Creates a pop-up menu on the given control.
`protected IPage` | `createDefaultPage(PageBook book)` The default page for a debug view is its viewer.
`void` | `createPartControl(Composite parent)` Creates this view's underlying viewer and actions.
`protected abstract Viewer` | `createViewer(Composite parent)` Creates and returns this view's underlying viewer.
`protected void` | `deregisterPartListener()` Deregisters and disposes this event handler's part listener.
`void` | `dispose()` Disposes of this workbench part.
`protected PageBookView.PageRec` | `doCreatePage(IWorkbenchPart part)` Creates a new page in the pagebook for a particular part.
`protected void` | `doDestroyPage(IWorkbenchPart part, PageBookView.PageRec pageRecord)` Destroys a page in the pagebook for a particular part.
`void` | `doubleClick(DoubleClickEvent event)` Delegate to the `DOUBLE_CLICK_ACTION`, if any.
`protected abstract void` | `fillContextMenu(IMenuManager menu)` Subclasses must override this method to fill the context menu each time it is realized.
`protected IViewPart` | `findView(String id)` Returns the specified view in this view's page or `null` if none.
`protected String` | `generatePreferenceKey(IAction action)` Generate a String that can be used as a key into a preference store based on the specified action.
`IAction` | `getAction(String actionID)` Returns the action installed under the given action id.
`Object` | `getAdapter(Class adapter)` Debug views implement the debug view adapter which provides access to a view's underlying viewer and debug model presentation for a specific debug model.
`protected IWorkbenchPart` | `getBootstrapPart()` Returns the active, important workbench part for this view.
`IMenuManager` | `getContextMenuManager()` Returns the context menu manager for this view.
`List` | `getContextMenuManagers()` Returns the context menu managers relevant to this view.
`protected Control` | `getControl()` Returns the control for this view, or `null` if none.
`protected Control` | `getDefaultControl()` Returns the default control for this view.
`protected abstract String` | `getHelpContextId()` Returns this view's help context id, which is hooked to this view on creation.
`protected IMemento` | `getMemento()` Returns the memento that contains the persisted state of the view.
`protected MessagePage` | `getMessagePage()` Returns this view's message page
`protected IPreferenceStore` | `getPreferenceStore()` Convenience method to return the preference store for the Debug UI plugin.
`IDebugModelPresentation` | `getPresentation(String id)` Returns the debug model presentation for this view specified by the debug model identifier.
`Map` | `getPresentationAttributes(String modelId)` Returns a map of the current attribute settings in the model presentation in this view associated with the given debug model.
`protected StructuredViewer` | `getStructuredViewer()` Returns this view's viewer as a structured viewer, or `null` if none.
`protected TextViewer` | `getTextViewer()` Returns this view's viewer as a text viewer, or `null` if none.
`Viewer` | `getViewer()` Returns the viewer contained in this debug view.
`protected void` | `handleKeyPressed(KeyEvent event)` Handles key events in viewer.
`void` | `init(IViewSite site, IMemento memento)` Initializes this view with the given view site.
`protected void` | `initActionState(IAction action)` Restores the persisted checked state of the specified action that was stored in preferences.
`protected void` | `initializeToolBar()` Configures this view's toolbar.
`boolean` | `isAvailable()` Returns whether this view's viewer is currently available.
`protected boolean` | `isImportant(IWorkbenchPart part)` Returns whether the given part should be added to this view.
`boolean` | `isVisible()` Returns whether this view is currently visible.
`protected void` | `registerPartListener()` Creates and registers a part listener with this event handler's page, if one does not already exist.
`void` | `remove(IUpdate updatable)` Removes the given IUpdate from this view's collection of updatable objects.
`protected void` | `saveAllCheckedActionStates()` Saves the checked state for all actions contributed to the toolbar manager that function as a toggleable action.
`protected void` | `saveCheckedActionState(IAction action)` Save the checked state of the specified action in the Debug UI plugin's preference store.
`void` | `setAction(String actionID, IAction action)` Installs the given action under the given action id.
`protected void` | `setMemento(IMemento memento)` Sets the memento that contains the persisted state of the view.
`void` | `showMessage(String message)` Shows the given message in this view's message' page.
`void` | `showViewer()` Shows this view's viewer page.
`void` | `syncExec(Runnable r)` Registers the given runnable with the display associated with this view's control, if any.
`void` | `updateObjects()` Updates all the registered updatables.

Methods inherited from class org.eclipse.ui.part.PageBookView
`doesPageExist, getCurrentContributingPart, getCurrentPage, getDefaultPage, getPageBook, getPageRec, getPageRec, getPageSite, getSelectionProvider, init, initPage, partActivated, partBroughtToTop, partClosed, partDeactivated, partOpened, setFocus, showPageRec`

Methods inherited from class org.eclipse.ui.part.ViewPart
`getViewSite, saveState, setContentDescription, setInitializationData, setPartName`

Methods inherited from class org.eclipse.ui.part.WorkbenchPart
`addPropertyListener, firePropertyChange, getConfigurationElement, getContentDescription, getDefaultImage, getPartName, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy`

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.IViewPart
`getViewSite, init, saveState`

Methods inherited from interface org.eclipse.ui.IWorkbenchPart
`addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener, setFocus`

Constructor Detail

### AbstractDebugView

    public AbstractDebugView()

  Constructs a new debug view.

Method Detail

### getAdapter

    public Object getAdapter(Class adapter)

  Debug views implement the debug view adapter which provides access to a view's underlying viewer and debug model presentation for a specific debug model.

  Specified by:
    `getAdapter` in interface `IAdaptable`
  Overrides:
    `getAdapter` in class `PageBookView`
  See Also:
    `IAdaptable.getAdapter(java.lang.Class)`, `IDebugView`

### createPartControl

    public void createPartControl(Composite parent)

  Creates this view's underlying viewer and actions. Hooks a pop-up menu to the underlying viewer's control, as well as a key listener. When the delete key is pressed, the `REMOVE_ACTION` is invoked. Hooks help to this view. Subclasses must implement the following methods which are called in the following order when a view is created:
  - `createViewer(Composite)` - the context menu is hooked to the viewer's control.
  - `createActions()`
  - `configureToolBar(IToolBarManager)`
  - `getHelpContextId()`

  Specified by:
    `createPartControl` in interface `IWorkbenchPart`
  Overrides:
    `createPartControl` in class `PageBookView`
  See Also:
    `IWorkbenchPart.createPartControl(Composite)`, `createPartControl(Composite)`, `createActions()`, `configureToolBar(IToolBarManager)`, `getHelpContextId()`, `fillContextMenu(IMenuManager)`

### createDefaultPage

    protected IPage createDefaultPage(PageBook book)

  The default page for a debug view is its viewer.

  Specified by:
    `createDefaultPage` in class `PageBookView`
  Parameters:
    `book` - the pagebook control
  Returns:
    the default page
  See Also:
    `PageBookView.createDefaultPage(PageBook)`

### createViewer

    protected abstract Viewer createViewer(Composite parent)

  Creates and returns this view's underlying viewer. The viewer's control will automatically be hooked to display a pop-up menu that other plug-ins may contribute to. Subclasses must override this method.

  Parameters:
    `parent` - the parent control

### createActions

    protected abstract void createActions()

  Creates this view's actions. Subclasses must override this method, which is called after `createViewer(Composite)`

### getHelpContextId

    protected abstract String getHelpContextId()

  Returns this view's help context id, which is hooked to this view on creation.

  Returns:
    help context id

### dispose

    public void dispose()

  Description copied from interface: `IWorkbenchPart`
  Disposes of this workbench part.

  This is the last method called on the `IWorkbenchPart`. At this point the part controls (if they were ever created) have been disposed as part of an SWT composite. There is no guarantee that createPartControl() has been called, so the part controls may never have been created.

  Within this method a part may release any resources, fonts, images, etc. held by this part. It is also very important to deregister all listeners from the workbench.

  Clients should not call this method (the workbench calls this method at appropriate times).

  Specified by:
    `dispose` in interface `IWorkbenchPart`
  Overrides:
    `dispose` in class `PageBookView`
  See Also:
    `IWorkbenchPart.dispose()`

### saveAllCheckedActionStates

    protected void saveAllCheckedActionStates()

  Saves the checked state for all actions contributed to the toolbar manager that function as a toggleable action. The states are saved in the Debug UI plugin's preference store.

  Since:
    2.1

### saveCheckedActionState

    protected void saveCheckedActionState(IAction action)

  Save the checked state of the specified action in the Debug UI plugin's preference store. The specified action is expected to be enabled and support the style `IAction.AS_CHECK_BOX`.

  Parameters:
    `action` - the enabled, toggleable action whose checked state will be saved in preferences
  Since:
    2.1

### generatePreferenceKey

    protected String generatePreferenceKey(IAction action)

  Generate a String that can be used as a key into a preference store based on the specified action. The resulting String will be unique across views.

  Returns:
    a String suitable for use as a preference store key for the given action
  Since:
    2.1

### getPreferenceStore

    protected IPreferenceStore getPreferenceStore()

  Convenience method to return the preference store for the Debug UI plugin.

  Returns:
    the preference store for the Debug UI plugin
  Since:
    2.1

### getViewer

    public Viewer getViewer()

  Description copied from interface: `IDebugView`
  Returns the viewer contained in this debug view.

  Specified by:
    `getViewer` in interface `IDebugView`
  Returns:
    viewer
  See Also:
    `IDebugView.getViewer()`

### getStructuredViewer

    protected StructuredViewer getStructuredViewer()

  Returns this view's viewer as a structured viewer, or `null` if none.

  Returns:
    this view's viewer as a structured viewer or `null`

### getTextViewer

    protected TextViewer getTextViewer()

  Returns this view's viewer as a text viewer, or `null` if none.

  Returns:
    this view's viewer as a text viewer or `null`

### getPresentation

    public IDebugModelPresentation getPresentation(String id)

  Description copied from interface: `IDebugView`
  Returns the debug model presentation for this view specified by the debug model identifier.

  Specified by:
    `getPresentation` in interface `IDebugView`
  Parameters:
    `id` - the debug model identifier that corresponds to the `id` attribute of a debug model presentation extension
  Returns:
    the debug model presentation, or `null` if no presentation is registered for the specified id
  See Also:
    `IDebugView.getPresentation(String)`

### createContextMenu

    protected void createContextMenu(Control menuControl)

  Creates a pop-up menu on the given control. The menu is registered with this view's site, such that other plug-ins may contribute to the menu. Subclasses should call this method, specifying the menu control as the control used in their viewer (for example, tree viewer). Subclasses must implement the method `#fillContextMenu(IMenuManager)` which will be called each time the context menu is realized.

  Parameters:
    `menuControl` - the control with which the pop-up menu will be associated with.

### getContextMenuManager

    public IMenuManager getContextMenuManager()

  Deprecated. @see AbstractDebugView.getContextMenuManagers()

  Description copied from interface: `IDebugView`
  Returns the context menu manager for this view.

  Specified by:
    `getContextMenuManager` in interface `IDebugView`
  Returns:
    the context menu manager for this view, or `null` if none
  See Also:
    `IDebugView.getContextMenuManager()`

### getContextMenuManagers

    public List getContextMenuManagers()

  Returns the context menu managers relevant to this view.

  Returns:
    the context menu managers relevant to this view
  Since:
    2.1

### fillContextMenu

    protected abstract void fillContextMenu(IMenuManager menu)

  Subclasses must override this method to fill the context menu each time it is realized.

  Parameters:
    `menu` - the context menu

### initializeToolBar

    protected void initializeToolBar()

  Configures this view's toolbar. Subclasses implement `#configureToolBar(IToolBarManager)` to contribute actions to the toolbar.

  To properly initialize toggle actions that are contributed to this view, state is restored for toggle actions that have a persisted state in the Debug UI plugin's preferences. As well, any toggle actions that have an initial state of 'checked' are invoked. The actions' states are restored and the actions are invoked in a runnable, after the view is created.

### initActionState

    protected void initActionState(IAction action)

  Restores the persisted checked state of the specified action that was stored in preferences. If the action is disabled, its persisted state is not restored (because a disabled action cannot be run).

  Parameters:
    `action` - the action whose checked state will be restored
  Since:
    2.1

### init

    public void init(IViewSite site,
                     IMemento memento)
              throws PartInitException

  Description copied from interface: `IViewPart`
  Initializes this view with the given view site. A memento is passed to the view which contains a snapshot of the views state from a previous session. Where possible, the view should try to recreate that state within the part controls.

  This method is automatically called by the workbench shortly after the part is instantiated. It marks the start of the views's lifecycle. Clients must not call this method.

  Specified by:
    `init` in interface `IViewPart`
  Overrides:
    `init` in class `ViewPart`
  Throws:
    `PartInitException`
  See Also:
    `IViewPart.init(IViewSite, IMemento)`

### configureToolBar

    protected abstract void configureToolBar(IToolBarManager tbm)

  Subclasses implement this menu to contribute actions to the toolbar. This method is called after `createActions()`.

  Parameters:
    `tbm` - the tool bar manager for this view's site
  See Also:
    `createViewer(Composite)`

### setAction

    public void setAction(String actionID,
                          IAction action)

  Description copied from interface: `IDebugView`
  Installs the given action under the given action id. If the action has an id that maps to one of the global action ids defined by this interface, the action is registered as a global action handler. If the action is an instance of `IUpdate` it is added/remove from the collection of updateables associated with this view.

  Specified by:
    `setAction` in interface `IDebugView`
  Parameters:
    `actionID` - the action id
    `action` - the action, or `null` to clear it
  See Also:
    `IDebugView.setAction(String, IAction)`

### getAction

    public IAction getAction(String actionID)

  Description copied from interface: `IDebugView`
  Returns the action installed under the given action id.

  Specified by:
    `getAction` in interface `IDebugView`
  Parameters:
    `actionID` - the action id
  Returns:
    the action, or `null` if none
  See Also:
    `IDebugView.getAction(String)`

### updateObjects

    public void updateObjects()

  Updates all the registered updatables.

### handleKeyPressed

    protected void handleKeyPressed(KeyEvent event)

  Handles key events in viewer. Invokes
  1. `REMOVE_ACTION` when the delete key is pressed

### doubleClick

    public void doubleClick(DoubleClickEvent event)

  Delegate to the `DOUBLE_CLICK_ACTION`, if any.

  Specified by:
    `doubleClick` in interface `IDoubleClickListener`
  Parameters:
    `event` - event object describing the double-click
  See Also:
    `IDoubleClickListener.doubleClick(DoubleClickEvent)`

### asyncExec

    public void asyncExec(Runnable r)

  Registers the given runnable with the display associated with this view's control, if any.

  See Also:
    `Display.asyncExec(java.lang.Runnable)`

### getControl

    protected Control getControl()

  Returns the control for this view, or `null` if none.

  Returns:
    the control for this view, or `null` if none
  Since:
    3.0

### syncExec

    public void syncExec(Runnable r)

  Registers the given runnable with the display associated with this view's control, if any.

  See Also:
    `Display.syncExec(java.lang.Runnable)`

### getMemento

    protected IMemento getMemento()

  Returns the memento that contains the persisted state of the view. May be `null`.

### setMemento

    protected void setMemento(IMemento memento)

  Sets the memento that contains the persisted state of the view.

### findView

    protected IViewPart findView(String id)

  Returns the specified view in this view's page or `null` if none.

  Parameters:
    `id` - view identifier
  Returns:
    view part

### isImportant

    protected boolean isImportant(IWorkbenchPart part)

  Description copied from class: `PageBookView`
  Returns whether the given part should be added to this view.

  Subclasses must implement this method.

  Specified by:
    `isImportant` in class `PageBookView`
  Parameters:
    `part` - the input part
  Returns:
    `true` if the part is relevant, and `false` otherwise
  See Also:
    `PageBookView.isImportant(IWorkbenchPart)`

### doCreatePage

    protected PageBookView.PageRec doCreatePage(IWorkbenchPart part)

  Description copied from class: `PageBookView`
  Creates a new page in the pagebook for a particular part. This page will be made visible whenever the part is active, and will be destroyed with a call to `doDestroyPage`.

  Subclasses must implement this method.

  Subclasses must call initPage with the new page (if it is an `IPageBookViewPage`) before calling createControl on the page.

  Specified by:
    `doCreatePage` in class `PageBookView`
  Parameters:
    `part` - the input part
  Returns:
    the record describing a new page for this view
  See Also:
    `PageBookView.doCreatePage(IWorkbenchPart)`

### doDestroyPage

    protected void doDestroyPage(IWorkbenchPart part,
                                 PageBookView.PageRec pageRecord)

  Description copied from class: `PageBookView`
  Destroys a page in the pagebook for a particular part. This page was returned as a result from `doCreatePage`.

  Subclasses must implement this method.

  Specified by:
    `doDestroyPage` in class `PageBookView`
  Parameters:
    `part` - the input part
    `pageRecord` - a page record for the part
  See Also:
    `PageBookView.doDestroyPage(org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.part.PageBookView.PageRec)`

### getBootstrapPart

    protected IWorkbenchPart getBootstrapPart()

  Description copied from class: `PageBookView`
  Returns the active, important workbench part for this view.

  When the page book view is created it has no idea which part within the workbook should be used to generate the first page. Therefore, it delegates the choice to subclasses of `PageBookView`.

  Implementors of this method should return an active, important part in the workbench or `null` if none found.

  Subclasses must implement this method.

  Specified by:
    `getBootstrapPart` in class `PageBookView`
  Returns:
    the active important part, or `null` if none
  See Also:
    `PageBookView.getBootstrapPart()`

### getDefaultControl

    protected Control getDefaultControl()

  Returns the default control for this view. By default, this view's viewer's control is returned. Subclasses should override if required - for example, if this view has its viewer nested inside other controls.

  Returns:
    this view's default control.

### getMessagePage

    protected MessagePage getMessagePage()

  Returns this view's message page

  Returns:
    message page

### showMessage

    public void showMessage(String message)

  Shows the given message in this view's message' page. Makes the message page the visible page.

  Parameters:
    `message` - the message to display

### showViewer

    public void showViewer()

  Shows this view's viewer page.

### isAvailable

    public boolean isAvailable()

  Returns whether this view's viewer is currently available.

  Returns:
    whether this view's viewer is currently available

### add

    public void add(IUpdate updatable)

  Description copied from interface: `IDebugView`
  Adds the given IUpdate to this view's collection of updatable objects. Allows the view to periodically update these registered objects. Has no effect if an identical IUpdate is already registered.

  Specified by:
    `add` in interface `IDebugView`
  Parameters:
    `updatable` - The IUpdate instance to be added
  See Also:
    `IDebugView.add(IUpdate)`

### remove

    public void remove(IUpdate updatable)

  Description copied from interface: `IDebugView`
  Removes the given IUpdate from this view's collection of updatable objects. Has no effect if an identical IUpdate was not already registered.

  Specified by:
    `remove` in interface `IDebugView`
  Parameters:
    `updatable` - The IUpdate instance to be removed
  See Also:
    `IDebugView.remove(IUpdate)`

### addContextMenuManager

    public void addContextMenuManager(IMenuManager contextMenuManager)

  Adds a context menu manager that is relevant to this view.

  Parameters:
    `contextMenuManager` - The contextMenuManager to add
  Since:
    2.1

### becomesVisible

    protected void becomesVisible()

  Notification this view is now visible.

  Since:
    2.1

### becomesHidden

    protected void becomesHidden()

  Notification this view is now hidden.

  Since:
    2.1

### isVisible

    public boolean isVisible()

  Returns whether this view is currently visible.

  Returns:
    whether this view is currently visbile
  Since:
    2.1

### registerPartListener

    protected void registerPartListener()

  Creates and registers a part listener with this event handler's page, if one does not already exist.

  Since:
    2.1

### deregisterPartListener

    protected void deregisterPartListener()

  Deregisters and disposes this event handler's part listener.

  Since:
    2.1

### getPresentationAttributes

    public Map getPresentationAttributes(String modelId)

  Returns a map of the current attribute settings in the model presentation in this view associated with the given debug model.

  Returns:
    a map of the current attribute settings in the model presentation in this view associated with the given debug model
  Since:
    3.0

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.