RSE
Release 3.3

org.eclipse.rse.ui.view
Class SystemTableView

java.lang.Object
  extended by org.eclipse.jface.viewers.Viewer
      extended by org.eclipse.jface.viewers.ContentViewer
          extended by org.eclipse.jface.viewers.StructuredViewer
              extended by org.eclipse.jface.viewers.ColumnViewer
                  extended by org.eclipse.jface.viewers.AbstractTableViewer
                      extended by org.eclipse.jface.viewers.TableViewer
                          extended by org.eclipse.rse.ui.view.SystemTableView
All Implemented Interfaces:
EventListener, IMenuListener, IInputProvider, IInputSelectionProvider, IPostSelectionProvider, ISelectionChangedListener, ISelectionProvider, ISystemRemoteChangeListener, ISystemResourceChangeListener, ISystemDeleteTarget, ISystemRenameTarget, ISystemShellProvider, ISystemSelectAllTarget
Direct Known Subclasses:
SystemCommandsView

public class SystemTableView
extends TableViewer
implements IMenuListener, ISystemDeleteTarget, ISystemRenameTarget, ISystemSelectAllTarget, ISystemResourceChangeListener, ISystemRemoteChangeListener, ISystemShellProvider, ISelectionChangedListener, ISelectionProvider

This subclass of the standard JFace table viewer is used to show a generic table view of the selected object in the Systems view


Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.jface.viewers.StructuredViewer
StructuredViewer.ColorAndFontCollector, StructuredViewer.ColorAndFontCollectorWithProviders
 
Field Summary
protected  PropertyDialogAction _propertyDialogAction
           
protected  SystemTableViewProvider _provider
           
protected  SystemRefreshAction _refreshAction
           
protected  boolean _selectionEnableDeleteAction
           
protected  boolean _selectionEnableRenameAction
           
protected  boolean _selectionFlagsUpdated
           
protected  boolean _selectionIsRemoteObject
           
protected  boolean _selectionShowDeleteAction
           
protected  boolean _selectionShowOpenViewActions
           
protected  boolean _selectionShowPropertiesAction
           
protected  boolean _selectionShowRefreshAction
           
protected  boolean _selectionShowRenameAction
           
protected  boolean menuListenerAdded
           
 
Fields inherited from class org.eclipse.jface.viewers.Viewer
WIDGET_DATA_KEY
 
Constructor Summary
SystemTableView(Table table, ISystemMessageLine msgLine)
          Constructor for the table view
 
Method Summary
 boolean canDelete()
          Required method from ISystemDeleteTarget Decides whether to enable the delete menu item.
 boolean canRename()
          Required method from ISystemRenameTarget Decides whether to enable the rename menu item.
 void clearMessage()
          Clear message/status shown on the message/status line
 void computeLayout()
           
 void computeLayout(boolean force)
          Determines what columns should be shown in this view.
 void displayMessage(String msg)
          Display a message/status on the message/status line
 void dispose()
           
 boolean doDelete(IProgressMonitor monitor)
          Actually do the delete of currently selected items.
 boolean doRename(String[] newNames)
          Required method from ISystemRenameTarget
 void doSelectAll(IStructuredSelection selection)
          When this action is run via Edit->Select All or via Ctrl+A, perform the select all action.
 boolean enableSelectAll(IStructuredSelection selection)
          Return true if select all should be enabled for the given object.
 void fillContextMenu(IMenuManager menu)
           
 ISystemViewElementAdapter getAdapterForContents()
          Convenience method for retrieving the view adapter for an object's children
 Map getCachedColumnWidths()
          Returns the column widths associated with this view.
 ISystemTableViewColumnManager getColumnManager()
           
 Menu getContextMenu()
          Return the popup menu for the table
 MenuManager getContextMenuManager()
          Return the popup menu for the table
 int[] getCurrentColumnWidths()
           
protected  IAction getDeleteAction()
          Rather than pre-defined this common action we wait until it is first needed, for performance reasons.
 Object getInput()
           
 int[] getLastColumnWidths()
           
 Layout getLayout()
           
 IPropertyDescriptor getNameDescriptor(Object object)
           
 IAction getNewConnectionAction()
          Rather than pre-defining this common action we wait until it is first needed, for performance reasons.
protected  Object getParentForContent(Object element)
           
protected  PropertyDialogAction getPropertyDialogAction()
           
protected  SystemTableViewProvider getProvider()
           
protected  IAction getRefreshAction()
          Return the refresh action
protected  ISystemRemoteElementAdapter getRemoteAdapter(Object o)
          Returns the implementation of ISystemRemoteElement for the given object.
