1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-03 07:05:24 +02:00

[163883] Enable proper persistence for multiple filter string attributes in filter pools

This commit is contained in:
David Dykstal 2007-08-30 17:13:10 +00:00
parent acd2bd19c2
commit 3aa04bb1f4
2 changed files with 43 additions and 4 deletions

View file

@ -13,6 +13,7 @@
* Contributors:
* Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
* Kevin Doyle (IBM) - [163883] Multiple filter strings are disabled
********************************************************************************/
package org.eclipse.rse.internal.persistence.dom;
@ -28,7 +29,6 @@ import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
import org.eclipse.rse.core.filters.ISystemFilterString;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.IProperty;
import org.eclipse.rse.core.model.IPropertySet;
import org.eclipse.rse.core.model.IPropertyType;
import org.eclipse.rse.core.model.IRSEModelObject;
@ -201,9 +201,24 @@ public class RSEDOMExporter implements IRSEDOMExporter {
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_STRING_CASE_SENSITIVE, getBooleanString(filterPool.isSetStringsCaseSensitive()));
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_DUPLICATE_FILTER_STRINGS, getBooleanString(filterPool.supportsDuplicateFilterStrings()));
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_RELEASE, Integer.toString(filterPool.getRelease()));
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SINGLE_FILTER_STRING_ONLY, getBooleanString(filterPool.isSetSingleFilterStringOnly()));
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_OWNING_PARENT_NAME, filterPool.getOwningParentName());
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_NON_RENAMABLE, getBooleanString(filterPool.isNonRenamable()));
boolean isSingleFilterStringOnly = false;
boolean isSingleFilterStringOnlyESet = filterPool.isSetSingleFilterStringOnly();
// if ESet is true then calling isSingleFilterStringOnly() will return
// the value stored in the filter pool and not in the fp manager
// in the false case isSingleFilterStringOnly should be false as that what it is by default
if (isSingleFilterStringOnlyESet) {
isSingleFilterStringOnly = filterPool.isSingleFilterStringOnly();
} else {
isSingleFilterStringOnly = false;
}
node.addAttribute("singleFilterStringOnlyESet", getBooleanString(isSingleFilterStringOnlyESet)); //$NON-NLS-1$
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SINGLE_FILTER_STRING_ONLY, getBooleanString(isSingleFilterStringOnly));
}
ISystemFilter[] filters = filterPool.getSystemFilters();
for (int i = 0; i < filters.length; i++) {

View file

@ -14,6 +14,7 @@
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
* Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
* Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods
* Kevin Doyle (IBM) - [163883] Multiple filter strings are disabled
********************************************************************************/
package org.eclipse.rse.internal.persistence.dom;
@ -353,7 +354,21 @@ public class RSEDOMImporter {
boolean isSetStringsCaseSensitive = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_STRING_CASE_SENSITIVE).getValue());
boolean isSetSupportsDuplicateFilterStrings = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_DUPLICATE_FILTER_STRINGS).getValue());
int release = getIntegerValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_RELEASE).getValue());
boolean isSetSingleFilterStringOnly = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_SINGLE_FILTER_STRING_ONLY).getValue());
// Since old profiles won't have an "singleFilterStringOnlyESet" attribute
// we must give it a default value.
// False has been chosen because if the persistence is not correct then we
// don't know what the proper value should be, so
// we want it to check with the filter pool manager to decide
// if multi filter strings are allowed
boolean isSingleFilterStringOnlyESet = false;
boolean isSetSingleFilterStringOnly = false;
RSEDOMNodeAttribute attribute = node.getAttribute("singleFilterStringOnlyESet"); //$NON-NLS-1$
if (attribute != null) {
isSingleFilterStringOnlyESet = getBooleanValue(attribute.getValue());
isSetSingleFilterStringOnly = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_SINGLE_FILTER_STRING_ONLY).getValue());
}
String owningParentName = node.getAttribute(IRSEDOMConstants.ATTRIBUTE_OWNING_PARENT_NAME).getValue();
boolean isNonRenamable = getBooleanValue(node.getAttribute(IRSEDOMConstants.ATTRIBUTE_NON_RENAMABLE).getValue());
@ -379,7 +394,16 @@ public class RSEDOMImporter {
filterPool.setStringsCaseSensitive(isSetStringsCaseSensitive);
filterPool.setSupportsDuplicateFilterStrings(isSetSupportsDuplicateFilterStrings);
filterPool.setRelease(release);
filterPool.setSingleFilterStringOnly(isSetSingleFilterStringOnly);
// if single filter string only has been set in the past then set
// the value to the persisted one which will set ESet to true
// In the false case we don't do anything because the persistence
// could be messed up or ESet has never been set before
// in which case single filter string only should be false
if (isSingleFilterStringOnlyESet) {
filterPool.setSingleFilterStringOnly(isSetSingleFilterStringOnly);
}
filterPool.setOwningParentName(owningParentName);
filterPool.setNonRenamable(isNonRenamable);
// filterPool.wasRestored();