Skip to content
Snippets Groups Projects

Resolve "Controller suggestions are wrong"

Merged Tobias Ask requested to merge 11-controller-suggestions-are-wrong into master
1 file
+ 13
1
Compare changes
  • Side-by-side
  • Inline
@@ -61,7 +61,8 @@ public class JavaProjectGlossary extends Glossary implements IElementChangedList
@@ -61,7 +61,8 @@ public class JavaProjectGlossary extends Glossary implements IElementChangedList
candidateControllers.addAll(getCandidateControllers(pkg));
candidateControllers.addAll(getCandidateControllers(pkg));
}
}
}
}
return candidateControllers.stream().map(c -> c.getElementName()).collect(Collectors.toList());
return candidateControllers.stream().map(c ->
 
getSuggestionName(c)).collect(Collectors.toList());
}
}
@Override
@Override
@@ -108,6 +109,17 @@ public class JavaProjectGlossary extends Glossary implements IElementChangedList
@@ -108,6 +109,17 @@ public class JavaProjectGlossary extends Glossary implements IElementChangedList
}
}
}
}
 
private String getSuggestionName(ICompilationUnit compilationUnit) {
 
try {
 
String packageName = compilationUnit.getPackageDeclarations()[0].getElementName();
 
String className = compilationUnit.getElementName().split("\\.")[0];
 
return packageName + "." + className;
 
} catch (JavaModelException e) {
 
e.printStackTrace();
 
}
 
return "";
 
}
 
private boolean updateControllerCandidates(IJavaElementDelta delta) {
private boolean updateControllerCandidates(IJavaElementDelta delta) {
boolean updated = false;
boolean updated = false;
ICompilationUnit compUnit = (ICompilationUnit) delta.getElement();
ICompilationUnit compUnit = (ICompilationUnit) delta.getElement();
Loading