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:
parent
453f71f4c4
commit
4fc55d2d21
21 changed files with 861 additions and 694 deletions
|
@ -14,7 +14,6 @@ import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
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.ICLanguageSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICMacroEntry;
|
import org.eclipse.cdt.core.settings.model.ICMacroEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||||
|
@ -31,14 +30,14 @@ public class PathInfoToLangSettingsConverter {
|
||||||
return ICLanguageSettingEntry.INCLUDE_PATH
|
return ICLanguageSettingEntry.INCLUDE_PATH
|
||||||
| ICLanguageSettingEntry.MACRO;
|
| ICLanguageSettingEntry.MACRO;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getSupportedEntryKinds(IPerFileDiscoveredPathInfo info){
|
public static int getSupportedEntryKinds(IPerFileDiscoveredPathInfo info){
|
||||||
return ICLanguageSettingEntry.INCLUDE_FILE
|
return ICLanguageSettingEntry.INCLUDE_FILE
|
||||||
| ICLanguageSettingEntry.INCLUDE_PATH
|
| ICLanguageSettingEntry.INCLUDE_PATH
|
||||||
| ICLanguageSettingEntry.MACRO
|
| ICLanguageSettingEntry.MACRO
|
||||||
| ICLanguageSettingEntry.MACRO_FILE;
|
| ICLanguageSettingEntry.MACRO_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ICLanguageSettingEntry[] entriesForKind(int kind, int flags, PathInfo info){
|
public static ICLanguageSettingEntry[] entriesForKind(int kind, int flags, PathInfo info){
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case ICLanguageSettingEntry.INCLUDE_PATH:
|
case ICLanguageSettingEntry.INCLUDE_PATH:
|
||||||
|
@ -73,7 +72,7 @@ public class PathInfoToLangSettingsConverter {
|
||||||
}
|
}
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ICMacroEntry[] calculateEntries(int flags, Map<String, String> map){
|
private static ICMacroEntry[] calculateEntries(int flags, Map<String, String> map){
|
||||||
ICMacroEntry entries[] = new ICMacroEntry[map.size()];
|
ICMacroEntry entries[] = new ICMacroEntry[map.size()];
|
||||||
int num = 0;
|
int num = 0;
|
||||||
|
@ -81,7 +80,7 @@ public class PathInfoToLangSettingsConverter {
|
||||||
for (Entry<String, String> entry : entrySet) {
|
for (Entry<String, String> entry : entrySet) {
|
||||||
String name = entry.getKey();
|
String name = entry.getKey();
|
||||||
String value = entry.getValue();
|
String value = entry.getValue();
|
||||||
entries[num++] = new CMacroEntry(name, value, flags);
|
entries[num++] = CDataUtil.createCMacroEntry(name, value, flags);
|
||||||
}
|
}
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -33,11 +33,9 @@ import java.util.regex.PatternSyntaxException;
|
||||||
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
|
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.resources.ACBuilder;
|
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.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
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.internal.core.envvar.EnvironmentVariableManager;
|
||||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
|
@ -611,11 +609,11 @@ public class HeadlessBuilder implements IApplication {
|
||||||
macroVal = macro.substring(macro.indexOf('=') + 1);
|
macroVal = macro.substring(macro.indexOf('=') + 1);
|
||||||
macro = macro.substring(0, macro.indexOf('='));
|
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$
|
} 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$
|
} 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$
|
} else if ("-E".equals(args[i])) { //$NON-NLS-1$
|
||||||
addEnvironmentVariable(args[++i], IEnvironmentVariable.ENVVAR_REPLACE);
|
addEnvironmentVariable(args[++i], IEnvironmentVariable.ENVVAR_REPLACE);
|
||||||
} else if ("-Ea".equals(args[i])) { //$NON-NLS-1$
|
} else if ("-Ea".equals(args[i])) { //$NON-NLS-1$
|
||||||
|
|
|
@ -19,7 +19,6 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
|
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.ICLanguageSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingPathEntry;
|
import org.eclipse.cdt.core.settings.model.ICLanguageSettingPathEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICLibraryFileEntry;
|
import org.eclipse.cdt.core.settings.model.ICLibraryFileEntry;
|
||||||
|
@ -221,8 +220,8 @@ public class BuildEntryStorage extends AbstractEntryStorage {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return user entries (level 0)
|
* Return user entries (level 0)
|
||||||
*
|
*
|
||||||
* The UserEntryInfo[] is an array of all user entries from all the options
|
* The UserEntryInfo[] is an array of all user entries from all the options
|
||||||
* applicable to the language setting entry kind.
|
* applicable to the language setting entry kind.
|
||||||
* @param emptyValuesInfos list to which unresolved entries are added
|
* @param emptyValuesInfos list to which unresolved entries are added
|
||||||
|
@ -302,7 +301,7 @@ public class BuildEntryStorage extends AbstractEntryStorage {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes non-absolute paths relative to the build directory
|
* Makes non-absolute paths relative to the build directory
|
||||||
*/
|
*/
|
||||||
private PathInfo fromBuildToProj(PathInfo info) {
|
private PathInfo fromBuildToProj(PathInfo info) {
|
||||||
if (info.isAbsolute())
|
if (info.isAbsolute())
|
||||||
|
@ -397,7 +396,7 @@ public class BuildEntryStorage extends AbstractEntryStorage {
|
||||||
|
|
||||||
if (kind == ICSettingEntry.MACRO) {
|
if (kind == ICSettingEntry.MACRO) {
|
||||||
String nv[] = macroNameValueFromValue(optionValue.getValue());
|
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;
|
IPath srcPath = null, srcRootPath = null, srcPrefixMapping = null;
|
||||||
|
@ -659,7 +658,7 @@ public class BuildEntryStorage extends AbstractEntryStorage {
|
||||||
* This method iterates over the passed in UserEntryInfo[]. The point of it is
|
* This method iterates over the passed in UserEntryInfo[]. The point of it is
|
||||||
* to collapse entries which are contained in a given UserEntry's sequence into a single
|
* to collapse entries which are contained in a given UserEntry's sequence into a single
|
||||||
* UserEntryInfo.
|
* UserEntryInfo.
|
||||||
*
|
*
|
||||||
* FIXME: As far as I can see info.fSequense only ever has a single entry in it...
|
* FIXME: As far as I can see info.fSequense only ever has a single entry in it...
|
||||||
* see UserEntryInfo constructor => this method doesn't accomplish anything useful
|
* see UserEntryInfo constructor => this method doesn't accomplish anything useful
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -20,6 +20,13 @@ public abstract class ACPathEntry extends ACSettingEntry implements ICPathEntry
|
||||||
// IPath fLocation;
|
// IPath fLocation;
|
||||||
// private IPath fPath;
|
// 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) {
|
ACPathEntry(IResource rc, int flags) {
|
||||||
super(rc.getFullPath().toString(), flags | RESOLVED | VALUE_WORKSPACE_PATH);
|
super(rc.getFullPath().toString(), flags | RESOLVED | VALUE_WORKSPACE_PATH);
|
||||||
// fFullPath = rc.getFullPath();
|
// fFullPath = rc.getFullPath();
|
||||||
|
@ -33,10 +40,25 @@ public abstract class ACPathEntry extends ACSettingEntry implements ICPathEntry
|
||||||
fFullPath = fullPath;
|
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) {
|
ACPathEntry(IPath path, int flags) {
|
||||||
super(path.toString(), flags /*| RESOLVED*/);
|
super(path.toString(), flags /*| RESOLVED*/);
|
||||||
// fPath = path;
|
// fPath = path;
|
||||||
|
|
|
@ -1,29 +1,59 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* 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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Intel Corporation - Initial API and implementation
|
* Intel Corporation - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.settings.model;
|
package org.eclipse.cdt.core.settings.model;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
public final class CIncludeFileEntry extends ACPathEntry implements
|
/**
|
||||||
ICIncludeFileEntry {
|
* Representation in the project model of include file settings entries.
|
||||||
|
* As an example, those are supplied by a gcc compiler with option "-include".
|
||||||
public CIncludeFileEntry(String value, int flags) {
|
*/
|
||||||
super(value, flags);
|
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) {
|
public CIncludeFileEntry(IPath location, int flags) {
|
||||||
super(location, 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) {
|
public CIncludeFileEntry(IFile rc, int flags) {
|
||||||
super(rc, flags);
|
super(rc, flags);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +1,59 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* 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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Intel Corporation - Initial API and implementation
|
* Intel Corporation - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.settings.model;
|
package org.eclipse.cdt.core.settings.model;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IFolder;
|
import org.eclipse.core.resources.IFolder;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
public final class CIncludePathEntry extends ACPathEntry implements ICIncludePathEntry{
|
/**
|
||||||
|
* Representation in the project model of include path settings entries.
|
||||||
public CIncludePathEntry(String value, int flags) {
|
* As an example, those are supplied by a gcc compiler with option "-I".
|
||||||
super(value, flags);
|
*/
|
||||||
|
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) {
|
public CIncludePathEntry(IPath location, int flags) {
|
||||||
super(location, 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) {
|
public CIncludePathEntry(IFolder rc, int flags) {
|
||||||
super(rc, flags);
|
super(rc, flags);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -12,11 +12,22 @@ package org.eclipse.cdt.core.settings.model;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.SafeStringInterner;
|
import org.eclipse.cdt.internal.core.SafeStringInterner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representation in the project model of macro settings entries.
|
||||||
public final class CMacroEntry extends ACSettingEntry implements ICMacroEntry{
|
* 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 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) {
|
public CMacroEntry(String name, String value, int flags) {
|
||||||
super(name, flags);
|
super(name, flags);
|
||||||
fValue = SafeStringInterner.safeIntern(value);
|
fValue = SafeStringInterner.safeIntern(value);
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -13,17 +13,48 @@ package org.eclipse.cdt.core.settings.model;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.runtime.IPath;
|
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) {
|
public CMacroFileEntry(IPath location, int flags) {
|
||||||
super(location, 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) {
|
public CMacroFileEntry(IFile rc, int flags) {
|
||||||
super(rc, flags);
|
super(rc, flags);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -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.CTargetPlatformData;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.impl.CDataFactory;
|
import org.eclipse.cdt.core.settings.model.extension.impl.CDataFactory;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.impl.CDefaultLanguageData;
|
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.cdt.internal.core.settings.model.ExceptionFactory;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.ProjectScope;
|
import org.eclipse.core.resources.ProjectScope;
|
||||||
|
@ -76,6 +77,18 @@ public class CDataUtil {
|
||||||
private static Random randomNumber;
|
private static Random randomNumber;
|
||||||
public static final String[] EMPTY_STRING_ARRAY = new String[0];
|
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(){
|
public static int genRandomNumber(){
|
||||||
if (randomNumber == null) {
|
if (randomNumber == null) {
|
||||||
// Set the random number seed
|
// Set the random number seed
|
||||||
|
@ -262,12 +275,39 @@ public class CDataUtil {
|
||||||
return path;
|
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));
|
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:
|
case ICSettingEntry.INCLUDE_PATH:
|
||||||
entry = new CIncludePathEntry(entry.getName(), flags);
|
entry = new CIncludePathEntry(entry.getName(), flags);
|
||||||
break;
|
break;
|
||||||
|
@ -293,34 +333,94 @@ public class CDataUtil {
|
||||||
);
|
);
|
||||||
break;
|
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);
|
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){
|
switch (kind){
|
||||||
case ICSettingEntry.INCLUDE_PATH:
|
case ICLanguageSettingEntry.INCLUDE_PATH:
|
||||||
return new CIncludePathEntry(name, flags);
|
entry = new CIncludePathEntry(name, flags);
|
||||||
case ICSettingEntry.MACRO:
|
break;
|
||||||
return new CMacroEntry(name, value, flags);
|
case ICLanguageSettingEntry.MACRO:
|
||||||
case ICSettingEntry.INCLUDE_FILE:
|
entry = new CMacroEntry(name, value, flags);
|
||||||
return new CIncludeFileEntry(name, flags);
|
break;
|
||||||
case ICSettingEntry.MACRO_FILE:
|
case ICLanguageSettingEntry.INCLUDE_FILE:
|
||||||
return new CMacroFileEntry(name, flags);
|
entry = new CIncludeFileEntry(name, flags);
|
||||||
case ICSettingEntry.LIBRARY_PATH:
|
break;
|
||||||
return new CLibraryPathEntry(name, flags);
|
case ICLanguageSettingEntry.MACRO_FILE:
|
||||||
case ICSettingEntry.LIBRARY_FILE:
|
entry = new CMacroFileEntry(name, flags);
|
||||||
return new CLibraryFileEntry(name, flags, srcPath, srcRootPath, srcPrefixMapping);
|
break;
|
||||||
case ICSettingEntry.OUTPUT_PATH:
|
case ICLanguageSettingEntry.LIBRARY_PATH:
|
||||||
return new COutputEntry(name, exclusionPatterns, flags);
|
entry = new CLibraryPathEntry(name, flags);
|
||||||
case ICSettingEntry.SOURCE_PATH:
|
break;
|
||||||
return new CSourceEntry(name, exclusionPatterns, flags);
|
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();
|
||||||
}
|
}
|
||||||
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) {
|
public static String[] getSourceExtensions(IProject project, CLanguageData data) {
|
||||||
|
|
|
@ -14,14 +14,6 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.StringTokenizer;
|
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.ICExclusionPatternPathEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICLibraryFileEntry;
|
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_ROOT_PATH = "srcRootPath"; //$NON-NLS-1$
|
||||||
public static final String ATTRIBUTE_SOURCE_ATTACHMENT_PREFIX_MAPPING = "srcPrefixMapping"; //$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_FULL_PATH = "fullPath"; //$NON-NLS-1$
|
||||||
// public static final String ATTRIBUTE_LOCATION = "location"; //$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_PATH = "includePath"; //$NON-NLS-1$
|
||||||
public static final String INCLUDE_FILE = "includeFile"; //$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 final String FLAGS_SEPARATOR = "|"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static ICSettingEntry[] loadEntries(ICStorageElement el){
|
public static ICSettingEntry[] loadEntries(ICStorageElement el) {
|
||||||
return loadEntries(el, 0);
|
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);
|
List<ICSettingEntry> list = loadEntriesList(el, kindFilter);
|
||||||
return list.toArray(new ICSettingEntry[list.size()]);
|
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);
|
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 children[] = el.getChildren();
|
||||||
ICStorageElement child;
|
ICStorageElement child;
|
||||||
List<ICSettingEntry> list = new ArrayList<ICSettingEntry>();
|
List<ICSettingEntry> list = new ArrayList<ICSettingEntry>();
|
||||||
ICSettingEntry entry;
|
ICSettingEntry entry;
|
||||||
for(int i = 0; i < children.length; i++){
|
for (int i = 0; i < children.length; i++) {
|
||||||
child = children[i];
|
child = children[i];
|
||||||
if(ELEMENT_ENTRY.equals(child.getName())){
|
if (ELEMENT_ENTRY.equals(child.getName())) {
|
||||||
entry = loadEntry(child);
|
entry = loadEntry(child);
|
||||||
if(entry != null
|
if (entry != null && (kindFilter == 0 || (kindFilter & entry.getKind()) != 0))
|
||||||
&& (kindFilter == 0
|
|
||||||
|| (kindFilter & entry.getKind()) != 0))
|
|
||||||
list.add(entry);
|
list.add(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,51 +91,33 @@ public class LanguageSettingEntriesSerializer {
|
||||||
|
|
||||||
int flags = composeFlags(el.getAttribute(ATTRIBUTE_FLAGS));
|
int flags = composeFlags(el.getAttribute(ATTRIBUTE_FLAGS));
|
||||||
String name = el.getAttribute(ATTRIBUTE_NAME);
|
String name = el.getAttribute(ATTRIBUTE_NAME);
|
||||||
|
String value = el.getAttribute(ATTRIBUTE_VALUE);
|
||||||
|
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 CDataUtil.createEntry(kind, name, value, exclusionPatterns, flags, srcPath, srcRootPath, srcPrefixMapping);
|
||||||
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 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IPath loadPath(ICStorageElement el, String attr){
|
private static IPath loadPath(ICStorageElement el, String attr) {
|
||||||
String value = el.getAttribute(attr);
|
String value = el.getAttribute(attr);
|
||||||
if(value != null)
|
if (value != null)
|
||||||
return new Path(value);
|
return new Path(value);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// private static void storePath(ICStorageElement el, String attr, IPath path){
|
// private static void storePath(ICStorageElement el, String attr, IPath path){
|
||||||
// if(path != null)
|
// if(path != null)
|
||||||
// el.setAttribute(attr, path.toString());
|
// el.setAttribute(attr, path.toString());
|
||||||
// }
|
// }
|
||||||
|
|
||||||
private static IPath[] loadExclusions(ICStorageElement el){
|
private static IPath[] loadExclusions(ICStorageElement el) {
|
||||||
String attr = el.getAttribute(ATTRIBUTE_EXCLUDING);
|
String attr = el.getAttribute(ATTRIBUTE_EXCLUDING);
|
||||||
if(attr != null){
|
if (attr != null) {
|
||||||
String[] strs = CDataUtil.stringToArray(attr, FLAGS_SEPARATOR);
|
String[] strs = CDataUtil.stringToArray(attr, FLAGS_SEPARATOR);
|
||||||
IPath[] paths = new IPath[strs.length];
|
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]);
|
paths[i] = new Path(strs[i]);
|
||||||
}
|
}
|
||||||
return paths;
|
return paths;
|
||||||
|
@ -154,12 +125,12 @@ public class LanguageSettingEntriesSerializer {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void storeExclusions(ICStorageElement el, IPath[] paths){
|
private static void storeExclusions(ICStorageElement el, IPath[] paths) {
|
||||||
if(paths == null || paths.length == 0)
|
if (paths == null || paths.length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String[] strs = new String[paths.length];
|
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();
|
strs[i] = paths[i].toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,51 +138,51 @@ public class LanguageSettingEntriesSerializer {
|
||||||
el.setAttribute(ATTRIBUTE_EXCLUDING, attr);
|
el.setAttribute(ATTRIBUTE_EXCLUDING, attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void serializeEntries(ICSettingEntry entries[], ICStorageElement element){
|
public static void serializeEntries(ICSettingEntry entries[], ICStorageElement element) {
|
||||||
ICStorageElement child;
|
ICStorageElement child;
|
||||||
if(entries != null){
|
if (entries != null) {
|
||||||
for(int i = 0; i < entries.length; i++){
|
for (int i = 0; i < entries.length; i++) {
|
||||||
child = element.createChild(ELEMENT_ENTRY);
|
child = element.createChild(ELEMENT_ENTRY);
|
||||||
serializeEntry(entries[i], child);
|
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 kind = kindToString(entry.getKind());
|
||||||
String flags = composeFlagsString(entry.getFlags());
|
String flags = composeFlagsString(entry.getFlags());
|
||||||
String name = entry.getName();
|
String name = entry.getName();
|
||||||
element.setAttribute(ATTRIBUTE_KIND, kind);
|
element.setAttribute(ATTRIBUTE_KIND, kind);
|
||||||
element.setAttribute(ATTRIBUTE_FLAGS, flags);
|
element.setAttribute(ATTRIBUTE_FLAGS, flags);
|
||||||
element.setAttribute(ATTRIBUTE_NAME, name);
|
element.setAttribute(ATTRIBUTE_NAME, name);
|
||||||
switch(entry.getKind()){
|
switch (entry.getKind()) {
|
||||||
case ICSettingEntry.MACRO:
|
case ICSettingEntry.MACRO:
|
||||||
String value = entry.getValue();
|
String value = entry.getValue();
|
||||||
element.setAttribute(ATTRIBUTE_VALUE, value);
|
element.setAttribute(ATTRIBUTE_VALUE, value);
|
||||||
break;
|
break;
|
||||||
case ICSettingEntry.SOURCE_PATH:
|
case ICSettingEntry.SOURCE_PATH:
|
||||||
case ICSettingEntry.OUTPUT_PATH:
|
case ICSettingEntry.OUTPUT_PATH:
|
||||||
IPath paths[] = ((ICExclusionPatternPathEntry)entry).getExclusionPatterns();
|
IPath paths[] = ((ICExclusionPatternPathEntry) entry).getExclusionPatterns();
|
||||||
storeExclusions(element, paths);
|
storeExclusions(element, paths);
|
||||||
break;
|
break;
|
||||||
case ICSettingEntry.LIBRARY_FILE:
|
case ICSettingEntry.LIBRARY_FILE:
|
||||||
ICLibraryFileEntry libFile = (ICLibraryFileEntry)entry;
|
ICLibraryFileEntry libFile = (ICLibraryFileEntry) entry;
|
||||||
IPath path = libFile.getSourceAttachmentPath();
|
IPath path = libFile.getSourceAttachmentPath();
|
||||||
if(path != null)
|
if (path != null)
|
||||||
element.setAttribute(ATTRIBUTE_SOURCE_ATTACHMENT_PATH, path.toString());
|
element.setAttribute(ATTRIBUTE_SOURCE_ATTACHMENT_PATH, path.toString());
|
||||||
|
|
||||||
path = libFile.getSourceAttachmentRootPath();
|
path = libFile.getSourceAttachmentRootPath();
|
||||||
if(path != null)
|
if (path != null)
|
||||||
element.setAttribute(ATTRIBUTE_SOURCE_ATTACHMENT_ROOT_PATH, path.toString());
|
element.setAttribute(ATTRIBUTE_SOURCE_ATTACHMENT_ROOT_PATH, path.toString());
|
||||||
|
|
||||||
path = libFile.getSourceAttachmentPrefixMapping();
|
path = libFile.getSourceAttachmentPrefixMapping();
|
||||||
if(path != null)
|
if (path != null)
|
||||||
element.setAttribute(ATTRIBUTE_SOURCE_ATTACHMENT_PREFIX_MAPPING, path.toString());
|
element.setAttribute(ATTRIBUTE_SOURCE_ATTACHMENT_PREFIX_MAPPING, path.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String kindToString(int kind){
|
public static String kindToString(int kind) {
|
||||||
switch(kind){
|
switch (kind) {
|
||||||
case ICSettingEntry.INCLUDE_PATH:
|
case ICSettingEntry.INCLUDE_PATH:
|
||||||
return INCLUDE_PATH;
|
return INCLUDE_PATH;
|
||||||
case ICSettingEntry.INCLUDE_FILE:
|
case ICSettingEntry.INCLUDE_FILE:
|
||||||
|
@ -232,64 +203,64 @@ public class LanguageSettingEntriesSerializer {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int stringToKind(String kind){
|
public static int stringToKind(String kind) {
|
||||||
if(INCLUDE_PATH.equals(kind))
|
if (INCLUDE_PATH.equals(kind))
|
||||||
return ICSettingEntry.INCLUDE_PATH;
|
return ICSettingEntry.INCLUDE_PATH;
|
||||||
if(INCLUDE_FILE.equals(kind))
|
if (INCLUDE_FILE.equals(kind))
|
||||||
return ICSettingEntry.INCLUDE_FILE;
|
return ICSettingEntry.INCLUDE_FILE;
|
||||||
if(MACRO.equals(kind))
|
if (MACRO.equals(kind))
|
||||||
return ICSettingEntry.MACRO;
|
return ICSettingEntry.MACRO;
|
||||||
if(MACRO_FILE.equals(kind))
|
if (MACRO_FILE.equals(kind))
|
||||||
return ICSettingEntry.MACRO_FILE;
|
return ICSettingEntry.MACRO_FILE;
|
||||||
if(LIBRARY_PATH.equals(kind))
|
if (LIBRARY_PATH.equals(kind))
|
||||||
return ICSettingEntry.LIBRARY_PATH;
|
return ICSettingEntry.LIBRARY_PATH;
|
||||||
if(LIBRARY_FILE.equals(kind))
|
if (LIBRARY_FILE.equals(kind))
|
||||||
return ICSettingEntry.LIBRARY_FILE;
|
return ICSettingEntry.LIBRARY_FILE;
|
||||||
if(SOURCE_PATH.equals(kind))
|
if (SOURCE_PATH.equals(kind))
|
||||||
return ICSettingEntry.SOURCE_PATH;
|
return ICSettingEntry.SOURCE_PATH;
|
||||||
if(OUTPUT_PATH.equals(kind))
|
if (OUTPUT_PATH.equals(kind))
|
||||||
return ICSettingEntry.OUTPUT_PATH;
|
return ICSettingEntry.OUTPUT_PATH;
|
||||||
return 0;
|
return 0;
|
||||||
// throw new UnsupportedOperationException();
|
// throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String composeFlagsString(int flags){
|
public static String composeFlagsString(int flags) {
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
if((flags & ICSettingEntry.BUILTIN) != 0){
|
if ((flags & ICSettingEntry.BUILTIN) != 0) {
|
||||||
buf.append(BUILTIN);
|
buf.append(BUILTIN);
|
||||||
}
|
}
|
||||||
if((flags & ICSettingEntry.READONLY) != 0){
|
if ((flags & ICSettingEntry.READONLY) != 0) {
|
||||||
if(buf.length() != 0)
|
if (buf.length() != 0)
|
||||||
buf.append(FLAGS_SEPARATOR);
|
buf.append(FLAGS_SEPARATOR);
|
||||||
|
|
||||||
buf.append(READONLY);
|
buf.append(READONLY);
|
||||||
}
|
}
|
||||||
if((flags & ICSettingEntry.LOCAL) != 0){
|
if ((flags & ICSettingEntry.LOCAL) != 0) {
|
||||||
if(buf.length() != 0)
|
if (buf.length() != 0)
|
||||||
buf.append(FLAGS_SEPARATOR);
|
buf.append(FLAGS_SEPARATOR);
|
||||||
|
|
||||||
buf.append(LOCAL);
|
buf.append(LOCAL);
|
||||||
}
|
}
|
||||||
if((flags & ICSettingEntry.VALUE_WORKSPACE_PATH) != 0){
|
if ((flags & ICSettingEntry.VALUE_WORKSPACE_PATH) != 0) {
|
||||||
if(buf.length() != 0)
|
if (buf.length() != 0)
|
||||||
buf.append(FLAGS_SEPARATOR);
|
buf.append(FLAGS_SEPARATOR);
|
||||||
|
|
||||||
buf.append(VALUE_WORKSPACE_PATH);
|
buf.append(VALUE_WORKSPACE_PATH);
|
||||||
}
|
}
|
||||||
if((flags & ICSettingEntry.RESOLVED) != 0){
|
if ((flags & ICSettingEntry.RESOLVED) != 0) {
|
||||||
if(buf.length() != 0)
|
if (buf.length() != 0)
|
||||||
buf.append(FLAGS_SEPARATOR);
|
buf.append(FLAGS_SEPARATOR);
|
||||||
|
|
||||||
buf.append(RESOLVED);
|
buf.append(RESOLVED);
|
||||||
}
|
}
|
||||||
if((flags & ICLanguageSettingEntry.UNDEFINED) != 0){
|
if ((flags & ICLanguageSettingEntry.UNDEFINED) != 0) {
|
||||||
if(buf.length() != 0)
|
if (buf.length() != 0)
|
||||||
buf.append(FLAGS_SEPARATOR);
|
buf.append(FLAGS_SEPARATOR);
|
||||||
|
|
||||||
buf.append(UNDEFINED);
|
buf.append(UNDEFINED);
|
||||||
}
|
}
|
||||||
if((flags & ICLanguageSettingEntry.FRAMEWORKS_MAC) != 0){
|
if ((flags & ICLanguageSettingEntry.FRAMEWORKS_MAC) != 0) {
|
||||||
if(buf.length() != 0)
|
if (buf.length() != 0)
|
||||||
buf.append(FLAGS_SEPARATOR);
|
buf.append(FLAGS_SEPARATOR);
|
||||||
|
|
||||||
buf.append(FRAMEWORK);
|
buf.append(FRAMEWORK);
|
||||||
|
@ -300,28 +271,28 @@ public class LanguageSettingEntriesSerializer {
|
||||||
/**
|
/**
|
||||||
* @since 5.4
|
* @since 5.4
|
||||||
*/
|
*/
|
||||||
public static int composeFlags(String flagsString){
|
public static int composeFlags(String flagsString) {
|
||||||
if(flagsString == null || flagsString.length() == 0)
|
if (flagsString == null || flagsString.length() == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
StringTokenizer tokenizer = new StringTokenizer(flagsString, FLAGS_SEPARATOR);
|
StringTokenizer tokenizer = new StringTokenizer(flagsString, FLAGS_SEPARATOR);
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
String f;
|
String f;
|
||||||
while(tokenizer.hasMoreElements()){
|
while (tokenizer.hasMoreElements()) {
|
||||||
f = tokenizer.nextToken();
|
f = tokenizer.nextToken();
|
||||||
if(BUILTIN.equals(f))
|
if (BUILTIN.equals(f))
|
||||||
flags |= ICSettingEntry.BUILTIN;
|
flags |= ICSettingEntry.BUILTIN;
|
||||||
if(READONLY.equals(f))
|
if (READONLY.equals(f))
|
||||||
flags |= ICSettingEntry.READONLY;
|
flags |= ICSettingEntry.READONLY;
|
||||||
if(LOCAL.equals(f))
|
if (LOCAL.equals(f))
|
||||||
flags |= ICSettingEntry.LOCAL;
|
flags |= ICSettingEntry.LOCAL;
|
||||||
if(VALUE_WORKSPACE_PATH.equals(f))
|
if (VALUE_WORKSPACE_PATH.equals(f))
|
||||||
flags |= ICSettingEntry.VALUE_WORKSPACE_PATH;
|
flags |= ICSettingEntry.VALUE_WORKSPACE_PATH;
|
||||||
if(RESOLVED.equals(f))
|
if (RESOLVED.equals(f))
|
||||||
flags |= ICSettingEntry.RESOLVED;
|
flags |= ICSettingEntry.RESOLVED;
|
||||||
if(UNDEFINED.equals(f))
|
if (UNDEFINED.equals(f))
|
||||||
flags |= ICSettingEntry.UNDEFINED;
|
flags |= ICSettingEntry.UNDEFINED;
|
||||||
if(FRAMEWORK.equals(f))
|
if (FRAMEWORK.equals(f))
|
||||||
flags |= ICSettingEntry.FRAMEWORKS_MAC;
|
flags |= ICSettingEntry.FRAMEWORKS_MAC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,11 +40,6 @@ import org.eclipse.cdt.core.model.IPathEntry;
|
||||||
import org.eclipse.cdt.core.model.ISourceEntry;
|
import org.eclipse.cdt.core.model.ISourceEntry;
|
||||||
import org.eclipse.cdt.core.resources.IPathEntryVariableManager;
|
import org.eclipse.cdt.core.resources.IPathEntryVariableManager;
|
||||||
import org.eclipse.cdt.core.settings.model.CExternalSetting;
|
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.COutputEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.CSourceEntry;
|
import org.eclipse.cdt.core.settings.model.CSourceEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
|
@ -301,25 +296,28 @@ public class PathEntryTranslator {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ICLanguageSettingEntry createLangEntry(ResolvedEntry entry) {
|
private static ICLanguageSettingEntry createLangEntry(ResolvedEntry entry) {
|
||||||
PathEntryValueInfo value = entry.getResolvedValue();
|
PathEntryValueInfo pathEntryValue = entry.getResolvedValue();
|
||||||
|
String name = pathEntryValue.getName();
|
||||||
|
|
||||||
int flags = ICSettingEntry.RESOLVED;
|
int flags = ICSettingEntry.RESOLVED;
|
||||||
if (entry.isReadOnly())
|
if (entry.isReadOnly())
|
||||||
flags |= ICSettingEntry.READONLY;
|
flags |= ICSettingEntry.READONLY;
|
||||||
if (entry.isBuiltIn())
|
if (entry.isBuiltIn())
|
||||||
flags |= ICSettingEntry.BUILTIN;
|
flags |= ICSettingEntry.BUILTIN;
|
||||||
|
|
||||||
switch (entry.fEntry.getEntryKind()) {
|
IPath path = pathEntryValue.getFullPath();
|
||||||
case IPathEntry.CDT_LIBRARY:{
|
if (path != null) {
|
||||||
ILibraryEntry libEntry = (ILibraryEntry)entry.fEntry;
|
flags |= ICSettingEntry.VALUE_WORKSPACE_PATH;
|
||||||
IPath path = value.getFullPath();
|
} else {
|
||||||
if (path != null) {
|
path = pathEntryValue.getLocation();
|
||||||
flags |= ICSettingEntry.VALUE_WORKSPACE_PATH;
|
}
|
||||||
} else {
|
|
||||||
path = value.getLocation();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
int kind = entry.fEntry.getEntryKind();
|
||||||
|
switch (kind) {
|
||||||
|
case IPathEntry.CDT_LIBRARY:{
|
||||||
if (path != null) {
|
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.getSourceAttachmentPath(),
|
||||||
libEntry.getSourceAttachmentRootPath(),
|
libEntry.getSourceAttachmentRootPath(),
|
||||||
libEntry.getSourceAttachmentPrefixMapping());
|
libEntry.getSourceAttachmentPrefixMapping());
|
||||||
|
@ -331,52 +329,30 @@ public class PathEntryTranslator {
|
||||||
// case IPathEntry.CDT_SOURCE:
|
// case IPathEntry.CDT_SOURCE:
|
||||||
// return INDEX_CDT_SOURCE;
|
// return INDEX_CDT_SOURCE;
|
||||||
case IPathEntry.CDT_INCLUDE:{
|
case IPathEntry.CDT_INCLUDE:{
|
||||||
IPath path = value.getFullPath();
|
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
flags |= ICSettingEntry.VALUE_WORKSPACE_PATH;
|
return CDataUtil.createCIncludePathEntry(name, flags);
|
||||||
} else {
|
|
||||||
path = value.getLocation();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (path != null) {
|
|
||||||
return new CIncludePathEntry(value.getName(), flags);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// case IPathEntry.CDT_CONTAINER:
|
// case IPathEntry.CDT_CONTAINER:
|
||||||
// return INDEX_CDT_CONTAINER;
|
// return INDEX_CDT_CONTAINER;
|
||||||
case IPathEntry.CDT_MACRO:
|
case IPathEntry.CDT_MACRO:
|
||||||
String name = value.getName();
|
|
||||||
if (name.length() != 0) {
|
if (name.length() != 0) {
|
||||||
String mValue = value.getValue();
|
String value = pathEntryValue.getValue();
|
||||||
return new CMacroEntry(name, mValue, flags);
|
return CDataUtil.createCMacroEntry(name, value, flags);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// case IPathEntry.CDT_OUTPUT:
|
// case IPathEntry.CDT_OUTPUT:
|
||||||
// return INDEX_CDT_OUTPUT;
|
// return INDEX_CDT_OUTPUT;
|
||||||
case IPathEntry.CDT_INCLUDE_FILE:{
|
case IPathEntry.CDT_INCLUDE_FILE:{
|
||||||
IPath path = value.getFullPath();
|
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
flags |= ICSettingEntry.VALUE_WORKSPACE_PATH;
|
return CDataUtil.createCIncludeFileEntry(name, flags);
|
||||||
} else {
|
|
||||||
path = value.getLocation();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (path != null) {
|
|
||||||
return new CIncludeFileEntry(value.getName(), flags);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IPathEntry.CDT_MACRO_FILE:{
|
case IPathEntry.CDT_MACRO_FILE:{
|
||||||
IPath path = value.getFullPath();
|
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
flags |= ICSettingEntry.VALUE_WORKSPACE_PATH;
|
return CDataUtil.createCMacroFileEntry(name, flags);
|
||||||
} else {
|
|
||||||
path = value.getLocation();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (path != null) {
|
|
||||||
return new CMacroFileEntry(value.getName(), flags);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,28 +19,28 @@ import org.xml.sax.ContentHandler;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.helpers.AttributesImpl;
|
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.ICLanguageSetting;
|
||||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
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.CDTSharedImages;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A settings processor that imports and exports include paths.
|
* A settings processor that imports and exports include paths.
|
||||||
*
|
*
|
||||||
* @author Mike Kucera
|
* @author Mike Kucera
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class IncludePathsSettingsProcessor extends SettingsProcessor {
|
public class IncludePathsSettingsProcessor extends SettingsProcessor {
|
||||||
|
|
||||||
private static final String SECTION_NAME = "org.eclipse.cdt.internal.ui.wizards.settingswizards.IncludePaths"; //$NON-NLS-1$
|
private static final String SECTION_NAME = "org.eclipse.cdt.internal.ui.wizards.settingswizards.IncludePaths"; //$NON-NLS-1$
|
||||||
private static final String INCLUDE_PATH_ELEMENT = "includepath"; //$NON-NLS-1$
|
private static final String INCLUDE_PATH_ELEMENT = "includepath"; //$NON-NLS-1$
|
||||||
private static final String WORKSPACE_PATH_ATTR = "workspace_path"; //$NON-NLS-1$
|
private static final String WORKSPACE_PATH_ATTR = "workspace_path"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Image getIcon() {
|
public Image getIcon() {
|
||||||
return CUIPlugin.getImageDescriptorRegistry().get(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_OBJS_INCLUDES_FOLDER));
|
return CUIPlugin.getImageDescriptorRegistry().get(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_OBJS_INCLUDES_FOLDER));
|
||||||
|
@ -50,7 +50,7 @@ public class IncludePathsSettingsProcessor extends SettingsProcessor {
|
||||||
public String getDisplayName() {
|
public String getDisplayName() {
|
||||||
return Messages.ProjectSettingsWizardPage_Processor_Includes;
|
return Messages.ProjectSettingsWizardPage_Processor_Includes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSectionName() {
|
public String getSectionName() {
|
||||||
return SECTION_NAME;
|
return SECTION_NAME;
|
||||||
|
@ -60,11 +60,11 @@ public class IncludePathsSettingsProcessor extends SettingsProcessor {
|
||||||
protected int getSettingsType() {
|
protected int getSettingsType() {
|
||||||
return ICSettingEntry.INCLUDE_PATH;
|
return ICSettingEntry.INCLUDE_PATH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeSettings(ContentHandler content, ICLanguageSettingEntry setting) throws SettingsImportExportException {
|
protected void writeSettings(ContentHandler content, ICLanguageSettingEntry setting) throws SettingsImportExportException {
|
||||||
char[] value = setting.getValue().toCharArray();
|
char[] value = setting.getValue().toCharArray();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
AttributesImpl attrib = null;
|
AttributesImpl attrib = null;
|
||||||
if( (setting.getFlags() & ICSettingEntry.VALUE_WORKSPACE_PATH) > 0 ) {
|
if( (setting.getFlags() & ICSettingEntry.VALUE_WORKSPACE_PATH) > 0 ) {
|
||||||
|
@ -75,17 +75,17 @@ public class IncludePathsSettingsProcessor extends SettingsProcessor {
|
||||||
content.characters(value, 0, value.length);
|
content.characters(value, 0, value.length);
|
||||||
content.endElement(NONE, NONE, INCLUDE_PATH_ELEMENT);
|
content.endElement(NONE, NONE, INCLUDE_PATH_ELEMENT);
|
||||||
newline(content);
|
newline(content);
|
||||||
|
|
||||||
} catch (SAXException e) {
|
} catch (SAXException e) {
|
||||||
throw new SettingsImportExportException(e);
|
throw new SettingsImportExportException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void readSettings(ICLanguageSetting setting, Element language) throws SettingsImportExportException {
|
protected void readSettings(ICLanguageSetting setting, Element language) throws SettingsImportExportException {
|
||||||
List<ICLanguageSettingEntry> includes = new ArrayList<ICLanguageSettingEntry>();
|
List<ICLanguageSettingEntry> includes = new ArrayList<ICLanguageSettingEntry>();
|
||||||
|
|
||||||
List<Element> includeNodes = XMLUtils.extractChildElements(language, INCLUDE_PATH_ELEMENT);
|
List<Element> includeNodes = XMLUtils.extractChildElements(language, INCLUDE_PATH_ELEMENT);
|
||||||
for(Element includeElement : includeNodes) {
|
for(Element includeElement : includeNodes) {
|
||||||
String include = includeElement.getTextContent();
|
String include = includeElement.getTextContent();
|
||||||
|
@ -93,13 +93,13 @@ public class IncludePathsSettingsProcessor extends SettingsProcessor {
|
||||||
if(include != null && include.length() > 0) {
|
if(include != null && include.length() > 0) {
|
||||||
if( includeElement.getAttribute(WORKSPACE_PATH_ATTR).equalsIgnoreCase(Boolean.TRUE.toString()) )
|
if( includeElement.getAttribute(WORKSPACE_PATH_ATTR).equalsIgnoreCase(Boolean.TRUE.toString()) )
|
||||||
flags |= ICSettingEntry.VALUE_WORKSPACE_PATH;
|
flags |= ICSettingEntry.VALUE_WORKSPACE_PATH;
|
||||||
includes.add(new CIncludePathEntry(include, flags));
|
includes.add(CDataUtil.createCIncludePathEntry(include, flags));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(includes.isEmpty())
|
if(includes.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// need to do this or existing settings will disappear
|
// need to do this or existing settings will disappear
|
||||||
includes.addAll(setting.getSettingEntriesList(ICSettingEntry.INCLUDE_PATH));
|
includes.addAll(setting.getSettingEntriesList(ICSettingEntry.INCLUDE_PATH));
|
||||||
setting.setSettingEntries(ICSettingEntry.INCLUDE_PATH, includes);
|
setting.setSettingEntries(ICSettingEntry.INCLUDE_PATH, includes);
|
||||||
|
|
|
@ -22,29 +22,29 @@ import org.w3c.dom.Text;
|
||||||
import org.xml.sax.ContentHandler;
|
import org.xml.sax.ContentHandler;
|
||||||
import org.xml.sax.SAXException;
|
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.ICLanguageSetting;
|
||||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
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.CDTSharedImages;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A settings processor that imports and exports symbols.
|
* A settings processor that imports and exports symbols.
|
||||||
*
|
*
|
||||||
* @author Mike Kucera
|
* @author Mike Kucera
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class MacroSettingsProcessor extends SettingsProcessor {
|
public class MacroSettingsProcessor extends SettingsProcessor {
|
||||||
|
|
||||||
public static final String SECTION_NAME = "org.eclipse.cdt.internal.ui.wizards.settingswizards.Macros"; //$NON-NLS-1$
|
public static final String SECTION_NAME = "org.eclipse.cdt.internal.ui.wizards.settingswizards.Macros"; //$NON-NLS-1$
|
||||||
|
|
||||||
private static final String MACRO_ELEMENT = "macro"; //$NON-NLS-1$
|
private static final String MACRO_ELEMENT = "macro"; //$NON-NLS-1$
|
||||||
private static final String NAME_ELEMENT = "name"; //$NON-NLS-1$
|
private static final String NAME_ELEMENT = "name"; //$NON-NLS-1$
|
||||||
private static final String VALUE_ELEMENT = "value"; //$NON-NLS-1$
|
private static final String VALUE_ELEMENT = "value"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Image getIcon() {
|
public Image getIcon() {
|
||||||
return CUIPlugin.getImageDescriptorRegistry().get(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_OBJS_MACRO));
|
return CUIPlugin.getImageDescriptorRegistry().get(CDTSharedImages.getImageDescriptor(CDTSharedImages.IMG_OBJS_MACRO));
|
||||||
|
@ -64,44 +64,44 @@ public class MacroSettingsProcessor extends SettingsProcessor {
|
||||||
protected int getSettingsType() {
|
protected int getSettingsType() {
|
||||||
return ICSettingEntry.MACRO;
|
return ICSettingEntry.MACRO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void writeSettings(ContentHandler content, ICLanguageSettingEntry setting) throws SettingsImportExportException {
|
protected void writeSettings(ContentHandler content, ICLanguageSettingEntry setting) throws SettingsImportExportException {
|
||||||
char[] name = setting.getName().toCharArray();
|
char[] name = setting.getName().toCharArray();
|
||||||
char[] value = setting.getValue().toCharArray();
|
char[] value = setting.getValue().toCharArray();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
content.startElement(NONE, NONE, MACRO_ELEMENT, null);
|
content.startElement(NONE, NONE, MACRO_ELEMENT, null);
|
||||||
newline(content);
|
newline(content);
|
||||||
|
|
||||||
content.startElement(NONE, NONE, NAME_ELEMENT, null);
|
content.startElement(NONE, NONE, NAME_ELEMENT, null);
|
||||||
content.characters(name, 0, name.length);
|
content.characters(name, 0, name.length);
|
||||||
content.endElement(NONE, NONE, NAME_ELEMENT);
|
content.endElement(NONE, NONE, NAME_ELEMENT);
|
||||||
|
|
||||||
content.startElement(NONE, NONE, VALUE_ELEMENT, null);
|
content.startElement(NONE, NONE, VALUE_ELEMENT, null);
|
||||||
content.characters(value, 0, value.length);
|
content.characters(value, 0, value.length);
|
||||||
content.endElement(NONE, NONE, VALUE_ELEMENT);
|
content.endElement(NONE, NONE, VALUE_ELEMENT);
|
||||||
newline(content);
|
newline(content);
|
||||||
|
|
||||||
content.endElement(NONE, NONE, MACRO_ELEMENT);
|
content.endElement(NONE, NONE, MACRO_ELEMENT);
|
||||||
newline(content);
|
newline(content);
|
||||||
|
|
||||||
} catch(SAXException e) {
|
} catch(SAXException e) {
|
||||||
throw new SettingsImportExportException(e);
|
throw new SettingsImportExportException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void readSettings(ICLanguageSetting setting, Element language) throws SettingsImportExportException {
|
protected void readSettings(ICLanguageSetting setting, Element language) throws SettingsImportExportException {
|
||||||
List<ICLanguageSettingEntry> macros = new ArrayList<ICLanguageSettingEntry>();
|
List<ICLanguageSettingEntry> macros = new ArrayList<ICLanguageSettingEntry>();
|
||||||
|
|
||||||
List<Element> macrosNodes = XMLUtils.extractChildElements(language, MACRO_ELEMENT);
|
List<Element> macrosNodes = XMLUtils.extractChildElements(language, MACRO_ELEMENT);
|
||||||
|
|
||||||
for(Element macroElement : macrosNodes) {
|
for(Element macroElement : macrosNodes) {
|
||||||
String name = null;
|
String name = null;
|
||||||
String value = null;
|
String value = null;
|
||||||
|
|
||||||
NodeList nodeList = macroElement.getChildNodes();
|
NodeList nodeList = macroElement.getChildNodes();
|
||||||
for(int i = 0; i < nodeList.getLength(); i++) {
|
for(int i = 0; i < nodeList.getLength(); i++) {
|
||||||
Node node = nodeList.item(i);
|
Node node = nodeList.item(i);
|
||||||
|
@ -125,21 +125,21 @@ public class MacroSettingsProcessor extends SettingsProcessor {
|
||||||
throw new SettingsImportExportException("Unknown node: " + node.getNodeName()); //$NON-NLS-1$
|
throw new SettingsImportExportException("Unknown node: " + node.getNodeName()); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(name == null)
|
if(name == null)
|
||||||
throw new SettingsImportExportException("There must be one <name> element"); //$NON-NLS-1$
|
throw new SettingsImportExportException("There must be one <name> element"); //$NON-NLS-1$
|
||||||
if(value == null)
|
if(value == null)
|
||||||
throw new SettingsImportExportException("There must be one <value> element"); //$NON-NLS-1$
|
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())
|
if(macros.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// need to do this or existing settings will disappear
|
// need to do this or existing settings will disappear
|
||||||
macros.addAll(setting.getSettingEntriesList(ICSettingEntry.MACRO));
|
macros.addAll(setting.getSettingEntriesList(ICSettingEntry.MACRO));
|
||||||
setting.setSettingEntries(ICSettingEntry.MACRO, macros);
|
setting.setSettingEntries(ICSettingEntry.MACRO, macros);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.ui.newui;
|
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.ICLanguageSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
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.
|
* @noextend This class is not intended to be subclassed by clients.
|
||||||
|
@ -25,7 +25,7 @@ public class ExpIncludeFileTab extends AbstractExportTab {
|
||||||
@Override
|
@Override
|
||||||
public ICLanguageSettingEntry doAdd(String s1, String s2, boolean isWsp) {
|
public ICLanguageSettingEntry doAdd(String s1, String s2, boolean isWsp) {
|
||||||
int flags = isWsp ? ICSettingEntry.VALUE_WORKSPACE_PATH : 0;
|
int flags = isWsp ? ICSettingEntry.VALUE_WORKSPACE_PATH : 0;
|
||||||
return new CIncludeFileEntry(s2, flags);
|
return CDataUtil.createCIncludeFileEntry(s2, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,26 +10,26 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.ui.newui;
|
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.ICLanguageSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
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.
|
* @noextend This class is not intended to be subclassed by clients.
|
||||||
*/
|
*/
|
||||||
public class ExpIncludeTab extends AbstractExportTab {
|
public class ExpIncludeTab extends AbstractExportTab {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICLanguageSettingEntry doAdd(String s1, String s2, boolean isWsp) {
|
public ICLanguageSettingEntry doAdd(String s1, String s2, boolean isWsp) {
|
||||||
int flags = isWsp ? ICSettingEntry.VALUE_WORKSPACE_PATH : 0;
|
int flags = isWsp ? ICSettingEntry.VALUE_WORKSPACE_PATH : 0;
|
||||||
return new CIncludePathEntry(s2, flags);
|
return CDataUtil.createCIncludePathEntry(s2, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICLanguageSettingEntry doEdit(String s1, String s2, boolean isWsp) {
|
public ICLanguageSettingEntry doEdit(String s1, String s2, boolean isWsp) {
|
||||||
return doAdd(s1, s2, isWsp);
|
return doAdd(s1, s2, isWsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getKind() { return ICSettingEntry.INCLUDE_PATH; }
|
public int getKind() { return ICSettingEntry.INCLUDE_PATH; }
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.ui.newui;
|
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.ICLanguageSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
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.
|
* @noextend This class is not intended to be subclassed by clients.
|
||||||
|
@ -22,14 +22,14 @@ public class ExpSymbolTab extends AbstractExportTab {
|
||||||
// isWsp is ignored for symbols
|
// isWsp is ignored for symbols
|
||||||
@Override
|
@Override
|
||||||
public ICLanguageSettingEntry doAdd(String s1, String s2, boolean isWsp) {
|
public ICLanguageSettingEntry doAdd(String s1, String s2, boolean isWsp) {
|
||||||
return new CMacroEntry(s1, s2, 0);
|
return CDataUtil.createCMacroEntry(s1, s2, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICLanguageSettingEntry doEdit(String s1, String s2, boolean isWsp) {
|
public ICLanguageSettingEntry doEdit(String s1, String s2, boolean isWsp) {
|
||||||
return doAdd(s1, s2, isWsp);
|
return doAdd(s1, s2, isWsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getKind() { return ICSettingEntry.MACRO; }
|
public int getKind() { return ICSettingEntry.MACRO; }
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -18,9 +18,9 @@ import org.eclipse.swt.accessibility.AccessibleEvent;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.TableColumn;
|
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.ICLanguageSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
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;
|
import org.eclipse.cdt.internal.ui.newui.Messages;
|
||||||
|
|
||||||
|
@ -40,13 +40,13 @@ public class IncludeFileTab extends AbstractLangsListTab {
|
||||||
@Override
|
@Override
|
||||||
public void additionalTableSet() {
|
public void additionalTableSet() {
|
||||||
columnToFit = new TableColumn(table, SWT.NONE);
|
columnToFit = new TableColumn(table, SWT.NONE);
|
||||||
columnToFit.setText(Messages.IncludeFileTab_0);
|
columnToFit.setText(Messages.IncludeFileTab_0);
|
||||||
columnToFit.setToolTipText(Messages.IncludeFileTab_0);
|
columnToFit.setToolTipText(Messages.IncludeFileTab_0);
|
||||||
showBIButton.setSelection(true);
|
showBIButton.setSelection(true);
|
||||||
table.getAccessible().addAccessibleListener(new AccessibleAdapter() {
|
table.getAccessible().addAccessibleListener(new AccessibleAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void getName(AccessibleEvent e) {
|
public void getName(AccessibleEvent e) {
|
||||||
e.result = Messages.IncludeFileTab_0;
|
e.result = Messages.IncludeFileTab_0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ public class IncludeFileTab extends AbstractLangsListTab {
|
||||||
if (dlg.check2) { // isWsp
|
if (dlg.check2) { // isWsp
|
||||||
flags = ICSettingEntry.VALUE_WORKSPACE_PATH;
|
flags = ICSettingEntry.VALUE_WORKSPACE_PATH;
|
||||||
}
|
}
|
||||||
return new CIncludeFileEntry(dlg.text1, flags);
|
return CDataUtil.createCIncludeFileEntry(dlg.text1, flags);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ public class IncludeFileTab extends AbstractLangsListTab {
|
||||||
IncludeDialog dlg = new IncludeDialog(
|
IncludeDialog dlg = new IncludeDialog(
|
||||||
usercomp.getShell(),
|
usercomp.getShell(),
|
||||||
IncludeDialog.OLD_FILE,
|
IncludeDialog.OLD_FILE,
|
||||||
Messages.IncludeFileTab_2,
|
Messages.IncludeFileTab_2,
|
||||||
ent.getValue(),
|
ent.getValue(),
|
||||||
getResDesc().getConfiguration(),
|
getResDesc().getConfiguration(),
|
||||||
ent.getFlags() & ICSettingEntry.VALUE_WORKSPACE_PATH,
|
ent.getFlags() & ICSettingEntry.VALUE_WORKSPACE_PATH,
|
||||||
|
@ -87,7 +87,7 @@ public class IncludeFileTab extends AbstractLangsListTab {
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
if (dlg.check2)
|
if (dlg.check2)
|
||||||
flags = ICSettingEntry.VALUE_WORKSPACE_PATH;
|
flags = ICSettingEntry.VALUE_WORKSPACE_PATH;
|
||||||
return new CIncludeFileEntry(dlg.text1, flags);
|
return CDataUtil.createCIncludeFileEntry(dlg.text1, flags);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,9 +17,9 @@ import org.eclipse.swt.accessibility.AccessibleEvent;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.TableColumn;
|
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.ICLanguageSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
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;
|
import org.eclipse.cdt.internal.ui.newui.Messages;
|
||||||
|
|
||||||
|
@ -27,28 +27,28 @@ import org.eclipse.cdt.internal.ui.newui.Messages;
|
||||||
* @noextend This class is not intended to be subclassed by clients.
|
* @noextend This class is not intended to be subclassed by clients.
|
||||||
*/
|
*/
|
||||||
public class IncludeTab extends AbstractLangsListTab {
|
public class IncludeTab extends AbstractLangsListTab {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void additionalTableSet() {
|
public void additionalTableSet() {
|
||||||
columnToFit = new TableColumn(table, SWT.NONE);
|
columnToFit = new TableColumn(table, SWT.NONE);
|
||||||
columnToFit.setText(Messages.IncludeTab_0);
|
columnToFit.setText(Messages.IncludeTab_0);
|
||||||
columnToFit.setToolTipText(Messages.IncludeTab_0);
|
columnToFit.setToolTipText(Messages.IncludeTab_0);
|
||||||
showBIButton.setSelection(true);
|
showBIButton.setSelection(true);
|
||||||
table.getAccessible().addAccessibleListener(
|
table.getAccessible().addAccessibleListener(
|
||||||
new AccessibleAdapter() {
|
new AccessibleAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void getName(AccessibleEvent e) {
|
public void getName(AccessibleEvent e) {
|
||||||
e.result = Messages.IncludeTab_0;
|
e.result = Messages.IncludeTab_0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICLanguageSettingEntry doAdd() {
|
public ICLanguageSettingEntry doAdd() {
|
||||||
IncludeDialog dlg = new IncludeDialog(
|
IncludeDialog dlg = new IncludeDialog(
|
||||||
usercomp.getShell(), IncludeDialog.NEW_DIR,
|
usercomp.getShell(), IncludeDialog.NEW_DIR,
|
||||||
Messages.IncludeTab_1,
|
Messages.IncludeTab_1,
|
||||||
EMPTY_STR, getResDesc().getConfiguration(), 0);
|
EMPTY_STR, getResDesc().getConfiguration(), 0);
|
||||||
if (dlg.open() && dlg.text1.trim().length() > 0 ) {
|
if (dlg.open() && dlg.text1.trim().length() > 0 ) {
|
||||||
toAllCfgs = dlg.check1;
|
toAllCfgs = dlg.check1;
|
||||||
|
@ -57,7 +57,7 @@ public void additionalTableSet() {
|
||||||
if (dlg.check2) { // isWsp
|
if (dlg.check2) { // isWsp
|
||||||
flags = ICSettingEntry.VALUE_WORKSPACE_PATH;
|
flags = ICSettingEntry.VALUE_WORKSPACE_PATH;
|
||||||
}
|
}
|
||||||
return new CIncludePathEntry(dlg.text1, flags);
|
return CDataUtil.createCIncludePathEntry(dlg.text1, flags);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -66,21 +66,21 @@ public void additionalTableSet() {
|
||||||
public ICLanguageSettingEntry doEdit(ICLanguageSettingEntry ent) {
|
public ICLanguageSettingEntry doEdit(ICLanguageSettingEntry ent) {
|
||||||
IncludeDialog dlg = new IncludeDialog(
|
IncludeDialog dlg = new IncludeDialog(
|
||||||
usercomp.getShell(), IncludeDialog.OLD_DIR,
|
usercomp.getShell(), IncludeDialog.OLD_DIR,
|
||||||
Messages.IncludeTab_2,
|
Messages.IncludeTab_2,
|
||||||
ent.getValue(), getResDesc().getConfiguration(),
|
ent.getValue(), getResDesc().getConfiguration(),
|
||||||
(ent.getFlags() & ICSettingEntry.VALUE_WORKSPACE_PATH));
|
(ent.getFlags() & ICSettingEntry.VALUE_WORKSPACE_PATH));
|
||||||
if (dlg.open()) {
|
if (dlg.open()) {
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
if (dlg.check2) flags = ICSettingEntry.VALUE_WORKSPACE_PATH;
|
if (dlg.check2) flags = ICSettingEntry.VALUE_WORKSPACE_PATH;
|
||||||
return new CIncludePathEntry(dlg.text1, flags);
|
return CDataUtil.createCIncludePathEntry(dlg.text1, flags);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getKind() { return ICSettingEntry.INCLUDE_PATH; }
|
public int getKind() { return ICSettingEntry.INCLUDE_PATH; }
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createControls(final Composite parent) {
|
public void createControls(final Composite parent) {
|
||||||
super.createControls(parent);
|
super.createControls(parent);
|
||||||
|
|
|
@ -20,9 +20,9 @@ import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.TableColumn;
|
import org.eclipse.swt.widgets.TableColumn;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.util.CDTListComparator;
|
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.ICLanguageSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
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;
|
import org.eclipse.cdt.internal.ui.newui.Messages;
|
||||||
|
|
||||||
|
@ -33,18 +33,18 @@ public class SymbolTab extends AbstractLangsListTab {
|
||||||
@Override
|
@Override
|
||||||
public void additionalTableSet() {
|
public void additionalTableSet() {
|
||||||
TableColumn tc = new TableColumn(table, SWT.LEFT);
|
TableColumn tc = new TableColumn(table, SWT.LEFT);
|
||||||
tc.setText(Messages.SymbolTab_0);
|
tc.setText(Messages.SymbolTab_0);
|
||||||
tc.setWidth(80);
|
tc.setWidth(80);
|
||||||
tc.setToolTipText(Messages.SymbolTab_0);
|
tc.setToolTipText(Messages.SymbolTab_0);
|
||||||
tc = new TableColumn(table, SWT.LEFT);
|
tc = new TableColumn(table, SWT.LEFT);
|
||||||
tc.setText(Messages.SymbolTab_1);
|
tc.setText(Messages.SymbolTab_1);
|
||||||
tc.setWidth(130);
|
tc.setWidth(130);
|
||||||
tc.setToolTipText(Messages.SymbolTab_1);
|
tc.setToolTipText(Messages.SymbolTab_1);
|
||||||
table.getAccessible().addAccessibleListener(
|
table.getAccessible().addAccessibleListener(
|
||||||
new AccessibleAdapter() {
|
new AccessibleAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void getName(AccessibleEvent e) {
|
public void getName(AccessibleEvent e) {
|
||||||
e.result = Messages.SymbolTab_0;
|
e.result = Messages.SymbolTab_0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -54,11 +54,11 @@ public class SymbolTab extends AbstractLangsListTab {
|
||||||
public ICLanguageSettingEntry doAdd() {
|
public ICLanguageSettingEntry doAdd() {
|
||||||
SymbolDialog dlg = new SymbolDialog(
|
SymbolDialog dlg = new SymbolDialog(
|
||||||
usercomp.getShell(), true,
|
usercomp.getShell(), true,
|
||||||
Messages.SymbolTab_2, EMPTY_STR, EMPTY_STR, getResDesc());
|
Messages.SymbolTab_2, EMPTY_STR, EMPTY_STR, getResDesc());
|
||||||
if (dlg.open() && dlg.text1.trim().length() > 0 ) {
|
if (dlg.open() && dlg.text1.trim().length() > 0 ) {
|
||||||
toAllCfgs = dlg.check1;
|
toAllCfgs = dlg.check1;
|
||||||
toAllLang = dlg.check3;
|
toAllLang = dlg.check3;
|
||||||
return new CMacroEntry(dlg.text1, dlg.text2, 0);
|
return CDataUtil.createCMacroEntry(dlg.text1, dlg.text2, 0);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -67,16 +67,16 @@ public class SymbolTab extends AbstractLangsListTab {
|
||||||
public ICLanguageSettingEntry doEdit(ICLanguageSettingEntry ent) {
|
public ICLanguageSettingEntry doEdit(ICLanguageSettingEntry ent) {
|
||||||
SymbolDialog dlg = new SymbolDialog(
|
SymbolDialog dlg = new SymbolDialog(
|
||||||
usercomp.getShell(), false,
|
usercomp.getShell(), false,
|
||||||
Messages.SymbolTab_3, ent.getName(),
|
Messages.SymbolTab_3, ent.getName(),
|
||||||
ent.getValue(), getResDesc());
|
ent.getValue(), getResDesc());
|
||||||
if (dlg.open())
|
if (dlg.open())
|
||||||
return new CMacroEntry(dlg.text1, dlg.text2, 0);
|
return CDataUtil.createCMacroEntry(dlg.text1, dlg.text2, 0);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getKind() {
|
public int getKind() {
|
||||||
return ICSettingEntry.MACRO;
|
return ICSettingEntry.MACRO;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Specific version of "update()" for Symbols tab only
|
// Specific version of "update()" for Symbols tab only
|
||||||
|
@ -84,21 +84,21 @@ public class SymbolTab extends AbstractLangsListTab {
|
||||||
public void update() {
|
public void update() {
|
||||||
if (lang != null) {
|
if (lang != null) {
|
||||||
int x = table.getSelectionIndex();
|
int x = table.getSelectionIndex();
|
||||||
if (x == -1)
|
if (x == -1)
|
||||||
x = 0;
|
x = 0;
|
||||||
shownEntries = getIncs();
|
shownEntries = getIncs();
|
||||||
Collections.sort(shownEntries, CDTListComparator.getInstance());
|
Collections.sort(shownEntries, CDTListComparator.getInstance());
|
||||||
tv.setInput(shownEntries.toArray(new Object[shownEntries.size()]));
|
tv.setInput(shownEntries.toArray(new Object[shownEntries.size()]));
|
||||||
if (table.getItemCount() > x)
|
if (table.getItemCount() > x)
|
||||||
table.setSelection(x);
|
table.setSelection(x);
|
||||||
else if (table.getItemCount() > 0)
|
else if (table.getItemCount() > 0)
|
||||||
table.setSelection(0);
|
table.setSelection(0);
|
||||||
}
|
}
|
||||||
updateStringListModeControl();
|
updateStringListModeControl();
|
||||||
updateButtons();
|
updateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createControls(final Composite parent) {
|
public void createControls(final Composite parent) {
|
||||||
super.createControls(parent);
|
super.createControls(parent);
|
||||||
|
|
|
@ -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.ICProjectDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
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.MakeCorePlugin;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager;
|
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
|
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 we didn't find the path, add it
|
||||||
if(!symbolFound) {
|
if(!symbolFound) {
|
||||||
entriesChanged = true;
|
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);
|
newEntries.add(newEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -216,7 +217,6 @@ public class PerFileXLCScannerInfoCollector implements IScannerInfoCollector3, I
|
||||||
newEntries.add(entry);
|
newEntries.add(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
boolean entriesChanged = false;
|
boolean entriesChanged = false;
|
||||||
|
|
||||||
// look for settings corresponding to each path we discovered
|
// 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 we didn't find the path, add it
|
||||||
if(!pathFound) {
|
if(!pathFound) {
|
||||||
entriesChanged = true;
|
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);
|
newEntries.add(newEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue