mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-20 06:35:50 +02:00
[206901] [api] fixing array store exception and simplifying class
This commit is contained in:
parent
84019da4e0
commit
3d54afd880
2 changed files with 337 additions and 418 deletions
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -12,17 +12,21 @@
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* {Name} (company) - description of contribution.
|
* 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.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.core.filters;
|
package org.eclipse.rse.core.filters;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Vector;
|
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;
|
||||||
import org.eclipse.rse.core.model.ISystemContentsType;
|
import org.eclipse.rse.core.model.ISystemContentsType;
|
||||||
import org.eclipse.rse.internal.core.filters.ISystemFilterConstants;
|
|
||||||
import org.eclipse.rse.internal.core.filters.SystemFilter;
|
import org.eclipse.rse.internal.core.filters.SystemFilter;
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,16 +54,13 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer
|
||||||
{
|
{
|
||||||
|
|
||||||
private String name = null;
|
private String name = null;
|
||||||
private String type = ISystemFilterConstants.DEFAULT_TYPE;
|
private String type = null;
|
||||||
private boolean caseSensitive = false;
|
private boolean caseSensitive = false;
|
||||||
private boolean promptable = false;
|
private boolean promptable = false;
|
||||||
private Object parent;
|
private Object parent;
|
||||||
// the following are inherited...
|
private boolean isStale;
|
||||||
//private String[] filterStringArray = null;
|
private List filterStrings = new ArrayList(3);
|
||||||
//private SystemFilterString[] filterStringObjectArray = null;
|
private HashMap cachedContents;
|
||||||
//private Vector filterStringVector = null;
|
|
||||||
protected boolean isStale;
|
|
||||||
protected HashMap cachedContents;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for SystemFilterSimpleImpl
|
* Constructor for SystemFilterSimpleImpl
|
||||||
|
@ -68,17 +69,17 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer
|
||||||
{
|
{
|
||||||
//super();
|
//super();
|
||||||
this.name = name;
|
this.name = name;
|
||||||
filterStringVector = new Vector();
|
// filterStringVector = new Vector();
|
||||||
isStale = true;
|
isStale = true;
|
||||||
cachedContents = new HashMap();
|
cachedContents = new HashMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void invalidateCache()
|
// protected void invalidateCache()
|
||||||
{
|
// {
|
||||||
filterStringArray = null;
|
// filterStringArray = null;
|
||||||
filterStringObjectArray = null;
|
// filterStringObjectArray = null;
|
||||||
//filterStringVector = null;
|
// //filterStringVector = null;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if this a transient or simple filter that is only created temporary "on the fly"
|
* Return true if this a transient or simple filter that is only created temporary "on the fly"
|
||||||
|
@ -99,8 +100,6 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer
|
||||||
public void clone(ISystemFilter targetFilter)
|
public void clone(ISystemFilter targetFilter)
|
||||||
{
|
{
|
||||||
super.clone(targetFilter);
|
super.clone(targetFilter);
|
||||||
// hmm, due to polymorphism, we should not have to do anything here!
|
|
||||||
// well, except for this:
|
|
||||||
targetFilter.setFilterStrings(getFilterStringsVector());
|
targetFilter.setFilterStrings(getFilterStringsVector());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,20 +113,24 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer
|
||||||
*/
|
*/
|
||||||
public void setFilterString(String filterString)
|
public void setFilterString(String filterString)
|
||||||
{
|
{
|
||||||
filterStringVector.clear();
|
filterStrings.clear();
|
||||||
filterStringVector.addElement(filterString);
|
filterStrings.add(filterString);
|
||||||
invalidateCache();
|
// filterStringVector.clear();
|
||||||
|
// filterStringVector.addElement(filterString);
|
||||||
|
// invalidateCache();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get the single filter string.
|
* Get the single (or the first) filter string.
|
||||||
* Returns null if setFilterString has not been called.
|
* Returns null if setFilterString has not been called.
|
||||||
*/
|
*/
|
||||||
public String getFilterString()
|
public String getFilterString()
|
||||||
{
|
{
|
||||||
if (filterStringVector.size() == 0)
|
String result = filterStrings.isEmpty() ? null : (String)filterStrings.get(0);
|
||||||
return null;
|
return result;
|
||||||
else
|
// if (filterStringVector.size() == 0)
|
||||||
return (String)filterStringVector.elementAt(0);
|
// return null;
|
||||||
|
// else
|
||||||
|
// return (String)filterStringVector.elementAt(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -158,6 +161,7 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the filter's name
|
* Get the filter's name
|
||||||
*/
|
*/
|
||||||
|
@ -165,6 +169,7 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer
|
||||||
{
|
{
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the filter's type
|
* Set the filter's type
|
||||||
*/
|
*/
|
||||||
|
@ -172,6 +177,7 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer
|
||||||
{
|
{
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the filter's type
|
* Get the filter's type
|
||||||
*/
|
*/
|
||||||
|
@ -179,6 +185,7 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer
|
||||||
{
|
{
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify if filter strings in this filter are case sensitive.
|
* Specify if filter strings in this filter are case sensitive.
|
||||||
* Default is false.
|
* Default is false.
|
||||||
|
@ -196,6 +203,7 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer
|
||||||
{
|
{
|
||||||
return caseSensitive;
|
return caseSensitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Are filter strings in this filter case sensitive?
|
* Are filter strings in this filter case sensitive?
|
||||||
*/
|
*/
|
||||||
|
@ -224,72 +232,91 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer
|
||||||
*/
|
*/
|
||||||
public String[] getFilterStrings()
|
public String[] getFilterStrings()
|
||||||
{
|
{
|
||||||
if (filterStringArray == null)
|
String[] result = new String[filterStrings.size()];
|
||||||
{
|
filterStrings.toArray(result);
|
||||||
filterStringArray = new String[filterStringVector.size()];
|
return result;
|
||||||
for (int idx=0; idx<filterStringArray.length; idx++)
|
// if (filterStringArray == null)
|
||||||
filterStringArray[idx] = (String)filterStringVector.elementAt(idx);
|
// {
|
||||||
}
|
// filterStringArray = new String[filterStringVector.size()];
|
||||||
return filterStringArray;
|
// for (int idx=0; idx<filterStringArray.length; idx++)
|
||||||
|
// filterStringArray[idx] = (String)filterStringVector.elementAt(idx);
|
||||||
|
// }
|
||||||
|
// return filterStringArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return filter strings as a Vector of String objects
|
* Return filter strings as a Vector of String objects
|
||||||
*/
|
*/
|
||||||
public Vector getFilterStringsVector()
|
public Vector getFilterStringsVector()
|
||||||
{
|
{
|
||||||
return filterStringVector;
|
Vector result = new Vector(filterStrings.size());
|
||||||
|
result.addAll(filterStrings);
|
||||||
|
return result;
|
||||||
|
// return filterStringVector;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return how many filter strings are defined in this filter.
|
* Return how many filter strings are defined in this filter.
|
||||||
*/
|
*/
|
||||||
public int getFilterStringCount()
|
public int getFilterStringCount()
|
||||||
{
|
{
|
||||||
return filterStringVector.size();
|
return filterStrings.size();
|
||||||
|
// return filterStringVector.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set all the filter strings for this filter.
|
* Set all the filter strings for this filter.
|
||||||
* @param newStrings Vector of String objects
|
* @param newStrings Vector of String objects
|
||||||
*/
|
*/
|
||||||
public void setFilterStrings(Vector newStrings)
|
public void setFilterStrings(Vector newStrings)
|
||||||
{
|
{
|
||||||
filterStringVector.clear();
|
filterStrings.clear();
|
||||||
for (int idx=0; idx<newStrings.size(); idx++)
|
filterStrings.addAll(newStrings);
|
||||||
{
|
// filterStringVector.clear();
|
||||||
filterStringVector.addElement(newStrings.elementAt(idx));
|
// for (int idx=0; idx<newStrings.size(); idx++)
|
||||||
}
|
// {
|
||||||
invalidateCache();
|
// filterStringVector.addElement(newStrings.elementAt(idx));
|
||||||
|
// }
|
||||||
|
// invalidateCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
*/
|
*/
|
||||||
public void setFilterStrings(String newStrings[])
|
public void setFilterStrings(String newStrings[])
|
||||||
{
|
{
|
||||||
filterStringVector.clear();
|
filterStrings.clear();
|
||||||
for (int idx=0; idx<newStrings.length; idx++)
|
filterStrings.addAll(Arrays.asList(newStrings)); // cannot just set since asList returns a fixed-size array
|
||||||
{
|
// filterStringVector.clear();
|
||||||
filterStringVector.addElement(newStrings[idx]);
|
// for (int idx=0; idx<newStrings.length; idx++)
|
||||||
}
|
// {
|
||||||
invalidateCache();
|
// filterStringVector.addElement(newStrings[idx]);
|
||||||
|
// }
|
||||||
|
// invalidateCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append a new filter string to this filter's list.
|
* Append a new filter string to this filter's list.
|
||||||
* Returns null.
|
* Returns null.
|
||||||
*/
|
*/
|
||||||
public ISystemFilterString addFilterString(String newString)
|
public ISystemFilterString addFilterString(String newString)
|
||||||
{
|
{
|
||||||
filterStringVector.addElement(newString);
|
filterStrings.add(newString);
|
||||||
invalidateCache();
|
// filterStringVector.addElement(newString);
|
||||||
|
// invalidateCache();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert a new filter string to this filter's list, at the given zero-based position.
|
* Insert a new filter string to this filter's list, at the given zero-based position.
|
||||||
* Returns null.
|
* Returns null.
|
||||||
*/
|
*/
|
||||||
public ISystemFilterString addFilterString(String newString, int position)
|
public ISystemFilterString addFilterString(String newString, int position)
|
||||||
{
|
{
|
||||||
filterStringVector.insertElementAt(newString,position);
|
filterStrings.add(position, newString);
|
||||||
invalidateCache();
|
// filterStringVector.insertElementAt(newString,position);
|
||||||
|
// invalidateCache();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,8 +326,9 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer
|
||||||
*/
|
*/
|
||||||
public ISystemFilterString removeFilterString(String oldString)
|
public ISystemFilterString removeFilterString(String oldString)
|
||||||
{
|
{
|
||||||
filterStringVector.removeElement(oldString);
|
filterStrings.remove(oldString);
|
||||||
invalidateCache();
|
// filterStringVector.removeElement(oldString);
|
||||||
|
// invalidateCache();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,10 +338,12 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer
|
||||||
*/
|
*/
|
||||||
public ISystemFilterString removeFilterString(int position)
|
public ISystemFilterString removeFilterString(int position)
|
||||||
{
|
{
|
||||||
filterStringVector.removeElementAt(position);
|
filterStrings.remove(position);
|
||||||
invalidateCache();
|
// filterStringVector.removeElementAt(position);
|
||||||
|
// invalidateCache();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the children of this filter.
|
* Return the children of this filter.
|
||||||
* This is the same as getFilterStrings()
|
* This is the same as getFilterStrings()
|
||||||
|
@ -322,14 +352,21 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer
|
||||||
{
|
{
|
||||||
return getFilterStrings();
|
return getFilterStrings();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this filter has any filter strings
|
* Returns true if this filter has any filter strings
|
||||||
*/
|
*/
|
||||||
public boolean hasChildren()
|
public boolean hasChildren()
|
||||||
{
|
{
|
||||||
return (filterStringVector.size() > 0);
|
return filterStrings.size() > 0;
|
||||||
|
// return (filterStringVector.size() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------
|
||||||
|
// methods needed by ISystemFilter
|
||||||
|
// ---------------------
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------
|
// -------------------------------------------------------
|
||||||
// Non-applicable methods overridden to do nothing...
|
// Non-applicable methods overridden to do nothing...
|
||||||
// -------------------------------------------------------
|
// -------------------------------------------------------
|
||||||
|
@ -348,30 +385,36 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer
|
||||||
* Overridden to do nothing
|
* Overridden to do nothing
|
||||||
*/
|
*/
|
||||||
public void setSupportsNestedFilters(boolean value) {}
|
public void setSupportsNestedFilters(boolean value) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does this support nested filters? No. Not for simple filtes.
|
* Does this support nested filters? No. Not for simple filtes.
|
||||||
*/
|
*/
|
||||||
public boolean supportsNestedFilters() {return false;}
|
public boolean supportsNestedFilters() {return false;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if this filter is a nested filter or not.
|
* Return true if this filter is a nested filter or not.
|
||||||
* Overridden to return false;
|
* Overridden to return false;
|
||||||
*/
|
*/
|
||||||
public boolean isNested() { return false; }
|
public boolean isNested() { return false; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a new filter string's string value.
|
* Update a new filter string's string value.
|
||||||
* Overridden to do nothing.
|
* Overridden to do nothing.
|
||||||
*/
|
*/
|
||||||
public void updateFilterString(ISystemFilterString filterString, String newValue) {}
|
public void updateFilterString(ISystemFilterString filterString, String newValue) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a filter string from this filter's list, given its SystemFilterString object.
|
* Remove a filter string from this filter's list, given its SystemFilterString object.
|
||||||
* Overridden to do nothing
|
* Overridden to do nothing
|
||||||
*/
|
*/
|
||||||
public boolean removeFilterString(ISystemFilterString filterString) {return false;}
|
public boolean removeFilterString(ISystemFilterString filterString) {return false;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move a given filter string to a given zero-based location.
|
* Move a given filter string to a given zero-based location.
|
||||||
* Overridden to do nothing
|
* Overridden to do nothing
|
||||||
*/
|
*/
|
||||||
public void moveSystemFilterString(int pos, ISystemFilterString filterString) {}
|
public void moveSystemFilterString(int pos, ISystemFilterString filterString) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden to do nothing
|
* Overridden to do nothing
|
||||||
*/
|
*/
|
||||||
|
@ -381,66 +424,82 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer
|
||||||
* Overridden to return -1
|
* Overridden to return -1
|
||||||
*/
|
*/
|
||||||
public int getRelativeOrder() { return -1; }
|
public int getRelativeOrder() { return -1; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden to do nothing
|
* Overridden to do nothing
|
||||||
*/
|
*/
|
||||||
public void setDefault(boolean value) {}
|
public void setDefault(boolean value) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden to return false
|
* Overridden to return false
|
||||||
*/
|
*/
|
||||||
public boolean isDefault() {return false; }
|
public boolean isDefault() {return false; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden to do nothing
|
* Overridden to do nothing
|
||||||
*/
|
*/
|
||||||
public void setParentFilter(ISystemFilter l) {}
|
public void setParentFilter(ISystemFilter l) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden to return null
|
* Overridden to return null
|
||||||
*/
|
*/
|
||||||
public ISystemFilter getParentFilter() {return null;}
|
public ISystemFilter getParentFilter() {return null;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden to return null
|
* Overridden to return null
|
||||||
*/
|
*/
|
||||||
public Vector getSystemFilterNames() {return null;}
|
public Vector getSystemFilterNames() {return null;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden to return null
|
* Overridden to return null
|
||||||
*/
|
*/
|
||||||
public java.util.List getNestedFilters() {return null;}
|
public java.util.List getNestedFilters() {return null;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden to return null
|
* Overridden to return null
|
||||||
*/
|
*/
|
||||||
public Vector getSystemFiltersVector() {return null;}
|
public Vector getSystemFiltersVector() {return null;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden to return null
|
* Overridden to return null
|
||||||
*/
|
*/
|
||||||
public ISystemFilter[] getSystemFilters() {return null;}
|
public ISystemFilter[] getSystemFilters() {return null;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden to return 0
|
* Overridden to return 0
|
||||||
*/
|
*/
|
||||||
public int getSystemFilterCount() {return 0;}
|
public int getSystemFilterCount() {return 0;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden to return null
|
* Overridden to return null
|
||||||
*/
|
*/
|
||||||
public java.util.List getStrings() {return null;}
|
public java.util.List getStrings() {return null;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden to return null
|
* Overridden to return null
|
||||||
*/
|
*/
|
||||||
public ISystemFilter getSystemFilter(String aliasName) {return null;}
|
public ISystemFilter getSystemFilter(String aliasName) {return null;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden to return null
|
* Overridden to return null
|
||||||
*/
|
*/
|
||||||
public ISystemFilterPoolManagerProvider getProvider() {return null;}
|
public ISystemFilterPoolManagerProvider getProvider() {return null;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden to return null
|
* Overridden to return null
|
||||||
*/
|
*/
|
||||||
public ISystemFilterPoolManager getSystemFilterPoolManager() {return null;}
|
public ISystemFilterPoolManager getSystemFilterPoolManager() {return null;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden to return null
|
* Overridden to return null
|
||||||
*/
|
*/
|
||||||
public IFile getSaveFile() {return null;}
|
public IFile getSaveFile() {return null;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden to return null
|
* Overridden to return null
|
||||||
*/
|
*/
|
||||||
public String getSaveFileName() {return null;}
|
public String getSaveFileName() {return null;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden to do nothing
|
* Overridden to do nothing
|
||||||
*/
|
*/
|
||||||
|
@ -467,11 +526,9 @@ public class SystemFilterSimple extends SystemFilter implements ISystemContainer
|
||||||
* @see org.eclipse.rse.core.model.ISystemContainer#hasContents(org.eclipse.rse.core.model.ISystemContentsType)
|
* @see org.eclipse.rse.core.model.ISystemContainer#hasContents(org.eclipse.rse.core.model.ISystemContentsType)
|
||||||
*/
|
*/
|
||||||
public boolean hasContents(ISystemContentsType contentsType) {
|
public boolean hasContents(ISystemContentsType contentsType) {
|
||||||
|
|
||||||
if (cachedContents.containsKey(contentsType)) {
|
if (cachedContents.containsKey(contentsType)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
* 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
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
@ -13,6 +13,9 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* David Dykstal (IBM) - 142806: refactoring persistence framework
|
* David Dykstal (IBM) - 142806: refactoring persistence framework
|
||||||
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
|
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
|
||||||
|
* David Dykstal (IBM) - [206901] fixing ArrayStoreException in getPersistableChildren
|
||||||
|
* Removed caching that was here because of previous EMF/MOF implementation. This makes
|
||||||
|
* the class simpler.
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.core.filters;
|
package org.eclipse.rse.internal.core.filters;
|
||||||
|
@ -36,251 +39,43 @@ import org.eclipse.rse.core.filters.ISystemFilterString;
|
||||||
import org.eclipse.rse.core.filters.SystemFilterSimple;
|
import org.eclipse.rse.core.filters.SystemFilterSimple;
|
||||||
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.core.references.IRSEReferencedObject;
|
|
||||||
import org.eclipse.rse.internal.core.RSECoreMessages;
|
import org.eclipse.rse.internal.core.RSECoreMessages;
|
||||||
import org.eclipse.rse.internal.references.SystemReferencedObject;
|
import org.eclipse.rse.internal.references.SystemReferencedObject;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A filter is an encapsulation of a unique name, and a list
|
* A filter is an encapsulation of a unique name, and a list of filter strings.
|
||||||
* of filter strings.
|
|
||||||
* Filters can be referenced.
|
* Filters can be referenced.
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @lastgen class SystemFilterImpl extends SystemReferencedObjectImpl implements SystemFilter, SystemReferencedObject, SystemFilterContainer, IAdaptable {}
|
* @lastgen class SystemFilterImpl extends SystemReferencedObjectImpl implements SystemFilter, SystemReferencedObject, SystemFilterContainer, IAdaptable {}
|
||||||
*/
|
*/
|
||||||
public class SystemFilter extends SystemReferencedObject implements ISystemFilter, IRSEReferencedObject, IAdaptable
|
public class SystemFilter extends SystemReferencedObject implements ISystemFilter, IAdaptable
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @see #getName()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
protected static final String NAME_EDEFAULT = null;
|
|
||||||
|
|
||||||
private SystemFilterContainerCommonMethods helpers = null;
|
private SystemFilterContainerCommonMethods helpers = null;
|
||||||
private ISystemFilterPool parentPool = null;
|
private ISystemFilterPool parentPool = null;
|
||||||
protected String[] filterStringArray = null;
|
private List filterStrings = new ArrayList(3);
|
||||||
protected ISystemFilterString[] filterStringObjectArray = null;
|
private String name = null;
|
||||||
protected Vector filterStringVector = null;
|
private String type = null;
|
||||||
|
private boolean supportsNestedFilters = false;
|
||||||
//protected static String SAVEFILE_PREFIX = DEFAULT_FILENAME_PREFIX_FILTER;
|
private int relativeOrder = 0;
|
||||||
//protected static String SAVEFILE_SUFFIX = ".xmi";
|
private boolean default_ = false;
|
||||||
protected static boolean debug = true;
|
private boolean stringsCaseSensitive = false;
|
||||||
/**
|
private boolean promptable = false;
|
||||||
* @generated This field/method will be replaced during code generation.
|
private boolean supportsDuplicateFilterStrings = false;
|
||||||
*/
|
private boolean nonDeletable = false;
|
||||||
/**
|
private boolean nonRenamable = false;
|
||||||
* @generated This field/method will be replaced during code generation.
|
private boolean nonChangable = false;
|
||||||
*/
|
private boolean stringsNonChangable = false;
|
||||||
protected String name = NAME_EDEFAULT;
|
private int release = 0;
|
||||||
/**
|
private boolean singleFilterStringOnly = false;
|
||||||
* The default value of the '{@link #getType() <em>Type</em>}' attribute.
|
private List nestedFilters = new ArrayList(3);
|
||||||
* <!-- begin-user-doc -->
|
// private List strings = null;
|
||||||
* <!-- end-user-doc -->
|
private ISystemFilter _parentFilter;
|
||||||
* @see #getType()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
protected static final String TYPE_EDEFAULT = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @generated This field/method will be replaced during code generation.
|
* Constructor.
|
||||||
*/
|
|
||||||
protected String type = TYPE_EDEFAULT;
|
|
||||||
/**
|
|
||||||
* The default value of the '{@link #isSupportsNestedFilters() <em>Supports Nested Filters</em>}' attribute.
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @see #isSupportsNestedFilters()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
protected static final boolean SUPPORTS_NESTED_FILTERS_EDEFAULT = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @generated This field/method will be replaced during code generation.
|
|
||||||
*/
|
|
||||||
protected boolean supportsNestedFilters = SUPPORTS_NESTED_FILTERS_EDEFAULT;
|
|
||||||
/**
|
|
||||||
* The default value of the '{@link #getRelativeOrder() <em>Relative Order</em>}' attribute.
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @see #getRelativeOrder()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
protected static final int RELATIVE_ORDER_EDEFAULT = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @generated This field/method will be replaced during code generation.
|
|
||||||
*/
|
|
||||||
protected int relativeOrder = RELATIVE_ORDER_EDEFAULT;
|
|
||||||
/**
|
|
||||||
* The default value of the '{@link #isDefault() <em>Default</em>}' attribute.
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @see #isDefault()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
protected static final boolean DEFAULT_EDEFAULT = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @generated This field/method will be replaced during code generation.
|
|
||||||
*/
|
|
||||||
protected boolean default_ = DEFAULT_EDEFAULT;
|
|
||||||
/**
|
|
||||||
* The default value of the '{@link #isStringsCaseSensitive() <em>Strings Case Sensitive</em>}' attribute.
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @see #isStringsCaseSensitive()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
protected static final boolean STRINGS_CASE_SENSITIVE_EDEFAULT = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @generated This field/method will be replaced during code generation.
|
|
||||||
*/
|
|
||||||
protected boolean stringsCaseSensitive = STRINGS_CASE_SENSITIVE_EDEFAULT;
|
|
||||||
/**
|
|
||||||
* The default value of the '{@link #isPromptable() <em>Promptable</em>}' attribute.
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @see #isPromptable()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
protected static final boolean PROMPTABLE_EDEFAULT = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @generated This field/method will be replaced during code generation.
|
|
||||||
*/
|
|
||||||
protected boolean promptable = PROMPTABLE_EDEFAULT;
|
|
||||||
/**
|
|
||||||
* The default value of the '{@link #isSupportsDuplicateFilterStrings() <em>Supports Duplicate Filter Strings</em>}' attribute.
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @see #isSupportsDuplicateFilterStrings()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
protected static final boolean SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @generated This field/method will be replaced during code generation.
|
|
||||||
*/
|
|
||||||
protected boolean supportsDuplicateFilterStrings = SUPPORTS_DUPLICATE_FILTER_STRINGS_EDEFAULT;
|
|
||||||
/**
|
|
||||||
* The default value of the '{@link #isNonDeletable() <em>Non Deletable</em>}' attribute.
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @see #isNonDeletable()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
protected static final boolean NON_DELETABLE_EDEFAULT = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @generated This field/method will be replaced during code generation.
|
|
||||||
*/
|
|
||||||
protected boolean nonDeletable = NON_DELETABLE_EDEFAULT;
|
|
||||||
/**
|
|
||||||
* The default value of the '{@link #isNonRenamable() <em>Non Renamable</em>}' attribute.
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @see #isNonRenamable()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
protected static final boolean NON_RENAMABLE_EDEFAULT = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @generated This field/method will be replaced during code generation.
|
|
||||||
*/
|
|
||||||
protected boolean nonRenamable = NON_RENAMABLE_EDEFAULT;
|
|
||||||
/**
|
|
||||||
* The default value of the '{@link #isNonChangable() <em>Non Changable</em>}' attribute.
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @see #isNonChangable()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
protected static final boolean NON_CHANGABLE_EDEFAULT = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @generated This field/method will be replaced during code generation.
|
|
||||||
*/
|
|
||||||
protected boolean nonChangable = NON_CHANGABLE_EDEFAULT;
|
|
||||||
/**
|
|
||||||
* The default value of the '{@link #isStringsNonChangable() <em>Strings Non Changable</em>}' attribute.
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @see #isStringsNonChangable()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
protected static final boolean STRINGS_NON_CHANGABLE_EDEFAULT = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @generated This field/method will be replaced during code generation.
|
|
||||||
*/
|
|
||||||
protected boolean stringsNonChangable = STRINGS_NON_CHANGABLE_EDEFAULT;
|
|
||||||
/**
|
|
||||||
* The default value of the '{@link #getRelease() <em>Release</em>}' attribute.
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @see #getRelease()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
protected static final int RELEASE_EDEFAULT = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @generated This field/method will be replaced during code generation.
|
|
||||||
*/
|
|
||||||
protected int release = RELEASE_EDEFAULT;
|
|
||||||
/**
|
|
||||||
* The default value of the '{@link #isSingleFilterStringOnly() <em>Single Filter String Only</em>}' attribute.
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @see #isSingleFilterStringOnly()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
protected static final boolean SINGLE_FILTER_STRING_ONLY_EDEFAULT = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The cached value of the '{@link #isSingleFilterStringOnly() <em>Single Filter String Only</em>}' attribute.
|
|
||||||
* <!-- begin-user-doc -->
|
|
||||||
* <!-- end-user-doc -->
|
|
||||||
* @see #isSingleFilterStringOnly()
|
|
||||||
* @generated
|
|
||||||
* @ordered
|
|
||||||
*/
|
|
||||||
protected boolean singleFilterStringOnly = SINGLE_FILTER_STRING_ONLY_EDEFAULT;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @generated This field/method will be replaced during code generation.
|
|
||||||
*/
|
|
||||||
protected java.util.List nestedFilters = null;
|
|
||||||
/**
|
|
||||||
* @generated This field/method will be replaced during code generation.
|
|
||||||
*/
|
|
||||||
protected java.util.List strings = null;
|
|
||||||
|
|
||||||
|
|
||||||
// FIXME
|
|
||||||
protected ISystemFilter _parentFilter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor. Do not instantiate directly, let MOF do it!
|
|
||||||
*/
|
*/
|
||||||
protected SystemFilter()
|
protected SystemFilter()
|
||||||
{
|
{
|
||||||
|
@ -290,7 +85,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.
|
||||||
*/
|
*/
|
||||||
protected java.util.List internalGetFilters()
|
private List internalGetFilters()
|
||||||
{
|
{
|
||||||
return getNestedFilters();
|
return getNestedFilters();
|
||||||
}
|
}
|
||||||
|
@ -353,7 +148,7 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte
|
||||||
*/
|
*/
|
||||||
public void initializeFilterStrings()
|
public void initializeFilterStrings()
|
||||||
{
|
{
|
||||||
java.util.List filterStrings = getStrings();
|
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);
|
||||||
|
@ -613,64 +408,87 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte
|
||||||
* Internal way to return emf-modelled list of filter strings.
|
* Internal way to return emf-modelled list of filter strings.
|
||||||
* We use this so we can easily change to non-mof if we decide to.
|
* We use this so we can easily change to non-mof if we decide to.
|
||||||
*/
|
*/
|
||||||
private java.util.List internalGetFilterStrings()
|
// private List internalGetFilterStrings()
|
||||||
{
|
// {
|
||||||
return getStrings();
|
// return getStrings();
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear internal cache so it will be rebuilt on next request.
|
* Clear internal cache so it will be rebuilt on next request.
|
||||||
*/
|
*/
|
||||||
protected void invalidateCache()
|
// protected void invalidateCache()
|
||||||
{
|
// {
|
||||||
filterStringArray = null;
|
// filterStringArray = null;
|
||||||
filterStringObjectArray = null;
|
// filterStringObjectArray = null;
|
||||||
filterStringVector = null;
|
// filterStringVector = null;
|
||||||
setDirty(true);
|
// setDirty(true);
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return filter strings as an array of String objects.
|
* Returns the filter strings of this filter as an array of String objects.
|
||||||
|
* The array may be empty but will not be null.
|
||||||
*/
|
*/
|
||||||
public String[] getFilterStrings()
|
public String[] getFilterStrings() {
|
||||||
{
|
ISystemFilterString[] filterStrings = getSystemFilterStrings();
|
||||||
if (filterStringArray == null)
|
String[] result = new String[filterStrings.length];
|
||||||
{
|
for (int i = 0; i < filterStrings.length; i++) {
|
||||||
java.util.List el = internalGetFilterStrings();
|
ISystemFilterString filterString = filterStrings[i];
|
||||||
filterStringArray = new String[el.size()];
|
result[i] = filterString.getString();
|
||||||
Iterator i = el.iterator();
|
|
||||||
int idx = 0;
|
|
||||||
while (i.hasNext())
|
|
||||||
filterStringArray[idx++] = ((ISystemFilterString)(i.next())).getString();
|
|
||||||
}
|
}
|
||||||
return filterStringArray;
|
return result;
|
||||||
}
|
}
|
||||||
|
// public String[] getFilterStrings()
|
||||||
|
// {
|
||||||
|
// if (filterStringArray == null)
|
||||||
|
// {
|
||||||
|
// List el = internalGetFilterStrings();
|
||||||
|
// filterStringArray = new String[el.size()];
|
||||||
|
// Iterator i = el.iterator();
|
||||||
|
// int idx = 0;
|
||||||
|
// while (i.hasNext())
|
||||||
|
// filterStringArray[idx++] = ((ISystemFilterString)(i.next())).getString();
|
||||||
|
// }
|
||||||
|
// return filterStringArray;
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return filter strings as a Vector of String objects
|
* Return filter strings as a Vector of String objects.
|
||||||
|
* This vector may be empty but will never be null.
|
||||||
*/
|
*/
|
||||||
public Vector getFilterStringsVector()
|
public Vector getFilterStringsVector() {
|
||||||
{
|
String[] strings = getFilterStrings();
|
||||||
if (filterStringVector == null)
|
List stringList = Arrays.asList(strings);
|
||||||
{
|
Vector result = new Vector(stringList);
|
||||||
java.util.List el = internalGetFilterStrings();
|
return result;
|
||||||
Iterator i = el.iterator();
|
|
||||||
filterStringVector = new Vector();
|
|
||||||
while (i.hasNext())
|
|
||||||
filterStringVector.addElement(((ISystemFilterString)(i.next())).getString());
|
|
||||||
}
|
|
||||||
return filterStringVector;
|
|
||||||
}
|
}
|
||||||
|
// public Vector getFilterStringsVector()
|
||||||
|
// {
|
||||||
|
// if (filterStringVector == null)
|
||||||
|
// {
|
||||||
|
// List el = internalGetFilterStrings();
|
||||||
|
// Iterator i = el.iterator();
|
||||||
|
// filterStringVector = new Vector();
|
||||||
|
// while (i.hasNext())
|
||||||
|
// filterStringVector.addElement(((ISystemFilterString)(i.next())).getString());
|
||||||
|
// }
|
||||||
|
// return filterStringVector;
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get this filter's filter strings as a Vector of FilterString objects
|
* Get this filter's filter strings as a Vector of FilterString objects
|
||||||
*/
|
*/
|
||||||
public Vector getFilterStringObjectsVector()
|
public Vector getFilterStringObjectsVector()
|
||||||
{
|
{
|
||||||
java.util.List el = internalGetFilterStrings();
|
Vector result = new Vector(filterStrings.size());
|
||||||
Iterator i = el.iterator();
|
result.addAll(filterStrings);
|
||||||
Vector filterStringVector = new Vector();
|
return result;
|
||||||
while (i.hasNext())
|
//
|
||||||
filterStringVector.addElement(i.next());
|
// List el = internalGetFilterStrings();
|
||||||
return filterStringVector;
|
// Iterator i = el.iterator();
|
||||||
|
// Vector filterStringVector = new Vector();
|
||||||
|
// while (i.hasNext())
|
||||||
|
// filterStringVector.addElement(i.next());
|
||||||
|
// return filterStringVector;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -678,8 +496,10 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte
|
||||||
*/
|
*/
|
||||||
public int getFilterStringCount()
|
public int getFilterStringCount()
|
||||||
{
|
{
|
||||||
return internalGetFilterStrings().size();
|
return filterStrings.size();
|
||||||
|
// return internalGetFilterStrings().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a filter string given its string value
|
* Get a filter string given its string value
|
||||||
*/
|
*/
|
||||||
|
@ -706,55 +526,73 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte
|
||||||
}
|
}
|
||||||
return match;
|
return match;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set all the filter strings for this filter.
|
* Set all the filter strings for this filter.
|
||||||
* @param newStrings Vector of String objects
|
* @param newStrings Vector of String objects
|
||||||
*/
|
*/
|
||||||
public void setFilterStrings(Vector newStrings)
|
public void setFilterStrings(Vector newStrings)
|
||||||
{
|
{
|
||||||
java.util.List strings = internalGetFilterStrings();
|
filterStrings.clear();
|
||||||
strings.clear();
|
for (Iterator z = newStrings.iterator(); z.hasNext();) {
|
||||||
for (int idx=0; idx<newStrings.size(); idx++)
|
String newString = (String) z.next();
|
||||||
{
|
ISystemFilterString filterString = createFilterString(newString);
|
||||||
String currString = (String)newStrings.elementAt(idx);
|
filterStrings.add(filterString);
|
||||||
ISystemFilterString string = new SystemFilterString();
|
|
||||||
// FIXME initMOF().createSystemFilterString();
|
|
||||||
string.setString(currString);
|
|
||||||
string.setParentSystemFilter(this);
|
|
||||||
strings.add(string);
|
|
||||||
}
|
}
|
||||||
invalidateCache();
|
setDirty(true);
|
||||||
|
// List strings = internalGetFilterStrings();
|
||||||
|
// strings.clear();
|
||||||
|
// for (int idx=0; idx<newStrings.size(); idx++)
|
||||||
|
// {
|
||||||
|
// String currString = (String)newStrings.elementAt(idx);
|
||||||
|
// ISystemFilterString string = new SystemFilterString();
|
||||||
|
// // FIXME initMOF().createSystemFilterString();
|
||||||
|
// string.setString(currString);
|
||||||
|
// string.setParentSystemFilter(this);
|
||||||
|
// strings.add(string);
|
||||||
|
// }
|
||||||
|
// invalidateCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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()
|
||||||
{
|
{
|
||||||
if (filterStringObjectArray == null)
|
// List strings = internalGetFilterStrings();
|
||||||
{
|
ISystemFilterString[] result = new ISystemFilterString[filterStrings.size()];
|
||||||
java.util.List el = internalGetFilterStrings();
|
filterStrings.toArray(result);
|
||||||
filterStringObjectArray = new ISystemFilterString[el.size()];
|
return result;
|
||||||
Iterator i = el.iterator();
|
// if (filterStrings == null)
|
||||||
int idx = 0;
|
// {
|
||||||
while (i.hasNext())
|
// List el = internalGetFilterStrings();
|
||||||
filterStringObjectArray[idx++] = (ISystemFilterString)(i.next());
|
// filterStrings = new ISystemFilterString[el.size()];
|
||||||
}
|
// Iterator i = el.iterator();
|
||||||
return filterStringObjectArray;
|
// int idx = 0;
|
||||||
|
// while (i.hasNext())
|
||||||
|
// filterStrings[idx++] = (ISystemFilterString)(i.next());
|
||||||
|
// }
|
||||||
|
// return filterStrings;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
*/
|
*/
|
||||||
public void setFilterStrings(String newStrings[])
|
public void setFilterStrings(String newStrings[])
|
||||||
{
|
{
|
||||||
java.util.List strings = internalGetFilterStrings();
|
// List strings = internalGetFilterStrings();
|
||||||
strings.clear();
|
filterStrings.clear();
|
||||||
for (int idx=0; idx<newStrings.length; idx++)
|
for (int idx=0; idx<newStrings.length; idx++)
|
||||||
{
|
{
|
||||||
addFilterString(newStrings[idx]);
|
ISystemFilterString filterString = createFilterString(newStrings[idx]);
|
||||||
|
filterStrings.add(filterString);
|
||||||
|
// addFilterString(newStrings[idx]);
|
||||||
}
|
}
|
||||||
|
setDirty(true);
|
||||||
//invalidateCache(); already done
|
//invalidateCache(); already done
|
||||||
}
|
}
|
||||||
|
|
||||||
private ISystemFilterString createFilterString(String string)
|
private ISystemFilterString createFilterString(String string)
|
||||||
{
|
{
|
||||||
ISystemFilterString filterstring = new SystemFilterString();
|
ISystemFilterString filterstring = new SystemFilterString();
|
||||||
|
@ -764,28 +602,33 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte
|
||||||
filterstring.setParentSystemFilter(this);
|
filterstring.setParentSystemFilter(this);
|
||||||
return filterstring;
|
return filterstring;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append a new filter string to this filter's list
|
* Append a new filter string to this filter's list
|
||||||
*/
|
*/
|
||||||
public ISystemFilterString addFilterString(String newString)
|
public ISystemFilterString addFilterString(String newString)
|
||||||
{
|
{
|
||||||
java.util.List strings = internalGetFilterStrings();
|
|
||||||
ISystemFilterString newFilterString = createFilterString(newString);
|
ISystemFilterString newFilterString = createFilterString(newString);
|
||||||
strings.add(newFilterString);
|
// List strings = internalGetFilterStrings();
|
||||||
invalidateCache();
|
filterStrings.add(newFilterString);
|
||||||
|
setDirty(true);
|
||||||
|
// invalidateCache();
|
||||||
return newFilterString;
|
return newFilterString;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert a new filter string to this filter's list, at the given zero-based position
|
* Insert a new filter string to this filter's list, at the given zero-based position
|
||||||
*/
|
*/
|
||||||
public ISystemFilterString addFilterString(String newString, int position)
|
public ISystemFilterString addFilterString(String newString, int position)
|
||||||
{
|
{
|
||||||
java.util.List strings = internalGetFilterStrings();
|
// List strings = internalGetFilterStrings();
|
||||||
ISystemFilterString newFilterString = createFilterString(newString);
|
ISystemFilterString newFilterString = createFilterString(newString);
|
||||||
strings.add(position, newFilterString);
|
filterStrings.add(position, newFilterString);
|
||||||
invalidateCache();
|
setDirty(true);
|
||||||
|
// invalidateCache();
|
||||||
return newFilterString;
|
return newFilterString;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a new filter string's string value
|
* Update a new filter string's string value
|
||||||
*/
|
*/
|
||||||
|
@ -800,9 +643,9 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte
|
||||||
*/
|
*/
|
||||||
public ISystemFilterString removeFilterString(String oldString)
|
public ISystemFilterString removeFilterString(String oldString)
|
||||||
{
|
{
|
||||||
java.util.List strings = internalGetFilterStrings();
|
// List strings = internalGetFilterStrings();
|
||||||
ISystemFilterString match = null;
|
ISystemFilterString match = null;
|
||||||
Iterator i = strings.iterator();
|
Iterator i = filterStrings.iterator();
|
||||||
while ((match==null) && (i.hasNext()))
|
while ((match==null) && (i.hasNext()))
|
||||||
{
|
{
|
||||||
ISystemFilterString currstring = (ISystemFilterString)i.next();
|
ISystemFilterString currstring = (ISystemFilterString)i.next();
|
||||||
|
@ -811,8 +654,9 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte
|
||||||
}
|
}
|
||||||
if (match!=null)
|
if (match!=null)
|
||||||
{
|
{
|
||||||
strings.remove(match);
|
filterStrings.remove(match);
|
||||||
invalidateCache();
|
// invalidateCache();
|
||||||
|
setDirty(true);
|
||||||
}
|
}
|
||||||
return match;
|
return match;
|
||||||
}
|
}
|
||||||
|
@ -823,12 +667,13 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte
|
||||||
*/
|
*/
|
||||||
public ISystemFilterString removeFilterString(int position)
|
public ISystemFilterString removeFilterString(int position)
|
||||||
{
|
{
|
||||||
java.util.List strings = internalGetFilterStrings();
|
// List strings = internalGetFilterStrings();
|
||||||
if (position >= strings.size())
|
ISystemFilterString filterString = null;
|
||||||
return null;
|
if (position < filterStrings.size()) {
|
||||||
ISystemFilterString filterString = (ISystemFilterString)strings.get(position);
|
filterString = (ISystemFilterString)filterStrings.remove(position);
|
||||||
strings.remove(position);
|
setDirty(true);
|
||||||
invalidateCache();
|
}
|
||||||
|
// invalidateCache();
|
||||||
return filterString;
|
return filterString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -838,23 +683,35 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte
|
||||||
*/
|
*/
|
||||||
public boolean removeFilterString(ISystemFilterString filterString)
|
public boolean removeFilterString(ISystemFilterString filterString)
|
||||||
{
|
{
|
||||||
java.util.List strings = internalGetFilterStrings();
|
// List strings = internalGetFilterStrings();
|
||||||
if (strings.contains(filterString))
|
boolean removed = filterStrings.remove(filterString);
|
||||||
{
|
if (removed) {
|
||||||
strings.remove(filterString);
|
setDirty(true);
|
||||||
invalidateCache();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
else
|
return removed;
|
||||||
return false;
|
// if (strings.contains(filterString))
|
||||||
|
// {
|
||||||
|
// strings.remove(filterString);
|
||||||
|
//// invalidateCache();
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move a given filter string to a given zero-based location
|
* Move a given filter string to a given zero-based location
|
||||||
*/
|
*/
|
||||||
public void moveSystemFilterString(int pos, ISystemFilterString filterString)
|
public void moveSystemFilterString(int pos, ISystemFilterString filterString)
|
||||||
{
|
{
|
||||||
|
// List strings = internalGetFilterStrings();
|
||||||
|
boolean removed = filterStrings.remove(filterString);
|
||||||
|
if (removed) {
|
||||||
|
filterStrings.add(pos, filterString);
|
||||||
|
setDirty(true);
|
||||||
|
}
|
||||||
//FIXME internalGetFilterStrings().move(pos,filterString);
|
//FIXME internalGetFilterStrings().move(pos,filterString);
|
||||||
invalidateCache();
|
// invalidateCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -900,7 +757,7 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte
|
||||||
*/
|
*/
|
||||||
public boolean hasChildren()
|
public boolean hasChildren()
|
||||||
{
|
{
|
||||||
if (internalGetFilterStrings().size() > 0)
|
if (filterStrings.size() > 0)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return helpers.hasSystemFilters(internalGetFilters());
|
return helpers.hasSystemFilters(internalGetFilters());
|
||||||
|
@ -954,7 +811,7 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte
|
||||||
/* FIXME
|
/* FIXME
|
||||||
String fileName = getRootSaveFileName(namingPolicy, name);
|
String fileName = getRootSaveFileName(namingPolicy, name);
|
||||||
|
|
||||||
java.util.List ext = mofHelpers.restore(folder,fileName);
|
List ext = mofHelpers.restore(folder,fileName);
|
||||||
|
|
||||||
// should be exactly one...
|
// should be exactly one...
|
||||||
Iterator iList = ext.iterator();
|
Iterator iList = ext.iterator();
|
||||||
|
@ -1118,12 +975,16 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte
|
||||||
*/
|
*/
|
||||||
public void unsetStringsCaseSensitive()
|
public void unsetStringsCaseSensitive()
|
||||||
{
|
{
|
||||||
boolean oldStringsCaseSensitive = stringsCaseSensitive;
|
if (stringsCaseSensitive) {
|
||||||
if (oldStringsCaseSensitive != STRINGS_CASE_SENSITIVE_EDEFAULT)
|
stringsCaseSensitive = false;
|
||||||
{
|
|
||||||
stringsCaseSensitive = STRINGS_CASE_SENSITIVE_EDEFAULT;
|
|
||||||
setDirty(true);
|
setDirty(true);
|
||||||
}
|
}
|
||||||
|
// boolean oldStringsCaseSensitive = stringsCaseSensitive;
|
||||||
|
// if (oldStringsCaseSensitive != STRINGS_CASE_SENSITIVE_EDEFAULT)
|
||||||
|
// {
|
||||||
|
// stringsCaseSensitive = STRINGS_CASE_SENSITIVE_EDEFAULT;
|
||||||
|
// setDirty(true);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1189,7 +1050,7 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte
|
||||||
/**
|
/**
|
||||||
* @generated This field/method will be replaced during code generation
|
* @generated This field/method will be replaced during code generation
|
||||||
*/
|
*/
|
||||||
public java.util.List getNestedFilters()
|
public List getNestedFilters()
|
||||||
{
|
{
|
||||||
if (nestedFilters == null)
|
if (nestedFilters == null)
|
||||||
{
|
{
|
||||||
|
@ -1202,14 +1063,14 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte
|
||||||
/**
|
/**
|
||||||
* @generated This field/method will be replaced during code generation
|
* @generated This field/method will be replaced during code generation
|
||||||
*/
|
*/
|
||||||
public java.util.List getStrings()
|
public List getStrings()
|
||||||
{
|
{
|
||||||
if (strings == null)
|
// if (filterStrings == null)
|
||||||
{
|
// {
|
||||||
strings = new ArrayList();
|
// filterStrings = new ArrayList();
|
||||||
//FIXME new EObjectContainmenteList(SystemFilterString.class, this, FiltersPackage.SYSTEM_FILTER__STRINGS);
|
// //FIXME new EObjectContainmenteList(SystemFilterString.class, this, FiltersPackage.SYSTEM_FILTER__STRINGS);
|
||||||
}
|
// }
|
||||||
return strings;
|
return filterStrings;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1352,13 +1213,17 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte
|
||||||
|
|
||||||
public void unsetSingleFilterStringOnly()
|
public void unsetSingleFilterStringOnly()
|
||||||
{
|
{
|
||||||
boolean oldSingleFilterStringOnly = singleFilterStringOnly;
|
if (singleFilterStringOnly) {
|
||||||
if (oldSingleFilterStringOnly != SINGLE_FILTER_STRING_ONLY_EDEFAULT)
|
singleFilterStringOnly = false;
|
||||||
{
|
|
||||||
singleFilterStringOnly = SINGLE_FILTER_STRING_ONLY_EDEFAULT;
|
|
||||||
setDirty(true);
|
setDirty(true);
|
||||||
}
|
}
|
||||||
|
// boolean oldSingleFilterStringOnly = singleFilterStringOnly;
|
||||||
|
// if (oldSingleFilterStringOnly != SINGLE_FILTER_STRING_ONLY_EDEFAULT)
|
||||||
|
// {
|
||||||
|
// singleFilterStringOnly = SINGLE_FILTER_STRING_ONLY_EDEFAULT;
|
||||||
|
// setDirty(true);
|
||||||
|
// }
|
||||||
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSetSingleFilterStringOnly()
|
public boolean isSetSingleFilterStringOnly()
|
||||||
|
@ -1380,12 +1245,9 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte
|
||||||
|
|
||||||
public IRSEPersistableContainer[] getPersistableChildren() {
|
public IRSEPersistableContainer[] getPersistableChildren() {
|
||||||
List children = new ArrayList(20);
|
List children = new ArrayList(20);
|
||||||
if (nestedFilters != null) {
|
List nf = getNestedFilters(); // guaranteed to not be null, none of these should be simple filters
|
||||||
children.addAll(nestedFilters);
|
children.addAll(nf);
|
||||||
}
|
children.addAll(filterStrings);
|
||||||
if (filterStringVector != null) {
|
|
||||||
children.addAll(filterStringVector);
|
|
||||||
}
|
|
||||||
children.addAll(Arrays.asList(getPropertySets()));
|
children.addAll(Arrays.asList(getPropertySets()));
|
||||||
IRSEPersistableContainer[] result = new IRSEPersistableContainer[children.size()];
|
IRSEPersistableContainer[] result = new IRSEPersistableContainer[children.size()];
|
||||||
children.toArray(result);
|
children.toArray(result);
|
||||||
|
|
Loading…
Add table
Reference in a new issue