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

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.dialogs
Class SystemRenameSingleDialog

java.lang.Object
  extended by 

org.eclipse.jface.window.Window
      extended by 

org.eclipse.jface.dialogs.Dialog
          extended by 

org.eclipse.rse.ui.dialogs.SystemPromptDialog
              extended by 
org.eclipse.rse.ui.dialogs.SystemRenameSingleDialog
All Implemented Interfaces:
Runnable, IDialogPage, IRunnableContext, IShellProvider, ISystemPromptDialog, ISystemMessageLine, Listener

public class SystemRenameSingleDialog
extends SystemPromptDialog
implements Runnable

Dialog for renaming a single resource. Used when only one item selected.

This is a re-usable dialog that you can use directly, or via the SystemCommonRenameAction action.

To use this dialog, you must call setInputObject with a StructuredSelection of the objects to be renamed. If those objects adapt to ISystemRemoteElementAdapter or ISystemRemoteElementAdapter, the dialog will offer built-in error checking.

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

This dialog does not do the actual renames. Rather, it will return the user-typed new name. This is queriable via getNewName(), after testing that SystemPromptDialog.wasCancelled() is false.

See Also:
SystemCommonRenameAction

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.jface.window. Window
Window.IExceptionHandler
 
Field Summary
static boolean COLLISION_MODE
           
 
Fields inherited from class org.eclipse.rse.ui.dialogs. SystemPromptDialog
activeRunningOperations, ADD_BUTTON_NO, ADD_BUTTON_YES, ADD_ID, addButton, arrowCursor, BROWSE_BUTTON_NO, BROWSE_BUTTON_YES, BROWSE_ID, browseButton, buttonsComposite, CANCEL_ALL_ID, cancelAllButton, cancelAllPressed, cancelButton, cancelListener, DETAILS_BUTTON_NO, DETAILS_BUTTON_YES, DETAILS_ID, detailsButton, detailsButtonHideMode, detailsHideLabel, detailsShowLabel, dialogAreaComposite, dialogMnemonics, fMessageLine, helpId, horizontalSpacing, initialAddButtonEnabledState, initialDetailsButtonEnabledState, initialOKButtonEnabledState, inputObject, labelAdd, labelBrowse, labelCancel, labelCancelAll, labelDetailsHide, labelDetailsShow, labelOk, labelTest, marginHeight, marginWidth, minHeight, minWidth, needsProgressMonitor, noShowAgainButton, noShowAgainOption, okButton, okPressed, operationCancelableState, outputObject, outputObjectValidator, overallShell, pack, parentComposite, pendingErrorMessage, pendingMessage, prefId, prefStore, prefValAsSelected, progressMonitorPart, showAddButton, showBrowseButton, showCancelAllButton, showDetailsButton, showOkButton, showTestButton, TEST_BUTTON_NO, TEST_BUTTON_YES, TEST_ID, testButton, tipAdd, tipBrowse, tipCancel, tipCancelAll, tipDetailsHide, tipDetailsShow, tipOk, tipTest, title, titleImage, verticalSpacing, waitCursor, windowClosingDialog
 
Fields inherited from class org.eclipse.jface.dialogs. Dialog
blockedHandler, buttonBar, DIALOG_DEFAULT_BOUNDS, DIALOG_PERSISTLOCATION, DIALOG_PERSISTSIZE, dialogArea, DLG_IMG_ERROR, DLG_IMG_HELP, DLG_IMG_INFO, DLG_IMG_MESSAGE_ERROR, DLG_IMG_MESSAGE_INFO, DLG_IMG_MESSAGE_WARNING, DLG_IMG_QUESTION, DLG_IMG_WARNING, ELLIPSIS
 
Fields inherited from class org.eclipse.jface.window. Window
CANCEL, OK
 
Constructor Summary
SystemRenameSingleDialog ( Shell shell)
          Constructor
SystemRenameSingleDialog ( Shell shell, boolean copyCollisionMode, Object inputObject, ISystemValidator nameValidator)
          Constructor with an input object and validator This constructor is in copy/move dialogs when there is a collision
