JIVE Platform
Release 0.3.1

edu.buffalo.cse.jive.ui
Class AbstractJiveView

java.lang.Object
  extended by org.eclipse.core.commands.common.EventManager
      extended by org.eclipse.ui.part.WorkbenchPart
          extended by org.eclipse.ui.part.ViewPart
              extended by edu.buffalo.cse.jive.ui.AbstractJiveView
All Implemented Interfaces:
IJiveView, EventListener, IAdaptable, IExecutableExtension, IDebugEventSetListener, ILaunchListener, IPropertyChangeListener, IPersistable, ISelectionListener, IViewPart, IWorkbenchPart, IWorkbenchPart2, IWorkbenchPart3, IWorkbenchPartOrientation
Direct Known Subclasses:
AbstractGraphicalJiveView, AbstractStructuredJiveView

public abstract class AbstractJiveView
extends ViewPart
implements IJiveView, ILaunchListener, IDebugEventSetListener, IPropertyChangeListener, ISelectionListener

An abstract view part used to present IJiveDebugTargets. The view part supports viewing multiple targets using a drop down action to switch between them. In order for a target to be displayed, it must be present in the launch manager. As a convenience, the view also provides actions to remove terminated launches in a fashion similar to that of the Console view.

Clients offering views of a JIVE model should derive from this class either directly or indirectly.

See Also:
AbstractStructuredJiveView, AbstractGraphicalJiveView

Field Summary
protected static String DISPLAY_TARGET_GROUP
          The group used to hold the action used to switch between targets.
protected static String REMOVE_TERMINATED_GROUP
          The group used to hold actions having to do with removing terminated launches.
protected static String STEP_CONTROLS_GROUP
          The group used to hold actions having to do with stepping through a program in both directions.
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Constructor Summary
AbstractJiveView()
          Constructs the view.
 
Method Summary
protected  void addUpdatableAction(IUpdatableAction action)
          Adds an IUpdatableAction to the list of actions that must be updated when the active target changes.
protected  void configurePullDownMenu(IMenuManager manager)
          Configures the view's pull-down menu with actions.
protected  void configureToolBar(IToolBarManager manager)
          Adds the actions to the tool bar using the supplied tool bar manager.
protected  void createActions()
          Creates the actions that will be used by the view.
protected abstract  void createContextMenu()
          Creates the context menu for the view.
 void createPartControl(Composite parent)
           
 void display(IJiveDebugTarget target)
          Changes the view to present the supplied IJiveDebugTarget, making it the new active target.
 void dispose()
           
protected abstract  String getDefaultContentDescription()
          Returns the content description to be used when there is no active target.
protected abstract  ImageDescriptor getDisplayDropDownDisabledImageDescriptor()
          Returns the ImageDescriptor of the image to be used for the DisplayTargetDropDownAction when it is disabled.
protected abstract  ImageDescriptor getDisplayDropDownEnabledImageDescriptor()
          Returns the ImageDescriptor of the image to be used for the DisplayTargetDropDownAction when it is enabled.
 IJiveDebugTarget getDisplayed()
          Returns the IJiveDebugTarget that is currently being presented by the view.
protected abstract  String getDisplayTargetDropDownText()
          Returns the text to be used for the DisplayTargetDropDownAction.
 void handleDebugEvents(DebugEvent[] events)
           
protected abstract  void initializeViewer(Composite parent)
          Called immediately in createPartControl(Composite) to initialize the internal viewer for the view.
 void launchAdded(ILaunch launch)
           
 void launchChanged(ILaunch launch)
           
 void launchRemoved(ILaunch launch)
           
 void propertyChange(PropertyChangeEvent event)
           
 void selectionChanged(IWorkbenchPart part, ISelection selection)
           
protected abstract  void setViewerInput(IJiveDebugTarget target)
          Sets the internal viewer's input to that of the supplied target.
 
Methods inherited from class org.eclipse.ui.part.ViewPart
checkSite, getViewSite, init, init, saveState, setContentDescription, setInitializationData, setPartName
 
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPartPropertyListener, addPropertyListener, firePartPropertyChanged, firePropertyChange, getAdapter, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, getTitleImage, getTitleToolTip, removePartPropertyListener, removePropertyListener, setFocus, setPartProperty, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy
 
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
 
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, init, saveState
 
Methods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener, setFocus
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Field Detail

REMOVE_TERMINATED_GROUP

protected static final String REMOVE_TERMINATED_GROUP
The group used to hold actions having to do with removing terminated launches.

See Also:
Constant Field Values

STEP_CONTROLS_GROUP

protected static final String STEP_CONTROLS_GROUP
The group used to hold actions having to do with stepping through a program in both directions.

See Also:
Constant Field Values

