mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
better formatting for inner classes and annotations on Classes, Methods and Fields
This commit is contained in:
@@ -358,6 +358,7 @@ public class ClsClassImpl extends ClsRepositoryPsiElement<PsiClassStub<?>> imple
|
||||
|
||||
PsiClass[] classes = getInnerClasses();
|
||||
if (classes.length > 0) {
|
||||
goNextLine(newIndentLevel, buffer);
|
||||
goNextLine(newIndentLevel, buffer);
|
||||
for (int i = 0; i < classes.length; i++) {
|
||||
PsiClass aClass = classes[i];
|
||||
|
||||
@@ -62,11 +62,23 @@ public class ClsModifierListImpl extends ClsRepositoryPsiElement<PsiModifierList
|
||||
throw new IncorrectOperationException(CAN_NOT_MODIFY_MESSAGE);
|
||||
}
|
||||
|
||||
private boolean isAnnotationFormattingAllowed() {
|
||||
final PsiElement element = getParent();
|
||||
return element instanceof PsiClass
|
||||
|| element instanceof PsiMethod
|
||||
|| element instanceof PsiField;
|
||||
}
|
||||
|
||||
public void appendMirrorText(final int indentLevel, final StringBuffer buffer) {
|
||||
PsiAnnotation[] annotations = getAnnotations();
|
||||
final boolean formattingAllowed = isAnnotationFormattingAllowed();
|
||||
for (PsiAnnotation annotation : annotations) {
|
||||
((ClsAnnotationImpl)annotation).appendMirrorText(indentLevel, buffer);
|
||||
buffer.append(' ');
|
||||
if (formattingAllowed) {
|
||||
goNextLine(indentLevel, buffer);
|
||||
} else {
|
||||
buffer.append(' ');
|
||||
}
|
||||
}
|
||||
|
||||
PsiElement parent = getParent();
|
||||
|
||||
Reference in New Issue
Block a user