Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-core-dev] SearchEngine

This mailing list is used for development only. Questions like this should
be posted on eclipse.tools.jdt news group instead...

Saying that, to answer your question, this would have been the correct
approach if your jar contained sources or had a source attachment location
and it seems not to be the case...

Unfortunately, SearchEngine is currently not able to find references in
class files which do not have attached source (see bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=127442).
In this case, it does only look for declarations and that's why you get no
match to your search request...

Cordialement/Regards,

Frédéric




                                                                           
             j3ns@xxxxxxxx                                                 
             Sent by:                                                      
             jdt-core-dev-boun                                          To 
             ces@xxxxxxxxxxx           jdt-core-dev@xxxxxxxxxxx            
                                                                        cc 
                                                                           
             03/30/2006 08:47                                      Subject 
             PM                        [jdt-core-dev] SearchEngine         
                                                                           
                                                                           
             Please respond to                                             
             "Eclipse JDT Core                                             
             developers list."                                             
                                                                           
                                                                           




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.

I’m 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 I’m 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.

_______________________________________________
jdt-core-dev mailing list
jdt-core-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jdt-core-dev

Back to the top