|
Plugin SearchEngine problem -
09-17-2008, 12:05 PM
I am writing an export plugin that should export properties of a specific objects located in the class path .jar files. I am trying to use the SearchEngine.search for this task. The problem is that I am able to find only classes that are located in the source folder (only .java files) and I am not able to find the classes that are located in the .jar files.
I see that the project contains the .jar files, but the search doesn't match them.
Here is the code that I am using:
public void initModel() {
try {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
// Get the Java model
IJavaModel javaModel = JavaCore.create(workspace.getRoot());
// Get all projects
IJavaProject javaProjects[] = javaModel.getJavaProjects();
// Create search pattern
SearchPattern pattern = SearchPattern.createPattern("jsystem.framework.sys tem.SystemObjectImpl",
IJavaSearchConstants.CLASS, IJavaSearchConstants.IMPLEMENTORS, SearchPattern.R_EXACT_MATCH);
IJavaSearchScope scope =
SearchEngine.createJavaSearchScope(javaProjects, IJavaSearchScope.SOURCES|IJavaSearchScope.APPLICAT ION_LIBRARIES);
try {
// Search...
SearchEngine searchEngine = new SearchEngine();
searchEngine.search(pattern, new SearchParticipant[] {SearchEngine.getDefaultSearchParticipant()},
scope, this, null);
} catch (CoreException ce){
notifyError("CoreException");
}
} catch (JavaModelException je) {
notifyError("JavaModelException");
}
}
|