RSE
Release 1.0

org.eclipse.rse.ui.view.team
Class SystemTeamViewPart

java.lang.Object
  extended byorg.eclipse.core.commands.common.EventManager
      extended byorg.eclipse.ui.part.WorkbenchPart
          extended byorg.eclipse.ui.part.ViewPart
              extended byorg.eclipse.rse.ui.view.team.SystemTeamViewPart
All Implemented Interfaces:
IAdaptable, IExecutableExtension, IPersistable, IRSEViewPart, ISelectionChangedListener, ISelectionProvider, ISetSelectionTarget, ISystemDeleteTarget, ISystemMessageLine, ISystemModelChangeListener, ISystemRenameTarget, IViewPart, IWorkbenchPart, IWorkbenchPart2, IWorkbenchPartOrientation

public class SystemTeamViewPart
extends ViewPart
implements ISetSelectionTarget, ISelectionProvider, ISystemModelChangeListener, ISystemMessageLine, ISelectionChangedListener, ISystemDeleteTarget, ISystemRenameTarget, IRSEViewPart

The viewer and view part for the Team view


Nested Class Summary
 class SystemTeamViewPart.RestoreStateRunnable
          Inner class for running restore-state in a thread
 
Field Summary
protected  SystemCollapseAllAction collapseAllAction
           
protected  SystemCommonDeleteAction deleteAction
           
static String ID
           
protected  SystemTeamViewRefreshAllAction menuRefreshAllAction
           
protected  SystemNewProfileAction newProfileAction
           
protected  ISystemViewElementAdapter profileAdapter
           
protected  PropertyDialogAction propertyDialogAction
           
protected  SystemTeamReloadAction reloadRSEAction
           
protected  SystemTeamViewRefreshAllAction toolBarRefreshAllAction
           
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Constructor Summary
SystemTeamViewPart()
           
 
Method Summary
protected  void addActions(SystemMenuManager ourMenu, IStructuredSelection selection)
          Let each object add their own actions...
 void addSelectionChangedListener(ISelectionChangedListener listener)
          Add a selection change listener
protected  void addTreeViewerListeners()
          Adds the listeners to the tree viewer.
 boolean canDelete()
          Return true if delete should be enabled based on your current selection.
 boolean canRename()
          Return true if rename should be enabled based on your current selection.
 void clearErrorMessage()
          Clears the currently displayed error message and redisplayes the message which was active before the error message was set.
 void clearMessage()
          Clears the currently displayed message.
 void createPartControl(Composite parent)
          Create the viewer to go in this view part.
 void createStandardGroups(IMenuManager menu)
          Creates the Systems plugin standard groups in a context menu.
 void dispose()
           
 boolean doDelete(IProgressMonitor monitor)
          Actually do the delete of currently selected items.
 boolean doRename(String[] newNames)
          Actually do the rename of currently selected items.
 void fillActionBars(IActionBars actionBars)
          Adds the actions in this group and its subgroups to the action bars.
protected  SystemCollapseAllAction getCollapseAllAction()
          Return the collapseAll action
protected  IAction getDeleteAction(IStructuredSelection selection)
          Rather than pre-defined this common action we wait until it is first needed, for performance reasons.
 String getErrorMessage()
          Get the currently displayed error text.
protected  IAdaptable getInput()
          Determines the input for the viewer.
protected  String getMementoHandle(Object o)
          Return the memento handle key plus the memento handle for each part leading up to the current object.
 String getMessage()
          Get the currently displayed message.
protected  ImageDescriptor getNavigatorImageDescriptor(String relativePath)
          Returns the image descriptor with the given relative path.
protected  Object getObjectFromMemento(String memento)
          Private method to deconstruct an expanded/selected memento into an actual object
 Viewer getRSEViewer()
           
 ISelection getSelection()
          Returns selection for the tree view
 Shell getShell()
          Returns the shell to use for opening dialogs.
 IStructuredSelection getStructuredSelection()
          Returns the tree viewer selection as a structured selection
 SystemMessage getSystemErrorMessage()
          Get the currently displayed error text.
 TreeViewer getTreeViewer()
           
 TreeViewer getViewer()
          Return our viewer.
protected  void handleOpen(OpenEvent event)
          Handles an open event from the viewer.
 void init(IViewSite site, IMemento memento)
          Initializes this view with the given view site.
protected  String internalGetMementoHandle(Object o)
          Encapsulate code to look at object class type and determine what to return for a memento handle
