1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-15 04:55:22 +02:00

[222270][api][breaking] Clean up interfaces in org.eclipse.rse.core.filters

https://bugs.eclipse.org/bugs/show_bug.cgi?id=222270
This commit is contained in:
David Dykstal 2008-03-13 02:40:27 +00:00
parent c978a62c0e
commit 054297d712
40 changed files with 741 additions and 2594 deletions

View file

@ -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.
* <p>
* Note that not all methods will be used for all saving policies.
* <p>
* @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();
}

View file

@ -17,9 +17,6 @@
package org.eclipse.rse.core.filters; 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.model.IRSEModelObject;
import org.eclipse.rse.core.references.IRSEReferencedObject; import org.eclipse.rse.core.references.IRSEReferencedObject;
@ -35,83 +32,70 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
/** /**
* Returns the value of the '<em><b>Name</b></em>' attribute. * Returns the value of the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <p> * <p>
* This is the name of the filter. It may be present in the user interface and is also * 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. * used to refer to the filter when it is persisted.
* </p> * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Name</em>' attribute. * @return the value of the '<em>Name</em>' attribute.
* @see #setName(String) * @see #setName(String)
*/ */
String getName(); public String getName();
/** /**
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#getName <em>Name</em>}' attribute. * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#getName <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* This is the name of the filter. It may be present in the user interface and is also * 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. * used to refer to the filter when it is persisted.
* <!-- end-user-doc -->
* @param value the new value of the '<em>Name</em>' attribute. * @param value the new value of the '<em>Name</em>' attribute.
* @see #getName() * @see #getName()
*/ */
void setName(String value); public void setName(String value);
/** /**
* Returns the value of the '<em><b>Type</b></em>' attribute. * Returns the value of the '<em><b>Type</b></em>' attribute.
* <!-- begin-user-doc -->
* <p> * <p>
* Filters may be further typed for use by subsystems. The type is also uninterpreted by the * 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. * filter. The type may be used to select a parser/interpreter for the filter strings.
* </p> * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Type</em>' attribute. * @return the value of the '<em>Type</em>' attribute.
* @see #setType(String) * @see #setType(String)
*/ */
String getType(); public String getType();
/** /**
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#getType <em>Type</em>}' attribute. * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#getType <em>Type</em>}' attribute.
* <!-- begin-user-doc -->
* Filters may be further typed for use by subsystems. The type is also uninterpreted by the * 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. * filter. The type may be used to select a parser/interpreter for the filter strings.
* <!-- end-user-doc -->
* @param value the new value of the '<em>Type</em>' attribute. * @param value the new value of the '<em>Type</em>' attribute.
* @see #getType() * @see #getType()
*/ */
void setType(String value); public void setType(String value);
/** /**
* Returns the value of the '<em><b>Supports Nested Filters</b></em>' attribute. * Returns the value of the '<em><b>Supports Nested Filters</b></em>' attribute.
* <!-- begin-user-doc -->
* <p> * <p>
* Specifies whether filters may be nested or not. If nested the intent is to apply this filter * 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 * 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. * parent filter. However, it is up to the subsystem to interpret exactly what "nesting" means.
* </p> * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Supports Nested Filters</em>' attribute. * @return the value of the '<em>Supports Nested Filters</em>' attribute.
* @see #setSupportsNestedFilters(boolean) * @see #setSupportsNestedFilters(boolean)
*/ */
boolean isSupportsNestedFilters(); public boolean isSupportsNestedFilters();
/** /**
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isSupportsNestedFilters <em>Supports Nested Filters</em>}' attribute. * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isSupportsNestedFilters <em>Supports Nested Filters</em>}' attribute.
* <!-- begin-user-doc -->
* <p> * <p>
* Specifies whether filters may be nested or not. If nested the intent is to apply this filter * 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 * 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. * parent filter. However, it is up to the subsystem to interpret exactly what "nesting" means.
* </p> * </p>
* <!-- end-user-doc -->
* @param value the new value of the '<em>Supports Nested Filters</em>' attribute. * @param value the new value of the '<em>Supports Nested Filters</em>' attribute.
* @see #isSupportsNestedFilters() * @see #isSupportsNestedFilters()
*/ */
void setSupportsNestedFilters(boolean value); public void setSupportsNestedFilters(boolean value);
/** /**
* Returns the value of the '<em><b>Relative Order</b></em>' attribute. * Returns the value of the '<em><b>Relative Order</b></em>' attribute.
* <!-- begin-user-doc -->
* <p> * <p>
* The relative order of a filter is intended to be used * The relative order of a filter is intended to be used
* by a persistence mechanism to keep the filters in a particular order * 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 * occur later in the pool. It may be employed in the absence of another
* mechanism for maintaining order. * mechanism for maintaining order.
* </p> * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Relative Order</em>' attribute. * @return the value of the '<em>Relative Order</em>' attribute.
* @see #setRelativeOrder(int) * @see #setRelativeOrder(int)
*/ */
int getRelativeOrder(); public int getRelativeOrder();
/** /**
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#getRelativeOrder <em>Relative Order</em>}' attribute. * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#getRelativeOrder <em>Relative Order</em>}' attribute.
* <!-- begin-user-doc -->
* The relative order of a filter is intended to be used * The relative order of a filter is intended to be used
* by a persistence mechanism to keep the filters in a particular order * by a persistence mechanism to keep the filters in a particular order
* when restoring them into a filter pool. Filters with higher numbers should * 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 * occur later in the pool. It may be employed in the absence of another
* mechanism for maintaining order. * mechanism for maintaining order.
* <!-- end-user-doc -->
* @param value the new value of the '<em>Relative Order</em>' attribute. * @param value the new value of the '<em>Relative Order</em>' attribute.
* @see #getRelativeOrder() * @see #getRelativeOrder()
*/ */
void setRelativeOrder(int value); public void setRelativeOrder(int value);
/** /**
* Returns the value of the '<em><b>Default</b></em>' attribute. * Returns the value of the '<em><b>Default</b></em>' attribute.
* <!-- begin-user-doc -->
* <p> * <p>
* This filter is a "default" filter in this filter pool. * This filter is a "default" filter in this filter pool.
* The meaning of "default" is determined by the subsystem in which it is deployed. * 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". * That is, the filter is "vendor supplied".
* There is no restriction on the number of default filters in a pool. * There is no restriction on the number of default filters in a pool.
* </p> * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Default</em>' attribute. * @return the value of the '<em>Default</em>' attribute.
* @see #setDefault(boolean) * @see #setDefault(boolean)
*/ */
boolean isDefault(); public boolean isDefault();
/** /**
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isDefault <em>Default</em>}' attribute. * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isDefault <em>Default</em>}' attribute.
* <!-- begin-user-doc -->
* Make this filter is a "default" filter in this filter pool. * 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. * 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. * 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". * That is, the filter is "vendor supplied".
* There is no restriction on the number of default filters in a pool. * There is no restriction on the number of default filters in a pool.
* <!-- end-user-doc -->
* @param value the new value of the '<em>Default</em>' attribute. * @param value the new value of the '<em>Default</em>' attribute.
* @see #isDefault() * @see #isDefault()
*/ */
void setDefault(boolean value); public void setDefault(boolean value);
/** /**
* Returns the value of the '<em><b>Strings Case Sensitive</b></em>' attribute. * Returns the value of the '<em><b>Strings Case Sensitive</b></em>' attribute.
* <!-- begin-user-doc -->
* <p> * <p>
* An attribute that may be used by the subystems when interpreting the filter. Used * 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 * 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 * If unset the value
* returned is from the parent filter pool. * returned is from the parent filter pool.
* </p> * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Strings Case Sensitive</em>' attribute. * @return the value of the '<em>Strings Case Sensitive</em>' attribute.
* @see #isSetStringsCaseSensitive() * @see #isSetStringsCaseSensitive()
* @see #unsetStringsCaseSensitive() * @see #unsetStringsCaseSensitive()
* @see #setStringsCaseSensitive(boolean) * @see #setStringsCaseSensitive(boolean)
*/ */
boolean isStringsCaseSensitive(); public boolean isStringsCaseSensitive();
/** /**
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isStringsCaseSensitive <em>Strings Case Sensitive</em>}' attribute. * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isStringsCaseSensitive <em>Strings Case Sensitive</em>}' attribute.
* <!-- begin-user-doc -->
* <p> * <p>
* An attribute that may be used by the subystems when interpreting the filter. Used * 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 * to indicate whether or not comparisons involving the filter should be considered
@ -202,7 +176,6 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
* <p> * <p>
* This will cause this attribute to be set in this filter. * This will cause this attribute to be set in this filter.
* </p> * </p>
* <!-- end-user-doc -->
* @param value the new value of the '<em>Strings Case Sensitive</em>' attribute. * @param value the new value of the '<em>Strings Case Sensitive</em>' attribute.
* @see #isSetStringsCaseSensitive() * @see #isSetStringsCaseSensitive()
* @see #unsetStringsCaseSensitive() * @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 <em>Strings Case Sensitive</em>}' attribute. * Unsets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isStringsCaseSensitive <em>Strings Case Sensitive</em>}' attribute.
* <!-- begin-user-doc -->
* <p> * <p>
* An attribute that may be used by the subystems when interpreting the filter. Used * 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 * to indicate whether or not comparisons involving the filter should be considered
@ -221,16 +193,14 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
* </p><p> * </p><p>
* Causes this filter to use the value specified by the parent filter pool. * Causes this filter to use the value specified by the parent filter pool.
* </p> * </p>
* <!-- end-user-doc -->
* @see #isSetStringsCaseSensitive() * @see #isSetStringsCaseSensitive()
* @see #isStringsCaseSensitive() * @see #isStringsCaseSensitive()
* @see #setStringsCaseSensitive(boolean) * @see #setStringsCaseSensitive(boolean)
*/ */
void unsetStringsCaseSensitive(); public void unsetStringsCaseSensitive();
/** /**
* Returns whether the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isStringsCaseSensitive <em>Strings Case Sensitive</em>}' attribute is set. * Returns whether the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isStringsCaseSensitive <em>Strings Case Sensitive</em>}' attribute is set.
* <!-- begin-user-doc -->
* <p> * <p>
* An attribute that may be used by the subystems when interpreting the filter. Used * 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 * 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 * 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. * is being inherited from the parent filter pool.
* </p> * </p>
* <!-- end-user-doc -->
* @return whether the value of the '<em>Strings Case Sensitive</em>' attribute is set. * @return whether the value of the '<em>Strings Case Sensitive</em>' attribute is set.
* @see #unsetStringsCaseSensitive() * @see #unsetStringsCaseSensitive()
* @see #isStringsCaseSensitive() * @see #isStringsCaseSensitive()
* @see #setStringsCaseSensitive(boolean) * @see #setStringsCaseSensitive(boolean)
*/ */
boolean isSetStringsCaseSensitive(); public boolean isSetStringsCaseSensitive();
/** /**
* Returns the value of the '<em><b>Promptable</b></em>' attribute. * Returns the value of the '<em><b>Promptable</b></em>' attribute.
* <!-- begin-user-doc -->
* <p> * <p>
* An attribute that may be used by the subystems when interpreting the filter. * 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 * 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 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. * the state of the filter is saved when the workbench is shut down.
* </p> * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Promptable</em>' attribute. * @return the value of the '<em>Promptable</em>' attribute.
* @see #setPromptable(boolean) * @see #setPromptable(boolean)
*/ */
boolean isPromptable(); public boolean isPromptable();
/** /**
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isPromptable <em>Promptable</em>}' attribute. * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isPromptable <em>Promptable</em>}' attribute.
* <!-- begin-user-doc -->
* <p> * <p>
* An attribute that may be used by the subystems when interpreting the filter. * 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 * 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 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. * the state of the filter is saved when the workbench is shut down.
* </p> * </p>
* <!-- end-user-doc -->
* @param value the new value of the '<em>Promptable</em>' attribute. * @param value the new value of the '<em>Promptable</em>' attribute.
* @see #isPromptable() * @see #isPromptable()
*/ */
void setPromptable(boolean value); public void setPromptable(boolean value);
/** /**
* Returns the value of the '<em><b>Supports Duplicate Filter Strings</b></em>' attribute. * Returns the value of the '<em><b>Supports Duplicate Filter Strings</b></em>' attribute.
* <!-- begin-user-doc -->
* <p> * <p>
* This attribute may be used by subsystems when interpreting the filter. * 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 * Typically used when adding filter strings to the filter or as a hint when
* applying the filter to the resources understood by the subsystem. * applying the filter to the resources understood by the subsystem.
* </p> * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Supports Duplicate Filter Strings</em>' attribute. * @return the value of the '<em>Supports Duplicate Filter Strings</em>' attribute.
* @see #setSupportsDuplicateFilterStrings(boolean) * @see #setSupportsDuplicateFilterStrings(boolean)
*/ */
boolean isSupportsDuplicateFilterStrings(); public boolean isSupportsDuplicateFilterStrings();
/** /**
* Does this support duplicate filter strings? * 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 <em>Supports Duplicate Filter Strings</em>}' attribute. * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isSupportsDuplicateFilterStrings <em>Supports Duplicate Filter Strings</em>}' attribute.
* <!-- begin-user-doc -->
* <p> * <p>
* This attribute may be used by subsystems when interpreting the filter. * 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 * Typically used when adding filter strings to the filter or as a hint when
* applying the filter to the resources understood by the subsystem. * applying the filter to the resources understood by the subsystem.
* </p> * </p>
* <!-- end-user-doc -->
* @param value the new value of the '<em>Supports Duplicate Filter Strings</em>' attribute. * @param value the new value of the '<em>Supports Duplicate Filter Strings</em>' attribute.
* @see #isSupportsDuplicateFilterStrings() * @see #isSupportsDuplicateFilterStrings()
*/ */
void setSupportsDuplicateFilterStrings(boolean value); public void setSupportsDuplicateFilterStrings(boolean value);
/** /**
* Returns the value of the '<em><b>Non Deletable</b></em>' attribute. * Returns the value of the '<em><b>Non Deletable</b></em>' attribute.
* <!-- begin-user-doc -->
* <p> * <p>
* An attribute that can be used when managing filters in filter pools. * An attribute that can be used when managing filters in filter pools.
* Some filters should not be deleted. * Some filters should not be deleted.
* </p> * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Non Deletable</em>' attribute. * @return the value of the '<em>Non Deletable</em>' attribute.
* @see #setNonDeletable(boolean) * @see #setNonDeletable(boolean)
*/ */
boolean isNonDeletable(); public boolean isNonDeletable();
/** /**
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isNonDeletable <em>Non Deletable</em>}' attribute. * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isNonDeletable <em>Non Deletable</em>}' attribute.
* <!-- begin-user-doc -->
* <p> * <p>
* An attribute that can be used when managing filters in filter pools. * An attribute that can be used when managing filters in filter pools.
* Some filters should not be deleted. * Some filters should not be deleted.
* </p> * </p>
* <!-- end-user-doc -->
* @param value the new value of the '<em>Non Deletable</em>' attribute. * @param value the new value of the '<em>Non Deletable</em>' attribute.
* @see #isNonDeletable() * @see #isNonDeletable()
*/ */
void setNonDeletable(boolean value); public void setNonDeletable(boolean value);
/** /**
* Returns the value of the '<em><b>Non Renamable</b></em>' attribute. * Returns the value of the '<em><b>Non Renamable</b></em>' attribute.
* <!-- begin-user-doc -->
* <p> * <p>
* An attribute that can be used when managing filters in filter pools. * An attribute that can be used when managing filters in filter pools.
* Some filters should not be renamed. * Some filters should not be renamed.
* </p> * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Non Renamable</em>' attribute. * @return the value of the '<em>Non Renamable</em>' attribute.
* @see #setNonRenamable(boolean) * @see #setNonRenamable(boolean)
*/ */
boolean isNonRenamable(); public boolean isNonRenamable();
/** /**
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isNonRenamable <em>Non Renamable</em>}' attribute. * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isNonRenamable <em>Non Renamable</em>}' attribute.
* <!-- begin-user-doc -->
* <p> * <p>
* An attribute that can be used when managing filters in filter pools. * An attribute that can be used when managing filters in filter pools.
* Some filters should not be renamed. * Some filters should not be renamed.
* </p> * </p>
* <!-- end-user-doc -->
* @param value the new value of the '<em>Non Renamable</em>' attribute. * @param value the new value of the '<em>Non Renamable</em>' attribute.
* @see #isNonRenamable() * @see #isNonRenamable()
*/ */
void setNonRenamable(boolean value); public void setNonRenamable(boolean value);
/** /**
* Returns the value of the '<em><b>Non Changable</b></em>' attribute. * Returns the value of the '<em><b>Non Changable</b></em>' attribute.
* <!-- begin-user-doc -->
* <p> * <p>
* An attribute that can be used when managing filters in filter pools. * An attribute that can be used when managing filters in filter pools.
* Some filters should not be modifiable. * Some filters should not be modifiable.
* </p> * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Non Changable</em>' attribute. * @return the value of the '<em>Non Changable</em>' attribute.
* @see #setNonChangable(boolean) * @see #setNonChangable(boolean)
*/ */
boolean isNonChangable(); public boolean isNonChangable();
/** /**
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isNonChangable <em>Non Changable</em>}' attribute. * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isNonChangable <em>Non Changable</em>}' attribute.
* <!-- begin-user-doc -->
* <p> * <p>
* An attribute that can be used when managing filters in filter pools. * An attribute that can be used when managing filters in filter pools.
* Some filters should not be modifiable. * Some filters should not be modifiable.
* </p> * </p>
* <!-- end-user-doc -->
* @param value the new value of the '<em>Non Changable</em>' attribute. * @param value the new value of the '<em>Non Changable</em>' attribute.
* @see #isNonChangable() * @see #isNonChangable()
*/ */
void setNonChangable(boolean value); public void setNonChangable(boolean value);
/** /**
* Returns the value of the '<em><b>Strings Non Changable</b></em>' attribute. * Returns the value of the '<em><b>Strings Non Changable</b></em>' attribute.
* <!-- begin-user-doc -->
* <p> * <p>
* An attribute that can be used when managing filters in filter pools. * An attribute that can be used when managing filters in filter pools.
* Some filters contain filter strings that should not be modifiable. * Some filters contain filter strings that should not be modifiable.
* </p> * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Strings Non Changable</em>' attribute. * @return the value of the '<em>Strings Non Changable</em>' attribute.
* @see #setStringsNonChangable(boolean) * @see #setStringsNonChangable(boolean)
*/ */
boolean isStringsNonChangable(); public boolean isStringsNonChangable();
/** /**
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isStringsNonChangable <em>Strings Non Changable</em>}' attribute. * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isStringsNonChangable <em>Strings Non Changable</em>}' attribute.
* <!-- begin-user-doc -->
* <p> * <p>
* An attribute that can be used when managing filters in filter pools. * An attribute that can be used when managing filters in filter pools.
* Some filters contain filter strings that should not be modifiable. * Some filters contain filter strings that should not be modifiable.
* </p> * </p>
* <!-- end-user-doc -->
* @param value the new value of the '<em>Strings Non Changable</em>' attribute. * @param value the new value of the '<em>Strings Non Changable</em>' attribute.
* @see #isStringsNonChangable() * @see #isStringsNonChangable()
*/ */
void setStringsNonChangable(boolean value); public void setStringsNonChangable(boolean value);
/** /**
* Returns the value of the '<em><b>Release</b></em>' attribute. * Returns the value of the '<em><b>Release</b></em>' attribute.
* <!-- begin-user-doc -->
* <p> * <p>
* This is an attribute specifying the release level of the * This is an attribute specifying the release level of the
* filter. This will be persisted in the filter definition and * filter. This will be persisted in the filter definition and
* can be used to migrate the internal form of the filter. * can be used to migrate the internal form of the filter.
* </p> * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Release</em>' attribute. * @return the value of the '<em>Release</em>' attribute.
* @see #setRelease(int) * @see #setRelease(int)
*/ */
int getRelease(); public int getRelease();
/** /**
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#getRelease <em>Release</em>}' attribute. * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#getRelease <em>Release</em>}' attribute.
* <!-- begin-user-doc -->
* <p> * <p>
* This is an attribute specifying the release level of the * This is an attribute specifying the release level of the
* filter. This will be persisted in the filter definition and * filter. This will be persisted in the filter definition and
* can be used to migrate the internal form of the filter. * can be used to migrate the internal form of the filter.
* </p> * </p>
* <!-- end-user-doc -->
* @param value the new value of the '<em>Release</em>' attribute. * @param value the new value of the '<em>Release</em>' attribute.
* @see #getRelease() * @see #getRelease()
*/ */
void setRelease(int value); public void setRelease(int value);
/** /**
* Returns the value of the '<em><b>Single Filter String Only</b></em>' attribute. * Returns the value of the '<em><b>Single Filter String Only</b></em>' attribute.
* <!-- begin-user-doc -->
* <p> * <p>
* This attribute specifies that the filter may contain only a single * This attribute specifies that the filter may contain only a single
* filter string. Used by a filter manager to ensure that the * 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 * This attribute may be set or unset. If unset this value will be inherited
* from the parent filter pool. * from the parent filter pool.
* </p> * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Single Filter String Only</em>' attribute. * @return the value of the '<em>Single Filter String Only</em>' attribute.
* @see #isSetSingleFilterStringOnly() * @see #isSetSingleFilterStringOnly()
* @see #unsetSingleFilterStringOnly() * @see #unsetSingleFilterStringOnly()
* @see #setSingleFilterStringOnly(boolean) * @see #setSingleFilterStringOnly(boolean)
*/ */
boolean isSingleFilterStringOnly(); public boolean isSingleFilterStringOnly();
/** /**
* Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute. * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute.
* <!-- begin-user-doc -->
* <p> * <p>
* This attribute specifies that the filter may contain only a single * This attribute specifies that the filter may contain only a single
* filter string. Used by a filter manager to ensure that the * 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 * This causes the attribute to be set for this filter, ignoring the value
* specified for the parent filter pool. * specified for the parent filter pool.
* </p> * </p>
* <!-- end-user-doc -->
* @param value the new value of the '<em>Single Filter String Only</em>' attribute. * @param value the new value of the '<em>Single Filter String Only</em>' attribute.
* @see #isSetSingleFilterStringOnly() * @see #isSetSingleFilterStringOnly()
* @see #unsetSingleFilterStringOnly() * @see #unsetSingleFilterStringOnly()
* @see #isSingleFilterStringOnly() * @see #isSingleFilterStringOnly()
*/ */
void setSingleFilterStringOnly(boolean value); public void setSingleFilterStringOnly(boolean value);
/** /**
* Unsets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute. * Unsets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute.
* <!-- begin-user-doc -->
* This causes the value of this attribute to be inherited from the parent filter pool. * This causes the value of this attribute to be inherited from the parent filter pool.
* <!-- end-user-doc -->
* @see #isSetSingleFilterStringOnly() * @see #isSetSingleFilterStringOnly()
* @see #isSingleFilterStringOnly() * @see #isSingleFilterStringOnly()
* @see #setSingleFilterStringOnly(boolean) * @see #setSingleFilterStringOnly(boolean)
*/ */
void unsetSingleFilterStringOnly(); public void unsetSingleFilterStringOnly();
/** /**
* Returns whether the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute is set. * Returns whether the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#isSingleFilterStringOnly <em>Single Filter String Only</em>}' attribute is set.
* <!-- begin-user-doc -->
* If true then the value of this attribute is set in this filter. If false it is inherited from the parent filter pool. * If true then the value of this attribute is set in this filter. If false it is inherited from the parent filter pool.
* <!-- end-user-doc -->
* @return whether the value of the '<em>Single Filter String Only</em>' attribute is set. * @return whether the value of the '<em>Single Filter String Only</em>' attribute is set.
* @see #unsetSingleFilterStringOnly() * @see #unsetSingleFilterStringOnly()
* @see #isSingleFilterStringOnly() * @see #isSingleFilterStringOnly()
* @see #setSingleFilterStringOnly(boolean) * @see #setSingleFilterStringOnly(boolean)
*/ */
boolean isSetSingleFilterStringOnly(); public boolean isSetSingleFilterStringOnly();
/** /**
* Returns the value of the '<em><b>Nested Filters</b></em>' containment reference list. * Returns the value of the '<em><b>Nested Filters</b></em>' containment reference list.
* The list contents are of type {@link org.eclipse.rse.core.filters.ISystemFilter}. * 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 <em>Parent Filter</em>}'. * It is bidirectional and its opposite is '{@link org.eclipse.rse.core.filters.ISystemFilter#getParentFilter <em>Parent Filter</em>}'.
* <!-- begin-user-doc -->
* <p> * <p>
* If this filter can contain child filters this will return the list of children. * If this filter can contain child filters this will return the list of children.
* </p> * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Nested Filters</em>' containment reference list. * @return the value of the '<em>Nested Filters</em>' containment reference list.
* @see org.eclipse.rse.core.filters.ISystemFilter#getParentFilter * @see org.eclipse.rse.core.filters.ISystemFilter#getParentFilter
*/ */
List getNestedFilters(); public ISystemFilter[] getNestedFilters();
/** /**
* Returns the value of the '<em><b>Parent Filter</b></em>' container reference. * Returns the value of the '<em><b>Parent Filter</b></em>' container reference.
* It is bidirectional and its opposite is '{@link org.eclipse.rse.core.filters.ISystemFilter#getNestedFilters <em>Nested Filters</em>}'. * It is bidirectional and its opposite is '{@link org.eclipse.rse.core.filters.ISystemFilter#getNestedFilters <em>Nested Filters</em>}'.
* <!-- begin-user-doc -->
* <p> * <p>
* If this filter can be nested inside another this will return the parent filter. Will be * If this filter can be nested inside another this will return the parent filter. Will be
* null if there is no parent. * null if there is no parent.
* </p> * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Parent Filter</em>' container reference. * @return the value of the '<em>Parent Filter</em>' container reference.
* @see #setParentFilter(ISystemFilter) * @see #setParentFilter(ISystemFilter)
* @see org.eclipse.rse.core.filters.ISystemFilter#getNestedFilters * @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 <em>Parent Filter</em>}' container reference. * Sets the value of the '{@link org.eclipse.rse.core.filters.ISystemFilter#getParentFilter <em>Parent Filter</em>}' container reference.
* <!-- begin-user-doc -->
* This is used by a filter manager to set the parent filter when one filter is nested inside another. * This is used by a filter manager to set the parent filter when one filter is nested inside another.
* <!-- end-user-doc -->
* @param value the new value of the '<em>Parent Filter</em>' container reference. * @param value the new value of the '<em>Parent Filter</em>' container reference.
* @see #getParentFilter() * @see #getParentFilter()
*/ */
void setParentFilter(ISystemFilter value); public void setParentFilter(ISystemFilter value);
/** /**
* Returns the value of the '<em><b>Strings</b></em>' containment reference list. * Returns the value of the '<em><b>Strings</b></em>' containment reference list.
* The list contents are of type {@link org.eclipse.rse.core.filters.ISystemFilterString}. * The list contents are of type {@link org.eclipse.rse.core.filters.ISystemFilterString}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Strings</em>' containment reference list. * @return the value of the '<em>Strings</em>' 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 * @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); 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. * Set this filter's filter strings by giving an array of String objects.
* This will construct the filter strings objects. * This will construct the filter strings objects.
@ -585,22 +503,14 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
public void setFilterStrings(String[] strings); public void setFilterStrings(String[] strings);
/** /**
* @return this filter's filter strings as a Vector 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 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
*/ */
public String[] getFilterStrings(); 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(); public ISystemFilterString[] getSystemFilterStrings();