SystemRenameSingleDialog ( Shell shell, boolean copyCollisionMode, Object inputObject, ISystemValidator nameValidator, List nameInUse)
          Constructor with an input object and validator This constructor is in copy/move dialogs when there is a collision
SystemRenameSingleDialog ( Shell shell, String title)
          Constructor with a title
 
Method Summary
protected  boolean checkIfWillBeFilteredOut ( Object remoteObject, String newName)
          If renaming a remote object, which is listed in a tree view under an expanded filter, this tests to see if the rename will cause that object to suddenly not meet the filtering criteria of the parent filter, and hence disappear.
protected   Control createInner ( Composite parent)
          Called by createContents method.
protected   ISystemMessageLine createMessageLine ( Composite c)
          Create message line.
 boolean getCopyCollisionMode ()
          Query if this dialog is the result of a copy/move name collision.
  String getDescription ()
           
protected   Control getInitialFocusControl ()
          Return the Control to be given initial focus.
protected   Object getInputElement ( Object inputObject)
          Returns the selected element given the current input, which is an IStructuredSelection.
  String getNewName ()
          Returns the user-entered new name
  String[] getNewNameArray ()
          Returns the user-entered new name as an array for convenience to ISystemRenameTarget hosts.
protected   ISystemRemoteElementAdapter getRemoteAdapter ( Object o)
          Returns the implementation of ISystemRemoteElement for the given object.
protected   ValidatorUniqueString getUniqueNameValidator ( Object inputElement, ISystemValidator nameValidator)
          Given an input element and externally-suppplied name validator for it, determine if we need to augment that validator with one that will check for uniqueness, and if so create and return that uniqueness validator
protected   ISystemViewElementAdapter getViewAdapter ( Object o)
          Returns the implementation of ISystemViewElement for the given object.
 void handleEvent ( Event e)
          Handles events generated by controls on this page.
 boolean isPageComplete ()
          This method can be called by the dialog or wizard page host, to decide whether to enable or disable the next, final or ok buttons.
protected  boolean processOK ()
          Called when user presses OK button.
 void run ()
          Runnable method
 void setCopyCollisionMode (boolean copyCollisionMode)
          Indicate this dialog is the result of a copy/move name collision.
 void setDescription ( String description)
           
 void setInputObject ( Object inputObject)
          Override of parent.
 void setNameValidator ( ISystemValidator nameValidator)
          Set the validator for the new name,as supplied by the adaptor for name checking.
 void setPageComplete ()
          Inform caller of page-complete status of this form
 void setPromptLabel ( String label, String tooltip)
          Set the label and tooltip of the prompt.
static  String trimTrailing ( String text)
          Trim leading blanks
protected   SystemMessage validateNameInput ()
          Called directly as user types.
protected   SystemMessage validateNameInput ( String theNewName)
          Called directly from verify.
 boolean verify ()
          Verifies all input.
 