protected  String internalGetMementoHandleKey(Object o)
          Encapsulate code to look at object class type and determine what to return for a memento handle key
 void removeSelectionChangedListener(ISelectionChangedListener listener)
          Remove a selection change listener
 void saveState(IMemento memento)
          Method declared on IViewPart.
 void selectionChanged(SelectionChangedEvent event)
          Handles selection changed in viewer.
 void selectReveal(ISelection selection)
          Reveal and selects the passed selection in viewer.
 void setErrorMessage(String message)
          Display the given error message.
 void setErrorMessage(SystemMessage message)
          Display the given error message.
 void setErrorMessage(Throwable exc)
          Display the given error message.
 void setFocus()
          We are getting focus
 void setMessage(String message)
          Set the message text.
 void setMessage(SystemMessage message)
          If the message line currently displays an error, the message is stored and will be shown after a call to clearErrorMessage
 void setSelection(ISelection selection)
           
 boolean showDelete()
          Return true if delete should even be shown in the popup menu
 boolean showRename()
          Return true if rename should even be shown in the popup menu
 void systemModelResourceChanged(ISystemModelChangeEvent event)
          This is the method in your class that will be called when a resource in the RSE model changes.
 void updateActionBars(IStructuredSelection selection)
          Updates the actions which were added to the action bars.
 void updateTitle()
          Updates the title text and title tool tip.
 
Methods inherited from class org.eclipse.ui.part.ViewPart
checkSite, getViewSite, init, setContentDescription, setInitializationData, setPartName
 
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPropertyListener, 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, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Field Detail

ID

public static final String ID
See Also:
Constant Field Values

reloadRSEAction

protected SystemTeamReloadAction reloadRSEAction

newProfileAction

protected SystemNewProfileAction newProfileAction

deleteAction

protected SystemCommonDeleteAction deleteAction

propertyDialogAction

protected PropertyDialogAction propertyDialogAction

toolBarRefreshAllAction

protected SystemTeamViewRefreshAllAction toolBarRefreshAllAction

menuRefreshAllAction

protected SystemTeamViewRefreshAllAction menuRefreshAllAction

collapseAllAction

protected SystemCollapseAllAction collapseAllAction

profileAdapter

protected ISystemViewElementAdapter profileAdapter
Constructor Detail

SystemTeamViewPart

public SystemTeamViewPart()
Method Detail

removeSelectionChangedListener

public void removeSelectionChangedListener(ISelectionChangedListener listener)
Remove a selection change listener

Specified by:
removeSelectionChangedListener in interface ISelectionProvider

addSelectionChangedListener

public void addSelectionChangedListener(ISelectionChangedListener listener)
Add a selection change listener

Specified by:
addSelectionChangedListener in interface ISelectionProvider

getSelection

public ISelection getSelection()
Returns selection for the tree view

Specified by:
getSelection in interface ISelectionProvider

setSelection

public void setSelection(ISelection selection)
Specified by:
setSelection in interface ISelectionProvider

getStructuredSelection

public IStructuredSelection getStructuredSelection()
Returns the tree viewer selection as a structured selection


getTreeViewer

public TreeViewer getTreeViewer()

getRSEViewer

public Viewer getRSEViewer()
Specified by:
getRSEViewer in interface IRSEViewPart

setFocus

public void setFocus()
We are getting focus

Specified by:
setFocus in interface IWorkbenchPart

createPartControl

public void createPartControl(Composite parent)
Create the viewer to go in this view part.

Specified by:
createPartControl in interface IWorkbenchPart

init

public void init(IViewSite site,
                 IMemento memento)
          throws PartInitException
Initializes this view with the given view site. A memento is passed to the view which contains a snapshot of the views state from a previous session. Where possible, the view should try to recreate that state within the part controls.

The parent's default implementation will ignore the memento and initialize the view in a fresh state. Subclasses may override the implementation to perform any state restoration as needed.

Specified by:
init in interface IViewPart
Throws:
PartInitException

addTreeViewerListeners

protected void addTreeViewerListeners()
Adds the listeners to the tree viewer.


getShell

public Shell getShell()
Returns the shell to use for opening dialogs. Used in this class, and in the actions.


handleOpen

protected void handleOpen(OpenEvent event)
Handles an open event from the viewer. Opens an editor on the selected file.


selectReveal

public void selectReveal(ISelection selection)
Reveal and selects the passed selection in viewer.

Specified by:
selectReveal in interface ISetSelectionTarget

addActions

protected void addActions(SystemMenuManager ourMenu,
                          IStructuredSelection selection)
Let each object add their own actions...


createStandardGroups

public void createStandardGroups(IMenuManager menu)
Creates the Systems plugin standard groups in a context menu.


getDeleteAction

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


dispose

public void dispose()
Specified by:
dispose in interface IWorkbenchPart

getViewer

public TreeViewer getViewer()
Return our viewer.


updateTitle

public void updateTitle()
Updates the title text and title tool tip. Called whenever the input of the viewer changes.


getInput