DISPLAY_TARGET_GROUP

protected static final String DISPLAY_TARGET_GROUP
The group used to hold the action used to switch between targets.

See Also:
Constant Field Values
Constructor Detail

AbstractJiveView

public AbstractJiveView()
Constructs the view.

Method Detail

createPartControl

public void createPartControl(Composite parent)
Specified by:
createPartControl in interface IWorkbenchPart
Specified by:
createPartControl in class WorkbenchPart

dispose

public void dispose()
Specified by:
dispose in interface IWorkbenchPart
Overrides:
dispose in class WorkbenchPart

initializeViewer

protected abstract void initializeViewer(Composite parent)
Called immediately in createPartControl(Composite) to initialize the internal viewer for the view. Subclasses must implement this method for the specific framework being used.

Parameters:
parent - the parent widget of the viewer

createActions

protected void createActions()
Creates the actions that will be used by the view.


createContextMenu

protected abstract void createContextMenu()
Creates the context menu for the view. Subclasses must implement this method.


configureToolBar

protected void configureToolBar(IToolBarManager manager)
Adds the actions to the tool bar using the supplied tool bar manager.

Parameters:
manager - the manager used to add the actions to the tool bar

configurePullDownMenu

protected void configurePullDownMenu(IMenuManager manager)
Configures the view's pull-down menu with actions. Subclasses should override this method if a pull-down menu is desired.

Parameters:
manager - the menu manager in which to add actions

getDisplayed

public IJiveDebugTarget getDisplayed()
Description copied from interface: IJiveView
Returns the IJiveDebugTarget that is currently being presented by the view. If there isn't an active target, then null is returned.

Specified by:
getDisplayed in interface IJiveView
Returns:
the active target of the view or null if there isn't one

display

public void display(IJiveDebugTarget target)
Description copied from interface: IJiveView
Changes the view to present the supplied IJiveDebugTarget, making it the new active target. Implementers may determine if the target should actually be presented.

This method should only be called on the UI thread. In order for non-UI threads to invoke this method, the following can be done.

     IJiveView view = ... ;
     IJiveDebugTarget target = ... ;
     
     Display display = JiveUITools.getStandardDisplay();
     display.syncExec(new Runnable() {
         public void run() {
             view.display(target);
         }
     });
 

Specified by:
display in interface IJiveView
Parameters:
target - the target to display in the view
See Also:
JiveUITools.getStandardDisplay(), Display#asyncExec(Runnable), Display#syncExec(Runnable)

setViewerInput

protected abstract void setViewerInput(IJiveDebugTarget target)
Sets the internal viewer's input to that of the supplied target. Subclasses must implement this method for the specific framework being used.

Parameters:
target - the target to set as input.

addUpdatableAction

protected void addUpdatableAction(IUpdatableAction action)
Adds an IUpdatableAction to the list of actions that must be updated when the active target changes.

Parameters:
action - the action to add

launchAdded

public void launchAdded(ILaunch launch)
Specified by:
launchAdded in interface ILaunchListener

launchChanged

public void launchChanged(ILaunch launch)
Specified by:
launchChanged in interface ILaunchListener

launchRemoved

public void launchRemoved(ILaunch launch)
Specified by:
launchRemoved in interface ILaunchListener

handleDebugEvents

public void handleDebugEvents(DebugEvent[] events)
Specified by:
handleDebugEvents in interface IDebugEventSetListener

propertyChange

public void propertyChange(PropertyChangeEvent event)
Specified by:
propertyChange in interface IPropertyChangeListener

selectionChanged

public void selectionChanged(IWorkbenchPart part,
                             ISelection selection)
Specified by:
selectionChanged in interface ISelectionListener

getDefaultContentDescription

protected abstract String getDefaultContentDescription()
Returns the content description to be used when there is no active target.

Returns:
the default content description
See Also:
ViewPart.setContentDescription(String)

getDisplayTargetDropDownText

protected abstract String getDisplayTargetDropDownText()
Returns the text to be used for the DisplayTargetDropDownAction.

Returns:
the text for the display target drop down

getDisplayDropDownEnabledImageDescriptor

protected abstract ImageDescriptor getDisplayDropDownEnabledImageDescriptor()
Returns the ImageDescriptor of the image to be used for the DisplayTargetDropDownAction when it is enabled.

Returns:
the enabled image descriptor for the display target drop down

getDisplayDropDownDisabledImageDescriptor

protected abstract ImageDescriptor getDisplayDropDownDisabledImageDescriptor()
Returns the ImageDescriptor of the image to be used for the DisplayTargetDropDownAction when it is disabled.

Returns:
the disabled image descriptor for the display target drop down

JIVE Platform
Release 0.3.1