Package org.eclipse.cdt.core.index
Class IndexLocationFactory
java.lang.Object
org.eclipse.cdt.core.index.IndexLocationFactory
Factory for obtaining instances of IIndexFileLocation for workspace and external files, and
some utility methods for going in the opposite direction.
- Since:
- 4.0
- Restriction:
- This class is not intended to be subclassed by clients.
- Restriction:
- This class is not intended to be instantiated by clients.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.eclipse.core.runtime.IPath
getAbsolutePath
(IIndexFileLocation location) Returns the absolute file path of a location, ornull
if the location is not a file-system path.static IIndexFileLocation
getExternalIFL
(String absolutePath) Returns an IIndexFileLocation for the specified absolute path, with no associated full path.static IIndexFileLocation
getExternalIFL
(org.eclipse.core.runtime.IPath absolutePath) Returns an IIndexFileLocation for the specified absolute path, with no associated full path.static IIndexFileLocation
Returns a workspace IIndexFileLocation if the translation unit has an associated resource an external IIndexFileLocation if the translation unit does not have an associated resource null, in any other casestatic IIndexFileLocation
getIFLExpensive
(String absolutePath) Equivalent to the overloaded form with the ICProject parameter set to nullstatic IIndexFileLocation
getIFLExpensive
(ICProject cproject, String absolutePath) Returns an IIndexFileLocation by searching the workspace for resources that are mapped onto the specified absolute path.static org.eclipse.core.runtime.IPath
getPath
(IIndexFileLocation location) Returns the full path if this IIndexFileLocation is within the workspace root the absolute path if this IIndexFileLocation is URI based and corresponds to a location on the local file system otherwise, nullstatic IIndexFileLocation
getWorkspaceIFL
(org.eclipse.core.resources.IFile file) Returns an IIndexFileLocation for the specified workspace file, ornull
if it does not have a location.
-
Constructor Details
-
IndexLocationFactory
public IndexLocationFactory()
-
-
Method Details
-
getPath
Returns- the full path if this IIndexFileLocation is within the workspace root
- the absolute path if this IIndexFileLocation is URI based and corresponds to a location on the local file system
- otherwise, null
- Parameters:
location
-- Returns:
- the workspace root relative path, a local file system absolute path or null
-
getAbsolutePath
Returns the absolute file path of a location, ornull
if the location is not a file-system path. -
getIFLExpensive
Equivalent to the overloaded form with the ICProject parameter set to null- See Also:
-
getIFLExpensive
Returns an IIndexFileLocation by searching the workspace for resources that are mapped onto the specified absolute path.If such a resource exists, an IIndexFileLocation that contains both the resource location URI, and the resources full path is created.
Otherwise, an IIndexFileLocation which contains the absolute path in URI form is returned.
N.B. As this searches the workspace, following links and potentially reading from alternate file systems, this method may be expensive.
- Parameters:
cproject
- the ICProject to prefer when resolving external includes to workspace resources (may be null)absolutePath
-- Returns:
- an IIndexFileLocation for the specified resource, containing a workspace relative path if possible.
-
getExternalIFL
Returns an IIndexFileLocation for the specified absolute path, with no associated full path.- Parameters:
absolutePath
-- Returns:
- an IIndexFileLocation for the specified absolute path, with no associated full path.
-
getExternalIFL
Returns an IIndexFileLocation for the specified absolute path, with no associated full path.- Parameters:
absolutePath
-- Returns:
- an IIndexFileLocation for the specified absolute path, with no associated full path.
-
getWorkspaceIFL
Returns an IIndexFileLocation for the specified workspace file, ornull
if it does not have a location.- Parameters:
file
-- Returns:
- an IIndexFileLocation for the specified workspace file
-
getIFL
Returns- a workspace IIndexFileLocation if the translation unit has an associated resource
- an external IIndexFileLocation if the translation unit does not have an associated resource
- null, in any other case
- Parameters:
tu
-- Returns:
- a suitable IIndexFileLocation for the specified ITranslationUnit
-