1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-05 08:46:02 +02:00

bug 290631: Caching of ICSettingEntry objects in CDataUtil.

This commit is contained in:
Andrew Gvozdev 2012-01-27 14:30:06 -05:00
parent 453f71f4c4
commit 4fc55d2d21
21 changed files with 861 additions and 694 deletions

View file

@ -14,7 +14,6 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.cdt.core.settings.model.CMacroEntry;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICMacroEntry;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
@ -81,7 +80,7 @@ public class PathInfoToLangSettingsConverter {
for (Entry<String, String> entry : entrySet) {
String name = entry.getKey();
String value = entry.getValue();
entries[num++] = new CMacroEntry(name, value, flags);
entries[num++] = CDataUtil.createCMacroEntry(name, value, flags);
}
return entries;
}

View file

@ -27,7 +27,6 @@ import java.util.Vector;
import org.eclipse.cdt.build.core.scannerconfig.ICfgScannerConfigBuilderInfo2Set;
import org.eclipse.cdt.build.internal.core.scannerconfig.CfgDiscoveredPathManager.PathInfoCache;
import org.eclipse.cdt.core.ErrorParserManager;
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
import org.eclipse.cdt.core.settings.model.CLibraryFileEntry;
import org.eclipse.cdt.core.settings.model.CLibraryPathEntry;
import org.eclipse.cdt.core.settings.model.CSourceEntry;
@ -2797,7 +2796,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
List<ICSettingEntry> list = new ArrayList<ICSettingEntry>(entries.length + 1);
// Add project level include path
list.add(new CIncludePathEntry(path.toString(), ICLanguageSettingEntry.VALUE_WORKSPACE_PATH));
list.add(CDataUtil.createCIncludePathEntry(path.toString(), ICLanguageSettingEntry.VALUE_WORKSPACE_PATH));
// Add Build output path as an exported library path
entries = CDataUtil.resolveEntries(entries, des);

View file