View file

@ -16,8 +16,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.core.filters; package org.eclipse.rse.core.filters;
import java.util.Vector;
import org.eclipse.rse.core.model.IRSEPersistableContainer; 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 aliasName The name to give the new filter. Must be unique for this pool.
* @param filterStrings The list of String objects that represent the filter strings. * @param 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. * 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. * @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. * Typically used by name validators for New and Rename actions to verify new name is unique.
*/ */
public Vector getSystemFilterNames(); public String[] getSystemFilterNames();
/**
* @return a Vector of the ISystemFilter objects contained in this filter container.
*/
public Vector getSystemFiltersVector();
/** /**
* @return an array of the ISystemFilter objects contained in this filter container. * @return an array of the ISystemFilter objects contained in this filter container.

View file

@ -17,8 +17,6 @@
package org.eclipse.rse.core.filters; package org.eclipse.rse.core.filters;
import java.util.List;
import org.eclipse.rse.core.model.IRSEModelObject; import org.eclipse.rse.core.model.IRSEModelObject;
import org.eclipse.rse.core.references.IRSEPersistableReferencedObject; import org.eclipse.rse.core.references.IRSEPersistableReferencedObject;
@ -33,18 +31,6 @@ public interface ISystemFilterPool extends IRSEPersistableReferencedObject, ISys
*/ */
public ISystemFilterPoolManagerProvider getProvider(); 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. * @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); public void orderSystemFilters(String[] names);
/**
* Set the save file policy. See constants in SystemFilterConstants. One of:
* <ul>
* <li>SAVE_POLICY_ONE_FILE_PER_POOL
* <li>SAVE_POLICY_ONE_FILE_PER_FILTER
* </ul>
* 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. * @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(); 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 * @return The value of the SupportsDuplicateFilterStrings attribute

View file

@ -18,67 +18,16 @@
package org.eclipse.rse.core.filters; package org.eclipse.rse.core.filters;
import java.util.Vector;
import org.eclipse.rse.core.model.IRSEPersistableContainer; import org.eclipse.rse.core.model.IRSEPersistableContainer;
import org.eclipse.rse.core.model.ISystemProfile; import org.eclipse.rse.core.model.ISystemProfile;
/** /**
* A filter pool manager manages filter pools. * A filter pool manager manages filter pools.
* <p> * <p>
* Each filter pool that is managed becomes a folder on disk.
* <p>
* 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.
* <p>
* 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:
* <ul>
* <li>SAVE_POLICY_ONE_FILE_PER_MANAGER - one file: mgrName.xmi
* <li>SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL - one file and folder per pool
* <li>SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER - one file per pool, all files in one folder
* <li>SAVE_POLICY_ONE_FILE_PER_FILTER - one file per filter, one folder per pool
* </ul>
* <p>
* With the policy of one file per pool, there are two possibilities regarding
* the folder structure:
* <ul>
* <li>Each pool gets its own subfolder, and the pool's xmi file goes in
* the pool's unique subfolder: SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL
* <li>There are no subfolders per pool, all the xmi pool files go in the
* same folder as specified when creating this manager instance:
* SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER
* </ul>
* <p>
* With the policy of one file per filter, each filter pool must have its own folder.
* <p>
* 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:
* <ul>
* <li>Restore all filter pools from disk
* <li>Save all, or individual, filter pools to disk
* <li>Get a list of existing filter pools
* <li>Create filter pools
* <li>Delete filter pools
* <li>Re-order filter pools
* <li>Clone filter pools
* <li>Rename filter pools
* <li>Save all, or individual, filter pools
* </ul>
* All the underlying file system work is handled for you.
* <p>
* Further, this is the front door for working with filters too. By forcing all * 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 * filter related activity through a single point like this, we can ensure that
* all changes are saved to disk, and events are fired properly. * all changes are saved to disk, and events are fired properly.
*/ */
/**
* @lastgen interface SystemFilterPoolManager {}
*/
public interface ISystemFilterPoolManager extends IRSEPersistableContainer { public interface ISystemFilterPoolManager extends IRSEPersistableContainer {
// --------------------------------- // ---------------------------------
// ATTRIBUTE METHODS // ATTRIBUTE METHODS
@ -166,11 +115,6 @@ public interface ISystemFilterPoolManager extends IRSEPersistableContainer {
*/ */
public String[] getSystemFilterPoolNames(); public String[] getSystemFilterPoolNames();
/**
* Get vector of filter pool names currently existing.
*/
public Vector getSystemFilterPoolNamesVector();
/** /**
* Return array of SystemFilterPools managed by this manager. * 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 aliasName The name to give the new filter. Must be unique for this pool.
* @param filterStrings The list of String objects that represent the filter strings. * @param 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. * 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. * takes a filter type as an additional parameter.
* <p> * <p>
* A filter's type is an arbitrary string that is not interpreted or used by the base framework. This * 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 filterStrings The list of String objects that represent the filter strings.
* @param type The type of this filter * @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 * 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. * takes a boolean indicating if it is promptable.
* <p> * <p>
* A promptable filter is one in which the user is prompted for information at expand time. * 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 type The type of this filter
* @param promptable Pass true if this is a promptable 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. * Delete an existing system filter.
@ -567,12 +511,6 @@ public interface ISystemFilterPoolManager extends IRSEPersistableContainer {
*/ */
void setStringsCaseSensitive(boolean value); 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 * @generated This field/method will be replaced during code generation
* @return The value of the SupportsDuplicateFilterStrings attribute * @return The value of the SupportsDuplicateFilterStrings attribute

View file

@ -17,9 +17,6 @@
package org.eclipse.rse.core.filters; 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.references.IRSEBasePersistableReferenceManager;
import org.eclipse.rse.core.subsystems.ISubSystem; import org.eclipse.rse.core.subsystems.ISubSystem;
@ -258,40 +255,4 @@ public interface ISystemFilterPoolReferenceManager extends IRSEBasePersistableRe
*/ */
public int getSystemFilterReferencePosition(ISubSystem subSystem, ISystemFilter filter); 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.
* <p>
* This method is called after restore and for each restored object in the list must:
* <ol>
* <li>Do what is necessary to find the referenced object, and set the internal reference pointer.
* <li>Call addReference(this) on that object so it can maintain it's in-memory list
* of all referencing objects.
* <li>Set the important transient variables
* </ol>
* @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);
} }

View file

