File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
src/main/java/io/github/linyimin/plugin/utils Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 11package io .github .linyimin .plugin .utils ;
22
3+ import com .intellij .openapi .module .Module ;
4+ import com .intellij .openapi .module .ModuleUtilCore ;
35import com .intellij .openapi .project .Project ;
46import com .intellij .psi .PsiClass ;
57import com .intellij .psi .PsiElement ;
@@ -181,9 +183,17 @@ public static boolean isElementWithinMapperXml(PsiElement psiElement) {
181183 */
182184 public static MybatisConfiguration findConfiguration (Project project , PsiMethod psiMethod ) {
183185 GlobalSearchScope scope = GlobalSearchScope .allScope (project );
186+
187+ Module module = ModuleUtilCore .findModuleForPsiElement (psiMethod );
188+
184189 List <DomFileElement <MybatisConfiguration >> elements = DomService .getInstance ().getFileElements (MybatisConfiguration .class , project , scope );
185190
186191 return elements .stream ()
192+ .filter (configuration -> {
193+ assert module != null ;
194+ assert configuration .getModule () != null ;
195+ return StringUtils .equals (module .getName (), configuration .getModule ().getName ());
196+ })
187197 .map (DomFileElement ::getRootElement )
188198 .findFirst ().orElse (null );
189199 }
You can’t perform that action at this time.
0 commit comments