From 33a35a5cd2c4f735ad4d4dca892ec7b22ec97f0c Mon Sep 17 00:00:00 2001 From: Uwe Stieber Date: Sat, 11 Oct 2008 16:10:11 +0000 Subject: [PATCH] [fix] bug 248685: new connection wizard does not check the default selection against the restricted system type list --- .../RSEMainNewConnectionWizard.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEMainNewConnectionWizard.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEMainNewConnectionWizard.java index 757a15debb8..5e5ce82571b 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEMainNewConnectionWizard.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEMainNewConnectionWizard.java @@ -230,11 +230,22 @@ public class RSEMainNewConnectionWizard extends Wizard implements INewWizard, IS public void setSelection(ISelection selection) { if (selection instanceof IStructuredSelection) { IStructuredSelection sel = (IStructuredSelection)selection; + // Reset previous selected system type + selectedSystemType = null; + // Only if the first element of the selection is of type IRSESystemType, + // we re-new the selected system type from the selection if (sel.getFirstElement() instanceof IRSESystemType) { - // update the selected system type. - selectedSystemType = (IRSESystemType)((IStructuredSelection)selection).getFirstElement(); - } else { - selectedSystemType = null; + // Get the system type candidate from the selection. + IRSESystemType candidate = (IRSESystemType)((IStructuredSelection)selection).getFirstElement(); + // Accept only system types as selection which are enabled or if + // the wizard has a restricted list of system types, is within the list + // of restricted system types + if (candidate.isEnabled() && + (restrictedSystemTypes == null || + restrictedSystemTypes.length == 0 || + Arrays.asList(restrictedSystemTypes).contains(candidate))) { + selectedSystemType = candidate; + } } // signal the system type change