@ -26,9 +26,6 @@ import org.eclipse.rse.core.subsystems.ISubSystem;
* Represents a shadow or reference to a system filter. * Represents a shadow or reference to a system filter.
* Such references are only transient, not savable to disk. * Such references are only transient, not savable to disk.
*/ */
/**
* @lastgen interface SystemFilterReference extends SystemReferencingObject, SystemFilterContainerReference {}
*/
public interface ISystemFilterReference extends IRSEReferencingObject, ISystemFilterContainerReference, ISystemContainer { public interface ISystemFilterReference extends IRSEReferencingObject, ISystemFilterContainerReference, ISystemContainer {
/** /**
* Return the reference manager which is managing this filter reference * 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 * 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);

View file

@ -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;
}

View file

@ -15,12 +15,6 @@ import org.eclipse.rse.logging.Logger;
public interface ISystemFilterStartHere { 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 * 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 * 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. * this manager will contain references to.
* @param name the name of the filter pool reference manager. This is not currently * @param name the name of the filter pool reference manager. This is not currently
* used, but you may find a use for it. * 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, public ISystemFilterPoolReferenceManager createSystemFilterPoolReferenceManager(ISystemFilterPoolReferenceManagerProvider caller, ISystemFilterPoolManagerProvider relatedPoolMgrProvider,
String name, IRSEFilterNamingPolicy namingPolicy); String name);
} }

View file

@ -20,9 +20,8 @@ package org.eclipse.rse.core.filters;
import org.eclipse.rse.core.references.IRSEBaseReferencingObject; import org.eclipse.rse.core.references.IRSEBaseReferencingObject;
/** /**
* Represents a reference to a master filter string. * Represents a reference to a filter string.
* Needed so GUI can show the same filter string multiple times. * Needed so the UI can show the same filter string multiple times.
* This is not modelled in MOF.
*/ */
public interface ISystemFilterStringReference extends IRSEBaseReferencingObject { public interface ISystemFilterStringReference extends IRSEBaseReferencingObject {
/** /**
@ -57,4 +56,4 @@ public interface ISystemFilterStringReference extends IRSEBaseReferencingObject
* Same as getReferencedFilterString().getString() * Same as getReferencedFilterString().getString()
*/ */
public String getString(); public String getString();
} //SystemFilterStringReference }

View file

@ -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.
* <p>
* 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.
* <p>
* 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.
* <p>
* 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.
* <p>
* 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
* <p>
* By default returns "filterPool_"
*/
public String getFilterPoolSaveFileNamePrefix() {
return DEFAULT_FILENAME_PREFIX_FILTERPOOL;
}
/**
* Get the folder name for the given SystemFilterPool object.
* <p>
* 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
* <p>
* 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.
* <p>
* 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
* <p>
* Returns "Filter_" by default.
*/
public String getFilterSaveFileNamePrefix() {
return DEFAULT_FILENAME_PREFIX_FILTER;
}
}

View file

@ -15,8 +15,11 @@
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.core.filters; package org.eclipse.rse.core.filters;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.Platform; 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.core.filters.SystemFilterStringReference;
import org.eclipse.rse.internal.references.SystemReferencingObject; import org.eclipse.rse.internal.references.SystemReferencingObject;
/** /**
* Represents a shadow or reference to a system filter. * Represents a shadow or reference to a system filter.
* Such references are only transient, not savable to disk. * 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 {} * @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 SystemFilterContainerReferenceCommonMethods containerHelper = null;
private ISystemFilterContainerReference parent = null; private ISystemFilterContainerReference parent = null;
private ISystemFilter referencedFilter = null; private ISystemFilter referencedFilter = null;
private ISystemFilterStringReference[] referencedFilterStrings = null; private ISystemFilterStringReference[] referencedFilterStrings = null;
protected boolean persistent; protected boolean persistent;
protected boolean isStale; protected boolean isStale;
// protected Object[] cachedContents; // protected Object[] cachedContents;
protected ISubSystem _subSystem; protected ISubSystem _subSystem;
protected HashMap cachedContents; protected HashMap cachedContents;
public static final boolean PERSISTENT_YES = true; 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(); super();
containerHelper = new SystemFilterContainerReferenceCommonMethods(this); containerHelper = new SystemFilterContainerReferenceCommonMethods(this);
persistent = true; persistent = true;
isStale = true; isStale = true;
cachedContents = new HashMap(); cachedContents = new HashMap();
} }
/** /**
* Create a new instance of this class. * Create a new instance of this class.
* @param parent The SystemFilterReference or SystemFilterPoolReference object that we are a child of. * @param parent The SystemFilterReference or SystemFilterPoolReference object that we are a child of.
* @param filter The master object to be referenced. * @param filter The master object to be referenced.
* @param persistent Whether we should formally register our reference with the target filter or not. * @param persistent Whether we should formally register our reference with the target filter or not.
*/ */
public static ISystemFilterReference createSystemFilterReference(ISubSystem subSystem, public static ISystemFilterReference createSystemFilterReference(ISubSystem subSystem, ISystemFilterContainerReference parent, ISystemFilter filter, boolean persistent) {
ISystemFilterContainerReference parent, SystemFilterReference newRef = new SystemFilterReference();
ISystemFilter filter,
boolean persistent)
{
//SystemFilterReferenceImpl newRef = (SystemFilterReferenceImpl)SystemFilterImpl.initMOF().createSystemFilterReference();
SystemFilterReference newRef = new SystemFilterReference(); // more efficient?
newRef.persistent = persistent; newRef.persistent = persistent;
newRef.setSubSystem(subSystem); newRef.setSubSystem(subSystem);
newRef.setParent(parent); newRef.setParent(parent);
newRef.setReferencedFilter(filter); newRef.setReferencedFilter(filter);
filter.addReference(newRef); filter.addReference(newRef);
return newRef; return newRef;
} }
@ -97,113 +93,102 @@ public class SystemFilterReference extends SystemReferencingObject implements IA
* Gets the subsystem that contains this reference * Gets the subsystem that contains this reference
* @return the subsystem * @return the subsystem
*/ */
public ISubSystem getSubSystem() public ISubSystem getSubSystem() {
{
return _subSystem; return _subSystem;
} }
/** /**
* Sets the subsystem that contains this reference * 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; _subSystem = subSystem;
} }
/** /**
* Return the reference manager which is managing this filter reference * Return the reference manager which is managing this filter reference
* framework object. * framework object.
*/ */
public ISystemFilterPoolReferenceManager getFilterPoolReferenceManager() public ISystemFilterPoolReferenceManager getFilterPoolReferenceManager() {
{
ISystemFilterPoolReference pool = getParentSystemFilterReferencePool(); ISystemFilterPoolReference pool = getParentSystemFilterReferencePool();
if (pool != null) if (pool != null)
return pool.getFilterPoolReferenceManager(); return pool.getFilterPoolReferenceManager();
else else
return null; return null;
} }
/** /**
* Return the object which instantiated the pool reference manager object. * 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 * Makes it easy to get back to the point of origin, given any filter reference
* framework object * framework object
*/ */
public ISystemFilterPoolReferenceManagerProvider getProvider() public ISystemFilterPoolReferenceManagerProvider getProvider() {
{ ISystemFilterPoolReferenceManager mgr = getFilterPoolReferenceManager();
ISystemFilterPoolReferenceManager mgr = getFilterPoolReferenceManager(); if (mgr != null) {
if (mgr != null) ISystemFilterPoolReferenceManagerProvider provider = mgr.getProvider();
{ if (provider == null) {
ISystemFilterPoolReferenceManagerProvider provider = mgr.getProvider(); provider = getSubSystem();
if (provider == null) }
{ return provider;
provider = getSubSystem(); } else
} return null;
return provider; }
}
else
return null;
}
/**
/** * If this is a reference to a nested filter, the parent is the
* 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 nested filter's parent. Else, it is the * reference to the parent filter pool
* reference to the parent filter pool */
*/ public void setParent(ISystemFilterContainerReference parent) {
public void setParent(ISystemFilterContainerReference parent) this.parent = parent;
{ }
this.parent = parent;
} /**
/** * The parent will either by a SystemFilterPoolReference or
* The parent will either by a SystemFilterPoolReference or * a SystemFilterReference.
* a SystemFilterReference. */
*/ public ISystemFilterContainerReference getParent() {
public ISystemFilterContainerReference getParent() return parent;
{ }
return parent;
}
/** /**
* Return the filter to which we reference... * Return the filter to which we reference...
*/ */
public ISystemFilter getReferencedFilter() public ISystemFilter getReferencedFilter() {
{ return persistent ? (ISystemFilter) super.getReferencedObject() : referencedFilter;
return persistent ? (ISystemFilter)super.getReferencedObject() : referencedFilter;
} }
/** /**
* Set the filter to which we reference... * Set the filter to which we reference...
*/ */
public void setReferencedFilter(ISystemFilter filter) public void setReferencedFilter(ISystemFilter filter) {
{
if (persistent) if (persistent)
super.setReferencedObject(filter); super.setReferencedObject(filter);
else else
referencedFilter = filter; referencedFilter = filter;
} }
/** /**
* If this is a reference to a nested filter, the parent is the * 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 nested filter's parent. Else, it is the
* reference to the parent filter pool * reference to the parent filter pool
*/ */
public ISystemFilterPoolReference getParentSystemFilterReferencePool() public ISystemFilterPoolReference getParentSystemFilterReferencePool() {
{ if (parent instanceof ISystemFilterPoolReference)
if (parent instanceof ISystemFilterPoolReference) return (ISystemFilterPoolReference) parent;
return (ISystemFilterPoolReference)parent; else
else return ((ISystemFilterReference) parent).getParentSystemFilterReferencePool();
return ((ISystemFilterReference)parent).getParentSystemFilterReferencePool(); }
}
/** /**
* This is the method required by the IAdaptable interface. * This is the method required by the IAdaptable interface.
* Given an adapter class type, return an object castable to the type, or * Given an adapter class type, return an object castable to the type, or
* null if this is not possible. * null if this is not possible.
*/ */
public Object getAdapter(Class adapterType) public Object getAdapter(Class adapterType) {
{ return Platform.getAdapterManager().getAdapter(this, adapterType);
return Platform.getAdapterManager().getAdapter(this, adapterType); }
}
// ------------------------------------------------------------- // -------------------------------------------------------------
// Methods common with SystemFilterPoolReferenceImpl, and hence // Methods common with SystemFilterPoolReferenceImpl, and hence
// abstracted out into SystemFilterContainerReference... // 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 * true that we only hold a SystemFilter. Hence, this is the same
* as calling getReferenceFilter and casting the result. * as calling getReferenceFilter and casting the result.
*/ */
public ISystemFilterContainer getReferencedSystemFilterContainer() public ISystemFilterContainer getReferencedSystemFilterContainer() {
{
return getReferencedFilter(); return getReferencedFilter();
} }
/** /**
* Build and return an array of SystemFilterReference objects. * Build and return an array of SystemFilterReference objects.
* Each object is created new. There is one for each of the filters * 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 * return a fresh one if something changes in the underlying
* filter list. * filter list.
*/ */
public ISystemFilterReference[] getSystemFilterReferences(ISubSystem subSystem) public ISystemFilterReference[] getSystemFilterReferences(ISubSystem subSystem) {
{ List references = containerHelper.getSystemFilterReferences(subSystem);
return containerHelper.getSystemFilterReferences(subSystem); ISystemFilterReference[] result = new ISystemFilterReference[references.size()];
} references.toArray(result);
/** return result;
* 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();
}
/** /**
* Return count of the number of filters in the referenced pool or filter * Create a single filter refererence to a given filter.
*/ * If there already is a reference to this filter, it is returned.
public int getFilterCount() * If not, a new reference is created and appended to the end of the existing filter reference array.
{ * @see #getExistingSystemFilterReference(ISubSystem, ISystemFilter)
return containerHelper.getFilterCount(); */
} 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. * Return an existing reference to a given system filter.
* For such objects this is what we show in the GUI. * If no reference currently exists to this filter, returns null.
*/ * @see #getSystemFilterReference(ISubSystem, ISystemFilter)
public String getName() */
{ 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(); ISystemFilter filter = getReferencedFilter();
if (filter != null) if (filter != null)
return filter.getName(); return filter.getName();
else else
return ""; //$NON-NLS-1$ return ""; //$NON-NLS-1$
} }
/** /**
* Override of Object method. Turn this filter in an outputable string * Override of Object method. Turn this filter in an outputable string
*/ */
public String toString() public String toString() {
{
return getName(); 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 // Methods for returning filter string references...
*/ // -------------------------------------------------
public ISystemFilterStringReference getSystemFilterStringReference(ISystemFilterString filterString) /**
{ * Return the number of filter strings in the referenced filter
return new SystemFilterStringReference(this, filterString); */
} 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,
* To save memory, we try to only regenerate the referenced filter list * not the masters.
* if something has changed. */
*/ public ISystemFilterStringReference[] getSystemFilterStringReferences() {
private boolean compareFilterStrings(java.util.List newFilterStrings) // These reference objects are built on the fly, each time, rather than
{ // maintaining a persisted list of such references. The reason
boolean mustReGen = false; // is we do no at this time allow users to subset the master list
if (newFilterStrings == null) // of strings maintained by a filter. Hence, we always simply
{ // return a complete list. However, to save memory we try to only
if (referencedFilterStrings != null) // re-gen the list if something has changed.
return true; ISystemFilterString[] filterStrings = getReferencedFilter().getStrings();
else List filterStringList = Arrays.asList(filterStrings);
return false; boolean needToReGen = compareFilterStrings(filterStringList);
} if (needToReGen) referencedFilterStrings = generateFilterStringReferences(filterStringList);
else if (referencedFilterStrings == null) return referencedFilterStrings;
{ }
return true; // newFilterStrings != null && referencedFilterStrings == null
} /**
// both old and new are non-null * Create a single filter string refererence to a given filter string
if (newFilterStrings.size() != referencedFilterStrings.length) */
return true; public ISystemFilterStringReference getSystemFilterStringReference(ISystemFilterString filterString) {
Iterator i = newFilterStrings.iterator(); return new SystemFilterStringReference(this, filterString);
for (int idx=0; !mustReGen && (idx<referencedFilterStrings.length); idx++) }
{
ISystemFilterString newFilterString = (ISystemFilterString)i.next(); /**
if (!(referencedFilterStrings[idx].getReferencedFilterString().equals(newFilterString))) * To save memory, we try to only regenerate the referenced filter list
mustReGen = true; * if something has changed.
} */
return mustReGen; private boolean compareFilterStrings(List newFilterStrings) {
} boolean mustReGen = false;
if (newFilterStrings == null) {
/** if (referencedFilterStrings != null)
* To save the memory of an intermediate array, we create the filter string references return true;
* directly from the MOF model... else
*/ return false;
private ISystemFilterStringReference[] generateFilterStringReferences(java.util.List newFilterStrings) } else if (referencedFilterStrings == null) {
{ return true; // newFilterStrings != null && referencedFilterStrings == null
if (newFilterStrings == null) }
return null; // both old and new are non-null
ISystemFilterStringReference[] refs = new ISystemFilterStringReference[newFilterStrings.size()]; if (newFilterStrings.size() != referencedFilterStrings.length) return true;
Iterator i = newFilterStrings.iterator(); Iterator i = newFilterStrings.iterator();
int idx = 0; for (int idx = 0; !mustReGen && (idx < referencedFilterStrings.length); idx++) {
while (i.hasNext()) ISystemFilterString newFilterString = (ISystemFilterString) i.next();
{ if (!(referencedFilterStrings[idx].getReferencedFilterString().equals(newFilterString))) mustReGen = true;
refs[idx++] = getSystemFilterStringReference((ISystemFilterString)i.next()); }
} return mustReGen;
return refs; }
}
/**
* Get references to filter strings from a list of the filter strings
*/
private ISystemFilterStringReference[] generateFilterStringReferences(List newFilterStrings) {
if (newFilterStrings == null) return null;
ISystemFilterStringReference[] refs = new ISystemFilterStringReference[newFilterStrings.size()];
Iterator i = newFilterStrings.iterator();
int idx = 0;
while (i.hasNext()) {
refs[idx++] = getSystemFilterStringReference((ISystemFilterString) i.next());
}
return refs;
}
// ----------------------------------- // -----------------------------------
// IRSEReferencingObject methods... // IRSEReferencingObject methods...
@ -390,108 +357,95 @@ public class SystemFilterReference extends SystemReferencingObject implements IA
/** /**
* Set the object to which we reference. Override of inherited * Set the object to which we reference. Override of inherited
*/ */
public void setReferencedObject(IRSEBaseReferencedObject obj) public void setReferencedObject(IRSEBaseReferencedObject obj) {
{ setReferencedFilter((ISystemFilter) obj);
setReferencedFilter((ISystemFilter)obj);
} }
/** /**
* Get the object which we reference. Override of inherited * Get the object which we reference. Override of inherited
*/ */
public IRSEBaseReferencedObject getReferencedObject() public IRSEBaseReferencedObject getReferencedObject() {
{
return getReferencedFilter(); return getReferencedFilter();
} }
/** /**
* Fastpath to getReferencedObject().removeReference(this). * Fastpath to getReferencedObject().removeReference(this).
* @return new reference count of master object * @return new reference count of master object
*/ */
public int removeReference() public int removeReference() {
{
int count = 0; int count = 0;
if (persistent) if (persistent) super.removeReference();
super.removeReference();
setReferencedFilter(null); setReferencedFilter(null);
return count; return count;
} }
/* (non-Javadoc)
* @see org.eclipse.rse.model.ISystemContainer#hasContents(org.eclipse.rse.model.ISystemContentsType)
*/
public boolean hasContents(ISystemContentsType contentsType)
{
if (cachedContents.containsKey(contentsType))
{
return true;
}
return false;
}
/* (non-Javadoc)
* @see org.eclipse.rse.model.ISystemContainer#getContents(org.eclipse.rse.model.ISystemContentsType)
*/
public Object[] getContents(ISystemContentsType contentsType)
{
return (Object[])cachedContents.get(contentsType);
}
public void setContents(ISystemContentsType type, Object[] cachedContents)
{
this.cachedContents.put(type, cachedContents);
isStale = false;
}
/* (non-Javadoc)
* @see org.eclipse.rse.model.ISystemContainer#isStale()
*/
public boolean isStale()
{
return isStale;
}
/* (non-Javadoc)
* @see org.eclipse.rse.model.ISystemContainer#markStale(boolean)
*/
public void markStale(boolean isStale)
{
markStale(isStale, true);
}
/* (non-Javadoc)
* @see org.eclipse.rse.model.ISystemContainer#markStale(boolean)
*/
public void markStale(boolean isStale, boolean clearCache)
{
this.isStale = isStale;
if (clearCache && isStale)
{
Iterator iterator = cachedContents.values().iterator();
while (iterator.hasNext())
{
Object[] arr = (Object[])iterator.next();
for (int i = 0; i < arr.length; i++)
{
Object obj = arr[i];
if (obj instanceof ISystemContainer)
{
((ISystemContainer)obj).markStale(true);
}
}
}
cachedContents.clear();
}
}
public boolean commit() /* (non-Javadoc)
{ * @see org.eclipse.rse.model.ISystemContainer#hasContents(org.eclipse.rse.model.ISystemContentsType)
*/
public boolean hasContents(ISystemContentsType contentsType) {
if (cachedContents.containsKey(contentsType)) {
return true;
}
return false; return false;
} }
public IRSEPersistableContainer getPersistableParent() { /* (non-Javadoc)
return null; * @see org.eclipse.rse.model.ISystemContainer#getContents(org.eclipse.rse.model.ISystemContentsType)
} */
public Object[] getContents(ISystemContentsType contentsType) {
public IRSEPersistableContainer[] getPersistableChildren() { return (Object[]) cachedContents.get(contentsType);
return IRSEPersistableContainer.NO_CHILDREN; }
}
public void setContents(ISystemContentsType type, Object[] cachedContents) {
this.cachedContents.put(type, cachedContents);
isStale = false;
}
/* (non-Javadoc)
* @see org.eclipse.rse.model.ISystemContainer#isStale()
*/
public boolean isStale() {
return isStale;
}
/* (non-Javadoc)
* @see org.eclipse.rse.model.ISystemContainer#markStale(boolean)
*/
public void markStale(boolean isStale) {
markStale(isStale, true);
}
/* (non-Javadoc)
* @see org.eclipse.rse.model.ISystemContainer#markStale(boolean)
*/
public void markStale(boolean isStale, boolean clearCache) {
this.isStale = isStale;
if (clearCache && isStale) {
Iterator iterator = cachedContents.values().iterator();
while (iterator.hasNext()) {
Object[] arr = (Object[]) iterator.next();
for (int i = 0; i < arr.length; i++) {
Object obj = arr[i];
if (obj instanceof ISystemContainer) {
((ISystemContainer) obj).markStale(true);
}
}
}
cachedContents.clear();
}
}
public boolean commit() {
return false;
}
public IRSEPersistableContainer getPersistableParent() {
return null;
}
public IRSEPersistableContainer[] getPersistableChildren() {
return IRSEPersistableContainer.NO_CHILDREN;
}
} }

View file

@ -23,7 +23,6 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Vector;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.rse.core.model.ISystemContainer; import org.eclipse.rse.core.model.ISystemContainer;
@ -78,7 +77,7 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer
*/ */
public void clone(ISystemFilter targetFilter) { public void clone(ISystemFilter targetFilter) {
super.clone(targetFilter); super.clone(targetFilter);
targetFilter.setFilterStrings(getFilterStringsVector()); targetFilter.setFilterStrings(getFilterStrings());
} }
// ------------------------------------------------------- // -------------------------------------------------------
@ -197,15 +196,6 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer
return result; return result;
} }
/**
* Return filter strings as a Vector of String objects
*/
public Vector getFilterStringsVector() {
Vector result = new Vector(filterStrings.size());
result.addAll(filterStrings);
return result;
}
/** /**
* Return how many filter strings are defined in this filter. * Return how many filter strings are defined in this filter.
*/ */
@ -213,15 +203,6 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer
return filterStrings.size(); return filterStrings.size();
} }
/**
* Set all the filter strings for this filter.
* @param newStrings Vector of String objects
*/
public void setFilterStrings(Vector newStrings) {
filterStrings.clear();
filterStrings.addAll(newStrings);
}
/** /**
* Set all the filter strings for this filter. * Set all the filter strings for this filter.
* @param newStrings array of String objects * @param newStrings array of String objects
@ -382,24 +363,17 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer
} }
/** /**
* Overridden to return null * Overridden to return an empty array
*/ */
public Vector getSystemFilterNames() { public String[] getSystemFilterNames() {
return null; return new String[0];
} }
/** /**
* Overridden to return null * Overridden to return an empty array
*/ */
public java.util.List getNestedFilters() { public ISystemFilter[] getNestedFilters() {
return null; return new ISystemFilter[0];
}
/**
* Overridden to return null
*/
public Vector getSystemFiltersVector() {
return null;
} }
/** /**
@ -417,10 +391,10 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer
} }
/** /**
* Overridden to return null * Overridden to return an empty array
*/ */
public java.util.List getStrings() { public ISystemFilterString[] getStrings() {
return null; return new ISystemFilterString[0];
} }
/** /**

View file

@ -17,7 +17,6 @@
package org.eclipse.rse.core.references; package org.eclipse.rse.core.references;
import org.eclipse.core.resources.IFolder;
/** /**
* A class for managing a list of shadow objects that reference master objects. * A class for managing a list of shadow objects that reference master objects.
@ -140,29 +139,6 @@ public interface IRSEBasePersistableReferenceManager {
*/ */
public IRSEBasePersistableReferencingObject getReferencedObject(IRSEBasePersistableReferencedObject object); public IRSEBasePersistableReferencingObject getReferencedObject(IRSEBasePersistableReferencedObject object);
/**
* 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;
/**
* After restoring this from disk, there is only the referenced object name,
* not the referenced object pointer, for each referencing object.
* <p>
* This method is called after restore and for each restored object in the list must:
* <ol>
* <li>Do what is necessary to find the referenced object, and set the internal reference pointer.
* <li>Call addReference(this) on that object so it can maintain it's in-memory list
* of all referencing objects.
* </ol>
* @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 * @generated This field/method will be replaced during code generation
* @return The value of the Name attribute * @return The value of the Name attribute

View file

@ -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.
* <p>
* 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.
* <p>
* 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.
* <p>
* 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
* <p>
* By default returns "filterPool_"
*/
public String getFilterPoolSaveFileNamePrefix() {
return super.getFilterPoolSaveFileNamePrefix();
}
/**
* Get the folder name for the given SystemFilterPool object.
* <p>
* 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
* <p>
* 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.
* <p>
* 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
* <p>
* Returns "Filter_" by default.
*/
public String getFilterSaveFileNamePrefix() {
return super.getFilterSaveFileNamePrefix();
}
}

View file

