From dc3c44e927823903cc9e21a00d4ec6c749b59c89 Mon Sep 17 00:00:00 2001 From: David McKnight Date: Tue, 25 Nov 2008 19:02:06 +0000 Subject: [PATCH] [249482] Duplicate Filters can be created if changing the filter pool --- .../SystemNewFilterWizardNamePage.java | 76 ++++++++++++++++++- 1 file changed, 73 insertions(+), 3 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardNamePage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardNamePage.java index f431b35136a..f122a5e3677 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardNamePage.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardNamePage.java @@ -15,6 +15,7 @@ * David Dykstal (IBM) - [160403] filters should be connection private by default * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types * David McKnight (IBM) - [226948] [api][regression] SystemNewFilterWizard.createNamePage() is no longer available + * David McKnight (IBM) - [249482] Duplicate Filters can be created if changing the filter pool *******************************************************************************/ package org.eclipse.rse.ui.filters.dialogs; @@ -310,22 +311,91 @@ public class SystemNewFilterWizardNamePage if (src == poolCombo) { int selection = poolCombo.getSelectionIndex(); - if ((selection >= 0) && (nameValidators!=null)) + + if ((selection >= 0) && (nameValidators!=null)){ nameValidator = nameValidators[selection]; + + ISystemFilterPool currentPool = poolsToSelectFrom[selection]; + if (currentPool == parentPool){ // if this is the connection-unique filter pool, set the uniqueCB + uniqueCB.setSelection(true); + poolCombo.setEnabled(false); + } + } } else if (src == poolWrapperCombo) { int selection = poolWrapperCombo.getSelectionIndex(); - if ((selection >= 0) && (nameValidators!=null)) + + if ((selection >= 0) && (nameValidators!=null)){ nameValidator = nameValidators[selection]; + + ISystemFilterPoolWrapper currentPool = poolWrappers[selection]; + if (currentPool == poolWrapperInformation.getPreSelectWrapper()){ // if this is the connection-unique filter pool, set the uniqueCB + uniqueCB.setSelection(true); + poolWrapperCombo.setEnabled(false); + } + } } else if (src == uniqueCB) { boolean selected = uniqueCB.getSelection(); if (poolVerbiage != null) poolVerbiage.setEnabled(!selected); - if (poolCombo != null) + if (poolCombo != null){ poolCombo.setEnabled(!selected); + + + // if unique to connection then only connection-private filter pool can be used + // if it's not unique to connection, then the connection-private filter pool should not be selected + boolean foundPool = false; + int filterPoolSelectionIndex = 0; + if (poolsToSelectFrom != null){ + + int currentIndex = poolCombo.getSelectionIndex(); + ISystemFilterPool currentPool = poolsToSelectFrom[currentIndex]; + if (currentPool != parentPool && !selected){ + // then the current pool is okay + filterPoolSelectionIndex = currentIndex; + } + else { + for (int idx=0; idx