RSE
Release 1.0

org.eclipse.rse.files.ui.actions
Class SystemCopyRemoteFileAction

java.lang.Object
  extended byorg.eclipse.core.commands.common.EventManager
      extended byorg.eclipse.jface.action.AbstractAction
          extended byorg.eclipse.jface.action.Action
              extended byorg.eclipse.rse.ui.actions.SystemBaseAction
                  extended byorg.eclipse.rse.ui.actions.SystemBaseDialogAction
                      extended byorg.eclipse.rse.ui.actions.SystemBaseCopyAction
                          extended byorg.eclipse.rse.files.ui.actions.SystemCopyRemoteFileAction
All Implemented Interfaces:
IAction, IRunnableWithProgress, ISelectionChangedListener, ISystemAction, ISystemCopyTargetSelectionCallback, ISystemDialogAction, IValidatorRemoteSelection
Direct Known Subclasses:
SystemMoveRemoteFileAction

public class SystemCopyRemoteFileAction
extends SystemBaseCopyAction
implements IValidatorRemoteSelection

Copy selected files and folders action.


Field Summary
protected  Vector copiedFiles
           
protected  IRemoteFile[] files
           
protected  IRemoteFile firstSelection
           
protected  IRemoteFile firstSelectionParent
           
protected  IHost sourceConnection
           
protected  IRemoteFileSubSystem ss
           
protected  IRemoteFile targetFileOrFolder
           
protected  IRemoteFile targetFolder
           
 
Fields inherited from class org.eclipse.rse.ui.actions.SystemBaseCopyAction
copiedOk, mgr, mode, MODE_COPY, MODE_MOVE, newNames, oldNames, oldObjects, runCount, runException, sr, targetContainer
 
Fields inherited from class org.eclipse.rse.ui.actions.SystemBaseDialogAction
cancelled, dlgHelpId, needsProgressMonitor, needsProgressMonitorSet, processAll, value
 
Fields inherited from class org.eclipse.rse.ui.actions.SystemBaseAction
allowOnMultipleSelection, arrowCursor, helpId, selectionSensitive, shell, sSelection, traceSelections, traceTarget, viewer, waitCursor
 
Fields inherited from interface org.eclipse.jface.action.IAction
AS_CHECK_BOX, AS_DROP_DOWN_MENU, AS_PUSH_BUTTON, AS_RADIO_BUTTON, AS_UNSPECIFIED, CHECKED, DESCRIPTION, ENABLED, HANDLED, IMAGE, RESULT, TEXT, TOOL_TIP_TEXT
 
Constructor Summary
SystemCopyRemoteFileAction(Shell shell)
          Constructor
 
Method Summary
protected  String checkForCollision(Shell shell, IProgressMonitor monitor, Object targetContainer, Object oldObject, String oldName)
           
 void copyComplete()
          Called after all the copy/move operations end, be it successfully or not.
protected  Dialog createDialog(Shell shell)
          Override of parent.
protected  boolean doCopy(IProgressMonitor monitor, Object targetContainer, Object oldObject, String newName)
          DO THE ACTUAL COPY OR MOVE.
protected  IRemoteFile getFirstSelectedFile()
          Get the first selected file or folder
protected  String[] getOldNames()
           
protected  Object[] getOldObjects()
           
protected  IRemoteFile[] getSelectedFiles()
          Get the currently selected IRemoteFile objects
protected  Object getTargetContainer(Dialog dlg)
          Override this method if you supply your own copy/move target dialog.
protected  SystemSimpleContentElement getTreeInitialSelection()
          Required parent class abstract method.
protected  SystemSimpleContentElement getTreeModel()
          Required parent class abstract method.
 SystemMessage isValid(IHost selectedConnection, Object[] selectedObjects, ISystemRemoteElementAdapter[] remoteAdaptersForSelectedObjects)
          The user has selected a remote object.
protected  void reset()
          Reset.
 boolean updateSelection(IStructuredSelection selection)
          We override from parent to do unique checking...
 
Methods inherited from class org.eclipse.rse.ui.actions.SystemBaseCopyAction
getCompletionMessage, getCopyingMessage, getCopyingMessage, getDialogValue, getPromptString, getRunnableContext, isValidTargetParent, preCheckForCollision, preCheckForCollision, run, showOperationCancelledMessage, showOperationErrorMessage, showOperationErrorMessage, showOperationMessage
 
Methods inherited from class org.eclipse.rse.ui.actions.SystemBaseDialogAction
getDialogHelpContextId, getNeedsProgressMonitor, getProcessAllSelections, getValue, run, setDialogHelp, setNeedsProgressMonitor, setProcessAllSelections, setValue, wasCancelled, wasNeedsProgressMonitorSet
 
Methods inherited from class org.eclipse.rse.ui.actions.SystemBaseAction
allowOnMultipleSelection, checkObjectType, getAdapter, getContextMenuGroup, getCurrentTreeView, getFirstSelection, getHelpContextId, getNextSelection, getRemoteAdapter, getSelection, getSelectionProvider, getShell, getShell, getSystemConnection, getViewer, isDummy, isEnabled, isSelectionSensitive, issueTraceMessage, selectionChanged, setAvailableOffline, setBusyCursor, setContextMenuGroup, setDisplayCursor, setDisplayCursor, setHelp, setHost, setInputs, setSelection, setSelectionProvider, setSelectionSensitive, setShell, setTracing, setTracing, setViewer
 
