public class CoreModelUtil extends Object
Constructor and Description |
---|
CoreModelUtil() |
Modifier and Type | Method and Description |
---|---|
static ITranslationUnit |
findTranslationUnit(org.eclipse.core.resources.IFile file)
Returns the translation unit for the file given or
null . |
static ITranslationUnit |
findTranslationUnitForLocation(IIndexFileLocation ifl,
ICProject preferredProject)
Returns the translation unit for the location given or
null . |
static ITranslationUnit |
findTranslationUnitForLocation(org.eclipse.core.runtime.IPath location,
ICProject preferredProject)
Searches for a translation unit within the cprojects.
|
static ITranslationUnit |
findTranslationUnitForLocation(URI locationURI,
ICProject preferredProject)
Searches for a translation unit within the cprojects.
|
static IBinaryParser |
getBinaryParser(ICConfigExtensionReference ref)
Instantiate binary parser for given extension reference.
|
static String[] |
getBinaryParserIds(ICConfigurationDescription[] cfgs)
Returns binary parser IDs for configurations
|
static ICConfigurationDescription[] |
getReferencedConfigurationDescriptions(ICConfigurationDescription cfgDes,
boolean writable)
Returns the configuration descriptions referenced directly by the specified
configuration description.
|
static ICConfigurationDescription[] |
getReferencingConfigurationDescriptions(ICConfigurationDescription cfgDes,
boolean writable)
Returns the list of all configuration descriptions which directly reference
the specified configuration description.
|
static int |
indexOf(char toBeFound,
char[] array)
Answers the first index in the array for which the corresponding character is equal to toBeFound.
|
static int |
indexOf(char toBeFound,
char[] array,
int start)
Answers the first index in the array for which the corresponding character is equal to toBeFound starting the search at index
start.
|
static boolean |
isExcluded(org.eclipse.core.runtime.IPath resourcePath,
char[][] exclusionPatterns)
Returns whether the given resource path matches one of the exclusion patterns.
|
static boolean |
isExcluded(org.eclipse.core.resources.IResource resource,
char[][] exclusionPatterns)
Returns whether the given resource matches one of the exclusion patterns.
|
static boolean |
isExcludedPath(org.eclipse.core.runtime.IPath resourcePath,
org.eclipse.core.runtime.IPath[] exclusionPatterns)
Returns whether the given path matches one of the exclusion patterns.
|
static boolean |
match(char[] pattern,
char[] name,
boolean isCaseSensitive)
Answers true if the pattern matches the given name, false otherwise.
|
static boolean |
match(char[] pattern,
int patternStart,
int patternEnd,
char[] name,
int nameStart,
int nameEnd,
boolean isCaseSensitive)
Answers true if the a sub-pattern matches the subpart of the given name, false otherwise.
|
static boolean |
pathMatch(char[] pattern,
char[] filepath,
boolean isCaseSensitive,
char pathSeparator)
Answers true if the pattern matches the filepath using the pathSepatator, false otherwise.
|
static void |
setBinaryParserIds(ICConfigurationDescription[] cfgs,
String[] pids)
Sets binary parser ID list to given configurations
|
public static boolean isExcludedPath(org.eclipse.core.runtime.IPath resourcePath, org.eclipse.core.runtime.IPath[] exclusionPatterns)
resourcePath
- exclusionPatterns
- true
if the given path matches one of the exclusion patterns.public static final boolean isExcluded(org.eclipse.core.resources.IResource resource, char[][] exclusionPatterns)
public static final boolean isExcluded(org.eclipse.core.runtime.IPath resourcePath, char[][] exclusionPatterns)
public static final boolean match(char[] pattern, char[] name, boolean isCaseSensitive)
pattern = { '?', 'b', '*' } name = { 'a', 'b', 'c' , 'd' } isCaseSensitive = true result => true
pattern = { '?', 'b', '?' } name = { 'a', 'b', 'c' , 'd' } isCaseSensitive = true result => false
pattern = { 'b', '*' } name = { 'a', 'b', 'c' , 'd' } isCaseSensitive = true result => false
pattern
- the given patternname
- the given nameisCaseSensitive
- flag to know whether or not the matching should be case sensitivepublic static final boolean match(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd, boolean isCaseSensitive)
pattern = { '?', 'b', '*' } patternStart = 1 patternEnd = 3 name = { 'a', 'b', 'c' , 'd' } nameStart = 1 nameEnd = 4 isCaseSensitive = true result => true
pattern = { '?', 'b', '*' } patternStart = 1 patternEnd = 2 name = { 'a', 'b', 'c' , 'd' } nameStart = 1 nameEnd = 2 isCaseSensitive = true result => false
pattern
- the given patternpatternStart
- the given pattern startpatternEnd
- the given pattern endname
- the given namenameStart
- the given name startnameEnd
- the given name endisCaseSensitive
- flag to know if the matching should be case sensitivepublic static final boolean pathMatch(char[] pattern, char[] filepath, boolean isCaseSensitive, char pathSeparator)
pattern
- the given patternfilepath
- the given pathisCaseSensitive
- to find out whether or not the matching should be case sensitivepathSeparator
- the given path separatorpublic static final int indexOf(char toBeFound, char[] array)
toBeFound = 'c' array = { ' a', 'b', 'c', 'd' } result => 2
toBeFound = 'e' array = { ' a', 'b', 'c', 'd' } result => -1
toBeFound
- the character to searcharray
- the array to be searchedNullPointerException
- if array is nullpublic static final int indexOf(char toBeFound, char[] array, int start)
toBeFound = 'c' array = { ' a', 'b', 'c', 'd' } start = 2 result => 2
toBeFound = 'c' array = { ' a', 'b', 'c', 'd' } start = 3 result => -1
toBeFound = 'e' array = { ' a', 'b', 'c', 'd' } start = 1 result => -1
toBeFound
- the character to searcharray
- the array to be searchedstart
- the starting indexNullPointerException
- if array is nullArrayIndexOutOfBoundsException
- if start is lower than 0public static ITranslationUnit findTranslationUnitForLocation(org.eclipse.core.runtime.IPath location, ICProject preferredProject) throws CModelException
CModelException
public static ITranslationUnit findTranslationUnitForLocation(URI locationURI, ICProject preferredProject) throws CModelException
CModelException
public static ITranslationUnit findTranslationUnitForLocation(IIndexFileLocation ifl, ICProject preferredProject) throws CModelException
null
.CModelException
public static ITranslationUnit findTranslationUnit(org.eclipse.core.resources.IFile file)
null
.public static ICConfigurationDescription[] getReferencedConfigurationDescriptions(ICConfigurationDescription cfgDes, boolean writable)
cfgDes
- writable
- - specifies whether the returned descriptions should be writable or read-onlygetReferencingConfigurationDescriptions(ICConfigurationDescription, boolean)
public static ICConfigurationDescription[] getReferencingConfigurationDescriptions(ICConfigurationDescription cfgDes, boolean writable)
cfgDes
- writable
- - specifies whether the returned descriptions should be writable or read-onlygetReferencedConfigurationDescriptions(ICConfigurationDescription, boolean)
public static String[] getBinaryParserIds(ICConfigurationDescription[] cfgs)
cfgs
- - array of configurations where we need searchpublic static void setBinaryParserIds(ICConfigurationDescription[] cfgs, String[] pids)
cfgs
- - array of configurations where we need searchpids
- - array of binary parser ids (Strings)public static IBinaryParser getBinaryParser(ICConfigExtensionReference ref) throws org.eclipse.core.runtime.CoreException
ref
- binary parser extension referenceorg.eclipse.core.runtime.CoreException
- if the parser could not be createdCopyright (c) IBM Corp. and others 2004, 2020. All Rights Reserved.