tmf: Convert Delete trace dialog to a JFace dialog
authorMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Wed, 22 Jun 2016 14:53:49 +0000 (10:53 -0400)
committerMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Wed, 22 Jun 2016 19:03:15 +0000 (15:03 -0400)
It's the same functionality as before when it was a native dialog. But
now it allows us to control it in SWTBot.

Change-Id: I44af835a15bb00d2be6b294c837399caa23c83fb
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/75736
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/handlers/DeleteTraceFolderElementHandler.java

index f483e7b8e185f0c88ea05e5681184d0662815b54..e1cd672a8a31b94bb927fc9053b6045e4c5bd275 100644 (file)
@@ -27,6 +27,8 @@ import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.OperationCanceledException;
 import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.ISelectionProvider;
 import org.eclipse.jface.viewers.IStructuredSelection;
@@ -238,10 +240,13 @@ public class DeleteTraceFolderElementHandler extends AbstractHandler {
 
         // Confirm the operation
         Shell shell = window.getShell();
-        MessageBox confirmOperation = new MessageBox(shell, SWT.ICON_QUESTION | SWT.CANCEL | SWT.OK);
-        confirmOperation.setText(getTitle(deleteType));
-        confirmOperation.setMessage(getMessage(deleteType));
-        if (confirmOperation.open() != SWT.OK) {
+        MessageDialog dialog = new MessageDialog(shell, getTitle(deleteType), null, getMessage(deleteType), MessageDialog.QUESTION, 1, new String[] { IDialogConstants.YES_LABEL,
+                IDialogConstants.NO_LABEL }) {
+            {
+                setShellStyle(SWT.SHEET);
+            }
+        };
+        if (dialog.open() != 0) {
             return null;
         }
 
This page took 0.04675 seconds and 5 git commands to generate.