protected IAdaptable getInput()
Determines the input for the viewer. This is needed for the "Open in New Window" action that sets the input to the workbench page, and expects the viewers to use it.


fillActionBars

public void fillActionBars(IActionBars actionBars)
Adds the actions in this group and its subgroups to the action bars.


getCollapseAllAction

protected SystemCollapseAllAction getCollapseAllAction()
Return the collapseAll action


updateActionBars

public void updateActionBars(IStructuredSelection selection)
Updates the actions which were added to the action bars.


systemModelResourceChanged

public void systemModelResourceChanged(ISystemModelChangeEvent event)
This is the method in your class that will be called when a resource in the RSE model changes. You will be called after the resource is changed.

Specified by:
systemModelResourceChanged in interface ISystemModelChangeListener
See Also:
ISystemModelChangeEvent

showDelete

public boolean showDelete()
Description copied from interface: ISystemDeleteTarget
Return true if delete should even be shown in the popup menu

Specified by:
showDelete in interface ISystemDeleteTarget

canDelete

public boolean canDelete()
Description copied from interface: ISystemDeleteTarget
Return true if delete should be enabled based on your current selection.

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

showRename

public boolean showRename()
Description copied from interface: ISystemRenameTarget
Return true if rename should even be shown in the popup menu

Specified by:
showRename in interface ISystemRenameTarget

canRename

public boolean canRename()
Description copied from interface: ISystemRenameTarget
Return true if rename should be enabled based on your current selection.

Specified by:
canRename in interface ISystemRenameTarget

doRename

public boolean doRename(String[] newNames)
Description copied from interface: ISystemRenameTarget
Actually do the rename of currently selected items. The array of new names matches the 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:
doRename in interface ISystemRenameTarget

getNavigatorImageDescriptor

protected ImageDescriptor getNavigatorImageDescriptor(String relativePath)
Returns the image descriptor with the given relative path.


saveState

public void saveState(IMemento memento)
Method declared on IViewPart.

Specified by:
saveState in interface IViewPart

getMementoHandle

protected String getMementoHandle(Object o)
Return the memento handle key plus the memento handle for each part leading up to the current object.


internalGetMementoHandleKey

protected String internalGetMementoHandleKey(Object o)
Encapsulate code to look at object class type and determine what to return for a memento handle key


internalGetMementoHandle

protected String internalGetMementoHandle(Object o)
Encapsulate code to look at object class type and determine what to return for a memento handle


getObjectFromMemento

protected Object getObjectFromMemento(String memento)
Private method to deconstruct an expanded/selected memento into an actual object


selectionChanged

public void selectionChanged(SelectionChangedEvent event)
Handles selection changed in viewer. Updates global actions. Links to editor (if option enabled)

Specified by:
selectionChanged in interface ISelectionChangedListener

clearErrorMessage

public void clearErrorMessage()
Clears the currently displayed error message and redisplayes the message which was active before the error message was set.

Specified by:
clearErrorMessage in interface ISystemMessageLine

clearMessage

public void clearMessage()
Clears the currently displayed message.

Specified by:
clearMessage in interface ISystemMessageLine

getErrorMessage

public String getErrorMessage()
Get the currently displayed error text.

Specified by:
getErrorMessage in interface ISystemMessageLine
Returns:
The error message. If no error message is displayed null is returned.

getMessage

public String getMessage()
Get the currently displayed message.

Specified by:
getMessage in interface ISystemMessageLine
Returns:
The message. If no message is displayed null is returned.

setErrorMessage

public void setErrorMessage(String message)
Display the given error message. A currently displayed message is saved and will be redisplayed when the error message is cleared.

Specified by:
setErrorMessage in interface ISystemMessageLine

getSystemErrorMessage

public SystemMessage getSystemErrorMessage()
Get the currently displayed error text.

Specified by:
getSystemErrorMessage in interface ISystemMessageLine
Returns:
The error message. If no error message is displayed null is returned.

setErrorMessage

public void setErrorMessage(SystemMessage message)
Display the given error message. A currently displayed message is saved and will be redisplayed when the error message is cleared.

Specified by:
setErrorMessage in interface ISystemMessageLine

setErrorMessage

public void setErrorMessage(Throwable exc)
Display the given error message. A currently displayed message is saved and will be redisplayed when the error message is cleared.

Specified by:
setErrorMessage in interface ISystemMessageLine

setMessage

public void setMessage(String message)
Set the message text. If the message line currently displays an error, the message is stored and will be shown after a call to clearErrorMessage

Specified by:
setMessage in interface ISystemMessageLine

setMessage

public void setMessage(SystemMessage message)
If the message line currently displays an error, the message is stored and will be shown after a call to clearErrorMessage

Specified by:
setMessage in interface ISystemMessageLine

RSE
Release 1.0

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