Methods inherited from class org.eclipse.jface.action.Action
convertAccelerator, convertAccelerator, findKeyCode, findKeyString, findModifier, findModifierString, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText
 
Methods inherited from class org.eclipse.jface.action.AbstractAction
addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener
 
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.rse.ui.actions.ISystemAction
allowOnMultipleSelection, getContextMenuGroup, getHelpContextId, getSelection, getShell, getViewer, isDummy, isSelectionSensitive, setContextMenuGroup, setHelp, setInputs, setSelection, setSelectionSensitive, setShell, setViewer
 
Methods inherited from interface org.eclipse.jface.action.IAction
addPropertyChangeListener, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, removePropertyChangeListener, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText
 
Methods inherited from interface org.eclipse.jface.viewers.ISelectionChangedListener
selectionChanged
 

Field Detail

targetFolder

protected IRemoteFile targetFolder

targetFileOrFolder

protected IRemoteFile targetFileOrFolder

firstSelection

protected IRemoteFile firstSelection

firstSelectionParent

protected IRemoteFile firstSelectionParent

files

protected IRemoteFile[] files

copiedFiles

protected Vector copiedFiles

sourceConnection

protected IHost sourceConnection

ss

protected IRemoteFileSubSystem ss
Constructor Detail

SystemCopyRemoteFileAction

public SystemCopyRemoteFileAction(Shell shell)
Constructor

Method Detail

reset

protected void reset()
Reset. This is a re-run of this action

Overrides:
reset in class SystemBaseCopyAction

updateSelection

public boolean updateSelection(IStructuredSelection selection)
We override from parent to do unique checking...

We simply ensure every selected object is an IRemoteFile

Overrides:
updateSelection in class SystemBaseAction
See Also:
SystemBaseAction.updateSelection(IStructuredSelection)

checkForCollision

protected String checkForCollision(Shell shell,
                                   IProgressMonitor monitor,
                                   Object targetContainer,
                                   Object oldObject,
                                   String oldName)
Specified by:
checkForCollision in class SystemBaseCopyAction
Parameters:
shell - Window to host dialog
monitor - Usually not needed
targetContainer - will be the IRemoteFile folder selected to copy into
oldObject - will be the IRemoteFile object currently being copied
oldName - will be the name of the IRemoteFile object currently being copied
See Also:
SystemBaseCopyAction.checkForCollision(Shell, IProgressMonitor, Object, Object, String)

doCopy

protected boolean doCopy(IProgressMonitor monitor,
                         Object targetContainer,
                         Object oldObject,
                         String newName)
                  throws Exception
Description copied from class: SystemBaseCopyAction
DO THE ACTUAL COPY OR MOVE. THIS MUST BE IMPLEMENTED BY CHILD CLASSES

Specified by:
doCopy in class SystemBaseCopyAction
Parameters:
monitor - Usually not needed
targetContainer - will be the IRemoteFile folder selected to copy into
oldObject - will be the IRemoteFile object currently being copied
newName - will be the new name to give the oldObject on copy
Throws:
Exception
See Also:
SystemBaseCopyAction.doCopy(IProgressMonitor, Object, Object, String)

getTreeModel

protected SystemSimpleContentElement getTreeModel()
Required parent class abstract method. Does not apply to us as we supply our own dialog for the copy-target

Specified by:
getTreeModel in class SystemBaseCopyAction

getTreeInitialSelection

protected SystemSimpleContentElement getTreeInitialSelection()
Required parent class abstract method. Does not apply to us as we supply our own dialog for the copy-target

Specified by:
getTreeInitialSelection in class SystemBaseCopyAction

getOldObjects

protected Object[] getOldObjects()
Specified by:
getOldObjects in class SystemBaseCopyAction
See Also:
Returns an array of IRemoteFile objects

getOldNames

protected String[] getOldNames()
Specified by:
getOldNames in class SystemBaseCopyAction
See Also:
SystemBaseCopyAction.getOldNames()

createDialog

protected Dialog createDialog(Shell shell)
Override of parent. Return the dialog that will be used to prompt for the copy/move target location.

Overrides:
createDialog in class SystemBaseCopyAction
See Also:
SystemBaseDialogAction.run()

getTargetContainer

protected Object getTargetContainer(Dialog dlg)
Override this method if you supply your own copy/move target dialog. Return the user-selected target or null if cancelled

Overrides:
getTargetContainer in class SystemBaseCopyAction

copyComplete

public void copyComplete()
Called after all the copy/move operations end, be it successfully or not. Your opportunity to display completion or do post-copy selections/refreshes

Overrides:
copyComplete in class SystemBaseCopyAction

getSelectedFiles

protected IRemoteFile[] getSelectedFiles()
Get the currently selected IRemoteFile objects


getFirstSelectedFile

protected IRemoteFile getFirstSelectedFile()
Get the first selected file or folder


isValid

public SystemMessage isValid(IHost selectedConnection,
                             Object[] selectedObjects,
                             ISystemRemoteElementAdapter[] remoteAdaptersForSelectedObjects)
The user has selected a remote object. Return null if OK is to be enabled, or a SystemMessage if it is not to be enabled. The message will be displayed on the message line.

This is overridden in SystemMoveRemoteFileAction

Specified by:
isValid in interface IValidatorRemoteSelection

RSE
Release 1.0

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