Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

RSE
Release 3.0

org.eclipse.rse.ui.actions
Class SystemBaseCopyAction


java.lang.Object
  extended by 

org.eclipse.core.commands.common.EventManager
      extended by 

org.eclipse.jface.action.AbstractAction
          extended by 

org.eclipse.jface.action.Action
              extended by 

org.eclipse.rse.ui.actions.SystemBaseAction
                  extended by 

org.eclipse.rse.ui.actions.SystemBaseDialogAction
                      extended by 
org.eclipse.rse.ui.actions.SystemBaseCopyAction
All Implemented Interfaces:
IAction, IRunnableWithProgress, ISelectionChangedListener, ISystemAction, ISystemCopyTargetSelectionCallback, ISystemDialogAction

public abstract class SystemBaseCopyAction
extends SystemBaseDialogAction
implements IRunnableWithProgress, ISystemCopyTargetSelectionCallback

An abstract base class for all copy actions. Defers minimal requirements to child classes.


Field Summary
protected  boolean copiedOk
           
protected   ISystemProfileManager mgr
           
protected  int mode
           
static int MODE_COPY
           
static int MODE_MOVE
           
protected   String[] newNames
           
protected   String[] oldNames
           
protected   Object[] oldObjects
           
protected  int runCount
           
protected   Exception runException
           
protected   ISystemRegistry sr
           
protected   Object 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
SystemBaseCopyAction ( Shell parent, int mode)
          Constructor when using default action ID
SystemBaseCopyAction ( Shell parent, String label, int mode)
          Constructor
 
Method Summary
protected abstract   String checkForCollision ( Shell shell, IProgressMonitor monitor, Object targetContainer, Object oldObject, String oldName)
           
 void copyComplete ( String operation)
          Called after all the copy/move operations end, be it successfully or not.
protected   Dialog createDialog ( Shell parent)
          Override of parent.
protected abstract  boolean doCopy ( Object targetContainer, Object oldObject, String newName, IProgressMonitor monitor)
          DO THE ACTUAL COPY OR MOVE.
  SystemMessage getCompletionMessage ( Object targetContainer, String[] oldNames, String[] newNames)
          Return complete message.
protected   SystemMessage getCopyingMessage ()
          Get the generic "Copying..." or "Moving..." message
protected   SystemMessage getCopyingMessage ( String oldName)
          Get the specific "Copying %1..." or "Moving %1..." message
protected   Object getDialogValue ( Dialog dlg)
          Required by parent.
protected abstract   String[] getOldNames ()
           
protected abstract   Object[] getOldObjects ()
           
protected   String getPromptString ()
          Get the verbiage prompt to show on line one of the copy dialog
protected   IRunnableContext getRunnableContext ()
          Get an IRunnable context to show progress in.
protected   Object getTargetContainer ( Dialog dlg)
          Override this method if you supply your own copy/move target dialog.
protected abstract   SystemSimpleContentElement getTreeInitialSelection ()
           
protected abstract   SystemSimpleContentElement getTreeModel ()
           
 boolean isValidTargetParent ( SystemSimpleContentElement selectedElement)
          This method is a callback from the select-target-parent dialog, allowing us to decide whether the current selected object is a valid parent object.
protected  boolean preCheckForCollision ()
          Do a pre-check for a collision situation.
protected  boolean preCheckForCollision ( Shell shell, Object targetContainer, Object oldObject, String oldName)
          Overridable entry point when you want to prevent any copies/moves if any of the selected objects have a name collision.
protected  void reset ()
          Reset.
 void run ( IProgressMonitor monitor)
          Method required by IRunnableWithProgress interface.
protected  void showOperationCancelledMessage ( Shell shell)
          Show an error message when the user cancels the operation.
protected  void showOperationErrorMessage ( Shell shell, SystemMessageException exc)
          Show an error message when the operation fails.
protected  void showOperationErrorMessage ( Shell shell, Throwable exc)
          Show an error message when the operation fails.
protected  void showOperationMessage ( Exception exc, Shell shell)
          Helper method to show an error message resulting from the attempted operation.
 
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, getContextMenuGroup, getCurrentTreeView, getFirstSelection, getHelpContextId, getNextSelection, getRemoteAdapter, getSelection, getSelectionProvider, getShell, getShell, getSystemConnection, getViewAdapter, getViewer, isDummy, isEnabled, isSelectionSensitive, issueTraceMessage, selectionChanged, setAvailableOffline, setBusyCursor, setContextMenuGroup, setDisplayCursor, setDisplayCursor, setHelp, setHost, setInputs, setSelection, setSelectionProvider, setSelectionSensitive, setShell, setTracing, setTracing, setViewer, updateSelection
 
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

mgr

protected 
ISystemProfileManager mgr

sr

protected 
ISystemRegistry sr

oldNames

protected 
String[] oldNames

newNames

protected 
String[] newNames

oldObjects

protected 
Object[] oldObjects

targetContainer

