This adds the style SWT.SAVE to the dialog and asks the user to override
an existing file before the save. Test will be added in a subsequent
patch.
Change-Id: I4b97197c94e46cfb7f6894902012f1ef242c0ceb
Signed-off-by: Jean-Christian Kouame <jean-christian.kouame@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/91508
Reviewed-by: Hudson CI
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jface.action.Action;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.tracecompass.internal.analysis.timing.ui.Activator;
if (shell == null) {
return;
}
- FileDialog fd = TmfFileDialogFactory.create(shell);
+ FileDialog fd = TmfFileDialogFactory.create(shell, SWT.SAVE);
fd.setFilterExtensions(getExtension());
String fileName = fd.open();
if (fileName == null) {
fOverridePaths = null;
return createNewFileDialog(parent, style, Arrays.asList(overridePath));
}
- return new FileDialog(parent, style);
+ FileDialog fileDialog = new FileDialog(parent, style);
+ if ((style & SWT.SAVE) != 0) {
+ fileDialog.setOverwrite(true);
+ }
+ return fileDialog;
}
/**