protected  IAction getRenameAction()
          Rather than pre-defined this common action we wait until it is first needed, for performance reasons.
protected  SystemMessage getRenamingMessage(String oldName)
          Get the specific "Renaming %1..."
protected  IAction getSelectAllAction()
          Return the select All action
 ISelection getSelection()
           
 Shell getShell()
          This method will be called to return the shell for your viewer.
protected  ISystemViewElementAdapter getViewAdapter(Object obj)
          Convenience method for retrieving the view adapter for an object
 String[] getViewFilters()
           
 IPropertyDescriptor[] getVisibleDescriptors(Object object)
          Used to determine what the columns should be on the table.
protected  void initDragAndDrop()
          Initialize drag and drop support for this view.
 void inputChanged(Object newObject, Object oldObject)
          Called whenever the input for the view changes
 void menuAboutToShow(IMenuManager manager)
           
 void positionTo(String name)
           
protected  void scanSelections()
          -------------------------------------------------------------------------------- For many actions we have to walk the selection list and examine each selected object to decide if a given common action is supported or not.
 void selectionChanged(SelectionChangedEvent event)
           
 void setCachedColumnWidths(Map cachedColumnWidths)
          Sets the map of column widths associated with this view
 void setCurrentColumnWidths(int[] widths)
           
 void setLastColumnWidths(int[] widths)
           
 void setViewFilters(String[] filter)
           
 void showColumns(boolean flag)
           
 boolean showDelete()
          Required method from ISystemDeleteTarget.
protected  boolean showProperties()
          Decides whether to even show the properties menu item.
 boolean showRename()
          Required method from ISystemRenameTarget.
 void systemRemoteResourceChanged(ISystemRemoteChangeEvent event)
          This is the method in your class that will be called when a remote resource changes.
 void systemResourceChanged(ISystemResourceChangeEvent event)
          Used to asynchronously update the view whenever properties change.
 
Methods inherited from class org.eclipse.jface.viewers.TableViewer
createViewerEditor, doClear, doClearAll, doDeselectAll, doFindItem, doGetColumn, doGetColumnCount, doGetItem, doGetItemCount, doGetItems, doGetSelection, doGetSelectionIndices, doIndexOf, doRemove, doRemove, doRemoveAll, doResetItem, doSelect, doSetItemCount, doSetSelection, doSetSelection, doShowItem, doShowSelection, getControl, getItemAt, getTable, getViewerRowFromItem, internalCreateNewRowPart, refresh, refresh, remove, setSelection
 
Methods inherited from class org.eclipse.jface.viewers.AbstractTableViewer
add, add, assertContentProviderType, clear, doFindInputItem, doUpdateItem, getColumnViewerOwner, getElementAt, getLabelProvider, getRawChildren, getSelectionFromWidget, handleDispose, hookControl, indexForElement, insert, internalRefresh, internalRefresh, remove, replace, reveal, setItemCount, setSelectionToWidget
 
Methods inherited from class org.eclipse.jface.viewers.ColumnViewer
applyEditorValue, cancelEditing, checkBusy, editElement, getCell, getCellEditors, getCellModifier, getColumnProperties, getColumnViewerEditor, getItem, getLabelProvider, getViewerRow, hookEditingSupport, isBusy, isCellEditorActive, refresh, refresh, setBusy, setCellEditors, setCellModifier, setColumnProperties, setColumnViewerEditor, setLabelProvider, triggerEditorActivationEvent, update
 
Methods inherited from class org.eclipse.jface.viewers.StructuredViewer
addDoubleClickListener, addDragSupport, addDropSupport, addFilter, addOpenListener, addPostSelectionChangedListener, assertElementsNotNull, associate, buildLabel, disassociate, equals, filter, findItem, findItems, fireDoubleClick, fireOpen, firePostSelectionChanged, getColorAndFontCollector, getComparator, getComparer, getFilteredChildren, getFilters, getRoot, getSortedChildren, getSorter, handleDoubleSelect, handleInvalidSelection, handleLabelProviderChanged, handleOpen, handlePostSelect, handleSelect, hasFilters, internalUpdate, mapElement, needsRefilter, preservingSelection, refresh, refresh, refreshItem, removeDoubleClickListener, removeFilter, removeOpenListener, removePostSelectionChangedListener, resetFilters, setComparator, setComparer, setContentProvider, setFilters, setInput, setSelectionToWidget, setSorter, setUseHashlookup, testFindItem, testFindItems, unmapAllElements, unmapElement, unmapElement, update, updateItem, updateSelection, usingElementMap
 
Methods inherited from class org.eclipse.jface.viewers.ContentViewer
getContentProvider, labelProviderChanged
 