@ -33,11 +33,9 @@ import java.util.regex.PatternSyntaxException;
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.resources.ACBuilder;
import org.eclipse.cdt.core.settings.model.CIncludeFileEntry;
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
import org.eclipse.cdt.core.settings.model.CMacroEntry;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
import org.eclipse.cdt.internal.core.envvar.EnvironmentVariableManager;
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
@ -611,11 +609,11 @@ public class HeadlessBuilder implements IApplication {
macroVal = macro.substring(macro.indexOf('=') + 1);
macro = macro.substring(0, macro.indexOf('='));
}
HeadlessBuilderExternalSettingsProvider.additionalSettings.add(new CMacroEntry(macro, macroVal, 0));
HeadlessBuilderExternalSettingsProvider.additionalSettings.add(CDataUtil.createCMacroEntry(macro, macroVal, 0));
} else if ("-I".equals(args[i])) { //$NON-NLS-1$
HeadlessBuilderExternalSettingsProvider.additionalSettings.add(new CIncludePathEntry(args[++i], 0));
HeadlessBuilderExternalSettingsProvider.additionalSettings.add(CDataUtil.createCIncludePathEntry(args[++i], 0));
} else if ("-include".equals(args[i])) { //$NON-NLS-1$
HeadlessBuilderExternalSettingsProvider.additionalSettings.add(new CIncludeFileEntry(args[++i], 0));
HeadlessBuilderExternalSettingsProvider.additionalSettings.add(CDataUtil.createCIncludeFileEntry(args[++i], 0));
} else if ("-E".equals(args[i])) { //$NON-NLS-1$
addEnvironmentVariable(args[++i], IEnvironmentVariable.ENVVAR_REPLACE);
} else if ("-Ea".equals(args[i])) { //$NON-NLS-1$

View file

@ -19,7 +19,6 @@ import java.util.List;
import java.util.Set;
import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
import org.eclipse.cdt.core.settings.model.CMacroEntry;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingPathEntry;
import org.eclipse.cdt.core.settings.model.ICLibraryFileEntry;
@ -397,7 +396,7 @@ public class BuildEntryStorage extends AbstractEntryStorage {
if (kind == ICSettingEntry.MACRO) {
String nv[] = macroNameValueFromValue(optionValue.getValue());
return new CMacroEntry(nv[0], nv[1], flags);
return CDataUtil.createCMacroEntry(nv[0], nv[1], flags);
}
IPath srcPath = null, srcRootPath = null, srcPrefixMapping = null;

View file

@ -20,6 +20,13 @@ public abstract class ACPathEntry extends ACSettingEntry implements ICPathEntry
// IPath fLocation;
// private IPath fPath;
/**
* Constructor.
*
* @param rc - a resource in the workspace.
* @param flags - bitwise combination of {@link ICSettingEntry} flags.
* If {@link #VALUE_WORKSPACE_PATH} is missing it will be supplied.
*/
ACPathEntry(IResource rc, int flags) {
super(rc.getFullPath().toString(), flags | RESOLVED | VALUE_WORKSPACE_PATH);
// fFullPath = rc.getFullPath();
@ -33,10 +40,25 @@ public abstract class ACPathEntry extends ACSettingEntry implements ICPathEntry
fFullPath = fullPath;
}
*/
ACPathEntry(String value, int flags) {
super(value, flags);
/**
* Constructor.
*
* @param name - resource path. The path can be an absolute location on the local file-system
* or with flag {@link #VALUE_WORKSPACE_PATH} it is treated as workspace full path.
* @param flags - bitwise combination of {@link ICSettingEntry} flags.
*/
ACPathEntry(String name, int flags) {
super(name, flags);
}
/**
* Constructor.
*
* @param path - resource path. The path can be an absolute location on the local
* file-system or with flag {@link #VALUE_WORKSPACE_PATH} it is treated as workspace full path.
* @param flags - bitwise combination of {@link ICSettingEntry} flags.
*/
ACPathEntry(IPath path, int flags) {
super(path.toString(), flags /*| RESOLVED*/);
// fPath = path;

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,17 +13,47 @@ package org.eclipse.cdt.core.settings.model;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
public final class CIncludeFileEntry extends ACPathEntry implements
ICIncludeFileEntry {
public CIncludeFileEntry(String value, int flags) {
super(value, flags);
/**
* Representation in the project model of include file settings entries.
* As an example, those are supplied by a gcc compiler with option "-include".
*/
public final class CIncludeFileEntry extends ACPathEntry implements ICIncludeFileEntry {
/**
* This constructor is discouraged to be referenced by clients.
*
* Instead, use pooled entries with CDataUtil.createCIncludeFileEntry(name, flags).
*
* @param name - include file path. The path can be an absolute location on the local file-system
* or with flag {@link #VALUE_WORKSPACE_PATH} it is treated as workspace full path.
* @param flags - bitwise combination of {@link ICSettingEntry} flags.
*/
public CIncludeFileEntry(String name, int flags) {
super(name, flags);
}
/**
* This constructor is discouraged to be used directly.
*
* Instead, use pooled entries with CDataUtil.createCIncludeFileEntry(location.toString(), flags)
* or wrap it with CDataUtil.getPooledEntry(new CIncludeFileEntry(location, flags)).
*
* @param location - include file path. The path can be an absolute location on the local
* file-system or with flag {@link #VALUE_WORKSPACE_PATH} it is treated as workspace full path.
* @param flags - bitwise combination of {@link ICSettingEntry} flags.
*/
public CIncludeFileEntry(IPath location, int flags) {
super(location, flags);
}
/**
* This constructor is discouraged to be used directly.
*
* Instead, use pooled entries wrapping with CDataUtil.getPooledEntry(new CIncludeFileEntry(rc, flags)).
*
* @param rc - include file as a resource in the workspace.
* @param flags - bitwise combination of {@link ICSettingEntry} flags.
* If {@link #VALUE_WORKSPACE_PATH} is missing it will be supplied.
*/
public CIncludeFileEntry(IFile rc, int flags) {
super(rc, flags);
}

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,16 +13,47 @@ package org.eclipse.cdt.core.settings.model;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.IPath;
public final class CIncludePathEntry extends ACPathEntry implements ICIncludePathEntry{
public CIncludePathEntry(String value, int flags) {
super(value, flags);
/**
* Representation in the project model of include path settings entries.
* As an example, those are supplied by a gcc compiler with option "-I".
*/
public final class CIncludePathEntry extends ACPathEntry implements ICIncludePathEntry {
/**
* This constructor is discouraged to be referenced by clients.
*
* Instead, use pooled entries with CDataUtil.createCIncludePathEntry(name, flags).
*
* @param name - include path. The path can be an absolute location on the local file-system
* or with flag {@link #VALUE_WORKSPACE_PATH} it is treated as workspace full path.
* @param flags - bitwise combination of {@link ICSettingEntry} flags.
*/
public CIncludePathEntry(String name, int flags) {
super(name, flags);
}
/**
* This constructor is discouraged to be used directly.
*
* Instead, use pooled entries with CDataUtil.createCIncludePathEntry(location.toString(), flags)
* or wrap it with CDataUtil.getPooledEntry(new CIncludePathEntry(location, flags)).
*
* @param location - include path. The path can be an absolute location on the local
* file-system or with flag {@link #VALUE_WORKSPACE_PATH} it is treated as workspace full path.
* @param flags - bitwise combination of {@link ICSettingEntry} flags.
*/
public CIncludePathEntry(IPath location, int flags) {
super(location, flags);
}
/**
* This constructor is discouraged to be used directly.
*
* Instead, use pooled entries wrapping with CDataUtil.getPooledEntry(new CIncludePathEntry(rc, flags)).
*
* @param rc - include path as a resource in the workspace.
* @param flags - bitwise combination of {@link ICSettingEntry} flags.
* If {@link #VALUE_WORKSPACE_PATH} is missing it will be supplied.
*/
public CIncludePathEntry(IFolder rc, int flags) {
super(rc, flags);
}

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
@ -12,11 +12,22 @@ package org.eclipse.cdt.core.settings.model;
import org.eclipse.cdt.internal.core.SafeStringInterner;
public final class CMacroEntry extends ACSettingEntry implements ICMacroEntry{
/**
* Representation in the project model of macro settings entries.
* As an example, those are supplied by a gcc compiler with option "-D".
*/
public final class CMacroEntry extends ACSettingEntry implements ICMacroEntry {
private String fValue;
/**
* This constructor is discouraged to be referenced by clients.
*
* Instead, use pooled entries with CDataUtil.createCMacroEntry(name, value, flags).
*
* @param name - name of the macro.
* @param value - value of the macro.
* @param flags - bitwise combination of {@link ICSettingEntry} flags.
*/
public CMacroEntry(String name, String value, int flags) {
super(name, flags);
fValue = SafeStringInterner.safeIntern(value);

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,17 +13,48 @@ package org.eclipse.cdt.core.settings.model;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
public final class CMacroFileEntry extends ACPathEntry implements
ICMacroFileEntry {
/**
* Representation in the project model of include file settings entries.
* As an example, those are supplied by a gcc compiler with option "-imacros".
*/
public final class CMacroFileEntry extends ACPathEntry implements ICMacroFileEntry {
public CMacroFileEntry(String value, int flags) {
super(value, flags);
/**
* This constructor is discouraged to be referenced by clients.
*
* Instead, use pooled entries with CDataUtil.createCMacroFileEntry(name, flags).
*
* @param name - macro file path. The path can be an absolute location on the local file-system
* or with flag {@link #VALUE_WORKSPACE_PATH} it is treated as workspace full path.
* @param flags - bitwise combination of {@link ICSettingEntry} flags.
*/
public CMacroFileEntry(String name, int flags) {
super(name, flags);
}
/**
* This constructor is discouraged to be used directly.
*
* Instead, use pooled entries with CDataUtil.createCMacroFileEntry(location.toString(), flags)
* or wrap it with CDataUtil.getPooledEntry(new CMacroFileEntry(location, flags)).
*
* @param location - macro file path. The path can be an absolute location on the local
* file-system or with flag {@link #VALUE_WORKSPACE_PATH} it is treated as workspace full path.
* @param flags - bitwise combination of {@link ICSettingEntry} flags.
*/
public CMacroFileEntry(IPath location, int flags) {
super(location, flags);
}
/**
* This constructor is discouraged to be used directly.
*
* Instead, use pooled entries wrapping with CDataUtil.getPooledEntry(new CMacroFileEntry(rc, flags)).
*
* @param rc - macro file as a resource in the workspace.
* @param flags - bitwise combination of {@link ICSettingEntry} flags.
* If {@link #VALUE_WORKSPACE_PATH} is missing it will be supplied.
*/
public CMacroFileEntry(IFile rc, int flags) {
super(rc, flags);
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2010 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
@ -57,6 +57,7 @@ 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.CDataFactory;
import org.eclipse.cdt.core.settings.model.extension.impl.CDefaultLanguageData;
import org.eclipse.cdt.internal.core.parser.util.WeakHashSet;
import org.eclipse.cdt.internal.core.settings.model.ExceptionFactory;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
@ -76,6 +77,18 @@ public class CDataUtil {
private static Random randomNumber;
public static final String[] EMPTY_STRING_ARRAY = new String[0];
/**
* Pool of setting entries implemented as WeakHashSet. That allows to gain memory savings
* at the expense of CPU time. WeakHashSet handles garbage collection when a list is not
* referenced anywhere else. See JavaDoc {@link java.lang.ref.WeakReference} about weak reference objects.
*/
private static WeakHashSet<ICSettingEntry> settingEntriesPool = new WeakHashSet<ICSettingEntry>() {
@Override
public synchronized ICSettingEntry add(ICSettingEntry entry) {
return super.add(entry);
}
};
public static int genRandomNumber(){
if (randomNumber == null) {
// Set the random number seed
@ -262,12 +275,39 @@ public class CDataUtil {
return path;
}
public static ICLanguageSettingEntry createEntry(ICLanguageSettingEntry entry, int flagsToAdd, int flafsToClear){
/**
* Return entry cached in setting entries pool to optimize for memory usage.
* Note that the pool will handle garbage collection for unreferenced entries.
*
* @since 5.4
*/
public static ICSettingEntry getPooledEntry(ICSettingEntry entry) {
return settingEntriesPool.add(entry);
}
/**
* Convenience method to clone {@link ICLanguageSettingEntry} with modified flags.
* Note that this method keeps the entries in the pool to avoid proliferation of duplicates.
*
* @param entry - source entry.
* @param flagsToAdd - binary combination of bits to add to the flags.
* @param flafsToClear - binary combination of bits to clear in the flags.
* @return new entry with the modified flags.
*/
public static ICLanguageSettingEntry createEntry(ICLanguageSettingEntry entry, int flagsToAdd, int flafsToClear) {
return createEntry(entry, (entry.getFlags() | flagsToAdd) & (~flafsToClear));
}
public static ICLanguageSettingEntry createEntry(ICLanguageSettingEntry entry, int flags){
switch (entry.getKind()){
/**
* Convenience method to clone {@link ICLanguageSettingEntry} with different flags.
* Note that this method keeps the entries in the pool to avoid proliferation of duplicates.
*
* @param entry - source entry.
* @param flags - new flags.
* @return new entry with the specified flags.
*/
public static ICLanguageSettingEntry createEntry(ICLanguageSettingEntry entry, int flags) {
switch (entry.getKind()) {
case ICSettingEntry.INCLUDE_PATH:
entry = new CIncludePathEntry(entry.getName(), flags);
break;
@ -293,35 +333,95 @@ public class CDataUtil {
);
break;
}
return entry;
return (ICLanguageSettingEntry) getPooledEntry(entry);
}
public static ICSettingEntry createEntry(int kind, String name, String value, IPath[] exclusionPatterns, int flags){
/**
* Convenience method to create {@link ICLanguageSettingEntry} depending on kind.
* Note that this method keeps the entries in the pool to avoid proliferation of duplicates.
*
* Note that the method always returns {@link ICLanguageSettingEntry}.
*/
public static ICSettingEntry createEntry(int kind, String name, String value, IPath[] exclusionPatterns, int flags) {
return createEntry(kind, name, value, exclusionPatterns, flags, null, null, null);
}
public static ICSettingEntry createEntry(int kind, String name, String value, IPath[] exclusionPatterns, int flags, IPath srcPath, IPath srcRootPath, IPath srcPrefixMapping){
/**
* Convenience method to create {@link ICSettingEntry} depending on kind.
* Note that this method keeps the entries in the pool to avoid proliferation of duplicates.
*/
public static ICSettingEntry createEntry(int kind, String name, String value, IPath[] exclusionPatterns, int flags, IPath sourceAttachmentPath, IPath sourceAttachmentRootPath, IPath sourceAttachmentPrefixMapping) {
ICSettingEntry entry = null;
switch (kind){
case ICSettingEntry.INCLUDE_PATH:
return new CIncludePathEntry(name, flags);
case ICSettingEntry.MACRO:
return new CMacroEntry(name, value, flags);
case ICSettingEntry.INCLUDE_FILE:
return new CIncludeFileEntry(name, flags);
case ICSettingEntry.MACRO_FILE:
return new CMacroFileEntry(name, flags);
case ICSettingEntry.LIBRARY_PATH:
return new CLibraryPathEntry(name, flags);
case ICSettingEntry.LIBRARY_FILE:
return new CLibraryFileEntry(name, flags, srcPath, srcRootPath, srcPrefixMapping);
case ICSettingEntry.OUTPUT_PATH:
return new COutputEntry(name, exclusionPatterns, flags);
case ICSettingEntry.SOURCE_PATH:
return new CSourceEntry(name, exclusionPatterns, flags);
}
case ICLanguageSettingEntry.INCLUDE_PATH:
entry = new CIncludePathEntry(name, flags);
break;
case ICLanguageSettingEntry.MACRO:
entry = new CMacroEntry(name, value, flags);
break;
case ICLanguageSettingEntry.INCLUDE_FILE:
entry = new CIncludeFileEntry(name, flags);
break;
case ICLanguageSettingEntry.MACRO_FILE:
entry = new CMacroFileEntry(name, flags);
break;
case ICLanguageSettingEntry.LIBRARY_PATH:
entry = new CLibraryPathEntry(name, flags);
break;
case ICLanguageSettingEntry.LIBRARY_FILE:
entry = new CLibraryFileEntry(name, flags, sourceAttachmentPath, sourceAttachmentRootPath, sourceAttachmentPrefixMapping);
break;
case ICLanguageSettingEntry.OUTPUT_PATH:
entry = new COutputEntry(name, exclusionPatterns, flags);
break;
case ICLanguageSettingEntry.SOURCE_PATH:
entry = new CSourceEntry(name, exclusionPatterns, flags);
break;
default:
throw new IllegalArgumentException();
}
return getPooledEntry(entry);
}
/**
* Utility method to create {@link CIncludePathEntry}.
* Note that this method keeps the entries in the pool to avoid proliferation of duplicates.
*
* @since 5.4
*/
public static CIncludePathEntry createCIncludePathEntry(String name, int flags) {
return (CIncludePathEntry) getPooledEntry(new CIncludePathEntry(name, flags));
}
/**
* Utility method to create {@link CIncludeFileEntry}.
* Note that this method keeps the entries in the pool to avoid proliferation of duplicates.
*
* @since 5.4
*/
public static CIncludeFileEntry createCIncludeFileEntry(String name, int flags) {
return (CIncludeFileEntry) getPooledEntry(new CIncludeFileEntry(name, flags));
}
/**
* Utility method to create {@link CMacroEntry}.
* Note that this method keeps the entries in the pool to avoid proliferation of duplicates.
*
* @since 5.4
*/
public static CMacroEntry createCMacroEntry(String name, String value, int flags) {
return (CMacroEntry) getPooledEntry(new CMacroEntry(name, value, flags));
}
/**
* Utility method to create {@link CMacroFileEntry}.
* Note that this method keeps the entries in the pool to avoid proliferation of duplicates.
*
* @since 5.4
*/
public static CMacroFileEntry createCMacroFileEntry(String name, int flags) {
return (CMacroFileEntry) getPooledEntry(new CMacroFileEntry(name, flags));
}
public static String[] getSourceExtensions(IProject project, CLanguageData data) {
String[] exts = null;

View file

@ -14,14 +14,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import org.eclipse.cdt.core.settings.model.CIncludeFileEntry;
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
import org.eclipse.cdt.core.settings.model.CLibraryFileEntry;
import org.eclipse.cdt.core.settings.model.CLibraryPathEntry;
import org.eclipse.cdt.core.settings.model.CMacroEntry;
import org.eclipse.cdt.core.settings.model.CMacroFileEntry;
import org.eclipse.cdt.core.settings.model.COutputEntry;
import org.eclipse.cdt.core.settings.model.CSourceEntry;
import org.eclipse.cdt.core.settings.model.ICExclusionPatternPathEntry;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICLibraryFileEntry;
@ -41,9 +33,8 @@ public class LanguageSettingEntriesSerializer {
public static final String ATTRIBUTE_SOURCE_ATTACHMENT_ROOT_PATH = "srcRootPath"; //$NON-NLS-1$
public static final String ATTRIBUTE_SOURCE_ATTACHMENT_PREFIX_MAPPING = "srcPrefixMapping"; //$NON-NLS-1$
// public static final String ATTRIBUTE_FULL_PATH = "fullPath"; //$NON-NLS-1$
// public static final String ATTRIBUTE_LOCATION = "location"; //$NON-NLS-1$
// public static final String ATTRIBUTE_FULL_PATH = "fullPath"; //$NON-NLS-1$
// public static final String ATTRIBUTE_LOCATION = "location"; //$NON-NLS-1$
public static final String INCLUDE_PATH = "includePath"; //$NON-NLS-1$
public static final String INCLUDE_FILE = "includeFile"; //$NON-NLS-1$
@ -64,31 +55,29 @@ public class LanguageSettingEntriesSerializer {
public static final String FLAGS_SEPARATOR = "|"; //$NON-NLS-1$
public static ICSettingEntry[] loadEntries(ICStorageElement el){
public static ICSettingEntry[] loadEntries(ICStorageElement el) {
return loadEntries(el, 0);
}
public static ICSettingEntry[] loadEntries(ICStorageElement el, int kindFilter){
public static ICSettingEntry[] loadEntries(ICStorageElement el, int kindFilter) {
List<ICSettingEntry> list = loadEntriesList(el, kindFilter);
return list.toArray(new ICSettingEntry[list.size()]);
}
public static List<ICSettingEntry> loadEntriesList(ICStorageElement el){
public static List<ICSettingEntry> loadEntriesList(ICStorageElement el) {
return loadEntriesList(el, 0);
}
public static List<ICSettingEntry> loadEntriesList(ICStorageElement el, int kindFilter){
public static List<ICSettingEntry> loadEntriesList(ICStorageElement el, int kindFilter) {
ICStorageElement children[] = el.getChildren();
ICStorageElement child;
List<ICSettingEntry> list = new ArrayList<ICSettingEntry>();
ICSettingEntry entry;
for(int i = 0; i < children.length; i++){
for (int i = 0; i < children.length; i++) {
child = children[i];
if(ELEMENT_ENTRY.equals(child.getName())){
if (ELEMENT_ENTRY.equals(child.getName())) {
entry = loadEntry(child);
if(entry != null
&& (kindFilter == 0
|| (kindFilter & entry.getKind()) != 0))
if (entry != null && (kindFilter == 0 || (kindFilter & entry.getKind()) != 0))
list.add(entry);
}
}
@ -102,51 +91,33 @@ public class LanguageSettingEntriesSerializer {
int flags = composeFlags(el.getAttribute(ATTRIBUTE_FLAGS));
String name = el.getAttribute(ATTRIBUTE_NAME);
switch(kind){
case ICSettingEntry.INCLUDE_PATH:
return new CIncludePathEntry(name, flags);
case ICSettingEntry.INCLUDE_FILE:
return new CIncludeFileEntry(name, flags);
case ICSettingEntry.MACRO:
String value = el.getAttribute(ATTRIBUTE_VALUE);
return new CMacroEntry(name, value, flags);
case ICSettingEntry.MACRO_FILE:
return new CMacroFileEntry(name, flags);
case ICSettingEntry.LIBRARY_PATH:
return new CLibraryPathEntry(name, flags);
case ICSettingEntry.LIBRARY_FILE:
IPath srcPath = loadPath(el, ATTRIBUTE_SOURCE_ATTACHMENT_PATH);
IPath srcRootPath = loadPath(el, ATTRIBUTE_SOURCE_ATTACHMENT_ROOT_PATH);
IPath[] exclusionPatterns = loadExclusions(el);
IPath srcPrefixMapping = loadPath(el, ATTRIBUTE_SOURCE_ATTACHMENT_PREFIX_MAPPING);
return new CLibraryFileEntry(name, flags, srcPath, srcRootPath, srcPrefixMapping);
case ICSettingEntry.OUTPUT_PATH:
return new COutputEntry(name, loadExclusions(el), flags);
case ICSettingEntry.SOURCE_PATH:
return new CSourceEntry(name, loadExclusions(el), flags);
}
return null;
return CDataUtil.createEntry(kind, name, value, exclusionPatterns, flags, srcPath, srcRootPath, srcPrefixMapping);
}
private static IPath loadPath(ICStorageElement el, String attr){
private static IPath loadPath(ICStorageElement el, String attr) {
String value = el.getAttribute(attr);
if(value != null)
if (value != null)
return new Path(value);
return null;
}
// private static void storePath(ICStorageElement el, String attr, IPath path){
// if(path != null)
// el.setAttribute(attr, path.toString());
// }
// private static void storePath(ICStorageElement el, String attr, IPath path){
// if(path != null)
// el.setAttribute(attr, path.toString());
// }
private static IPath[] loadExclusions(ICStorageElement el){
private static IPath[] loadExclusions(ICStorageElement el) {
String attr = el.getAttribute(ATTRIBUTE_EXCLUDING);
if(attr != null){
if (attr != null) {
String[] strs = CDataUtil.stringToArray(attr, FLAGS_SEPARATOR);
IPath[] paths = new IPath[strs.length];
for(int i = 0; i < strs.length; i++){
for (int i = 0; i < strs.length; i++) {
paths[i] = new Path(strs[i]);
}
return paths;
@ -154,12 +125,12 @@ public class LanguageSettingEntriesSerializer {
return null;
}
private static void storeExclusions(ICStorageElement el, IPath[] paths){
if(paths == null || paths.length == 0)
private static void storeExclusions(ICStorageElement el, IPath[] paths) {
if (paths == null || paths.length == 0)
return;
String[] strs = new String[paths.length];
for(int i = 0; i < strs.length; i++){
for (int i = 0; i < strs.length; i++) {
strs[i] = paths[i].toString();
}
@ -167,51 +138,51 @@ public class LanguageSettingEntriesSerializer {
el.setAttribute(ATTRIBUTE_EXCLUDING, attr);
}
public static void serializeEntries(ICSettingEntry entries[], ICStorageElement element){
public static void serializeEntries(ICSettingEntry entries[], ICStorageElement element) {
ICStorageElement child;
if(entries != null){
for(int i = 0; i < entries.length; i++){
if (entries != null) {
for (int i = 0; i < entries.length; i++) {
child = element.createChild(ELEMENT_ENTRY);
serializeEntry(entries[i], child);
}
}
}
public static void serializeEntry(ICSettingEntry entry, ICStorageElement element){
public static void serializeEntry(ICSettingEntry entry, ICStorageElement element) {
String kind = kindToString(entry.getKind());
String flags = composeFlagsString(entry.getFlags());
String name = entry.getName();
element.setAttribute(ATTRIBUTE_KIND, kind);
element.setAttribute(ATTRIBUTE_FLAGS, flags);
element.setAttribute(ATTRIBUTE_NAME, name);
switch(entry.getKind()){
switch (entry.getKind()) {
case ICSettingEntry.MACRO:
String value = entry.getValue();
element.setAttribute(ATTRIBUTE_VALUE, value);
break;
case ICSettingEntry.SOURCE_PATH:
case ICSettingEntry.OUTPUT_PATH:
IPath paths[] = ((ICExclusionPatternPathEntry)entry).getExclusionPatterns();
IPath paths[] = ((ICExclusionPatternPathEntry) entry).getExclusionPatterns();
storeExclusions(element, paths);
break;
case ICSettingEntry.LIBRARY_FILE:
ICLibraryFileEntry libFile = (ICLibraryFileEntry)entry;
ICLibraryFileEntry libFile = (ICLibraryFileEntry) entry;
IPath path = libFile.getSourceAttachmentPath();
if(path != null)
if (path != null)
element.setAttribute(ATTRIBUTE_SOURCE_ATTACHMENT_PATH, path.toString());
path = libFile.getSourceAttachmentRootPath();
if(path != null)
if (path != null)
element.setAttribute(ATTRIBUTE_SOURCE_ATTACHMENT_ROOT_PATH, path.toString());
path = libFile.getSourceAttachmentPrefixMapping();
if(path != null)
if (path != null)
element.setAttribute(ATTRIBUTE_SOURCE_ATTACHMENT_PREFIX_MAPPING, path.toString());
}
}
public static String kindToString(int kind){
switch(kind){
public static String kindToString(int kind) {
switch (kind) {
case ICSettingEntry.INCLUDE_PATH:
return INCLUDE_PATH;
case ICSettingEntry.INCLUDE_FILE:
@ -232,64 +203,64 @@ public class LanguageSettingEntriesSerializer {
throw new IllegalArgumentException();
}
public static int stringToKind(String kind){
if(INCLUDE_PATH.equals(kind))
public static int stringToKind(String kind) {
if (INCLUDE_PATH.equals(kind))
return ICSettingEntry.INCLUDE_PATH;
if(INCLUDE_FILE.equals(kind))
if (INCLUDE_FILE.equals(kind))
return ICSettingEntry.INCLUDE_FILE;
if(MACRO.equals(kind))
if (MACRO.equals(kind))
return ICSettingEntry.MACRO;
if(MACRO_FILE.equals(kind))
if (MACRO_FILE.equals(kind))
return ICSettingEntry.MACRO_FILE;
if(LIBRARY_PATH.equals(kind))
if (LIBRARY_PATH.equals(kind))
return ICSettingEntry.LIBRARY_PATH;
if(LIBRARY_FILE.equals(kind))
if (LIBRARY_FILE.equals(kind))
return ICSettingEntry.LIBRARY_FILE;
if(SOURCE_PATH.equals(kind))
if (SOURCE_PATH.equals(kind))
return ICSettingEntry.SOURCE_PATH;
if(OUTPUT_PATH.equals(kind))
if (OUTPUT_PATH.equals(kind))
return ICSettingEntry.OUTPUT_PATH;
return 0;
// throw new UnsupportedOperationException();
// throw new UnsupportedOperationException();
}
public static String composeFlagsString(int flags){
public static String composeFlagsString(int flags) {
StringBuffer buf = new StringBuffer();
if((flags & ICSettingEntry.BUILTIN) != 0){
if ((flags & ICSettingEntry.BUILTIN) != 0) {
buf.append(BUILTIN);
}
if((flags & ICSettingEntry.READONLY) != 0){
if(buf.length() != 0)
if ((flags & ICSettingEntry.READONLY) != 0) {
if (buf.length() != 0)
buf.append(FLAGS_SEPARATOR);
buf.append(READONLY);
}
if((flags & ICSettingEntry.LOCAL) != 0){
if(buf.length() != 0)
if ((flags & ICSettingEntry.LOCAL) != 0) {
if (buf.length() != 0)
buf.append(FLAGS_SEPARATOR);
buf.append(LOCAL);
}
if((flags & ICSettingEntry.VALUE_WORKSPACE_PATH) != 0){
if(buf.length() != 0)
if ((flags & ICSettingEntry.VALUE_WORKSPACE_PATH) != 0) {
if (buf.length() != 0)
buf.append(FLAGS_SEPARATOR);
buf.append(VALUE_WORKSPACE_PATH);
}
if((flags & ICSettingEntry.RESOLVED) != 0){
if(buf.length() != 0)
if ((flags & ICSettingEntry.RESOLVED) != 0) {
if (buf.length() != 0)
buf.append(FLAGS_SEPARATOR);
buf.append(RESOLVED);
}
if((flags & ICLanguageSettingEntry.UNDEFINED) != 0){
if(buf.length() != 0)
if ((flags & ICLanguageSettingEntry.UNDEFINED) != 0) {
if (buf.length() != 0)
buf.append(FLAGS_SEPARATOR);
buf.append(UNDEFINED);
}
if((flags & ICLanguageSettingEntry.FRAMEWORKS_MAC) != 0){
if(buf.length() != 0)
if ((flags & ICLanguageSettingEntry.FRAMEWORKS_MAC) != 0) {
if (buf.length() != 0)
buf.append(FLAGS_SEPARATOR);
buf.append(FRAMEWORK);
@ -300,28 +271,28 @@ public class LanguageSettingEntriesSerializer {
/**
* @since 5.4
*/
public static int composeFlags(String flagsString){
if(flagsString == null || flagsString.length() == 0)
public static int composeFlags(String flagsString) {
if (flagsString == null || flagsString.length() == 0)
return 0;
StringTokenizer tokenizer = new StringTokenizer(flagsString, FLAGS_SEPARATOR);
int flags = 0;
String f;
while(tokenizer.hasMoreElements()){
while (tokenizer.hasMoreElements()) {
f = tokenizer.nextToken();
if(BUILTIN.equals(f))
if (BUILTIN.equals(f))
flags |= ICSettingEntry.BUILTIN;
if(READONLY.equals(f))
if (READONLY.equals(f))
flags |= ICSettingEntry.READONLY;
if(LOCAL.equals(f))
if (LOCAL.equals(f))
flags |= ICSettingEntry.LOCAL;
if(VALUE_WORKSPACE_PATH.equals(f))
if (VALUE_WORKSPACE_PATH.equals(f))
flags |= ICSettingEntry.VALUE_WORKSPACE_PATH;
if(RESOLVED.equals(f))
if (RESOLVED.equals(f))
flags |= ICSettingEntry.RESOLVED;
if(UNDEFINED.equals(f))
if (UNDEFINED.equals(f))
flags |= ICSettingEntry.UNDEFINED;
if(FRAMEWORK.equals(f))
if (FRAMEWORK.equals(f))
flags |= ICSettingEntry.FRAMEWORKS_MAC;
}

View file

@ -40,11 +40,6 @@ import org.eclipse.cdt.core.model.IPathEntry;
import org.eclipse.cdt.core.model.ISourceEntry;
import org.eclipse.cdt.core.resources.IPathEntryVariableManager;
import org.eclipse.cdt.core.settings.model.CExternalSetting;
import org.eclipse.cdt.core.settings.model.CIncludeFileEntry;
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
import org.eclipse.cdt.core.settings.model.CLibraryFileEntry;
import org.eclipse.cdt.core.settings.model.CMacroEntry;
import org.eclipse.cdt.core.settings.model.CMacroFileEntry;
import org.eclipse.cdt.core.settings.model.COutputEntry;
import org.eclipse.cdt.core.settings.model.CSourceEntry;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
@ -301,25 +296,28 @@ public class PathEntryTranslator {
}
private static ICLanguageSettingEntry createLangEntry(ResolvedEntry entry) {
PathEntryValueInfo value = entry.getResolvedValue();
PathEntryValueInfo pathEntryValue = entry.getResolvedValue();
String name = pathEntryValue.getName();
int flags = ICSettingEntry.RESOLVED;
if (entry.isReadOnly())
flags |= ICSettingEntry.READONLY;
if (entry.isBuiltIn())
flags |= ICSettingEntry.BUILTIN;
switch (entry.fEntry.getEntryKind()) {
case IPathEntry.CDT_LIBRARY:{
ILibraryEntry libEntry = (ILibraryEntry)entry.fEntry;
IPath path = value.getFullPath();
IPath path = pathEntryValue.getFullPath();
if (path != null) {
flags |= ICSettingEntry.VALUE_WORKSPACE_PATH;
} else {
path = value.getLocation();
path = pathEntryValue.getLocation();
}
int kind = entry.fEntry.getEntryKind();
switch (kind) {
case IPathEntry.CDT_LIBRARY:{
if (path != null) {
return new CLibraryFileEntry(value.getName(), flags,
ILibraryEntry libEntry = (ILibraryEntry)entry.fEntry;
return (ICLanguageSettingEntry) CDataUtil.createEntry(ICSettingEntry.LIBRARY_FILE, name, null, null, flags,
libEntry.getSourceAttachmentPath(),
libEntry.getSourceAttachmentRootPath(),
libEntry.getSourceAttachmentPrefixMapping());
@ -331,52 +329,30 @@ public class PathEntryTranslator {
// case IPathEntry.CDT_SOURCE:
// return INDEX_CDT_SOURCE;
case IPathEntry.CDT_INCLUDE:{
IPath path = value.getFullPath();
if (path != null) {
flags |= ICSettingEntry.VALUE_WORKSPACE_PATH;
} else {
path = value.getLocation();
}
if (path != null) {
return new CIncludePathEntry(value.getName(), flags);
return CDataUtil.createCIncludePathEntry(name, flags);
}
break;
}
// case IPathEntry.CDT_CONTAINER:
// return INDEX_CDT_CONTAINER;
case IPathEntry.CDT_MACRO:
String name = value.getName();
if (name.length() != 0) {
String mValue = value.getValue();
return new CMacroEntry(name, mValue, flags);
String value = pathEntryValue.getValue();
return CDataUtil.createCMacroEntry(name, value, flags);
}
break;
// case IPathEntry.CDT_OUTPUT:
// return INDEX_CDT_OUTPUT;
case IPathEntry.CDT_INCLUDE_FILE:{
IPath path = value.getFullPath();
if (path != null) {
flags |= ICSettingEntry.VALUE_WORKSPACE_PATH;
} else {
path = value.getLocation();
}
if (path != null) {
return new CIncludeFileEntry(value.getName(), flags);
return CDataUtil.createCIncludeFileEntry(name, flags);
}
break;
}
case IPathEntry.CDT_MACRO_FILE:{
IPath path = value.getFullPath();
if (path != null) {
flags |= ICSettingEntry.VALUE_WORKSPACE_PATH;
} else {
path = value.getLocation();
}
if (path != null) {
return new CMacroFileEntry(value.getName(), flags);
return CDataUtil.createCMacroFileEntry(name, flags);
}
break;
}

View file

@ -19,10 +19,10 @@ import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
import org.eclipse.cdt.ui.CDTSharedImages;
import org.eclipse.cdt.ui.CUIPlugin;
@ -93,7 +93,7 @@ public class IncludePathsSettingsProcessor extends SettingsProcessor {
if(include != null && include.length() > 0) {
if( includeElement.getAttribute(WORKSPACE_PATH_ATTR).equalsIgnoreCase(Boolean.TRUE.toString()) )
flags |= ICSettingEntry.VALUE_WORKSPACE_PATH;
includes.add(new CIncludePathEntry(include, flags));
includes.add(CDataUtil.createCIncludePathEntry(include, flags));
}
}

View file

@ -22,10 +22,10 @@ import org.w3c.dom.Text;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
import org.eclipse.cdt.core.settings.model.CMacroEntry;
import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
import org.eclipse.cdt.ui.CDTSharedImages;
import org.eclipse.cdt.ui.CUIPlugin;
@ -131,7 +131,7 @@ public class MacroSettingsProcessor extends SettingsProcessor {
if(value == null)
throw new SettingsImportExportException("There must be one <value> element"); //$NON-NLS-1$
macros.add(new CMacroEntry(name, value, 0));
macros.add(CDataUtil.createCMacroEntry(name, value, 0));
}
if(macros.isEmpty())

View file

@ -11,9 +11,9 @@
*******************************************************************************/
package org.eclipse.cdt.ui.newui;
import org.eclipse.cdt.core.settings.model.CIncludeFileEntry;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
/**
* @noextend This class is not intended to be subclassed by clients.
@ -25,7 +25,7 @@ public class ExpIncludeFileTab extends AbstractExportTab {
@Override
public ICLanguageSettingEntry doAdd(String s1, String s2, boolean isWsp) {
int flags = isWsp ? ICSettingEntry.VALUE_WORKSPACE_PATH : 0;
return new CIncludeFileEntry(s2, flags);
return CDataUtil.createCIncludeFileEntry(s2, flags);
}
@Override

View file

@ -10,9 +10,9 @@
*******************************************************************************/
package org.eclipse.cdt.ui.newui;
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
/**
* @noextend This class is not intended to be subclassed by clients.
@ -22,7 +22,7 @@ public class ExpIncludeTab extends AbstractExportTab {
@Override
public ICLanguageSettingEntry doAdd(String s1, String s2, boolean isWsp) {
int flags = isWsp ? ICSettingEntry.VALUE_WORKSPACE_PATH : 0;
return new CIncludePathEntry(s2, flags);
return CDataUtil.createCIncludePathEntry(s2, flags);
}
@Override

View file

@ -10,9 +10,9 @@
*******************************************************************************/
package org.eclipse.cdt.ui.newui;
import org.eclipse.cdt.core.settings.model.CMacroEntry;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
/**
* @noextend This class is not intended to be subclassed by clients.
@ -22,7 +22,7 @@ public class ExpSymbolTab extends AbstractExportTab {
// isWsp is ignored for symbols
@Override
public ICLanguageSettingEntry doAdd(String s1, String s2, boolean isWsp) {
return new CMacroEntry(s1, s2, 0);
return CDataUtil.createCMacroEntry(s1, s2, 0);
}
@Override

View file

@ -18,9 +18,9 @@ import org.eclipse.swt.accessibility.AccessibleEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.cdt.core.settings.model.CIncludeFileEntry;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
import org.eclipse.cdt.internal.ui.newui.Messages;
@ -68,7 +68,7 @@ public class IncludeFileTab extends AbstractLangsListTab {
if (dlg.check2) { // isWsp
flags = ICSettingEntry.VALUE_WORKSPACE_PATH;
}
return new CIncludeFileEntry(dlg.text1, flags);
return CDataUtil.createCIncludeFileEntry(dlg.text1, flags);
}
return null;
}
@ -87,7 +87,7 @@ public class IncludeFileTab extends AbstractLangsListTab {
int flags = 0;
if (dlg.check2)
flags = ICSettingEntry.VALUE_WORKSPACE_PATH;
return new CIncludeFileEntry(dlg.text1, flags);
return CDataUtil.createCIncludeFileEntry(dlg.text1, flags);
}
return null;
}

View file

@ -17,9 +17,9 @@ import org.eclipse.swt.accessibility.AccessibleEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
import org.eclipse.cdt.internal.ui.newui.Messages;
@ -57,7 +57,7 @@ public void additionalTableSet() {
if (dlg.check2) { // isWsp
flags = ICSettingEntry.VALUE_WORKSPACE_PATH;
}
return new CIncludePathEntry(dlg.text1, flags);
return CDataUtil.createCIncludePathEntry(dlg.text1, flags);
}
return null;
}
@ -72,7 +72,7 @@ public void additionalTableSet() {
if (dlg.open()) {
int flags = 0;
if (dlg.check2) flags = ICSettingEntry.VALUE_WORKSPACE_PATH;
return new CIncludePathEntry(dlg.text1, flags);
return CDataUtil.createCIncludePathEntry(dlg.text1, flags);
}
return null;
}

View file

@ -20,9 +20,9 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.cdt.core.model.util.CDTListComparator;
import org.eclipse.cdt.core.settings.model.CMacroEntry;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
import org.eclipse.cdt.internal.ui.newui.Messages;
@ -58,7 +58,7 @@ public class SymbolTab extends AbstractLangsListTab {
if (dlg.open() && dlg.text1.trim().length() > 0 ) {
toAllCfgs = dlg.check1;
toAllLang = dlg.check3;
return new CMacroEntry(dlg.text1, dlg.text2, 0);
return CDataUtil.createCMacroEntry(dlg.text1, dlg.text2, 0);
}
return null;
}
@ -70,7 +70,7 @@ public class SymbolTab extends AbstractLangsListTab {
Messages.SymbolTab_3, ent.getName(),
ent.getValue(), getResDesc());
if (dlg.open())
return new CMacroEntry(dlg.text1, dlg.text2, 0);
return CDataUtil.createCMacroEntry(dlg.text1, dlg.text2, 0);
return null;
}

View file

@ -35,6 +35,7 @@ import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
@ -196,7 +197,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
// if we didn't find the path, add it
if(!symbolFound) {
entriesChanged = true;
CMacroEntry newEntry = new CMacroEntry(symbol, discSymbols.get(symbol), ICSettingEntry.BUILTIN | ICSettingEntry.READONLY | ICSettingEntry.RESOLVED);
CMacroEntry newEntry = CDataUtil.createCMacroEntry(symbol, discSymbols.get(symbol), ICSettingEntry.BUILTIN | ICSettingEntry.READONLY | ICSettingEntry.RESOLVED);
newEntries.add(newEntry);
}
}
@ -216,7 +217,6 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
newEntries.add(entry);
}
boolean entriesChanged = false;
// look for settings corresponding to each path we discovered
@ -234,7 +234,7 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
// if we didn't find the path, add it
if(!pathFound) {
entriesChanged = true;
CIncludePathEntry newEntry = new CIncludePathEntry(path, ICSettingEntry.BUILTIN | ICSettingEntry.READONLY | ICSettingEntry.RESOLVED);
CIncludePathEntry newEntry = CDataUtil.createCIncludePathEntry(path.toString(), ICSettingEntry.BUILTIN | ICSettingEntry.READONLY | ICSettingEntry.RESOLVED);
newEntries.add(newEntry);
}
}