/**
* Implementation of a dialog box to rename an experiment.
* <p>
+ *
* @version 1.0
* @author Francois Chouinard
*/
// Members
// ------------------------------------------------------------------------
- private final TmfExperimentElement fExperiment;
- private Text fNewExperimentName;
+ private final TmfExperimentElement fExperiment;
+ private Text fNewExperimentName;
private final IContainer fExperimentFolder;
private final TmfProjectElement fProject;
/**
* Constructor
- * @param shell The parent shell
- * @param experiment The experiment element rename
+ *
+ * @param shell
+ * The parent shell
+ * @param experiment
+ * The experiment element rename
*/
public RenameExperimentDialog(Shell shell, TmfExperimentElement experiment) {
super(shell);
// ------------------------------------------------------------------------
// Dialog
// ------------------------------------------------------------------------
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
+
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
fNewExperimentName.addListener(SWT.Modify, new Listener() {
@Override
public void handleEvent(Event event) {
- validateNewExperimentName();
+ validateNewExperimentName();
}
});
}
private void validateNewExperimentName() {
- String name = fNewExperimentName.getText();
+ String name = fNewExperimentName.getText();
IWorkspace workspace = fExperimentFolder.getWorkspace();
IStatus nameStatus = workspace.validateName(name, IResource.FOLDER);
if ("".equals(name)) { //$NON-NLS-1$
- updateStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.Dialog_EmptyNameError, null));
- return;
+ updateStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.Dialog_EmptyNameError, null));
+ return;
}
if (!nameStatus.isOK()) {
- updateStatus(nameStatus);
- return;
+ updateStatus(nameStatus);
+ return;
}
IPath path = new Path(name);
// ------------------------------------------------------------------------
// SelectionStatusDialog
// ------------------------------------------------------------------------
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.dialogs.SelectionStatusDialog#computeResult()
- */
+
@Override
protected void computeResult() {
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.dialogs.SelectionStatusDialog#create()
- */
@Override
public void create() {
super.create();
getButton(IDialogConstants.OK_ID).setEnabled(false);
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.dialogs.SelectionStatusDialog#okPressed()
- */
@Override
protected void okPressed() {
IFolder folder = renameExperiment(fNewExperimentName.getText());
private IFolder renameExperiment(final String newName) {
- IPath oldPath = fExperiment.getResource().getFullPath();
- final IPath newPath = oldPath.append("../" + newName); //$NON-NLS-1$
+ IPath oldPath = fExperiment.getResource().getFullPath();
+ final IPath newPath = oldPath.append("../" + newName); //$NON-NLS-1$
- WorkspaceModifyOperation operation = new WorkspaceModifyOperation() {
+ WorkspaceModifyOperation operation = new WorkspaceModifyOperation() {
@Override
public void execute(IProgressMonitor monitor) throws CoreException {
try {
}
fExperiment.renameSupplementaryFolder(newName);
- fExperiment.getResource().move(newPath, IResource.FORCE | IResource.SHALLOW, null);
+ fExperiment.getResource().move(newPath, IResource.FORCE | IResource.SHALLOW, null);
if (monitor.isCanceled()) {
throw new OperationCanceledException();
}