Methods inherited from class org.eclipse.jface.viewers.Viewer
addHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, removeHelpListener, removeSelectionChangedListener, scrollDown, scrollUp, setData, setSelection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.jface.viewers.ISelectionProvider
addSelectionChangedListener, removeSelectionChangedListener, setSelection
 
Methods inherited from interface org.eclipse.jface.viewers.ISelectionProvider
addSelectionChangedListener, removeSelectionChangedListener, setSelection
 

Field Detail

_provider

protected SystemTableViewProvider _provider

_refreshAction

protected SystemRefreshAction _refreshAction

_propertyDialogAction

protected PropertyDialogAction _propertyDialogAction

_selectionShowRefreshAction

protected boolean _selectionShowRefreshAction

_selectionShowOpenViewActions

protected boolean _selectionShowOpenViewActions

_selectionShowDeleteAction

protected boolean _selectionShowDeleteAction

_selectionShowRenameAction

protected boolean _selectionShowRenameAction

_selectionShowPropertiesAction

protected boolean _selectionShowPropertiesAction

_selectionEnableDeleteAction

protected boolean _selectionEnableDeleteAction

_selectionEnableRenameAction

protected boolean _selectionEnableRenameAction

_selectionIsRemoteObject

protected boolean _selectionIsRemoteObject

_selectionFlagsUpdated

protected boolean _selectionFlagsUpdated

menuListenerAdded

protected boolean menuListenerAdded
Constructor Detail

SystemTableView

public SystemTableView(Table table,
                       ISystemMessageLine msgLine)
Constructor for the table view

Method Detail

getProvider

protected SystemTableViewProvider getProvider()
Returns:
returns the table view provider
Since:
3.0 Moved SystemTableViewProvider from internal to API

showColumns

public void showColumns(boolean flag)

getLayout

public Layout getLayout()

setViewFilters

public void setViewFilters(String[] filter)

getViewFilters

public String[] getViewFilters()

getContextMenu

public Menu getContextMenu()
Return the popup menu for the table


getContextMenuManager

public MenuManager getContextMenuManager()
Return the popup menu for the table


inputChanged

public void inputChanged(Object newObject,
                         Object oldObject)
Called whenever the input for the view changes

Overrides:
inputChanged in class AbstractTableViewer

getInput

public Object getInput()
Specified by:
getInput in interface IInputProvider
Overrides:
getInput in class ContentViewer

getViewAdapter

protected ISystemViewElementAdapter getViewAdapter(Object obj)
Convenience method for retrieving the view adapter for an object


getAdapterForContents

public ISystemViewElementAdapter getAdapterForContents()
Convenience method for retrieving the view adapter for an object's children


getVisibleDescriptors

public IPropertyDescriptor[] getVisibleDescriptors(Object object)
Used to determine what the columns should be on the table.


getColumnManager

public ISystemTableViewColumnManager getColumnManager()
Returns:
the column manager
Since:
3.0 replaced SystemTableViewColumnManager by ISystemTableViewColumnManager

getNameDescriptor

public IPropertyDescriptor getNameDescriptor(Object object)

computeLayout

public void computeLayout()

computeLayout

public void computeLayout(boolean force)
Determines what columns should be shown in this view. The columns may change anytime the view input changes. The columns in the control are modified and columns may be added or deleted as necessary to make it conform to the new data.


getCurrentColumnWidths

public int[] getCurrentColumnWidths()

setCurrentColumnWidths

public void setCurrentColumnWidths(int[] widths)

getLastColumnWidths

public int[] getLastColumnWidths()

setLastColumnWidths

public void setLastColumnWidths(int[] widths)

initDragAndDrop

protected void initDragAndDrop()
Initialize drag and drop support for this view.


systemResourceChanged

public void systemResourceChanged(ISystemResourceChangeEvent event)
Used to asynchronously update the view whenever properties change.

Specified by:
systemResourceChanged in interface ISystemResourceChangeListener
See Also:
ISystemResourceChangeListener.systemResourceChanged(org.eclipse.rse.core.events.ISystemResourceChangeEvent)

systemRemoteResourceChanged

public void systemRemoteResourceChanged(ISystemRemoteChangeEvent event)
This is the method in your class that will be called when a remote resource changes. You will be called after the resource is changed.

Specified by:
systemRemoteResourceChanged in interface ISystemRemoteChangeListener
Parameters:
event - the event.
See Also:
ISystemRemoteChangeListener.systemRemoteResourceChanged(org.eclipse.rse.core.events.ISystemRemoteChangeEvent)

selectionChanged

public void selectionChanged(SelectionChangedEvent event)
Specified by:
selectionChanged in interface ISelectionChangedListener

dispose

public void dispose()

getPropertyDialogAction

protected PropertyDialogAction getPropertyDialogAction()

getSelectAllAction

protected IAction getSelectAllAction()
Return the select All action


getRenameAction

protected IAction getRenameAction()
Rather than pre-defined this common action we wait until it is first needed, for performance reasons.


getDeleteAction

protected IAction getDeleteAction()
Rather than pre-defined this common action we wait until it is first needed, for performance reasons.


getRefreshAction

protected IAction getRefreshAction()
Return the refresh action


getNewConnectionAction

public IAction getNewConnectionAction()
Rather than pre-defining this common action we wait until it is first needed, for performance reasons.

Since:
3.0

getShell

public Shell getShell()
Description copied from interface: ISystemShellProvider
This method will be called to return the shell for your viewer.

Specified by:
getShell in interface ISystemShellProvider
Returns:
the shell for your viewer.

showDelete

public boolean showDelete()
Required method from ISystemDeleteTarget. Decides whether to even show the delete menu item. Assumes scanSelections() has already been called

Specified by:
showDelete in interface ISystemDeleteTarget

canDelete

public boolean canDelete()
Required method from ISystemDeleteTarget Decides whether to enable the delete menu item. Assumes scanSelections() has already been called

Specified by:
canDelete in interface ISystemDeleteTarget

doDelete

public boolean doDelete(IProgressMonitor monitor)
Description copied from interface: ISystemDeleteTarget
Actually do the delete of currently selected items. Return true if it worked. Return false if it didn't (you display msg), or throw an exception (framework displays msg)

Specified by:
doDelete in interface ISystemDeleteTarget

showProperties

protected boolean showProperties()
Decides whether to even show the properties menu item. Assumes scanSelections() has already been called


showRename

public boolean showRename()
Required method from ISystemRenameTarget. Decides whether to even show the rename menu item. Assumes scanSelections() has already been called

Specified by:
showRename in interface ISystemRenameTarget

canRename

public boolean canRename()
Required method from ISystemRenameTarget Decides whether to enable the rename menu item. Assumes scanSelections() has already been called

Specified by:
canRename in interface ISystemRenameTarget

getParentForContent

protected Object getParentForContent(Object element)

getRenamingMessage

protected SystemMessage getRenamingMessage(String oldName)
Get the specific "Renaming %1..."

Since:
3.0

doRename

public boolean doRename(String[] newNames)
Required method from ISystemRenameTarget

Specified by:
doRename in interface ISystemRenameTarget

getRemoteAdapter

protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
Returns the implementation of ISystemRemoteElement for the given object. Returns null if this object does not adaptable to this.


enableSelectAll

public boolean enableSelectAll(IStructuredSelection selection)
Return true if select all should be enabled for the given object. For a tree view, you should return true if and only if the selected object has children. You can use the passed in selection or ignore it and query your own selection.

Specified by:
enableSelectAll in interface ISystemSelectAllTarget

doSelectAll

public void doSelectAll(IStructuredSelection selection)
When this action is run via Edit->Select All or via Ctrl+A, perform the select all action. For a tree view, this should select all the children of the given selected object. You can use the passed in selected object or ignore it and query the selected object yourself.

Specified by:
doSelectAll in interface ISystemSelectAllTarget

menuAboutToShow

public void menuAboutToShow(IMenuManager manager)
Specified by:
menuAboutToShow in interface IMenuListener

getSelection

public ISelection getSelection()
Specified by:
getSelection in interface ISelectionProvider
Overrides:
getSelection in class StructuredViewer

fillContextMenu

public void fillContextMenu(IMenuManager menu)

scanSelections

protected void scanSelections()
-------------------------------------------------------------------------------- For many actions we have to walk the selection list and examine each selected object to decide if a given common action is supported or not.

Walking this list multiple times while building the popup menu is a performance hit, so we have this common method that does it only once, setting instance variables for all of the decisions we are in interested in. --------------------------------------------------------------------------------


positionTo

public void positionTo(String name)

displayMessage

public void displayMessage(String msg)
Display a message/status on the message/status line


clearMessage

public void clearMessage()
Clear message/status shown on the message/status line


getCachedColumnWidths

public Map getCachedColumnWidths()
Returns the column widths associated with this view.

Returns:
the map of column widths associated with this view
Since:
3.1

setCachedColumnWidths

public void setCachedColumnWidths(Map cachedColumnWidths)
Sets the map of column widths associated with this view

Parameters:
cachedColumnWidths - the column widths map
Since:
3.1

RSE
Release 3.3

Copyright (c) IBM Corporation and others 2000, 2011. All Rights Reserved.