tmf.ui: Fix the destination group in the import wizard
authorSimon Delisle <simon.delisle@ericsson.com>
Wed, 3 May 2017 13:35:02 +0000 (09:35 -0400)
committerBernd Hufmann <bernd.hufmann@ericsson.com>
Tue, 9 May 2017 17:37:37 +0000 (13:37 -0400)
The destination group was handle by the parent class and add a browse
button and the possibility to write the destination path. The text field
and the browse button does nothing in the current version of Trace
Compass and it is a bit confusing since these part are not deactivate. I
removed the browse button and set the text field to read-only.

Change-Id: I11f0fe66609792785c44e9af19868ca1f5cccb82
Signed-off-by: Simon Delisle <simon.delisle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/96306
Reviewed-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Reviewed-by: Jean-Christian Kouame <jean-christian.kouame@ericsson.com>
Tested-by: Jean-Christian Kouame <jean-christian.kouame@ericsson.com>
ctf/org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/ctf/ui/swtbot/tests/SWTBotImportWizardUtils.java
doc/org.eclipse.tracecompass.doc.user/doc/images/ProjectImportTraceDialog.png
tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/ui/swtbot/tests/wizards/StandardImportGzipTraceTest.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/project/wizards/importtrace/ImportTraceWizardPage.java

index 4ce2e3dd096c2d5a59fcf5bfd8a38bbbb9f13735..3d0262902ba99f8cc9b1d9ef40b5dbae9efeef52 100644 (file)
@@ -22,7 +22,6 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTableItem;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
 import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.importtrace.ImportTraceWizardPage;
@@ -54,8 +53,8 @@ public final class SWTBotImportWizardUtils {
         sourceCombo.setText(traceFolderParent.getAbsolutePath());
 
         /* the resource tree gets updated when the combo loses focus */
-        SWTBotText text = bot.text();
-        text.setFocus();
+        SWTBotTree tree = bot.tree();
+        tree.setFocus();
     }
 
     /**
@@ -76,8 +75,8 @@ public final class SWTBotImportWizardUtils {
         sourceCombo.setText(new File(archivePath).getAbsolutePath());
 
         /* the resource tree gets updated when the combo loses focus */
-        SWTBotText text = bot.text();
-        text.setFocus();
+        SWTBotTree tree = bot.tree();
+        tree.setFocus();
     }
 
     /**
index b1f7481b3a09f7345b5118be42a92fbb9b9046e4..eb695f4ed02ca7a58a5d9188c34e42cb837c2f9d 100644 (file)
Binary files a/doc/org.eclipse.tracecompass.doc.user/doc/images/ProjectImportTraceDialog.png and b/doc/org.eclipse.tracecompass.doc.user/doc/images/ProjectImportTraceDialog.png differ
index 914f8b33fc01d4322cef0f346d79ec94f2dac1c8..83b1636f80cf6979cb6578ac4c6da7c32ef0db2d 100644 (file)
@@ -43,7 +43,6 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
 import org.eclipse.tracecompass.internal.tmf.ui.project.wizards.importtrace.ImportTraceWizard;
@@ -211,8 +210,8 @@ public class StandardImportGzipTraceTest {
 
         sourceCombo.setText(new File(archivePath).getAbsolutePath());
 
-        SWTBotText text = fBot.text();
-        text.setFocus();
+        SWTBotTree tree = fBot.tree();
+        tree.setFocus();
     }
 
     private void openImportWizard() {
index 677f9f96b8fda3059e32d5c6f85c498bd1356625..6c2a99dece1a4da1e0052b7fdf8047ab16b80731 100644 (file)
@@ -67,7 +67,6 @@ import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.FileDialog;
 import org.eclipse.swt.widgets.Group;
 import org.eclipse.swt.widgets.Label;
@@ -91,6 +90,7 @@ import org.eclipse.ui.dialogs.WizardResourceImportPage;
 import org.eclipse.ui.ide.dialogs.IElementFilter;
 import org.eclipse.ui.ide.dialogs.ResourceTreeAndListGroup;
 import org.eclipse.ui.internal.ide.DialogUtil;
+import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
 import org.eclipse.ui.model.WorkbenchContentProvider;
 import org.eclipse.ui.model.WorkbenchLabelProvider;
 import org.eclipse.ui.model.WorkbenchViewerComparator;
@@ -160,16 +160,11 @@ public class ImportTraceWizardPage extends WizardResourceImportPage {
     // Attributes
     // ------------------------------------------------------------------------
 
-    // Target import directory ('Traces' folder)
-    private IFolder fTargetFolder;
     // Target Trace folder element
     private TmfTraceFolder fTraceFolderElement;
     // The workspace experiment folder
     private TmfExperimentFolder fExperimentFolderElement;
     private  String fPreviousSource;
-    // Flag to handle destination folder change event
-    private Boolean fIsDestinationChanged = false;
-    private final Object fSyncObject = new Object();
     // Combo box containing trace types
     private Combo fTraceTypes;
     // Button to ignore unrecognized traces or not
@@ -256,7 +251,6 @@ public class ImportTraceWizardPage extends WizardResourceImportPage {
 
         // Set the target trace folder
         if (traceFolder != null) {
-            fTargetFolder = traceFolder;
             String path = traceFolder.getFullPath().toString();
             setContainerFieldValue(path);
         }
@@ -316,6 +310,23 @@ public class ImportTraceWizardPage extends WizardResourceImportPage {
         validateSourceGroup();
     }
 
+    @Override
+    protected void createDestinationGroup(Composite parent) {
+        Composite containerComposite = new Composite(parent, SWT.NONE);
+        containerComposite.setLayout(new GridLayout(2, false));
+        containerComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
+
+        Label destinationLabel = new Label(containerComposite, SWT.NONE);
+        destinationLabel.setText(IDEWorkbenchMessages.WizardImportPage_folder);
+
+        Text containerText = new Text(containerComposite, SWT.SINGLE);
+        containerText.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
+        containerText.setEnabled(false);
+
+        // Initialize the field with the container path
+        containerText.setText(getContainerFullPath().toString());
+    }
+
     @Override
     protected ITreeContentProvider getFileProvider() {
         return new WorkbenchContentProvider() {
@@ -567,38 +578,6 @@ public class ImportTraceWizardPage extends WizardResourceImportPage {
     // Browse for the source directory
     // ------------------------------------------------------------------------
 
-    @Override
-    public void handleEvent(Event event) {
-        if (event.widget == directoryBrowseButton) {
-            handleSourceDirectoryBrowseButtonPressed();
-        }
-
-        // Avoid overwriting destination path without repeatedly trigger
-        // call of handleEvent();
-        synchronized (fSyncObject) {
-            if (!fIsDestinationChanged) {
-                event.display.asyncExec(new Runnable() {
-                    @Override
-                    public void run() {
-                        synchronized (fSyncObject) {
-                            fIsDestinationChanged = true;
-                            String path = fTargetFolder.getFullPath().toString();
-                            setContainerFieldValue(path);
-                        }
-                    }
-                });
-            } else {
-                fIsDestinationChanged = false;
-            }
-        }
-        super.handleEvent(event);
-    }
-
-    @Override
-    protected void handleContainerBrowseButtonPressed() {
-        // Do nothing so that destination directory cannot be changed.
-    }
-
     /**
      * Handle the button pressed event
      */
This page took 0.029098 seconds and 5 git commands to generate.