protected 
Object targetContainer

copiedOk

protected boolean copiedOk

runException

protected 
Exception runException

mode

protected int mode

runCount

protected int runCount

MODE_COPY

public static final int MODE_COPY
See Also:
Constant Field Values

MODE_MOVE

public static final int MODE_MOVE
See Also:
Constant Field Values
Constructor Detail

SystemBaseCopyAction

public SystemBaseCopyAction(
Shell parent,
                            int mode)
Constructor when using default action ID

Parameters:
parent - Owning shell
mode - Either MODE_COPY or MODE_MOVE from this class

SystemBaseCopyAction

public SystemBaseCopyAction(
Shell parent,
                            
String label,
                            int mode)
Constructor

Parameters:
parent - Owning shell
label -
mode - Either MODE_COPY or MODE_MOVE from this class
Method Detail

reset

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


createDialog

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

Specified by:
createDialog in class SystemBaseDialogAction
See Also:
SystemBaseDialogAction.run()

getOldNames

protected abstract 
String[] getOldNames()

getOldObjects

protected abstract 
Object[] getOldObjects()

getPromptString

protected 
String getPromptString()
Get the verbiage prompt to show on line one of the copy dialog


getTreeModel

protected abstract 
SystemSimpleContentElement getTreeModel()

getTreeInitialSelection

protected abstract 
SystemSimpleContentElement getTreeInitialSelection()

isValidTargetParent

public boolean isValidTargetParent(
SystemSimpleContentElement selectedElement)
This method is a callback from the select-target-parent dialog, allowing us to decide whether the current selected object is a valid parent object. This affects the enabling of the OK button on that dialog.

The default is to return true if the selected element has no children. This is sufficient for most cases. However, in some cases it is not, such as for filter strings where we want to only enable OK if a filter is selected. It is possible that filter pools have no filters, so the default algorithm is not sufficient. In these cases the child class can override this method.

Specified by:
isValidTargetParent in interface ISystemCopyTargetSelectionCallback

getDialogValue

protected 
Object getDialogValue(
Dialog dlg)
Required by parent. We use it to actually do the work.

Specified by:
getDialogValue in class SystemBaseDialogAction
Parameters:
dlg - The dialog object, after it has returned from open.

getRunnableContext

protected 
IRunnableContext getRunnableContext()
Get an IRunnable context to show progress in. If there is currently a dialog or wizard up with a progress monitor in it, we will use this, else we will create a progress monitor dialog.


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


preCheckForCollision

protected boolean preCheckForCollision()
Do a pre-check for a collision situation. This really is only a problem for filter strings, when a name collision is fatal verus recoverable via a new-name prompt.


preCheckForCollision

protected boolean preCheckForCollision(
Shell shell,
                                       
Object targetContainer,
                                       
Object oldObject,
                                       
String oldName)
Overridable entry point when you want to prevent any copies/moves if any of the selected objects have a name collision.

If you decide to override this, it is your responsibility to issue the error message to the user and return false here.

Returns:
true if there is no problem, false if there is a fatal collision

copyComplete

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

Since:
3.0 taking String argument

run

public void run(
IProgressMonitor monitor)
         throws 
InvocationTargetException,
                
InterruptedException
Method required by IRunnableWithProgress interface. Allows execution of a long-running operation modally by via a thread. In our case, it runs the copy operation with a visible progress monitor

Specified by:
run in interface IRunnableWithProgress
Throws:
InvocationTargetException
InterruptedException

checkForCollision

protected abstract 
String checkForCollision(
Shell shell,
                                            
IProgressMonitor monitor,
                                            
Object targetContainer,
                                            
Object oldObject,
                                            
String oldName)

getCopyingMessage

protected 
SystemMessage getCopyingMessage()
Get the generic "Copying..." or "Moving..." message


getCopyingMessage

protected 
SystemMessage getCopyingMessage(
String oldName)
Get the specific "Copying %1..." or "Moving %1..." message


doCopy

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

Throws:
Exception

getCompletionMessage

public 
SystemMessage getCompletionMessage(
Object targetContainer,
                                          
String[] oldNames,
                                          
String[] newNames)
Return complete message. Override if you want to popup a completion message after a successful copy/move


showOperationMessage

protected void showOperationMessage(
Exception exc,
                                    
Shell shell)
Helper method to show an error message resulting from the attempted operation.


showOperationErrorMessage

protected void showOperationErrorMessage(
Shell shell,
                                         
Throwable exc)
Show an error message when the operation fails. Shows a common message by default. Overridable.


showOperationErrorMessage

protected void showOperationErrorMessage(
Shell shell,
                                         
SystemMessageException exc)
Show an error message when the operation fails. Shows a SystemMessage that was encapsulated in a SystemMessage exception Overridable.


showOperationCancelledMessage

protected void showOperationCancelledMessage(
Shell shell)
Show an error message when the user cancels the operation. Shows a common message by default. Overridable.


RSE
Release 3.0

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

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire