tmf: Enable the finish button when default target project is selected
authorMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Mon, 16 Dec 2013 22:03:07 +0000 (17:03 -0500)
committerMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Mon, 16 Dec 2013 22:43:06 +0000 (17:43 -0500)
The previous fix for the batch import "target project" page introduces
a default selection but the user still has to click on the list again
to enable the finish button.

Change-Id: I492cc1ff115d6208aa577a721f04d96ebd2a4e2c
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/19881
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/importtrace/ImportTraceWizardPageOptions.java

index 0281f28b83edab4a9354f77cd1a1e6bd7fcf05f8..f1b6c9848c851f1bb62dd2984482d176f1e9b852 100644 (file)
@@ -77,28 +77,14 @@ public class ImportTraceWizardPageOptions extends AbstractImportTraceWizardPage
         fProjects.getSelection();
         fProjects.addSelectionListener(new SelectionListener() {
 
-            private static final String TRACE = "Traces"; //$NON-NLS-1$
-
             @Override
             public void widgetSelected(SelectionEvent e) {
-                handleSelected();
+                updateWithSelection();
             }
 
             @Override
             public void widgetDefaultSelected(SelectionEvent e) {
-                handleSelected();
-            }
-
-            private void handleSelected() {
-                String[] selection = fProjects.getSelection();
-                if (selection.length > 0) {
-                    final String listItem = selection[0];
-                    IFolder folder = fProjectsMap.get(listItem).getFolder(TRACE);
-                    getBatchWizard().setTraceFolder(folder);
-                    ImportTraceWizardPageOptions.this.setErrorMessage(null);
-                } else {
-                    ImportTraceWizardPageOptions.this.setErrorMessage(Messages.SharedSelectProject);
-                }
+                updateWithSelection();
             }
         });
         if (proj != null) {
@@ -106,7 +92,21 @@ public class ImportTraceWizardPageOptions extends AbstractImportTraceWizardPage
         } else if (fProjects.getItemCount() > 0) {
             fProjects.setSelection(0);
         }
+        updateWithSelection();
         setMessage(Messages.SharedSelectProject);
         this.setTitle(Messages.ImportTraceWizardPageOptionsTitle);
     }
+
+    private void updateWithSelection() {
+        final String TRACE = "Traces"; //$NON-NLS-1$
+        String[] selection = fProjects.getSelection();
+        if (selection.length > 0) {
+            final String listItem = selection[0];
+            IFolder folder = fProjectsMap.get(listItem).getFolder(TRACE);
+            getBatchWizard().setTraceFolder(folder);
+            ImportTraceWizardPageOptions.this.setErrorMessage(null);
+        } else {
+            ImportTraceWizardPageOptions.this.setErrorMessage(Messages.SharedSelectProject);
+        }
+    }
 }
This page took 0.025784 seconds and 5 git commands to generate.