com.ibm.jdg2e.view.basic
Class BasicViewPart

java.lang.Object
  extended byorg.eclipse.core.commands.common.EventManager
      extended byorg.eclipse.ui.part.WorkbenchPart
          extended byorg.eclipse.ui.part.ViewPart
              extended bycom.ibm.jdg2e.view.basic.BasicViewPart
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.IExecutableExtension, org.eclipse.ui.IPersistable, org.eclipse.jface.viewers.ISelectionChangedListener, org.eclipse.ui.IViewPart, org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.IWorkbenchPart2, org.eclipse.ui.part.IWorkbenchPartOrientation

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.


Field Summary
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Constructor Summary
BasicViewPart()
          The constructor.
 
Method Summary
 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.
 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
checkSite, getViewSite, init, init, saveState, setContentDescription, setInitializationData, setPartName
 
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPropertyListener, dispose, firePropertyChange, getAdapter, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener, 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.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.

Specified by:
createPartControl in interface org.eclipse.ui.IWorkbenchPart
See Also:
IWorkbenchPart.createPartControl(org.eclipse.swt.widgets.Composite)

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)

setFocus

public void setFocus()
Passing the focus request to the viewer's control.

Specified by:
setFocus in interface org.eclipse.ui.IWorkbenchPart