From 054297d712d959107bcd80c77945552804d0c39d Mon Sep 17 00:00:00 2001 From: David Dykstal Date: Thu, 13 Mar 2008 02:40:27 +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 --- .../core/filters/IRSEFilterNamingPolicy.java | 77 --- .../rse/core/filters/ISystemFilter.java | 168 ++--- .../core/filters/ISystemFilterContainer.java | 11 +- .../rse/core/filters/ISystemFilterPool.java | 28 +- .../filters/ISystemFilterPoolManager.java | 72 +-- .../ISystemFilterPoolReferenceManager.java | 39 -- .../core/filters/ISystemFilterReference.java | 5 +- .../filters/ISystemFilterSavePolicies.java | 47 -- .../core/filters/ISystemFilterStartHere.java | 9 +- .../filters/ISystemFilterStringReference.java | 7 +- .../filters/SystemFilterNamingPolicy.java | 149 ----- .../core/filters/SystemFilterReference.java | 590 ++++++++---------- .../rse/core/filters/SystemFilterSimple.java | 46 +- .../IRSEBasePersistableReferenceManager.java | 24 - .../SubSystemFilterNamingPolicy.java | 117 ---- .../internal/core/filters/SystemFilter.java | 138 +--- .../SystemFilterContainerCommonMethods.java | 10 +- ...FilterContainerReferenceCommonMethods.java | 349 +++++------ .../core/filters/SystemFilterPool.java | 414 ++---------- .../core/filters/SystemFilterPoolManager.java | 173 +---- .../filters/SystemFilterPoolReference.java | 7 +- .../SystemFilterPoolReferenceManager.java | 389 +----------- .../core/filters/SystemFilterStartHere.java | 23 +- .../persistence/dom/RSEDOMImporter.java | 12 +- .../SystemPersistableReferenceManager.java | 140 ----- .../SystemFileFilterStringEditPane.java | 5 +- .../RemoteFileSubSystemConfiguration.java | 18 +- ...toreWindowsFileSubSystemConfiguration.java | 10 +- .../LocalFileSubSystemConfiguration.java | 9 +- .../RemoteProcessSubSystemConfiguration.java | 17 +- ...terNewFilterPoolWizardDefaultMainPage.java | 13 +- .../ui/view/SystemViewFilterAdapter.java | 60 +- .../ui/view/SystemViewFilterPoolAdapter.java | 19 +- .../SystemViewFilterPoolReferenceAdapter.java | 31 +- .../SystemViewFilterReferenceAdapter.java | 33 +- .../view/SystemViewFilterStringAdapter.java | 24 +- .../dialogs/SystemNewFilterWizard.java | 30 +- .../SystemFilterStringPropertyPage.java | 5 +- .../rse/core/subsystems/SubSystem.java | 1 - .../subsystems/SubSystemConfiguration.java | 16 +- 40 files changed, 741 insertions(+), 2594 deletions(-) delete mode 100644 rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/IRSEFilterNamingPolicy.java delete mode 100644 rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterSavePolicies.java delete mode 100644 rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/SystemFilterNamingPolicy.java delete mode 100644 rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/SubSystemFilterNamingPolicy.java diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/IRSEFilterNamingPolicy.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/IRSEFilterNamingPolicy.java deleted file mode 100644 index 58739c83668..00000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/IRSEFilterNamingPolicy.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.rse.core.filters; - - -/** - * Allows tool writers to specify the naming standards for the - * persistence files and folders involved with filters. - *

- * Note that not all methods will be used for all saving policies. - *

- * @see org.eclipse.rse.core.filters.SystemFilterNamingPolicy#getNamingPolicy() - */ -public interface IRSEFilterNamingPolicy { - /** - * Get the unqualified save file name for the given SystemFilterPoolManager object name. - * Do NOT include the extension, as .xmi will be added. - */ - public String getManagerSaveFileName(String managerName); - - /** - * Get the unqualified save file name for the given SystemFilterPoolReferenceManager object name. - * Do NOT include the extension, as .xmi will be added. - */ - public String getReferenceManagerSaveFileName(String managerName); - - /** - * Get the unqualified save file name for the given SystemFilterPool object name. - * Do NOT include the extension, as .xmi will be added. - */ - public String getFilterPoolSaveFileName(String poolName); - - /** - * Get the file name prefix for all pool files. - * Used to deduce the saved pools by examining the file system - */ - public String getFilterPoolSaveFileNamePrefix(); - - /** - * Get the folder name for the given SystemFilterPool object name. - */ - public String getFilterPoolFolderName(String poolName); - - /** - * Get the folder name prefix for all pool folders. - * Used to deduce the saved pools by examining the file system - */ - public String getFilterPoolFolderNamePrefix(); - - /** - * Get the unqualified save file name for the given SystemFilter object name - * Do NOT include the extension, as .xmi will be added. - */ - public String getFilterSaveFileName(String filterName); - - /** - * Get the file name prefix for all filter files. - * Used to deduce the saved pools by examining the file system - */ - public String getFilterSaveFileNamePrefix(); - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilter.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilter.java index 583a93caca3..63f2a423889 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilter.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilter.java @@ -17,9 +17,6 @@ package org.eclipse.rse.core.filters; -import java.util.List; -import java.util.Vector; - import org.eclipse.rse.core.model.IRSEModelObject; import org.eclipse.rse.core.references.IRSEReferencedObject; @@ -35,83 +32,70 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai /** * Returns the value of the 'Name' attribute. - * *

* This is the name of the filter. It may be present in the user interface and is also * used to refer to the filter when it is persisted. *

- * * @return the value of the 'Name' attribute. * @see #setName(String) */ - String getName(); + public String getName(); /** * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#getName Name}' attribute. - * * This is the name of the filter. It may be present in the user interface and is also * used to refer to the filter when it is persisted. - * * @param value the new value of the 'Name' attribute. * @see #getName() */ - void setName(String value); + public void setName(String value); /** * Returns the value of the 'Type' attribute. - * *

* Filters may be further typed for use by subsystems. The type is also uninterpreted by the * filter. The type may be used to select a parser/interpreter for the filter strings. *

- * * @return the value of the 'Type' attribute. * @see #setType(String) */ - String getType(); + public String getType(); /** * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#getType Type}' attribute. - * * Filters may be further typed for use by subsystems. The type is also uninterpreted by the * filter. The type may be used to select a parser/interpreter for the filter strings. - * * @param value the new value of the 'Type' attribute. * @see #getType() */ - void setType(String value); + public void setType(String value); /** * Returns the value of the 'Supports Nested Filters' attribute. - * *

* Specifies whether filters may be nested or not. If nested the intent is to apply this filter * to the results of the parent filter - further restricting the resources selected by the * parent filter. However, it is up to the subsystem to interpret exactly what "nesting" means. *

- * * @return the value of the 'Supports Nested Filters' attribute. * @see #setSupportsNestedFilters(boolean) */ - boolean isSupportsNestedFilters(); + public boolean isSupportsNestedFilters(); /** * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isSupportsNestedFilters Supports Nested Filters}' attribute. - * *

* Specifies whether filters may be nested or not. If nested the intent is to apply this filter * to the results of the parent filter - further restricting the resources selected by the * parent filter. However, it is up to the subsystem to interpret exactly what "nesting" means. *

- * * @param value the new value of the 'Supports Nested Filters' attribute. * @see #isSupportsNestedFilters() */ - void setSupportsNestedFilters(boolean value); + public void setSupportsNestedFilters(boolean value); /** * Returns the value of the 'Relative Order' attribute. - * *

* The relative order of a filter is intended to be used * by a persistence mechanism to keep the filters in a particular order @@ -119,29 +103,25 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai * occur later in the pool. It may be employed in the absence of another * mechanism for maintaining order. *

- * * @return the value of the 'Relative Order' attribute. * @see #setRelativeOrder(int) */ - int getRelativeOrder(); + public int getRelativeOrder(); /** * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#getRelativeOrder Relative Order}' attribute. - * * The relative order of a filter is intended to be used * by a persistence mechanism to keep the filters in a particular order * when restoring them into a filter pool. Filters with higher numbers should * occur later in the pool. It may be employed in the absence of another * mechanism for maintaining order. - * * @param value the new value of the 'Relative Order' attribute. * @see #getRelativeOrder() */ - void setRelativeOrder(int value); + public void setRelativeOrder(int value); /** * Returns the value of the 'Default' attribute. - * *

* This filter is a "default" filter in this filter pool. * The meaning of "default" is determined by the subsystem in which it is deployed. @@ -149,29 +129,25 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai * That is, the filter is "vendor supplied". * There is no restriction on the number of default filters in a pool. *

- * * @return the value of the 'Default' attribute. * @see #setDefault(boolean) */ - boolean isDefault(); + public boolean isDefault(); /** * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isDefault Default}' attribute. - * * Make this filter is a "default" filter in this filter pool. * The meaning of "default" is determined by the subsystem in which it is deployed. * It typically means that the filter is supplied by the subsystem at the time the subsystem is created. * That is, the filter is "vendor supplied". * There is no restriction on the number of default filters in a pool. - * * @param value the new value of the 'Default' attribute. * @see #isDefault() */ - void setDefault(boolean value); + public void setDefault(boolean value); /** * Returns the value of the 'Strings Case Sensitive' attribute. - * *

* An attribute that may be used by the subystems when interpreting the filter. Used * to indicate whether or not comparisons involving the filter should be considered @@ -182,17 +158,15 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai * If unset the value * returned is from the parent filter pool. *

- * * @return the value of the 'Strings Case Sensitive' attribute. * @see #isSetStringsCaseSensitive() * @see #unsetStringsCaseSensitive() * @see #setStringsCaseSensitive(boolean) */ - boolean isStringsCaseSensitive(); + public boolean isStringsCaseSensitive(); /** * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isStringsCaseSensitive Strings Case Sensitive}' attribute. - * *

* An attribute that may be used by the subystems when interpreting the filter. Used * to indicate whether or not comparisons involving the filter should be considered @@ -202,7 +176,6 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai *

* This will cause this attribute to be set in this filter. *

- * * @param value the new value of the 'Strings Case Sensitive' attribute. * @see #isSetStringsCaseSensitive() * @see #unsetStringsCaseSensitive() @@ -212,7 +185,6 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai /** * Unsets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isStringsCaseSensitive Strings Case Sensitive}' attribute. - * *

* An attribute that may be used by the subystems when interpreting the filter. Used * to indicate whether or not comparisons involving the filter should be considered @@ -221,16 +193,14 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai *

* Causes this filter to use the value specified by the parent filter pool. *

- * * @see #isSetStringsCaseSensitive() * @see #isStringsCaseSensitive() * @see #setStringsCaseSensitive(boolean) */ - void unsetStringsCaseSensitive(); + public void unsetStringsCaseSensitive(); /** * Returns whether the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isStringsCaseSensitive Strings Case Sensitive}' attribute is set. - * *

* An attribute that may be used by the subystems when interpreting the filter. Used * to indicate whether or not comparisons involving the filter should be considered @@ -240,17 +210,15 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai * This will be true if this attribute is explicitly specified for this filter. It will be false if this * is being inherited from the parent filter pool. *

- * * @return whether the value of the 'Strings Case Sensitive' attribute is set. * @see #unsetStringsCaseSensitive() * @see #isStringsCaseSensitive() * @see #setStringsCaseSensitive(boolean) */ - boolean isSetStringsCaseSensitive(); + public boolean isSetStringsCaseSensitive(); /** * Returns the value of the 'Promptable' attribute. - * *

* An attribute that may be used by the subystems when interpreting the filter. * Typically used to indicate whether or not some sort of prompting is to occur when the @@ -258,15 +226,13 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai * the start of a wizard or dialog. It may also have an effect on whether * the state of the filter is saved when the workbench is shut down. *

- * * @return the value of the 'Promptable' attribute. * @see #setPromptable(boolean) */ - boolean isPromptable(); + public boolean isPromptable(); /** * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isPromptable Promptable}' attribute. - * *

* An attribute that may be used by the subystems when interpreting the filter. * Typically used to indicate whether or not some sort of prompting is to occur when the @@ -274,25 +240,22 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai * the start of a wizard or dialog. It may also have an effect on whether * the state of the filter is saved when the workbench is shut down. *

- * * @param value the new value of the 'Promptable' attribute. * @see #isPromptable() */ - void setPromptable(boolean value); + public void setPromptable(boolean value); /** * Returns the value of the 'Supports Duplicate Filter Strings' attribute. - * *

* This attribute may be used by subsystems when interpreting the filter. * Typically used when adding filter strings to the filter or as a hint when * applying the filter to the resources understood by the subsystem. *

- * * @return the value of the 'Supports Duplicate Filter Strings' attribute. * @see #setSupportsDuplicateFilterStrings(boolean) */ - boolean isSupportsDuplicateFilterStrings(); + public boolean isSupportsDuplicateFilterStrings(); /** * Does this support duplicate filter strings? @@ -302,153 +265,130 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai /** * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isSupportsDuplicateFilterStrings Supports Duplicate Filter Strings}' attribute. - * *

* This attribute may be used by subsystems when interpreting the filter. * Typically used when adding filter strings to the filter or as a hint when * applying the filter to the resources understood by the subsystem. *

- * * @param value the new value of the 'Supports Duplicate Filter Strings' attribute. * @see #isSupportsDuplicateFilterStrings() */ - void setSupportsDuplicateFilterStrings(boolean value); + public void setSupportsDuplicateFilterStrings(boolean value); /** * Returns the value of the 'Non Deletable' attribute. - * *

* An attribute that can be used when managing filters in filter pools. * Some filters should not be deleted. *

- * * @return the value of the 'Non Deletable' attribute. * @see #setNonDeletable(boolean) */ - boolean isNonDeletable(); + public boolean isNonDeletable(); /** * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isNonDeletable Non Deletable}' attribute. - * *

* An attribute that can be used when managing filters in filter pools. * Some filters should not be deleted. *

- * * @param value the new value of the 'Non Deletable' attribute. * @see #isNonDeletable() */ - void setNonDeletable(boolean value); + public void setNonDeletable(boolean value); /** * Returns the value of the 'Non Renamable' attribute. - * *

* An attribute that can be used when managing filters in filter pools. * Some filters should not be renamed. *

- * * @return the value of the 'Non Renamable' attribute. * @see #setNonRenamable(boolean) */ - boolean isNonRenamable(); + public boolean isNonRenamable(); /** * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isNonRenamable Non Renamable}' attribute. - * *

* An attribute that can be used when managing filters in filter pools. * Some filters should not be renamed. *

- * * @param value the new value of the 'Non Renamable' attribute. * @see #isNonRenamable() */ - void setNonRenamable(boolean value); + public void setNonRenamable(boolean value); /** * Returns the value of the 'Non Changable' attribute. - * *

* An attribute that can be used when managing filters in filter pools. * Some filters should not be modifiable. *

- * * @return the value of the 'Non Changable' attribute. * @see #setNonChangable(boolean) */ - boolean isNonChangable(); + public boolean isNonChangable(); /** * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isNonChangable Non Changable}' attribute. - * *

* An attribute that can be used when managing filters in filter pools. * Some filters should not be modifiable. *

- * * @param value the new value of the 'Non Changable' attribute. * @see #isNonChangable() */ - void setNonChangable(boolean value); + public void setNonChangable(boolean value); /** * Returns the value of the 'Strings Non Changable' attribute. - * *

* An attribute that can be used when managing filters in filter pools. * Some filters contain filter strings that should not be modifiable. *

- * * @return the value of the 'Strings Non Changable' attribute. * @see #setStringsNonChangable(boolean) */ - boolean isStringsNonChangable(); + public boolean isStringsNonChangable(); /** * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isStringsNonChangable Strings Non Changable}' attribute. - * *

* An attribute that can be used when managing filters in filter pools. * Some filters contain filter strings that should not be modifiable. *

- * * @param value the new value of the 'Strings Non Changable' attribute. * @see #isStringsNonChangable() */ - void setStringsNonChangable(boolean value); + public void setStringsNonChangable(boolean value); /** * Returns the value of the 'Release' attribute. - * *

* This is an attribute specifying the release level of the * filter. This will be persisted in the filter definition and * can be used to migrate the internal form of the filter. *

- * * @return the value of the 'Release' attribute. * @see #setRelease(int) */ - int getRelease(); + public int getRelease(); /** * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#getRelease Release}' attribute. - * *

* This is an attribute specifying the release level of the * filter. This will be persisted in the filter definition and * can be used to migrate the internal form of the filter. *

- * * @param value the new value of the 'Release' attribute. * @see #getRelease() */ - void setRelease(int value); + public void setRelease(int value); /** * Returns the value of the 'Single Filter String Only' attribute. - * *

* This attribute specifies that the filter may contain only a single * filter string. Used by a filter manager to ensure that the @@ -458,17 +398,15 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai * This attribute may be set or unset. If unset this value will be inherited * from the parent filter pool. *

- * * @return the value of the 'Single Filter String Only' attribute. * @see #isSetSingleFilterStringOnly() * @see #unsetSingleFilterStringOnly() * @see #setSingleFilterStringOnly(boolean) */ - boolean isSingleFilterStringOnly(); + public boolean isSingleFilterStringOnly(); /** * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isSingleFilterStringOnly Single Filter String Only}' attribute. - * *

* This attribute specifies that the filter may contain only a single * filter string. Used by a filter manager to ensure that the @@ -478,84 +416,71 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai * This causes the attribute to be set for this filter, ignoring the value * specified for the parent filter pool. *

- * * @param value the new value of the 'Single Filter String Only' attribute. * @see #isSetSingleFilterStringOnly() * @see #unsetSingleFilterStringOnly() * @see #isSingleFilterStringOnly() */ - void setSingleFilterStringOnly(boolean value); + public void setSingleFilterStringOnly(boolean value); /** * Unsets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isSingleFilterStringOnly Single Filter String Only}' attribute. - * * This causes the value of this attribute to be inherited from the parent filter pool. - * * @see #isSetSingleFilterStringOnly() * @see #isSingleFilterStringOnly() * @see #setSingleFilterStringOnly(boolean) */ - void unsetSingleFilterStringOnly(); + public void unsetSingleFilterStringOnly(); /** * Returns whether the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isSingleFilterStringOnly Single Filter String Only}' attribute is set. - * * If true then the value of this attribute is set in this filter. If false it is inherited from the parent filter pool. - * * @return whether the value of the 'Single Filter String Only' attribute is set. * @see #unsetSingleFilterStringOnly() * @see #isSingleFilterStringOnly() * @see #setSingleFilterStringOnly(boolean) */ - boolean isSetSingleFilterStringOnly(); + public boolean isSetSingleFilterStringOnly(); /** * Returns the value of the 'Nested Filters' containment reference list. * The list contents are of type {@link org.eclipse.rse.core.filters.ISystemFilter}. * It is bidirectional and its opposite is '{@link org.eclipse.rse.core.filters.ISystemFilter#getParentFilter Parent Filter}'. - * *

* If this filter can contain child filters this will return the list of children. *

- * * @return the value of the 'Nested Filters' containment reference list. * @see org.eclipse.rse.core.filters.ISystemFilter#getParentFilter */ - List getNestedFilters(); + public ISystemFilter[] getNestedFilters(); /** * Returns the value of the 'Parent Filter' container reference. * It is bidirectional and its opposite is '{@link org.eclipse.rse.core.filters.ISystemFilter#getNestedFilters Nested Filters}'. - * *

* If this filter can be nested inside another this will return the parent filter. Will be * null if there is no parent. *

- * * @return the value of the 'Parent Filter' container reference. * @see #setParentFilter(ISystemFilter) * @see org.eclipse.rse.core.filters.ISystemFilter#getNestedFilters */ - ISystemFilter getParentFilter(); + public ISystemFilter getParentFilter(); /** * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#getParentFilter Parent Filter}' container reference. - * * This is used by a filter manager to set the parent filter when one filter is nested inside another. - * * @param value the new value of the 'Parent Filter' container reference. * @see #getParentFilter() */ - void setParentFilter(ISystemFilter value); + public void setParentFilter(ISystemFilter value); /** * Returns the value of the 'Strings' containment reference list. * The list contents are of type {@link org.eclipse.rse.core.filters.ISystemFilterString}. - * - * * @return the value of the 'Strings' containment reference list. */ - List getStrings(); + public ISystemFilterString[] getStrings(); /** * @return the parent pool of this filter. For nested filters, this will walk up the parent chain @@ -570,13 +495,6 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai */ public void setParentFilterPool(ISystemFilterPool parentPool); - /** - * Set this filter's filter strings by giving a Vector of String objects. - * This will construct the filter strings objects. - * @param strings the vector of String objects. - */ - public void setFilterStrings(Vector strings); - /** * Set this filter's filter strings by giving an array of String objects. * This will construct the filter strings objects. @@ -585,22 +503,14 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai public void setFilterStrings(String[] strings); /** - * @return this filter's filter strings as a Vector of String objects - */ - public Vector getFilterStringsVector(); - - /** - * @return this filter's filter strings as a Vector of IFilterString objects - */ - public Vector getFilterStringObjectsVector(); - - /** - * @return this filter's filter strings as an array of String objects + * @return this filter's filter strings as an array of String objects. This array will + * not be null, but may be empty. */ public String[] getFilterStrings(); /** - * @return this filter's filter string objects as an array of IFilterString objects + * @return this filter's filter string objects as an array of IFilterString objects. + * This array will not be null, but may be empty. */ public ISystemFilterString[] getSystemFilterStrings(); diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterContainer.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterContainer.java index 21e5ddbbf6b..df26d02cbda 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterContainer.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterContainer.java @@ -16,8 +16,6 @@ *******************************************************************************/ package org.eclipse.rse.core.filters; -import java.util.Vector; - import org.eclipse.rse.core.model.IRSEPersistableContainer; /** @@ -44,7 +42,7 @@ public interface ISystemFilterContainer extends IRSEPersistableContainer { * @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(String aliasName, Vector filterStrings); + public ISystemFilter createSystemFilter(String aliasName, String[] filterStrings); /** * Adds given filter to the list without populating the filter strings. @@ -57,12 +55,7 @@ public interface ISystemFilterContainer extends IRSEPersistableContainer { * @return Vector of String objects: the names of existing filters in this container. * Typically used by name validators for New and Rename actions to verify new name is unique. */ - public Vector getSystemFilterNames(); - - /** - * @return a Vector of the ISystemFilter objects contained in this filter container. - */ - public Vector getSystemFiltersVector(); + public String[] getSystemFilterNames(); /** * @return an array of the ISystemFilter objects contained in this filter container. diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPool.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPool.java index f76fa481fdf..549231b8244 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPool.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPool.java @@ -17,8 +17,6 @@ package org.eclipse.rse.core.filters; -import java.util.List; - import org.eclipse.rse.core.model.IRSEModelObject; import org.eclipse.rse.core.references.IRSEPersistableReferencedObject; @@ -33,18 +31,6 @@ public interface ISystemFilterPool extends IRSEPersistableReferencedObject, ISys */ public ISystemFilterPoolManagerProvider getProvider(); - /** - * Set the naming policy used when saving data to disk. - * @see org.eclipse.rse.core.filters.IRSEFilterNamingPolicy - */ - public void setNamingPolicy(IRSEFilterNamingPolicy namingPolicy); - - /** - * Get the naming policy currently used when saving data to disk. - * @see org.eclipse.rse.core.filters.IRSEFilterNamingPolicy - */ - public IRSEFilterNamingPolicy getNamingPolicy(); - /** * @return true if filters in this pool support nested filters. */ @@ -121,16 +107,6 @@ public interface ISystemFilterPool extends IRSEPersistableReferencedObject, ISys */ public void orderSystemFilters(String[] names); - /** - * Set the save file policy. See constants in SystemFilterConstants. One of: - * - * This method is called by the SystemFilterPoolManager. - */ - public void setSavePolicy(int policy); - /** * @return the id of the filter pool. Used for referencing this filter pool from filter pool references. */ @@ -211,9 +187,9 @@ public interface ISystemFilterPool extends IRSEPersistableReferencedObject, ISys public boolean isSetStringsCaseSensitive(); /** - * @return The list of Filters references + * @return An array of filters in this pool */ - public List getFilters(); + public ISystemFilter[] getFilters(); /** * @return The value of the SupportsDuplicateFilterStrings attribute 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 a18ebb374a3..64ef5b33629 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 @@ -18,67 +18,16 @@ package org.eclipse.rse.core.filters; -import java.util.Vector; - import org.eclipse.rse.core.model.IRSEPersistableContainer; import org.eclipse.rse.core.model.ISystemProfile; /** * A filter pool manager manages filter pools. *

- * Each filter pool that is managed becomes a folder on disk. - *

- * To create a filter pool manager instance, use the factory methods - * in SystemFilterPoolManagerImpl in the ...impl package. - * You must pass a folder that represents the anchor point for the - * pools managed by this manager instance. - *

- * Depending on your tools' needs, you have four choices about how - * the filter pools and filters are persisted to disk. The decision is - * made at the time you instantiate the pool manager and is one of the - * following constants from the {@link SystemFilterConstants} interface: - *

- *

- * With the policy of one file per pool, there are two possibilities regarding - * the folder structure: - *

- *

- * With the policy of one file per filter, each filter pool must have its own folder. - *

- * With an instantiated filter pool manager (most tools will only need - * one such instance), you now simply call its methods to work with - * filter pools. For example, use it to: - *

- * All the underlying file system work is handled for you. - *

* Further, this is the front door for working with filters too. By forcing all * filter related activity through a single point like this, we can ensure that * all changes are saved to disk, and events are fired properly. */ -/** - * @lastgen interface SystemFilterPoolManager {} - */ public interface ISystemFilterPoolManager extends IRSEPersistableContainer { // --------------------------------- // ATTRIBUTE METHODS @@ -166,11 +115,6 @@ public interface ISystemFilterPoolManager extends IRSEPersistableContainer { */ public String[] getSystemFilterPoolNames(); - /** - * Get vector of filter pool names currently existing. - */ - public Vector getSystemFilterPoolNamesVector(); - /** * Return array of SystemFilterPools managed by this manager. */ @@ -312,11 +256,11 @@ public interface ISystemFilterPoolManager extends IRSEPersistableContainer { * @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, Vector filterStrings) throws Exception; + public ISystemFilter createSystemFilter(ISystemFilterContainer parent, String aliasName, String[] filterStrings) throws Exception; /** * Creates a new system filter that is typed. - * Same as {@link #createSystemFilter(ISystemFilterContainer, String, Vector)} but + * 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 @@ -328,11 +272,11 @@ public interface ISystemFilterPoolManager extends IRSEPersistableContainer { * @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, Vector filterStrings, String type) throws Exception; + public ISystemFilter createSystemFilter(ISystemFilterContainer parent, String aliasName, String[] filterStrings, String type) throws Exception; /** * Creates a new system filter that is typed and promptable - * Same as {@link #createSystemFilter(ISystemFilterContainer, String ,Vector, String)} but + * 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. @@ -345,7 +289,7 @@ public interface ISystemFilterPoolManager extends IRSEPersistableContainer { * @param type The type of this filter * @param promptable Pass true if this is a promptable filter */ - public ISystemFilter createSystemFilter(ISystemFilterContainer parent, String aliasName, Vector filterStrings, String type, boolean promptable) throws Exception; + public ISystemFilter createSystemFilter(ISystemFilterContainer parent, String aliasName, String[] filterStrings, String type, boolean promptable) throws Exception; /** * Delete an existing system filter. @@ -567,12 +511,6 @@ public interface ISystemFilterPoolManager extends IRSEPersistableContainer { */ void setStringsCaseSensitive(boolean value); - /** - * @generated This field/method will be replaced during code generation - * @return The list of Pools references - */ - java.util.List getPools(); - /** * @generated This field/method will be replaced during code generation * @return The value of the SupportsDuplicateFilterStrings attribute diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolReferenceManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolReferenceManager.java index d13be377202..83daeecf138 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolReferenceManager.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterPoolReferenceManager.java @@ -17,9 +17,6 @@ package org.eclipse.rse.core.filters; -import java.util.Vector; - -import org.eclipse.core.resources.IFolder; import org.eclipse.rse.core.references.IRSEBasePersistableReferenceManager; import org.eclipse.rse.core.subsystems.ISubSystem; @@ -258,40 +255,4 @@ public interface ISystemFilterPoolReferenceManager extends IRSEBasePersistableRe */ public int getSystemFilterReferencePosition(ISubSystem subSystem, ISystemFilter filter); - // ------------------------- - // SAVE / RESTORE METHODS... - // ------------------------- - /** - * After restoring this from disk, there is only the referenced object name, - * not the referenced object pointer, for each referencing object. - *

- * This method is called after restore and for each restored object in the list must: - *

    - *
  1. Do what is necessary to find the referenced object, and set the internal reference pointer. - *
  2. Call addReference(this) on that object so it can maintain it's in-memory list - * of all referencing objects. - *
  3. Set the important transient variables - *
- * @param relatedPoolMgrProvider the creator of the filter pool managers that hold filter pools we reference - * @param provider the host of this reference manager, so you can later call getProvider - * @return A Vector of SystemFilterPoolReferences that were not successfully resolved, or null if all - * were resolved. - */ - public Vector resolveReferencesAfterRestore(ISystemFilterPoolManagerProvider relatedPoolMgrProvider, ISystemFilterPoolReferenceManagerProvider provider); - - /** - * Save all the filter pool references to disk. - * Use only if not doing your own saving, else override or set save policy to none. - */ - public void save() throws Exception; - - /** - * Return the folder that this manager is contained in. - */ - public IFolder getFolder(); - - /** - * Reset the folder that this manager is contained in. - */ - public void resetManagerFolder(IFolder newFolder); } diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterReference.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterReference.java index 37ce0c5c46a..2253752b7ee 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterReference.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterReference.java @@ -26,9 +26,6 @@ import org.eclipse.rse.core.subsystems.ISubSystem; * Represents a shadow or reference to a system filter. * Such references are only transient, not savable to disk. */ -/** - * @lastgen interface SystemFilterReference extends SystemReferencingObject, SystemFilterContainerReference {} - */ public interface ISystemFilterReference extends IRSEReferencingObject, ISystemFilterContainerReference, ISystemContainer { /** * Return the reference manager which is managing this filter reference @@ -51,7 +48,7 @@ public interface ISystemFilterReference extends IRSEReferencingObject, ISystemFi /** * Sets the subsystem that contains this reference - * @param subSystem + * @param subSystem the subsystem that holds this reference */ public void setSubSystem(ISubSystem subSystem); diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterSavePolicies.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterSavePolicies.java deleted file mode 100644 index 43981e3ce61..00000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterSavePolicies.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.rse.core.filters; - -/** - * A save policy dictates how filter framework artifacts are persisted to disk. - */ -public interface ISystemFilterSavePolicies { - /** - * No saving. All save/restoring handled elsewhere. - */ - public static final int SAVE_POLICY_NONE = -1; - /** - * Save all filter pools and all filters in one file, with same name as the manager - */ - public static final int SAVE_POLICY_ONE_FILE_PER_MANAGER = 0; - /** - * Save all filters in each filter pool in one file per pool, with the same name as the pool. - * Each pool also has its own unique folder. - */ - public static final int SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL = 1; - /** - * Save all filters in each filter pool in one file per pool, with the same name as the pool - * All pool files go into the same folder. - */ - public static final int SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER = 2; - /** - * Save each filter in each filter pool in its own file, with the same name as the filter - */ - public static final int SAVE_POLICY_ONE_FILE_PER_FILTER = 3; - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterStartHere.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterStartHere.java index e6b9de5b067..6706e28484d 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterStartHere.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterStartHere.java @@ -15,12 +15,6 @@ import org.eclipse.rse.logging.Logger; public interface ISystemFilterStartHere { - /** - * Factory method to return an instance populated with defaults. - * You can then simply override whatever is desired via setXXX methods. - */ - public IRSEFilterNamingPolicy createSystemFilterNamingPolicy(); - /** * Factory to create a filter pool manager, when you do NOT want it to worry about * saving and restoring the filter data to disk. Rather, you will save and restore @@ -50,8 +44,7 @@ public interface ISystemFilterStartHere { * this manager will contain references to. * @param name the name of the filter pool reference manager. This is not currently * used, but you may find a use for it. - * @param namingPolicy the naming policy object which will return the name of that one file. */ public ISystemFilterPoolReferenceManager createSystemFilterPoolReferenceManager(ISystemFilterPoolReferenceManagerProvider caller, ISystemFilterPoolManagerProvider relatedPoolMgrProvider, - String name, IRSEFilterNamingPolicy namingPolicy); + String name); } diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterStringReference.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterStringReference.java index 6948fd5d774..099ac8f46d1 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterStringReference.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/ISystemFilterStringReference.java @@ -20,9 +20,8 @@ package org.eclipse.rse.core.filters; import org.eclipse.rse.core.references.IRSEBaseReferencingObject; /** - * Represents a reference to a master filter string. - * Needed so GUI can show the same filter string multiple times. - * This is not modelled in MOF. + * Represents a reference to a filter string. + * Needed so the UI can show the same filter string multiple times. */ public interface ISystemFilterStringReference extends IRSEBaseReferencingObject { /** @@ -57,4 +56,4 @@ public interface ISystemFilterStringReference extends IRSEBaseReferencingObject * Same as getReferencedFilterString().getString() */ public String getString(); -} //SystemFilterStringReference +} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/SystemFilterNamingPolicy.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/SystemFilterNamingPolicy.java deleted file mode 100644 index 34851684773..00000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/SystemFilterNamingPolicy.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.rse.core.filters; - - -/** - * A naming policy so tool writers can override defaults used when - * saving filter data to disk. - *

- * Subclass this and override what you wish to change. - */ -public class SystemFilterNamingPolicy implements IRSEFilterNamingPolicy { - - protected String managerFileNamePrefix; - protected String poolFolderNamePrefix; - protected String poolFolderNameSuffix; - protected String poolFileNamePrefix; - protected String filterFileNamePrefix; - protected String referenceManagerFileNamePrefix; - /** - * Default prefix for filter pool manager persisted file: "filterPools_" - */ - public static final String DEFAULT_FILENAME_PREFIX_FILTERPOOLMANAGER = "filterPools_"; //$NON-NLS-1$ - /** - * Default prefix for filter pool reference manager persisted file: "filterPoolRefs_" - */ - public static final String DEFAULT_FILENAME_PREFIX_FILTERPOOLREFERENCEMANAGER = "filterPoolRefs_"; //$NON-NLS-1$ - /** - * Default prefix for filter pool persisted file: "filterPool_" - */ - public static final String DEFAULT_FILENAME_PREFIX_FILTERPOOL = "filterPool_"; //$NON-NLS-1$ - /** - * Default prefix for filter persisted file: "filter_" - */ - public static final String DEFAULT_FILENAME_PREFIX_FILTER = "filter_"; //$NON-NLS-1$ - /** - * Default prefix for filter pool folder: "FilterPool_" - */ - public static final String DEFAULT_FOLDERNAME_PREFIX_FILTERPOOL = "FilterPool_"; //$NON-NLS-1$ - - /** - * Factory method to return an instance populated with defaults. - * Can then simply override whatever is desired. - */ - public static IRSEFilterNamingPolicy getNamingPolicy() { - return new SystemFilterNamingPolicy(); - } - - /** - * Constructor for SystemFilterNamingPolicyImpl - */ - public SystemFilterNamingPolicy() { - super(); - } - - /** - * Get the unqualified save file name for the given SystemFilterPoolManager object. - * Do NOT include the extension, as .xmi will be added. - *

- * Returns "filterPools_"+managerName by default. - */ - public String getManagerSaveFileName(String managerName) { - return DEFAULT_FILENAME_PREFIX_FILTERPOOLMANAGER + managerName; - } - - /** - * Get the unqualified save file name for the given SystemFilterPoolReferenceManager object. - * Do NOT include the extension, as .xmi will be added. - *

- * Returns "filterPoolRefs_"+managerName by default. - */ - public String getReferenceManagerSaveFileName(String managerName) { - return DEFAULT_FILENAME_PREFIX_FILTERPOOLREFERENCEMANAGER + managerName; - } - - /** - * Get the unqualified save file name for the given SystemFilterPool object. - * Do NOT include the extension, as .xmi will be added. - *

- * Returns getFilterPoolSaveFileNamePrefix()+poolName by default. - */ - public String getFilterPoolSaveFileName(String poolName) { - return getFilterPoolSaveFileNamePrefix() + poolName; - } - - /** - * Get the file name prefix for all pool files. - * Used to deduce the saved pools by examining the file system - *

- * By default returns "filterPool_" - */ - public String getFilterPoolSaveFileNamePrefix() { - return DEFAULT_FILENAME_PREFIX_FILTERPOOL; - } - - /** - * Get the folder name for the given SystemFilterPool object. - *

- * Returns getFilterPoolFolderNamePrefix()+poolName by default. - */ - public String getFilterPoolFolderName(String poolName) { - return getFilterPoolFolderNamePrefix() + poolName; - } - - /** - * Get the folder name prefix for all pool folders. - * Used to deduce the saved pools by examining the file system - *

- * By default returns "FilterPool_" - */ - public String getFilterPoolFolderNamePrefix() { - return DEFAULT_FOLDERNAME_PREFIX_FILTERPOOL; - } - - /** - * Get the unqualified save file name for the given SystemFilter object. - * Do NOT include the extension, as .xmi will be added. - *

- * Returns getFilterSaveFileNamePrefix()+filterName by default. - */ - public String getFilterSaveFileName(String filterName) { - return getFilterSaveFileNamePrefix() + filterName; - } - - /** - * Get the file name prefix for all filter files. - * Used to deduce the saved filters by examining the file system - *

- * Returns "Filter_" by default. - */ - public String getFilterSaveFileNamePrefix() { - return DEFAULT_FILENAME_PREFIX_FILTER; - } -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/SystemFilterReference.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/SystemFilterReference.java index 4d34098196d..74409665f11 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/SystemFilterReference.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/SystemFilterReference.java @@ -15,8 +15,11 @@ ********************************************************************************/ package org.eclipse.rse.core.filters; + +import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.Platform; @@ -29,8 +32,6 @@ import org.eclipse.rse.internal.core.filters.SystemFilterContainerReferenceCommo import org.eclipse.rse.internal.core.filters.SystemFilterStringReference; import org.eclipse.rse.internal.references.SystemReferencingObject; - - /** * Represents a shadow or reference to a system filter. * Such references are only transient, not savable to disk. @@ -46,49 +47,44 @@ import org.eclipse.rse.internal.references.SystemReferencingObject; /** * @lastgen class SystemFilterReferenceImpl extends SystemReferencingObjectImpl implements IAdaptable, SystemFilterReference, SystemReferencingObject {} */ -public class SystemFilterReference extends SystemReferencingObject implements IAdaptable, ISystemFilterReference -{ +public class SystemFilterReference extends SystemReferencingObject implements IAdaptable, ISystemFilterReference { private SystemFilterContainerReferenceCommonMethods containerHelper = null; - private ISystemFilterContainerReference parent = null; + private ISystemFilterContainerReference parent = null; private ISystemFilter referencedFilter = null; private ISystemFilterStringReference[] referencedFilterStrings = null; protected boolean persistent; protected boolean isStale; // protected Object[] cachedContents; protected ISubSystem _subSystem; - + protected HashMap cachedContents; - + public static final boolean PERSISTENT_YES = true; - public static final boolean PERSISTENT_NO = false; + public static final boolean PERSISTENT_NO = false; + /** - * Constructor. Typically called by MOF. + * Constructor. */ - protected SystemFilterReference() - { + protected SystemFilterReference() { super(); containerHelper = new SystemFilterContainerReferenceCommonMethods(this); persistent = true; isStale = true; cachedContents = new HashMap(); } + /** * Create a new instance of this class. * @param parent The SystemFilterReference or SystemFilterPoolReference object that we are a child of. * @param filter The master object to be referenced. * @param persistent Whether we should formally register our reference with the target filter or not. */ - public static ISystemFilterReference createSystemFilterReference(ISubSystem subSystem, - ISystemFilterContainerReference parent, - ISystemFilter filter, - boolean persistent) - { - //SystemFilterReferenceImpl newRef = (SystemFilterReferenceImpl)SystemFilterImpl.initMOF().createSystemFilterReference(); - SystemFilterReference newRef = new SystemFilterReference(); // more efficient? + public static ISystemFilterReference createSystemFilterReference(ISubSystem subSystem, ISystemFilterContainerReference parent, ISystemFilter filter, boolean persistent) { + SystemFilterReference newRef = new SystemFilterReference(); newRef.persistent = persistent; newRef.setSubSystem(subSystem); newRef.setParent(parent); - newRef.setReferencedFilter(filter); + newRef.setReferencedFilter(filter); filter.addReference(newRef); return newRef; } @@ -97,113 +93,102 @@ public class SystemFilterReference extends SystemReferencingObject implements IA * Gets the subsystem that contains this reference * @return the subsystem */ - public ISubSystem getSubSystem() - { + public ISubSystem getSubSystem() { return _subSystem; } - + /** * Sets the subsystem that contains this reference - * @param subSystem + * @param subSystem the subsystem that holds this reference */ - public void setSubSystem(ISubSystem subSystem) - { + public void setSubSystem(ISubSystem subSystem) { _subSystem = subSystem; } - + /** * Return the reference manager which is managing this filter reference * framework object. */ - public ISystemFilterPoolReferenceManager getFilterPoolReferenceManager() - { + public ISystemFilterPoolReferenceManager getFilterPoolReferenceManager() { ISystemFilterPoolReference pool = getParentSystemFilterReferencePool(); if (pool != null) - return pool.getFilterPoolReferenceManager(); + return pool.getFilterPoolReferenceManager(); else - return null; + return null; } - + /** * Return the object which instantiated the pool reference manager object. * Makes it easy to get back to the point of origin, given any filter reference * framework object */ - public ISystemFilterPoolReferenceManagerProvider getProvider() - { - ISystemFilterPoolReferenceManager mgr = getFilterPoolReferenceManager(); - if (mgr != null) - { - ISystemFilterPoolReferenceManagerProvider provider = mgr.getProvider(); - if (provider == null) - { - provider = getSubSystem(); - } - return provider; - } - else - return null; - } + public ISystemFilterPoolReferenceManagerProvider getProvider() { + ISystemFilterPoolReferenceManager mgr = getFilterPoolReferenceManager(); + if (mgr != null) { + ISystemFilterPoolReferenceManagerProvider provider = mgr.getProvider(); + if (provider == null) { + provider = getSubSystem(); + } + return provider; + } else + return null; + } - - /** - * If this is a reference to a nested filter, the parent is the - * reference to the nested filter's parent. Else, it is the - * reference to the parent filter pool - */ - public void setParent(ISystemFilterContainerReference parent) - { - this.parent = parent; - } - /** - * The parent will either by a SystemFilterPoolReference or - * a SystemFilterReference. - */ - public ISystemFilterContainerReference getParent() - { - return parent; - } + /** + * If this is a reference to a nested filter, the parent is the + * reference to the nested filter's parent. Else, it is the + * reference to the parent filter pool + */ + public void setParent(ISystemFilterContainerReference parent) { + this.parent = parent; + } + + /** + * The parent will either by a SystemFilterPoolReference or + * a SystemFilterReference. + */ + public ISystemFilterContainerReference getParent() { + return parent; + } /** * Return the filter to which we reference... */ - public ISystemFilter getReferencedFilter() - { - return persistent ? (ISystemFilter)super.getReferencedObject() : referencedFilter; + public ISystemFilter getReferencedFilter() { + return persistent ? (ISystemFilter) super.getReferencedObject() : referencedFilter; } + /** * Set the filter to which we reference... */ - public void setReferencedFilter(ISystemFilter filter) - { + public void setReferencedFilter(ISystemFilter filter) { if (persistent) - super.setReferencedObject(filter); + super.setReferencedObject(filter); else - referencedFilter = filter; + referencedFilter = filter; } - /** - * If this is a reference to a nested filter, the parent is the - * reference to the nested filter's parent. Else, it is the - * reference to the parent filter pool - */ - public ISystemFilterPoolReference getParentSystemFilterReferencePool() - { - if (parent instanceof ISystemFilterPoolReference) - return (ISystemFilterPoolReference)parent; - else - return ((ISystemFilterReference)parent).getParentSystemFilterReferencePool(); - } - /** + /** + * If this is a reference to a nested filter, the parent is the + * reference to the nested filter's parent. Else, it is the + * reference to the parent filter pool + */ + public ISystemFilterPoolReference getParentSystemFilterReferencePool() { + if (parent instanceof ISystemFilterPoolReference) + return (ISystemFilterPoolReference) parent; + else + return ((ISystemFilterReference) parent).getParentSystemFilterReferencePool(); + } + + /** * This is the method required by the IAdaptable interface. * Given an adapter class type, return an object castable to the type, or * null if this is not possible. */ - public Object getAdapter(Class adapterType) - { - return Platform.getAdapterManager().getAdapter(this, adapterType); - } - + public Object getAdapter(Class adapterType) { + return Platform.getAdapterManager().getAdapter(this, adapterType); + } + // ------------------------------------------------------------- // Methods common with SystemFilterPoolReferenceImpl, and hence // abstracted out into SystemFilterContainerReference... @@ -217,10 +202,10 @@ public class SystemFilterReference extends SystemReferencingObject implements IA * true that we only hold a SystemFilter. Hence, this is the same * as calling getReferenceFilter and casting the result. */ - public ISystemFilterContainer getReferencedSystemFilterContainer() - { + public ISystemFilterContainer getReferencedSystemFilterContainer() { return getReferencedFilter(); } + /** * Build and return an array of SystemFilterReference objects. * Each object is created new. There is one for each of the filters @@ -229,159 +214,141 @@ public class SystemFilterReference extends SystemReferencingObject implements IA * return a fresh one if something changes in the underlying * filter list. */ - public ISystemFilterReference[] getSystemFilterReferences(ISubSystem subSystem) - { - return containerHelper.getSystemFilterReferences(subSystem); - } - /** - * Create a single filter refererence to a given filter. - * If there already is a reference to this filter, it is returned. - * If not, a new reference is created and appended to the end of the existing filter reference array. - * @see #getExistingSystemFilterReference(ISubSystem, ISystemFilter) - */ - public ISystemFilterReference getSystemFilterReference(ISubSystem subSystem, ISystemFilter filter) - { - //return containerHelper.generateFilterReference(filter); - return containerHelper.generateAndRecordFilterReference(subSystem, filter); - } - /** - * Return an existing reference to a given system filter. - * If no reference currently exists to this filter, returns null. - * @see #getSystemFilterReference(ISubSystem, ISystemFilter) - */ - public ISystemFilterReference getExistingSystemFilterReference(ISubSystem subSystem, ISystemFilter filter) - { - return containerHelper.getExistingSystemFilterReference(subSystem, filter); - } - - /** - * Return true if the referenced pool or filter has filters. - */ - public boolean hasFilters() - { - return containerHelper.hasFilters(); - } + public ISystemFilterReference[] getSystemFilterReferences(ISubSystem subSystem) { + List references = containerHelper.getSystemFilterReferences(subSystem); + ISystemFilterReference[] result = new ISystemFilterReference[references.size()]; + references.toArray(result); + return result; + } - /** - * Return count of the number of filters in the referenced pool or filter - */ - public int getFilterCount() - { - return containerHelper.getFilterCount(); - } + /** + * Create a single filter refererence to a given filter. + * If there already is a reference to this filter, it is returned. + * If not, a new reference is created and appended to the end of the existing filter reference array. + * @see #getExistingSystemFilterReference(ISubSystem, ISystemFilter) + */ + public ISystemFilterReference getSystemFilterReference(ISubSystem subSystem, ISystemFilter filter) { + //return containerHelper.generateFilterReference(filter); + return containerHelper.generateAndRecordFilterReference(subSystem, filter); + } - /** - * Return the name of the SystemFilter or SystemFilterPool that we reference. - * For such objects this is what we show in the GUI. - */ - public String getName() - { + /** + * Return an existing reference to a given system filter. + * If no reference currently exists to this filter, returns null. + * @see #getSystemFilterReference(ISubSystem, ISystemFilter) + */ + public ISystemFilterReference getExistingSystemFilterReference(ISubSystem subSystem, ISystemFilter filter) { + return containerHelper.getExistingSystemFilterReference(subSystem, filter); + } + + /** + * Return true if the referenced pool or filter has filters. + */ + public boolean hasFilters() { + return containerHelper.hasFilters(); + } + + /** + * Return count of the number of filters in the referenced pool or filter + */ + public int getFilterCount() { + return containerHelper.getFilterCount(); + } + + /** + * Return the name of the SystemFilter or SystemFilterPool that we reference. + * For such objects this is what we show in the GUI. + */ + public String getName() { ISystemFilter filter = getReferencedFilter(); if (filter != null) - return filter.getName(); + return filter.getName(); else - return ""; //$NON-NLS-1$ + return ""; //$NON-NLS-1$ } - + /** * Override of Object method. Turn this filter in an outputable string */ - public String toString() - { + public String toString() { return getName(); } - - // ------------------------------------------------- - // Methods for returning filter string references... - // ------------------------------------------------- - /** - * Return the number of filter strings in the referenced filter - */ - public int getSystemFilterStringCount() - { - int count = 0; - ISystemFilter referencedFilter = getReferencedFilter(); - if (referencedFilter != null) - count = referencedFilter.getFilterStringCount(); - return count; - } - /** - * Get the filter strings contained by this filter. But get references to each, - * not the masters. - */ - public ISystemFilterStringReference[] getSystemFilterStringReferences() - { - // These reference objects are built on the fly, each time, rather than - // maintaining a persisted list of such references. The reason - // is we do no at this time allow users to subset the master list - // of strings maintained by a filter. Hence, we always simply - // return a complete list. However, to save memory we try to only - // re-gen the list if something has changed. - java.util.List mofList = getReferencedFilter().getStrings(); - boolean needToReGen = compareFilterStrings(mofList); - if (needToReGen) - referencedFilterStrings = generateFilterStringReferences(mofList); - return referencedFilterStrings; - } - /** - * Create a single filter string refererence to a given filter string - */ - public ISystemFilterStringReference getSystemFilterStringReference(ISystemFilterString filterString) - { - return new SystemFilterStringReference(this, filterString); - } + // ------------------------------------------------- + // Methods for returning filter string references... + // ------------------------------------------------- + /** + * Return the number of filter strings in the referenced filter + */ + public int getSystemFilterStringCount() { + int count = 0; + ISystemFilter referencedFilter = getReferencedFilter(); + if (referencedFilter != null) count = referencedFilter.getFilterStringCount(); + return count; + } - - /** - * To save memory, we try to only regenerate the referenced filter list - * if something has changed. - */ - private boolean compareFilterStrings(java.util.List newFilterStrings) - { - boolean mustReGen = false; - if (newFilterStrings == null) - { - if (referencedFilterStrings != null) - return true; - else - return false; - } - else if (referencedFilterStrings == null) - { - return true; // newFilterStrings != null && referencedFilterStrings == null - } - // both old and new are non-null - if (newFilterStrings.size() != referencedFilterStrings.length) - return true; - Iterator i = newFilterStrings.iterator(); - for (int idx=0; !mustReGen && (idx - * This method is called after restore and for each restored object in the list must: - *

    - *
  1. Do what is necessary to find the referenced object, and set the internal reference pointer. - *
  2. Call addReference(this) on that object so it can maintain it's in-memory list - * of all referencing objects. - *
- * @return true if resolved successfully. False if some references were not found and - * hence those referencing objects removed from the restored list. - */ - public boolean resolveReferencesAfterRestore(); - /** * @generated This field/method will be replaced during code generation * @return The value of the Name attribute diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/SubSystemFilterNamingPolicy.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/SubSystemFilterNamingPolicy.java deleted file mode 100644 index 7256d1feeaa..00000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/SubSystemFilterNamingPolicy.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.rse.core.subsystems; - -import org.eclipse.rse.core.filters.IRSEFilterNamingPolicy; -import org.eclipse.rse.core.filters.SystemFilterNamingPolicy; - -/** - * A filter naming policy is responsible for returning the save file names for - * a given filter framework object. - * This policy implements our naming policy for the filter files in the - * remote systems project. - */ -public class SubSystemFilterNamingPolicy extends SystemFilterNamingPolicy implements IRSEFilterNamingPolicy { - - /** - * Constructor for SubSystemFilterNamingPolicy - */ - public SubSystemFilterNamingPolicy() { - super(); - } - - /** - * Get the unqualified save file name for the given SystemFilterPoolManager object. - * Do NOT include the extension, as .xmi will be added. - *

- * Returns "filterPools_"+managerName by default. - */ - public String getManagerSaveFileName(String managerName) { - return super.getManagerSaveFileName(managerName); - } - - /** - * Get the unqualified save file name for the given SystemFilterPoolReferenceManager object. - * Do NOT include the extension, as .xmi will be added. - *

- * Returns "filterPoolRefs_"+managerName by default. - */ - public String getReferenceManagerSaveFileName(String managerName) { - return super.getReferenceManagerSaveFileName(managerName); - } - - /** - * Get the unqualified save file name for the given SystemFilterPool object. - * Do NOT include the extension, as .xmi will be added. - *

- * Returns getFilterPoolSaveFileNamePrefix()+poolName by default. - */ - public String getFilterPoolSaveFileName(String poolName) { - return super.getFilterPoolSaveFileName(poolName); - } - - /** - * Get the file name prefix for all pool files. - * Used to deduce the saved pools by examining the file system - *

- * By default returns "filterPool_" - */ - public String getFilterPoolSaveFileNamePrefix() { - return super.getFilterPoolSaveFileNamePrefix(); - } - - /** - * Get the folder name for the given SystemFilterPool object. - *

- * Returns getFilterPoolFolderNamePrefix()+poolName by default. - */ - public String getFilterPoolFolderName(String poolName) { - return super.getFilterPoolFolderName(poolName); - } - - /** - * Get the folder name prefix for all pool folders. - * Used to deduce the saved pools by examining the file system - *

- * By default returns "FilterPool_" - */ - public String getFilterPoolFolderNamePrefix() { - return super.getFilterPoolFolderNamePrefix(); - } - - /** - * Get the unqualified save file name for the given SystemFilter object. - * Do NOT include the extension, as .xmi will be added. - *

- * Returns getFilterSaveFileNamePrefix()+filterName by default. - */ - public String getFilterSaveFileName(String filterName) { - return super.getFilterSaveFileName(filterName); - } - - /** - * Get the file name prefix for all filter files. - * Used to deduce the saved filters by examining the file system - *

- * Returns "Filter_" by default. - */ - public String getFilterSaveFileNamePrefix() { - return super.getFilterSaveFileNamePrefix(); - } - -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilter.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilter.java index 17a4b6a117a..60391e6068a 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilter.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilter.java @@ -20,17 +20,14 @@ package org.eclipse.rse.internal.core.filters; -import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.Vector; -import org.eclipse.core.resources.IFolder; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.Platform; -import org.eclipse.rse.core.filters.IRSEFilterNamingPolicy; import org.eclipse.rse.core.filters.ISystemFilter; import org.eclipse.rse.core.filters.ISystemFilterContainer; import org.eclipse.rse.core.filters.ISystemFilterPool; @@ -81,7 +78,7 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte * Private internal way to get filters. Makes it easy to change in future, if we don't use MOF. */ private List internalGetFilters() { - return getNestedFilters(); + return nestedFilters; } /** @@ -114,7 +111,7 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte * @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(String aliasName, Vector filterStrings) { + public ISystemFilter createSystemFilter(String aliasName, String[] filterStrings) { ISystemFilter newFilter = helpers.createSystemFilter(internalGetFilters(), getParentFilterPool(), aliasName, filterStrings); newFilter.setSupportsNestedFilters(true); // presumably it does since it is nested itself. newFilter.setSupportsDuplicateFilterStrings(supportsDuplicateFilterStrings()); @@ -126,7 +123,6 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte * Internal use method */ public void initializeFilterStrings() { - List filterStrings = getStrings(); Iterator i = filterStrings.iterator(); while (i.hasNext()) ((ISystemFilterString) i.next()).setParentSystemFilter(this); @@ -241,15 +237,12 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte * Return Vector of String objects: the names of existing filters in this container. * Needed by name validators for New and Rename actions to verify new name is unique. */ - public Vector getSystemFilterNames() { - return helpers.getSystemFilterNames(internalGetFilters()); - } - - /** - * Return the nested filters as a Vector - */ - public Vector getSystemFiltersVector() { - return helpers.getSystemFiltersVector(internalGetFilters()); + public String[] getSystemFilterNames() { + List filters = internalGetFilters(); + List names = helpers.getSystemFilterNames(filters); + String[] result = new String[names.size()]; + names.toArray(result); + return result; } /** @@ -385,26 +378,6 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte return result; } - /** - * Return filter strings as a Vector of String objects. - * This vector may be empty but will never be null. - */ - public Vector getFilterStringsVector() { - String[] strings = getFilterStrings(); - List stringList = Arrays.asList(strings); - Vector result = new Vector(stringList); - return result; - } - - /** - * Get this filter's filter strings as a Vector of FilterString objects - */ - public Vector getFilterStringObjectsVector() { - Vector result = new Vector(filterStrings.size()); - result.addAll(filterStrings); - return result; - } - /** * Return how many filter strings are defined in this filter. */ @@ -448,7 +421,7 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte } /** - * Get this filter's filter string objects as an array + * Get this filter's filter string objects as an array. */ public ISystemFilterString[] getSystemFilterStrings() { ISystemFilterString[] result = new ISystemFilterString[filterStrings.size()]; @@ -576,16 +549,17 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte * This is all nested filters and all filter strings. */ public Object[] getChildren() { - Vector strings = getFilterStringsVector(); - Vector filters = getSystemFiltersVector(); + String[] strings = getFilterStrings(); + ISystemFilter[] filters = getSystemFilters(); Vector vChildren = new Vector(); // start with nested filters... - for (int idx = 0; idx < filters.size(); idx++) - vChildren.addElement(filters.elementAt(idx)); + for (int idx = 0; idx < filters.length; idx++) { + vChildren.addElement(filters[idx]); + } // continue with resolved filter string objects... - for (int idx = 0; idx < strings.size(); idx++) { - String filterString = (String) strings.elementAt(idx); + for (int idx = 0; idx < strings.length; idx++) { + String filterString = strings[idx]; vChildren.addElement(filterString); } @@ -630,71 +604,6 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte return null; } - // ----------------------- - // SAVE/RESTORE METHODS... - // ----------------------- - - /** - * Restore specific filter. Used when save policy is SAVE_POLICY_ONE_FILE_PER_FILTER - * @param folder the folder containing the saved file. - * @param name The name of the saved filter. The file name is derived from this. - * @param parentPool the SystemFilterPool that is the parent of this filter. Will be perpetuated to nested filters. - * @param namingPolicy Tells us how to derive file name from filter name. Can be null for default prefix name. - * @return SystemFilter object if restored ok, null if error encountered. If null, call getLastException(). - * @deprecated no longer used - */ - public static ISystemFilter restore(IFolder folder, String name, ISystemFilterPool parentPool, IRSEFilterNamingPolicy namingPolicy) throws Exception { - /* code no longer needed since restore is done by importers, not by MOF/EMF - String fileName = getRootSaveFileName(namingPolicy, name); - - List ext = mofHelpers.restore(folder,fileName); - - // should be exactly one... - Iterator iList = ext.iterator(); - SystemFilter filter = (SystemFilter)iList.next(); - if (parentPool != null) - filter.setParentFilterPool(parentPool); - ((SystemFilterImpl)filter).initializeFilterStrings(); - return filter; - */ - return null; - } - - /** - * Return the root save file name without the extension .xmi - * @deprecated no longer used - */ - protected static String getRootSaveFileName(ISystemFilter filter) { - return getRootSaveFileName(getNamingPolicy(filter), filter.getName()); - } - - /** - * Return the root save file name without the extension .xmi - * @deprecated no longer used - */ - protected static String getRootSaveFileName(IRSEFilterNamingPolicy namingPolicy, String name) { - return namingPolicy.getFilterSaveFileName(name); - } - - /** - * Return naming policy - * @deprecated no longer used - */ - protected static IRSEFilterNamingPolicy getNamingPolicy(ISystemFilter filter) { - return filter.getParentFilterPool().getNamingPolicy(); - } - - /** - * Ensure given path ends with path separator. - * @deprecated no longer used - */ - public static String addPathTerminator(String path) { - if (!path.endsWith(File.separator)) path = path + File.separatorChar; - //else - // path = path; - return path; - } - /*------------------- * Attribute getters and setters *-------------------*/ @@ -841,18 +750,22 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte /* (non-Javadoc) * @see org.eclipse.rse.core.filters.ISystemFilter#getNestedFilters() */ - public List getNestedFilters() { + public ISystemFilter[] getNestedFilters() { if (nestedFilters == null) { nestedFilters = new ArrayList(); } - return nestedFilters; + ISystemFilter[] result = new ISystemFilter[nestedFilters.size()]; + nestedFilters.toArray(result); + return result; } /* (non-Javadoc) * @see org.eclipse.rse.core.filters.ISystemFilter#getStrings() */ - public List getStrings() { - return filterStrings; + public ISystemFilterString[] getStrings() { + ISystemFilterString[] result = new ISystemFilterString[filterStrings.size()]; + filterStrings.toArray(result); + return result; } /* (non-Javadoc) @@ -1014,8 +927,7 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte */ public IRSEPersistableContainer[] getPersistableChildren() { List children = new ArrayList(20); - List nf = getNestedFilters(); // guaranteed to not be null, none of these should be simple filters - children.addAll(nf); + children.addAll(nestedFilters); children.addAll(filterStrings); children.addAll(Arrays.asList(getPropertySets())); IRSEPersistableContainer[] result = new IRSEPersistableContainer[children.size()]; diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterContainerCommonMethods.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterContainerCommonMethods.java index e00caace3b6..2f93383a62a 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterContainerCommonMethods.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterContainerCommonMethods.java @@ -65,7 +65,7 @@ public class SystemFilterContainerCommonMethods * @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(java.util.List filters, ISystemFilterPool parentPool, String aliasName, Vector filterStrings) { + public ISystemFilter createSystemFilter(java.util.List filters, ISystemFilterPool parentPool, String aliasName, String[] filterStrings) { ISystemFilter newFilter = null; // FIXME - not using error message and null return @@ -95,7 +95,7 @@ public class SystemFilterContainerCommonMethods * @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(Vector filters, ISystemFilterPool parentPool, String aliasName, Vector filterStrings) { + public ISystemFilter createSystemFilter(Vector filters, ISystemFilterPool parentPool, String aliasName, String[] filterStrings) { ISystemFilter newFilter = null; boolean exists = getSystemFilter(filters, aliasName) != null; if (exists) { @@ -112,7 +112,7 @@ public class SystemFilterContainerCommonMethods * Internal encapsulation of mof effort to create new filter, and setting of * the core attributes. */ - private ISystemFilter internalCreateSystemFilter(ISystemFilterPool parentPool, String aliasName, Vector filterStrings) { + private ISystemFilter internalCreateSystemFilter(ISystemFilterPool parentPool, String aliasName, String[] filterStrings) { ISystemFilter newFilter = null; try { newFilter = new SystemFilter(); @@ -415,7 +415,7 @@ public class SystemFilterContainerCommonMethods */ public ISystemFilter cloneSystemFilter(java.util.List filters, ISystemFilter filter, String aliasName) { - ISystemFilter copy = createSystemFilter(filters, filter.getParentFilterPool(), aliasName, filter.getFilterStringsVector()); + ISystemFilter copy = createSystemFilter(filters, filter.getParentFilterPool(), aliasName, filter.getFilterStrings()); internalAfterCloneSystemFilter(filter, copy); // now clone nested filters... ISystemFilter[] nested = filter.getSystemFilters(); @@ -433,7 +433,7 @@ public class SystemFilterContainerCommonMethods */ public ISystemFilter cloneSystemFilter(Vector filters, ISystemFilter filter, String aliasName) { - ISystemFilter copy = createSystemFilter(filters, filter.getParentFilterPool(), aliasName, filter.getFilterStringsVector()); + ISystemFilter copy = createSystemFilter(filters, filter.getParentFilterPool(), aliasName, filter.getFilterStrings()); internalAfterCloneSystemFilter(filter, copy); // now clone nested filters... ISystemFilter[] nested = filter.getSystemFilters(); diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterContainerReferenceCommonMethods.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterContainerReferenceCommonMethods.java index 86c9048bb4b..962398d6477 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterContainerReferenceCommonMethods.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterContainerReferenceCommonMethods.java @@ -16,6 +16,9 @@ *******************************************************************************/ package org.eclipse.rse.internal.core.filters; + +import java.util.ArrayList; +import java.util.Arrays; import java.util.Iterator; import java.util.List; @@ -27,8 +30,6 @@ import org.eclipse.rse.core.filters.ISystemFilterReference; import org.eclipse.rse.core.filters.SystemFilterReference; import org.eclipse.rse.core.subsystems.ISubSystem; - - /** * Both SystemFilter and SystemFilterPool contain filters, so the * common methods for filters are abstracted out in SystemFilterContainer, @@ -42,220 +43,158 @@ import org.eclipse.rse.core.subsystems.ISubSystem; * SystemFilterReferenceImpl and SystemFilterPoolReferenceImpl use this via * containment. */ -public class SystemFilterContainerReferenceCommonMethods -{ - private ISystemFilterContainerReference parentRef = null; - private ISystemFilterReference[] referencedFilters = null; - +public class SystemFilterContainerReferenceCommonMethods { + + private ISystemFilterContainerReference parentRef = null; + private List filterReferences = new ArrayList(10); + /** * Constructor * @param parentRef the object we are helping. */ - public SystemFilterContainerReferenceCommonMethods(ISystemFilterContainerReference parentRef) - { + public SystemFilterContainerReferenceCommonMethods(ISystemFilterContainerReference parentRef) { super(); this.parentRef = parentRef; } - /** - * Return the name of the SystemFilter or SystemFilterPool that we reference. - */ - public String getName() - { - ISystemFilterContainer parent = parentRef.getReferencedSystemFilterContainer(); - String name = null; - if (parent instanceof ISystemFilterPool) - name = ((ISystemFilterPool)parent).getName(); - else - name = ((ISystemFilter)parent).getName(); - return name; + /** + * Return true if the referenced pool or filter has filters. + */ + public boolean hasFilters() { + return getFilterCount() > 0; + } + + /** + * Return count of the number of filters in the referenced pool or filter + */ + public int getFilterCount() { + List filters = getFiltersFromParent(); + int count = filters.size(); + return count; + } + + /** + * Get the list of nested filters referenced by this ISystemFilterContainerReference. + */ + public List getSystemFilterReferences(ISubSystem subSystem) { + generateSystemFilterReferences(subSystem); + return filterReferences; + } + + /** + * Refreshes the list of filter references. + * @param subSystem + */ + private void generateSystemFilterReferences(ISubSystem subSystem) { + List filters = getFiltersFromParent(); + if (mustGenerate(filters)) { + generateFilterReferences(subSystem, filters); + } + } + + /** + * Determine if the list of filter references is stale. + */ + private boolean mustGenerate(List filters) { + boolean result = true; + List referencedFilters = getReferencedFilters(); + if (filters.size() == referencedFilters.size()) { + int n = filters.size(); + int i = 0; + result = false; + while (i < n && result == false) { + ISystemFilter filter = (ISystemFilter) filters.get(i); + ISystemFilter referencedFilter = (ISystemFilter) referencedFilters.get(i); + if (filter != referencedFilter) { + result = true; + } + i++; + } + } + return result; } - /** - * Return true if the referenced pool or filter has filters. - */ - public boolean hasFilters() - { - return getFilterCount() > 0; - } + /** + * @return the list of currently referenced filters + */ + private List getReferencedFilters() { + List result = new ArrayList(filterReferences.size()); + for (Iterator z = filterReferences.iterator(); z.hasNext();) { + ISystemFilterReference reference = (ISystemFilterReference) z.next(); + result.add(reference.getReferencedFilter()); + } + return result; + } - /** - * Return count of the number of filters in the referenced pool or filter - */ - public int getFilterCount() - { - int count = 0; - ISystemFilterContainer parent = parentRef.getReferencedSystemFilterContainer(); - java.util.List mofList = null; - if (parent instanceof ISystemFilterPool) - mofList = ((ISystemFilterPool)parent).getFilters(); - else - mofList = ((ISystemFilter)parent).getNestedFilters(); - if (mofList != null) - count = mofList.size(); - return count; - } + /** + * Generate references to the filters in the list. + * Attempt to preserve existing references where they are available. + */ + private void generateFilterReferences(ISubSystem subSystem, List filters) { + List referencedFilters = getReferencedFilters(); + List newReferences = new ArrayList(filters.size()); + for (Iterator z = filters.iterator(); z.hasNext();) { + ISystemFilter filter = (ISystemFilter) z.next(); + int i = referencedFilters.indexOf(filter); + ISystemFilterReference reference = (i >= 0) ? (ISystemFilterReference) filterReferences.get(i) : generateFilterReference(subSystem, filter); + newReferences.add(reference); + } + filterReferences = newReferences; + } - /** - * Get the list of nested filters referenced by this ISystemFilterContainerReference. - */ - public ISystemFilterReference[] getSystemFilterReferences(ISubSystem subSystem) - { - - // These reference objects are built on the fly, each time, rather than - // maintaining a persisted list of such references. The reason - // is we do not at this time allow users to subset the master list - // of filters maintained by a filterpool. Hence, we always simply - // return a complete list. However, to save memory we try to only - // re-gen the list if something has changed. - ISystemFilterContainer parent = parentRef.getReferencedSystemFilterContainer(); - List mofList = null; - if (parent instanceof ISystemFilterPool) - mofList = ((ISystemFilterPool)parent).getFilters(); - else if (parent instanceof ISystemFilter) { - mofList = ((ISystemFilter)parent).getNestedFilters(); - } - boolean needToReGen = compareFilters(mofList); - //System.out.println("In getSFRefs for " + getName() + ": regen? " + needToReGen); - - if (needToReGen) - { - // first, need remove backward references... - - // second, build new references... - referencedFilters = generateFilterReferences(subSystem, mofList); - } - if (referencedFilters == null) { - referencedFilters = new ISystemFilterReference[0]; - } - return referencedFilters; - } - - /** - * To save memory, we try to only regenerate the referenced filter list - * if something has changed. - */ - private boolean compareFilters(java.util.List newFilters) - { - boolean mustReGen = false; - if (newFilters == null) - { - if (referencedFilters != null) - return true; - else - return false; - } - else if (referencedFilters == null) - { - return true; // newFilters != null && referencedFilters == null - } - // both old and new are non-null - if (newFilters.size() != referencedFilters.length) - return true; - Iterator i = newFilters.iterator(); - for (int idx=0; !mustReGen && (idx0)) - { - for (int idx=0; (ref==null) && (idxName}' attribute. - * - * * @see #getName() - * @generated - * @ordered */ protected static final String NAME_EDEFAULT = null; private String name; /** * The default value of the '{@link #getType() Type}' attribute. - * - * * @see #getType() - * @generated - * @ordered */ protected static final String TYPE_EDEFAULT = null; - private int savePolicy; - private IRSEFilterNamingPolicy namingPolicy = null; private ISystemFilterPoolManager mgr; private SystemFilterContainerCommonMethods helpers = null; private Object filterPoolData = null; @@ -93,13 +78,10 @@ public class SystemFilterPool extends SystemPersistableReferencedObject * @generated This field/method will be replaced during code generation. */ protected String type = TYPE_EDEFAULT; + /** * The default value of the '{@link #isSupportsNestedFilters() Supports Nested Filters}' attribute. - * - * * @see #isSupportsNestedFilters() - * @generated - * @ordered */ protected static final boolean SUPPORTS_NESTED_FILTERS_EDEFAULT = false; @@ -107,41 +89,33 @@ public class SystemFilterPool extends SystemPersistableReferencedObject * @generated This field/method will be replaced during code generation. */ protected boolean supportsNestedFilters = SUPPORTS_NESTED_FILTERS_EDEFAULT; + /** * The default value of the '{@link #isDeletable() Deletable}' attribute. - * - * * @see #isDeletable() - * @generated - * @ordered */ protected static final boolean DELETABLE_EDEFAULT = false; /** * @generated This field/method will be replaced during code generation. */ + protected boolean deletable = DELETABLE_EDEFAULT; /** * The default value of the '{@link #isDefault() Default}' attribute. - * - * * @see #isDefault() - * @generated - * @ordered */ + protected static final boolean DEFAULT_EDEFAULT = false; /** * @generated This field/method will be replaced during code generation. */ protected boolean default_ = DEFAULT_EDEFAULT; + /** * The default value of the '{@link #isStringsCaseSensitive() Strings Case Sensitive}' attribute. - * - * * @see #isStringsCaseSensitive() - * @generated - * @ordered */ protected static final boolean STRINGS_CASE_SENSITIVE_EDEFAULT = false; @@ -149,22 +123,15 @@ public class SystemFilterPool extends SystemPersistableReferencedObject * @generated This field/method will be replaced during code generation. */ protected boolean stringsCaseSensitive = STRINGS_CASE_SENSITIVE_EDEFAULT; + /** * This is true if the Strings Case Sensitive attribute has been set. - * - * - * @generated - * @ordered */ protected boolean stringsCaseSensitiveESet = false; /** * The default value of the '{@link #isSupportsDuplicateFilterStrings() Supports Duplicate Filter Strings}' attribute. - * - * * @see #isSupportsDuplicateFilterStrings() - * @generated - * @ordered */ protected static final boolean SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT = false; @@ -172,13 +139,10 @@ public class SystemFilterPool extends SystemPersistableReferencedObject * @generated This field/method will be replaced during code generation. */ protected boolean supportsDuplicateFilterStrings = SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT; + /** * The default value of the '{@link #getRelease() Release}' attribute. - * - * * @see #getRelease() - * @generated - * @ordered */ protected static final int RELEASE_EDEFAULT = 0; @@ -186,79 +150,52 @@ public class SystemFilterPool extends SystemPersistableReferencedObject * @generated This field/method will be replaced during code generation. */ protected int release = RELEASE_EDEFAULT; + /** * The default value of the '{@link #isSingleFilterStringOnly() Single Filter String Only}' attribute. - * - * * @see #isSingleFilterStringOnly() - * @generated - * @ordered */ protected static final boolean SINGLE_FILTER_STRING_ONLY_EDEFAULT = false; /** * The cached value of the '{@link #isSingleFilterStringOnly() Single Filter String Only}' attribute. - * - * * @see #isSingleFilterStringOnly() - * @generated - * @ordered */ protected boolean singleFilterStringOnly = SINGLE_FILTER_STRING_ONLY_EDEFAULT; /** * This is true if the Single Filter String Only attribute has been set. - * - * - * @generated - * @ordered */ protected boolean singleFilterStringOnlyESet = false; /** * The default value of the '{@link #getOwningParentName() Owning Parent Name}' attribute. - * - * * @see #getOwningParentName() - * @generated - * @ordered */ protected static final String OWNING_PARENT_NAME_EDEFAULT = null; /** * The cached value of the '{@link #getOwningParentName() Owning Parent Name}' attribute. - * - * * @see #getOwningParentName() - * @generated - * @ordered */ protected String owningParentName = OWNING_PARENT_NAME_EDEFAULT; /** * The default value of the '{@link #isNonRenamable() Non Renamable}' attribute. - * - * * @see #isNonRenamable() - * @generated - * @ordered */ protected static final boolean NON_RENAMABLE_EDEFAULT = false; /** * The cached value of the '{@link #isNonRenamable() Non Renamable}' attribute. - * - * * @see #isNonRenamable() - * @generated - * @ordered */ protected boolean nonRenamable = NON_RENAMABLE_EDEFAULT; /** * @generated This field/method will be replaced during code generation. */ - protected java.util.List filters = null; + protected List filters = new ArrayList(10); /** * Default constructor @@ -269,7 +206,7 @@ public class SystemFilterPool extends SystemPersistableReferencedObject helpers = new SystemFilterContainerCommonMethods(); setRelease(RSECorePlugin.CURRENT_RELEASE); if (!initialized) { - initialize(poolName, savePolicy, namingPolicy); + initialize(poolName); } setDeletable(isDeletable); // mof attribute setSupportsNestedFilters(allowNestedFilters); // cascades to each filter @@ -278,22 +215,16 @@ public class SystemFilterPool extends SystemPersistableReferencedObject /* * Private helper method to core initialization, from either createXXX or restore. */ - protected void initialize(String name, - int savePolicy, IRSEFilterNamingPolicy namingPolicy) + protected void initialize(String name) { setName(name); // mof attribute - setSavePolicy(savePolicy); - setNamingPolicy(namingPolicy); - initialized = true; } - //protected Vector internalGetFilters() - protected java.util.List internalGetFilters() + protected List internalGetFilters() { - //return filters; - return getFilters(); // mof-supplied in parent class + return filters; } /** @@ -308,47 +239,6 @@ public class SystemFilterPool extends SystemPersistableReferencedObject return null; } - /** - * Set the save file policy. See constants in {@link org.eclipse.rse.internal.core.filters.ISystemFilterConstants SystemFilterConstants}. - * One of: - *

- * This method is called by the SystemFilterPoolManager. - */ - public void setSavePolicy(int policy) - { - if (this.savePolicy != policy) - { - this.savePolicy = policy; - setDirty(true); - } - } - - /** - * Set the naming policy used when saving data to disk. - * @see org.eclipse.rse.core.filters.IRSEFilterNamingPolicy - */ - public void setNamingPolicy(IRSEFilterNamingPolicy namingPolicy) - { - if (this.namingPolicy != namingPolicy) - { - this.namingPolicy = namingPolicy; - setDirty(true); - } - } - - /** - * Get the naming policy currently used when saving data to disk. - * @see org.eclipse.rse.core.filters.IRSEFilterNamingPolicy - */ - public IRSEFilterNamingPolicy getNamingPolicy() - { - return namingPolicy; - } - /** * Set whether filters in this pool support nested filters. * Important to note this is stored in every filter as well as this filter pool. @@ -361,12 +251,11 @@ public class SystemFilterPool extends SystemPersistableReferencedObject for (int idx=0; idx - * - * @generated + * @param newSupportsNestedFilters */ - public void setSupportsNestedFiltersGen(boolean newSupportsNestedFilters) + private void setSupportsNestedFiltersGen(boolean newSupportsNestedFilters) { supportsNestedFilters = newSupportsNestedFilters; } @@ -383,12 +272,11 @@ public class SystemFilterPool extends SystemPersistableReferencedObject for (int idx=0; idx - * - * @generated + * @param newSupportsDuplicateFilterStrings */ - public void setSupportsDuplicateFilterStringsGen(boolean newSupportsDuplicateFilterStrings) + private void setSupportsDuplicateFilterStringsGen(boolean newSupportsDuplicateFilterStrings) { supportsDuplicateFilterStrings = newSupportsDuplicateFilterStrings; setDirty(true); @@ -407,12 +295,8 @@ public class SystemFilterPool extends SystemPersistableReferencedObject filters[idx].setStringsCaseSensitive(supports); setDirty(true); } - /** - * - * - * @generated - */ - public void setStringsCaseSensitiveGen(boolean newStringsCaseSensitive) + + private void setStringsCaseSensitiveGen(boolean newStringsCaseSensitive) { stringsCaseSensitive = newStringsCaseSensitive; stringsCaseSensitiveESet = true; @@ -502,20 +386,16 @@ public class SystemFilterPool extends SystemPersistableReferencedObject return type; } - /** - * - * - * @generated + /* (non-Javadoc) + * @see org.eclipse.rse.core.filters.ISystemFilterPool#isDeletable() */ public boolean isDeletable() { return deletable; } - /** - * - * - * @generated + /* (non-Javadoc) + * @see org.eclipse.rse.core.filters.ISystemFilterPool#setDeletable(boolean) */ public void setDeletable(boolean newDeletable) { @@ -523,20 +403,16 @@ public class SystemFilterPool extends SystemPersistableReferencedObject setDirty(true); } - /** - * - * - * @generated + /* (non-Javadoc) + * @see org.eclipse.rse.core.filters.ISystemFilterPool#isDefault() */ public boolean isDefault() { return default_; } - /** - * - * - * @generated + /* (non-Javadoc) + * @see org.eclipse.rse.core.filters.ISystemFilterPool#setDefault(boolean) */ public void setDefault(boolean newDefault) { @@ -673,7 +549,7 @@ public class SystemFilterPool extends SystemPersistableReferencedObject * @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(String aliasName, Vector filterStrings) + public ISystemFilter createSystemFilter(String aliasName, String[] filterStrings) { ISystemFilter newFilter = helpers.createSystemFilter(internalGetFilters(), this, aliasName, filterStrings); newFilter.setSupportsNestedFilters(supportsNestedFilters()); @@ -687,18 +563,15 @@ public class SystemFilterPool extends SystemPersistableReferencedObject * Return Vector of String objects: the names of existing filters in this container. * Needed by name validators for New and Rename actions to verify new name is unique. */ - public Vector getSystemFilterNames() + public String[] getSystemFilterNames() { - return helpers.getSystemFilterNames(internalGetFilters()); + List filters = internalGetFilters(); + List names = helpers.getSystemFilterNames(filters); + String[] result = new String[names.size()]; + names.toArray(result); + return result; } - /** - * Return the nested filters as a Vector - */ - public Vector getSystemFiltersVector() - { - return helpers.getSystemFiltersVector(internalGetFilters()); - } /** * Return how many filters are defined in this filter container */ @@ -804,23 +677,6 @@ public class SystemFilterPool extends SystemPersistableReferencedObject return Platform.getAdapterManager().getAdapter(this, adapterType); } - /** - * Private helper method to deduce filter names from disk files. - * Will populate and return a list. - * Only makes sense to use if the save policy is one file per filter. - */ - protected static Vector deduceFilterNames(IFolder folder, IRSEFilterNamingPolicy namingPolicy) - { - Vector filterNames = SystemResourceHelpers.getResourceHelpers().convertToVectorAndStrip( - SystemResourceHelpers.getResourceHelpers().listFiles(folder, - namingPolicy.getFilterSaveFileNamePrefix(), - ISystemFilterConstants.SAVEFILE_SUFFIX), - namingPolicy.getFilterSaveFileNamePrefix(), ISystemFilterConstants.SAVEFILE_SUFFIX); - return filterNames; - } - - - /** * Order filters according to user preferences. *

@@ -832,14 +688,13 @@ public class SystemFilterPool extends SystemPersistableReferencedObject */ public void orderSystemFilters(String[] names) { - java.util.List filterList = internalGetFilters(); - ISystemFilter[] filters = new ISystemFilter[names.length]; - for (int idx=0; idx - *

  • SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL - one file and folder per pool - *
  • SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER - one file per pool, all files in one folder - *
  • SAVE_POLICY_ONE_FILE_PER_FILTER - one file per filter, one folder per pool - * - * @param namingPolicy The names to use for file and folders when persisting to disk. Pass - * null to just use the defaults. - * @return SystemFilterPool object if restored ok, null if error encountered. If null, call getLastException(). - * @see org.eclipse.rse.internal.core.filters.ISystemFilterConstants - */ - protected static ISystemFilterPool restore(String name, int savePolicy, - IRSEFilterNamingPolicy namingPolicy) - throws Exception - { - if (namingPolicy == null) - namingPolicy = SystemFilterNamingPolicy.getNamingPolicy(); - - // FIXME SystemFilterImpl.initMOF(); // to be safe - - ISystemFilterPool pool = null; - /* FIXME - SystemFilterPool poolImpl = null; - switch(savePolicy) - { - case SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL: - pool = restoreFromOneFile(mofHelpers, folder, name, namingPolicy, true); - poolImpl = (SystemFilterPoolImpl)pool; - break; - - case SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER: - pool = restoreFromOneFile(mofHelpers, folder, name, namingPolicy, true); - poolImpl = (SystemFilterPoolImpl)pool; - break; - - case SAVE_POLICY_ONE_FILE_PER_FILTER: - pool = restoreFromOneFile(mofHelpers, folder, name, namingPolicy, false); // restore data part - poolImpl = (SystemFilterPoolImpl)pool; - //pool = createPool(); - - poolImpl.setFolder(folder); // SystemFilter's restore will query it - pool.setNamingPolicy(namingPolicy); // SystemFilter's restore will query it - Vector filterNames = deduceFilterNames(folder, namingPolicy); - if (filterNames != null) - { - Exception lastException = null; - for (int idx=0; idx - * This method is called after restore and for each restored object in the list must: - *
      - *
    1. Do what is necessary to find the referenced object, and set the internal reference pointer. - *
    2. Call addReference(this) on that object so it can maintain it's in-memory list of all referencing objects. - *
    3. Set the important transient variables - *
    - * @param relatedPoolMgrProvider the filter pool manager provider that created the filter pools we reference - * (usually a subsystem configuration) - * @param provider the host of this reference manager, so you can later call getProvider - * @return A Vector of SystemFilterPoolReferences that were not successfully resolved, or null if all - * were resolved. - */ - public Vector resolveReferencesAfterRestore(ISystemFilterPoolManagerProvider relatedPoolMgrProvider, ISystemFilterPoolReferenceManagerProvider provider) { - setSystemFilterPoolManagerProvider(relatedPoolMgrProvider); - setProvider(provider); - ISystemFilterPoolManager[] relatedManagers = getSystemFilterPoolManagers(); - if (relatedManagers != null) { - Vector badRefs = new Vector(); - ISystemFilterPoolReference[] poolRefs = getSystemFilterPoolReferences(); - if (poolRefs != null) { - for (int idx = 0; idx < poolRefs.length; idx++) { - String poolName = poolRefs[idx].getReferencedFilterPoolName(); - String mgrName = poolRefs[idx].getReferencedFilterPoolManagerName(); - - ISystemFilterPool refdPool = getFilterPool(relatedManagers, mgrName, poolName); - if ((refdPool == null) && (getFilterPoolManager(relatedManagers, mgrName) == null)) { - //System.out.println("...looking for broken reference for "+mgrName+"."+poolName); - refdPool = relatedPoolMgrProvider.getSystemFilterPoolForBrokenReference(this, mgrName, poolName); - } - if (refdPool != null) { - poolRefs[idx].setReferenceToFilterPool(refdPool); // calls refdPool.addReference(poolRef) - } else { - badRefs.addElement(poolRefs[idx]); - } - } - if (badRefs.size() == 0) - return null; - else { - for (int idx = 0; idx < badRefs.size(); idx++) { - ISystemFilterPoolReference badRef = (ISystemFilterPoolReference) badRefs.elementAt(idx); - //badRef.setReferenceBroken(true); - super.removeReferencingObject(badRef); - } - invalidateFilterPoolReferencesCache(); - quietSave(); - return badRefs; - } - } - } - return null; - } - /** * Utility method to scan across all filter pools in a given named filter pool manager, for a match * on a given filter pool name. @@ -967,80 +668,6 @@ public class SystemFilterPoolReferenceManager extends SystemPersistableReference // HELPER METHODS... // ------------------ - /** - * If saving all info in one file, this returns the fully qualified name of that file, - * given the unadorned manager name and the prefix (if any) to adorn with. - * No longer used. - * @param mgrFolder The folder in which to save a reference manager. - * @param name The name of the file for a filter pool reference manager. - * @param namingPolicy The naming policy for a filter pool reference manager - * @return The name of the path to which to save the references in a filter pool reference manager. - */ - protected static String getSaveFilePathAndName(IFolder mgrFolder, String name, IRSEFilterNamingPolicy namingPolicy) { - return SystemFilter.addPathTerminator(getFolderPath(mgrFolder)) + getSaveFileName(namingPolicy.getReferenceManagerSaveFileName(name)); - } - - /** - * Appends the correct extension to the file name where this manager is saved. - * No longer used. - * @param fileNameNoSuffix the file name sans suffix. - * @return the unqualified file name used to store this to disk. - */ - protected static String getSaveFileName(String fileNameNoSuffix) { - return fileNameNoSuffix + ISystemFilterConstants.SAVEFILE_SUFFIX; - } - - /** - * @return the full path name of the file in which to save this manager. - */ - protected String getSaveFilePathAndName() { - return SystemFilter.addPathTerminator(getFolderPath(mgrFolder)) + getSaveFileName(); - } - - /** - * @return the simple name of the file in which to save this manager. - */ - protected String getSaveFileName() { - return getSaveFileName(namingPolicy.getReferenceManagerSaveFileName(getName())); - } - - /** - * @return the folder that this manager is contained in. - */ - public IFolder getFolder() { - return mgrFolder; - } - - /** - * Set the folder that this manager is contained in. - * @param newFolder the new folder - */ - public void resetManagerFolder(IFolder newFolder) { - mgrFolder = newFolder; - } - - /** - * @return the path of the folder that contains this manager. - */ - public String getFolderPath() { - return getResourceHelpers().getFolderPath(mgrFolder); - } - - /** - * @param folder the folder to find the path for - * @return the path of the given folder - */ - public static String getFolderPath(IFolder folder) { - return SystemResourceHelpers.getResourceHelpers().getFolderPath(folder); - } - - /* - * To reduce typing... - */ - private SystemResourceHelpers getResourceHelpers() { - return SystemResourceHelpers.getResourceHelpers(); - } - public String toString() { return getName(); } diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterStartHere.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterStartHere.java index da6ebaac593..070d7d55596 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterStartHere.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterStartHere.java @@ -16,15 +16,11 @@ ********************************************************************************/ package org.eclipse.rse.internal.core.filters; - -import org.eclipse.rse.core.filters.IRSEFilterNamingPolicy; import org.eclipse.rse.core.filters.ISystemFilterPoolManager; import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider; import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager; import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider; -import org.eclipse.rse.core.filters.ISystemFilterSavePolicies; import org.eclipse.rse.core.filters.ISystemFilterStartHere; -import org.eclipse.rse.core.filters.SystemFilterNamingPolicy; import org.eclipse.rse.core.model.ISystemProfile; import org.eclipse.rse.logging.Logger; @@ -63,16 +59,6 @@ public class SystemFilterStartHere return _instance; } - /** - * Factory method to return an instance populated with defaults. - * You can then simply override whatever is desired via setXXX methods. - */ - public IRSEFilterNamingPolicy createSystemFilterNamingPolicy() - { - return SystemFilterNamingPolicy.getNamingPolicy(); - } - - /** * Factory to create a filter pool manager, when you do NOT want it to worry about * saving and restoring the filter data to disk. Rather, you will save and restore @@ -96,7 +82,7 @@ public class SystemFilterStartHere boolean allowNestedFilters) { return SystemFilterPoolManager.createSystemFilterPoolManager(profile, logger, caller, - name, allowNestedFilters, ISystemFilterSavePolicies.SAVE_POLICY_NONE, null); + name, allowNestedFilters); } @@ -112,16 +98,15 @@ public class SystemFilterStartHere * @param relatedPoolMgrProvider The manager provider that own the master list of filter pools that * this manager will contain references to. * @param name the name of the filter pool reference manager. This is not currently - * used, but you may find a use for it. - * @param namingPolicy the naming policy object which will return the name of that one file. + * used, but you may find a use for it. */ public ISystemFilterPoolReferenceManager createSystemFilterPoolReferenceManager( ISystemFilterPoolReferenceManagerProvider caller, ISystemFilterPoolManagerProvider relatedPoolMgrProvider, - String name, IRSEFilterNamingPolicy namingPolicy) + String name) { return SystemFilterPoolReferenceManager.createSystemFilterPoolReferenceManager( - caller, relatedPoolMgrProvider, null, name, ISystemFilterSavePolicies.SAVE_POLICY_NONE, namingPolicy); + caller, relatedPoolMgrProvider, name); } diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java index 05fa2157ec2..d03fd1ccd5a 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java @@ -48,7 +48,6 @@ import org.eclipse.rse.core.subsystems.IConnectorService; import org.eclipse.rse.core.subsystems.IServerLauncherProperties; import org.eclipse.rse.core.subsystems.ISubSystem; import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; -import org.eclipse.rse.core.subsystems.SubSystemFilterNamingPolicy; import org.eclipse.rse.internal.core.model.SystemProfile; import org.eclipse.rse.internal.core.model.SystemProfileManager; import org.eclipse.rse.persistence.dom.IRSEDOMConstants; @@ -288,7 +287,7 @@ public class RSEDOMImporter { if (factory.supportsFilters()) { ISystemFilterStartHere startHere = _registry.getSystemFilterStartHere(); - ISystemFilterPoolReferenceManager fprMgr = startHere.createSystemFilterPoolReferenceManager(subSystem, factory, name, new SubSystemFilterNamingPolicy()); + ISystemFilterPoolReferenceManager fprMgr = startHere.createSystemFilterPoolReferenceManager(subSystem, factory, name); subSystem.setFilterPoolReferenceManager(fprMgr); ISystemFilterPoolManager defaultFilterPoolManager = factory.getFilterPoolManager(host.getSystemProfile()); fprMgr.setDefaultSystemFilterPoolManager(defaultFilterPoolManager); @@ -331,17 +330,12 @@ public class RSEDOMImporter { int release = getIntegerValue(node, IRSEDOMConstants.ATTRIBUTE_RELEASE); boolean isSetSingleFilterStringOnly = getBooleanValue(node, IRSEDOMConstants.ATTRIBUTE_SINGLE_FILTER_STRING_ONLY); - Vector filterStrings = new Vector(); - // create the filter strings RSEDOMNode[] filterStringNodes = node.getChildren(IRSEDOMConstants.TYPE_FILTER_STRING); + String[] filterStrings = new String[filterStringNodes.length]; for (int i = 0; i < filterStringNodes.length; i++) { RSEDOMNode filterStringNode = filterStringNodes[i]; - - // might not have to restore the filter strings this way - //restoreFilterString(filter, filterStringNode); - - filterStrings.add(filterStringNode.getName()); + filterStrings[i] = filterStringNode.getName(); } // create the filter diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemPersistableReferenceManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemPersistableReferenceManager.java index d61a4eb4d1e..4c1d7160642 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemPersistableReferenceManager.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemPersistableReferenceManager.java @@ -23,7 +23,6 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; -import org.eclipse.core.resources.IFolder; import org.eclipse.rse.core.references.IRSEBasePersistableReferenceManager; import org.eclipse.rse.core.references.IRSEBasePersistableReferencedObject; import org.eclipse.rse.core.references.IRSEBasePersistableReferencingObject; @@ -40,11 +39,7 @@ import org.eclipse.rse.core.references.IRSEBasePersistableReferencingObject; public class SystemPersistableReferenceManager implements IRSEBasePersistableReferenceManager { /** * The default value of the '{@link #getName() Name}' attribute. - * - * * @see #getName() - * @generated - * @ordered */ protected static final String NAME_EDEFAULT = null; @@ -265,141 +260,6 @@ public class SystemPersistableReferenceManager implements IRSEBasePersistableRef // Methods for saving and restoring if not doing your own in your own subclass // --------------------------------------------------------------------------- - /** - * YOU MUST OVERRIDE THIS METHOD! - *

    - * After restoring this from disk, there is only the referenced object name, - * not the referenced object pointer, for each referencing object. - *

    - * This method is called after restore and for each restored object in the list must: - *

      - *
    1. Do what is necessary to find the referenced object, and set the internal reference pointer. - *
    2. Call addReference(this) on that object so it can maintain it's in-memory list - * of all referencing objects. - *
    - * @return true if resolved successfully. False if some references were not found and - * hence those referencing objects removed from the restored list. - */ - public boolean resolveReferencesAfterRestore() { - return false; - } - - /** - * Attempt to save contents of manager to disk. Only call if not doing your own save from - * your own model that uses a subclass of this. - * @param folder The folder in which to save the manager. - * @param fileName The unqualified file name to save to. Should include extension, such as .xmi - */ - public void save(IFolder folder, String fileName) throws Exception { - /* FIXME - initMOF(); - String path = folder.getLocation().toOSString(); - String saveFileName = addPathTerminator(path)+fileName; - File saveFile = new File(saveFileName); - boolean exists = saveFile.exists(); - saveFileName = saveFile.toURL().toString(); - Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE; - - Resource.Factory resFactory = reg.getFactory(URI.createURI(saveFileName)); - //java.util.List ext = resFactory.createExtent(); // MOF way - //ext.add(this); // MOF way - Resource mofRes = resFactory.createResource(URI.createURI(saveFileName)); - mofRes.getContents().add(this); - try - { - mofRes.save(EMPTY_MAP); - } catch (Exception e) - { - if (debug) - { - System.out.println("Error saving SystemPersistableReferenceManager "+getName() + " to "+saveFile+": " + e.getClass().getName() + ": " + e.getMessage()); - e.printStackTrace(); - } - throw e; - } - - // if this is the first time we have created this file, we must update Eclipse - // resource tree to know about it... - if (!exists || !folder.exists()) - { - try - { - //RSEUIPlugin.logWarning("Calling refreshLocal on project after saving MOF file: " + saveFileName); - folder.getProject().refreshLocal(IResource.DEPTH_INFINITE, null); - } catch(Exception exc) - { - System.out.println("Exception doing refreshLocal on project: " + exc.getClass().getName()); - } - } - else - { - try - { - //RSEUIPlugin.logWarning("Calling refreshLocal on project after saving MOF file: " + saveFileName); - folder.refreshLocal(IResource.DEPTH_ONE, null); - } catch(Exception exc) - { - System.out.println("Exception doing refreshLocal on project: " + exc.getClass().getName()); - } - } - */ - } - - /** - * Restore a persisted manager from disk. - *

    - * After restoration, YOU MUST CALL {@link #resolveReferencesAfterRestore() resolveReferencesAfterRestore} - * This presumes yours subclass has overridden that method! - *

    - * @param folder The folder in which the saved manager exists. - * @param fileName The unqualified save file name including extension such as .xmi - * @return The restored object, or null if given file not found. Any other error gives an exception. - */ - public static IRSEBasePersistableReferenceManager restore(IFolder folder, String fileName) throws Exception { - IRSEBasePersistableReferenceManager mgr = new SystemPersistableReferenceManager(); - /*FIXME - initMOF(); - Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE; - String path = folder.getLocation().toOSString(); - String saveFile = addPathTerminator(path)+fileName; - //ResourceSet resourceSet = // MOF way - // Resource.Factory.Registry.getResourceSetFactory().makeResourceSet(); - Resource res1 = null; - try - { - // res1 = resourceSet.load(saveFile); MOF way - Resource.Factory resFactory = reg.getFactory(URI.createURI(saveFile)); - res1 = resFactory.createResource(URI.createURI(saveFile)); - res1.load(EMPTY_MAP); - } - catch (java.io.FileNotFoundException e) - { - if (debug) - System.out.println("SystemPersistableReferenceManager file not found: "+saveFile); - return null; - } - catch (Exception e) - { - if (debug) - { - System.out.println("Error loading SystemPersistableReferenceManager from file: "+saveFile+": " + e.getClass().getName() + ": " + e.getMessage()); - e.printStackTrace(); - } - throw e; - } - - java.util.List ext1 = res1.getContents(); - - // should be exactly one... - Iterator iList = ext1.iterator(); - mgr = (SystemPersistableReferenceManager)iList.next(); - - if (debug) - System.out.println("Ok. SystemPersistableReferenceManager "+mgr.getName()+" restored successfully."); - */ - return mgr; - } - /** * Ensure given path ends with path separator. */ diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemFileFilterStringEditPane.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemFileFilterStringEditPane.java index 849b2dc4740..3993dd5aaeb 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemFileFilterStringEditPane.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemFileFilterStringEditPane.java @@ -18,6 +18,7 @@ package org.eclipse.rse.files.ui.widgets; +import java.util.Arrays; import java.util.Vector; import org.eclipse.core.runtime.IStatus; @@ -802,7 +803,9 @@ public class SystemFileFilterStringEditPane */ public static ValidatorFileFilterString getFileFilterStringValidator(ISystemFilter filter, String filterString) { - Vector v = filter.getFilterStringsVector(); + String[] strings = filter.getFilterStrings(); + Vector v = new Vector(strings.length); + v.addAll(Arrays.asList(strings)); if (filterString != null) v.removeElement(filterString); IRemoteFileSubSystemConfiguration ssFactory = (IRemoteFileSubSystemConfiguration)filter.getProvider(); diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystemConfiguration.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystemConfiguration.java index 6ee14a201f4..e5c9dd80a2b 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystemConfiguration.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystemConfiguration.java @@ -341,22 +341,14 @@ public abstract class RemoteFileSubSystemConfiguration extends SubSystemConfigur if (pool != null && isUserPrivateProfile(mgr)) { - Vector filterStrings = new Vector(); - /* - RemoteFileFilterString rootsFilterString = new RemoteFileFilterString(this); - filterStrings.add(rootsFilterString.toString()); - mgr.createSystemFilter(pool, rb.getString(ISystemFileConstants.RESID_FILTER_ROOTS),filterStrings); - */ - // ---------------------- // "My Home" filter... // ---------------------- - filterStrings = new Vector(); RemoteFileFilterString myHomeFilterString = new RemoteFileFilterString(this); myHomeFilterString.setPath(getSeparator()); - filterStrings.add("./*"); //$NON-NLS-1$ - ISystemFilter filter = mgr.createSystemFilter(pool, SystemFileResources.RESID_FILTER_MYHOME,filterStrings); + String[] filterStrings = new String[] {"./*"}; //$NON-NLS-1$ + ISystemFilter filter = mgr.createSystemFilter(pool, SystemFileResources.RESID_FILTER_MYHOME, filterStrings); filter.setNonChangable(true); filter.setSingleFilterStringOnly(true); @@ -387,10 +379,9 @@ public abstract class RemoteFileSubSystemConfiguration extends SubSystemConfigur // ---------------------- // "Root Files" filter... // ---------------------- - filterStrings = new Vector(); RemoteFileFilterString rootFilesFilterString = new RemoteFileFilterString(this); rootFilesFilterString.setPath(getSeparator()); - filterStrings.add(rootFilesFilterString.toString()); + filterStrings = new String[] {rootFilesFilterString.toString()}; mgr.createSystemFilter(pool, SystemFileResources.RESID_FILTER_ROOTFILES,filterStrings); } else @@ -400,10 +391,9 @@ public abstract class RemoteFileSubSystemConfiguration extends SubSystemConfigur // ---------------------- // "Root Files" filter... // ---------------------- - Vector filterStrings = new Vector(); RemoteFileFilterString rootFilesFilterString = new RemoteFileFilterString(this); rootFilesFilterString.setPath(getSeparator()); - filterStrings.add(rootFilesFilterString.toString()); + String[] filterStrings = new String[] {rootFilesFilterString.toString()}; mgr.createSystemFilter(pool, SystemFileResources.RESID_FILTER_ROOTFILES,filterStrings); } //else diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/DStoreWindowsFileSubSystemConfiguration.java b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/DStoreWindowsFileSubSystemConfiguration.java index 4cb6a9853c5..5a95a7b7e6d 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/DStoreWindowsFileSubSystemConfiguration.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/subsystems/files/dstore/DStoreWindowsFileSubSystemConfiguration.java @@ -48,27 +48,23 @@ public class DStoreWindowsFileSubSystemConfiguration extends DStoreFileSubSystem // ---------------------- // "My Home" filter... // ---------------------- - Vector filterStrings = new Vector(); + String[] filterStrings = new String[] {".\\*"}; //$NON-NLS-1$ RemoteFileFilterString myHomeFilterString = new RemoteFileFilterString(this); myHomeFilterString.setPath(getSeparator()); - filterStrings.add(".\\*"); //$NON-NLS-1$ ISystemFilter filter = mgr.createSystemFilter(pool, SystemFileResources.RESID_FILTER_MYHOME,filterStrings); filter.setNonChangable(true); filter.setSingleFilterStringOnly(true); - filterStrings = new Vector(); RemoteFileFilterString defaultFilterString = new RemoteFileFilterString(this); - filterStrings.add(defaultFilterString.toString()); + filterStrings = new String[] {defaultFilterString.toString()}; String filterName = SystemFileResources.RESID_FILTER_DRIVES; mgr.createSystemFilter(pool, filterName, filterStrings); } else { - Vector filterStrings = new Vector(); - filterStrings = new Vector(); RemoteFileFilterString defaultFilterString = new RemoteFileFilterString(this); - filterStrings.add(defaultFilterString.toString()); + String[] filterStrings = new String[] {defaultFilterString.toString()}; String filterName = SystemFileResources.RESID_FILTER_DRIVES; mgr.createSystemFilter(pool, filterName, filterStrings); diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.local/src/org/eclipse/rse/subsystems/files/local/LocalFileSubSystemConfiguration.java b/rse/plugins/org.eclipse.rse.subsystems.files.local/src/org/eclipse/rse/subsystems/files/local/LocalFileSubSystemConfiguration.java index f95c563e535..c5d40bc4ed1 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.local/src/org/eclipse/rse/subsystems/files/local/LocalFileSubSystemConfiguration.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.local/src/org/eclipse/rse/subsystems/files/local/LocalFileSubSystemConfiguration.java @@ -117,16 +117,14 @@ public class LocalFileSubSystemConfiguration extends FileServiceSubSystemConfigu String myHomeFilterName = SystemFileResources.RESID_FILTER_MYHOME; RemoteFileFilterString myDocsFilterString = new RemoteFileFilterString(this); myDocsFilterString.setPath(System.getProperty("user.home") + getSeparator()); //$NON-NLS-1$ - Vector myDocsFilterStrings = new Vector(); - myDocsFilterStrings.add(myDocsFilterString.toString()); + String[] myDocsFilterStrings = new String[] {myDocsFilterString.toString()}; mgr.createSystemFilter(pool, myHomeFilterName, myDocsFilterStrings); - Vector filterStrings = new Vector(); RemoteFileFilterString defaultFilterString = new RemoteFileFilterString(this); if (!_isWindows) defaultFilterString.setPath(getSeparator()); - filterStrings.add(defaultFilterString.toString()); + String[] filterStrings = new String[] {defaultFilterString.toString()}; //System.out.println("creating filter..."); String filterName = null; if (_isWindows) @@ -137,11 +135,10 @@ public class LocalFileSubSystemConfiguration extends FileServiceSubSystemConfigu } else { - Vector filterStrings = new Vector(); RemoteFileFilterString defaultFilterString = new RemoteFileFilterString(this); if (!_isWindows) defaultFilterString.setPath(getSeparator()); - filterStrings.add(defaultFilterString.toString()); + String[] filterStrings = new String[] {defaultFilterString.toString()}; //System.out.println("creating filter..."); String filterName = null; if (_isWindows) diff --git a/rse/plugins/org.eclipse.rse.subsystems.processes.core/src/org/eclipse/rse/subsystems/processes/core/subsystem/impl/RemoteProcessSubSystemConfiguration.java b/rse/plugins/org.eclipse.rse.subsystems.processes.core/src/org/eclipse/rse/subsystems/processes/core/subsystem/impl/RemoteProcessSubSystemConfiguration.java index ca52d0b4382..48e02605be0 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.processes.core/src/org/eclipse/rse/subsystems/processes/core/subsystem/impl/RemoteProcessSubSystemConfiguration.java +++ b/rse/plugins/org.eclipse.rse.subsystems.processes.core/src/org/eclipse/rse/subsystems/processes/core/subsystem/impl/RemoteProcessSubSystemConfiguration.java @@ -96,41 +96,36 @@ public abstract class RemoteProcessSubSystemConfiguration extends if (isUserPrivateProfile(mgr)) { - Vector filterStrings = new Vector(); // ---------------------- // "All Processes" filter... // ---------------------- - filterStrings = new Vector(); HostProcessFilterImpl allProcessesFilterString = new HostProcessFilterImpl(); - filterStrings.add(allProcessesFilterString.toString()); - ISystemFilter filter = mgr.createSystemFilter(pool, SystemProcessesCoreResources.RESID_PROPERTY_PROCESS_DEFAULTFILTER_LABEL,filterStrings); + String[] filterStrings = new String[] {allProcessesFilterString.toString()}; + ISystemFilter filter = mgr.createSystemFilter(pool, SystemProcessesCoreResources.RESID_PROPERTY_PROCESS_DEFAULTFILTER_LABEL, filterStrings); filter.setNonChangable(true); filter.setSingleFilterStringOnly(true); //------------------------ // "My Processes" filter... // ---------------------- - filterStrings = new Vector(); HostProcessFilterImpl myProcessesFilterString = new HostProcessFilterImpl(); myProcessesFilterString.setUsername("${user.id}"); //$NON-NLS-1$ - filterStrings.add(myProcessesFilterString.toString()); - filter = mgr.createSystemFilter(pool, SystemProcessesCoreResources.RESID_PROPERTY_PROCESS_MYPROCESSESFILTER_LABEL,filterStrings); + filterStrings = new String[] {myProcessesFilterString.toString()}; + filter = mgr.createSystemFilter(pool, SystemProcessesCoreResources.RESID_PROPERTY_PROCESS_MYPROCESSESFILTER_LABEL, filterStrings); filter.setNonChangable(true); filter.setSingleFilterStringOnly(true); } else { - Vector filterStrings = new Vector(); // ---------------------- // "All Processes" filter... // ---------------------- - filterStrings = new Vector(); HostProcessFilterImpl allProcessesFilterString = new HostProcessFilterImpl(); - filterStrings.add(allProcessesFilterString.toString()); - ISystemFilter filter = mgr.createSystemFilter(pool, SystemProcessesCoreResources.RESID_PROPERTY_PROCESS_DEFAULTFILTER_LABEL,filterStrings); + String[] filterStrings = new String[] {allProcessesFilterString.toString()}; + ISystemFilter filter = mgr.createSystemFilter(pool, SystemProcessesCoreResources.RESID_PROPERTY_PROCESS_DEFAULTFILTER_LABEL, filterStrings); filter.setNonChangable(true); filter.setSingleFilterStringOnly(true); } diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterNewFilterPoolWizardDefaultMainPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterNewFilterPoolWizardDefaultMainPage.java index 85518d3a160..0b27eae982d 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterNewFilterPoolWizardDefaultMainPage.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterNewFilterPoolWizardDefaultMainPage.java @@ -97,15 +97,14 @@ public class SystemFilterNewFilterPoolWizardDefaultMainPage * Either call this or override getFilterPoolManagerNames, or leave null and this prompt will * not show. */ - public void setFilterPoolManagers(ISystemFilterPoolManager[] mgrs) - { + public void setFilterPoolManagers(ISystemFilterPoolManager[] mgrs) { mgrNames = new String[mgrs.length]; validatorsByManager = new ISystemValidator[mgrNames.length]; - for (int idx=0; idx diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterReferenceAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterReferenceAdapter.java index 8cefba44013..1fcfb056e55 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterReferenceAdapter.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterReferenceAdapter.java @@ -28,8 +28,6 @@ package org.eclipse.rse.internal.ui.view; -import java.util.Vector; - import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; @@ -659,49 +657,32 @@ public class SystemViewFilterReferenceAdapter * Return a validator for verifying the new name is correct. * @param element either a filter for a rename action, or a filter pool for a "new" action. */ - public ISystemValidator getNameValidator(Object element) - { + public ISystemValidator getNameValidator(Object element) { ISystemFilter filter = null; ISystemFilterPool pool = null; - Vector filterNames = null; - if (element instanceof ISystemFilterReference) - { + String[] filterNames = null; + if (element instanceof ISystemFilterReference) { filter = getFilter(element); pool = filter.getParentFilterPool(); if (pool != null) filterNames = pool.getSystemFilterNames(); - else - { + else { ISystemFilter parentFilter = filter.getParentFilter(); filterNames = parentFilter.getSystemFilterNames(); } - } - else if (element instanceof ISystemFilter) - { + } else if (element instanceof ISystemFilter) { filter = (ISystemFilter) element; pool = filter.getParentFilterPool(); if (pool != null) filterNames = pool.getSystemFilterNames(); - else - { + else { ISystemFilter parentFilter = filter.getParentFilter(); filterNames = parentFilter.getSystemFilterNames(); } - } - else - { + } else { pool = (ISystemFilterPool) element; filterNames = pool.getSystemFilterNames(); } - /* - if (filter != null) - { - filterNames.removeElement(filter.getName()); // remove current filter's name - System.out.println("Existing names for " + filter.getName()); - for (int idx=0; idx