analysis.ui: Fix Export to TSV action in segment store statistics view
authorJean-Christian Kouame <jean-christian.kouame@ericsson.com>
Mon, 20 Feb 2017 20:55:07 +0000 (15:55 -0500)
committerJean-Christian Kouame <jean-christian.kouame@ericsson.com>
Tue, 21 Feb 2017 14:29:54 +0000 (09:29 -0500)
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>
analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/ExportToTsvAction.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/dialog/TmfFileDialogFactory.java

index 21a9c90763b1b2c1fc4af04a19dfcbca4ce725e0..a29f1b6bee137c59015d445dfc6c19da1a3b36b3 100644 (file)
@@ -15,6 +15,7 @@ import java.io.OutputStream;
 
 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;
@@ -56,7 +57,7 @@ public abstract class ExportToTsvAction extends Action {
         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) {
index c13749b111fe9fe0a1b2c1dbebe93c67d7b18617..a77994bc2edbb866f352221586d51e2bfaba3e35 100644 (file)
@@ -112,7 +112,11 @@ public final class TmfFileDialogFactory {
             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;
     }
 
     /**
This page took 0.025831 seconds and 5 git commands to generate.