com.ibm.jdg2e.view.basic
Class BasicViewPart

java.lang.Object
  |
  +--org.eclipse.ui.part.WorkbenchPart
        |
        +--org.eclipse.ui.part.ViewPart
              |
              +--com.ibm.jdg2e.view.basic.BasicViewPart
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.IExecutableExtension, org.eclipse.jface.viewers.ISelectionChangedListener, org.eclipse.ui.IViewPart, org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.IWorkbenchPart2

public class BasicViewPart
extends org.eclipse.ui.part.ViewPart
implements org.eclipse.jface.viewers.ISelectionChangedListener

A basic example of the creation of a ViewPart.

This example uses a TableViewer to create the user interface and uses a IRoadTrip object as the input to the view. This comes from the SimpleModel plug-in.

Actions are created and added to the view's drop down menu and toolbar. These same actions are also added to the context menu for the viewer used in the view.


Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Constructor Summary
BasicViewPart()
          The constructor.
 
Method Summary
(package private)  void contributeToActionBars()
          Adds actions to the action bars for the ViewPart.
 void createPartControl(org.eclipse.swt.widgets.Composite parent)
          This method is called for each ViewPart to allow the customized user interface content to be created.
(package private)  void fillContextMenu(org.eclipse.jface.action.IMenuManager manager)
          Add the actions that should be available to the context menu.
(package private)  void fillLocalPullDown(org.eclipse.jface.action.IMenuManager manager)
          Adds actions to the pulldown menu structure for the ViewPart.
(package private)  void fillLocalToolBar(org.eclipse.jface.action.IToolBarManager manager)
          Adds actions to the toolbar for the ViewPart.
(package private)  void makeActions()
          Create any required Action instances.
 void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
          Force delete action to only be available when something is selected in the viewer.
 void setFocus()
          Passing the focus request to the viewer's control.
 
Methods inherited from class org.eclipse.ui.part.ViewPart
getViewSite, init, init, saveState, setContentDescription, setInitializationData, setPartName
 
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPropertyListener, dispose, firePropertyChange, getAdapter, getConfigurationElement, getContentDescription, getDefaultImage, getPartName, getSite, getTitle, getTitleImage, getTitleToolTip, internalSetContentDescription, internalSetPartName, removePropertyListener, setDefaultTitle, 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.IWorkbenchPart
addPropertyListener, dispose, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Constructor Detail

BasicViewPart

public BasicViewPart()
The constructor.
Method Detail

createPartControl

public void createPartControl(org.eclipse.swt.widgets.Composite parent)
This method is called for each ViewPart to allow the customized user interface content to be created.

In this example a simple TableViewer structure is created and used to display the IRoadTrip model.

Overrides:
createPartControl in class org.eclipse.ui.part.WorkbenchPart

fillContextMenu

void fillContextMenu(org.eclipse.jface.action.IMenuManager manager)
Add the actions that should be available to the context menu. In this example all actions are added. Action enablement is controlled by the selectionChanged method.
Parameters:
manager - - the menu structure where the actions will be added.

contributeToActionBars

void contributeToActionBars()
Adds actions to the action bars for the ViewPart.

fillLocalPullDown

void fillLocalPullDown(org.eclipse.jface.action.IMenuManager manager)
Adds actions to the pulldown menu structure for the ViewPart. A placeholder for external contributions is added as well ("additions").
Parameters:
manager -  

fillLocalToolBar

void fillLocalToolBar(org.eclipse.jface.action.IToolBarManager manager)
Adds actions to the toolbar for the ViewPart. A placeholder for external contributions is added as well ("additions").
Parameters:
manager -  

makeActions

void makeActions()
Create any required Action instances.

setFocus

public void setFocus()
Passing the focus request to the viewer's control.
Overrides:
setFocus in class org.eclipse.ui.part.WorkbenchPart

selectionChanged

public void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
Force delete action to only be available when something is selected in the viewer. This implementation does not care if one or more than one element is selected. If there is no selection then the delete action is disabled.
Specified by:
selectionChanged in interface org.eclipse.jface.viewers.ISelectionChangedListener
See Also:
ISelectionChangedListener.selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)