From 7402ada10401657001de34a17b10d65ce65e5196 Mon Sep 17 00:00:00 2001 From: Uwe Stieber Date: Mon, 5 Mar 2007 15:36:21 +0000 Subject: [PATCH] [fix] New connection wizard selection page filtering now allows use of org.eclipse.jface.viewer.ViewerFilter --- .../RSENewConnectionWizardSelectionPage.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSENewConnectionWizardSelectionPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSENewConnectionWizardSelectionPage.java index 7b3105fe113..5de966347bc 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSENewConnectionWizardSelectionPage.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSENewConnectionWizardSelectionPage.java @@ -56,6 +56,13 @@ import org.eclipse.ui.dialogs.PatternFilter; /** * The New Connection Wizard main page that allows selection of system type. + *

+ * Note: The page allows filtering of the presented wizard list by adapting + * the associated system type to
+ *

*/ public class RSENewConnectionWizardSelectionPage extends WizardPage { private final String helpId = RSEUIPlugin.HELPPREFIX + "wncc0000"; //$NON-NLS-1$; @@ -72,7 +79,7 @@ public class RSENewConnectionWizardSelectionPage extends WizardPage { /** * Internal class. The wizard state filter is responsible to filter - * out any not enabled wizard from the tree. + * out any not enabled or filtered wizard from the tree. */ private class NewConnectionWizardStateFilter extends ViewerFilter { @@ -96,12 +103,21 @@ public class RSENewConnectionWizardSelectionPage extends WizardPage { if (!Arrays.asList(restricted).contains(systemType)) return false; } + // first check if the system type is enabled at all. RSESystemTypeAdapter adapter = (RSESystemTypeAdapter)(systemType.getAdapter(IRSESystemType.class)); - if (adapter != null) { - return adapter.isEnabled(systemType); + if (adapter != null && !adapter.isEnabled(systemType)) { + return false; + } + + // second, adapt the system type to a viewer filter and pass on the select request + // to the viewer filter adapter if available + ViewerFilter filter = (ViewerFilter)(systemType.getAdapter(ViewerFilter.class)); + if (filter != null && !filter.select(viewer, parentElement, element)) { + return false; } } + // In all other cases, the element passes the filter return true; } }