@ -20,17 +20,14 @@
package org.eclipse.rse.internal.core.filters; package org.eclipse.rse.internal.core.filters;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.Platform; 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.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterContainer; import org.eclipse.rse.core.filters.ISystemFilterContainer;
import org.eclipse.rse.core.filters.ISystemFilterPool; 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 internal way to get filters. Makes it easy to change in future, if we don't use MOF.
*/ */
private List internalGetFilters() { 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 aliasName The name to give the new filter. Must be unique for this pool.
* @param filterStrings The list of String objects that represent the filter strings. * @param 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); ISystemFilter newFilter = helpers.createSystemFilter(internalGetFilters(), getParentFilterPool(), aliasName, filterStrings);
newFilter.setSupportsNestedFilters(true); // presumably it does since it is nested itself. newFilter.setSupportsNestedFilters(true); // presumably it does since it is nested itself.
newFilter.setSupportsDuplicateFilterStrings(supportsDuplicateFilterStrings()); newFilter.setSupportsDuplicateFilterStrings(supportsDuplicateFilterStrings());
@ -126,7 +123,6 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte
* Internal use method * Internal use method
*/ */
public void initializeFilterStrings() { public void initializeFilterStrings() {
List filterStrings = getStrings();
Iterator i = filterStrings.iterator(); Iterator i = filterStrings.iterator();
while (i.hasNext()) while (i.hasNext())
((ISystemFilterString) i.next()).setParentSystemFilter(this); ((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. * 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. * 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 the nested filters as a Vector return result;
*/
public Vector getSystemFiltersVector() {
return helpers.getSystemFiltersVector(internalGetFilters());
} }
/** /**
@ -385,26 +378,6 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte
return result; 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. * 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() { public ISystemFilterString[] getSystemFilterStrings() {
ISystemFilterString[] result = new ISystemFilterString[filterStrings.size()]; 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. * This is all nested filters and all filter strings.
*/ */
public Object[] getChildren() { public Object[] getChildren() {
Vector strings = getFilterStringsVector(); String[] strings = getFilterStrings();
Vector filters = getSystemFiltersVector(); ISystemFilter[] filters = getSystemFilters();
Vector vChildren = new Vector(); Vector vChildren = new Vector();
// start with nested filters... // start with nested filters...
for (int idx = 0; idx < filters.size(); idx++) for (int idx = 0; idx < filters.length; idx++) {
vChildren.addElement(filters.elementAt(idx)); vChildren.addElement(filters[idx]);
}
// continue with resolved filter string objects... // continue with resolved filter string objects...
for (int idx = 0; idx < strings.size(); idx++) { for (int idx = 0; idx < strings.length; idx++) {
String filterString = (String) strings.elementAt(idx); String filterString = strings[idx];
vChildren.addElement(filterString); vChildren.addElement(filterString);
} }
@ -630,71 +604,6 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte
return null; 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 * Attribute getters and setters
*-------------------*/ *-------------------*/
@ -841,18 +750,22 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.core.filters.ISystemFilter#getNestedFilters() * @see org.eclipse.rse.core.filters.ISystemFilter#getNestedFilters()
*/ */
public List getNestedFilters() { public ISystemFilter[] getNestedFilters() {
if (nestedFilters == null) { if (nestedFilters == null) {
nestedFilters = new ArrayList(); nestedFilters = new ArrayList();
} }
return nestedFilters; ISystemFilter[] result = new ISystemFilter[nestedFilters.size()];
nestedFilters.toArray(result);
return result;
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.core.filters.ISystemFilter#getStrings() * @see org.eclipse.rse.core.filters.ISystemFilter#getStrings()
*/ */
public List getStrings() { public ISystemFilterString[] getStrings() {
return filterStrings; ISystemFilterString[] result = new ISystemFilterString[filterStrings.size()];
filterStrings.toArray(result);
return result;
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -1014,8 +927,7 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte
*/ */
public IRSEPersistableContainer[] getPersistableChildren() { public IRSEPersistableContainer[] getPersistableChildren() {
List children = new ArrayList(20); List children = new ArrayList(20);
List nf = getNestedFilters(); // guaranteed to not be null, none of these should be simple filters children.addAll(nestedFilters);
children.addAll(nf);
children.addAll(filterStrings); children.addAll(filterStrings);
children.addAll(Arrays.asList(getPropertySets())); children.addAll(Arrays.asList(getPropertySets()));
IRSEPersistableContainer[] result = new IRSEPersistableContainer[children.size()]; IRSEPersistableContainer[] result = new IRSEPersistableContainer[children.size()];

View file

@ -65,7 +65,7 @@ public class SystemFilterContainerCommonMethods
* @param aliasName The name to give the new filter. Must be unique for this pool. * @param aliasName The name to give the new filter. Must be unique for this pool.
* @param filterStrings The list of String objects that represent the filter strings. * @param 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; ISystemFilter newFilter = null;
// FIXME - not using error message and null return // 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 aliasName The name to give the new filter. Must be unique for this pool.
* @param filterStrings The list of String objects that represent the filter strings. * @param 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; ISystemFilter newFilter = null;
boolean exists = getSystemFilter(filters, aliasName) != null; boolean exists = getSystemFilter(filters, aliasName) != null;
if (exists) { if (exists) {
@ -112,7 +112,7 @@ public class SystemFilterContainerCommonMethods
* Internal encapsulation of mof effort to create new filter, and setting of * Internal encapsulation of mof effort to create new filter, and setting of
* the core attributes. * the core attributes.
*/ */
private ISystemFilter internalCreateSystemFilter(ISystemFilterPool parentPool, String aliasName, Vector filterStrings) { private ISystemFilter internalCreateSystemFilter(ISystemFilterPool parentPool, String aliasName, String[] filterStrings) {
ISystemFilter newFilter = null; ISystemFilter newFilter = null;
try { try {
newFilter = new SystemFilter(); newFilter = new SystemFilter();
@ -415,7 +415,7 @@ public class SystemFilterContainerCommonMethods
*/ */
public ISystemFilter cloneSystemFilter(java.util.List filters, ISystemFilter filter, String aliasName) { 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); internalAfterCloneSystemFilter(filter, copy);
// now clone nested filters... // now clone nested filters...
ISystemFilter[] nested = filter.getSystemFilters(); ISystemFilter[] nested = filter.getSystemFilters();
@ -433,7 +433,7 @@ public class SystemFilterContainerCommonMethods
*/ */
public ISystemFilter cloneSystemFilter(Vector filters, ISystemFilter filter, String aliasName) { 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); internalAfterCloneSystemFilter(filter, copy);
// now clone nested filters... // now clone nested filters...
ISystemFilter[] nested = filter.getSystemFilters(); ISystemFilter[] nested = filter.getSystemFilters();

View file

@ -16,6 +16,9 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.core.filters; package org.eclipse.rse.internal.core.filters;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; 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.filters.SystemFilterReference;
import org.eclipse.rse.core.subsystems.ISubSystem; import org.eclipse.rse.core.subsystems.ISubSystem;
/** /**
* Both SystemFilter and SystemFilterPool contain filters, so the * Both SystemFilter and SystemFilterPool contain filters, so the
* common methods for filters are abstracted out in SystemFilterContainer, * 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 * SystemFilterReferenceImpl and SystemFilterPoolReferenceImpl use this via
* containment. * containment.
*/ */
public class SystemFilterContainerReferenceCommonMethods public class SystemFilterContainerReferenceCommonMethods {
{
private ISystemFilterContainerReference parentRef = null; private ISystemFilterContainerReference parentRef = null;
private ISystemFilterReference[] referencedFilters = null; private List filterReferences = new ArrayList(10);
/** /**
* Constructor * Constructor
* @param parentRef the object we are helping. * @param parentRef the object we are helping.
*/ */
public SystemFilterContainerReferenceCommonMethods(ISystemFilterContainerReference parentRef) public SystemFilterContainerReferenceCommonMethods(ISystemFilterContainerReference parentRef) {
{
super(); super();
this.parentRef = parentRef; this.parentRef = parentRef;
} }
/** /**
* Return the name of the SystemFilter or SystemFilterPool that we reference. * Return true if the referenced pool or filter has filters.
*/ */
public String getName() public boolean hasFilters() {
{ return getFilterCount() > 0;
ISystemFilterContainer parent = parentRef.getReferencedSystemFilterContainer(); }
String name = null;
if (parent instanceof ISystemFilterPool) /**
name = ((ISystemFilterPool)parent).getName(); * Return count of the number of filters in the referenced pool or filter
else */
name = ((ISystemFilter)parent).getName(); public int getFilterCount() {
return name; 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. * @return the list of currently referenced filters
*/ */
public boolean hasFilters() private List getReferencedFilters() {
{ List result = new ArrayList(filterReferences.size());
return getFilterCount() > 0; 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 * Generate references to the filters in the list.
*/ * Attempt to preserve existing references where they are available.
public int getFilterCount() */
{ private void generateFilterReferences(ISubSystem subSystem, List filters) {
int count = 0; List referencedFilters = getReferencedFilters();
ISystemFilterContainer parent = parentRef.getReferencedSystemFilterContainer(); List newReferences = new ArrayList(filters.size());
java.util.List mofList = null; for (Iterator z = filters.iterator(); z.hasNext();) {
if (parent instanceof ISystemFilterPool) ISystemFilter filter = (ISystemFilter) z.next();
mofList = ((ISystemFilterPool)parent).getFilters(); int i = referencedFilters.indexOf(filter);
else ISystemFilterReference reference = (i >= 0) ? (ISystemFilterReference) filterReferences.get(i) : generateFilterReference(subSystem, filter);
mofList = ((ISystemFilter)parent).getNestedFilters(); newReferences.add(reference);
if (mofList != null) }
count = mofList.size(); filterReferences = newReferences;
return count; }
}
/** /**
* Get the list of nested filters referenced by this ISystemFilterContainerReference. * Create a single filter refererence
*/ */
public ISystemFilterReference[] getSystemFilterReferences(ISubSystem subSystem) private ISystemFilterReference generateFilterReference(ISubSystem subSystem, ISystemFilter filter) {
{ ISystemFilterReference result = SystemFilterReference.createSystemFilterReference(subSystem, parentRef, filter, SystemFilterReference.PERSISTENT_NO);
return result;
// 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 && (idx<referencedFilters.length); idx++)
{
ISystemFilter newFilter = (ISystemFilter)i.next();
if (referencedFilters[idx].getReferencedFilter() != newFilter)
mustReGen = true;
}
return mustReGen;
}
/** /**
* To save the memory of an intermediate array, we create the filter references * Create a single filter refererence and append it to the end of the list.
* directly from the MOF model... * This will first check if there already is a reference to the given filter and if so
*/ * will simply return it.
private ISystemFilterReference[] generateFilterReferences(ISubSystem subSystem, java.util.List newFilters) */
{ public ISystemFilterReference generateAndRecordFilterReference(ISubSystem subSystem, ISystemFilter filter) {
if (newFilters == null) generateSystemFilterReferences(subSystem);
return null; ISystemFilterReference reference = getExistingSystemFilterReference(subSystem, filter);
ISystemFilterReference[] oldRefs = referencedFilters; if (reference == null) {
ISystemFilterReference[] refs = new ISystemFilterReference[newFilters.size()]; reference = generateFilterReference(subSystem, filter);
Iterator i = newFilters.iterator(); filterReferences.add(reference);
int idx = 0; }
while (i.hasNext()) return reference;
{ }
ISystemFilter filter = (ISystemFilter)i.next();
boolean foundOldOne = false;
// DKM - first check if we already have a reference for this
if (oldRefs != null)
{
for (int o = 0; o < oldRefs.length && !foundOldOne; o++)
{
ISystemFilterReference oRef = oldRefs[o];
if (oRef.getReferencedFilter() == filter)
{
refs[idx++] = oRef;
foundOldOne = true;
}
}
}
if (!foundOldOne)
{
refs[idx++] = generateFilterReference(subSystem, filter);
}
}
return refs;
}
/** /**
* Create a single filter refererence * Return an existing reference to a given system filter.
*/ * If no reference currently exists to this filter, returns null.
public ISystemFilterReference generateFilterReference( ISubSystem subSystem, ISystemFilter filter) */
{ public ISystemFilterReference getExistingSystemFilterReference(ISubSystem subSystem, ISystemFilter filter) {
return SystemFilterReference.createSystemFilterReference(subSystem, parentRef, filter, SystemFilterReference.PERSISTENT_NO); ISystemFilterReference result = null;
} for (Iterator z = filterReferences.iterator(); z.hasNext() && result == null;) {
/** ISystemFilterReference reference = (ISystemFilterReference) z.next();
* Create a single filter refererence and append it to the end of the list. if (reference.getReferencedFilter() == filter && reference.getSubSystem() == subSystem) {
* This will first check if there already is a reference to the given filter and if so result = reference;
* will simply return it. }
*/ }
public ISystemFilterReference generateAndRecordFilterReference(ISubSystem subSystem, ISystemFilter filter) return result;
{ }
getSystemFilterReferences(subSystem); // regenerate all references if needed
ISystemFilterReference sfr = getExistingSystemFilterReference(subSystem, filter); /**
if (sfr == null) // still no reference exist? * @return a list of ISystemFilter objects.
{ */
/* */ private List getFiltersFromParent() {
sfr = generateFilterReference(subSystem, filter); ISystemFilterContainer parent = parentRef.getReferencedSystemFilterContainer();
int currLength = 0; ISystemFilter[] filters = null;
if (referencedFilters != null) if (parent instanceof ISystemFilterPool) {
currLength = referencedFilters.length; filters = ((ISystemFilterPool) parent).getFilters();
int newLength = currLength + 1; } else if (parent instanceof ISystemFilter) {
ISystemFilterReference[] newRefs = new ISystemFilterReference[newLength]; filters = ((ISystemFilter) parent).getNestedFilters();
for (int idx=0; idx<currLength; idx++) } else {
{ filters = new ISystemFilter[0];
newRefs[idx] = referencedFilters[idx]; }
} List result = Arrays.asList(filters);
newRefs[newLength-1] = sfr; return result;
referencedFilters = newRefs; }
} }
return sfr;
}
/**
* Return an existing reference to a given system filter.
* If no reference currently exists to this filter, returns null.
*/
public ISystemFilterReference getExistingSystemFilterReference(ISubSystem subSystem, ISystemFilter filter)
{
ISystemFilterReference ref = null;
ISystemFilterReference[] refs = referencedFilters;
if ((refs != null) && (refs.length>0))
{
for (int idx=0; (ref==null) && (idx<refs.length); idx++)
{
ISystemFilterReference aref = refs[idx];
if (aref.getReferencedFilter() == filter && aref.getSubSystem() == subSystem)
ref = aref;
}
}
return ref;
}
}

View file

@ -21,19 +21,14 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; 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.IAdaptable;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.SystemResourceHelpers;
import org.eclipse.rse.core.filters.IRSEFilterNamingPolicy;
import org.eclipse.rse.core.filters.ISystemFilter; import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterPool; import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.core.filters.ISystemFilterPoolManager; import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider; import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
import org.eclipse.rse.core.filters.SystemFilterNamingPolicy;
import org.eclipse.rse.core.model.IRSEPersistableContainer; import org.eclipse.rse.core.model.IRSEPersistableContainer;
import org.eclipse.rse.core.model.ISystemProfile; import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.internal.core.RSECoreMessages; import org.eclipse.rse.internal.core.RSECoreMessages;
@ -60,27 +55,17 @@ public class SystemFilterPool extends SystemPersistableReferencedObject
/** /**
* The default value of the '{@link #getName() <em>Name</em>}' attribute. * The default value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName() * @see #getName()
* @generated
* @ordered
*/ */
protected static final String NAME_EDEFAULT = null; protected static final String NAME_EDEFAULT = null;
private String name; private String name;
/** /**
* The default value of the '{@link #getType() <em>Type</em>}' attribute. * The default value of the '{@link #getType() <em>Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getType() * @see #getType()
* @generated
* @ordered
*/ */
protected static final String TYPE_EDEFAULT = null; protected static final String TYPE_EDEFAULT = null;
private int savePolicy;
private IRSEFilterNamingPolicy namingPolicy = null;
private ISystemFilterPoolManager mgr; private ISystemFilterPoolManager mgr;
private SystemFilterContainerCommonMethods helpers = null; private SystemFilterContainerCommonMethods helpers = null;
private Object filterPoolData = null; private Object filterPoolData = null;
@ -93,13 +78,10 @@ public class SystemFilterPool extends SystemPersistableReferencedObject
* @generated This field/method will be replaced during code generation. * @generated This field/method will be replaced during code generation.
*/ */
protected String type = TYPE_EDEFAULT; protected String type = TYPE_EDEFAULT;
/** /**
* The default value of the '{@link #isSupportsNestedFilters() <em>Supports Nested Filters</em>}' attribute. * The default value of the '{@link #isSupportsNestedFilters() <em>Supports Nested Filters</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSupportsNestedFilters() * @see #isSupportsNestedFilters()
* @generated
* @ordered
*/ */
protected static final boolean SUPPORTS_NESTED_FILTERS_EDEFAULT = false; 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. * @generated This field/method will be replaced during code generation.
*/ */
protected boolean supportsNestedFilters = SUPPORTS_NESTED_FILTERS_EDEFAULT; protected boolean supportsNestedFilters = SUPPORTS_NESTED_FILTERS_EDEFAULT;
/** /**
* The default value of the '{@link #isDeletable() <em>Deletable</em>}' attribute. * The default value of the '{@link #isDeletable() <em>Deletable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isDeletable() * @see #isDeletable()
* @generated
* @ordered
*/ */
protected static final boolean DELETABLE_EDEFAULT = false; protected static final boolean DELETABLE_EDEFAULT = false;
/** /**
* @generated This field/method will be replaced during code generation. * @generated This field/method will be replaced during code generation.
*/ */
protected boolean deletable = DELETABLE_EDEFAULT; protected boolean deletable = DELETABLE_EDEFAULT;
/** /**
* The default value of the '{@link #isDefault() <em>Default</em>}' attribute. * The default value of the '{@link #isDefault() <em>Default</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isDefault() * @see #isDefault()
* @generated
* @ordered
*/ */
protected static final boolean DEFAULT_EDEFAULT = false; protected static final boolean DEFAULT_EDEFAULT = false;
/** /**
* @generated This field/method will be replaced during code generation. * @generated This field/method will be replaced during code generation.
*/ */
protected boolean default_ = DEFAULT_EDEFAULT; protected boolean default_ = DEFAULT_EDEFAULT;
/** /**
* The default value of the '{@link #isStringsCaseSensitive() <em>Strings Case Sensitive</em>}' attribute. * The default value of the '{@link #isStringsCaseSensitive() <em>Strings Case Sensitive</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isStringsCaseSensitive() * @see #isStringsCaseSensitive()
* @generated
* @ordered
*/ */
protected static final boolean STRINGS_CASE_SENSITIVE_EDEFAULT = false; 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. * @generated This field/method will be replaced during code generation.
*/ */
protected boolean stringsCaseSensitive = STRINGS_CASE_SENSITIVE_EDEFAULT; protected boolean stringsCaseSensitive = STRINGS_CASE_SENSITIVE_EDEFAULT;
/** /**
* This is true if the Strings Case Sensitive attribute has been set. * This is true if the Strings Case Sensitive attribute has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/ */
protected boolean stringsCaseSensitiveESet = false; protected boolean stringsCaseSensitiveESet = false;
/** /**
* The default value of the '{@link #isSupportsDuplicateFilterStrings() <em>Supports Duplicate Filter Strings</em>}' attribute. * The default value of the '{@link #isSupportsDuplicateFilterStrings() <em>Supports Duplicate Filter Strings</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSupportsDuplicateFilterStrings() * @see #isSupportsDuplicateFilterStrings()
* @generated
* @ordered
*/ */
protected static final boolean SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT = false; 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. * @generated This field/method will be replaced during code generation.
*/ */
protected boolean supportsDuplicateFilterStrings = SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT; protected boolean supportsDuplicateFilterStrings = SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT;
/** /**
* The default value of the '{@link #getRelease() <em>Release</em>}' attribute. * The default value of the '{@link #getRelease() <em>Release</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRelease() * @see #getRelease()
* @generated
* @ordered
*/ */
protected static final int RELEASE_EDEFAULT = 0; 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. * @generated This field/method will be replaced during code generation.
*/ */
protected int release = RELEASE_EDEFAULT; protected int release = RELEASE_EDEFAULT;
/** /**
* The default value of the '{@link #isSingleFilterStringOnly() <em>Single Filter String Only</em>}' attribute. * The default value of the '{@link #isSingleFilterStringOnly() <em>Single Filter String Only</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSingleFilterStringOnly() * @see #isSingleFilterStringOnly()
* @generated
* @ordered
*/ */
protected static final boolean SINGLE_FILTER_STRING_ONLY_EDEFAULT = false; protected static final boolean SINGLE_FILTER_STRING_ONLY_EDEFAULT = false;
/** /**
* The cached value of the '{@link #isSingleFilterStringOnly() <em>Single Filter String Only</em>}' attribute. * The cached value of the '{@link #isSingleFilterStringOnly() <em>Single Filter String Only</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSingleFilterStringOnly() * @see #isSingleFilterStringOnly()
* @generated
* @ordered
*/ */
protected boolean singleFilterStringOnly = SINGLE_FILTER_STRING_ONLY_EDEFAULT; protected boolean singleFilterStringOnly = SINGLE_FILTER_STRING_ONLY_EDEFAULT;
/** /**
* This is true if the Single Filter String Only attribute has been set. * This is true if the Single Filter String Only attribute has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/ */
protected boolean singleFilterStringOnlyESet = false; protected boolean singleFilterStringOnlyESet = false;
/** /**
* The default value of the '{@link #getOwningParentName() <em>Owning Parent Name</em>}' attribute. * The default value of the '{@link #getOwningParentName() <em>Owning Parent Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOwningParentName() * @see #getOwningParentName()
* @generated
* @ordered
*/ */
protected static final String OWNING_PARENT_NAME_EDEFAULT = null; protected static final String OWNING_PARENT_NAME_EDEFAULT = null;
/** /**
* The cached value of the '{@link #getOwningParentName() <em>Owning Parent Name</em>}' attribute. * The cached value of the '{@link #getOwningParentName() <em>Owning Parent Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOwningParentName() * @see #getOwningParentName()
* @generated
* @ordered
*/ */
protected String owningParentName = OWNING_PARENT_NAME_EDEFAULT; protected String owningParentName = OWNING_PARENT_NAME_EDEFAULT;
/** /**
* The default value of the '{@link #isNonRenamable() <em>Non Renamable</em>}' attribute. * The default value of the '{@link #isNonRenamable() <em>Non Renamable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isNonRenamable() * @see #isNonRenamable()
* @generated
* @ordered
*/ */
protected static final boolean NON_RENAMABLE_EDEFAULT = false; protected static final boolean NON_RENAMABLE_EDEFAULT = false;
/** /**
* The cached value of the '{@link #isNonRenamable() <em>Non Renamable</em>}' attribute. * The cached value of the '{@link #isNonRenamable() <em>Non Renamable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isNonRenamable() * @see #isNonRenamable()
* @generated
* @ordered
*/ */
protected boolean nonRenamable = NON_RENAMABLE_EDEFAULT; protected boolean nonRenamable = NON_RENAMABLE_EDEFAULT;
/** /**
* @generated This field/method will be replaced during code generation. * @generated This field/method will be replaced during code generation.
*/ */
protected java.util.List filters = null; protected List filters = new ArrayList(10);
/** /**
* Default constructor * Default constructor
@ -269,7 +206,7 @@ public class SystemFilterPool extends SystemPersistableReferencedObject
helpers = new SystemFilterContainerCommonMethods(); helpers = new SystemFilterContainerCommonMethods();
setRelease(RSECorePlugin.CURRENT_RELEASE); setRelease(RSECorePlugin.CURRENT_RELEASE);
if (!initialized) { if (!initialized) {
initialize(poolName, savePolicy, namingPolicy); initialize(poolName);
} }
setDeletable(isDeletable); // mof attribute setDeletable(isDeletable); // mof attribute
setSupportsNestedFilters(allowNestedFilters); // cascades to each filter 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. * Private helper method to core initialization, from either createXXX or restore.
*/ */
protected void initialize(String name, protected void initialize(String name)
int savePolicy, IRSEFilterNamingPolicy namingPolicy)
{ {
setName(name); // mof attribute setName(name); // mof attribute
setSavePolicy(savePolicy);
setNamingPolicy(namingPolicy);
initialized = true; initialized = true;
} }
//protected Vector internalGetFilters() protected List internalGetFilters()
protected java.util.List internalGetFilters()
{ {
//return filters; return filters;
return getFilters(); // mof-supplied in parent class
} }
/** /**
@ -308,47 +239,6 @@ public class SystemFilterPool extends SystemPersistableReferencedObject
return null; return null;
} }
/**
* Set the save file policy. See constants in {@link org.eclipse.rse.internal.core.filters.ISystemFilterConstants SystemFilterConstants}.
* One of:
* <ul>
* <li>SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL - one file and folder per pool
* <li>SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER - one file per pool, all files in one folder
* <li>SAVE_POLICY_ONE_FILE_PER_FILTER - one file per filter, one folder per pool
* </ul>
* 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. * Set whether filters in this pool support nested filters.
* Important to note this is stored in every filter as well as this filter pool. * 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<filters.length; idx++) for (int idx=0; idx<filters.length; idx++)
filters[idx].setSupportsNestedFilters(supports); filters[idx].setSupportsNestedFilters(supports);
} }
/** /**
* <!-- begin-user-doc --> * @param newSupportsNestedFilters
* <!-- end-user-doc -->
* @generated
*/ */
public void setSupportsNestedFiltersGen(boolean newSupportsNestedFilters) private void setSupportsNestedFiltersGen(boolean newSupportsNestedFilters)
{ {
supportsNestedFilters = newSupportsNestedFilters; supportsNestedFilters = newSupportsNestedFilters;
} }
@ -383,12 +272,11 @@ public class SystemFilterPool extends SystemPersistableReferencedObject
for (int idx=0; idx<filters.length; idx++) for (int idx=0; idx<filters.length; idx++)
filters[idx].setSupportsDuplicateFilterStrings(supports); filters[idx].setSupportsDuplicateFilterStrings(supports);
} }
/** /**
* <!-- begin-user-doc --> * @param newSupportsDuplicateFilterStrings
* <!-- end-user-doc -->
* @generated
*/ */
public void setSupportsDuplicateFilterStringsGen(boolean newSupportsDuplicateFilterStrings) private void setSupportsDuplicateFilterStringsGen(boolean newSupportsDuplicateFilterStrings)
{ {
supportsDuplicateFilterStrings = newSupportsDuplicateFilterStrings; supportsDuplicateFilterStrings = newSupportsDuplicateFilterStrings;
setDirty(true); setDirty(true);
@ -407,12 +295,8 @@ public class SystemFilterPool extends SystemPersistableReferencedObject
filters[idx].setStringsCaseSensitive(supports); filters[idx].setStringsCaseSensitive(supports);
setDirty(true); setDirty(true);
} }
/**
* <!-- begin-user-doc --> private void setStringsCaseSensitiveGen(boolean newStringsCaseSensitive)
* <!-- end-user-doc -->
* @generated
*/
public void setStringsCaseSensitiveGen(boolean newStringsCaseSensitive)
{ {
stringsCaseSensitive = newStringsCaseSensitive; stringsCaseSensitive = newStringsCaseSensitive;
stringsCaseSensitiveESet = true; stringsCaseSensitiveESet = true;
@ -502,20 +386,16 @@ public class SystemFilterPool extends SystemPersistableReferencedObject
return type; return type;
} }
/** /* (non-Javadoc)
* <!-- begin-user-doc --> * @see org.eclipse.rse.core.filters.ISystemFilterPool#isDeletable()
* <!-- end-user-doc -->
* @generated
*/ */
public boolean isDeletable() public boolean isDeletable()
{ {
return deletable; return deletable;
} }
/** /* (non-Javadoc)
* <!-- begin-user-doc --> * @see org.eclipse.rse.core.filters.ISystemFilterPool#setDeletable(boolean)
* <!-- end-user-doc -->
* @generated
*/ */
public void setDeletable(boolean newDeletable) public void setDeletable(boolean newDeletable)
{ {
@ -523,20 +403,16 @@ public class SystemFilterPool extends SystemPersistableReferencedObject
setDirty(true); setDirty(true);
} }
/** /* (non-Javadoc)
* <!-- begin-user-doc --> * @see org.eclipse.rse.core.filters.ISystemFilterPool#isDefault()
* <!-- end-user-doc -->
* @generated
*/ */
public boolean isDefault() public boolean isDefault()
{ {
return default_; return default_;
} }
/** /* (non-Javadoc)
* <!-- begin-user-doc --> * @see org.eclipse.rse.core.filters.ISystemFilterPool#setDefault(boolean)
* <!-- end-user-doc -->
* @generated
*/ */
public void setDefault(boolean newDefault) 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 aliasName The name to give the new filter. Must be unique for this pool.
* @param filterStrings The list of String objects that represent the filter strings. * @param 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); ISystemFilter newFilter = helpers.createSystemFilter(internalGetFilters(), this, aliasName, filterStrings);
newFilter.setSupportsNestedFilters(supportsNestedFilters()); 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. * 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. * 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 * 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); 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. * Order filters according to user preferences.
* <p> * <p>
@ -832,14 +688,13 @@ public class SystemFilterPool extends SystemPersistableReferencedObject
*/ */
public void orderSystemFilters(String[] names) public void orderSystemFilters(String[] names)
{ {
java.util.List filterList = internalGetFilters(); ISystemFilter[] filterArray = new ISystemFilter[names.length];
ISystemFilter[] filters = new ISystemFilter[names.length]; for (int idx=0; idx<filterArray.length; idx++)
for (int idx=0; idx<filters.length; idx++) filterArray[idx] = getSystemFilter(names[idx]); // convert name to filter
filters[idx] = getSystemFilter(names[idx]); // convert name to filter filters.clear();
filterList.clear(); for (int idx=0; idx<filterArray.length; idx++)
for (int idx=0; idx<filters.length; idx++)
{ {
filterList.add(filters[idx]); filters.add(filterArray[idx]);
} }
helpers.invalidateCache(); helpers.invalidateCache();
} }
@ -849,90 +704,11 @@ public class SystemFilterPool extends SystemPersistableReferencedObject
// SAVE/RESTORE METHODS... // SAVE/RESTORE METHODS...
// ----------------------- // -----------------------
/**
* Restore specific filter pool. You should not call this directly, as it is possible
* that certain data is not restored if the save policy is one file per filter. Rather,
* you should call the createSystemFilterPoolMethod.
* @param name name of pool to restore. Used to deduce file name for save policy of one file per pool.
* @param savePolicy policy used to save the pool. One of the following from SystemFilterPoolManager:
* <ul>
* <li>SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL - one file and folder per pool
* <li>SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER - one file per pool, all files in one folder
* <li>SAVE_POLICY_ONE_FILE_PER_FILTER - one file per filter, one folder per pool
* </ul>
* @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<filterNames.size(); idx++)
{
try {
SystemFilter filter =
SystemFilterImpl.restore(mofHelpers, folder, (String)filterNames.elementAt(idx), pool, namingPolicy);
poolImpl.addSystemFilter(filter);
} catch (Exception exc) {lastException = exc;}
}
if (lastException != null)
{
// todo, something! We want to signal the error, but not prevent pool from being restored.
// Only option: log it somewhere.
}
else
poolImpl.sortFilters();
}
break;
}
if (poolImpl != null)
{
poolImpl.initialize(name,savePolicy,namingPolicy);
}
*/
return pool;
}
/** /**
* Internal use method * Internal use method
*/ */
protected void initializeFilterStrings() protected void initializeFilterStrings()
{ {
java.util.List filters = getFilters();
Iterator i = filters.iterator(); Iterator i = filters.iterator();
while (i.hasNext()) while (i.hasNext())
((SystemFilter)i.next()).initializeFilterStrings(); ((SystemFilter)i.next()).initializeFilterStrings();
@ -946,20 +722,19 @@ public class SystemFilterPool extends SystemPersistableReferencedObject
*/ */
protected void sortFilters() protected void sortFilters()
{ {
java.util.List filterList = getFilters(); // get java.util.List if (filters.size() <= 1) // not enough to sort?
if (filterList.size() <= 1) // not enough to sort?
return; // outa here! return; // outa here!
if (debug) if (debug)
printFilterList("Before sorting"); //$NON-NLS-1$ printFilterList("Before sorting"); //$NON-NLS-1$
helpers.invalidateCache(); // force re-gen of array from java.util.List on next getSystemFilters() request helpers.invalidateCache(); // force re-gen of array from java.util.List on next getSystemFilters() request
ISystemFilter[] filters = getSystemFilters(); // convert java.util.List to array ISystemFilter[] filterArray = getSystemFilters(); // convert java.util.List to array
boolean[] processed = new boolean[filters.length]; boolean[] processed = new boolean[filterArray.length];
//for (int idx=0;idx<processed.length;idx++) //for (int idx=0;idx<processed.length;idx++)
//processed[idx] = false; //processed[idx] = false;
filterList.clear(); // clear java.util.List filters.clear(); // clear java.util.List
//boolean done = false; //boolean done = false;
int processedCount = 0; int processedCount = 0;
int totalCount = filters.length; int totalCount = filterArray.length;
int nextHighest = -1; int nextHighest = -1;
int firstMatchIdx = -1; int firstMatchIdx = -1;
int round = 0; int round = 0;
@ -977,7 +752,7 @@ public class SystemFilterPool extends SystemPersistableReferencedObject
{ {
if (!processed[idx]) if (!processed[idx])
{ {
int currOrder = filters[idx].getRelativeOrder(); int currOrder = filterArray[idx].getRelativeOrder();
if (currOrder < nextHighest) if (currOrder < nextHighest)
{ {
nextHighest = currOrder; nextHighest = currOrder;
@ -995,7 +770,7 @@ public class SystemFilterPool extends SystemPersistableReferencedObject
//System.out.println("Round " + round + ": nextHighest = " + nextHighest + ", firstMatchIdx = " + firstMatchIdx); //System.out.println("Round " + round + ": nextHighest = " + nextHighest + ", firstMatchIdx = " + firstMatchIdx);
if (firstMatchIdx != -1) if (firstMatchIdx != -1)
{ {
filterList.add(filters[firstMatchIdx]); filters.add(filterArray[firstMatchIdx]);
processed[firstMatchIdx] = true; processed[firstMatchIdx] = true;
++processedCount; ++processedCount;
} }
@ -1018,31 +793,6 @@ public class SystemFilterPool extends SystemPersistableReferencedObject
System.out.println(); System.out.println();
} }
/**
* Return the root save file name without the extension .xmi
*/
protected static String getRootSaveFileName(ISystemFilterPool pool)
{
return getRootSaveFileName(pool.getNamingPolicy(), pool.getName());
}
/**
* Return the root save file name without the extension .xmi
*/
protected static String getRootSaveFileName(ISystemFilterPool pool, String newName)
{
return getRootSaveFileName(pool.getNamingPolicy(), newName);
}
/**
* Return the root save file name without the extension .xmi
*/
protected static String getRootSaveFileName(IRSEFilterNamingPolicy namingPolicy, String poolName)
{
return namingPolicy.getFilterPoolSaveFileName(poolName);
}
/** /**
* Return the unique reference name of this object. * Return the unique reference name of this object.
* <p> * <p>
@ -1097,17 +847,14 @@ public class SystemFilterPool extends SystemPersistableReferencedObject
return stringsCaseSensitiveESet; return stringsCaseSensitiveESet;
} }
/** /* (non-Javadoc)
* @generated This field/method will be replaced during code generation * @see org.eclipse.rse.core.filters.ISystemFilterPool#getFilters()
*/ */
public java.util.List getFilters() public ISystemFilter[] getFilters()
{ {
if (filters == null) ISystemFilter[] result = new ISystemFilter[filters.size()];
{ filters.toArray(result);
filters = new ArrayList(); return result;
//FIXME new EObjectContainmenteList(SystemFilter.class, this, FiltersPackage.SYSTEM_FILTER_POOL__FILTERS);
}
return filters;
} }
/** /**
@ -1148,20 +895,9 @@ public class SystemFilterPool extends SystemPersistableReferencedObject
else else
return getSystemFilterPoolManager().isSingleFilterStringOnly(); return getSystemFilterPoolManager().isSingleFilterStringOnly();
} }
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSingleFilterStringOnlyGen()
{
return singleFilterStringOnly;
}
/** /* (non-Javadoc)
* <!-- begin-user-doc --> * @see org.eclipse.rse.core.filters.ISystemFilterPool#setSingleFilterStringOnly(boolean)
* <!-- end-user-doc -->
* @generated
*/ */
public void setSingleFilterStringOnly(boolean newSingleFilterStringOnly) public void setSingleFilterStringOnly(boolean newSingleFilterStringOnly)
{ {
@ -1170,10 +906,8 @@ public class SystemFilterPool extends SystemPersistableReferencedObject
setDirty(true); setDirty(true);
} }
/** /* (non-Javadoc)
* <!-- begin-user-doc --> * @see org.eclipse.rse.core.filters.ISystemFilterPool#unsetSingleFilterStringOnly()
* <!-- end-user-doc -->
* @generated
*/ */
public void unsetSingleFilterStringOnly() public void unsetSingleFilterStringOnly()
{ {
@ -1182,30 +916,24 @@ public class SystemFilterPool extends SystemPersistableReferencedObject
setDirty(true); setDirty(true);
} }
/** /* (non-Javadoc)
* <!-- begin-user-doc --> * @see org.eclipse.rse.core.filters.ISystemFilterPool#isSetSingleFilterStringOnly()
* <!-- end-user-doc -->
* @generated
*/ */
public boolean isSetSingleFilterStringOnly() public boolean isSetSingleFilterStringOnly()
{ {
return singleFilterStringOnlyESet; return singleFilterStringOnlyESet;
} }
/** /* (non-Javadoc)
* <!-- begin-user-doc --> * @see org.eclipse.rse.core.filters.ISystemFilterPool#getOwningParentName()
* <!-- end-user-doc -->
* @generated
*/ */
public String getOwningParentName() public String getOwningParentName()
{ {
return owningParentName; return owningParentName;
} }
/** /* (non-Javadoc)
* <!-- begin-user-doc --> * @see org.eclipse.rse.core.filters.ISystemFilterPool#setOwningParentName(java.lang.String)
* <!-- end-user-doc -->
* @generated
*/ */
public void setOwningParentName(String newOwningParentName) public void setOwningParentName(String newOwningParentName)
{ {
@ -1216,20 +944,16 @@ public class SystemFilterPool extends SystemPersistableReferencedObject
} }
} }
/** /* (non-Javadoc)
* <!-- begin-user-doc --> * @see org.eclipse.rse.core.filters.ISystemFilterPool#isNonRenamable()
* <!-- end-user-doc -->
* @generated
*/ */
public boolean isNonRenamable() public boolean isNonRenamable()
{ {
return nonRenamable; return nonRenamable;
} }
/** /* (non-Javadoc)
* <!-- begin-user-doc --> * @see org.eclipse.rse.core.filters.ISystemFilterPool#setNonRenamable(boolean)
* <!-- end-user-doc -->
* @generated
*/ */
public void setNonRenamable(boolean newNonRenamable) public void setNonRenamable(boolean newNonRenamable)
{ {

View file

@ -19,14 +19,10 @@
package org.eclipse.rse.internal.core.filters; package org.eclipse.rse.internal.core.filters;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Vector;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.filters.IRSEFilterNamingPolicy;
import org.eclipse.rse.core.filters.ISystemFilter; import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterContainer; import org.eclipse.rse.core.filters.ISystemFilterContainer;
import org.eclipse.rse.core.filters.ISystemFilterPool; import org.eclipse.rse.core.filters.ISystemFilterPool;
@ -59,10 +55,8 @@ import org.eclipse.rse.logging.Logger;
* This class is not intended to be subclassed by clients. * This class is not intended to be subclassed by clients.
*/ */
public class SystemFilterPoolManager extends RSEPersistableObject implements ISystemFilterPoolManager { public class SystemFilterPoolManager extends RSEPersistableObject implements ISystemFilterPoolManager {
// private ISystemFilterPool[] poolArray = null; // cache for performance
private ISystemFilterPoolManagerProvider caller = null; private ISystemFilterPoolManagerProvider caller = null;
private Object poolMgrData; private Object poolMgrData;
// private Vector poolNames;
private boolean initialized = false; private boolean initialized = false;
private boolean suspendCallbacks = false; private boolean suspendCallbacks = false;
@ -74,22 +68,14 @@ public class SystemFilterPoolManager extends RSEPersistableObject implements ISy
/** /**
* The default value of the '{@link #getName() <em>Name</em>}' attribute. * The default value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName() * @see #getName()
* @generated
* @ordered
*/ */
protected static final String NAME_EDEFAULT = null; protected static final String NAME_EDEFAULT = null;
protected String name = NAME_EDEFAULT; protected String name = NAME_EDEFAULT;
/** /**
* The default value of the '{@link #isSupportsNestedFilters() <em>Supports Nested Filters</em>}' attribute. * The default value of the '{@link #isSupportsNestedFilters() <em>Supports Nested Filters</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSupportsNestedFilters() * @see #isSupportsNestedFilters()
* @generated
* @ordered
*/ */
protected static final boolean SUPPORTS_NESTED_FILTERS_EDEFAULT = false; protected static final boolean SUPPORTS_NESTED_FILTERS_EDEFAULT = false;
@ -99,11 +85,7 @@ public class SystemFilterPoolManager extends RSEPersistableObject implements ISy
protected boolean supportsNestedFilters = SUPPORTS_NESTED_FILTERS_EDEFAULT; protected boolean supportsNestedFilters = SUPPORTS_NESTED_FILTERS_EDEFAULT;
/** /**
* The default value of the '{@link #isStringsCaseSensitive() <em>Strings Case Sensitive</em>}' attribute. * The default value of the '{@link #isStringsCaseSensitive() <em>Strings Case Sensitive</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isStringsCaseSensitive() * @see #isStringsCaseSensitive()
* @generated
* @ordered
*/ */
protected static final boolean STRINGS_CASE_SENSITIVE_EDEFAULT = false; protected static final boolean STRINGS_CASE_SENSITIVE_EDEFAULT = false;
@ -113,11 +95,7 @@ public class SystemFilterPoolManager extends RSEPersistableObject implements ISy
protected boolean stringsCaseSensitive = STRINGS_CASE_SENSITIVE_EDEFAULT; protected boolean stringsCaseSensitive = STRINGS_CASE_SENSITIVE_EDEFAULT;
/** /**
* The default value of the '{@link #isSupportsDuplicateFilterStrings() <em>Supports Duplicate Filter Strings</em>}' attribute. * The default value of the '{@link #isSupportsDuplicateFilterStrings() <em>Supports Duplicate Filter Strings</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSupportsDuplicateFilterStrings() * @see #isSupportsDuplicateFilterStrings()
* @generated
* @ordered
*/ */
protected static final boolean SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT = false; protected static final boolean SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT = false;
@ -127,30 +105,18 @@ public class SystemFilterPoolManager extends RSEPersistableObject implements ISy
protected boolean supportsDuplicateFilterStrings = SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT; protected boolean supportsDuplicateFilterStrings = SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT;
/** /**
* This is true if the Supports Duplicate Filter Strings attribute has been set. * This is true if the Supports Duplicate Filter Strings attribute has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/ */
protected boolean supportsDuplicateFilterStringsESet = false; protected boolean supportsDuplicateFilterStringsESet = false;
/** /**
* The default value of the '{@link #isSingleFilterStringOnly() <em>Single Filter String Only</em>}' attribute. * The default value of the '{@link #isSingleFilterStringOnly() <em>Single Filter String Only</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSingleFilterStringOnly() * @see #isSingleFilterStringOnly()
* @generated
* @ordered
*/ */
protected static final boolean SINGLE_FILTER_STRING_ONLY_EDEFAULT = false; protected static final boolean SINGLE_FILTER_STRING_ONLY_EDEFAULT = false;
/** /**
* The cached value of the '{@link #isSingleFilterStringOnly() <em>Single Filter String Only</em>}' attribute. * The cached value of the '{@link #isSingleFilterStringOnly() <em>Single Filter String Only</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSingleFilterStringOnly() * @see #isSingleFilterStringOnly()
* @generated
* @ordered
*/ */
protected boolean singleFilterStringOnly = SINGLE_FILTER_STRING_ONLY_EDEFAULT; protected boolean singleFilterStringOnly = SINGLE_FILTER_STRING_ONLY_EDEFAULT;
@ -184,22 +150,9 @@ public class SystemFilterPoolManager extends RSEPersistableObject implements ISy
* @param allowNestedFilters true if filters inside filter pools in this manager are * @param allowNestedFilters true if filters inside filter pools in this manager are
* to allow nested filters. This is the default, but can be overridden at the * to allow nested filters. This is the default, but can be overridden at the
* individual filter pool level. * individual filter pool level.
* @param savePolicy The save policy for the filter pools and filters. One of the
* following constants from the
* {@link ISystemFilterConstants} interface:
* <ul>
* <li>SAVE_POLICY_NONE - no files, all save/restore handled elsewhere
* <li>SAVE_POLICY_ONE_FILE_PER_MANAGER - one file: mgrName.xmi
* <li>SAVE_POLICY_ONE_FILEANDFOLDER_PER_POOL - one file and folder per pool
* <li>SAVE_POLICY_ONE_FILE_PER_POOL_SAME_FOLDER - one file per pool, all files in one folder
* <li>SAVE_POLICY_ONE_FILE_PER_FILTER - one file per filter, one folder per pool
* </ul>
* @param namingPolicy The names to use for file and folders when persisting to disk. Pass
* null to just use the defaults, or if using SAVE_POLICY_NONE.
*/ */
public static ISystemFilterPoolManager createSystemFilterPoolManager(ISystemProfile profile, Logger logger, public static ISystemFilterPoolManager createSystemFilterPoolManager(ISystemProfile profile, Logger logger,
ISystemFilterPoolManagerProvider caller, String name, boolean allowNestedFilters, ISystemFilterPoolManagerProvider caller, String name, boolean allowNestedFilters) {
int savePolicy, IRSEFilterNamingPolicy namingPolicy) {
SystemFilterPoolManager mgr = new SystemFilterPoolManager(profile); SystemFilterPoolManager mgr = new SystemFilterPoolManager(profile);
mgr.initialize(logger, caller, name, allowNestedFilters); mgr.initialize(logger, caller, name, allowNestedFilters);
return mgr; return mgr;
@ -213,25 +166,6 @@ public class SystemFilterPoolManager extends RSEPersistableObject implements ISy
initialize(logger, caller, name); // core data initialize(logger, caller, name); // core data
} }
setSupportsNestedFilters(allowNestedFilters); // cascade it down setSupportsNestedFilters(allowNestedFilters); // cascade it down
// invalidatePoolCache();
// List pools = getPools();
// ISystemFilterPool pool = null;
// Vector poolNames = getSystemFilterPoolNamesVector();
// for (int idx = 0; idx < poolNames.size(); idx++) {
// String poolName = (String) poolNames.elementAt(idx);
//// pool = RSECorePlugin.getThePersistenceManager().restoreFilterPool(poolName);
// pool = null; // that's what the above returned
// pool.setSystemFilterPoolManager(this);
// pools.add(pool);
//
// /** FIXME test
// if (pool.specialCaseNoDataRestored)
// {
// pool.setDeletable(true); // what else to do?
// //pool.setSupportsNestedFilters(allowNestedFilters); will be cascaded down anyway
// }
// */
// }
} }
/* /*
@ -320,19 +254,14 @@ public class SystemFilterPoolManager extends RSEPersistableObject implements ISy
} }
/** /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ */
public void setSupportsDuplicateFilterStringsGen(boolean newSupportsDuplicateFilterStrings) { private void setSupportsDuplicateFilterStringsGen(boolean newSupportsDuplicateFilterStrings) {
supportsDuplicateFilterStrings = newSupportsDuplicateFilterStrings; supportsDuplicateFilterStrings = newSupportsDuplicateFilterStrings;
supportsDuplicateFilterStringsESet = true; supportsDuplicateFilterStringsESet = true;
} }
/** /* (non-Javadoc)
* <!-- begin-user-doc --> * @see org.eclipse.rse.core.filters.ISystemFilterPoolManager#isStringsCaseSensitive()
* <!-- end-user-doc -->
* @generated
*/ */
public boolean isStringsCaseSensitive() { public boolean isStringsCaseSensitive() {
return stringsCaseSensitive; return stringsCaseSensitive;
@ -363,11 +292,8 @@ public class SystemFilterPoolManager extends RSEPersistableObject implements ISy
} }
/** /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ */
public void setStringsCaseSensitiveGen(boolean newStringsCaseSensitive) { private void setStringsCaseSensitiveGen(boolean newStringsCaseSensitive) {
stringsCaseSensitive = newStringsCaseSensitive; stringsCaseSensitive = newStringsCaseSensitive;
} }
@ -420,33 +346,13 @@ public class SystemFilterPoolManager extends RSEPersistableObject implements ISy
* Get list of filter pool names currently existing. * Get list of filter pool names currently existing.
*/ */
public String[] getSystemFilterPoolNames() { public String[] getSystemFilterPoolNames() {
Vector v = getSystemFilterPoolNamesVector(); ISystemFilterPool[] pools = getSystemFilterPools();
String[] names = new String[v.size()]; String[] names = new String[pools.length];
for (int idx = 0; idx < names.length; idx++) for (int i = 0; i < pools.length; i++) {
names[idx] = (String) v.elementAt(idx); ISystemFilterPool pool = pools[i];
return names; names[i] = pool.getName();
}
/**
* Get list of filter pool names currently existing.
*/
public Vector getSystemFilterPoolNamesVector() {
Vector result = new Vector(pools.size());
for (Iterator z = pools.iterator(); z.hasNext();) {
ISystemFilterPool pool = (ISystemFilterPool) z.next();
String poolName = pool.getName();
result.add(poolName);
} }
return result; return names;
// List pools = getPools();
// if ((poolNames == null) || (poolNames.size() != pools.size())) // been invalidated?
// {
// poolNames = new Vector();
// Iterator i = pools.iterator();
// while (i.hasNext())
// poolNames.addElement(((ISystemFilterPool) i.next()).getName());
// }
// return poolNames;
} }
/* /*
@ -724,7 +630,7 @@ public class SystemFilterPoolManager extends RSEPersistableObject implements ISy
* @param aliasName The name to give the new filter. Must be unique for this pool. * @param aliasName The name to give the new filter. Must be unique for this pool.
* @param filterStrings The list of String objects that represent the filter strings. * @param 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 {
ISystemFilter newFilter = null; ISystemFilter newFilter = null;
ISystemFilterPool parentPool = null; ISystemFilterPool parentPool = null;
if (parent instanceof ISystemFilterPool) if (parent instanceof ISystemFilterPool)
@ -740,7 +646,7 @@ public class SystemFilterPoolManager extends RSEPersistableObject implements ISy
/** /**
* Creates a new system filter that is typed. * 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. * takes a filter type as an additional parameter.
* <p> * <p>
* A filter's type is an arbitrary string that is not interpreted or used by the base framework. This * A filter's type is an arbitrary string that is not interpreted or used by the base framework. This
@ -752,7 +658,7 @@ public class SystemFilterPoolManager extends RSEPersistableObject implements ISy
* @param filterStrings The list of String objects that represent the filter strings. * @param filterStrings The list of String objects that represent the filter strings.
* @param type The type of this filter * @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 {
boolean oldSuspendSave = suspendSave; boolean oldSuspendSave = suspendSave;
boolean oldSuspendCallbacks = suspendCallbacks; boolean oldSuspendCallbacks = suspendCallbacks;
suspendSave = true; suspendSave = true;
@ -779,7 +685,7 @@ public class SystemFilterPoolManager extends RSEPersistableObject implements ISy
/** /**
* Creates a new system filter that is typed and promptable * 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. * takes a boolean indicating if it is promptable.
* <p> * <p>
* A promptable filter is one in which the user is prompted for information at expand time. * A promptable filter is one in which the user is prompted for information at expand time.
@ -792,7 +698,7 @@ public class SystemFilterPoolManager extends RSEPersistableObject implements ISy
* @param type The type of this filter * @param type The type of this filter
* @param promptable Pass true if this is a promptable 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 {
boolean oldSuspendSave = suspendSave; boolean oldSuspendSave = suspendSave;
boolean oldSuspendCallbacks = suspendCallbacks; boolean oldSuspendCallbacks = suspendCallbacks;
suspendSave = true; suspendSave = true;
@ -1251,29 +1157,6 @@ public class SystemFilterPoolManager extends RSEPersistableObject implements ISy
return null; return null;
} }
/**
* Restore filter pools when all are stored in one file
* @param logger The logging object to log errors to
* @param mgrFolder The folder containing the file to restore from.
* @param name The name of the manager, from which the file name is derived.
* @param namingPolicy Naming prefix information for persisted data file names.
*/
protected static ISystemFilterPoolManager restoreFromOneFile(Logger logger, IFolder mgrFolder, String name, IRSEFilterNamingPolicy namingPolicy) throws Exception {
/* FIXME
String fileName = getRootSaveFileName(namingPolicy, name);
List ext = getMOFHelpers(logger).restore(mgrFolder,fileName);
SystemFilterPoolManager mgr = null;
// should be exactly one system filter pool manager...
Iterator iList = ext.iterator();
mgr = (SystemFilterPoolManager)iList.next();
return mgr;
*/
return null;
}
/** /**
* Return our logger * Return our logger
*/ */
@ -1381,18 +1264,6 @@ public class SystemFilterPoolManager extends RSEPersistableObject implements ISy
return supportsNestedFilters; return supportsNestedFilters;
} }
/**
* @generated This field/method will be replaced during code generation
*/
public List getPools() {
// if (pools == null) {
// pools = new ArrayList();
// }
List result = new ArrayList(pools.size());
result.addAll(pools);
return result;
}
/** /**
* @generated This field/method will be replaced during code generation. * @generated This field/method will be replaced during code generation.
*/ */
@ -1422,19 +1293,15 @@ public class SystemFilterPoolManager extends RSEPersistableObject implements ISy
return supportsDuplicateFilterStringsESet; return supportsDuplicateFilterStringsESet;
} }
/** /* (non-Javadoc)
* <!-- begin-user-doc --> * @see org.eclipse.rse.core.filters.ISystemFilterPoolManager#isSingleFilterStringOnly()
* <!-- end-user-doc -->
* @generated
*/ */
public boolean isSingleFilterStringOnly() { public boolean isSingleFilterStringOnly() {
return singleFilterStringOnly; return singleFilterStringOnly;
} }
/** /* (non-Javadoc)
* <!-- begin-user-doc --> * @see org.eclipse.rse.core.filters.ISystemFilterPoolManager#setSingleFilterStringOnly(boolean)
* <!-- end-user-doc -->
* @generated
*/ */
public void setSingleFilterStringOnly(boolean newSingleFilterStringOnly) { public void setSingleFilterStringOnly(boolean newSingleFilterStringOnly) {
boolean oldSingleFilterStringOnly = singleFilterStringOnly; boolean oldSingleFilterStringOnly = singleFilterStringOnly;

View file

@ -21,6 +21,8 @@
package org.eclipse.rse.internal.core.filters; package org.eclipse.rse.internal.core.filters;
import java.util.List;
import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.RSECorePlugin;
@ -218,7 +220,10 @@ public class SystemFilterPoolReference extends SystemPersistableReferencingObjec
* @see org.eclipse.rse.core.filters.ISystemFilterContainerReference#getSystemFilterReferences(org.eclipse.rse.core.subsystems.ISubSystem) * @see org.eclipse.rse.core.filters.ISystemFilterContainerReference#getSystemFilterReferences(org.eclipse.rse.core.subsystems.ISubSystem)
*/ */
public ISystemFilterReference[] getSystemFilterReferences(ISubSystem subSystem) { public ISystemFilterReference[] getSystemFilterReferences(ISubSystem subSystem) {
return containerHelper.getSystemFilterReferences(subSystem); List references = containerHelper.getSystemFilterReferences(subSystem);
ISystemFilterReference[] result = new ISystemFilterReference[references.size()];
references.toArray(result);
return result;
} }
/* (non-Javadoc) /* (non-Javadoc)

View file

@ -21,10 +21,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.rse.core.SystemResourceHelpers;
import org.eclipse.rse.core.filters.IRSEFilterNamingPolicy;
import org.eclipse.rse.core.filters.ISystemFilter; import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterPool; import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.core.filters.ISystemFilterPoolManager; import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
@ -33,8 +29,6 @@ import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager; import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider; import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
import org.eclipse.rse.core.filters.ISystemFilterReference; import org.eclipse.rse.core.filters.ISystemFilterReference;
import org.eclipse.rse.core.filters.ISystemFilterSavePolicies;
import org.eclipse.rse.core.filters.SystemFilterNamingPolicy;
import org.eclipse.rse.core.references.IRSEBasePersistableReferencingObject; import org.eclipse.rse.core.references.IRSEBasePersistableReferencingObject;
import org.eclipse.rse.core.subsystems.ISubSystem; import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.internal.references.SystemPersistableReferenceManager; import org.eclipse.rse.internal.references.SystemPersistableReferenceManager;
@ -48,20 +42,12 @@ import org.eclipse.rse.internal.references.SystemPersistableReferenceManager;
* There will be one of these instantiated for a subsystem. Filter pool references can * There will be one of these instantiated for a subsystem. Filter pool references can
* be moved within a subsystem and this manager provides that function as well. * be moved within a subsystem and this manager provides that function as well.
*/ */
/**
* @lastgen class SystemFilterPoolReferenceManagerImpl extends SystemPersistableReferenceManagerImpl implements SystemFilterPoolReferenceManager, SystemPersistableReferenceManager {}
*/
public class SystemFilterPoolReferenceManager extends SystemPersistableReferenceManager implements ISystemFilterPoolReferenceManager { public class SystemFilterPoolReferenceManager extends SystemPersistableReferenceManager implements ISystemFilterPoolReferenceManager {
//private SystemFilterPoolManager[] poolMgrs = null;
private ISystemFilterPoolManagerProvider poolMgrProvider = null; private ISystemFilterPoolManagerProvider poolMgrProvider = null;
private ISystemFilterPoolManager defaultPoolMgr = null; private ISystemFilterPoolManager defaultPoolMgr = null;
private ISystemFilterPoolReferenceManagerProvider caller = null; private ISystemFilterPoolReferenceManagerProvider caller = null;
private IRSEFilterNamingPolicy namingPolicy = null;
private int savePolicy = ISystemFilterSavePolicies.SAVE_POLICY_NONE;
private Object mgrData = null; private Object mgrData = null;
private IFolder mgrFolder = null;
private boolean initialized = false; private boolean initialized = false;
private boolean noSave;
private boolean noEvents; private boolean noEvents;
private boolean fireEvents = true; private boolean fireEvents = true;
private ISystemFilterPoolReference[] fpRefsArray = null; private ISystemFilterPoolReference[] fpRefsArray = null;
@ -82,40 +68,18 @@ public class SystemFilterPoolReferenceManager extends SystemPersistableReference
* object via the getProvider method call. * object via the getProvider method call.
* @param relatedPoolManagerProvider The managers that owns the master list of filter pools that * @param relatedPoolManagerProvider The managers that owns the master list of filter pools that
* this manager will contain references to. * this manager will contain references to.
* @param mgrFolder the folder that will hold the persisted file. This is used when * @param name the name of the filter pool reference manager.
* the save policy is SAVE_POLICY_ONE_FILE_PER_MANAGER. For SAVE_POLICY_NONE, this
* is not used. If it is used, it is created if it does not already exist.
* @param name the name of the filter pool reference manager. This is used when
* the save policy is SAVE_POLICY_ONE_FILE_PER_MANAGER, to deduce the file name.
* @param savePolicy The save policy for the filter pool references list. One of the
* following from the {@link org.eclipse.rse.internal.core.filters.ISystemFilterConstants SystemFilterConstants}
* interface:
* <ul>
* <li>SAVE_POLICY_NONE - no files, all save/restore handled elsewhere
* <li>SAVE_POLICY_ONE_FILE_PER_MANAGER - one file: mgrName.xmi
* </ul>
* @param namingPolicy The names to use for file and folders when persisting to disk. Pass
* null to just use the defaults, or if using SAVE_POLICY_NONE.
* @return a filter pool reference manager * @return a filter pool reference manager
*/ */
public static ISystemFilterPoolReferenceManager createSystemFilterPoolReferenceManager(ISystemFilterPoolReferenceManagerProvider caller, public static ISystemFilterPoolReferenceManager createSystemFilterPoolReferenceManager(ISystemFilterPoolReferenceManagerProvider caller, ISystemFilterPoolManagerProvider relatedPoolManagerProvider, String name) {
ISystemFilterPoolManagerProvider relatedPoolManagerProvider, IFolder mgrFolder, String name, int savePolicy, IRSEFilterNamingPolicy namingPolicy) {
SystemFilterPoolReferenceManager mgr = null; SystemFilterPoolReferenceManager mgr = null;
if (mgrFolder != null) SystemResourceHelpers.getResourceHelpers().ensureFolderExists(mgrFolder);
if (namingPolicy == null) namingPolicy = SystemFilterNamingPolicy.getNamingPolicy();
try {
if (savePolicy != ISystemFilterSavePolicies.SAVE_POLICY_NONE) mgr = (SystemFilterPoolReferenceManager) restore(caller, mgrFolder, name, namingPolicy);
} catch (Exception exc) // real error trying to restore, versus simply not found.
{
// todo: something. Log the exception somewhere?
}
if (mgr == null) // not found or some serious error. if (mgr == null) // not found or some serious error.
{ {
mgr = createManager(); mgr = createManager();
} }
if (mgr != null) { if (mgr != null) {
mgr.initialize(caller, mgrFolder, name, savePolicy, namingPolicy, relatedPoolManagerProvider); mgr.initialize(caller, name, relatedPoolManagerProvider);
} }
return mgr; return mgr;
@ -132,9 +96,8 @@ public class SystemFilterPoolReferenceManager extends SystemPersistableReference
/* /*
* Private helper method to initialize state * Private helper method to initialize state
*/ */
protected void initialize(ISystemFilterPoolReferenceManagerProvider caller, IFolder folder, String name, int savePolicy, IRSEFilterNamingPolicy namingPolicy, protected void initialize(ISystemFilterPoolReferenceManagerProvider caller, String name, ISystemFilterPoolManagerProvider relatedPoolManagerProvider) {
ISystemFilterPoolManagerProvider relatedPoolManagerProvider) { if (!initialized) initialize(caller, name); // core data
if (!initialized) initialize(caller, folder, name, savePolicy, namingPolicy); // core data
//setSystemFilterPoolManagers(relatedPoolManagers); //setSystemFilterPoolManagers(relatedPoolManagers);
setSystemFilterPoolManagerProvider(relatedPoolManagerProvider); setSystemFilterPoolManagerProvider(relatedPoolManagerProvider);
} }
@ -143,12 +106,9 @@ public class SystemFilterPoolReferenceManager extends SystemPersistableReference
* Private helper method to do core initialization. * Private helper method to do core initialization.
* Might be called from either the static factory method or the static restore method. * Might be called from either the static factory method or the static restore method.
*/ */
protected void initialize(ISystemFilterPoolReferenceManagerProvider caller, IFolder folder, String name, int savePolicy, IRSEFilterNamingPolicy namingPolicy) { protected void initialize(ISystemFilterPoolReferenceManagerProvider caller, String name) {
this.mgrFolder = folder;
setProvider(caller); setProvider(caller);
setName(name); setName(name);
this.savePolicy = savePolicy;
setNamingPolicy(namingPolicy);
initialized = true; initialized = true;
} }
@ -278,24 +238,6 @@ public class SystemFilterPoolReferenceManager extends SystemPersistableReference
this.fireEvents = fireEvents; this.fireEvents = fireEvents;
} }
/**
* Set the naming policy used when saving data to disk.
* @see org.eclipse.rse.core.filters.IRSEFilterNamingPolicy
* @param namingPolicy the naming policy - no longer used.
*/
public void setNamingPolicy(IRSEFilterNamingPolicy namingPolicy) {
this.namingPolicy = namingPolicy;
}
/**
* Get the naming policy currently used when saving data to disk.
* @see org.eclipse.rse.core.filters.IRSEFilterNamingPolicy
* @return the naming policy - no longer used.
*/
public IRSEFilterNamingPolicy getNamingPolicy() {
return namingPolicy;
}
/** /**
* This is to set transient data that is subsequently queryable. * This is to set transient data that is subsequently queryable.
* @param data the data associated with this pool reference manager. * @param data the data associated with this pool reference manager.
@ -311,26 +253,6 @@ public class SystemFilterPoolReferenceManager extends SystemPersistableReference
return mgrData; return mgrData;
} }
/**
* Set the name. This is an override of mof-generated method
* in order to potentially rename the disk file for a save
* policy of SAVE_POLICY_ONE_FILE_PER_MANAGER.
* No longer used.
* @param name the name of this reference manager.
*/
public void setName(String name) {
if (savePolicy == ISystemFilterSavePolicies.SAVE_POLICY_ONE_FILE_PER_MANAGER) {
IFile file = getResourceHelpers().getFile(getFolder(), getSaveFileName());
super.setName(name);
String newFileName = getSaveFileName();
try {
getResourceHelpers().renameFile(file, newFileName);
} catch (Exception exc) {
}
} else
super.setName(name);
}
// --------------------------------------------------- // ---------------------------------------------------
// Methods that work on FilterPool referencing objects // Methods that work on FilterPool referencing objects
// --------------------------------------------------- // ---------------------------------------------------
@ -345,7 +267,6 @@ public class SystemFilterPoolReferenceManager extends SystemPersistableReference
if (pool != null) fpRefs[idx].resetReferencedFilterPoolName(pool.getReferenceName()); if (pool != null) fpRefs[idx].resetReferencedFilterPoolName(pool.getReferenceName());
} }
invalidateFilterPoolReferencesCache(); // just in case! invalidateFilterPoolReferencesCache(); // just in case!
quietSave();
} }
/** /**
@ -374,7 +295,6 @@ public class SystemFilterPoolReferenceManager extends SystemPersistableReference
invalidateFilterPoolReferencesCache(); invalidateFilterPoolReferencesCache();
// callback to provider so they can fire events in their GUI // callback to provider so they can fire events in their GUI
if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferencesReset(); if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferencesReset();
quietSave();
} }
/** /**
@ -410,7 +330,6 @@ public class SystemFilterPoolReferenceManager extends SystemPersistableReference
int count = addReferencingObject(filterPoolReference); int count = addReferencingObject(filterPoolReference);
filterPoolReference.setParentReferenceManager(this); // DWD - should be done in addReferencingObject? filterPoolReference.setParentReferenceManager(this); // DWD - should be done in addReferencingObject?
invalidateFilterPoolReferencesCache(); invalidateFilterPoolReferencesCache();
quietSave();
return count; return count;
} }
@ -423,7 +342,6 @@ public class SystemFilterPoolReferenceManager extends SystemPersistableReference
filterPoolReference.removeReference(); filterPoolReference.removeReference();
filterPoolReference.setReferencedObject(newPool); filterPoolReference.setReferencedObject(newPool);
if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferenceReset(filterPoolReference); if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferenceReset(filterPoolReference);
quietSave();
} }
/** /**
@ -440,7 +358,6 @@ public class SystemFilterPoolReferenceManager extends SystemPersistableReference
count = super.removeAndDeReferenceReferencingObject(filterPoolReference); count = super.removeAndDeReferenceReferencingObject(filterPoolReference);
invalidateFilterPoolReferencesCache(); invalidateFilterPoolReferencesCache();
if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferenceDeleted(filterPoolReference); if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferenceDeleted(filterPoolReference);
quietSave();
return count; return count;
} }
@ -470,7 +387,6 @@ public class SystemFilterPoolReferenceManager extends SystemPersistableReference
int oldPos = super.getReferencingObjectPosition(filterPoolRef); int oldPos = super.getReferencingObjectPosition(filterPoolRef);
super.moveReferencingObjectPosition(pos, filterPoolRef); super.moveReferencingObjectPosition(pos, filterPoolRef);
invalidateFilterPoolReferencesCache(); invalidateFilterPoolReferencesCache();
if (!noSave) quietSave();
if (fireEvents && (caller != null) && !noEvents) { if (fireEvents && (caller != null) && !noEvents) {
ISystemFilterPoolReference[] refs = new ISystemFilterPoolReference[1]; ISystemFilterPoolReference[] refs = new ISystemFilterPoolReference[1];
refs[0] = filterPoolRef; refs[0] = filterPoolRef;
@ -488,7 +404,7 @@ public class SystemFilterPoolReferenceManager extends SystemPersistableReference
*/ */
public void moveSystemFilterPoolReferences(ISystemFilterPoolReference[] filterPoolRefs, int delta) { public void moveSystemFilterPoolReferences(ISystemFilterPoolReference[] filterPoolRefs, int delta) {
int[] oldPositions = new int[filterPoolRefs.length]; int[] oldPositions = new int[filterPoolRefs.length];
noEvents = noSave = true; noEvents = true;
for (int idx = 0; idx < filterPoolRefs.length; idx++) for (int idx = 0; idx < filterPoolRefs.length; idx++)
oldPositions[idx] = getSystemFilterPoolReferencePosition(filterPoolRefs[idx]); oldPositions[idx] = getSystemFilterPoolReferencePosition(filterPoolRefs[idx]);
if (delta > 0) // moving down, process backwards if (delta > 0) // moving down, process backwards
@ -498,8 +414,7 @@ public class SystemFilterPoolReferenceManager extends SystemPersistableReference
for (int idx = 0; idx < filterPoolRefs.length; idx++) for (int idx = 0; idx < filterPoolRefs.length; idx++)
moveSystemFilterPoolReference(filterPoolRefs[idx], oldPositions[idx] + delta); moveSystemFilterPoolReference(filterPoolRefs[idx], oldPositions[idx] + delta);
invalidateFilterPoolReferencesCache(); invalidateFilterPoolReferencesCache();
noEvents = noSave = false; noEvents = false;
quietSave();
if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferencesRePositioned(filterPoolRefs, delta); if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferencesRePositioned(filterPoolRefs, delta);
} }
@ -549,7 +464,6 @@ public class SystemFilterPoolReferenceManager extends SystemPersistableReference
addReferencingObject(filterPoolReference); addReferencingObject(filterPoolReference);
filterPoolReference.setParentReferenceManager(this); // DWD - should be done in addReferencingObject? filterPoolReference.setParentReferenceManager(this); // DWD - should be done in addReferencingObject?
invalidateFilterPoolReferencesCache(); invalidateFilterPoolReferencesCache();
quietSave();
if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferenceCreated(filterPoolReference); if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferenceCreated(filterPoolReference);
return filterPoolReference; return filterPoolReference;
} }
@ -562,7 +476,6 @@ public class SystemFilterPoolReferenceManager extends SystemPersistableReference
addReferencingObject(filterPoolReference); addReferencingObject(filterPoolReference);
filterPoolReference.setParentReferenceManager(this); // DWD - should be done in addReferencingObject? filterPoolReference.setParentReferenceManager(this); // DWD - should be done in addReferencingObject?
invalidateFilterPoolReferencesCache(); invalidateFilterPoolReferencesCache();
quietSave();
if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferenceCreated(filterPoolReference); if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferenceCreated(filterPoolReference);
return filterPoolReference; return filterPoolReference;
} }
@ -580,7 +493,6 @@ public class SystemFilterPoolReferenceManager extends SystemPersistableReference
filterPoolReference.removeReference(); filterPoolReference.removeReference();
newCount = removeReferencingObject(filterPoolReference); newCount = removeReferencingObject(filterPoolReference);
invalidateFilterPoolReferencesCache(); invalidateFilterPoolReferencesCache();
quietSave();
// callback to provider so they can fire events in their GUI // callback to provider so they can fire events in their GUI
if (fireEvents && (caller != null)) { if (fireEvents && (caller != null)) {
caller.filterEventFilterPoolReferenceDeleted(filterPoolReference); caller.filterEventFilterPoolReferenceDeleted(filterPoolReference);
@ -605,7 +517,6 @@ public class SystemFilterPoolReferenceManager extends SystemPersistableReference
String oldName = poolRef.getReferencedObjectName(); String oldName = poolRef.getReferencedObjectName();
poolRef.resetReferencedFilterPoolName(pool.getReferenceName()); poolRef.resetReferencedFilterPoolName(pool.getReferenceName());
invalidateFilterPoolReferencesCache(); invalidateFilterPoolReferencesCache();
quietSave();
if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferenceRenamed(poolRef, oldName); if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferenceRenamed(poolRef, oldName);
} }
} }
@ -630,7 +541,6 @@ public class SystemFilterPoolReferenceManager extends SystemPersistableReference
filterPoolReference.setParentReferenceManager(this); // DWD - should be done in addReferencingObject? filterPoolReference.setParentReferenceManager(this); // DWD - should be done in addReferencingObject?
} }
invalidateFilterPoolReferencesCache(); invalidateFilterPoolReferencesCache();
quietSave();
if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferencesReset(); if (fireEvents && (caller != null)) caller.filterEventFilterPoolReferencesReset();
} }
} }
@ -726,215 +636,6 @@ public class SystemFilterPoolReferenceManager extends SystemPersistableReference
return match; return match;
} }
// -----------------------
// SAVE/RESTORE METHODS...
// -----------------------
private void quietSave() {
try {
save();
} catch (Exception exc) {
// TODO log exception
}
}
/**
* Save all the filter pools to disk.
* Only called if the save policy is not "none".
* No longer used.
* @throws Exception
*/
public void save() throws Exception {
switch (savePolicy) {
// ONE FILE PER FILTER POOL REFERENCE MANAGER
case ISystemFilterSavePolicies.SAVE_POLICY_ONE_FILE_PER_MANAGER:
saveToOneFile();
break;
}
}
/**
* Save this reference manager to disk.
* Used only if using the reference manager to save a single file to disk.
* No longer used.
* @return true if the save succeeded
* @throws Exception
*/
protected boolean saveToOneFile() throws Exception {
/* FIXME
String saveFileName = getSaveFilePathAndName();
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));
//System.out.println("Saving filter pool ref mgr "+getName()+" to: " + saveFile);
//java.util.List ext = resFactory.createExtent(); mof way
//ext.add(this);
Resource res = resFactory.createResource(URI.createURI(saveFileName));
res.getContents().add(this);
try
{
res.save(EMPTY_MAP);
} catch (Exception e)
{
if (debug)
{
System.out.println("Error saving filter pool ref mgr "+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)
{
try {
mgrFolder.getProject().refreshLocal(IResource.DEPTH_INFINITE, null);
} catch(Exception exc) {}
}
*/
return true;
}
/**
* Restore the filter pools from disk.
* After restoring, you must call resolveReferencesAfterRestore.
* No longer used.
* @param caller The object that is calling this, which must implement SystemFilterPoolReferenceManagerProvider
* @param mgrFolder folder containing filter pool references file.
* @param name the name of the manager to restore. File name is derived from it when saving to one file.
* @param namingPolicy to get file name prefix, via getFilterPoolReferenceManagerFileNamePrefix(). Pass null to use default.
* @return the restored manager, or null if it does not exist.
* @throws Exception if anything else went wrong
*/
public static ISystemFilterPoolReferenceManager restore(ISystemFilterPoolReferenceManagerProvider caller, IFolder mgrFolder, String name, IRSEFilterNamingPolicy namingPolicy) throws Exception {
if (namingPolicy == null) namingPolicy = SystemFilterNamingPolicy.getNamingPolicy();
ISystemFilterPoolReferenceManager mgr = restoreFromOneFile(mgrFolder, name, namingPolicy);
if (mgr != null) {
((SystemFilterPoolReferenceManager) mgr).initialize(caller, mgrFolder, name, ISystemFilterSavePolicies.SAVE_POLICY_ONE_FILE_PER_MANAGER, namingPolicy); // core data
}
return mgr;
}
/**
* Restore the filter pools from disk, assuming default for a naming policy.
* No longer used.
* @param caller The object that is calling this, which must implement SystemFilterPoolReferenceManagerProvider
* @param mgrFolder folder containing filter pool references file.
* @param name the name of the manager to restore. File name is derived from it when saving to one file.
* @return the restored manager, or null if it does not exist.
* @throws Exception if anything else went wrong
*/
public static ISystemFilterPoolReferenceManager restore(ISystemFilterPoolReferenceManagerProvider caller, IFolder mgrFolder, String name) throws Exception {
return restore(caller, mgrFolder, name, null);
}
/**
* Restore filter pools when all are stored in one file.
* No longer used.
* @param mgrFolder The folder containing the file to restore from.
* @param name The name of the manager, from which the file name is derived.
* @param namingPolicy Naming prefix information for persisted data file names.
* @return the restored manager, or null if it does not exist.
* @throws Exception if anything else went wrong
*/
protected static ISystemFilterPoolReferenceManager restoreFromOneFile(IFolder mgrFolder, String name, IRSEFilterNamingPolicy namingPolicy) throws Exception {
ISystemFilterPoolReferenceManager mgr = null;
/* FIXME
Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
//ResourceSet resourceSet = MOF WAY
// Resource.Factory.Registry.getResourceSetFactory().makeResourceSet();
Resource res = null;
String saveFile = getSaveFilePathAndName(mgrFolder, name, namingPolicy);
try
{
//res = resourceSet.load(saveFile); MOF Way
Resource.Factory resFactory = reg.getFactory(URI.createURI(saveFile));
res = resFactory.createResource(URI.createURI(saveFile));
res.load(EMPTY_MAP);
}
catch (java.io.FileNotFoundException e)
{
System.out.println("Restore error: Filter pool ref mgr "+name+" missing its file: "+saveFile);
return null;
}
catch (Exception e)
{
if (debug)
{
System.out.println("Error restoring filter pool ref mgr "+name+" file "+saveFile+": " + e.getClass().getName() + ": " + e.getMessage());
e.printStackTrace();
}
throw e;
}
java.util.List ext = res.getContents();
// should be exactly one system filter pool manager...
Iterator iList = ext.iterator();
mgr = (SystemFilterPoolReferenceManager)iList.next();
if (debug)
System.out.println("Filter Pool Ref Mgr "+name+" loaded successfully.");
*/
return mgr;
}
/**
* After restoring this from disk, there is only the referenced object name,
* not the referenced object pointer, for each referencing object.
* <p>
* This method is called after restore and for each restored object in the list must:
* <ol>
* <li>Do what is necessary to find the referenced object, and set the internal reference pointer.
* <li>Call addReference(this) on that object so it can maintain it's in-memory list of all referencing objects.
* <li>Set the important transient variables
* </ol>
* @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 * Utility method to scan across all filter pools in a given named filter pool manager, for a match
* on a given filter pool name. * on a given filter pool name.
@ -967,80 +668,6 @@ public class SystemFilterPoolReferenceManager extends SystemPersistableReference
// HELPER METHODS... // 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 <i>sans</i> 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() { public String toString() {
return getName(); return getName();
} }

View file

@ -16,15 +16,11 @@
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.core.filters; 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.ISystemFilterPoolManager;
import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider; import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager; import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider; 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.ISystemFilterStartHere;
import org.eclipse.rse.core.filters.SystemFilterNamingPolicy;
import org.eclipse.rse.core.model.ISystemProfile; import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.logging.Logger; import org.eclipse.rse.logging.Logger;
@ -63,16 +59,6 @@ public class SystemFilterStartHere
return _instance; 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 * 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 * saving and restoring the filter data to disk. Rather, you will save and restore
@ -96,7 +82,7 @@ public class SystemFilterStartHere
boolean allowNestedFilters) boolean allowNestedFilters)
{ {
return SystemFilterPoolManager.createSystemFilterPoolManager(profile, logger, caller, 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 * @param relatedPoolMgrProvider The manager provider that own the master list of filter pools that
* this manager will contain references to. * this manager will contain references to.
* @param name the name of the filter pool reference manager. This is not currently * @param name the name of the filter pool reference manager. This is not currently
* used, but you may find a use for it. * 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( public ISystemFilterPoolReferenceManager createSystemFilterPoolReferenceManager(
ISystemFilterPoolReferenceManagerProvider caller, ISystemFilterPoolReferenceManagerProvider caller,
ISystemFilterPoolManagerProvider relatedPoolMgrProvider, ISystemFilterPoolManagerProvider relatedPoolMgrProvider,
String name, IRSEFilterNamingPolicy namingPolicy) String name)
{ {
return SystemFilterPoolReferenceManager.createSystemFilterPoolReferenceManager( return SystemFilterPoolReferenceManager.createSystemFilterPoolReferenceManager(
caller, relatedPoolMgrProvider, null, name, ISystemFilterSavePolicies.SAVE_POLICY_NONE, namingPolicy); caller, relatedPoolMgrProvider, name);
} }

View file

@ -48,7 +48,6 @@ import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.core.subsystems.IServerLauncherProperties; import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
import org.eclipse.rse.core.subsystems.ISubSystem; import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; 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.SystemProfile;
import org.eclipse.rse.internal.core.model.SystemProfileManager; import org.eclipse.rse.internal.core.model.SystemProfileManager;
import org.eclipse.rse.persistence.dom.IRSEDOMConstants; import org.eclipse.rse.persistence.dom.IRSEDOMConstants;
@ -288,7 +287,7 @@ public class RSEDOMImporter {
if (factory.supportsFilters()) { if (factory.supportsFilters()) {
ISystemFilterStartHere startHere = _registry.getSystemFilterStartHere(); ISystemFilterStartHere startHere = _registry.getSystemFilterStartHere();
ISystemFilterPoolReferenceManager fprMgr = startHere.createSystemFilterPoolReferenceManager(subSystem, factory, name, new SubSystemFilterNamingPolicy()); ISystemFilterPoolReferenceManager fprMgr = startHere.createSystemFilterPoolReferenceManager(subSystem, factory, name);
subSystem.setFilterPoolReferenceManager(fprMgr); subSystem.setFilterPoolReferenceManager(fprMgr);
ISystemFilterPoolManager defaultFilterPoolManager = factory.getFilterPoolManager(host.getSystemProfile()); ISystemFilterPoolManager defaultFilterPoolManager = factory.getFilterPoolManager(host.getSystemProfile());
fprMgr.setDefaultSystemFilterPoolManager(defaultFilterPoolManager); fprMgr.setDefaultSystemFilterPoolManager(defaultFilterPoolManager);
@ -331,17 +330,12 @@ public class RSEDOMImporter {
int release = getIntegerValue(node, IRSEDOMConstants.ATTRIBUTE_RELEASE); int release = getIntegerValue(node, IRSEDOMConstants.ATTRIBUTE_RELEASE);
boolean isSetSingleFilterStringOnly = getBooleanValue(node, IRSEDOMConstants.ATTRIBUTE_SINGLE_FILTER_STRING_ONLY); boolean isSetSingleFilterStringOnly = getBooleanValue(node, IRSEDOMConstants.ATTRIBUTE_SINGLE_FILTER_STRING_ONLY);
Vector filterStrings = new Vector();
// create the filter strings // create the filter strings
RSEDOMNode[] filterStringNodes = node.getChildren(IRSEDOMConstants.TYPE_FILTER_STRING); RSEDOMNode[] filterStringNodes = node.getChildren(IRSEDOMConstants.TYPE_FILTER_STRING);
String[] filterStrings = new String[filterStringNodes.length];
for (int i = 0; i < filterStringNodes.length; i++) { for (int i = 0; i < filterStringNodes.length; i++) {
RSEDOMNode filterStringNode = filterStringNodes[i]; RSEDOMNode filterStringNode = filterStringNodes[i];
filterStrings[i] = filterStringNode.getName();
// might not have to restore the filter strings this way
//restoreFilterString(filter, filterStringNode);
filterStrings.add(filterStringNode.getName());
} }
// create the filter // create the filter

View file

@ -23,7 +23,6 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.eclipse.core.resources.IFolder;
import org.eclipse.rse.core.references.IRSEBasePersistableReferenceManager; import org.eclipse.rse.core.references.IRSEBasePersistableReferenceManager;
import org.eclipse.rse.core.references.IRSEBasePersistableReferencedObject; import org.eclipse.rse.core.references.IRSEBasePersistableReferencedObject;
import org.eclipse.rse.core.references.IRSEBasePersistableReferencingObject; import org.eclipse.rse.core.references.IRSEBasePersistableReferencingObject;
@ -40,11 +39,7 @@ import org.eclipse.rse.core.references.IRSEBasePersistableReferencingObject;
public class SystemPersistableReferenceManager implements IRSEBasePersistableReferenceManager { public class SystemPersistableReferenceManager implements IRSEBasePersistableReferenceManager {
/** /**
* The default value of the '{@link #getName() <em>Name</em>}' attribute. * The default value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName() * @see #getName()
* @generated
* @ordered
*/ */
protected static final String NAME_EDEFAULT = null; 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 // Methods for saving and restoring if not doing your own in your own subclass
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/**
* <b>YOU MUST OVERRIDE THIS METHOD!</b>
* <p>
* After restoring this from disk, there is only the referenced object name,
* not the referenced object pointer, for each referencing object.
* <p>
* This method is called after restore and for each restored object in the list must:
* <ol>
* <li>Do what is necessary to find the referenced object, and set the internal reference pointer.
* <li>Call addReference(this) on that object so it can maintain it's in-memory list
* of all referencing objects.
* </ol>
* @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.
* <p>
* After restoration, YOU MUST CALL {@link #resolveReferencesAfterRestore() resolveReferencesAfterRestore}
* This presumes yours subclass has overridden that method!
* <p>
* @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. * Ensure given path ends with path separator.
*/ */

View file

@ -18,6 +18,7 @@
package org.eclipse.rse.files.ui.widgets; package org.eclipse.rse.files.ui.widgets;
import java.util.Arrays;
import java.util.Vector; import java.util.Vector;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
@ -802,7 +803,9 @@ public class SystemFileFilterStringEditPane
*/ */
public static ValidatorFileFilterString getFileFilterStringValidator(ISystemFilter filter, String filterString) 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) if (filterString != null)
v.removeElement(filterString); v.removeElement(filterString);
IRemoteFileSubSystemConfiguration ssFactory = (IRemoteFileSubSystemConfiguration)filter.getProvider(); IRemoteFileSubSystemConfiguration ssFactory = (IRemoteFileSubSystemConfiguration)filter.getProvider();

View file

@ -341,22 +341,14 @@ public abstract class RemoteFileSubSystemConfiguration extends SubSystemConfigur
if (pool != null && isUserPrivateProfile(mgr)) 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... // "My Home" filter...
// ---------------------- // ----------------------
filterStrings = new Vector();
RemoteFileFilterString myHomeFilterString = new RemoteFileFilterString(this); RemoteFileFilterString myHomeFilterString = new RemoteFileFilterString(this);
myHomeFilterString.setPath(getSeparator()); myHomeFilterString.setPath(getSeparator());
filterStrings.add("./*"); //$NON-NLS-1$ String[] filterStrings = new String[] {"./*"}; //$NON-NLS-1$
ISystemFilter filter = mgr.createSystemFilter(pool, SystemFileResources.RESID_FILTER_MYHOME,filterStrings); ISystemFilter filter = mgr.createSystemFilter(pool, SystemFileResources.RESID_FILTER_MYHOME, filterStrings);
filter.setNonChangable(true); filter.setNonChangable(true);
filter.setSingleFilterStringOnly(true); filter.setSingleFilterStringOnly(true);
@ -387,10 +379,9 @@ public abstract class RemoteFileSubSystemConfiguration extends SubSystemConfigur
// ---------------------- // ----------------------
// "Root Files" filter... // "Root Files" filter...
// ---------------------- // ----------------------
filterStrings = new Vector();
RemoteFileFilterString rootFilesFilterString = new RemoteFileFilterString(this); RemoteFileFilterString rootFilesFilterString = new RemoteFileFilterString(this);
rootFilesFilterString.setPath(getSeparator()); rootFilesFilterString.setPath(getSeparator());
filterStrings.add(rootFilesFilterString.toString()); filterStrings = new String[] {rootFilesFilterString.toString()};
mgr.createSystemFilter(pool, SystemFileResources.RESID_FILTER_ROOTFILES,filterStrings); mgr.createSystemFilter(pool, SystemFileResources.RESID_FILTER_ROOTFILES,filterStrings);
} }
else else
@ -400,10 +391,9 @@ public abstract class RemoteFileSubSystemConfiguration extends SubSystemConfigur
// ---------------------- // ----------------------
// "Root Files" filter... // "Root Files" filter...
// ---------------------- // ----------------------
Vector filterStrings = new Vector();
RemoteFileFilterString rootFilesFilterString = new RemoteFileFilterString(this); RemoteFileFilterString rootFilesFilterString = new RemoteFileFilterString(this);
rootFilesFilterString.setPath(getSeparator()); rootFilesFilterString.setPath(getSeparator());
filterStrings.add(rootFilesFilterString.toString()); String[] filterStrings = new String[] {rootFilesFilterString.toString()};
mgr.createSystemFilter(pool, SystemFileResources.RESID_FILTER_ROOTFILES,filterStrings); mgr.createSystemFilter(pool, SystemFileResources.RESID_FILTER_ROOTFILES,filterStrings);
} }
//else //else

View file

@ -48,27 +48,23 @@ public class DStoreWindowsFileSubSystemConfiguration extends DStoreFileSubSystem
// ---------------------- // ----------------------
// "My Home" filter... // "My Home" filter...
// ---------------------- // ----------------------
Vector filterStrings = new Vector(); String[] filterStrings = new String[] {".\\*"}; //$NON-NLS-1$
RemoteFileFilterString myHomeFilterString = new RemoteFileFilterString(this); RemoteFileFilterString myHomeFilterString = new RemoteFileFilterString(this);
myHomeFilterString.setPath(getSeparator()); myHomeFilterString.setPath(getSeparator());
filterStrings.add(".\\*"); //$NON-NLS-1$
ISystemFilter filter = mgr.createSystemFilter(pool, SystemFileResources.RESID_FILTER_MYHOME,filterStrings); ISystemFilter filter = mgr.createSystemFilter(pool, SystemFileResources.RESID_FILTER_MYHOME,filterStrings);
filter.setNonChangable(true); filter.setNonChangable(true);
filter.setSingleFilterStringOnly(true); filter.setSingleFilterStringOnly(true);
filterStrings = new Vector();
RemoteFileFilterString defaultFilterString = new RemoteFileFilterString(this); RemoteFileFilterString defaultFilterString = new RemoteFileFilterString(this);
filterStrings.add(defaultFilterString.toString()); filterStrings = new String[] {defaultFilterString.toString()};
String filterName = SystemFileResources.RESID_FILTER_DRIVES; String filterName = SystemFileResources.RESID_FILTER_DRIVES;
mgr.createSystemFilter(pool, filterName, filterStrings); mgr.createSystemFilter(pool, filterName, filterStrings);
} }
else else
{ {
Vector filterStrings = new Vector();
filterStrings = new Vector();
RemoteFileFilterString defaultFilterString = new RemoteFileFilterString(this); RemoteFileFilterString defaultFilterString = new RemoteFileFilterString(this);
filterStrings.add(defaultFilterString.toString()); String[] filterStrings = new String[] {defaultFilterString.toString()};
String filterName = SystemFileResources.RESID_FILTER_DRIVES; String filterName = SystemFileResources.RESID_FILTER_DRIVES;
mgr.createSystemFilter(pool, filterName, filterStrings); mgr.createSystemFilter(pool, filterName, filterStrings);

View file

@ -117,16 +117,14 @@ public class LocalFileSubSystemConfiguration extends FileServiceSubSystemConfigu
String myHomeFilterName = SystemFileResources.RESID_FILTER_MYHOME; String myHomeFilterName = SystemFileResources.RESID_FILTER_MYHOME;
RemoteFileFilterString myDocsFilterString = new RemoteFileFilterString(this); RemoteFileFilterString myDocsFilterString = new RemoteFileFilterString(this);
myDocsFilterString.setPath(System.getProperty("user.home") + getSeparator()); //$NON-NLS-1$ myDocsFilterString.setPath(System.getProperty("user.home") + getSeparator()); //$NON-NLS-1$
Vector myDocsFilterStrings = new Vector(); String[] myDocsFilterStrings = new String[] {myDocsFilterString.toString()};
myDocsFilterStrings.add(myDocsFilterString.toString());
mgr.createSystemFilter(pool, myHomeFilterName, myDocsFilterStrings); mgr.createSystemFilter(pool, myHomeFilterName, myDocsFilterStrings);
Vector filterStrings = new Vector();
RemoteFileFilterString defaultFilterString = new RemoteFileFilterString(this); RemoteFileFilterString defaultFilterString = new RemoteFileFilterString(this);
if (!_isWindows) if (!_isWindows)
defaultFilterString.setPath(getSeparator()); defaultFilterString.setPath(getSeparator());
filterStrings.add(defaultFilterString.toString()); String[] filterStrings = new String[] {defaultFilterString.toString()};
//System.out.println("creating filter..."); //System.out.println("creating filter...");
String filterName = null; String filterName = null;
if (_isWindows) if (_isWindows)
@ -137,11 +135,10 @@ public class LocalFileSubSystemConfiguration extends FileServiceSubSystemConfigu
} }
else else
{ {
Vector filterStrings = new Vector();
RemoteFileFilterString defaultFilterString = new RemoteFileFilterString(this); RemoteFileFilterString defaultFilterString = new RemoteFileFilterString(this);
if (!_isWindows) if (!_isWindows)
defaultFilterString.setPath(getSeparator()); defaultFilterString.setPath(getSeparator());
filterStrings.add(defaultFilterString.toString()); String[] filterStrings = new String[] {defaultFilterString.toString()};
//System.out.println("creating filter..."); //System.out.println("creating filter...");
String filterName = null; String filterName = null;
if (_isWindows) if (_isWindows)

View file

@ -96,41 +96,36 @@ public abstract class RemoteProcessSubSystemConfiguration extends
if (isUserPrivateProfile(mgr)) if (isUserPrivateProfile(mgr))
{ {
Vector filterStrings = new Vector();
// ---------------------- // ----------------------
// "All Processes" filter... // "All Processes" filter...
// ---------------------- // ----------------------
filterStrings = new Vector();
HostProcessFilterImpl allProcessesFilterString = new HostProcessFilterImpl(); HostProcessFilterImpl allProcessesFilterString = new HostProcessFilterImpl();
filterStrings.add(allProcessesFilterString.toString()); String[] filterStrings = new String[] {allProcessesFilterString.toString()};
ISystemFilter filter = mgr.createSystemFilter(pool, SystemProcessesCoreResources.RESID_PROPERTY_PROCESS_DEFAULTFILTER_LABEL,filterStrings); ISystemFilter filter = mgr.createSystemFilter(pool, SystemProcessesCoreResources.RESID_PROPERTY_PROCESS_DEFAULTFILTER_LABEL, filterStrings);
filter.setNonChangable(true); filter.setNonChangable(true);
filter.setSingleFilterStringOnly(true); filter.setSingleFilterStringOnly(true);
//------------------------ //------------------------
// "My Processes" filter... // "My Processes" filter...
// ---------------------- // ----------------------
filterStrings = new Vector();
HostProcessFilterImpl myProcessesFilterString = new HostProcessFilterImpl(); HostProcessFilterImpl myProcessesFilterString = new HostProcessFilterImpl();
myProcessesFilterString.setUsername("${user.id}"); //$NON-NLS-1$ myProcessesFilterString.setUsername("${user.id}"); //$NON-NLS-1$
filterStrings.add(myProcessesFilterString.toString()); filterStrings = new String[] {myProcessesFilterString.toString()};
filter = mgr.createSystemFilter(pool, SystemProcessesCoreResources.RESID_PROPERTY_PROCESS_MYPROCESSESFILTER_LABEL,filterStrings); filter = mgr.createSystemFilter(pool, SystemProcessesCoreResources.RESID_PROPERTY_PROCESS_MYPROCESSESFILTER_LABEL, filterStrings);
filter.setNonChangable(true); filter.setNonChangable(true);
filter.setSingleFilterStringOnly(true); filter.setSingleFilterStringOnly(true);
} }
else else
{ {
Vector filterStrings = new Vector();
// ---------------------- // ----------------------
// "All Processes" filter... // "All Processes" filter...
// ---------------------- // ----------------------
filterStrings = new Vector();
HostProcessFilterImpl allProcessesFilterString = new HostProcessFilterImpl(); HostProcessFilterImpl allProcessesFilterString = new HostProcessFilterImpl();
filterStrings.add(allProcessesFilterString.toString()); String[] filterStrings = new String[] {allProcessesFilterString.toString()};
ISystemFilter filter = mgr.createSystemFilter(pool, SystemProcessesCoreResources.RESID_PROPERTY_PROCESS_DEFAULTFILTER_LABEL,filterStrings); ISystemFilter filter = mgr.createSystemFilter(pool, SystemProcessesCoreResources.RESID_PROPERTY_PROCESS_DEFAULTFILTER_LABEL, filterStrings);
filter.setNonChangable(true); filter.setNonChangable(true);
filter.setSingleFilterStringOnly(true); filter.setSingleFilterStringOnly(true);
} }

View file

@ -97,15 +97,14 @@ public class SystemFilterNewFilterPoolWizardDefaultMainPage
* Either call this or override getFilterPoolManagerNames, or leave null and this prompt will * Either call this or override getFilterPoolManagerNames, or leave null and this prompt will
* not show. * not show.
*/ */
public void setFilterPoolManagers(ISystemFilterPoolManager[] mgrs) public void setFilterPoolManagers(ISystemFilterPoolManager[] mgrs) {
{
mgrNames = new String[mgrs.length]; mgrNames = new String[mgrs.length];
validatorsByManager = new ISystemValidator[mgrNames.length]; validatorsByManager = new ISystemValidator[mgrNames.length];
for (int idx=0; idx<mgrs.length; idx++) for (int idx = 0; idx < mgrs.length; idx++) {
{ ISystemFilterPoolManager manager = mgrs[idx];
mgrNames[idx] = mgrs[idx].getName(); mgrNames[idx] = manager.getName();
ISystemValidator iiv = new ValidatorFilterPoolName(mgrs[idx].getSystemFilterPoolNamesVector()); ISystemValidator iiv = new ValidatorFilterPoolName(manager.getSystemFilterPoolNames());
validatorsByManager[idx] = iiv; validatorsByManager[idx] = iiv;
} }
} }
/** /**

View file

@ -22,6 +22,7 @@
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.ui.view; package org.eclipse.rse.internal.ui.view;
import java.util.Arrays;
import java.util.Vector; import java.util.Vector;
import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IAdaptable;
@ -278,19 +279,17 @@ public class SystemViewFilterAdapter extends AbstractSystemViewAdapter
// normal filters... // normal filters...
//Vector strings = filter.getFilterStringsVector(); //Vector strings = filter.getFilterStringsVector();
Vector strings = filter.getFilterStringObjectsVector(); ISystemFilterString[] filterStrings = filter.getSystemFilterStrings();
Vector filters = filter.getSystemFiltersVector(); ISystemFilter[] filters = filter.getSystemFilters();
Vector vChildren = new Vector(); Vector vChildren = new Vector();
// start with nested filters... // start with nested filters...
for (int idx=0; idx < filters.size(); idx++) for (int idx=0; idx < filters.length; idx++)
vChildren.addElement(filters.elementAt(idx)); vChildren.addElement(filters[idx]);
// continue with resolved filter string objects... // continue with resolved filter string objects...
for (int idx=0; idx < strings.size(); idx++) for (int idx=0; idx < filterStrings.length; idx++)
{ {
//String filterString = (String)strings.elementAt(idx); vChildren.addElement(filterStrings[idx]);
ISystemFilterString filterString = (ISystemFilterString)strings.elementAt(idx);
vChildren.addElement(filterString);
} }
// convert whole thing to an array... // convert whole thing to an array...
@ -482,35 +481,28 @@ public class SystemViewFilterAdapter extends AbstractSystemViewAdapter
* @param element either a filter for a rename action, or a filter pool for a "new" action. * @param element either a filter for a rename action, or a filter pool for a "new" action.
* @return a validator for verifying the new name is correct. * @return a validator for verifying the new name is correct.
*/ */
public ISystemValidator getNameValidator(Object element) public ISystemValidator getNameValidator(Object element) {
{
ISystemFilter filter = null; ISystemFilter filter = null;
ISystemFilterPool pool = null; ISystemFilterPool pool = null;
Vector filterNames = null; String[] filterNames = null;
if (element instanceof ISystemFilter) if (element instanceof ISystemFilter) {
{ filter = (ISystemFilter) element;
filter = (ISystemFilter)element; pool = filter.getParentFilterPool();
pool = filter.getParentFilterPool(); if (pool != null)
if (pool != null) filterNames = pool.getSystemFilterNames();
filterNames = pool.getSystemFilterNames(); else {
else ISystemFilter parentFilter = filter.getParentFilter();
{ filterNames = parentFilter.getSystemFilterNames();
ISystemFilter parentFilter = filter.getParentFilter(); }
filterNames = parentFilter.getSystemFilterNames(); } else {
} pool = (ISystemFilterPool) element;
filterNames = pool.getSystemFilterNames();
} }
else Vector names = new Vector(filterNames.length);
{ names.addAll(Arrays.asList(filterNames));
pool = (ISystemFilterPool)element; ISystemValidator nameValidator = new ValidatorFilterName(filterNames);
filterNames = pool.getSystemFilterNames(); return nameValidator;
} }
/*
if (filter != null)
filterNames.removeElement(filter.getName()); // remove current filter's name
*/
ISystemValidator nameValidator = new ValidatorFilterName(filterNames);
return nameValidator;
}
/** /**
* Parent override. * Parent override.

View file

@ -18,7 +18,6 @@
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.ui.view; package org.eclipse.rse.internal.ui.view;
import java.util.Vector;
import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
@ -262,19 +261,13 @@ public class SystemViewFilterPoolAdapter extends AbstractSystemViewAdapter
/** /**
* Return a validator for verifying the new name is correct. * Return a validator for verifying the new name is correct.
*/ */
public ISystemValidator getNameValidator(Object element) public ISystemValidator getNameValidator(Object element) {
{ ISystemFilterPool fp = (ISystemFilterPool) element;
ISystemFilterPool fp = (ISystemFilterPool)element;
ISystemFilterPoolManager mgr = fp.getSystemFilterPoolManager(); ISystemFilterPoolManager mgr = fp.getSystemFilterPoolManager();
Vector v = mgr.getSystemFilterPoolNamesVector(); String[] names = mgr.getSystemFilterPoolNames();
/* ISystemValidator nameValidator = new ValidatorFilterPoolName(names);
if (fp != null) // might be called by the New wizard vs rename action return nameValidator;
v.removeElement(fp.getName()); }
*/
ISystemValidator nameValidator = new ValidatorFilterPoolName(v);
//System.out.println("Inside getNameValidator for SystemViewFilterPoolAdapter");
return nameValidator;
}
/** /**
* Parent override. * Parent override.

View file

@ -19,7 +19,6 @@
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.ui.view; package org.eclipse.rse.internal.ui.view;
import java.util.Vector;
import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
@ -327,22 +326,20 @@ public class SystemViewFilterPoolReferenceAdapter
/** /**
* Return a validator for verifying the new name is correct. * Return a validator for verifying the new name is correct.
*/ */
public ISystemValidator getNameValidator(Object element) public ISystemValidator getNameValidator(Object element) {
{ ISystemFilterPool fp = null;
ISystemFilterPool fp = null; if (element instanceof ISystemFilterPoolReference) {
if (element instanceof ISystemFilterPoolReference) fp = getFilterPool(element);
fp = getFilterPool(element); } else if (element instanceof ISystemFilterPool) {
else fp = (ISystemFilterPool) element;
fp = (ISystemFilterPool)element; } else {
ISystemFilterPoolManager mgr = fp.getSystemFilterPoolManager(); throw new IllegalArgumentException();
Vector v = mgr.getSystemFilterPoolNamesVector(); }
/* ISystemFilterPoolManager mgr = fp.getSystemFilterPoolManager();
if (fp != null) // might be called by the New wizard vs rename action String[] names = mgr.getSystemFilterPoolNames();
v.removeElement(fp.getName()); ISystemValidator nameValidator = new ValidatorFilterPoolName(names);
*/ return nameValidator;
ISystemValidator nameValidator = new ValidatorFilterPoolName(v); }
return nameValidator;
}
/** /**
* Parent override. * Parent override.
* <p> * <p>

View file

@ -28,8 +28,6 @@
package org.eclipse.rse.internal.ui.view; package org.eclipse.rse.internal.ui.view;
import java.util.Vector;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
@ -659,49 +657,32 @@ public class SystemViewFilterReferenceAdapter
* Return a validator for verifying the new name is correct. * 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. * @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; ISystemFilter filter = null;
ISystemFilterPool pool = null; ISystemFilterPool pool = null;
Vector filterNames = null; String[] filterNames = null;
if (element instanceof ISystemFilterReference) if (element instanceof ISystemFilterReference) {
{
filter = getFilter(element); filter = getFilter(element);
pool = filter.getParentFilterPool(); pool = filter.getParentFilterPool();
if (pool != null) if (pool != null)
filterNames = pool.getSystemFilterNames(); filterNames = pool.getSystemFilterNames();
else else {
{
ISystemFilter parentFilter = filter.getParentFilter(); ISystemFilter parentFilter = filter.getParentFilter();
filterNames = parentFilter.getSystemFilterNames(); filterNames = parentFilter.getSystemFilterNames();
} }
} } else if (element instanceof ISystemFilter) {
else if (element instanceof ISystemFilter)
{
filter = (ISystemFilter) element; filter = (ISystemFilter) element;
pool = filter.getParentFilterPool(); pool = filter.getParentFilterPool();
if (pool != null) if (pool != null)
filterNames = pool.getSystemFilterNames(); filterNames = pool.getSystemFilterNames();
else else {
{
ISystemFilter parentFilter = filter.getParentFilter(); ISystemFilter parentFilter = filter.getParentFilter();
filterNames = parentFilter.getSystemFilterNames(); filterNames = parentFilter.getSystemFilterNames();
} }
} } else {
else
{
pool = (ISystemFilterPool) element; pool = (ISystemFilterPool) element;
filterNames = pool.getSystemFilterNames(); 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<filterNames.size(); idx++)
System.out.println("...: " + filterNames.elementAt(idx));
}
*/
ISystemValidator nameValidator = new ValidatorFilterName(filterNames); ISystemValidator nameValidator = new ValidatorFilterName(filterNames);
return nameValidator; return nameValidator;
} }

View file

@ -18,6 +18,8 @@
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.ui.view; package org.eclipse.rse.internal.ui.view;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector; import java.util.Vector;
import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IAdaptable;
@ -225,17 +227,21 @@ public class SystemViewFilterStringAdapter extends AbstractSystemViewAdapter
/** /**
* Perform the delete action. * Perform the delete action.
*/ */
public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor) throws Exception public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor) throws Exception {
{
ISystemFilterString filterString = getFilterString(element); ISystemFilterString filterString = getFilterString(element);
ISystemFilter filter = filterString.getParentSystemFilter(); ISystemFilter filter = filterString.getParentSystemFilter();
ISystemFilterPoolManager fpMgr = filterString.getSystemFilterPoolManager(); ISystemFilterPoolManager fpMgr = filterString.getSystemFilterPoolManager();
Vector strings = filter.getSystemFiltersVector(); String[] oldStrings = filter.getFilterStrings();
String[] filterStrings = new String[strings.size()-1]; List workingStrings = new ArrayList(oldStrings.length);
for (int idx=0; idx<filterStrings.length; idx++) for (int i = 0; i < oldStrings.length; i++) {
filterStrings[idx] = ((ISystemFilterString)strings.elementAt(idx)).toString(); String oldString = oldStrings[i];
strings.remove(filterString); if (!filterString.equals(oldStrings[i])) {
fpMgr.updateSystemFilter(filter, filter.getName(), filterStrings); workingStrings.add(oldString);
}
}
String[] newStrings = new String[workingStrings.size()];
workingStrings.toArray(newStrings);
fpMgr.updateSystemFilter(filter, filter.getName(), newStrings);
return true; return true;
} }

View file

@ -16,6 +16,7 @@
package org.eclipse.rse.ui.filters.dialogs; package org.eclipse.rse.ui.filters.dialogs;
import java.util.Arrays;
import java.util.Vector; import java.util.Vector;
import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.ImageDescriptor;
@ -426,16 +427,21 @@ public class SystemNewFilterWizard
} }
/** /**
* Reusable method to return a name validator for renaming a filter. * Reusable method to return a name validator for renaming a filter.
* @param the current filter object on updates. Can be null for new names. Used * @param container the current filter object on updates. Can be null for new names. Used
* to remove from the existing name list the current filter's name. * to remove from the existing name list the current filter's name.
* @param filter the filter whose name should be removed from the validation list. May be null if the list from the container
* should be used intact.
* @return a name validator
*/ */
public static ISystemValidator getFilterNameValidator(ISystemFilterContainer container,ISystemFilter filter) public static ISystemValidator getFilterNameValidator(ISystemFilterContainer container, ISystemFilter filter) {
{ String[] names = container.getSystemFilterNames();
Vector v = container.getSystemFilterNames(); Vector v = new Vector(names.length);
if (filter != null) v.addAll(Arrays.asList(names));
v.removeElement(filter.getName()); if (filter != null) {
ValidatorFilterName filterNameValidator = new ValidatorFilterName(v); v.removeElement(filter.getName());
return filterNameValidator; }
ValidatorFilterName filterNameValidator = new ValidatorFilterName(v);
return filterNameValidator;
} }
/** /**
@ -616,12 +622,14 @@ public class SystemNewFilterWizard
* @param shell the shell that hosts this wizard. * @param shell the shell that hosts this wizard.
* @param filterParent the parent of this filter - usually a filter pool * @param filterParent the parent of this filter - usually a filter pool
* @param aliasName the name of the filter itself * @param aliasName the name of the filter itself
* @param filterStrings a Vector of string that contain the specification of this filter * @param filterStringsVector a Vector of string that contain the specification of this filter
* @param type the type of the filter used when interpreting the filter, usually supplied by a subsystem * @param type the type of the filter used when interpreting the filter, usually supplied by a subsystem
* @return the ISystemFilter that was created * @return the ISystemFilter that was created
* @throws Exception if an error occurs * @throws Exception if an error occurs
*/ */
public ISystemFilter createNewFilter(Shell shell, ISystemFilterContainer filterParent, String aliasName, Vector filterStrings, String type) throws Exception { public ISystemFilter createNewFilter(Shell shell, ISystemFilterContainer filterParent, String aliasName, Vector filterStringsVector, String type) throws Exception {
String[] filterStrings = new String[filterStringsVector.size()];
filterStringsVector.toArray(filterStrings);
ISystemFilter newFilter = null; ISystemFilter newFilter = null;
ISystemFilterPoolManager fpMgr = filterParent.getSystemFilterPoolManager(); ISystemFilterPoolManager fpMgr = filterParent.getSystemFilterPoolManager();
if (type == null) if (type == null)

View file

@ -15,6 +15,7 @@
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui.propertypages; package org.eclipse.rse.ui.propertypages;
import java.util.Arrays;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import java.util.Vector; import java.util.Vector;
@ -247,7 +248,9 @@ public class SystemFilterStringPropertyPage extends SystemBasePropertyPage imple
editPaneComposite.setEnabled(false); editPaneComposite.setEnabled(false);
else if (filterStringValidator == null) else if (filterStringValidator == null)
{ {
Vector existingStrings = filter.getFilterStringsVector(); String[] filterStrings = filter.getFilterStrings();
Vector existingStrings = new Vector(filterStrings.length);
existingStrings.addAll(Arrays.asList(filterStrings));
existingStrings.remove(filterstring); existingStrings.remove(filterstring);
filterStringValidator = new ValidatorFilterString(existingStrings, filter.isStringsCaseSensitive()); filterStringValidator = new ValidatorFilterString(existingStrings, filter.isStringsCaseSensitive());
if (dupeFilterStringMessage != null) if (dupeFilterStringMessage != null)

View file

@ -3229,7 +3229,6 @@ public abstract class SubSystem extends RSEModelObject
ISystemFilterPoolReference poolReference = (ISystemFilterPoolReference) z.next(); ISystemFilterPoolReference poolReference = (ISystemFilterPoolReference) z.next();
fprm.addSystemFilterPoolReference(poolReference); fprm.addSystemFilterPoolReference(poolReference);
} }
fprm.resolveReferencesAfterRestore();
} }
filterEventFilterPoolReferencesReset(); // signal a resource change event filterEventFilterPoolReferencesReset(); // signal a resource change event
} }

