use of org.eclipse.jface.dialogs.IInputValidator in project tdi-studio-se by Talend.
the class RenameAction method getNewName.
/**
* Gets the new file name.
*
* @return The new file name
*/
private String getNewName() {
IFileStore fileStore = snapshot.getFileStore();
List<String> oldNames = new ArrayList<String>();
try {
for (String oldName : fileStore.getParent().childNames(EFS.NONE, null)) {
oldNames.add(removeSuffix(oldName));
}
} catch (CoreException e) {
Activator.log(IStatus.ERROR, NLS.bind(Messages.accessFileFailedMsg, fileStore.getName()), e);
return null;
}
String oldName = fileStore.getName();
IInputValidator validator = new InputValidator(oldNames, oldName);
InputDialog dialog = new InputDialog(treeViewer.getControl().getShell(), Messages.renameTitle, Messages.newNameLabel, removeSuffix(oldName), validator);
if (dialog.open() == Window.OK) {
return oldName.replace(removeSuffix(oldName), dialog.getValue());
}
return null;
}
Aggregations