Package org.eclipse.jdt.core.search
Interface IJavaSearchScope
-
public interface IJavaSearchScope
AnIJavaSearchScope
defines where search result should be found by aSearchEngine
. Clients must pass an instance of this interface to thesearch(...)
methods. Such an instance can be created using the following factory methods:SearchEngine.createHierarchyScope(IType)
,SearchEngine.createJavaSearchScope(IJavaElement[])
,SearchEngine.createWorkspaceScope()
or clients may choose to implement this interface.
-
-
Field Summary
Fields Modifier and Type Field Description static int
APPLICATION_LIBRARIES
Include type constant (bit mask) indicating that application libraries should be considered in the search scope.static String
JAR_FILE_ENTRY_SEPARATOR
This constant defines the separator of the resourcePath string of theencloses(String)
method.static int
REFERENCED_PROJECTS
Include type constant (bit mask) indicating that referenced projects should be considered in the search scope.static int
SOURCES
Include type constant (bit mask) indicating that source folders should be considered in the search scope.static int
SYSTEM_LIBRARIES
Include type constant (bit mask) indicating that system libraries should be considered in the search scope.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description boolean
encloses(String resourcePath)
Checks whether the resource at the given path is enclosed by this scope.boolean
encloses(IJavaElement element)
Checks whether this scope encloses the given element.IPath[]
enclosingProjectsAndJars()
Returns the paths to the enclosing projects and JARs for this search scope.boolean
includesBinaries()
Deprecated.UseSearchEngine.createJavaSearchScope(IJavaElement[])
with the package fragment roots that correspond to the binaries instead.boolean
includesClasspaths()
Deprecated.UseSearchEngine.createJavaSearchScope(IJavaElement[])
with a Java project instead.void
setIncludesBinaries(boolean includesBinaries)
Deprecated.UseSearchEngine.createJavaSearchScope(IJavaElement[])
with the package fragment roots that correspond to the binaries instead.void
setIncludesClasspaths(boolean includesClasspaths)
Deprecated.UseSearchEngine.createJavaSearchScope(IJavaElement[])
with a Java project instead.
-
-
-
Field Detail
-
JAR_FILE_ENTRY_SEPARATOR
static final String JAR_FILE_ENTRY_SEPARATOR
This constant defines the separator of the resourcePath string of theencloses(String)
method. If present in the string, it separates the path to the jar file from the path to the .class file in the jar.- See Also:
- Constant Field Values
-
SOURCES
static final int SOURCES
Include type constant (bit mask) indicating that source folders should be considered in the search scope.- Since:
- 3.0
- See Also:
- Constant Field Values
-
APPLICATION_LIBRARIES
static final int APPLICATION_LIBRARIES
Include type constant (bit mask) indicating that application libraries should be considered in the search scope.- Since:
- 3.0
- See Also:
- Constant Field Values
-
SYSTEM_LIBRARIES
static final int SYSTEM_LIBRARIES
Include type constant (bit mask) indicating that system libraries should be considered in the search scope.- Since:
- 3.0
- See Also:
- Constant Field Values
-
REFERENCED_PROJECTS
static final int REFERENCED_PROJECTS
Include type constant (bit mask) indicating that referenced projects should be considered in the search scope.- Since:
- 3.0
- See Also:
- Constant Field Values
-
-
Method Detail
-
encloses
boolean encloses(String resourcePath)
Checks whether the resource at the given path is enclosed by this scope.- Parameters:
resourcePath
- if the resource is contained in a JAR file, the path is composed of 2 paths separated byJAR_FILE_ENTRY_SEPARATOR
: the first path is the full OS path to the JAR (if it is an external JAR), or the workspace relativeIPath
to the JAR (if it is an internal JAR), the second path is the path to the resource inside the JAR.- Returns:
- whether the resource is enclosed by this scope
-
encloses
boolean encloses(IJavaElement element)
Checks whether this scope encloses the given element.- Parameters:
element
- the given element- Returns:
true
if the element is in this scope
-
enclosingProjectsAndJars
IPath[] enclosingProjectsAndJars()
Returns the paths to the enclosing projects and JARs for this search scope.- If the path is a project path, this is the full path of the project
(see
IResource.getFullPath()
). For example, /MyProject - If the path is a JAR path and this JAR is internal to the workspace,
this is the full path of the JAR file (see
IResource.getFullPath()
). For example, /MyProject/mylib.jar - If the path is a JAR path and this JAR is external to the workspace, this is the full OS path to the JAR file on the file system. For example, d:\libs\mylib.jar
- Returns:
- an array of paths to the enclosing projects and JARS.
- If the path is a project path, this is the full path of the project
(see
-
includesBinaries
boolean includesBinaries()
Deprecated.UseSearchEngine.createJavaSearchScope(IJavaElement[])
with the package fragment roots that correspond to the binaries instead.Returns whether this scope contains any.class
files (either in folders or within JARs).- Returns:
- whether this scope contains any
.class
files
-
includesClasspaths
boolean includesClasspaths()
Deprecated.UseSearchEngine.createJavaSearchScope(IJavaElement[])
with a Java project instead.Returns whether this scope includes classpaths defined by the projects of the resources of this search scope.- Returns:
- whether this scope includes classpaths
-
setIncludesBinaries
void setIncludesBinaries(boolean includesBinaries)
Deprecated.UseSearchEngine.createJavaSearchScope(IJavaElement[])
with the package fragment roots that correspond to the binaries instead.Sets whether this scope contains any.class
files (either in folders or within JARs).- Parameters:
includesBinaries
- whether this scope contains any.class
files
-
setIncludesClasspaths
void setIncludesClasspaths(boolean includesClasspaths)
Deprecated.UseSearchEngine.createJavaSearchScope(IJavaElement[])
with a Java project instead.Sets whether this scope includes the classpaths defined by the projects of the resources of this search scope.- Parameters:
includesClasspaths
- whether this scope includes classpaths
-
-