org.fosstrak.llrp.commander.views
Class MessageboxView

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 org.fosstrak.llrp.commander.views.TableViewPart
                  extended by org.fosstrak.llrp.commander.views.MessageboxView
All Implemented Interfaces:
java.util.EventListener, org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.IExecutableExtension, org.eclipse.ui.IPersistable, org.eclipse.ui.ISelectionListener, org.eclipse.ui.IViewPart, org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.IWorkbenchPart2, org.eclipse.ui.IWorkbenchPart3, org.eclipse.ui.part.IWorkbenchPartOrientation

public class MessageboxView
extends TableViewPart
implements org.eclipse.ui.ISelectionListener

This sample class demonstrates how to plug-in a new workbench view. The view shows data obtained from the model. The sample creates a dummy model on the fly, but a real implementation would connect to the model available either in this or another plug-in (e.g. the workspace). The view is connected to the model using a content provider.

The view uses a label provider to define how model objects should be presented in the view. Each view can present the same model objects using different labels and icons, if needed. Alternatively, a single label provider can be shared between views in order to ensure that objects of the same type are presented in the same way everywhere.

Author:
zhanghao, sawielan

Field Summary
static int COL_MSG_ADAPTER
          column for the adapter.
static int COL_MSG_COMMENT
          Column ID for Message Comments.
static int COL_MSG_ID
          Column ID for Message ID.
static int COL_MSG_MARK
          Column ID for User Marks.
static int COL_MSG_READER
          Column ID for Message Type.
static int COL_MSG_TIME
          Column ID for Message Issue Time.
static int COL_MSG_TYPE
          Column ID for Message Type.
static int COL_STATUS_CODE
          Column ID for Status Code.
protected  org.eclipse.swt.widgets.Display display
          access to the display is needed by the asyncExec/syncExec API to allow multi-threaded access to the SWT widget
static java.lang.String ICON_AUTO_REFRESH
          the name of the auto refresh icon.
 
Fields inherited from class org.fosstrak.llrp.commander.views.TableViewPart
TAG_COLUMN, TAG_NUMBER, TAG_WIDTH
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Constructor Summary
MessageboxView()
          The constructor.
 
Method Summary
protected  void createActions()
           
 void createPartControl(org.eclipse.swt.widgets.Composite parent)
          This is a callback that will allow us to create the viewer and initialize it.
 void dispose()
          Dispose the view.
protected  void fillContextMenu(org.eclipse.jface.action.IMenuManager manager)
           
protected  void fillLocalToolBar(org.eclipse.jface.action.IToolBarManager manager)
           
 org.eclipse.swt.widgets.Display getDisplay()
          return a handle to the display of this widget.
 int getDisplayNumMessages()
           
 java.lang.String getSelectedAdapter()
           
 java.lang.String getSelectedReader()
           
 void selectionChanged(org.eclipse.ui.IWorkbenchPart part, org.eclipse.jface.viewers.ISelection selection)
          Triggered when user change the reader in Reader Management View.
 void setDisplayNumMessages(int displayNumMessages)
           
 void updateViewer(boolean reload)
          Refresh the message list in the viewer from selected adapter or reader.
 
Methods inherited from class org.fosstrak.llrp.commander.views.TableViewPart
contributeToActionBars, createColumns, fillLocalPullDown, getTable, getViewer, hookEvents, hookMenus, init, restoreColumnWidths, saveColumnWidths, saveState, selectionChanged, setColumnHeaders, setColumnLayouts, setDoubleClickAction, setFocus
 
Methods inherited from class org.eclipse.ui.part.ViewPart
checkSite, getViewSite, init, 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, 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.IWorkbenchPart
addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Field Detail

COL_MSG_MARK

public static final int COL_MSG_MARK
Column ID for User Marks.

See Also:
Constant Field Values

COL_MSG_ID

public static final int COL_MSG_ID
Column ID for Message ID.

See Also:
Constant Field Values

COL_MSG_ADAPTER

public static final int COL_MSG_ADAPTER
column for the adapter.

See Also:
Constant Field Values

COL_MSG_READER

public static final int COL_MSG_READER
Column ID for Message Type.

See Also:
Constant Field Values

COL_MSG_TYPE

public static final int COL_MSG_TYPE
Column ID for Message Type.

See Also:
Constant Field Values

COL_STATUS_CODE

public static final int COL_STATUS_CODE
Column ID for Status Code.

See Also:
Constant Field Values

COL_MSG_TIME

public static final int COL_MSG_TIME
Column ID for Message Issue Time.

See Also:
Constant Field Values

COL_MSG_COMMENT

public static final int COL_MSG_COMMENT
Column ID for Message Comments.

See Also:
Constant Field Values

ICON_AUTO_REFRESH

public static final java.lang.String ICON_AUTO_REFRESH
the name of the auto refresh icon.

See Also:
Constant Field Values

display

protected org.eclipse.swt.widgets.Display display
access to the display is needed by the asyncExec/syncExec API to allow multi-threaded access to the SWT widget

Constructor Detail

MessageboxView

public MessageboxView()
The constructor.

Method Detail

createPartControl

public void createPartControl(org.eclipse.swt.widgets.Composite parent)
This is a callback that will allow us to create the viewer and initialize it.

Specified by:
createPartControl in interface org.eclipse.ui.IWorkbenchPart
Overrides:
createPartControl in class TableViewPart

getDisplay

public org.eclipse.swt.widgets.Display getDisplay()
return a handle to the display of this widget.

Returns:
the display of this widget.

fillContextMenu

protected void fillContextMenu(org.eclipse.jface.action.IMenuManager manager)
Overrides:
fillContextMenu in class TableViewPart

fillLocalToolBar

protected void fillLocalToolBar(org.eclipse.jface.action.IToolBarManager manager)
Overrides:
fillLocalToolBar in class TableViewPart

createActions

protected void createActions()
Overrides:
createActions in class TableViewPart

dispose

public void dispose()
Dispose the view.

Specified by:
dispose in interface org.eclipse.ui.IWorkbenchPart
Overrides:
dispose in class org.eclipse.ui.part.WorkbenchPart

selectionChanged

public void selectionChanged(org.eclipse.ui.IWorkbenchPart part,
                             org.eclipse.jface.viewers.ISelection selection)
Triggered when user change the reader in Reader Management View. The corresponding messages need to be updated.

Specified by:
selectionChanged in interface org.eclipse.ui.ISelectionListener

updateViewer

public void updateViewer(boolean reload)
Refresh the message list in the viewer from selected adapter or reader.

Parameters:
reload - flag whether to reload the whole list of messages. if set to true all the messages get loaded from the backend, otherwise just the new messages get added to the view.

setDisplayNumMessages

public void setDisplayNumMessages(int displayNumMessages)
Parameters:
displayNumMessages - the displayNumMessages to set

getDisplayNumMessages

public int getDisplayNumMessages()
Returns:
the displayNumMessages

getSelectedAdapter

public final java.lang.String getSelectedAdapter()
Returns:
the selectedAdapter

getSelectedReader

public final java.lang.String getSelectedReader()
Returns:
the selectedReader


Copyright © 2009. All Rights Reserved.