From d0aa83ebefb58acabdc7507ee5b823cc95051e3b Mon Sep 17 00:00:00 2001 From: David Dykstal Date: Fri, 14 Mar 2008 21:09:03 +0000 Subject: [PATCH] [222270][api][breaking] Clean up interfaces in org.eclipse.rse.core.filters https://bugs.eclipse.org/bugs/show_bug.cgi?id=222270 --- .../filters/ISystemFilterPoolManager.java | 48 +++++++- .../core/filters/SystemFilterPoolManager.java | 104 ++++++++++-------- 2 files changed, 103 insertions(+), 49 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolManager.java index 64ef5b33629..c061711a19e 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolManager.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolManager.java @@ -14,10 +14,13 @@ * Contributors: * David Dykstal (IBM) - [197036] All filter pools created on clean workspace * cleaned javadoc for renameSystemFilterPool + * David Dykstal (IBM) - [222270] clean up interfaces in org.eclipse.rse.core.filters *******************************************************************************/ package org.eclipse.rse.core.filters; +import java.util.List; + import org.eclipse.rse.core.model.IRSEPersistableContainer; import org.eclipse.rse.core.model.ISystemProfile; @@ -250,7 +253,7 @@ public interface ISystemFilterPoolManager extends IRSEPersistableContainer { // --------------------------------- /** * Creates a new system filter within the given filter container (either a filter pool, or - * a filter). This creates the filter, and then saves the filter pool. + * a filter). This creates the filter, and then saves the filter pool. *

Calls back to provider to inform of the event (filterEventFilterCreated) * @param parent The parent which is either a SystemFilterPool or a SystemFilter * @param aliasName The name to give the new filter. Must be unique for this pool. @@ -258,6 +261,16 @@ public interface ISystemFilterPoolManager extends IRSEPersistableContainer { */ public ISystemFilter createSystemFilter(ISystemFilterContainer parent, String aliasName, String[] filterStrings) throws Exception; + /** + * Creates a new system filter within the given filter container (either a filter pool, or + * a filter). This creates the filter, and then saves the filter pool. + *

Calls back to provider to inform of the event (filterEventFilterCreated) + * @param parent The parent which is either a SystemFilterPool or a SystemFilter + * @param aliasName The name to give the new filter. Must be unique for this pool. + * @param filterStrings The list of String objects that represent the filter strings. + */ + public ISystemFilter createSystemFilter(ISystemFilterContainer parent, String aliasName, List filterStrings) throws Exception; + /** * Creates a new system filter that is typed. * Same as {@link #createSystemFilter(ISystemFilterContainer, String, String[])} but @@ -274,6 +287,22 @@ public interface ISystemFilterPoolManager extends IRSEPersistableContainer { */ public ISystemFilter createSystemFilter(ISystemFilterContainer parent, String aliasName, String[] filterStrings, String type) throws Exception; + /** + * Creates a new system filter that is typed. + * Same as {@link #createSystemFilter(ISystemFilterContainer, String, String[])} but + * takes a filter type as an additional parameter. + *

+ * A filter's type is an arbitrary string that is not interpreted or used by the base framework. This + * is for use entirely by tools who wish to support multiple types of filters and be able to launch unique + * actions per type, say. + * + * @param parent The parent which is either a SystemFilterPool or a SystemFilter + * @param aliasName The name to give the new filter. Must be unique for this pool. + * @param filterStrings The list of String objects that represent the filter strings. + * @param type The type of this filter + */ + public ISystemFilter createSystemFilter(ISystemFilterContainer parent, String aliasName, List filterStrings, String type) throws Exception; + /** * Creates a new system filter that is typed and promptable * Same as {@link #createSystemFilter(ISystemFilterContainer, String ,String[], String)} but @@ -291,6 +320,23 @@ public interface ISystemFilterPoolManager extends IRSEPersistableContainer { */ public ISystemFilter createSystemFilter(ISystemFilterContainer parent, String aliasName, String[] filterStrings, String type, boolean promptable) throws Exception; + /** + * Creates a new system filter that is typed and promptable + * Same as {@link #createSystemFilter(ISystemFilterContainer, String ,String[], String)} but + * takes a boolean indicating if it is promptable. + *

+ * A promptable filter is one in which the user is prompted for information at expand time. + * There is no base filter framework support for this, but tools can query this attribute and + * do their own thing at expand time. + * + * @param parent The parent which is either a SystemFilterPool or a SystemFilter + * @param aliasName The name to give the new filter. Must be unique for this pool. + * @param filterStrings The list of String objects that represent the filter strings. + * @param type The type of this filter + * @param promptable Pass true if this is a promptable filter + */ + public ISystemFilter createSystemFilter(ISystemFilterContainer parent, String aliasName, List filterStrings, String type, boolean promptable) throws Exception; + /** * Delete an existing system filter. * Does the following: diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPoolManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPoolManager.java index c125d229bc1..4fe2b72fe84 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPoolManager.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPoolManager.java @@ -14,6 +14,7 @@ * Contributors: * David Dykstal (IBM) - 142806: refactoring persistence framework * David Dykstal (IBM) - [197036] removed caching mechanism to clean up logic + * David Dykstal (IBM) - [222270] clean up interfaces in org.eclipse.rse.core.filters *******************************************************************************/ package org.eclipse.rse.internal.core.filters; @@ -622,6 +623,34 @@ public class SystemFilterPoolManager extends RSEPersistableObject implements ISy // --------------------------------- // FILTER METHODS // --------------------------------- + + /* (non-Javadoc) + * @see org.eclipse.rse.core.filters.ISystemFilterPoolManager#createSystemFilter(org.eclipse.rse.core.filters.ISystemFilterContainer, java.lang.String, java.util.List, java.lang.String, boolean) + */ + public ISystemFilter createSystemFilter(ISystemFilterContainer parent, String aliasName, List filterStrings, String type, boolean promptable) throws Exception { + String[] filterStringsArray = new String[filterStrings.size()]; + ISystemFilter result = doCreateSystemFilter(parent, aliasName, filterStringsArray, type, promptable); + return result; + } + + /* (non-Javadoc) + * @see org.eclipse.rse.core.filters.ISystemFilterPoolManager#createSystemFilter(org.eclipse.rse.core.filters.ISystemFilterContainer, java.lang.String, java.util.List, java.lang.String) + */ + public ISystemFilter createSystemFilter(ISystemFilterContainer parent, String aliasName, List filterStrings, String type) throws Exception { + String[] filterStringsArray = new String[filterStrings.size()]; + ISystemFilter result = doCreateSystemFilter(parent, aliasName, filterStringsArray, type, false); + return result; + } + + /* (non-Javadoc) + * @see org.eclipse.rse.core.filters.ISystemFilterPoolManager#createSystemFilter(org.eclipse.rse.core.filters.ISystemFilterContainer, java.lang.String, java.util.List) + */ + public ISystemFilter createSystemFilter(ISystemFilterContainer parent, String aliasName, List filterStrings) throws Exception { + String[] filterStringsArray = new String[filterStrings.size()]; + ISystemFilter result = doCreateSystemFilter(parent, aliasName, filterStringsArray, null, false); + return result; + } + /** * Creates a new system filter within the given filter container (either a filter pool, or * a filter). This creates the filter, and then saves the filter pool. @@ -631,16 +660,7 @@ public class SystemFilterPoolManager extends RSEPersistableObject implements ISy * @param filterStrings The list of String objects that represent the filter strings. */ public ISystemFilter createSystemFilter(ISystemFilterContainer parent, String aliasName, String[] filterStrings) throws Exception { - ISystemFilter newFilter = null; - ISystemFilterPool parentPool = null; - if (parent instanceof ISystemFilterPool) - parentPool = (ISystemFilterPool) parent; - else - parentPool = ((ISystemFilter) parent).getParentFilterPool(); - newFilter = parent.createSystemFilter(aliasName, filterStrings); - if (!suspendSave) commit(parentPool); - // if caller provider, callback to inform them of this event - if ((caller != null) && !suspendCallbacks) caller.filterEventFilterCreated(newFilter); + ISystemFilter newFilter = doCreateSystemFilter(parent, aliasName, filterStrings, null, false); return newFilter; } @@ -659,27 +679,7 @@ public class SystemFilterPoolManager extends RSEPersistableObject implements ISy * @param type The type of this filter */ public ISystemFilter createSystemFilter(ISystemFilterContainer parent, String aliasName, String[] filterStrings, String type) throws Exception { - boolean oldSuspendSave = suspendSave; - boolean oldSuspendCallbacks = suspendCallbacks; - suspendSave = true; - suspendCallbacks = true; - - ISystemFilter newFilter = createSystemFilter(parent, aliasName, filterStrings); - newFilter.setType(type); - - suspendSave = oldSuspendSave; - suspendCallbacks = oldSuspendCallbacks; - - if (!suspendSave) { - ISystemFilterPool parentPool = null; - if (parent instanceof ISystemFilterPool) - parentPool = (ISystemFilterPool) parent; - else - parentPool = ((ISystemFilter) parent).getParentFilterPool(); - commit(parentPool); - } - // if caller provider, callback to inform them of this event - if ((caller != null) && !suspendCallbacks) caller.filterEventFilterCreated(newFilter); + ISystemFilter newFilter = doCreateSystemFilter(parent, aliasName, filterStrings, type, false); return newFilter; } @@ -699,27 +699,35 @@ public class SystemFilterPoolManager extends RSEPersistableObject implements ISy * @param promptable Pass true if this is a promptable filter */ public ISystemFilter createSystemFilter(ISystemFilterContainer parent, String aliasName, String[] filterStrings, String type, boolean promptable) throws Exception { - boolean oldSuspendSave = suspendSave; - boolean oldSuspendCallbacks = suspendCallbacks; - suspendSave = true; - suspendCallbacks = true; - - ISystemFilter newFilter = createSystemFilter(parent, aliasName, filterStrings, type); + ISystemFilter newFilter = doCreateSystemFilter(parent, aliasName, filterStrings, type, promptable); + return newFilter; + } + + /** + * Creates a system filter. + * @param parent the owning parent of this filter, must be a filter pool or a filter capable of nesting + * @param name the name of this filter + * @param filterStrings the strings associated with this filter + * @param type the type of this filter, used only if inheritType is false + * @param promptable the promptable nature of this filter, used only if inheritPromptable is false + * @return + */ + private ISystemFilter doCreateSystemFilter(ISystemFilterContainer parent, String name, String[] filterStrings, String type, boolean promptable) { + ISystemFilterPool parentPool = null; + if (parent instanceof ISystemFilterPool) { + parentPool = (ISystemFilterPool) parent; + } else { + parentPool = ((ISystemFilter) parent).getParentFilterPool(); + } + ISystemFilter newFilter = parentPool.createSystemFilter(name, filterStrings); + newFilter.setType(type); newFilter.setPromptable(promptable); - - suspendSave = oldSuspendSave; - suspendCallbacks = oldSuspendCallbacks; - if (!suspendSave) { - ISystemFilterPool parentPool = null; - if (parent instanceof ISystemFilterPool) - parentPool = (ISystemFilterPool) parent; - else - parentPool = ((ISystemFilter) parent).getParentFilterPool(); commit(parentPool); } - // if caller provider, callback to inform them of this event - if ((caller != null) && !suspendCallbacks) caller.filterEventFilterCreated(newFilter); + if ((caller != null) && !suspendCallbacks) { + caller.filterEventFilterCreated(newFilter); + } return newFilter; }