Skip to content

Commit a838bff

Browse files
committed
Support for recursive custom event handlers
1 parent 1e4e8fe commit a838bff

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

src/main/java/org/axonframework/intellij/ide/plugin/handler/DefaultEventHandlerProvider.java

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,22 +104,27 @@ private Map<String, String> getFullyQualifiedNames(final Project project) {
104104

105105
for (AnnotationTypes annotationType : AnnotationTypes.values()) {
106106
annotations.put(annotationType.getFullyQualifiedName(), annotationType.getAnnotation());
107+
addCustomHandlers(annotations, project, annotationType.getFullyQualifiedName());
108+
}
109+
return annotations;
110+
}
107111

108-
final PsiClass eventHandlerAnnotation = JavaPsiFacade.getInstance(project)
109-
.findClass(annotationType.getFullyQualifiedName(),
110-
GlobalSearchScope.allScope(project));
112+
private void addCustomHandlers(final HashMap<String, String> annotations, final Project project, final String fullyQualifiedName) {
113+
final PsiClass eventHandlerAnnotation = JavaPsiFacade.getInstance(project)
114+
.findClass(fullyQualifiedName, GlobalSearchScope.allScope(project));
111115

112-
if (eventHandlerAnnotation != null) {
113-
final Query<PsiClass> customEventHandlers = searchPsiClasses(eventHandlerAnnotation, projectScope(project));
114-
customEventHandlers.forEach(new Processor<PsiClass>() {
115-
@Override
116-
public boolean process(final PsiClass psiClass) {
117-
annotations.put(psiClass.getQualifiedName(), psiClass.getName());
118-
return true;
116+
if (eventHandlerAnnotation != null) {
117+
final Query<PsiClass> customEventHandlers = searchPsiClasses(eventHandlerAnnotation, projectScope(project));
118+
customEventHandlers.forEach(new Processor<PsiClass>() {
119+
@Override
120+
public boolean process(final PsiClass psiClass) {
121+
if (psiClass.isAnnotationType()) {
122+
addCustomHandlers(annotations, project, psiClass.getQualifiedName());
119123
}
120-
});
121-
}
124+
annotations.put(psiClass.getQualifiedName(), psiClass.getName());
125+
return true;
126+
}
127+
});
122128
}
123-
return annotations;
124129
}
125130
}

0 commit comments

Comments
 (0)