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:
parent
6680b5a020
commit
d20555df6c
13 changed files with 113 additions and 222 deletions
|
@ -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
|
||||
|
|
|
@ -114,6 +114,6 @@ public abstract class ACPathEntry extends ACSettingEntry implements ICPathEntry
|
|||
|
||||
@Override
|
||||
protected String contentsToString() {
|
||||
return fName;
|
||||
return getName();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
/**
|
||||
|
|
|
@ -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,9 +17,12 @@ 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;
|
||||
|
@ -98,6 +101,9 @@ public class CDefaultLanguageData extends CLanguageData {
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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() {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue