public abstract class AbstractDebugView extends PageBookView implements IDebugView, IDoubleClickListener
IDebugView
IUpdate
are updated when updateActions()
is
called.REMOVE_ACTION
when the delete key
is pressed.DOUBLE_CLICK_ACTION
when the mouse
is double-clicked.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.becomesVisible()
and becomesHidden()
.getHelpContextId().
This class may be sub-classed.
PageBookView.PageRec, PageBookView.SelectionProvider
COPY_ACTION, CUT_ACTION, DOUBLE_CLICK_ACTION, FIND_ACTION, PASTE_ACTION, REMOVE_ACTION, SELECT_ALL_ACTION
PROP_TITLE
Constructor and Description |
---|
AbstractDebugView()
Constructs a new debug view.
|
Modifier and Type | Method and Description |
---|---|
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()
Unregisters and disposes this event handler's part listener.
|
void |
dispose()
The
PageBookView implementation of this
IWorkbenchPart method cleans up all the pages. |
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.
|
<T> T |
getAdapter(Class<T> 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()
Deprecated.
@see AbstractDebugView.getContextMenuManagers()
|
List<IMenuManager> |
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
plug-in.
|
IDebugModelPresentation |
getPresentation(String id)
Returns the debug model presentation for this view specified
by the debug model identifier.
|
Map<String,Object> |
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 toggle 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.
|
protected void |
setViewer(Viewer viewer)
Sets the viewer for this 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.
|
doesPageExist, getCurrentContributingPart, getCurrentPage, getDefaultPage, getPageBook, getPageRec, getPageRec, getPageSite, getSelectionProvider, getViewAdapter, init, initPage, partActivated, partBroughtToTop, partClosed, partDeactivated, partHidden, partOpened, partVisible, setFocus, showPageRec
checkSite, getViewSite, saveState, setContentDescription, setInitializationData, setPartName
addPartPropertyListener, addPropertyListener, firePartPropertyChanged, firePropertyChange, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, getTitleImage, getTitleToolTip, removePartPropertyListener, removePropertyListener, setPartProperty, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getViewSite, init, saveState
addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener, setFocus
public <T> T getAdapter(Class<T> adapter)
getAdapter
in interface IAdaptable
getAdapter
in class PageBookView
adapter
- the adapter class to look upnull
if this object does not
have an adapter for the given classIAdaptable.getAdapter(java.lang.Class)
,
IDebugView
public void createPartControl(Composite parent)
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()
createPartControl
in interface IWorkbenchPart
createPartControl
in class PageBookView
parent
- the parent controlIWorkbenchPart.createPartControl(Composite)
,
createPartControl(Composite)
,
createActions()
,
configureToolBar(IToolBarManager)
,
getHelpContextId()
,
fillContextMenu(IMenuManager)
protected IPage createDefaultPage(PageBook book)
createDefaultPage
in class PageBookView
book
- the pagebook controlPageBookView.createDefaultPage(PageBook)
protected abstract Viewer createViewer(Composite parent)
parent
- the parent controlViewer
protected abstract void createActions()
createViewer(Composite)
protected abstract String getHelpContextId()
public void dispose()
PageBookView
PageBookView
implementation of this
IWorkbenchPart
method cleans up all the pages. Subclasses
may extend.dispose
in interface IWorkbenchPart
dispose
in class PageBookView
IWorkbenchPart.dispose()
protected void saveAllCheckedActionStates()
protected void saveCheckedActionState(IAction action)
IAction.AS_CHECK_BOX
.action
- the enabled, toggle action whose checked state will be
saved in preferencesprotected String generatePreferenceKey(IAction action)
action
- the action to generate a key forprotected IPreferenceStore getPreferenceStore()
public Viewer getViewer()
IDebugView
getViewer
in interface IDebugView
IDebugView.getViewer()
protected StructuredViewer getStructuredViewer()
null
if none.null
protected TextViewer getTextViewer()
null
if none.null
public IDebugModelPresentation getPresentation(String id)
IDebugView
getPresentation
in interface IDebugView
id
- the debug model identifier that corresponds to the id
attribute of a debug model presentation extensionnull
if no
presentation is registered for the specified idIDebugView.getPresentation(String)
protected void createContextMenu(Control menuControl)
#fillContextMenu(IMenuManager)
which will
be called each time the context menu is realized.menuControl
- the control with which the pop-up
menu will be associated with.@Deprecated public IMenuManager getContextMenuManager()
IDebugView
getContextMenuManager
in interface IDebugView
null
if noneIDebugView.getContextMenuManager()
public List<IMenuManager> getContextMenuManagers()
protected abstract void fillContextMenu(IMenuManager menu)
menu
- the context menuprotected void initializeToolBar()
#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.
protected void initActionState(IAction action)
action
- the action whose checked state will be restoredpublic void init(IViewSite site, IMemento memento) throws PartInitException
IViewPart
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.
init
in interface IViewPart
init
in class ViewPart
site
- the view sitememento
- the IViewPart state or null if there is no previous saved statePartInitException
- if this view was not initialized successfullyIViewPart.init(IViewSite, IMemento)
protected void setViewer(Viewer viewer)
viewer
- viewerprotected abstract void configureToolBar(IToolBarManager tbm)
createActions()
.tbm
- the tool bar manager for this view's sitecreateViewer(Composite)
public void setAction(String actionID, IAction action)
IDebugView
IUpdate
it is added/remove
from the collection of updateables associated with this view.setAction
in interface IDebugView
actionID
- the action idaction
- the action, or null
to clear itIDebugView.setAction(String, IAction)
public IAction getAction(String actionID)
IDebugView
getAction
in interface IDebugView
actionID
- the action idnull
if noneIDebugView.getAction(String)
public void updateObjects()
protected void handleKeyPressed(KeyEvent event)
REMOVE_ACTION
when the delete
key is pressedevent
- the KeyEvent
public void doubleClick(DoubleClickEvent event)
DOUBLE_CLICK_ACTION
,
if any.doubleClick
in interface IDoubleClickListener
event
- event object describing the double-clickIDoubleClickListener.doubleClick(DoubleClickEvent)
public void asyncExec(Runnable r)
r
- the Runnable
to runDisplay.asyncExec(java.lang.Runnable)
protected Control getControl()
null
if none.null
if nonepublic void syncExec(Runnable r)
r
- the Runnable
to runDisplay.syncExec(java.lang.Runnable)
protected IMemento getMemento()
null
.IMemento
protected void setMemento(IMemento memento)
memento
- the new IMemento
protected IViewPart findView(String id)
null
if none.id
- view identifierprotected boolean isImportant(IWorkbenchPart part)
PageBookView
Subclasses must implement this method.
isImportant
in class PageBookView
part
- the input parttrue
if the part is relevant, and
false
otherwisePageBookView.isImportant(IWorkbenchPart)
protected PageBookView.PageRec doCreatePage(IWorkbenchPart part)
PageBookView
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.
doCreatePage
in class PageBookView
part
- the input partPageBookView.doCreatePage(IWorkbenchPart)
protected void doDestroyPage(IWorkbenchPart part, PageBookView.PageRec pageRecord)
PageBookView
doCreatePage
.
Subclasses must implement this method.
doDestroyPage
in class PageBookView
part
- the input partpageRecord
- a page record for the partPageBookView.doDestroyPage(org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.part.PageBookView.PageRec)
protected IWorkbenchPart getBootstrapPart()
PageBookView
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.
getBootstrapPart
in class PageBookView
null
if nonePageBookView.getBootstrapPart()
protected Control getDefaultControl()
protected MessagePage getMessagePage()
public void showMessage(String message)
message
- the message to displaypublic void showViewer()
public boolean isAvailable()
public void add(IUpdate updatable)
IDebugView
add
in interface IDebugView
updatable
- The IUpdate instance to be addedIDebugView.add(IUpdate)
public void remove(IUpdate updatable)
IDebugView
remove
in interface IDebugView
updatable
- The IUpdate instance to be removedIDebugView.remove(IUpdate)
public void addContextMenuManager(IMenuManager contextMenuManager)
contextMenuManager
- The contextMenuManager to addprotected void becomesVisible()
protected void becomesHidden()
public boolean isVisible()
protected void registerPartListener()
protected void deregisterPartListener()
public Map<String,Object> getPresentationAttributes(String modelId)
modelId
- the debug model identifier
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.