### Eclipse Workspace Patch 1.0 #P org.eclipse.rse.core Index: src/org/eclipse/rse/internal/core/filters/SystemFilterPoolReferenceManager.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPoolReferenceManager.java,v retrieving revision 1.2 diff -u -r1.2 SystemFilterPoolReferenceManager.java --- src/org/eclipse/rse/internal/core/filters/SystemFilterPoolReferenceManager.java 12 Apr 2007 20:25:59 -0000 1.2 +++ src/org/eclipse/rse/internal/core/filters/SystemFilterPoolReferenceManager.java 14 Apr 2007 17:38:26 -0000 @@ -16,6 +16,8 @@ package org.eclipse.rse.internal.core.filters; +import java.util.ArrayList; +import java.util.List; import java.util.Vector; import org.eclipse.core.resources.IFile; @@ -384,9 +386,10 @@ * Create a filter pool reference. This creates an unresolved raw reference that * must be added to the managed lists by the caller. * That will be attempted to be resolved on first use. + * @param filterPoolName the fully qualified filter pool name */ - private ISystemFilterPoolReference createSystemFilterPoolReference(ISystemFilterPoolManager filterPoolManager, String filterPoolName) { - ISystemFilterPoolReference filterPoolReference = new SystemFilterPoolReference(filterPoolManager, filterPoolName); + private ISystemFilterPoolReference createSystemFilterPoolReference(String filterPoolName) { + ISystemFilterPoolReference filterPoolReference = new SystemFilterPoolReference(filterPoolName); invalidateFilterPoolReferencesCache(); return filterPoolReference; } @@ -503,10 +506,16 @@ */ public ISystemFilterPool[] getReferencedSystemFilterPools() { ISystemFilterPoolReference[] refs = getSystemFilterPoolReferences(); - ISystemFilterPool[] pools = new ISystemFilterPool[refs.length]; - for (int idx = 0; idx < pools.length; idx++) - pools[idx] = refs[idx].getReferencedFilterPool(); - return pools; + List pools = new ArrayList(refs.length); + for (int idx = 0; idx < refs.length; idx++) { + ISystemFilterPool pool = refs[idx].getReferencedFilterPool(); + if (pool != null) { + pools.add(pool); + } + } + ISystemFilterPool[] result = new ISystemFilterPool[pools.size()]; + pools.toArray(result); + return result; } /** @@ -542,8 +551,8 @@ /* (non-Javadoc) * @see org.eclipse.rse.filters.ISystemFilterPoolReferenceManager#addReferenceToSystemFilterPool(org.eclipse.rse.filters.ISystemFilterPoolManager, java.lang.String) */ - public ISystemFilterPoolReference addReferenceToSystemFilterPool(ISystemFilterPoolManager filterPoolManager, String filterPoolName) { - ISystemFilterPoolReference filterPoolReference = createSystemFilterPoolReference(filterPoolManager, filterPoolName); + public ISystemFilterPoolReference addReferenceToSystemFilterPool(String filterPoolName) { + ISystemFilterPoolReference filterPoolReference = createSystemFilterPoolReference(filterPoolName); addReferencingObject(filterPoolReference); filterPoolReference.setParentReferenceManager(this); invalidateFilterPoolReferencesCache(); Index: src/org/eclipse/rse/internal/core/filters/SystemFilterPoolReference.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPoolReference.java,v retrieving revision 1.2 diff -u -r1.2 SystemFilterPoolReference.java --- src/org/eclipse/rse/internal/core/filters/SystemFilterPoolReference.java 4 Apr 2007 02:27:55 -0000 1.2 +++ src/org/eclipse/rse/internal/core/filters/SystemFilterPoolReference.java 14 Apr 2007 17:38:25 -0000 @@ -16,9 +16,6 @@ package org.eclipse.rse.internal.core.filters; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.Platform; import org.eclipse.rse.core.RSECorePlugin; @@ -35,6 +32,7 @@ import org.eclipse.rse.core.model.ISystemProfile; import org.eclipse.rse.core.model.ISystemRegistry; import org.eclipse.rse.core.subsystems.ISubSystem; +import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; import org.eclipse.rse.internal.references.SystemPersistableReferencingObject; /** @@ -66,13 +64,10 @@ /** * Constructs a new filter pool reference. This is an unresolved reference. - * It is resolved on first use by using the supplied filterPoolManager. - * @param filterPoolManager the manager used to resolve the reference. * @param filterPoolName the name of the filter pool. */ - public SystemFilterPoolReference(ISystemFilterPoolManager filterPoolManager, String filterPoolName) { + public SystemFilterPoolReference(String filterPoolName) { this(); - this.filterPoolManager = filterPoolManager; setReferencedObjectName(filterPoolName); } @@ -105,28 +100,48 @@ * @see org.eclipse.rse.core.filters.ISystemFilterPoolReference#getReferencedFilterPoolName() */ public String getReferencedFilterPoolName() { - String savedName = super.getReferencedObjectName(); - String poolName = null; - int idx = savedName.indexOf(DELIMITER); - if (idx >= 0) - poolName = savedName.substring(idx + DELIMITER_LENGTH); - else - poolName = savedName; - return poolName; + /* + * A filter pool reference stores the name of the filter pool it references in the form managerName___filterPoolName. + * or in the unqualified form of filterPoolName which references a locally defined filter pool. + * ___ is the delimiter. Absence of the delimiter indicates an unqualified name. + * The filter pool manager name is the same as its owning profile. + */ + String savedName = getReferencedObjectName(); + String[] parts = savedName.split(DELIMITER, 2); + String result = parts[0]; + if (parts.length == 2) { + result = parts[1]; + } + return result; } /* (non-Javadoc) * @see org.eclipse.rse.core.filters.ISystemFilterPoolReference#getReferencedFilterPoolManagerName() */ public String getReferencedFilterPoolManagerName() { - String savedName = super.getReferencedObjectName(); - String mgrName = null; - int idx = savedName.indexOf(DELIMITER); - if (idx >= 0) - mgrName = savedName.substring(0, idx); - else - mgrName = savedName; - return mgrName; + /* + * A filter pool reference stores the name of the filter pool it references in the form managerName___filterPoolName. + * or in the unqualified form of filterPoolName which references a locally defined filter pool. + * ___ is the delimiter. Absence of the delimiter indicates an unqualified name. + * The filter pool manager name is the same as its owning profile. + */ + String result = null; + String savedName = getReferencedObjectName(); + String[] parts = savedName.split(DELIMITER, 2); + if (parts.length == 2) { + result = parts[0]; + } else { + ISystemFilterPoolReferenceManagerProvider provider = getProvider(); + if (provider instanceof ISubSystem) { + ISubSystem subsystem = (ISubSystem) provider; + ISystemProfile profile = subsystem.getSystemProfile(); + result = profile.getName(); + } + } + if (result == null) { + RSECorePlugin.getDefault().getLogger().logWarning("Unexpected condition: filter pool manager name not found.", null); //$NON-NLS-1$ + } + return result; } /* (non-Javadoc) @@ -150,28 +165,20 @@ ISystemFilterPool filterPool = (ISystemFilterPool) getReferencedObject(); if (filterPool == null) { String filterPoolName = getReferencedFilterPoolName(); + String profileName = getReferencedFilterPoolManagerName(); + ISystemRegistry registry = RSECorePlugin.getDefault().getSystemRegistry(); + ISystemProfile profile = registry.getSystemProfile(profileName); + ISubSystem subsystem = (ISubSystem) getProvider(); + ISubSystemConfiguration config = subsystem.getSubSystemConfiguration(); + filterPoolManager = config.getFilterPoolManager(profile); filterPool = filterPoolManager.getSystemFilterPool(filterPoolName); - if (filterPool == null) { - Pattern p = Pattern.compile("(^.*):"); //$NON-NLS-1$ - Matcher m = p.matcher(filterPoolName); - if (m.find()) { - String profileName = m.group(1); - ISystemRegistry registry = RSECorePlugin.getDefault().getSystemRegistry(); - ISystemProfile profile = registry.getSystemProfile(profileName); - if (profile != null) { - ISystemFilterPool[] pools = profile.getFilterPools(); - for (int i = 0; i < pools.length && filterPool == null; i++) { - ISystemFilterPool pool = pools[i]; - if (filterPoolName.equals(pool.getName())) filterPool = pool; - } - } - } - } - if (filterPool != null) { - setReferenceToFilterPool(filterPool); - } } - setReferenceBroken(filterPool == null); + if (filterPool != null) { + setReferenceToFilterPool(filterPool); + setReferenceBroken(false); + } else { + setReferenceBroken(true); + } return filterPool; } @@ -234,7 +241,7 @@ * @see org.eclipse.rse.core.filters.ISystemFilterPoolReference#getFullName() */ public String getFullName() { - return super.getReferencedObjectName(); + return getReferencedObjectName(); } /* (non-Javadoc) Index: src/org/eclipse/rse/internal/core/filters/SystemFilterPool.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPool.java,v retrieving revision 1.6 diff -u -r1.6 SystemFilterPool.java --- src/org/eclipse/rse/internal/core/filters/SystemFilterPool.java 12 Apr 2007 20:25:59 -0000 1.6 +++ src/org/eclipse/rse/internal/core/filters/SystemFilterPool.java 14 Apr 2007 17:38:25 -0000 @@ -256,103 +256,22 @@ * @generated This field/method will be replaced during code generation. */ protected java.util.List filters = null; - private static SystemFilterPool _instance; -/** + + /** * Default constructor */ - protected SystemFilterPool() + public SystemFilterPool(String poolName, boolean allowNestedFilters, boolean isDeletable) { super(); helpers = new SystemFilterContainerCommonMethods(); - } - - public static SystemFilterPool getDefault() - { - if (_instance == null) - { - _instance = new SystemFilterPool(); + setRelease(RSECorePlugin.CURRENT_RELEASE); + if (!initialized) { + initialize(poolName, savePolicy, namingPolicy); } - return _instance; - } - - /** - * Static factory method for creating a new filter pool. Will - * first try to restore it, and if that fails will create a new instance and - * return it. - *

- * Use this method only if you are not using a SystemFilterPoolManager, else - * use the createSystemFilterPool method in that class. - * - * This folder will be created if it does not already exist. - * @param name the name of the filter pool. Typically this is also the name - * of the given folder, but this is not required. For the save policy of one file - * per pool, the name of the file is derived from this. - * @param allowNestedFilters true if filters inside this filter pool are - * to allow nested filters. - * @param isDeletable true if this filter pool is allowed to be deleted by users. - * @param tryToRestore true to attempt a restore first, false if a pure create operation. - */ - public ISystemFilterPool createSystemFilterPool( - String name, - boolean allowNestedFilters, - boolean isDeletable, - boolean tryToRestore) - { - - - SystemFilterPool pool = null; - if (tryToRestore) - { - try - { - pool = (SystemFilterPool)RSECorePlugin.getThePersistenceManager().restoreFilterPool(name); - } - catch (Exception exc) // real error trying to restore, versus simply not found. - { - // todo: something? Log the exception somewhere? - } - } - if (pool == null) // not found or some serious error. - { - pool = createPool(); - } - if (pool != null) - { - pool.initialize(name, allowNestedFilters, isDeletable); - } - return pool; - } - - // temporary! - //public boolean isSharable() {return isSharable; } - //public void setIsSharable(boolean is) { isSharable = is; } - - /* - * Private helper method. - * Uses MOF to create an instance of this class. - */ - protected static SystemFilterPool createPool() - { - ISystemFilterPool pool = new SystemFilterPool(); - // FIXME SystemFilterImpl.initMOF().createSystemFilterPool(); - pool.setRelease(RSECorePlugin.CURRENT_RELEASE); - return (SystemFilterPool)pool; - } - - /* - * Private helper method to initialize attributes - */ - protected void initialize(String name, - boolean allowNestedFilters, - boolean isDeletable) - { - if (!initialized) - initialize(name, savePolicy, namingPolicy); setDeletable(isDeletable); // mof attribute - //System.out.println("In initialize() for filter pool " + getName() + ". isDeletable= " + isDeletable); setSupportsNestedFilters(allowNestedFilters); // cascades to each filter - } - + } + /* * Private helper method to core initialization, from either createXXX or restore. */ Index: src/org/eclipse/rse/internal/core/filters/SystemFilterString.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterString.java,v retrieving revision 1.4 diff -u -r1.4 SystemFilterString.java --- src/org/eclipse/rse/internal/core/filters/SystemFilterString.java 12 Apr 2007 20:25:59 -0000 1.4 +++ src/org/eclipse/rse/internal/core/filters/SystemFilterString.java 14 Apr 2007 17:38:28 -0000 @@ -18,7 +18,6 @@ import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.Platform; -import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.filters.ISystemFilter; import org.eclipse.rse.core.filters.ISystemFilterPoolManager; import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider; Index: src/org/eclipse/rse/core/model/RSEPersistableObject.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/RSEPersistableObject.java,v retrieving revision 1.1 diff -u -r1.1 RSEPersistableObject.java --- src/org/eclipse/rse/core/model/RSEPersistableObject.java 4 Apr 2007 02:27:54 -0000 1.1 +++ src/org/eclipse/rse/core/model/RSEPersistableObject.java 14 Apr 2007 17:38:22 -0000 @@ -1,11 +1,11 @@ package org.eclipse.rse.core.model; + public abstract class RSEPersistableObject implements IRSEPersistableContainer { private boolean _isDirty = false; private boolean _wasRestored = false; private boolean _isTainted = false; - private boolean _restoring = false; public RSEPersistableObject() { super(); @@ -16,21 +16,8 @@ } public final void setDirty(boolean flag) { - if (!_restoring) { - _isDirty = flag; - if (flag) { - setTainted(true); - } - } - } - - public final void beginRestore() { - _restoring = true; - } - - public final void endRestore() { - _restoring = false; - setWasRestored(true); + _isDirty = flag; + setTainted(flag); } public final boolean wasRestored() { @@ -46,19 +33,12 @@ } public final void setTainted(boolean flag) { - if (!_restoring) { - _isTainted = flag; - if (_isTainted) { - IRSEPersistableContainer parent = getPersistableParent(); - if (parent != null) { - parent.setTainted(true); - } - } else { - IRSEPersistableContainer[] children = getPersistableChildren(); - for (int i = 0; i < children.length; i++) { - IRSEPersistableContainer child = children[i]; - child.setTainted(false); - } + boolean taintParent = flag && !_isTainted; + _isTainted = flag; + if (taintParent) { + IRSEPersistableContainer parent = getPersistableParent(); + if (parent != null) { + parent.setTainted(true); } } } Index: src/org/eclipse/rse/core/model/ISystemRegistry.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemRegistry.java,v retrieving revision 1.11 diff -u -r1.11 ISystemRegistry.java --- src/org/eclipse/rse/core/model/ISystemRegistry.java 27 Mar 2007 18:42:44 -0000 1.11 +++ src/org/eclipse/rse/core/model/ISystemRegistry.java 14 Apr 2007 17:38:22 -0000 @@ -22,7 +22,6 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.jobs.ISchedulingRule; import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.filters.ISystemFilterPool; import org.eclipse.rse.core.filters.ISystemFilterStartHere; import org.eclipse.rse.core.subsystems.IConnectorService; import org.eclipse.rse.core.subsystems.ISubSystem; @@ -44,8 +43,6 @@ public ISystemFilterStartHere getSystemFilterStartHere(); - public ISystemFilterPool getSystemFilterPool(); - // ---------------------------------- // UI METHODS... // ---------------------------------- Index: src/org/eclipse/rse/core/model/ISystemProfileManager.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemProfileManager.java,v retrieving revision 1.5 diff -u -r1.5 ISystemProfileManager.java --- src/org/eclipse/rse/core/model/ISystemProfileManager.java 2 Mar 2007 18:54:02 -0000 1.5 +++ src/org/eclipse/rse/core/model/ISystemProfileManager.java 14 Apr 2007 17:38:21 -0000 @@ -16,6 +16,7 @@ package org.eclipse.rse.core.model; +import java.util.List; import java.util.Vector; /** @@ -44,11 +45,17 @@ public void makeSystemProfileActive(ISystemProfile profile, boolean makeActive); /** - * @return an array of all existing profiles. + * @return an array of all existing profiles. This is guaranteed to contain the + * default private profile. */ public ISystemProfile[] getSystemProfiles(); /** + * @return the number of profiles known to this manager. + */ + public int getSize(); + + /** * @return an array of all existing profile names. */ public String[] getSystemProfileNames(); @@ -129,7 +136,9 @@ * @return The list of profiles known to this manager. This list is generated * at the point of this call and may thus be manipulated by the caller. */ - java.util.List getProfiles(); + public List getProfiles(); + + public void addSystemProfile(ISystemProfile profile); // /** // * Reusable method to return a name validator for renaming a profile. Index: src/org/eclipse/rse/core/model/RSEModelOperation.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/RSEModelOperation.java,v retrieving revision 1.2 diff -u -r1.2 RSEModelOperation.java --- src/org/eclipse/rse/core/model/RSEModelOperation.java 3 Jan 2007 16:44:01 -0000 1.2 +++ src/org/eclipse/rse/core/model/RSEModelOperation.java 14 Apr 2007 17:38:22 -0000 @@ -74,10 +74,8 @@ * Ends a transaction. Schedules all changed profiles for save. */ private static void endTransaction() { - ISystemRegistry registry = RSECorePlugin.getDefault().getSystemRegistry(); - ISystemProfileManager profileManager = registry.getSystemProfileManager(); IRSEPersistenceManager persistenceManager = RSECorePlugin.getDefault().getPersistenceManager(); - persistenceManager.commit(profileManager); + persistenceManager.commitProfiles(); } /** Index: src/org/eclipse/rse/core/model/IRSEPersistableContainer.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/IRSEPersistableContainer.java,v retrieving revision 1.2 diff -u -r1.2 IRSEPersistableContainer.java --- src/org/eclipse/rse/core/model/IRSEPersistableContainer.java 4 Apr 2007 02:27:54 -0000 1.2 +++ src/org/eclipse/rse/core/model/IRSEPersistableContainer.java 14 Apr 2007 17:38:21 -0000 @@ -49,22 +49,7 @@ * @param flag true if the object was restored. */ public void setWasRestored(boolean flag); - - /** - * Notifies the object that it is being restored. Typically this will - * suppress any marking of the object as dirty and related objects as - * tainted while the restore is taking place. Should be used only by - * persistence providers. - */ - public void beginRestore(); - - /** - * Notifies the object that it is has been restored. This will - * enable the object to be marked as dirty if subsequent changes - * are made to it. Should be used only by persistence providers. - */ - public void endRestore(); - + /** * An object is dirty if a change has been made to it that requires * it to be persisted. @@ -106,8 +91,7 @@ * Sets the tainted attribute for this object. This should set to * true only by child objects when they have been marked dirty or tainted. * Setting this to true will cause all parent objects in the containment - * hierarchy to be marked tainted. Setting this to false will cause all - * children to be marked as not tainted. + * hierarchy to be marked tainted. * It should be set to false only by a persistence manager when the * object has been committed. * @param flag the tainted state of the object. Index: src/org/eclipse/rse/core/filters/SystemFilterPoolManager.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/filters/SystemFilterPoolManager.java,v retrieving revision 1.6 diff -u -r1.6 SystemFilterPoolManager.java --- src/org/eclipse/rse/core/filters/SystemFilterPoolManager.java 12 Apr 2007 20:25:59 -0000 1.6 +++ src/org/eclipse/rse/core/filters/SystemFilterPoolManager.java 14 Apr 2007 17:38:21 -0000 @@ -18,6 +18,7 @@ import java.util.ArrayList; import java.util.Iterator; +import java.util.List; import java.util.Vector; import org.eclipse.core.resources.IFile; @@ -25,15 +26,11 @@ import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.model.IRSEPersistableContainer; import org.eclipse.rse.core.model.ISystemProfile; -import org.eclipse.rse.core.model.ISystemRegistry; import org.eclipse.rse.core.model.RSEPersistableObject; import org.eclipse.rse.core.references.IRSEBaseReferencingObject; import org.eclipse.rse.internal.core.filters.ISystemFilterConstants; +import org.eclipse.rse.internal.core.filters.SystemFilterPool; import org.eclipse.rse.logging.Logger; -import org.eclipse.rse.persistence.IRSEPersistenceManager; - -// -// /** * A filter pool manager manages filter pools. @@ -190,10 +187,7 @@ */ protected boolean singleFilterStringOnly = SINGLE_FILTER_STRING_ONLY_EDEFAULT; - /** - * @generated This field/method will be replaced during code generation. - */ - protected java.util.List pools = null; + protected List pools = null; /** * Constructor @@ -224,7 +218,7 @@ * individual filter pool level. * @param savePolicy The save policy for the filter pools and filters. One of the * following constants from the - * {@link org.eclipse.rse.internal.core.filters.ISystemFilterConstants SystemFilterConstants} interface: + * {@link ISystemFilterConstants} interface: *