Methods inherited from class org.eclipse.rse.ui.dialogs. SystemPromptDialog
aboutToStart, addFillerLine, addGrowableFillerLine, addSeparatorLine, adjustButtonWidth, applyMnemonics, buttonPressed, clearErrorMessage, clearMessage, close, configureShell, createButtonBar, createButtonsForButtonBar, createContents, createControl, createDialogArea, createNoShowAgainButton, createWizardClosingDialog, dispose, enableAddButton, enableBrowseButton, enableCancelAllButton, enableCancelButton, enableDetailsButton, enableOkButton, enableTestButton, getAddButton, getBrowseButton, getCancelAllButton, getCancelOrCloseButton, getControl, getDetailsButton, getDialogMnemonics, getErrorMessage, getHelpContextId, getImage, getInputObject, getMessage, getMessageLine, getOkButton, getOutputObject, getOutputObjectValidator, getProgressMonitor, getSystemErrorMessage, getTestButton, getTitle, hardClose, okToClose, performHelp, processAdd, processBrowse, processCancel, processCancelAll, processDetails, processTest, publicConvertHeightInCharsToPixels, publicConvertWidthInCharsToPixels, restoreEnableState, restoreUIState, run, saveEnableStateAndSet, saveUIState, setAddButtonLabel, setAddButtonToolTipText, setBrowseButtonLabel, setBrowseButtonToolTipText, setBusyCursor, setCancelAllButtonLabel, setCancelAllButtonToolTipText, setCancelButtonLabel, setCancelButtonToolTipText, setControl, setDetailsButtonLabel, setDetailsButtonToolTipText, setDisplayCursor, setDisplayCursor, setErrorMessage, setErrorMessage, setErrorMessage, setHelp, setHelp, setImageDescriptor, setInitialOKButtonEnabledState, setMessage, setMessage, setMinimumSize, setNeedsProgressMonitor, setNoShowAgainOption, setOkButtonLabel, setOkButtonToolTipText, setOutputObject, setOutputObjectValidator, setPageComplete, setShowAddButton, setShowBrowseButton, setShowCancelAllButton, setShowDetailsButton, setShowOkButton, setShowTestButton, setTestButtonLabel, setTestButtonToolTipText, setTitle, setVisible, wasCancelled, wasCancelledAll
 
Methods inherited from class org.eclipse.jface.dialogs. Dialog
applyDialogFont, cancelPressed, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, create, createButton, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getDialogBoundsSettings, getDialogBoundsStrategy, getImage, getInitialLocation, getInitialSize, getOKButton, initializeBounds, initializeDialogUnits, isResizable, okPressed, setBlockedHandler, setButtonLayoutData, setButtonLayoutFormData, shortenText
 
Methods inherited from class org.eclipse.jface.window. Window
canHandleShellCloseEvent, constrainShellSize, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, getLayout, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, handleShellCloseEvent, open, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setParentShell, setReturnCode, setShellStyle, setWindowManager
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COLLISION_MODE

public static final boolean COLLISION_MODE
See Also:
Constant Field Values
Constructor Detail

SystemRenameSingleDialog

public SystemRenameSingleDialog(
Shell shell)
Constructor


SystemRenameSingleDialog

public SystemRenameSingleDialog(
Shell shell,
                                
String title)
Constructor with a title


SystemRenameSingleDialog

public SystemRenameSingleDialog(
Shell shell,
                                boolean copyCollisionMode,
                                
Object inputObject,
                                
ISystemValidator nameValidator)
Constructor with an input object and validator This constructor is in copy/move dialogs when there is a collision

Parameters:
shell - The parent dialog
copyCollisionMode - true if this is being called because of a name collision on a copy or move operation
inputObject - The object that is being renamed, or on a copy/move the object in the target container which already exists. Used to get the old name and the name validator
nameValidator - The name validator to use. Can be null, in which case it is queried from the adapter of the input object

SystemRenameSingleDialog

public SystemRenameSingleDialog(
Shell shell,
                                boolean copyCollisionMode,
                                
Object inputObject,
                                
ISystemValidator nameValidator,
                                
List nameInUse)
Constructor with an input object and validator This constructor is in copy/move dialogs when there is a collision

Parameters:
shell - The parent dialog
copyCollisionMode - true if this is being called because of a name collision on a copy or move operation
inputObject - The object that is being renamed, or on a copy/move the object in the target container which already exists. Used to get the old name and the name validator
nameValidator - The name validator to use. Can be null, in which case it is queried from the adapter of the input object
nameInUse - the List of names that have been previously selected for other files that are to be renamed for multiple file renaming.
Since:
3.0 added nameInUse argument
Method Detail

setPromptLabel

public void setPromptLabel(
String label,
                           
String tooltip)
Set the label and tooltip of the prompt. The default is "New name:"


setCopyCollisionMode

public void setCopyCollisionMode(boolean copyCollisionMode)
Indicate this dialog is the result of a copy/move name collision. Affects the title, verbiage 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, verbiage at the top of the dialog, and context help.


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.


