37
|
1 |
/*******************************************************************************
|
|
2 |
* Copyright (c) 2005, 2009 QNX Software Systems 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 |
* QNX Software Systems - initial API and implementation
|
|
10 |
* IBM Corporation
|
|
11 |
* Markus Schorn (Wind River Systems)
|
|
12 |
* Warren Paul (Nokia) - 174238
|
|
13 |
*******************************************************************************/
|
|
14 |
package org.eclipse.cdt.internal.ui.wizards.classwizard;
|
|
15 |
|
|
16 |
import java.util.ArrayList;
|
|
17 |
import java.util.List;
|
|
18 |
|
|
19 |
import org.eclipse.core.resources.IFile;
|
|
20 |
import org.eclipse.core.resources.IProject;
|
|
21 |
import org.eclipse.core.resources.IResource;
|
|
22 |
import org.eclipse.core.resources.IWorkspaceRoot;
|
|
23 |
import org.eclipse.core.resources.ResourcesPlugin;
|
|
24 |
import org.eclipse.core.runtime.CoreException;
|
|
25 |
import org.eclipse.core.runtime.IAdaptable;
|
|
26 |
import org.eclipse.core.runtime.IPath;
|
|
27 |
import org.eclipse.core.runtime.NullProgressMonitor;
|
|
28 |
import org.eclipse.core.runtime.Path;
|
|
29 |
import org.eclipse.jface.operation.IRunnableContext;
|
|
30 |
import org.eclipse.jface.viewers.IStructuredSelection;
|
|
31 |
import org.eclipse.ui.IEditorInput;
|
|
32 |
import org.eclipse.ui.IEditorPart;
|
|
33 |
import org.eclipse.ui.IWorkbenchPart;
|
|
34 |
import org.eclipse.ui.views.contentoutline.ContentOutline;
|
|
35 |
|
|
36 |
import org.eclipse.cdt.core.CCorePlugin;
|
|
37 |
import org.eclipse.cdt.core.browser.AllTypesCache;
|
|
38 |
import org.eclipse.cdt.core.browser.IQualifiedTypeName;
|
|
39 |
import org.eclipse.cdt.core.browser.ITypeInfo;
|
|
40 |
import org.eclipse.cdt.core.browser.ITypeReference;
|
|
41 |
import org.eclipse.cdt.core.browser.TypeSearchScope;
|
|
42 |
import org.eclipse.cdt.core.dom.ILinkage;
|
|
43 |
import org.eclipse.cdt.core.dom.ast.DOMException;
|
|
44 |
import org.eclipse.cdt.core.dom.ast.IBinding;
|
|
45 |
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
|
46 |
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
|
47 |
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
|
|
48 |
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
|
49 |
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
|
50 |
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
|
51 |
import org.eclipse.cdt.core.index.IIndex;
|
|
52 |
import org.eclipse.cdt.core.index.IndexFilter;
|
|
53 |
import org.eclipse.cdt.core.model.CModelException;
|
|
54 |
import org.eclipse.cdt.core.model.CoreModel;
|
|
55 |
import org.eclipse.cdt.core.model.ICContainer;
|
|
56 |
import org.eclipse.cdt.core.model.ICElement;
|
|
57 |
import org.eclipse.cdt.core.model.ICProject;
|
|
58 |
import org.eclipse.cdt.core.model.ISourceRoot;
|
|
59 |
import org.eclipse.cdt.core.parser.IScannerInfo;
|
|
60 |
import org.eclipse.cdt.core.parser.IScannerInfoProvider;
|
|
61 |
import org.eclipse.cdt.ui.CUIPlugin;
|
|
62 |
|
|
63 |
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
|
64 |
|
|
65 |
import org.eclipse.cdt.internal.ui.editor.CEditor;
|
|
66 |
import org.eclipse.cdt.internal.ui.viewsupport.IViewPartInputProvider;
|
|
67 |
import org.eclipse.cdt.internal.ui.wizards.filewizard.NewSourceFileGenerator;
|
|
68 |
|
|
69 |
public class NewClassWizardUtil {
|
|
70 |
|
|
71 |
/**
|
|
72 |
* Returns the parent source folder of the given element. If the given
|
|
73 |
* element is already a source folder, the element itself is returned.
|
|
74 |
*
|
|
75 |
* @param element the C Element
|
|
76 |
* @return the source folder
|
|
77 |
*/
|
|
78 |
public static ICContainer getSourceFolder(ICElement element) {
|
|
79 |
ICContainer folder = null;
|
|
80 |
boolean foundSourceRoot = false;
|
|
81 |
ICElement curr = element;
|
|
82 |
while (curr != null && !foundSourceRoot) {
|
|
83 |
if (curr instanceof ICContainer && folder == null) {
|
|
84 |
folder = (ICContainer)curr;
|
|
85 |
}
|
|
86 |
foundSourceRoot = (curr instanceof ISourceRoot);
|
|
87 |
curr = curr.getParent();
|
|
88 |
}
|
|
89 |
if (folder == null) {
|
|
90 |
ICProject cproject = element.getCProject();
|
|
91 |
folder = cproject.findSourceRoot(cproject.getProject());
|
|
92 |
}
|
|
93 |
return folder;
|
|
94 |
}
|
|
95 |
|
|
96 |
/**
|
|
97 |
* Returns the parent source folder for the given path. If the given
|
|
98 |
* path is already a source folder, the corresponding C element is returned.
|
|
99 |
*
|
|
100 |
* @param path the path
|
|
101 |
* @return the source folder
|
|
102 |
*/
|
|
103 |
public static ICContainer getSourceFolder(IPath path) {
|
|
104 |
if (path == null)
|
|
105 |
return null;
|
|
106 |
while (path.segmentCount() > 0) {
|
|
107 |
IResource res = getWorkspaceRoot().findMember(path);
|
|
108 |
if (res != null && res.exists()) {
|
|
109 |
int resType = res.getType();
|
|
110 |
if (resType == IResource.PROJECT || resType == IResource.FOLDER) {
|
|
111 |
ICElement elem = CoreModel.getDefault().create(res.getFullPath());
|
|
112 |
if (elem != null) {
|
|
113 |
ICContainer sourceFolder = getSourceFolder(elem);
|
|
114 |
if (sourceFolder != null)
|
|
115 |
return sourceFolder;
|
|
116 |
if (resType == IResource.PROJECT) {
|
|
117 |
if (elem instanceof ICContainer) {
|
|
118 |
return (ICContainer)elem;
|
|
119 |
}
|
|
120 |
}
|
|
121 |
}
|
|
122 |
}
|
|
123 |
}
|
|
124 |
path = path.removeLastSegments(1);
|
|
125 |
}
|
|
126 |
return null;
|
|
127 |
}
|
|
128 |
|
|
129 |
/**
|
|
130 |
* Returns the parent source folder for the given resource. If the given
|
|
131 |
* resource is already a source folder, the corresponding C element is returned.
|
|
132 |
*
|
|
133 |
* @param resource the resource
|
|
134 |
* @return the source folder
|
|
135 |
*/
|
|
136 |
public static ICContainer getSourceFolder(IResource resource) {
|
|
137 |
if (resource != null && resource.exists()) {
|
|
138 |
int resType = resource.getType();
|
|
139 |
if (resType == IResource.PROJECT || resType == IResource.FOLDER) {
|
|
140 |
ICElement elem = CoreModel.getDefault().create(resource.getFullPath());
|
|
141 |
if (elem != null) {
|
|
142 |
ICContainer sourceFolder = getSourceFolder(elem);
|
|
143 |
if (sourceFolder != null)
|
|
144 |
return sourceFolder;
|
|
145 |
}
|
|
146 |
} else {
|
|
147 |
return getSourceFolder(resource.getParent());
|
|
148 |
}
|
|
149 |
}
|
|
150 |
return null;
|
|
151 |
}
|
|
152 |
|
|
153 |
/**
|
|
154 |
* Returns the first source root in the given project. If the project has
|
|
155 |
* no source roots as children, the project itself is returned.
|
|
156 |
*
|
|
157 |
* @param cproject
|
|
158 |
* @return the source root
|
|
159 |
*/
|
|
160 |
public static ISourceRoot getFirstSourceRoot(ICProject cproject) {
|
|
161 |
ISourceRoot folder = null;
|
|
162 |
try {
|
|
163 |
if (cproject.exists()) {
|
|
164 |
ISourceRoot[] roots = cproject.getSourceRoots();
|
|
165 |
if (roots != null && roots.length > 0)
|
|
166 |
folder = roots[0];
|
|
167 |
}
|
|
168 |
} catch (CModelException e) {
|
|
169 |
CUIPlugin.log(e);
|
|
170 |
}
|
|
171 |
if (folder == null) {
|
|
172 |
folder = cproject.findSourceRoot(cproject.getResource());
|
|
173 |
}
|
|
174 |
return folder;
|
|
175 |
}
|
|
176 |
|
|
177 |
/**
|
|
178 |
* Returns the C Element which corresponds to the given selection.
|
|
179 |
*
|
|
180 |
* @param selection the selection to be inspected
|
|
181 |
* @return a C element matching the selection, or <code>null</code>
|
|
182 |
* if no C element exists in the given selection
|
|
183 |
*/
|
|
184 |
public static ICElement getCElementFromSelection(IStructuredSelection selection) {
|
|
185 |
ICElement celem = null;
|
|
186 |
if (selection != null && !selection.isEmpty()) {
|
|
187 |
Object selectedElement = selection.getFirstElement();
|
|
188 |
if (selectedElement instanceof IAdaptable) {
|
|
189 |
IAdaptable adaptable = (IAdaptable) selectedElement;
|
|
190 |
|
|
191 |
celem = (ICElement) adaptable.getAdapter(ICElement.class);
|
|
192 |
if (celem == null) {
|
|
193 |
IResource resource = (IResource) adaptable.getAdapter(IResource.class);
|
|
194 |
if (resource != null && resource.getType() != IResource.ROOT) {
|
|
195 |
while (celem == null && resource.getType() != IResource.PROJECT) {
|
|
196 |
celem = (ICElement) resource.getAdapter(ICElement.class);
|
|
197 |
resource = resource.getParent();
|
|
198 |
}
|
|
199 |
if (celem == null) {
|
|
200 |
celem = CoreModel.getDefault().create(resource); // c project
|
|
201 |
}
|
|
202 |
}
|
|
203 |
}
|
|
204 |
}
|
|
205 |
}
|
|
206 |
return celem;
|
|
207 |
}
|
|
208 |
|
|
209 |
/**
|
|
210 |
* Returns the C Element which corresponds to the active editor.
|
|
211 |
*
|
|
212 |
* @return a C element matching the active editor, or <code>null</code>
|
|
213 |
* if no C element can be found
|
|
214 |
*/
|
|
215 |
public static ICElement getCElementFromEditor() {
|
|
216 |
ICElement celem = null;
|
|
217 |
IWorkbenchPart part = CUIPlugin.getActivePage().getActivePart();
|
|
218 |
if (part instanceof ContentOutline) {
|
|
219 |
part = CUIPlugin.getActivePage().getActiveEditor();
|
|
220 |
}
|
|
221 |
if (part instanceof IViewPartInputProvider) {
|
|
222 |
Object elem = ((IViewPartInputProvider)part).getViewPartInput();
|
|
223 |
if (elem instanceof ICElement) {
|
|
224 |
celem = (ICElement) elem;
|
|
225 |
}
|
|
226 |
}
|
|
227 |
if (celem == null && part instanceof CEditor) {
|
|
228 |
IEditorInput input = ((IEditorPart)part).getEditorInput();
|
|
229 |
if (input != null) {
|
|
230 |
final IResource res = (IResource) input.getAdapter(IResource.class);
|
|
231 |
if (res != null && res instanceof IFile) {
|
|
232 |
celem = CoreModel.getDefault().create((IFile)res);
|
|
233 |
}
|
|
234 |
}
|
|
235 |
}
|
|
236 |
return celem;
|
|
237 |
}
|
|
238 |
|
|
239 |
/**
|
|
240 |
* Returns the parent namespace for the given element. If the given element is
|
|
241 |
* already a namespace, the element itself is returned.
|
|
242 |
*
|
|
243 |
* @param element the given C Element
|
|
244 |
* @return the C Element for the namespace, or <code>null</code> if not found
|
|
245 |
*/
|
|
246 |
public static ICElement getNamespace(ICElement element) {
|
|
247 |
ICElement curr = element;
|
|
248 |
while (curr != null) {
|
|
249 |
int type = curr.getElementType();
|
|
250 |
if (type == ICElement.C_UNIT) {
|
|
251 |
break;
|
|
252 |
}
|
|
253 |
if (type == ICElement.C_NAMESPACE) {
|
|
254 |
return curr;
|
|
255 |
}
|
|
256 |
curr = curr.getParent();
|
|
257 |
}
|
|
258 |
return null;
|
|
259 |
}
|
|
260 |
|
|
261 |
/**
|
|
262 |
* Creates a header file name from the given class name. This is the file name
|
|
263 |
* to be used when the class is created. eg. "MyClass" -> "MyClass.h"
|
|
264 |
*
|
|
265 |
* @param className the class name
|
|
266 |
* @return the header file name for the given class
|
|
267 |
*/
|
|
268 |
public static String createHeaderFileName(String className) {
|
|
269 |
return NewSourceFileGenerator.generateHeaderFileNameFromClass(className);
|
|
270 |
}
|
|
271 |
|
|
272 |
/**
|
|
273 |
* Creates a source file name from the given class name. This is the file name
|
|
274 |
* to be used when the class is created. eg. "MyClass" -> "MyClass.cpp"
|
|
275 |
*
|
|
276 |
* @param className the class name
|
|
277 |
* @return the source file name for the given class
|
|
278 |
*/
|
|
279 |
public static String createSourceFileName(String className) {
|
|
280 |
return NewSourceFileGenerator.generateSourceFileNameFromClass(className);
|
|
281 |
}
|
|
282 |
|
|
283 |
/**
|
|
284 |
* Returns the workspace root.
|
|
285 |
*
|
|
286 |
* @return the workspace root
|
|
287 |
*/
|
|
288 |
public static IWorkspaceRoot getWorkspaceRoot() {
|
|
289 |
return ResourcesPlugin.getWorkspace().getRoot();
|
|
290 |
}
|
|
291 |
|
|
292 |
/**
|
|
293 |
* Resolve the location of the given class.
|
|
294 |
*
|
|
295 |
* @param type the class to resolve
|
|
296 |
* @param context the runnable context
|
|
297 |
* @return the class location, or <code>null</code> if not found
|
|
298 |
*/
|
|
299 |
public static ITypeReference resolveClassLocation(ITypeInfo type, IRunnableContext context) {
|
|
300 |
return type.getResolvedReference();
|
|
301 |
}
|
|
302 |
|
|
303 |
private static final int[] CLASS_TYPES = { ICElement.C_CLASS, ICElement.C_STRUCT };
|
|
304 |
|
|
305 |
/**
|
|
306 |
* Returns all classes/structs which are accessible from the include
|
|
307 |
* paths of the given project.
|
|
308 |
*
|
|
309 |
* @param cProject the given project
|
|
310 |
* @return array of classes/structs
|
|
311 |
*/
|
|
312 |
public static ITypeInfo[] getReachableClasses(ICProject cProject) {
|
|
313 |
ITypeInfo[] elements = AllTypesCache.getTypes(new TypeSearchScope(true), CLASS_TYPES);
|
|
314 |
if (elements != null && elements.length > 0) {
|
|
315 |
if (cProject != null) {
|
|
316 |
IProject project = cProject.getProject();
|
|
317 |
IScannerInfoProvider provider = CCorePlugin.getDefault().getScannerInfoProvider(project);
|
|
318 |
if (provider != null) {
|
|
319 |
//TODO get the scanner info for the actual source folder
|
|
320 |
IScannerInfo info = provider.getScannerInformation(project);
|
|
321 |
if (info != null) {
|
|
322 |
String[] includePaths = info.getIncludePaths();
|
|
323 |
List<ITypeInfo> filteredTypes = new ArrayList<ITypeInfo>();
|
|
324 |
for (int i = 0; i < elements.length; ++i) {
|
|
325 |
ITypeInfo baseType = elements[i];
|
|
326 |
if (isTypeReachable(baseType, cProject, includePaths)) {
|
|
327 |
filteredTypes.add(baseType);
|
|
328 |
}
|
|
329 |
}
|
|
330 |
return filteredTypes.toArray(new ITypeInfo[filteredTypes.size()]);
|
|
331 |
}
|
|
332 |
}
|
|
333 |
}
|
|
334 |
}
|
|
335 |
return elements;
|
|
336 |
}
|
|
337 |
|
|
338 |
/**
|
|
339 |
* Checks whether the given type can be found in the given project or the
|
|
340 |
* given include paths.
|
|
341 |
*
|
|
342 |
* @param type the type
|
|
343 |
* @param project the project
|
|
344 |
* @param includePaths the include paths
|
|
345 |
* @return <code>true</code> if the given type is found
|
|
346 |
*/
|
|
347 |
public static boolean isTypeReachable(ITypeInfo type, ICProject project, String[] includePaths) {
|
|
348 |
ICProject baseProject = type.getEnclosingProject();
|
|
349 |
|
61
|
350 |
if (baseProject != null && baseProject.equals(project)) {
|
37
|
351 |
return true;
|
|
352 |
}
|
|
353 |
|
|
354 |
// check the include paths
|
|
355 |
ITypeReference ref = type.getResolvedReference();
|
|
356 |
IPath location = ref == null ? null : ref.getLocation();
|
|
357 |
boolean isTypeLocation= true;
|
|
358 |
if (location == null) {
|
|
359 |
isTypeLocation= false;
|
61
|
360 |
|
|
361 |
if (baseProject != null) {
|
|
362 |
location = baseProject.getProject().getLocation();
|
|
363 |
}
|
|
364 |
|
|
365 |
if (location == null)
|
37
|
366 |
return false;
|
|
367 |
}
|
|
368 |
|
|
369 |
for (int i = 0; i < includePaths.length; ++i) {
|
|
370 |
IPath includePath = new Path(includePaths[i]);
|
|
371 |
if (isTypeLocation) {
|
|
372 |
if (includePath.isPrefixOf(location))
|
|
373 |
return true;
|
|
374 |
} else {
|
|
375 |
// we don't have the real location, so just check the project path
|
|
376 |
if (location.isPrefixOf(includePath))
|
|
377 |
return true;
|
|
378 |
}
|
|
379 |
}
|
|
380 |
|
|
381 |
return false;
|
|
382 |
}
|
|
383 |
|
|
384 |
public static final int SEARCH_MATCH_ERROR = -1; // some error, search failed
|
|
385 |
public static final int SEARCH_MATCH_NOTFOUND = 0; // no match found
|
|
386 |
public static final int SEARCH_MATCH_FOUND_EXACT = 1; // exact match
|
|
387 |
public static final int SEARCH_MATCH_FOUND_EXACT_ANOTHER_TYPE = 2; // same name found, by different type
|
|
388 |
public static final int SEARCH_MATCH_FOUND_ANOTHER_NAMESPACE = 3; // same type name exits in different scope
|
|
389 |
public static final int SEARCH_MATCH_FOUND_ANOTHER_TYPE = 4; // same name used by another type in different scope
|
|
390 |
|
|
391 |
/**
|
|
392 |
* Search for the given qualified name of the give
|
|
393 |
* @param typeName qualified name of the type to search
|
|
394 |
* @param project
|
|
395 |
* @param queryType Class of interface type to search for (e.g. ICPPClassType.class)
|
|
396 |
* @return one of {@link #SEARCH_MATCH_ERROR},
|
|
397 |
* {@link #SEARCH_MATCH_FOUND_ANOTHER_NAMESPACE},
|
|
398 |
* {@link #SEARCH_MATCH_FOUND_ANOTHER_TYPE},
|
|
399 |
* {@link #SEARCH_MATCH_FOUND_EXACT_ANOTHER_TYPE},
|
|
400 |
* {@link #SEARCH_MATCH_FOUND_EXACT} or
|
|
401 |
* {@link #SEARCH_MATCH_NOTFOUND}.
|
|
402 |
*/
|
|
403 |
public static int searchForCppType(IQualifiedTypeName typeName, ICProject project, Class<?> queryType) {
|
|
404 |
IIndex index= null;
|
|
405 |
try {
|
|
406 |
if (project != null) {
|
|
407 |
index = CCorePlugin.getIndexManager().getIndex(project);
|
|
408 |
index.acquireReadLock();
|
|
409 |
}
|
|
410 |
} catch (CoreException e) {
|
|
411 |
CUIPlugin.log(e);
|
|
412 |
return SEARCH_MATCH_ERROR;
|
|
413 |
} catch (InterruptedException e) {
|
|
414 |
Thread.currentThread().interrupt();
|
|
415 |
return SEARCH_MATCH_NOTFOUND;
|
|
416 |
}
|
|
417 |
if (index == null) {
|
|
418 |
return SEARCH_MATCH_ERROR;
|
|
419 |
}
|
|
420 |
try {
|
|
421 |
String fullyQualifiedTypeName = typeName.getFullyQualifiedName();
|
|
422 |
try {
|
|
423 |
IndexFilter filter= IndexFilter.getFilter(ILinkage.CPP_LINKAGE_ID);
|
|
424 |
//bug 165636: findBindings(char[][]...) does not find nested nodes (classes)
|
|
425 |
//therefore switching back to findBindings(Pattern...)
|
|
426 |
IBinding[] bindings = index.findBindings(typeName.getName().toCharArray(), false, filter, new NullProgressMonitor());
|
|
427 |
boolean sameTypeNameExists = false;
|
|
428 |
boolean sameNameDifferentTypeExists = false;
|
|
429 |
|
|
430 |
for (int i = 0; i < bindings.length; ++i) {
|
|
431 |
ICPPBinding binding = (ICPPBinding)bindings[i];
|
|
432 |
|
|
433 |
//get the fully qualified name of this binding
|
|
434 |
String bindingFullName = CPPVisitor.renderQualifiedName(binding.getQualifiedName());
|
|
435 |
Class<? extends ICPPBinding> currentNodeType = binding.getClass();
|
|
436 |
// full binding
|
|
437 |
if (queryType.isAssignableFrom(currentNodeType)) {
|
|
438 |
if (bindingFullName.equals(fullyQualifiedTypeName)) {
|
|
439 |
//bug 165636: there is a match only if there is a definition for the binding
|
|
440 |
//otherwise, users can create a new class definition for this binding
|
|
441 |
if (index.findDefinitions(binding).length > 0) {
|
|
442 |
return SEARCH_MATCH_FOUND_EXACT;
|
|
443 |
}
|
|
444 |
} else {
|
|
445 |
// same type , same name , but different name space
|
|
446 |
// see if there is an exact match;
|
|
447 |
sameTypeNameExists = true;
|
|
448 |
}
|
|
449 |
} else if(ICPPClassType.class.isAssignableFrom(currentNodeType) ||
|
|
450 |
IEnumeration.class.isAssignableFrom(currentNodeType) || // TODO - this should maybe be ICPPEnumeration
|
|
451 |
ICPPNamespace.class.isAssignableFrom(currentNodeType) ||
|
|
452 |
ITypedef.class.isAssignableFrom(currentNodeType) ||
|
|
453 |
ICPPBasicType.class.isAssignableFrom(currentNodeType))
|
|
454 |
{
|
|
455 |
if (bindingFullName.equals(fullyQualifiedTypeName)) {
|
|
456 |
return SEARCH_MATCH_FOUND_EXACT_ANOTHER_TYPE;
|
|
457 |
}
|
|
458 |
// different type , same name , but different name space
|
|
459 |
sameNameDifferentTypeExists = true;
|
|
460 |
}
|
|
461 |
}
|
|
462 |
if(sameTypeNameExists){
|
|
463 |
return SEARCH_MATCH_FOUND_ANOTHER_NAMESPACE;
|
|
464 |
}
|
|
465 |
|
|
466 |
if(sameNameDifferentTypeExists){
|
|
467 |
return SEARCH_MATCH_FOUND_ANOTHER_TYPE;
|
|
468 |
}
|
|
469 |
} catch (CoreException e) {
|
|
470 |
return SEARCH_MATCH_ERROR;
|
|
471 |
} catch (DOMException e) {
|
|
472 |
return SEARCH_MATCH_ERROR;
|
|
473 |
}
|
|
474 |
return SEARCH_MATCH_NOTFOUND;
|
|
475 |
}
|
|
476 |
finally {
|
|
477 |
index.releaseReadLock();
|
|
478 |
}
|
|
479 |
}
|
|
480 |
}
|