KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > core > search > IJavaSearchScope


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.core.search;
12
13 import org.eclipse.core.runtime.IPath;
14 import org.eclipse.jdt.core.IJavaElement;
15
16 /**
17  * An <code>IJavaSearchScope</code> defines where search result should be found by a
18  * <code>SearchEngine</code>. Clients must pass an instance of this interface
19  * to the <code>search(...)</code> methods. Such an instance can be created using the
20  * following factory methods on <code>SearchEngine</code>: <code>createHierarchyScope(IType)</code>,
21  * <code>createJavaSearchScope(IResource[])</code>, <code>createWorkspaceScope()</code>, or
22  * clients may choose to implement this interface.
23  */

24 public interface IJavaSearchScope {
25 /**
26  * This constant defines the separator of the resourcePath string of the <code>encloses(String)</code>
27  * method. If present in the string, it separates the path to the jar file from the path
28  * to the .class file in the jar.
29  */

30 String JavaDoc JAR_FILE_ENTRY_SEPARATOR = "|"; //$NON-NLS-1$
31
/**
32  * Include type constant (bit mask) indicating that source folders should be considered in the search scope.
33  * @since 3.0
34  */

35 int SOURCES = 1;
36 /**
37  * Include type constant (bit mask) indicating that application libraries should be considered in the search scope.
38  * @since 3.0
39  */

40 int APPLICATION_LIBRARIES = 2;
41 /**
42  * Include type constant (bit mask) indicating that system libraries should be considered in the search scope.
43  * @since 3.0
44  */

45 int SYSTEM_LIBRARIES = 4;
46 /**
47  * Include type constant (bit mask) indicating that referenced projects should be considered in the search scope.
48  * @since 3.0
49  */

50 int REFERENCED_PROJECTS = 8;
51 /**
52  * Checks whether the resource at the given path is enclosed by this scope.
53  *
54  * @param resourcePath if the resource is contained in
55  * a JAR file, the path is composed of 2 paths separated
56  * by <code>JAR_FILE_ENTRY_SEPARATOR</code>: the first path is the full OS path
57  * to the JAR (if it is an external JAR), or the workspace relative <code>IPath</code>
58  * to the JAR (if it is an internal JAR),
59  * the second path is the path to the resource inside the JAR.
60  * @return whether the resource is enclosed by this scope
61  */

62 public boolean encloses(String JavaDoc resourcePath);
63 /**
64  * Checks whether this scope encloses the given element.
65  *
66  * @param element the given element
67  * @return <code>true</code> if the element is in this scope
68  */

69 public boolean encloses(IJavaElement element);
70 /**
71  * Returns the paths to the enclosing projects and JARs for this search scope.
72  * <ul>
73  * <li> If the path is a project path, this is the full path of the project
74  * (see <code>IResource.getFullPath()</code>).
75  * For example, /MyProject
76  * </li>
77  * <li> If the path is a JAR path and this JAR is internal to the workspace,
78  * this is the full path of the JAR file (see <code>IResource.getFullPath()</code>).
79  * For example, /MyProject/mylib.jar
80  * </li>
81  * <li> If the path is a JAR path and this JAR is external to the workspace,
82  * this is the full OS path to the JAR file on the file system.
83  * For example, d:\libs\mylib.jar
84  * </li>
85  * </ul>
86  *
87  * @return an array of paths to the enclosing projects and JARS.
88  */

89 IPath[] enclosingProjectsAndJars();
90 /**
91  * Returns whether this scope contains any <code>.class</code> files (either
92  * in folders or within JARs).
93  *
94  * @return whether this scope contains any <code>.class</code> files
95  * @deprecated Use
96  * {@link org.eclipse.jdt.core.search.SearchEngine#createJavaSearchScope(IJavaElement[])}
97  * with the package fragment roots that correspond to the binaries instead.
98  */

99 boolean includesBinaries();
100 /**
101  * Returns whether this scope includes classpaths defined by
102  * the projects of the resources of this search scope.
103  *
104  * @return whether this scope includes classpaths
105  * @deprecated Use
106  * {@link org.eclipse.jdt.core.search.SearchEngine#createJavaSearchScope(IJavaElement[])}
107  * with a Java project instead.
108  */

109 boolean includesClasspaths();
110 /**
111  * Sets whether this scope contains any <code>.class</code> files (either
112  * in folders or within JARs).
113  *
114  * @param includesBinaries whether this scope contains any <code>.class</code> files
115  * @deprecated Use
116  * {@link org.eclipse.jdt.core.search.SearchEngine#createJavaSearchScope(IJavaElement[])}
117  * with the package fragment roots that correspond to the binaries instead.
118  */

119 public void setIncludesBinaries(boolean includesBinaries);
120 /**
121  * Sets whether this scope includes the classpaths defined by
122  * the projects of the resources of this search scope.
123  *
124  * @param includesClasspaths whether this scope includes classpaths
125  * @deprecated Use
126  * {@link org.eclipse.jdt.core.search.SearchEngine#createJavaSearchScope(IJavaElement[])}
127  * with a Java project instead.
128  */

129 public void setIncludesClasspaths(boolean includesClasspaths);
130 }
131
Popular Tags