createMessageLine

protected 
ISystemMessageLine createMessageLine(
Composite c)
Create message line. Intercept so we can set msg line of form.

Overrides:
createMessageLine in class SystemPromptDialog

getInitialFocusControl

protected 
Control getInitialFocusControl()
Description copied from class: SystemPromptDialog
Return the Control to be given initial focus. Child classes must override this, but can return null.

Specified by:
getInitialFocusControl in class SystemPromptDialog
See Also:
SystemPromptDialog.getInitialFocusControl()

createInner

protected 
Control createInner(
Composite parent)
Description copied from class: SystemPromptDialog
Called by createContents method. Create this dialog's widgets inside a composite. Child classes must override this.

Specified by:
createInner in class SystemPromptDialog
See Also:
SystemPromptDialog.createInner(Composite)

setInputObject

public void setInputObject(
Object inputObject)
Override of parent. Must pass selected object onto the form for initializing fields. Called by SystemDialogAction's default run() method after dialog instantiated.

Specified by:
setInputObject in interface ISystemPromptDialog
Overrides:
setInputObject in class SystemPromptDialog

run

public void run()
Runnable method

Specified by:
run in interface Runnable
Overrides:
run in class SystemPromptDialog

getUniqueNameValidator

protected 
ValidatorUniqueString getUniqueNameValidator(
Object inputElement,
                                                       
ISystemValidator nameValidator)
Given an input element and externally-suppplied name validator for it, determine if we need to augment that validator with one that will check for uniqueness, and if so create and return that uniqueness validator


getInputElement

protected 
Object getInputElement(
Object inputObject)
Returns the selected element given the current input, which is an IStructuredSelection.


getViewAdapter

protected 
ISystemViewElementAdapter getViewAdapter(
Object o)
Returns the implementation of ISystemViewElement for the given object. Returns null if the adapter is not defined or the object is not adaptable.


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.


processOK

protected boolean processOK()
Called when user presses OK button. Return true to close dialog. Return false to not close dialog.

Overrides:
processOK in class SystemPromptDialog

trimTrailing

public static 
String trimTrailing(
String text)
Trim leading blanks


verify

public boolean verify()
Verifies all input.

Returns:
true if there are no errors in the user input

checkIfWillBeFilteredOut

protected boolean checkIfWillBeFilteredOut(
Object remoteObject,
                                           
String newName)
If renaming a remote object, which is listed in a tree view under an expanded filter, this tests to see if the rename will cause that object to suddenly not meet the filtering criteria of the parent filter, and hence disappear. If so, issue warning message before proceeding.

Returns:
true if will be filtered out and user chose to cancel operation

validateNameInput

protected 
SystemMessage validateNameInput()
Called directly as user types.


validateNameInput

protected 
SystemMessage validateNameInput(
String theNewName)
Called directly from verify.


isPageComplete

public boolean isPageComplete()
This method can be called by the dialog or wizard page host, to decide whether to enable or disable the next, final or ok buttons. It returns true if the minimal information is available and is correct.


setPageComplete

public void setPageComplete()
Inform caller of page-complete status of this form


getNewName

public 
String getNewName()
Returns the user-entered new name


getNewNameArray

public 
String[] getNewNameArray()
Returns the user-entered new name as an array for convenience to ISystemRenameTarget hosts.


setDescription

public void setDescription(
String description)
Specified by:
setDescription in interface IDialogPage
Overrides:
setDescription in class SystemPromptDialog

getDescription

public 
String getDescription()
Specified by:
getDescription in interface IDialogPage
Overrides:
getDescription in class SystemPromptDialog

handleEvent

public void handleEvent(
Event e)
Description copied from class: SystemPromptDialog
Handles events generated by controls on this page. Should be overridden by child. Only public because of interface requirement!

Specified by:
handleEvent in interface Listener
Overrides:
handleEvent in class SystemPromptDialog

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