use of com.intellij.psi.SyntheticElement in project intellij-community by JetBrains.
the class GrPackageInspection method getElementToHighlight.
@Nullable
private static PsiElement getElementToHighlight(GroovyFile file) {
GrPackageDefinition packageDefinition = file.getPackageDefinition();
if (packageDefinition != null)
return packageDefinition;
PsiClass[] classes = file.getClasses();
for (PsiClass aClass : classes) {
if (!(aClass instanceof SyntheticElement) && aClass instanceof GrTypeDefinition) {
return ((GrTypeDefinition) aClass).getNameIdentifierGroovy();
}
}
GrTopStatement[] statements = file.getTopStatements();
if (statements.length > 0) {
GrTopStatement first = statements[0];
if (first instanceof GrNamedElement)
return ((GrNamedElement) first).getNameIdentifierGroovy();
return first;
}
return null;
}
Aggregations