View file

@ -57,7 +57,6 @@ import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.core.filters.ISystemFilterPoolManager; import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
import org.eclipse.rse.core.filters.ISystemFilterPoolReference; import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager; import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
import org.eclipse.rse.core.filters.ISystemFilterSavePolicies;
import org.eclipse.rse.core.filters.ISystemFilterString; import org.eclipse.rse.core.filters.ISystemFilterString;
import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ILabeledObject; import org.eclipse.rse.core.model.ILabeledObject;
@ -138,7 +137,6 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
private static final ISubSystem[] EMPTY_SUBSYSTEM_ARRAY = new ISubSystem[0]; private static final ISubSystem[] EMPTY_SUBSYSTEM_ARRAY = new ISubSystem[0];
// filters stuff... // filters stuff...
protected SubSystemFilterNamingPolicy filterNamingPolicy = new SubSystemFilterNamingPolicy();
protected ISystemFilterPoolManager[] filterPoolManagers = null; protected ISystemFilterPoolManager[] filterPoolManagers = null;
protected Hashtable filterPoolManagersPerProfile = new Hashtable(); protected Hashtable filterPoolManagersPerProfile = new Hashtable();
@ -991,7 +989,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
// that are stored with a subsystem. // that are stored with a subsystem.
//SystemFilterPoolManager[] relatedFilterPoolManagers = //SystemFilterPoolManager[] relatedFilterPoolManagers =
// getReferencableFilterPoolManagers(conn.getSystemProfile()); // getReferencableFilterPoolManagers(conn.getSystemProfile());
ISystemFilterPoolReferenceManager fprMgr = SystemFilterStartHere.getInstance().createSystemFilterPoolReferenceManager(subsys, this, subsys.getName(), filterNamingPolicy); ISystemFilterPoolReferenceManager fprMgr = SystemFilterStartHere.getInstance().createSystemFilterPoolReferenceManager(subsys, this, subsys.getName());
subsys.setFilterPoolReferenceManager(fprMgr); subsys.setFilterPoolReferenceManager(fprMgr);
ISystemFilterPoolManager defaultFilterPoolManager = getFilterPoolManager(conn.getSystemProfile()); ISystemFilterPoolManager defaultFilterPoolManager = getFilterPoolManager(conn.getSystemProfile());
fprMgr.setDefaultSystemFilterPoolManager(defaultFilterPoolManager); fprMgr.setDefaultSystemFilterPoolManager(defaultFilterPoolManager);
@ -1082,7 +1080,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
// that are stored with a subsystem. // that are stored with a subsystem.
//SystemFilterPoolManager[] relatedFilterPoolManagers = //SystemFilterPoolManager[] relatedFilterPoolManagers =
// getReferencableFilterPoolManagers(newConnection.getSystemProfile()); // getReferencableFilterPoolManagers(newConnection.getSystemProfile());
ISystemFilterPoolReferenceManager newRefMgr = SystemFilterStartHere.getInstance().createSystemFilterPoolReferenceManager(subsys, this, subsys.getName(), filterNamingPolicy); ISystemFilterPoolReferenceManager newRefMgr = SystemFilterStartHere.getInstance().createSystemFilterPoolReferenceManager(subsys, this, subsys.getName());
ISystemFilterPoolManager defaultFilterPoolManager = null; ISystemFilterPoolManager defaultFilterPoolManager = null;
if (copyProfileOperation) if (copyProfileOperation)
defaultFilterPoolManager = getFilterPoolManager(newConnection.getSystemProfile()); defaultFilterPoolManager = getFilterPoolManager(newConnection.getSystemProfile());
@ -1613,8 +1611,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
Logger logger = RSECorePlugin.getDefault().getLogger(); Logger logger = RSECorePlugin.getDefault().getLogger();
String managerName = getFilterPoolManagerName(profile); String managerName = getFilterPoolManagerName(profile);
boolean supportsNested = supportsNestedFilters(); boolean supportsNested = supportsNestedFilters();
int savePolicy = ISystemFilterSavePolicies.SAVE_POLICY_ONE_FILE_PER_FILTER; mgr = SystemFilterPoolManager.createSystemFilterPoolManager(profile, logger, this, managerName, supportsNested);// the filter pool manager name
mgr = SystemFilterPoolManager.createSystemFilterPoolManager(profile, logger, this, managerName, supportsNested, savePolicy, filterNamingPolicy);// the filter pool manager name
mgr.setSingleFilterStringOnly(!supportsMultipleFilterStrings()); mgr.setSingleFilterStringOnly(!supportsMultipleFilterStrings());
mgr.setWasRestored(false); // not yet initialized mgr.setWasRestored(false); // not yet initialized
} catch (Exception exc) { } catch (Exception exc) {
@ -1666,10 +1663,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
ISystemFilterPoolManager oldMgr = getFilterPoolManager(oldProfile); // will restore it if necessary ISystemFilterPoolManager oldMgr = getFilterPoolManager(oldProfile); // will restore it if necessary
ISystemFilterPoolManager mgr = SystemFilterPoolManager.createSystemFilterPoolManager(newProfile, RSECorePlugin.getDefault().getLogger(), this, // the caller ISystemFilterPoolManager mgr = SystemFilterPoolManager.createSystemFilterPoolManager(newProfile, RSECorePlugin.getDefault().getLogger(), this, getFilterPoolManagerName(newProfile), supportsNestedFilters());
getFilterPoolManagerName(newProfile), // the filter pool manager name
supportsNestedFilters(), // whether or not nested filters are allowed
ISystemFilterSavePolicies.SAVE_POLICY_ONE_FILE_PER_FILTER, filterNamingPolicy);
mgr.setStringsCaseSensitive(oldMgr.areStringsCaseSensitive()); mgr.setStringsCaseSensitive(oldMgr.areStringsCaseSensitive());
mgr.setSupportsDuplicateFilterStrings(oldMgr.supportsDuplicateFilterStrings()); mgr.setSupportsDuplicateFilterStrings(oldMgr.supportsDuplicateFilterStrings());
addFilterPoolManager(newProfile, mgr); addFilterPoolManager(newProfile, mgr);
@ -2556,7 +2550,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
// that are stored with a subsystem. // that are stored with a subsystem.
//SystemFilterPoolManager[] relatedFilterPoolManagers = //SystemFilterPoolManager[] relatedFilterPoolManagers =
// getReferencableFilterPoolManagers(conn.getSystemProfile()); // getReferencableFilterPoolManagers(conn.getSystemProfile());
ISystemFilterPoolReferenceManager fprMgr = SystemFilterStartHere.getInstance().createSystemFilterPoolReferenceManager(subsys, this, subsys.getName(), filterNamingPolicy); ISystemFilterPoolReferenceManager fprMgr = SystemFilterStartHere.getInstance().createSystemFilterPoolReferenceManager(subsys, this, subsys.getName());
subsys.setFilterPoolReferenceManager(fprMgr); subsys.setFilterPoolReferenceManager(fprMgr);
ISystemFilterPoolManager defaultFilterPoolManager = getFilterPoolManager(conn.getSystemProfile()); ISystemFilterPoolManager defaultFilterPoolManager = getFilterPoolManager(conn.getSystemProfile());
fprMgr.setDefaultSystemFilterPoolManager(defaultFilterPoolManager); fprMgr.setDefaultSystemFilterPoolManager(defaultFilterPoolManager);