[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[jdt-core-dev] SearchEngine
|
Hi,
I was wondering if any of you at the mailing list could help me a little with
the SearchEngine (located in org.elcipse.jdt.core.search). But first I've would
like to tell you a little about what I'm trying to achieve.
Im trying to create an Editor(multipage) for reading and manipulating a JCE
keystore. But the user should be able to configure the JCE Prodivers he/she
would like to use to open the selected keystore (by adding/removing and
changing the order of the JCE Providers in the java.security.Security class).
When the user chooses to add one (or more) providers he would be prompted with
a file dialog so he can choose one or more jar files containing the
Provider(s).
The file dialog returns an array of paths which is then passed to a method which
uses the SearchEngine to index jar which then is used to look for providers. I
thought it was possible to use the SearchEngine because my public boolean
encloses(String resourcePath) does see the correct matches (located in the
ProviderJavaSearchScope.class and the indexes is locaed in
.metadata/.plugins/org.eclipse.jdt.core) (e.g 2 results for the BouncyCastle
JCE jar file) but I was expecting the get the results from SearchRequestor:
public void acceptSearchMatch(SearchMatch match). I can see (when I run the
code below) that all other methods gets called (enter/exitParticipant and
begin/endReporting).
public void findProviders(String[] providerPaths) {
SearchPattern pattern = SearchPattern.createPattern("java.security.Provider",
//$NON-NLS-1$
IJavaSearchConstants.CLASS,
IJavaSearchConstants.ALL_OCCURRENCES,
SearchPattern.R_CASE_SENSITIVE | SearchPattern.R_PATTERN_MATCH);
SearchRequestor requestor = new ProviderSearchRequestor();
IJavaSearchScope scope = new ProviderJavaSearchScope(providerPaths);
SearchParticipant[] participants = new SearchParticipant[1];
participants[0] = SearchEngine.getDefaultSearchParticipant(); //new
JavaSearchParticipant();
try {
SearchEngine se = new SearchEngine();
se.search(pattern, participants, scope, requestor, null);
} catch (CoreException e) {
e.printStackTrace();
}
}
The result that a get (when enabling VERBOSE) is the following:
Thread[main,6,main] BasicSearchEngine.search(SearchPattern, SearchParticipant[],
IJavaSearchScope, SearchRequestor, IProgressMonitor)
Thread[main,6,main] Searching for pattern: ClassDeclarationPattern:
qualification<java.security>, type<Provider> ClassDeclarationPattern: pkg<*>,
enclosing<*>, type<Provider>, exact match, case sensitive
Thread[main,6,main] | TypeReferencePattern: qualification<java.security>,
type<Provider>, exact match, case sensitive
Thread[main,6,main]
org.iostream.jdt.internal.keystore.util.ProviderLocator$ProviderJavaSearchScope@4b9ec5
start Reporting
enterParticipant:
org.eclipse.jdt.internal.core.search.JavaSearchParticipant@a4c0b2
Thread[main,6,main] STARTING concurrent job - searching
ClassDeclarationPattern: qualification<java.security>, type<Provider>
ClassDeclarationPattern: pkg<*>, enclosing<*>, type<Provider>, exact match,
case sensitive
Thread[main,6,main] | TypeReferencePattern: qualification<java.security>,
type<Provider>, exact match, case sensitive
Thread[main,6,main] -> execution time: 49ms - searching ClassDeclarationPattern:
qualification<java.security>, type<Provider> ClassDeclarationPattern: pkg<*>,
enclosing<*>, type<Provider>, exact match, case sensitive
Thread[main,6,main] | TypeReferencePattern: qualification<java.security>,
type<Provider>, exact match, case sensitive
Thread[main,6,main] FINISHED concurrent job - searching
ClassDeclarationPattern: qualification<java.security>, type<Provider>
ClassDeclarationPattern: pkg<*>, enclosing<*>, type<Provider>, exact match,
case sensitive
Thread[main,6,main] | TypeReferencePattern: qualification<java.security>,
type<Provider>, exact match, case sensitive
Locating matches in documents [
SearchDocument for
/Users/jens/Desktop/providers/bcprov-jdk15-132.jar|org/bouncycastle/jce/provider/X509CertificateObject.class
SearchDocument for
/Users/jens/Desktop/providers/bcprov-jdk15-132.jar|org/bouncycastle/jce/provider/BouncyCastleProvider.class
]
exitParticipant:
org.eclipse.jdt.internal.core.search.JavaSearchParticipant@a4c0b2
stop Reporting
So my question is: Is what Im trying to do possible using the SearchEngine
outside the workspace - or should I take another approach?
best regards,
Jens
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.