1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-03 14:25:37 +02:00

[224671][api] org.eclipse.rse.core API leaks non-API types

https://bugs.eclipse.org/bugs/show_bug.cgi?id=224671
This commit is contained in:
David Dykstal 2008-04-03 20:57:55 +00:00
parent 959999b4eb
commit 80500e6983
20 changed files with 249 additions and 232 deletions

View file

@ -14,12 +14,14 @@
* Contributors:
* David Dykstal (IBM) - cleanup format and javadoc
* Martin Oberhuber (Wind River) - [cleanup] Add API "since" Javadoc tags
* David Dykstal (IBM) - [224671] [api] org.eclipse.rse.core API leaks non-API types
*******************************************************************************/
package org.eclipse.rse.core.filters;
import org.eclipse.rse.core.model.IRSEModelObject;
import org.eclipse.rse.core.references.IRSEReferencedObject;
import org.eclipse.rse.core.subsystems.ISubSystem;
/**
* A filter consists of filter strings and may be contained in a filter pool.
@ -605,6 +607,22 @@ public interface ISystemFilter extends IRSEReferencedObject, ISystemFilterContai
*/
public boolean isTransient();
/**
* Set the subsytem of this filter.
* This is ignored if the filter is not transient.
* @param subsystem a subsystem associated with this transient filter
* @since 3.0
*/
public void setSubSystem(ISubSystem subsystem);
/**
* Get the subsystem for this filter.
* This will return null if the filter is not transient.
* @return the subsystem
* @since 3.0
*/
public Object getSubSystem();
/**
* Clones a given filter to the given target filter.
* All filter strings, and all nested filters, are copied.

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2002, 2007 IBM Corporation. All rights reserved.
* Copyright (c) 2002, 2008 IBM Corporation. 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
@ -12,6 +12,7 @@
*
* Contributors:
* David Dykstal (IBM) - 142806: refactoring persistence framework
* David Dykstal (IBM) - [224671] [api] org.eclipse.rse.core API leaks non-API types
********************************************************************************/
package org.eclipse.rse.core.filters;
@ -27,10 +28,10 @@ import org.eclipse.rse.core.model.IRSEPersistableContainer;
import org.eclipse.rse.core.model.ISystemContainer;
import org.eclipse.rse.core.model.ISystemContentsType;
import org.eclipse.rse.core.references.IRSEBaseReferencedObject;
import org.eclipse.rse.core.references.SystemReferencingObject;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.internal.core.filters.SystemFilterContainerReferenceCommonMethods;
import org.eclipse.rse.internal.core.filters.SystemFilterStringReference;
import org.eclipse.rse.internal.references.SystemReferencingObject;
/**
* Represents a shadow or reference to a system filter.

View file

@ -0,0 +1,25 @@
/*********************************************************************************
* Copyright (c) 2008 IBM Corporation. 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
*
* Contributors:
* David Dykstal (IBM) - [224671] [api] org.eclipse.rse.core API leaks non-API types
*********************************************************************************/
package org.eclipse.rse.core.filters;
import org.eclipse.rse.internal.core.filters.SystemFilterSimple;
/**
* Utilities to be used in the construction and manipulation of filters.
* @noextend
*/
public class SystemFilterUtil {
public static ISystemFilter makeSimpleFilter(String name) {
return new SystemFilterSimple(name);
}
}

View file

