@@ -100,7 +100,7 @@ private List<StepDefinition> getCukeSteps(ICompilationUnit iCompUnit, MarkerFact
100
100
if (m .find ()) {
101
101
if ("*" .equals (m .group (2 ))) {
102
102
importedAnnotations .addAll (getAllAnnotationsInPackage (iCompUnit .getJavaProject (),
103
- CUCUMBER_API_JAVA + m .group (1 ), m .group (1 )));
103
+ CUCUMBER_API_JAVA + m .group (1 ), m .group (1 ), progressMonitor ));
104
104
} else {
105
105
importedAnnotations .add (new CucumberAnnotation (m .group (2 ), m .group (1 )));
106
106
}
@@ -111,7 +111,7 @@ private List<StepDefinition> getCukeSteps(ICompilationUnit iCompUnit, MarkerFact
111
111
if (m .find ()) {
112
112
if ("*" .equals (m .group (2 ))) {
113
113
importedAnnotations .addAll (getAllAnnotationsInPackage (iCompUnit .getJavaProject (),
114
- IO_CUCUMBER_JAVA + m .group (1 ), m .group (1 )));
114
+ IO_CUCUMBER_JAVA + m .group (1 ), m .group (1 ), progressMonitor ));
115
115
} else {
116
116
importedAnnotations .add (new CucumberAnnotation (m .group (2 ), m .group (1 )));
117
117
}
@@ -260,7 +260,7 @@ private int getLineNumber(ICompilationUnit compUnit, IAnnotation annotation) thr
260
260
}
261
261
262
262
private List <CucumberAnnotation > getAllAnnotationsInPackage (final IJavaProject javaProject ,
263
- final String packageFrag , final String lang ) throws CoreException , JavaModelException {
263
+ final String packageFrag , final String lang , IProgressMonitor monitor ) throws CoreException , JavaModelException {
264
264
265
265
SearchPattern pattern = SearchPattern .createPattern (packageFrag , IJavaSearchConstants .PACKAGE ,
266
266
IJavaSearchConstants .DECLARATIONS , SearchPattern .R_PATTERN_MATCH | SearchPattern .R_CASE_SENSITIVE );
@@ -287,12 +287,12 @@ public void acceptSearchMatch(SearchMatch match) {
287
287
}
288
288
};
289
289
SearchEngine engine = new SearchEngine ();
290
- jdtSearch (engine , pattern , scope , requestor );
290
+ jdtSearch (engine , pattern , scope , requestor , monitor );
291
291
return annotations ;
292
292
}
293
293
294
294
private void jdtSearch (SearchEngine engine , SearchPattern pattern , IJavaSearchScope scope ,
295
- SearchRequestor requestor ) throws CoreException {
295
+ SearchRequestor requestor , IProgressMonitor monitor ) throws CoreException {
296
296
try {
297
297
engine .search (pattern , new SearchParticipant [] { SearchEngine .getDefaultSearchParticipant () }, scope ,
298
298
requestor , null );
@@ -315,6 +315,10 @@ private CucumberAnnotation getCukeAnnotation(List<CucumberAnnotation> importedAn
315
315
if (m .find ()) {
316
316
return new CucumberAnnotation (m .group (2 ), m .group (1 ));
317
317
}
318
+ m = ioCucumberAnnotationMatcher .matcher (annotation .getElementName ());
319
+ if (m .find ()) {
320
+ return new CucumberAnnotation (m .group (2 ), m .group (1 ));
321
+ }
318
322
for (CucumberAnnotation cuke : importedAnnotations ) {
319
323
if (cuke .getAnnotation ().equals (annotation .getElementName ()))
320
324
return cuke ;
@@ -397,7 +401,7 @@ public boolean support(IResource resource) throws CoreException {
397
401
private Set <StepDefinition > findStepDefinitionsInClasspath (IJavaProject javaProject , MarkerFactory markerFactory ,
398
402
IProgressMonitor monitor ) throws CoreException {
399
403
400
- SearchPattern searchPattern = SearchPattern .createPattern ("cucumber.api.java.*. *" , IJavaSearchConstants .TYPE ,
404
+ SearchPattern searchPattern = SearchPattern .createPattern ("* cucumber*.java *" , IJavaSearchConstants .TYPE ,
401
405
IJavaSearchConstants .IMPORT_DECLARATION_TYPE_REFERENCE ,
402
406
SearchPattern .R_PATTERN_MATCH | SearchPattern .R_CASE_SENSITIVE );
403
407
@@ -456,7 +460,7 @@ public void acceptSearchMatch(SearchMatch match) {
456
460
};
457
461
458
462
for (IJavaSearchScope scope : scopes ) {
459
- jdtSearch (engine , searchPattern , scope , requestor );
463
+ jdtSearch (engine , searchPattern , scope , requestor , monitor );
460
464
}
461
465
462
466
return stepDefinitions ;
0 commit comments