1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

bug 370063: CSettingEntryFactory is not needed anymore

This commit is contained in:
Andrew Gvozdev 2012-01-29 08:38:39 -05:00
parent 6680b5a020
commit d20555df6c
13 changed files with 113 additions and 222 deletions

View file

@ -16,9 +16,10 @@ import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.IPath;
public abstract class ACExclusionFilterEntry extends ACPathEntry implements ICExclusionPatternPathEntry {
private IPath[] exclusionPatterns;
private final IPath[] exclusionPatterns;
private final static char[][] UNINIT_PATTERNS = new char[][] { "Non-initialized yet".toCharArray() }; //$NON-NLS-1$
char[][]fullCharExclusionPatterns = UNINIT_PATTERNS;
/** calculated value, does not have to be final */
char[][] fullCharExclusionPatterns = UNINIT_PATTERNS;
ACExclusionFilterEntry(IPath path, IPath exclusionPatterns[] , int flags) {
@ -74,17 +75,25 @@ public abstract class ACExclusionFilterEntry extends ACPathEntry implements ICEx
}
@Override
public boolean equals(Object other) {
if(!super.equals(other))
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
ACExclusionFilterEntry otherEntry = (ACExclusionFilterEntry)other;
return Arrays.equals(exclusionPatterns, otherEntry.exclusionPatterns);
if (getClass() != obj.getClass())
return false;
ACExclusionFilterEntry other = (ACExclusionFilterEntry) obj;
if (!Arrays.equals(exclusionPatterns, other.exclusionPatterns))
return false;
return true;
}
@Override
public int hashCode() {
return super.hashCode() + exclusionPatterns.hashCode();
final int prime = 31;
int result = super.hashCode();
result = prime * result + Arrays.hashCode(exclusionPatterns);
return result;
}
@Override

View file

@ -114,6 +114,6 @@ public abstract class ACPathEntry extends ACSettingEntry implements ICPathEntry
@Override
protected String contentsToString() {
return fName;
return getName();
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2008 Intel Corporation and others.
* Copyright (c) 2007, 2012 Intel 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
@ -13,11 +13,9 @@ package org.eclipse.cdt.core.settings.model;
import org.eclipse.cdt.core.settings.model.util.LanguageSettingEntriesSerializer;
import org.eclipse.cdt.internal.core.SafeStringInterner;
public abstract class ACSettingEntry implements ICSettingEntry {
int fFlags;
String fName;
private final int fFlags;
private final String fName;
ACSettingEntry(String name, int flags){
fName = SafeStringInterner.safeIntern(name);

View file

@ -20,9 +20,9 @@ import org.eclipse.core.runtime.Path;
* As an example, those are supplied by a gcc compiler with option "-l".
*/
public final class CLibraryFileEntry extends ACPathEntry implements ICLibraryFileEntry {
private IPath fSourceAttachmentPath;
private IPath fSourceAttachmentRootPath;
private IPath fSourceAttachmentPrefixMapping;
private final IPath fSourceAttachmentPath;
private final IPath fSourceAttachmentRootPath;
private final IPath fSourceAttachmentPrefixMapping;
/**
* This constructor is discouraged to be referenced by clients.
@ -64,38 +64,33 @@ public final class CLibraryFileEntry extends ACPathEntry implements ICLibraryFil
this(rc, flags, null, null, null);
}
public CLibraryFileEntry(String value,
int flags,
public CLibraryFileEntry(String name, int flags,
IPath sourceAttachmentPath,
IPath sourceAttachmentRootPath,
IPath sourceAttachmentPrefixMapping) {
super(value, flags);
setSourceAttachmentSettings(sourceAttachmentPath, sourceAttachmentRootPath, sourceAttachmentPrefixMapping);
super(name, flags);
fSourceAttachmentPath = sourceAttachmentPath;
fSourceAttachmentRootPath = sourceAttachmentRootPath != null ? sourceAttachmentRootPath : Path.EMPTY;
fSourceAttachmentPrefixMapping = sourceAttachmentPrefixMapping != null ? sourceAttachmentPrefixMapping : Path.EMPTY;
}
public CLibraryFileEntry(IPath location,
int flags,
public CLibraryFileEntry(IPath location, int flags,
IPath sourceAttachmentPath,
IPath sourceAttachmentRootPath,
IPath sourceAttachmentPrefixMapping) {
super(location, flags);
setSourceAttachmentSettings(sourceAttachmentPath, sourceAttachmentRootPath, sourceAttachmentPrefixMapping);
fSourceAttachmentPath = sourceAttachmentPath;
fSourceAttachmentRootPath = sourceAttachmentRootPath != null ? sourceAttachmentRootPath : Path.EMPTY;
fSourceAttachmentPrefixMapping = sourceAttachmentPrefixMapping != null ? sourceAttachmentPrefixMapping : Path.EMPTY;
}
public CLibraryFileEntry(IFile rc,
int flags,
public CLibraryFileEntry(IFile rc, int flags,
IPath sourceAttachmentPath,
IPath sourceAttachmentRootPath,
IPath sourceAttachmentPrefixMapping) {
super(rc, flags);
setSourceAttachmentSettings(sourceAttachmentPath, sourceAttachmentRootPath, sourceAttachmentPrefixMapping);
}
private void setSourceAttachmentSettings(IPath sourceAttachmentPath,
IPath sourceAttachmentRootPath,
IPath sourceAttachmentPrefixMapping){
if(sourceAttachmentPath == null)
return;
fSourceAttachmentPath = sourceAttachmentPath;
fSourceAttachmentRootPath = sourceAttachmentRootPath != null ? sourceAttachmentRootPath : Path.EMPTY;
@ -132,10 +127,8 @@ public final class CLibraryFileEntry extends ACPathEntry implements ICLibraryFil
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((fSourceAttachmentPath == null) ? 0 : fSourceAttachmentPath.hashCode());
result = prime * result
+ ((fSourceAttachmentPrefixMapping == null) ? 0 : fSourceAttachmentPrefixMapping.hashCode());
result = prime * result
+ ((fSourceAttachmentRootPath == null) ? 0 : fSourceAttachmentRootPath.hashCode());
result = prime * result + ((fSourceAttachmentPrefixMapping == null) ? 0 : fSourceAttachmentPrefixMapping.hashCode());
result = prime * result + ((fSourceAttachmentRootPath == null) ? 0 : fSourceAttachmentRootPath.hashCode());
return result;
}

View file

@ -17,7 +17,7 @@ import org.eclipse.cdt.internal.core.SafeStringInterner;
* As an example, those are supplied by a gcc compiler with option "-D".
*/
public final class CMacroEntry extends ACSettingEntry implements ICMacroEntry {
private String fValue;
private final String fValue;
/**
* This constructor is discouraged to be referenced by clients.
@ -30,9 +30,8 @@ public final class CMacroEntry extends ACSettingEntry implements ICMacroEntry {
*/
public CMacroEntry(String name, String value, int flags) {
super(name, flags);
fValue = SafeStringInterner.safeIntern(value);
if(fValue == null)
fValue = ""; //$NON-NLS-1$
String val = SafeStringInterner.safeIntern(value);
fValue = val != null ? val : ""; //$NON-NLS-1$
}
@Override
@ -80,7 +79,7 @@ public final class CMacroEntry extends ACSettingEntry implements ICMacroEntry {
@Override
protected String contentsToString() {
return new StringBuffer().append(fName).append('=').append(fValue).toString();
return new StringBuffer().append(getName()).append('=').append(fValue).toString();
}
}

View file

@ -11,10 +11,16 @@
package org.eclipse.cdt.core.settings.model;
import org.eclipse.cdt.core.model.IIncludeEntry;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
/**
* An interface representing setting entries.
*
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
*
* Any class implementing this interface should be immutable so the setting
* entries could be safely pooled by {@link CDataUtil#getPooledEntry(ICSettingEntry)}.
*/
public interface ICSettingEntry {
/**

View file

@ -1,12 +1,12 @@
/*******************************************************************************
* Copyright (c) 2007, 2009 Intel Corporation and others.
* Copyright (c) 2007, 2012 Intel 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
*
* Contributors:
* Intel Corporation - Initial API and implementation
* Intel Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.settings.model.extension.impl;
@ -17,11 +17,14 @@ import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
import org.eclipse.cdt.core.settings.model.util.EntryStore;
import org.eclipse.cdt.core.settings.model.util.KindBasedStore;
import org.eclipse.cdt.internal.core.settings.model.CLanguageSettingCache;
public class CDefaultLanguageData extends CLanguageData {
@Deprecated /** not used anymore */
protected final static int OP_COPY = 1;
@Deprecated /** not used anymore */
protected final static int OP_SET = 2;
protected String fName;
protected String fId;
protected String fLanguageId;
@ -45,32 +48,32 @@ public class CDefaultLanguageData extends CLanguageData {
// factory = new CDataFacroty();
// fFactory = factory;
// }
protected CDefaultLanguageData(){
fStore = createStore();
}
public CDefaultLanguageData(String id,
String languageId,
String ids[],
String languageId,
String ids[],
boolean isContentTypes) {
fId = id;
fLanguageId = languageId;
if(isContentTypes)
fSourceContentTypeIds = ids.clone();
else
fSourceExts = ids.clone();
fStore = createStore();
}
public CDefaultLanguageData(String id, CLanguageData base) {
fId = id;
copySettingsFrom(base);
}
protected void copySettingsFrom(CLanguageData data){
fName = data.getName();
fLanguageId = data.getLanguageId();
@ -81,27 +84,30 @@ public class CDefaultLanguageData extends CLanguageData {
// fHeaderExts = data.getHeaderExtensions();
fStore = createStore(data);
}
protected EntryStore createStore(CLanguageData data){
EntryStore store = createStore();
EntryStore store = createStore();
int kinds[] = KindBasedStore.getLanguageEntryKinds();
for (int kind : kinds) {
ICLanguageSettingEntry entries[] = getEntriesToCopy(kind, data);
entries = processStoredEntries(entries, OP_COPY);
store.storeEntries(kind, entries);
}
return store;
}
protected ICLanguageSettingEntry[] getEntriesToCopy(int kind, CLanguageData lData){
return lData.getEntries(kind);
}
/**
* This method is overridden in {@link CLanguageSettingCache} to ensure the entries are cached with {@link CDataUtil} pool.
*/
protected ICLanguageSettingEntry[] processStoredEntries(ICLanguageSettingEntry[] entries, int op){
return entries;
}
protected EntryStore createStore(){
return new EntryStore(true);
}
@ -130,9 +136,9 @@ public class CDefaultLanguageData extends CLanguageData {
public void setLanguageId(String id) {
if(CDataUtil.objectsEqual(id, fLanguageId))
return;
fLanguageId = id;
setModified(true);
}
@ -147,7 +153,7 @@ public class CDefaultLanguageData extends CLanguageData {
public ICLanguageSettingEntry[] getSettingEntries(int kind) {
return fStore.getEntries(kind);
List list = new ArrayList();
if((kinds & ICLanguageSettingEntry.INCLUDE_PATH) != 0) {
addLanguageEntries(ICLanguageSettingEntry.INCLUDE_PATH, list);
} else if((kinds & ICLanguageSettingEntry.INCLUDE_FILE) != 0) {
@ -165,7 +171,7 @@ public class CDefaultLanguageData extends CLanguageData {
return (ICLanguageSettingEntry[])list.toArray(new ICLanguageSettingEntry[list.size()]);
}
private List addLanguageEntries(int kind, List list){
ICLanguageSettingEntry entries[] = fStore.getEntries(kind);
for(int i = 0; i < entries.length; i++){
@ -198,7 +204,7 @@ public class CDefaultLanguageData extends CLanguageData {
public void setEntries(int kind, ICLanguageSettingEntry entries[]) {
entries = processStoredEntries(entries, OP_SET);
fStore.storeEntries(kind, entries);
setModified(true);
}
@ -211,10 +217,10 @@ public class CDefaultLanguageData extends CLanguageData {
public void setSourceContentTypeIds(String[] ids) {
if(Arrays.equals(ids, fSourceContentTypeIds))
return;
fSourceContentTypeIds = ids != null ?
(String[])ids.clone() : null;
setModified(true);
}
@ -222,17 +228,17 @@ public class CDefaultLanguageData extends CLanguageData {
public void setSourceExtensions(String[] exts) {
if(Arrays.equals(exts, fSourceExts))
return;
fSourceExts = exts != null ?
(String[])exts.clone() : null;
setModified(true);
}
public boolean isModified(){
return fIsModified;
}
public void setModified(boolean modified){
fIsModified = modified;
}

View file

@ -277,8 +277,9 @@ public class CDataUtil {
*
* @since 5.4
*/
public static ICSettingEntry getPooledEntry(ICSettingEntry entry) {
return settingEntriesPool.add(entry);
@SuppressWarnings("unchecked")
public static <T extends ICSettingEntry> T getPooledEntry(T entry) {
return (T) settingEntriesPool.add(entry);
}
/**
@ -329,7 +330,7 @@ public class CDataUtil {
);
break;
}
return (ICLanguageSettingEntry) getPooledEntry(entry);
return getPooledEntry(entry);
}
/**
@ -386,7 +387,7 @@ public class CDataUtil {
* @since 5.4
*/
public static CIncludePathEntry createCIncludePathEntry(String name, int flags) {
return (CIncludePathEntry) getPooledEntry(new CIncludePathEntry(name, flags));
return getPooledEntry(new CIncludePathEntry(name, flags));
}
/**
@ -396,7 +397,7 @@ public class CDataUtil {
* @since 5.4
*/
public static CIncludeFileEntry createCIncludeFileEntry(String name, int flags) {
return (CIncludeFileEntry) getPooledEntry(new CIncludeFileEntry(name, flags));
return getPooledEntry(new CIncludeFileEntry(name, flags));
}
/**
@ -406,7 +407,7 @@ public class CDataUtil {
* @since 5.4
*/
public static CMacroEntry createCMacroEntry(String name, String value, int flags) {
return (CMacroEntry) getPooledEntry(new CMacroEntry(name, value, flags));
return getPooledEntry(new CMacroEntry(name, value, flags));
}
/**
@ -416,7 +417,7 @@ public class CDataUtil {
* @since 5.4
*/
public static CMacroFileEntry createCMacroFileEntry(String name, int flags) {
return (CMacroFileEntry) getPooledEntry(new CMacroFileEntry(name, flags));
return getPooledEntry(new CMacroFileEntry(name, flags));
}
/**
@ -426,7 +427,7 @@ public class CDataUtil {
* @since 5.4
*/
public static CLibraryPathEntry createCLibraryPathEntry(String name, int flags) {
return (CLibraryPathEntry) getPooledEntry(new CLibraryPathEntry(name, flags));
return getPooledEntry(new CLibraryPathEntry(name, flags));
}
/**
@ -436,7 +437,7 @@ public class CDataUtil {
* @since 5.4
*/
public static CLibraryFileEntry createCLibraryFileEntry(String name, int flags) {
return (CLibraryFileEntry) getPooledEntry(new CLibraryFileEntry(name, flags));
return getPooledEntry(new CLibraryFileEntry(name, flags));
}
public static String[] getSourceExtensions(IProject project, CLanguageData data) {

View file

@ -12,117 +12,27 @@
*******************************************************************************/
package org.eclipse.cdt.core.settings.model.util;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import org.eclipse.cdt.core.settings.model.ICExclusionPatternPathEntry;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.core.runtime.IPath;
/**
* Cache of setting entries stored with multidimentional maps.
* See bug 284699 comment 7 for a possible insight into it.
* Used to be factory/cache of setting entries. Superseded by {@link CDataUtil} pool of entries.
* Not used in CDT anymore.
*
* @deprecated Since CDT 9.0. Use corresponding {@link CDataUtil} methods instead.
*/
@Deprecated
public class CSettingEntryFactory {
private static final HashSet<IPath> EMPTY_SET = new HashSet<IPath>(0);
private KindBasedStore<HashMap<String, ?>> fStore = new KindBasedStore<HashMap<String, ?>>(false);
private <K, V> HashMap<String, HashMap<K, V>> getNameMap(int kind, boolean create){
@SuppressWarnings("unchecked")
HashMap<String/*name*/, HashMap<K, V>> map = (HashMap<String, HashMap<K, V>>) fStore.get(kind);
if(map == null && create){
map = new HashMap<String, HashMap<K, V>>();
fStore.put(kind, map);
}
return map;
public ICSettingEntry getEntry(ICSettingEntry entry) {
return CDataUtil.getPooledEntry(entry);
}
private HashMap<String, HashMap<Integer, ICSettingEntry>> getValueMap(String name, boolean create){
HashMap<String/*name*/, HashMap<String/*value*/, HashMap<Integer/*flags*/, ICSettingEntry>>> nameMap = getNameMap(ICSettingEntry.MACRO, create);
if(nameMap != null){
return getMap(nameMap, name, create);
}
return null;
public ICLanguageSettingEntry getLanguageSettingEntry(ICLanguageSettingEntry entry) {
return CDataUtil.getPooledEntry(entry);
}
private HashMap<Integer, ICSettingEntry> getFlagMap(int kind, String name, String value, IPath[] exclusionPatterns, boolean create){
switch(kind){
case ICSettingEntry.MACRO:
HashMap<String, HashMap<Integer, ICSettingEntry>> valueMap = getValueMap(name, create);
if(valueMap != null){
return getMap(valueMap, value, create);
}
return null;
case ICSettingEntry.SOURCE_PATH:
case ICSettingEntry.OUTPUT_PATH:
HashMap<HashSet<IPath>, HashMap<Integer, ICSettingEntry>> excPatternMap = getExclusionPatternsMap(kind, name, create);
if(excPatternMap != null){
HashSet<IPath> setKey = exclusionPatterns == null || exclusionPatterns.length == 0 ? EMPTY_SET : new HashSet<IPath>(Arrays.asList(exclusionPatterns));
return getMap(excPatternMap, setKey, create);
}
return null;
default:
HashMap<String, HashMap<Integer, ICSettingEntry>> nameMap = getNameMap(kind, create);
if(nameMap != null){
return getMap(nameMap, name, create);
}
return null;
}
public ICSettingEntry getEntry(int kind, String name, String value, IPath[] exclusionPatterns, int flags, boolean create) {
return CDataUtil.createEntry(kind, name, value, exclusionPatterns, flags);
}
private HashMap<HashSet<IPath>, HashMap<Integer, ICSettingEntry>> getExclusionPatternsMap(int kind, String name, boolean create){
HashMap<String/*name*/, HashMap<HashSet<IPath>/*exclusionPatterns*/, HashMap<Integer/*flags*/, ICSettingEntry>>> nameMap = getNameMap(kind, create);
if(nameMap != null){
return getMap(nameMap, name, create);
}
return null;
}
private static <Key, K, V> HashMap<K, V> getMap(HashMap<Key, HashMap<K, V>> container, Key key, boolean create){
HashMap<K, V> map = container.get(key);
if(map == null && create){
map = new HashMap<K, V>();
container.put(key, map);
}
return map;
}
public ICSettingEntry getEntry(ICSettingEntry entry){
switch(entry.getKind()){
case ICSettingEntry.OUTPUT_PATH:
case ICSettingEntry.SOURCE_PATH:
return getEntry(entry.getKind(), entry.getName(), null, ((ICExclusionPatternPathEntry)entry).getExclusionPatterns(), entry.getFlags(), entry, true);
default:
return getLanguageSettingEntry((ICLanguageSettingEntry)entry);
}
}
public ICLanguageSettingEntry getLanguageSettingEntry(ICLanguageSettingEntry lEntry){
return (ICLanguageSettingEntry)getEntry(lEntry.getKind(), lEntry.getName(), lEntry.getValue(), null, lEntry.getFlags(), lEntry, true);
}
public ICSettingEntry getEntry(int kind, String name, String value, IPath[] exclusionPatterns, int flags, boolean create){
return getEntry(kind, name, value, exclusionPatterns, flags, null, create);
}
private ICSettingEntry getEntry(int kind, String name, String value, IPath[] exclusionPatterns, int flags, ICSettingEntry baseEntry, boolean create){
HashMap<Integer, ICSettingEntry> flagMap = getFlagMap(kind, name, value, exclusionPatterns, create);
if(flagMap != null){
Integer iFlags = new Integer(flags);
ICSettingEntry entry = flagMap.get(iFlags);
if(entry == null && create){
entry = baseEntry != null ? baseEntry : CDataUtil.createEntry(kind, name, value, exclusionPatterns, flags);
flagMap.put(iFlags, entry);
}
return entry;
}
return null;
}
public void clear(){
fStore.clear();
public void clear() {
}
}

View file

@ -47,7 +47,6 @@ import org.eclipse.cdt.core.settings.model.extension.CResourceData;
import org.eclipse.cdt.core.settings.model.extension.CTargetPlatformData;
import org.eclipse.cdt.core.settings.model.extension.impl.CDefaultConfigurationData;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
import org.eclipse.cdt.core.settings.model.util.CSettingEntryFactory;
import org.eclipse.cdt.core.settings.model.util.PathSettingsContainer;
import org.eclipse.cdt.internal.core.cdtvariables.CdtVariableManager;
import org.eclipse.cdt.internal.core.cdtvariables.StorableCdtVariables;
@ -104,7 +103,6 @@ public class CConfigurationDescriptionCache extends CDefaultConfigurationData
private boolean fDataLoadded;
private boolean fInitializing;
private ICConfigurationDescription fBaseDescription;
private CSettingEntryFactory fSettingsFactory;
private ICSourceEntry[] fResolvedSourceEntries;
CConfigurationDescriptionCache(ICStorageElement storage, CProjectDescription parent) throws CoreException{
@ -123,7 +121,7 @@ public class CConfigurationDescriptionCache extends CDefaultConfigurationData
return fInitializing;
}
void loadData(CSettingEntryFactory factory) throws CoreException{
void loadData() throws CoreException{
if(fDataLoadded)
return;
@ -131,12 +129,8 @@ public class CConfigurationDescriptionCache extends CDefaultConfigurationData
fData = CProjectDescriptionManager.getInstance().loadData(this, null);
fSettingsFactory = factory;
copySettingsFrom(fData, true);
fSettingsFactory = null;
fSpecSettings.reconcileExtensionSettings(true);
((CBuildSettingCache)fBuildData).initEnvironmentCache();
ICdtVariable vars[] = CdtVariableManager.getDefault().getVariables(this);
@ -167,7 +161,7 @@ public class CConfigurationDescriptionCache extends CDefaultConfigurationData
return fBaseCache;
}
boolean applyData(CSettingEntryFactory factory, SettingsContext context) throws CoreException{
boolean applyData(SettingsContext context) throws CoreException{
boolean modified = true;
if(fBaseDescription != null){
@ -175,7 +169,6 @@ public class CConfigurationDescriptionCache extends CDefaultConfigurationData
fDataLoadded = true;
fName = fData.getName();
fId = fData.getId();
fSettingsFactory = factory;
if((context.getAllConfigurationSettingsFlags() & IModificationContext.CFG_DATA_SETTINGS_UNMODIFIED) == 0 || fBaseCache == null){
copySettingsFrom(fData, true);
@ -186,8 +179,6 @@ public class CConfigurationDescriptionCache extends CDefaultConfigurationData
modified = (context.getAllConfigurationSettingsFlags() & IModificationContext.CFG_DATA_STORAGE_UNMODIFIED) == 0;
}
fSettingsFactory = null;
ICdtVariable vars[] = CdtVariableManager.getDefault().getVariables(this);
fMacros = new StorableCdtVariables(vars, true);
fSpecSettings.serialize();
@ -201,10 +192,6 @@ public class CConfigurationDescriptionCache extends CDefaultConfigurationData
return modified;
}
CSettingEntryFactory getSettingsFactory(){
return fSettingsFactory;
}
public StorableCdtVariables getCachedVariables(){
return fMacros;
}

View file

@ -20,7 +20,6 @@ import org.eclipse.cdt.core.settings.model.ICSettingContainer;
import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
import org.eclipse.cdt.core.settings.model.extension.impl.CDefaultLanguageData;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
import org.eclipse.cdt.core.settings.model.util.CSettingEntryFactory;
import org.eclipse.cdt.core.settings.model.util.EntryStore;
import org.eclipse.core.resources.IProject;
@ -177,16 +176,9 @@ public class CLanguageSettingCache extends CDefaultLanguageData implements
}
@Override
protected ICLanguageSettingEntry[] processStoredEntries(
ICLanguageSettingEntry[] entries, int op) {
if(entries.length != 0){
CConfigurationDescriptionCache cfgCache = (CConfigurationDescriptionCache)getConfiguration();
CSettingEntryFactory factory = cfgCache.getSettingsFactory();
if(factory != null){
for(int i = 0; i < entries.length; i++){
entries[i] = factory.getLanguageSettingEntry(entries[i]);
}
}
protected ICLanguageSettingEntry[] processStoredEntries(ICLanguageSettingEntry[] entries, int op) {
for(int i = 0; i < entries.length; i++) {
entries[i] = CDataUtil.getPooledEntry(entries[i]);
}
return entries;
}

View file

@ -26,7 +26,6 @@ import org.eclipse.cdt.core.settings.model.ICSettingsStorage;
import org.eclipse.cdt.core.settings.model.ICStorageElement;
import org.eclipse.cdt.core.settings.model.WriteAccessException;
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
import org.eclipse.cdt.core.settings.model.util.CSettingEntryFactory;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.QualifiedName;
@ -189,12 +188,10 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
if(!fIsReadOnly || !fIsLoading)
return;
CSettingEntryFactory factory = new CSettingEntryFactory();
for(Iterator<ICConfigurationDescription> iter = fCfgMap.values().iterator(); iter.hasNext();){
CConfigurationDescriptionCache cache = (CConfigurationDescriptionCache)iter.next();
try {
cache.loadData(factory);
factory.clear();
cache.loadData();
} catch (CoreException e) {
CCorePlugin.log(e);
iter.remove();
@ -210,14 +207,12 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
if(!fIsReadOnly || !fIsApplying)
return false;
CSettingEntryFactory factory = new CSettingEntryFactory();
boolean modified = false;
for (Iterator<ICConfigurationDescription> iter = fCfgMap.values().iterator(); iter.hasNext();) {
CConfigurationDescriptionCache cache = (CConfigurationDescriptionCache)iter.next();
try {
if(cache.applyData(factory, context))
if(cache.applyData(context))
modified = true;
factory.clear();
} catch (CoreException e) {
CCorePlugin.log(e);
e.printStackTrace();

View file

@ -86,7 +86,6 @@ import org.eclipse.cdt.core.settings.model.extension.CResourceData;
import org.eclipse.cdt.core.settings.model.extension.ICProjectConverter;
import org.eclipse.cdt.core.settings.model.extension.impl.CDataFactory;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
import org.eclipse.cdt.core.settings.model.util.CSettingEntryFactory;
import org.eclipse.cdt.core.settings.model.util.KindBasedStore;
import org.eclipse.cdt.core.settings.model.util.ListComparator;
import org.eclipse.cdt.core.settings.model.util.PathSettingsContainer;
@ -2325,11 +2324,9 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
ICStorageElement baseRootEl = settings.getRootStorageElement();
rootEl = rootParent.importChild(baseRootEl);
CConfigurationDescriptionCache cache = new CConfigurationDescriptionCache(des, baseData, baseCache, cfgDes.getSpecSettings(), null, rootEl);
CSettingEntryFactory factory = new CSettingEntryFactory();
SettingsContext context = new SettingsContext(null);
cache.applyData(factory, context);
cache.applyData(context);
cache.doneInitialization();
factory.clear();
runContextOperations(context, null);
return cache;
}
@ -2404,10 +2401,8 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
}
CConfigurationDescriptionCache cache = new CConfigurationDescriptionCache(cfgEl, null);
CSettingEntryFactory factory = new CSettingEntryFactory();
cache.loadData(factory);
cache.loadData();
cache.doneInitialization();
factory.clear();
return cache;
}