@ -0,0 +1,25 @@
/*********************************************************************************
* Copyright (c) 2008 IBM Corporation. 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
*
* Contributors:
* David Dykstal (IBM) - [224671] [api] org.eclipse.rse.core API leaks non-API types
*********************************************************************************/
package org.eclipse.rse.core.model;
/**
* A modifiable container allows its contents to be set directly.
*/
public interface ISystemModifiableContainer extends ISystemContainer {
/**
* Cache contents of a certain type.
* @param type the contents type.
* @param cachedContents the contents to cache.
*/
public void setContents(ISystemContentsType type, Object[] cachedContents);
}

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* Copyright (c) 2002, 2008 IBM Corporation. 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
@ -11,26 +11,19 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* David Dykstal (IBM) - [224671] [api] org.eclipse.rse.core API leaks non-API types
********************************************************************************/
package org.eclipse.rse.internal.references;
package org.eclipse.rse.core.references;
import org.eclipse.rse.core.model.RSEModelObject;
import org.eclipse.rse.core.references.IRSEBaseReferencingObject;
import org.eclipse.rse.core.references.IRSEReferencedObject;
/**
* A class to encapsulate the operations required of an object which
* supports references to it by other objects (SystemReferencingObject).
* supports references to it by other objects ({@link SystemReferencingObject}).
* This type of class needs to support maintaining an in-memory list of
* all who reference it so that list can be following on delete and
* rename operations.
* <p>
* These references are not persistent. Persistent references are managed
* by the subclass SystemPersistableReferencedObject.
* <p>
* SystemFilter is a known concrete subclass.
*/
public abstract class SystemReferencedObject extends RSEModelObject implements IRSEReferencedObject {
@ -40,12 +33,9 @@ public abstract class SystemReferencedObject extends RSEModelObject implements I
* Default constructor. Typically called by EMF factory method.
*/
protected SystemReferencedObject() {
helper = new SystemReferencedObjectHelper(this);
helper = new SystemReferencedObjectHelper();
}
// ----------------------------------
// IRSEReferencedObject methods...
// ----------------------------------
/**
* Add a reference, increment reference count, return new count
* @param ref the referencing object

View file

@ -0,0 +1,72 @@
/*******************************************************************************
* Copyright (c) 2002, 2008 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:
* David Dykstal (IBM) - [224671] [api] org.eclipse.rse.core API leaks non-API types
*******************************************************************************/
package org.eclipse.rse.core.references;
import java.util.Vector;
/**
* The class should be used by subclasses of {@link SystemReferencedObject} by instantiating it and delegating to it.
*/
public class SystemReferencedObjectHelper {
private Vector referencingObjects = new Vector();
/**
* @see IRSEBaseReferencedObject#addReference(IRSEBaseReferencingObject)
*/
public int addReference(IRSEBaseReferencingObject ref) {
referencingObjects.addElement(ref);
return referencingObjects.size();
}
/**
* @see IRSEBaseReferencedObject#removeReference(IRSEBaseReferencingObject)
*/
public int removeReference(IRSEBaseReferencingObject ref) {
referencingObjects.removeElement(ref);
return referencingObjects.size();
}
/**
* @see IRSEBaseReferencedObject#getReferenceCount()
*/
public int getReferenceCount() {
return referencingObjects.size();
}
/**
* Clear the list of referenced objects.
*/
public void removeAllReferences() {
IRSEBaseReferencingObject[] references = getReferencingObjects();
for (int i = 0; i < references.length; i++) {
IRSEBaseReferencingObject reference = references[i];
removeReference(reference);
}
}
/**
* @see IRSEBaseReferencedObject#getReferencingObjects()
*/
public IRSEBaseReferencingObject[] getReferencingObjects() {
IRSEBaseReferencingObject[] references = new IRSEBaseReferencingObject[referencingObjects.size()];
referencingObjects.toArray(references);
return references;
}
}

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
* Copyright (c) 2002, 2008 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
@ -12,25 +12,21 @@
*
* Contributors:
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
* David Dykstal (IBM) - [224671] [api] org.eclipse.rse.core API leaks non-API types
********************************************************************************/
package org.eclipse.rse.internal.references;
package org.eclipse.rse.core.references;
import org.eclipse.rse.core.model.RSEModelObject;
import org.eclipse.rse.core.references.IRSEBaseReferencedObject;
import org.eclipse.rse.core.references.IRSEReferencingObject;
import org.eclipse.rse.internal.core.RSECoreMessages;
/**
* A class to encapsulate the operations required of an object which
* is merely a reference to another object, something we call a shadow.
* Such shadows are needed to support a GUI which displays the same
* Such shadows are needed to support a UI which displays the same
* object in multiple places. To enable that, it is necessary not to
* use the same physical object in each UI representation as the UI
* will only know how to update/refresh the first one it finds.
* <p>
* These references are not persistent. Persistent references are managed
* by the subclass SystemPersistableReferencingObject.
*/
public abstract class SystemReferencingObject extends RSEModelObject implements IRSEReferencingObject {
private SystemReferencingObjectHelper helper = null;

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2002, 2007 IBM Corporation and others.
* Copyright (c) 2002, 2008 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
@ -12,19 +12,15 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* David Dykstal (IBM) - [224671] [api] org.eclipse.rse.core API leaks non-API types
*******************************************************************************/
package org.eclipse.rse.internal.references;
package org.eclipse.rse.core.references;
import org.eclipse.rse.core.references.IRSEBaseReferencedObject;
import org.eclipse.rse.core.references.IRSEBaseReferencingObject;
/**
* This is a class that implements all the methods in the IRSEReferencingObject.
* It makes implementing this interface trivial.
* The easiest use of this class is to subclass it, but since that is not
* always possible, it is not abstract and hence can be leveraged via containment.
* The class should be used by subclasses of {@link SystemReferencingObject} by instantiating it and delegating to it.
* @noextend
*/
public class SystemReferencingObjectHelper {

View file

@ -16,6 +16,7 @@
* David Dykstal (IBM) - [206901] fixing ArrayStoreException in getPersistableChildren
* Removed caching that was here because of previous EMF/MOF implementation. This makes
* the class simpler.
* David Dykstal (IBM) - [224671] [api] org.eclipse.rse.core API leaks non-API types
********************************************************************************/
package org.eclipse.rse.internal.core.filters;
@ -34,11 +35,11 @@ import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
import org.eclipse.rse.core.filters.ISystemFilterString;
import org.eclipse.rse.core.filters.SystemFilterSimple;
import org.eclipse.rse.core.model.IRSEPersistableContainer;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.references.SystemReferencedObject;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.internal.core.RSECoreMessages;
import org.eclipse.rse.internal.references.SystemReferencedObject;
/**
* A filter is an encapsulation of a unique name, and a list of filter strings.
@ -186,7 +187,6 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte
* and not intended to be saved or part of the filter framework. Eg it has no manager or provider.
* <p>
* We always return false.
* @see SystemFilterSimple
*/
public boolean isTransient() {
return false;
@ -904,6 +904,20 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte
public boolean isSetSingleFilterStringOnly() {
return singleFilterStringOnly;
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.filters.ISystemFilter#setSubSystem(org.eclipse.rse.core.subsystems.ISubSystem)
*/
public void setSubSystem(ISubSystem subsystem) {
// does nothing this is not a transient filter
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.filters.ISystemFilter#getSubSystem()
*/
public Object getSubSystem() {
return null; // since this is not a transient filter
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.model.IRSEPersistableContainer#commit()

View file

@ -15,9 +15,10 @@
* David Dykstal (IBM) - [206901] fixing ArrayStoreException in getPersistableChildren
* Fix involved removing visibility for data referenced in SystemFilter. Addressed
* that by modifying the implementation of SystemFilterSimple to use its own data.
* David Dykstal (IBM) - [224671] [api] org.eclipse.rse.core API leaks non-API types
*******************************************************************************/
package org.eclipse.rse.core.filters;
package org.eclipse.rse.internal.core.filters;
import java.util.ArrayList;
import java.util.Arrays;
@ -25,9 +26,13 @@ import java.util.HashMap;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.rse.core.model.ISystemContainer;
import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
import org.eclipse.rse.core.filters.ISystemFilterString;
import org.eclipse.rse.core.model.ISystemContentsType;
import org.eclipse.rse.internal.core.filters.SystemFilter;
import org.eclipse.rse.core.model.ISystemModifiableContainer;
import org.eclipse.rse.core.subsystems.ISubSystem;
/**
* A lightweight implementation of ISystemFilter.
@ -47,14 +52,14 @@ import org.eclipse.rse.internal.core.filters.SystemFilter;
* <li>The attributes relativeOrder, promptable and default
* </ul>
*/
public class SystemFilterSimple extends SystemFilter implements ISystemContainer {
public class SystemFilterSimple extends SystemFilter implements ISystemModifiableContainer {
private String name = null;
private String type = null;
private boolean caseSensitive = false;
private boolean promptable = false;
private boolean isStale = true;
private Object parent = null;
private Object subsystem = null;
private List filterStrings = new ArrayList(3);
private HashMap cachedContents = new HashMap();
@ -107,15 +112,15 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer
* Set the parent. Since we don't have any filter manager, we need
* some way to store context info for the adapter. Use this.
*/
public void setParent(Object parent) {
this.parent = parent;
public void setSubSystem(ISubSystem parent) {
this.subsystem = parent;
}
/**
* Get the parent as set in setParent(Object)
*/
public Object getParent() {
return parent;
public Object getSubSystem() {
return subsystem;
}
// -------------------------------------------------------

View file

@ -14,6 +14,7 @@
* David Dykstal (IBM) - 142806: refactoring persistence framework
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
* Martin Oberhuber (Wind River) - Cleanup Javadoc.
* David Dykstal (IBM) - [224671] [api] org.eclipse.rse.core API leaks non-API types
********************************************************************************/
package org.eclipse.rse.internal.core.filters;
@ -27,8 +28,8 @@ import org.eclipse.rse.core.filters.ISystemFilterString;
import org.eclipse.rse.core.model.IRSEPersistableContainer;
import org.eclipse.rse.core.model.RSEModelObject;
import org.eclipse.rse.core.references.IRSEBaseReferencingObject;
import org.eclipse.rse.core.references.SystemReferencedObjectHelper;
import org.eclipse.rse.internal.core.RSECoreMessages;
import org.eclipse.rse.internal.references.SystemReferencedObjectHelper;
/**
@ -72,7 +73,7 @@ public class SystemFilterString extends RSEModelObject implements ISystemFilterS
protected SystemFilterString()
{
super();
helper = new SystemReferencedObjectHelper(this);
helper = new SystemReferencedObjectHelper();
}
/*

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2002, 2007 IBM Corporation and others.
* Copyright (c) 2002, 2008 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
@ -12,7 +12,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* David Dykstal (IBM) - [224671] [api] org.eclipse.rse.core API leaks non-API types
*******************************************************************************/
package org.eclipse.rse.internal.core.filters;
@ -25,7 +25,7 @@ import org.eclipse.rse.core.filters.ISystemFilterReference;
import org.eclipse.rse.core.filters.ISystemFilterString;
import org.eclipse.rse.core.filters.ISystemFilterStringReference;
import org.eclipse.rse.core.references.IRSEBaseReferencedObject;
import org.eclipse.rse.internal.references.SystemReferencingObjectHelper;
import org.eclipse.rse.core.references.SystemReferencingObjectHelper;
/**
* A reference to a system filter string.

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* Copyright (c) 2002, 2008 IBM Corporation. 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
@ -11,11 +11,12 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* David Dykstal (IBM) - [224671] [api] org.eclipse.rse.core API leaks non-API types
********************************************************************************/
package org.eclipse.rse.internal.references;
import org.eclipse.rse.core.references.IRSEPersistableReferencedObject;
import org.eclipse.rse.core.references.SystemReferencedObject;
/**
* @see org.eclipse.rse.core.references.IRSEBasePersistableReferenceManager

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* Copyright (c) 2002, 2008 IBM Corporation. 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
@ -11,12 +11,13 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* David Dykstal (IBM) - [224671] [api] org.eclipse.rse.core API leaks non-API types
********************************************************************************/
package org.eclipse.rse.internal.references;
import org.eclipse.rse.core.references.IRSEBasePersistableReferencedObject;
import org.eclipse.rse.core.references.SystemReferencedObjectHelper;
/**
* This class extends the support for a class that supports being managing by a transient
@ -31,11 +32,9 @@ public class SystemPersistableReferencedObjectHelper extends SystemReferencedObj
/**
* Constructor for SystemPersistableReferencedObjectHelper
* @param parent the SystemPersistableReferencedObject that uses this helper.
* @param referenceName The unique name that can be stored to identify this object.
*/
protected SystemPersistableReferencedObjectHelper(IRSEBasePersistableReferencedObject parent, String referenceName) {
super(parent);
protected SystemPersistableReferencedObjectHelper(String referenceName) {
setReferenceName(referenceName);
}

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* Copyright (c) 2002, 2008 IBM Corporation. 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
@ -11,7 +11,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* David Dykstal (IBM) - [224671] [api] org.eclipse.rse.core API leaks non-API types
********************************************************************************/
package org.eclipse.rse.internal.references;
@ -19,6 +19,7 @@ package org.eclipse.rse.internal.references;
import org.eclipse.rse.core.references.IRSEBasePersistableReferenceManager;
import org.eclipse.rse.core.references.IRSEBasePersistableReferencedObject;
import org.eclipse.rse.core.references.IRSEPersistableReferencingObject;
import org.eclipse.rse.core.references.SystemReferencingObject;
/**
* This class represents an object that references another object in the model.

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2002, 2007 IBM Corporation and others.
* Copyright (c) 2002, 2008 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
@ -12,13 +12,14 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* David Dykstal (IBM) - [224671] [api] org.eclipse.rse.core API leaks non-API types
*******************************************************************************/
package org.eclipse.rse.internal.references;
import org.eclipse.rse.core.references.IRSEBasePersistableReferencedObject;
import org.eclipse.rse.core.references.IRSEBaseReferencingObject;
import org.eclipse.rse.core.references.SystemReferencingObjectHelper;
/**
* This class extends the support for managing a transient in-memory reference

View file

@ -1,131 +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.internal.references;
import java.util.Vector;
import org.eclipse.rse.core.references.IRSEBaseReferencedObject;
import org.eclipse.rse.core.references.IRSEBaseReferencingObject;
/**
* This is a class that implements all the methods in the IRSEReferencedObject.
* It makes implementing this interface trivial.
* The easiest use of this class is to subclass it, but since that is not
* always possible, it is not abstract and hence can be leveraged via containment.
*/
public class SystemReferencedObjectHelper implements IRSEBaseReferencedObject {
private Vector referencingObjects = new Vector();
// private IRSEBaseReferencedObject parent = null;
/**
* Constructor for SystemReferencedObjectHelper
* @param parent the SystemReferencedObject creating this helper
*/
public SystemReferencedObjectHelper(IRSEBaseReferencedObject parent) {
// this.parent = parent;
}
/**
* @see IRSEBaseReferencedObject#addReference(IRSEBaseReferencingObject)
*/
public int addReference(IRSEBaseReferencingObject ref) {
// String fromName = getReferencingName(ref);
// String toName = getReferencedName();
// System.out.println(MessageFormat.format("Adding reference from {0} to {1}", new Object[] {fromName, toName}));
referencingObjects.addElement(ref);
return referencingObjects.size();
}
// private String getReferencedName() {
// String toName = "unknown"; //$NON-NLS-1$
// if (parent instanceof ISystemFilterPool) {
// ISystemFilterPool fp = (ISystemFilterPool) parent;
// toName = fp.getName();
// }
// return toName;
// }
// private String getReferencingName(IRSEBaseReferencingObject object) {
// String fromName = "unknown"; //$NON-NLS-1$
// if (object instanceof ISystemFilterPoolReference) {
// ISystemFilterPoolReference fpr = (ISystemFilterPoolReference) object;
// ISystemFilterPoolReferenceManagerProvider provider = fpr.getProvider();
// String prefix = "unknown|unknown|unknown"; //$NON-NLS-1$
// if (provider instanceof ISubSystem) {
// ISubSystem subsystem = (ISubSystem) provider;
// IHost host = subsystem.getHost();
// prefix = host.getAliasName() + "|" + subsystem.getName(); //$NON-NLS-1$
// fromName = prefix + fpr.getName();
// }
// }
// return fromName;
// }
/**
* @see IRSEBaseReferencedObject#removeReference(IRSEBaseReferencingObject)
*/
public int removeReference(IRSEBaseReferencingObject ref) {
// String fromName = getReferencingName(ref);
// String toName = getReferencedName();
// System.out.println(MessageFormat.format("Removing reference from {0} to {1}", new Object[] {fromName, toName}));
boolean found = referencingObjects.removeElement(ref);
assertThis(!found, "removeReference failed for " + ref); //$NON-NLS-1$
return referencingObjects.size();
}
/**
* @see IRSEBaseReferencedObject#getReferenceCount()
*/
public int getReferenceCount() {
return referencingObjects.size();
}
/**
* Clear the list of referenced objects.
*/
public void removeAllReferences() {
IRSEBaseReferencingObject[] references = getReferencingObjects();
for (int i = 0; i < references.length; i++) {
IRSEBaseReferencingObject reference = references[i];
removeReference(reference);
}
// referencingObjects.removeAllElements();
}
/**
* @see IRSEBaseReferencedObject#getReferencingObjects()
*/
public IRSEBaseReferencingObject[] getReferencingObjects() {
IRSEBaseReferencingObject[] references = new IRSEBaseReferencingObject[referencingObjects.size()];
referencingObjects.toArray(references);
return references;
}
/**
* Assertion method for debugging purposes. All instances of assertion failure should be removed by
* release.
* @param assertion a boolean (usually an expression) that is to be tested
* @param msg the message printed on System.out
*/
protected void assertThis(boolean assertion, String msg) {
// if (!assertion) System.out.println("ASSERTION FAILED IN SystemReferencedObject: " + msg); //$NON-NLS-1$
}
}

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
* Copyright (c) 2002, 2008 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
@ -13,6 +13,7 @@
* Contributors:
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* David Dykstal (IBM) - [224671] [api] org.eclipse.rse.core API leaks non-API types
********************************************************************************/
package org.eclipse.rse.files.ui.widgets;
@ -31,7 +32,7 @@ import org.eclipse.rse.core.IRSESystemType;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.SystemRemoteObjectMatcher;
import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.SystemFilterSimple;
import org.eclipse.rse.core.filters.SystemFilterUtil;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.files.ui.ISystemAddFileListener;
@ -83,7 +84,6 @@ import org.eclipse.swt.widgets.Text;
* <li>{@link #setShowPropertySheet(boolean)}
* <li>{@link #enableAddMode(org.eclipse.rse.files.ui.ISystemAddFileListener)}
* <li>{@link #setMultipleSelectionMode(boolean)}
* <li>{@link #setSelectionValidator(org.eclipse.rse.ui.IValidatorRemoteSelection)}
* </ul>
* <p>
* To configure the text on the dialog, call these methods:
@ -302,7 +302,7 @@ public class SystemSelectRemoteFileOrFolderForm
// set the default filters we will show when the user expands a connection...
String filterName = null;
SystemFilterSimple filter = null;
ISystemFilter filter = null;
int filterCount = showRootFilter ? 2 : 1;
if (preSelectRoot)
filterCount = 1;
@ -327,9 +327,9 @@ public class SystemSelectRemoteFileOrFolderForm
}
else
filterName = fileMode ? SystemFileResources.RESID_FILTER_DRIVES : SystemFileResources.RESID_FILTER_DRIVES;
filter = new SystemFilterSimple(filterName);
filter.setParent(ss);
filter.setFilterString(rffs.toString());
filter = SystemFilterUtil.makeSimpleFilter(filterName);
filter.setSubSystem(ss);
filter.setFilterStrings(new String[] {rffs.toString()});
filters[idx++] = filter;
//System.out.println("FILTER 1: " + filter.getFilterString());
if (preSelectRoot)
@ -346,9 +346,9 @@ public class SystemSelectRemoteFileOrFolderForm
// filter two: "\folder1\folder2"
rffs.setPath(folderAbsolutePath);
filter = new SystemFilterSimple(rffs.toStringNoSwitches());
filter.setParent(ss);
filter.setFilterString(rffs.toString());
filter = SystemFilterUtil.makeSimpleFilter(rffs.toStringNoSwitches());
filter.setSubSystem(ss);
filter.setFilterStrings(new String[] {rffs.toString()});
filters[idx] = filter;
preSelectFilter = filter;

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
* Copyright (c) 2002, 2008 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
@ -17,6 +17,7 @@
* Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods
* Tobias Schwarz (Wind River) - [173267] "empty list" should not be displayed
* Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
* David Dykstal (IBM) - [224671] [api] org.eclipse.rse.core API leaks non-API types
********************************************************************************/
package org.eclipse.rse.internal.ui.view;
@ -26,7 +27,7 @@ import org.eclipse.rse.core.IRSESystemType;
import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterReference;
import org.eclipse.rse.core.filters.ISystemFilterStringReference;
import org.eclipse.rse.core.filters.SystemFilterSimple;
import org.eclipse.rse.core.filters.SystemFilterUtil;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemViewInputProvider;
import org.eclipse.rse.core.subsystems.ISubSystem;
@ -228,9 +229,8 @@ public class SystemSelectRemoteObjectAPIProviderImpl
}
/**
* Set the quick filters to be exposed to the user. These will be shown to the
* user when they expand a connection.
* @see org.eclipse.rse.core.filters.SystemFilterSimple
* Set the filters to be exposed to the user. These will be shown to the
* user when they expand a connection.
*/
public void setQuickFilters(ISystemFilter[] filters)
{
@ -428,10 +428,10 @@ public class SystemSelectRemoteObjectAPIProviderImpl
for (int idx=0; idx<quickFilters.length; idx++)
{
SystemFilterSimple quickFilter = (SystemFilterSimple)quickFilters[idx];
children[idx] = new SystemFilterSimple(quickFilter.getName());
ISystemFilter quickFilter = quickFilters[idx];
children[idx] = SystemFilterUtil.makeSimpleFilter(quickFilter.getName());
quickFilter.clone((ISystemFilter)children[idx]);
((SystemFilterSimple)children[idx]).setParent(subsystem);
((ISystemFilter)children[idx]).setSubSystem(subsystem);
}
}
@ -440,9 +440,9 @@ public class SystemSelectRemoteObjectAPIProviderImpl
// walk through quickFilters and if they are transient, assign current subsystem as parent
for (int idx=0; idx<quickFilters.length; idx++)
{
if ((quickFilters[idx] instanceof SystemFilterSimple))
if ((quickFilters[idx].isTransient()))
{
((SystemFilterSimple)quickFilters[idx]).setParent(subsystem);
quickFilters[idx].setSubSystem(subsystem);
}
}

View file

@ -20,6 +20,7 @@
* Tobias Schwarz (Wind River) - [173267] "empty list" should not be displayed
* Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
* Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
* David Dykstal (IBM) - [224671] [api] org.eclipse.rse.core API leaks non-API types
*******************************************************************************/
package org.eclipse.rse.internal.ui.view;
@ -39,8 +40,8 @@ import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
import org.eclipse.rse.core.filters.ISystemFilterString;
import org.eclipse.rse.core.filters.SystemFilterSimple;
import org.eclipse.rse.core.model.ISystemMessageObject;
import org.eclipse.rse.core.model.ISystemModifiableContainer;
import org.eclipse.rse.core.model.ISystemViewInputProvider;
import org.eclipse.rse.core.model.SystemChildrenContentsType;
import org.eclipse.rse.core.model.SystemMessageObject;
@ -159,7 +160,7 @@ public class SystemViewFilterAdapter extends AbstractSystemViewAdapter
public String getAbsoluteName(Object element)
{
ISystemFilter filter = getFilter(element);
if (filter instanceof SystemFilterSimple)
if (filter.isTransient())
{
return filter.getName();
}
@ -188,7 +189,7 @@ public class SystemViewFilterAdapter extends AbstractSystemViewAdapter
{
ISystemFilter filter = getFilter(element);
if (filter.isTransient())
return ((SystemFilterSimple)filter).getParent();
return filter.getSubSystem();
return filter.getParentFilterContainer();
}
@ -206,11 +207,10 @@ public class SystemViewFilterAdapter extends AbstractSystemViewAdapter
return checkForEmptyList(processPromptingFilter(filter), element, true);
Object[] children = null;
SystemFilterSimple simpleFilter = (SystemFilterSimple)filter;
String[] filterStrings = simpleFilter.getFilterStrings();
String[] filterStrings = filter.getFilterStrings();
// 50167pc: The following was a problem, as the parent in a SystemFilterSimpleImpl is not
// to be trusted, since we tend to use the same instance for each connection in the list.
ISubSystem ss = (ISubSystem)simpleFilter.getParent();
ISubSystem ss = (ISubSystem)filter.getSubSystem();
String preSelectName = null;
try
{
@ -230,20 +230,23 @@ public class SystemViewFilterAdapter extends AbstractSystemViewAdapter
}
preSelectName = ip.getPreSelectFilterChild();
}
if (filter instanceof ISystemModifiableContainer) {
ISystemModifiableContainer containingFilter = (ISystemModifiableContainer) filter;
// get children from cache if the children have been cached
if (ss.getSubSystemConfiguration().supportsFilterCaching() && !containingFilter.isStale() &&
containingFilter.hasContents(SystemChildrenContentsType.getInstance())) {
children = containingFilter.getContents(SystemChildrenContentsType.getInstance());
}
// otherwise, get children and then cache
else {
children = checkForEmptyList(ss.resolveFilterStrings(filterStrings, monitor), element, true);
if (ss.getSubSystemConfiguration().supportsFilterCaching()) {
containingFilter.setContents(SystemChildrenContentsType.getInstance(), children);
}
}
}
// get children from cache if the children have been cached
if (ss.getSubSystemConfiguration().supportsFilterCaching() && !simpleFilter.isStale() &&
simpleFilter.hasContents(SystemChildrenContentsType.getInstance())) {
children = simpleFilter.getContents(SystemChildrenContentsType.getInstance());
}
// otherwise, get children and then cache
else {
children = checkForEmptyList(ss.resolveFilterStrings(filterStrings, monitor), element, true);
if (ss.getSubSystemConfiguration().supportsFilterCaching()) {
simpleFilter.setContents(SystemChildrenContentsType.getInstance(), children);
}
}
if ((children !=null) && (preSelectName != null))
{