optionPane.setLayout(new GridLayout());
optionPane.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, true));
- fProjects = new List(optionPane, SWT.NONE);
+ fProjects = new List(optionPane, SWT.V_SCROLL);
fProjects.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
for (IProject project : TraceUtils.getOpenedTmfProjects()) {
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);
- }
+ updateWithSelection();
}
});
if (proj != null) {
fProjects.setSelection(fProjects.indexOf(proj.getName()));
- this.setErrorMessage(null);
- } else {
- this.setErrorMessage(Messages.SharedSelectProject);
+ } 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);
+ }
+ }
}