Class CDataUtil
- java.lang.Object
-
- org.eclipse.cdt.core.settings.model.util.CDataUtil
-
public class CDataUtil extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String[]EMPTY_STRING_ARRAY
-
Constructor Summary
Constructors Constructor Description CDataUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static ICSourceEntryaddExcludePaths(ICSourceEntry entry, java.util.Collection<org.eclipse.core.runtime.IPath> paths, boolean removePrefix)static ICExclusionPatternPathEntryaddRemoveExclusionsToEntry(ICExclusionPatternPathEntry entry, org.eclipse.core.runtime.IPath[] paths, boolean add)static CConfigurationDataadjustConfig(CConfigurationData cfg, CDataFactory factory)static ICOutputEntry[]adjustEntries(ICOutputEntry[] entries, boolean makeAbsolute, org.eclipse.core.resources.IProject project)static ICSourceEntry[]adjustEntries(ICSourceEntry[] entries)static ICSourceEntry[]adjustEntries(ICSourceEntry[] entries, boolean makeAbsolute, org.eclipse.core.resources.IProject project)static java.lang.StringarrayToString(java.lang.Object[] array, java.lang.String separator)static java.lang.StringarrayToString(java.lang.String[] array, java.lang.String separator)static booleancanExclude(org.eclipse.core.runtime.IPath path, boolean isFolder, boolean excluded, ICSourceEntry[] entries)static CIncludeFileEntrycreateCIncludeFileEntry(java.lang.String name, int flags)Utility method to createCIncludeFileEntry.static CIncludePathEntrycreateCIncludePathEntry(java.lang.String name, int flags)Utility method to createCIncludePathEntry.static CLibraryFileEntrycreateCLibraryFileEntry(java.lang.String name, int flags)Utility method to createCLibraryFileEntry.static CLibraryPathEntrycreateCLibraryPathEntry(java.lang.String name, int flags)Utility method to createCLibraryPathEntry.static CMacroEntrycreateCMacroEntry(java.lang.String name, java.lang.String value, int flags)Utility method to createCMacroEntry.static CMacroFileEntrycreateCMacroFileEntry(java.lang.String name, int flags)Utility method to createCMacroFileEntry.static CConfigurationDatacreateEmptyData(java.lang.String id, java.lang.String name, CDataFactory factory, boolean performLangAdjustment)static ICSettingEntrycreateEntry(int kind, java.lang.String name, java.lang.String value, org.eclipse.core.runtime.IPath[] exclusionPatterns, int flags)Convenience method to createICSettingEntrydepending on kind.static ICSettingEntrycreateEntry(int kind, java.lang.String name, java.lang.String value, org.eclipse.core.runtime.IPath[] exclusionPatterns, int flags, org.eclipse.core.runtime.IPath sourceAttachmentPath, org.eclipse.core.runtime.IPath sourceAttachmentRootPath, org.eclipse.core.runtime.IPath sourceAttachmentPrefixMapping)Convenience method to createICSettingEntrydepending on kind.static ICLanguageSettingEntrycreateEntry(ICLanguageSettingEntry entry, int flags)Convenience method to cloneICLanguageSettingEntrywith different flags.static ICLanguageSettingEntrycreateEntry(ICLanguageSettingEntry entry, int flagsToAdd, int flafsToClear)Convenience method to cloneICLanguageSettingEntrywith modified flags.static java.util.Map<org.eclipse.core.runtime.IPath,CResourceData>createPathRcDataMap(CConfigurationData data)static PathSettingsContainercreateRcDataHolder(CConfigurationData data)static java.util.Map<EntryContentsKey,ICSettingEntry>fillEntriesMapByContentsKey(java.util.Map<EntryContentsKey,ICSettingEntry> map, ICSettingEntry[] entries)static java.util.Map<EntryNameKey,ICSettingEntry>fillEntriesMapByNameKey(java.util.Map<EntryNameKey,ICSettingEntry> map, ICSettingEntry[] entries)static CLanguageDatafindLanguagDataForFile(java.lang.String fileName, org.eclipse.core.resources.IProject project, CFolderData fData)static CLanguageDatafindLanguagDataForFile(java.lang.String fileName, org.eclipse.core.resources.IProject project, CLanguageData[] datas)static CLanguageDatafindLanguageDataForExtension(java.lang.String ext, CLanguageData[] datas)static java.lang.StringgenId(java.lang.String baseId)static intgenRandomNumber()static booleangetBoolean(ICStorageElement el, java.lang.String attr, boolean defaultValue)static java.lang.String[]getContentTypeFileSpecs(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.content.IContentType type)static java.lang.String[]getExtensionsFromContentTypes(org.eclipse.core.resources.IProject project, java.lang.String[] typeIds)static intgetInteger(ICStorageElement el, java.lang.String attr, int defaultValue)static <T extends ICSettingEntry>
TgetPooledEntry(T entry)Return entry cached in setting entries pool to optimize for memory usage.static java.lang.String[]getSourceExtensions(org.eclipse.core.resources.IProject project, CLanguageData data)static booleanisEqual(ICSourceEntry[] ein, ICSourceEntry[] aus)static booleanisExcluded(org.eclipse.core.runtime.IPath path, ICSourceEntry entry)static booleanisExcluded(org.eclipse.core.runtime.IPath path, ICSourceEntry[] entries)static booleanisOnSourceEntry(org.eclipse.core.runtime.IPath path, ICSourceEntry entry)static ICExclusionPatternPathEntry[]makeAbsolute(org.eclipse.core.resources.IProject project, ICExclusionPatternPathEntry[] entries, boolean force)static ICExclusionPatternPathEntrymakeAbsolute(org.eclipse.core.resources.IProject project, ICExclusionPatternPathEntry entry, boolean force)static ICOutputEntrymakeAbsolute(org.eclipse.core.resources.IProject project, ICOutputEntry entry)static ICOutputEntry[]makeAbsolute(org.eclipse.core.resources.IProject project, ICOutputEntry[] entries)static ICSourceEntrymakeAbsolute(org.eclipse.core.resources.IProject project, ICSourceEntry entry)static ICSourceEntry[]makeAbsolute(org.eclipse.core.resources.IProject project, ICSourceEntry[] entries)static ICExclusionPatternPathEntry[]makeRelative(org.eclipse.core.resources.IProject project, ICExclusionPatternPathEntry[] entries, boolean force)static ICExclusionPatternPathEntrymakeRelative(org.eclipse.core.resources.IProject project, ICExclusionPatternPathEntry entry, boolean force)static ICOutputEntrymakeRelative(org.eclipse.core.resources.IProject project, ICOutputEntry entry)static ICOutputEntry[]makeRelative(org.eclipse.core.resources.IProject project, ICOutputEntry[] entries)static ICSourceEntrymakeRelative(org.eclipse.core.resources.IProject project, ICSourceEntry entry)static ICSourceEntry[]makeRelative(org.eclipse.core.resources.IProject project, ICSourceEntry[] entries)static booleanobjectsEqual(java.lang.Object o1, java.lang.Object o2)Deprecated.UseObject.equals(Object)static ICLanguageSettingEntry[]resolveEntries(ICLanguageSettingEntry[] entries, ICConfigurationDescription cfgDes)static ICOutputEntry[]resolveEntries(ICOutputEntry[] entries, ICConfigurationDescription cfgDes)static ICSettingEntry[]resolveEntries(ICSettingEntry[] entries, ICConfigurationDescription cfgDes)static ICSourceEntry[]resolveEntries(ICSourceEntry[] entries, ICConfigurationDescription cfgDes)static voidsetBoolean(ICStorageElement el, java.lang.String attr, boolean value)static ICSourceEntry[]setExcluded(org.eclipse.core.runtime.IPath path, boolean isFolder, boolean excluded, ICSourceEntry[] entries)static ICSourceEntry[]setExcluded(org.eclipse.core.runtime.IPath path, boolean isFolder, boolean excluded, ICSourceEntry[] entries, boolean throwExceptionOnErr)static ICSourceEntry[]setExcludedIfPossible(org.eclipse.core.runtime.IPath path, boolean isFolder, boolean excluded, ICSourceEntry[] entries)static voidsetInteger(ICStorageElement el, java.lang.String attr, int value)static java.lang.String[]stringToArray(java.lang.String string, java.lang.String separator)
-
-
-
Method Detail
-
genRandomNumber
public static int genRandomNumber()
-
genId
public static java.lang.String genId(java.lang.String baseId)
-
objectsEqual
@Deprecated public static boolean objectsEqual(java.lang.Object o1, java.lang.Object o2)Deprecated.UseObject.equals(Object)
-
arrayToString
public static java.lang.String arrayToString(java.lang.String[] array, java.lang.String separator)
-
arrayToString
public static java.lang.String arrayToString(java.lang.Object[] array, java.lang.String separator)
-
stringToArray
public static java.lang.String[] stringToArray(java.lang.String string, java.lang.String separator)
-
resolveEntries
public static ICSettingEntry[] resolveEntries(ICSettingEntry[] entries, ICConfigurationDescription cfgDes)
-
resolveEntries
public static ICLanguageSettingEntry[] resolveEntries(ICLanguageSettingEntry[] entries, ICConfigurationDescription cfgDes)
-
resolveEntries
public static ICSourceEntry[] resolveEntries(ICSourceEntry[] entries, ICConfigurationDescription cfgDes)
-
resolveEntries
public static ICOutputEntry[] resolveEntries(ICOutputEntry[] entries, ICConfigurationDescription cfgDes)
-
getPooledEntry
public static <T extends ICSettingEntry> T getPooledEntry(T entry)
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
-
createEntry
public static ICLanguageSettingEntry createEntry(ICLanguageSettingEntry entry, int flagsToAdd, int flafsToClear)
Convenience method to cloneICLanguageSettingEntrywith modified flags. Note that this method keeps the entries in the pool to avoid proliferation of duplicates.- Parameters:
entry- - source entry.flagsToAdd- - binary combination of bits to add to the flags.flafsToClear- - binary combination of bits to clear in the flags.- Returns:
- new entry with the modified flags.
-
createEntry
public static ICLanguageSettingEntry createEntry(ICLanguageSettingEntry entry, int flags)
Convenience method to cloneICLanguageSettingEntrywith different flags. Note that this method keeps the entries in the pool to avoid proliferation of duplicates.- Parameters:
entry- - source entry.flags- - new flags.- Returns:
- new entry with the specified flags.
-
createEntry
public static ICSettingEntry createEntry(int kind, java.lang.String name, java.lang.String value, org.eclipse.core.runtime.IPath[] exclusionPatterns, int flags)
Convenience method to createICSettingEntrydepending on kind. Note that this method keeps the entries in the pool to avoid proliferation of duplicates.
-
createEntry
public static ICSettingEntry createEntry(int kind, java.lang.String name, java.lang.String value, org.eclipse.core.runtime.IPath[] exclusionPatterns, int flags, org.eclipse.core.runtime.IPath sourceAttachmentPath, org.eclipse.core.runtime.IPath sourceAttachmentRootPath, org.eclipse.core.runtime.IPath sourceAttachmentPrefixMapping)
Convenience method to createICSettingEntrydepending on kind. Note that this method keeps the entries in the pool to avoid proliferation of duplicates.
-
createCIncludePathEntry
public static CIncludePathEntry createCIncludePathEntry(java.lang.String name, int flags)
Utility method to createCIncludePathEntry. Note that this method keeps the entries in the pool to avoid proliferation of duplicates.- Since:
- 5.4
-
createCIncludeFileEntry
public static CIncludeFileEntry createCIncludeFileEntry(java.lang.String name, int flags)
Utility method to createCIncludeFileEntry. Note that this method keeps the entries in the pool to avoid proliferation of duplicates.- Since:
- 5.4
-
createCMacroEntry
public static CMacroEntry createCMacroEntry(java.lang.String name, java.lang.String value, int flags)
Utility method to createCMacroEntry. Note that this method keeps the entries in the pool to avoid proliferation of duplicates.- Since:
- 5.4
-
createCMacroFileEntry
public static CMacroFileEntry createCMacroFileEntry(java.lang.String name, int flags)
Utility method to createCMacroFileEntry. Note that this method keeps the entries in the pool to avoid proliferation of duplicates.- Since:
- 5.4
-
createCLibraryPathEntry
public static CLibraryPathEntry createCLibraryPathEntry(java.lang.String name, int flags)
Utility method to createCLibraryPathEntry. Note that this method keeps the entries in the pool to avoid proliferation of duplicates.- Since:
- 5.4
-
createCLibraryFileEntry
public static CLibraryFileEntry createCLibraryFileEntry(java.lang.String name, int flags)
Utility method to createCLibraryFileEntry. Note that this method keeps the entries in the pool to avoid proliferation of duplicates.- Since:
- 5.4
-
getSourceExtensions
public static java.lang.String[] getSourceExtensions(org.eclipse.core.resources.IProject project, CLanguageData data)
-
getExtensionsFromContentTypes
public static java.lang.String[] getExtensionsFromContentTypes(org.eclipse.core.resources.IProject project, java.lang.String[] typeIds)
-
getContentTypeFileSpecs
public static java.lang.String[] getContentTypeFileSpecs(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.content.IContentType type)
-
findLanguagDataForFile
public static CLanguageData findLanguagDataForFile(java.lang.String fileName, org.eclipse.core.resources.IProject project, CFolderData fData)
-
findLanguagDataForFile
public static CLanguageData findLanguagDataForFile(java.lang.String fileName, org.eclipse.core.resources.IProject project, CLanguageData[] datas)
-
findLanguageDataForExtension
public static CLanguageData findLanguageDataForExtension(java.lang.String ext, CLanguageData[] datas)
-
createPathRcDataMap
public static java.util.Map<org.eclipse.core.runtime.IPath,CResourceData> createPathRcDataMap(CConfigurationData data)
-
createRcDataHolder
public static PathSettingsContainer createRcDataHolder(CConfigurationData data)
-
createEmptyData
public static CConfigurationData createEmptyData(java.lang.String id, java.lang.String name, CDataFactory factory, boolean performLangAdjustment)
-
adjustConfig
public static CConfigurationData adjustConfig(CConfigurationData cfg, CDataFactory factory)
-
isExcluded
public static boolean isExcluded(org.eclipse.core.runtime.IPath path, ICSourceEntry[] entries)
-
isExcluded
public static boolean isExcluded(org.eclipse.core.runtime.IPath path, ICSourceEntry entry)
-
isOnSourceEntry
public static boolean isOnSourceEntry(org.eclipse.core.runtime.IPath path, ICSourceEntry entry)
-
canExclude
public static boolean canExclude(org.eclipse.core.runtime.IPath path, boolean isFolder, boolean excluded, ICSourceEntry[] entries)
-
isEqual
public static boolean isEqual(ICSourceEntry[] ein, ICSourceEntry[] aus)
- Parameters:
ein- - initial source entriesaus- - resulting source entries- Returns:
- - true if they are equal
-
setExcluded
public static ICSourceEntry[] setExcluded(org.eclipse.core.runtime.IPath path, boolean isFolder, boolean excluded, ICSourceEntry[] entries) throws org.eclipse.core.runtime.CoreException
- Throws:
org.eclipse.core.runtime.CoreException
-
setExcludedIfPossible
public static ICSourceEntry[] setExcludedIfPossible(org.eclipse.core.runtime.IPath path, boolean isFolder, boolean excluded, ICSourceEntry[] entries)
-
setExcluded
public static ICSourceEntry[] setExcluded(org.eclipse.core.runtime.IPath path, boolean isFolder, boolean excluded, ICSourceEntry[] entries, boolean throwExceptionOnErr) throws org.eclipse.core.runtime.CoreException
- Throws:
org.eclipse.core.runtime.CoreException
-
adjustEntries
public static ICSourceEntry[] adjustEntries(ICSourceEntry[] entries)
-
adjustEntries
public static ICOutputEntry[] adjustEntries(ICOutputEntry[] entries, boolean makeAbsolute, org.eclipse.core.resources.IProject project)
-
adjustEntries
public static ICSourceEntry[] adjustEntries(ICSourceEntry[] entries, boolean makeAbsolute, org.eclipse.core.resources.IProject project)
-
makeAbsolute
public static ICSourceEntry makeAbsolute(org.eclipse.core.resources.IProject project, ICSourceEntry entry)
-
makeRelative
public static ICSourceEntry makeRelative(org.eclipse.core.resources.IProject project, ICSourceEntry entry)
-
makeRelative
public static ICSourceEntry[] makeRelative(org.eclipse.core.resources.IProject project, ICSourceEntry[] entries)
-
makeAbsolute
public static ICSourceEntry[] makeAbsolute(org.eclipse.core.resources.IProject project, ICSourceEntry[] entries)
-
makeAbsolute
public static ICOutputEntry makeAbsolute(org.eclipse.core.resources.IProject project, ICOutputEntry entry)
-
makeRelative
public static ICOutputEntry makeRelative(org.eclipse.core.resources.IProject project, ICOutputEntry entry)
-
makeAbsolute
public static ICOutputEntry[] makeAbsolute(org.eclipse.core.resources.IProject project, ICOutputEntry[] entries)
-
makeRelative
public static ICOutputEntry[] makeRelative(org.eclipse.core.resources.IProject project, ICOutputEntry[] entries)
-
addExcludePaths
public static ICSourceEntry addExcludePaths(ICSourceEntry entry, java.util.Collection<org.eclipse.core.runtime.IPath> paths, boolean removePrefix)
-
fillEntriesMapByNameKey
public static java.util.Map<EntryNameKey,ICSettingEntry> fillEntriesMapByNameKey(java.util.Map<EntryNameKey,ICSettingEntry> map, ICSettingEntry[] entries)
-
fillEntriesMapByContentsKey
public static java.util.Map<EntryContentsKey,ICSettingEntry> fillEntriesMapByContentsKey(java.util.Map<EntryContentsKey,ICSettingEntry> map, ICSettingEntry[] entries)
-
getBoolean
public static boolean getBoolean(ICStorageElement el, java.lang.String attr, boolean defaultValue)
-
setBoolean
public static void setBoolean(ICStorageElement el, java.lang.String attr, boolean value)
-
getInteger
public static int getInteger(ICStorageElement el, java.lang.String attr, int defaultValue)
-
setInteger
public static void setInteger(ICStorageElement el, java.lang.String attr, int value)
-
addRemoveExclusionsToEntry
public static ICExclusionPatternPathEntry addRemoveExclusionsToEntry(ICExclusionPatternPathEntry entry, org.eclipse.core.runtime.IPath[] paths, boolean add) throws java.lang.IllegalArgumentException
- Throws:
java.lang.IllegalArgumentException
-
makeAbsolute
public static ICExclusionPatternPathEntry makeAbsolute(org.eclipse.core.resources.IProject project, ICExclusionPatternPathEntry entry, boolean force)
-
makeRelative
public static ICExclusionPatternPathEntry makeRelative(org.eclipse.core.resources.IProject project, ICExclusionPatternPathEntry entry, boolean force)
-
makeRelative
public static ICExclusionPatternPathEntry[] makeRelative(org.eclipse.core.resources.IProject project, ICExclusionPatternPathEntry[] entries, boolean force)
-
makeAbsolute
public static ICExclusionPatternPathEntry[] makeAbsolute(org.eclipse.core.resources.IProject project, ICExclusionPatternPathEntry[] entries, boolean force)
-
-