RSE
Release 1.0

org.eclipse.rse.ui.actions
Class SystemCommonRenameAction

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.SystemCommonRenameAction
All Implemented Interfaces:
IAction, ISelectionChangedListener, ISystemAction, ISystemDialogAction

public class SystemCommonRenameAction
extends SystemBaseDialogAction

The action that displays the Rename dialog. There are two ways to use this action:

  1. When invoking from a class that implements ISystemRenameTarget. In this case, that class will be called back to determine if this action is to be enabled or not, and to do the actual rename for each selected object, after the dialog is dismissed.
  2. When used without an ISystemRenameTarget, in which case you need to call getNewNames() after running the action, and then use the new names to do the rename. This will return null if the dialog was cancelled.

If the input objects do not adapt to ISystemRemoteElementAdapter or ISystemViewElementAdapter, then you should call setNameValidator(org.eclipse.rse.ui.validators.ISystemValidator) to specify a validator that is called to verify the typed new name is valid. Further, to show the type value of the input objects, they should implement ISystemTypedObject.

See Also:
SystemRenameDialog, SystemRenameSingleDialog

Field Summary
 
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
SystemCommonRenameAction(Shell parent)
          Constructor when not using a rename target
SystemCommonRenameAction(Shell parent, ISystemRenameTarget target)
          Constructor when using a rename target
 
Method Summary
protected  Dialog createDialog(Shell parent)
          If you decide to use the supplied run method as is, then you must override this method to create and return the dialog that is displayed by the default run method implementation.
 boolean getCopyCollisionMode()
          Query if this dialog is the result of a copy/move name collision.
protected  Object getDialogValue(Dialog dlg)
          Required by parent.
 String[] getNewNames()
          Return the new names entered by the user.
 void setCopyCollisionMode(boolean copyCollisionMode)
          Indicate this dialog is the result of a copy/move name collision.
 void setDialogMultiSelectionHelp(String helpID)
          Set the help to use in the dialog when there are multiple selections
 void setDialogSingleSelectionHelp(String helpID)
          Set the help to use in the dialog when there is a single selection
 void setMultiSelectVerbage(String verbage)
          Set the verbage to show at the top of the table, used when multi things are selected.
 void setNameValidator(ISystemValidator nameValidator)
          Set the validator for the new name,as supplied by the adaptor for name checking.
 void setSingleSelectPromptLabel(String label, String tooltip)
          Set the label and tooltip of the prompt, used when only one thing is selected.
 boolean updateSelection(IStructuredSelection selection)
          Called by SystemBaseAction when selection is set.
 
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
 

Constructor Detail

SystemCommonRenameAction

public SystemCommonRenameAction(Shell parent,
                                ISystemRenameTarget target)
Constructor when using a rename target

Parameters:
parent - The Shell of the parent UI for this dialog
target - The UI part that has selectable and renamable parts.

SystemCommonRenameAction

public SystemCommonRenameAction(Shell parent)
Constructor when not using a rename target

Parameters:
parent - The Shell of the parent UI for this dialog
Method Detail

setDialogSingleSelectionHelp

public void setDialogSingleSelectionHelp(String helpID)
Set the help to use in the dialog when there is a single selection


setDialogMultiSelectionHelp

public void setDialogMultiSelectionHelp(String helpID)
Set the help to use in the dialog when there are multiple selections


setSingleSelectPromptLabel

public void setSingleSelectPromptLabel(String label,
                                       String tooltip)
Set the label and tooltip of the prompt, used when only one thing is selected. The default is "New name:"


setMultiSelectVerbage

public void setMultiSelectVerbage(String verbage)
Set the verbage to show at the top of the table, used when multi things are selected. The default is "Enter a new name for each resource"


setNameValidator

public void setNameValidator(ISystemValidator nameValidator)
Set the validator for the new name,as supplied by the adaptor for name checking. Overrides the default which is to query it from the object's adapter.


setCopyCollisionMode

public void setCopyCollisionMode(boolean copyCollisionMode)
Indicate this dialog is the result of a copy/move name collision. Affects the title, verbage at the top of the dialog, and context help.


getCopyCollisionMode

public boolean getCopyCollisionMode()
Query if this dialog is the result of a copy/move name collision. Affects the title, verbage at the top of the dialog, and context help.


updateSelection

public boolean updateSelection(IStructuredSelection selection)
Called by SystemBaseAction when selection is set. Our opportunity to verify we are allowed for this selected type. We overload it to call canRename() in the SystemView class.

Overrides:
updateSelection in class SystemBaseAction

createDialog

protected Dialog createDialog(Shell parent)
If you decide to use the supplied run method as is, then you must override this method to create and return the dialog that is displayed by the default run method implementation.

If you override run with your own, then simply implement this to return null as it won't be used.

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

getDialogValue

protected Object getDialogValue(Dialog dlg)
Required by parent. We use it to actually do the rename by calling doRename in the supplied ISystemRenameTarget, if we are in that mode. As a result, we return null from here.

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

getNewNames

public String[] getNewNames()
Return the new names entered by the user. You only need to call this when you don't supply a rename target. In this case, it is your responsibility to do the actual renames.

Returns:
- array of new names, with the order matching the order of the input selection. Null if dialog cancelled.

RSE
Release 1.0

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