Remote Systems
v6.4.1

com.ibm.etools.systems.core.ui.view.scratchpad
Class SystemScratchpadView

java.lang.Object
  extended byTreeViewer
      extended bycom.ibm.etools.systems.core.ui.view.scratchpad.SystemScratchpadView
All Implemented Interfaces:
EventListener, ISystemDeleteTarget, ISystemRemoteChangeListener, ISystemRenameTarget, ISystemResourceChangeListener, ISystemSelectAllTarget

public class SystemScratchpadView
extends TreeViewer
implements ISystemDeleteTarget, ISystemRenameTarget, ISystemSelectAllTarget, ISystemResourceChangeListener, ISystemRemoteChangeListener

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

TableViewer comes from com.ibm.jface.viewer

See Also:
Serialized Form

Field Summary
protected  ClearAction _clearAllAction
           
protected  ClearSelectedAction _clearSelectedAction
           
protected  SystemCommonDeleteAction _deleteAction
           
protected  SystemOpenExplorerPerspectiveAction _openToPerspectiveAction
           
protected  PropertyDialogAction _propertyDialogAction
           
protected  SystemRefreshAction _refreshAction
           
protected  SystemRemotePropertiesAction _remotePropertyDialogAction
           
protected  SystemCommonRenameAction _renameAction
           
protected  SystemCommonSelectAllAction _selectAllAction
           
protected  boolean _selectionEnableDeleteAction
           
protected  boolean _selectionEnableRenameAction
           
protected  boolean _selectionFlagsUpdated
           
protected  boolean _selectionIsRemoteObject
           
protected  boolean _selectionShowDeleteAction
           
protected  boolean _selectionShowOpenViewActions
           
protected  boolean _selectionShowRefreshAction
           
protected  boolean _selectionShowRenameAction
           
protected  SystemShowInTableAction _showInTableAction
           
static String Copyright
           
protected  boolean menuListenerAdded
           
 
Fields inherited from interface com.ibm.etools.systems.core.ui.ISystemDeleteTarget
copyright
 
Fields inherited from interface com.ibm.etools.systems.core.ui.ISystemRenameTarget
copyright
 
Fields inherited from interface com.ibm.etools.systems.model.ISystemResourceChangeListener
copyright
 
Fields inherited from interface com.ibm.etools.systems.model.ISystemRemoteChangeListener
copyright
 
Constructor Summary
SystemScratchpadView(Tree tableTree, 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 displayMessage(String msg)
          Display a message/status on the message/status line
 void dispose()
           
 boolean doDelete()
          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)
           
protected  ISystemViewElementAdapter getAdapter(Object obj)
          Convenience method for retrieving the view adapter for an object
protected  IAction getClearAllAction()
           
protected  IAction getClearSelectedAction()
           
 Menu getContextMenu()
          Return the popup menu for the table
 MenuManager getContextMenuManager()
          Return the popup menu for the table
protected  IAction getDeleteAction()
          Rather than pre-defined this common action we wait until it is first needed, for performance reasons.
 Object getInput()
           
 Layout getLayout()
           
protected  SystemOpenExplorerPerspectiveAction getOpenToPerspectiveAction()
          Get the common "Open to->" action for opening a new Remote Systems Explorer view, scoped to the currently selected object.
protected  Object getParentForContent(Object element)
           
protected  PropertyDialogAction getPropertyDialogAction()
          Rather than pre-defining this common action we wait until it is first needed, for performance reasons.
protected  IAction getRefreshAction()
          Return the refresh action
protected  ISystemRemoteElementAdapter getRemoteAdapter(Object o)
          Returns the implementation of ISystemRemoteElement for the given object.
protected  SystemRemotePropertiesAction getRemotePropertyDialogAction()
          Rather than pre-defining this common action we wait until it is first needed, for performance reasons.
protected  IAction getRenameAction()
          Rather than pre-defined this common action we wait until it is first needed, for performance reasons.
protected  IAction getSelectAllAction()
          Return the select All action
 ISelection getSelection()
           
 Shell getShell()
          This is the method in your class that will be called to return the shell for your viewer
protected  SystemShowInTableAction getShowInTableAction()
           
protected  void initDragAndDrop()
           
 void inputChanged(Object newObject, Object oldObject)
          Called whenever the input for the view changes
 void menuAboutToShow(IMenuManager manager)
           
 void removeAsListener()
          Remove as listener.
 boolean sameParent()
          This is called to ensure all elements in a multiple-selection have the same parent in the tree viewer.
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 setWorkbenchPart(IWorkbenchPart part)
           
 boolean showDelete()
          Required method from ISystemDeleteTarget.
protected  boolean showRefresh()
          Decides whether to even show the refresh 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Copyright

public static final String Copyright
See Also:
Constant Field Values

_refreshAction

protected SystemRefreshAction _refreshAction

_propertyDialogAction

protected PropertyDialogAction _propertyDialogAction

_remotePropertyDialogAction

protected SystemRemotePropertiesAction _remotePropertyDialogAction

_openToPerspectiveAction

protected SystemOpenExplorerPerspectiveAction _openToPerspectiveAction

_showInTableAction

protected SystemShowInTableAction _showInTableAction

_deleteAction

protected SystemCommonDeleteAction _deleteAction

_renameAction

protected SystemCommonRenameAction _renameAction

_selectAllAction

protected SystemCommonSelectAllAction _selectAllAction

_clearSelectedAction

protected ClearSelectedAction _clearSelectedAction

_clearAllAction

protected ClearAction _clearAllAction

_selectionShowRefreshAction

protected boolean _selectionShowRefreshAction

_selectionShowOpenViewActions

protected boolean _selectionShowOpenViewActions

_selectionShowDeleteAction

protected boolean _selectionShowDeleteAction

_selectionShowRenameAction

protected boolean _selectionShowRenameAction

_selectionEnableDeleteAction

protected boolean _selectionEnableDeleteAction

_selectionEnableRenameAction

protected boolean _selectionEnableRenameAction

_selectionIsRemoteObject

protected boolean _selectionIsRemoteObject

_selectionFlagsUpdated

protected boolean _selectionFlagsUpdated

menuListenerAdded

protected boolean menuListenerAdded
Constructor Detail

SystemScratchpadView

public SystemScratchpadView(Tree tableTree,
                            ISystemMessageLine msgLine)
Constructor for the table view

Method Detail

getLayout

public Layout getLayout()

setWorkbenchPart

public void setWorkbenchPart(IWorkbenchPart part)

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


getInput

public Object getInput()

getAdapter

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


initDragAndDrop

protected void initDragAndDrop()

systemResourceChanged

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

Specified by:
systemResourceChanged in interface ISystemResourceChangeListener
See Also:
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
See Also:
ISystemRemoteChangeEvent

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


selectionChanged

public void selectionChanged(SelectionChangedEvent event)

dispose

public void dispose()

removeAsListener

public void removeAsListener()
Remove as listener.


getPropertyDialogAction

protected PropertyDialogAction getPropertyDialogAction()
Rather than pre-defining this common action we wait until it is first needed, for performance reasons.


getRemotePropertyDialogAction

protected SystemRemotePropertiesAction getRemotePropertyDialogAction()
Rather than pre-defining this common action we wait until it is first needed, for performance reasons.


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.


getClearSelectedAction

protected IAction getClearSelectedAction()

getClearAllAction

protected IAction getClearAllAction()

getRefreshAction

protected IAction getRefreshAction()
Return the refresh action


getOpenToPerspectiveAction

protected SystemOpenExplorerPerspectiveAction getOpenToPerspectiveAction()
Get the common "Open to->" action for opening a new Remote Systems Explorer view, scoped to the currently selected object.


getShowInTableAction

protected SystemShowInTableAction getShowInTableAction()

getShell

public Shell getShell()
Description copied from interface: ISystemResourceChangeListener
This is the method in your class that will be called to return the shell for your viewer

Specified by:
getShell in interface ISystemResourceChangeListener

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()
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

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)

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)

getSelection

public ISelection getSelection()

fillContextMenu

public void fillContextMenu(IMenuManager menu)

showRefresh

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


sameParent

public boolean sameParent()
This is called to ensure all elements in a multiple-selection have the same parent in the tree viewer. If they don't we automatically disable all actions.

Designed to be as fast as possible by going directly to the SWT widgets


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. --------------------------------------------------------------------------------


Remote Systems
v6.4.1

Copyright © 2005 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.