IDEA-107059 Manage spaces after modifier list

This commit is contained in:
Max Medvedev
2013-05-13 18:26:52 +04:00
parent c9caa273d7
commit 50ed7ae8ca
@@ -317,6 +317,16 @@ public class GrModifierListImpl extends GrStubElementBase<GrModifierListStub> im
}
}
@Override
public ASTNode addInternal(ASTNode first, ASTNode last, ASTNode anchor, Boolean before) {
final ASTNode node = super.addInternal(first, last, anchor, before);
final PsiElement sibling = getNextSibling();
if (sibling != null && sibling.getText().contains("\n")) {
sibling.replace(GroovyPsiElementFactory.getInstance(getProject()).createWhiteSpace());
}
return node;
}
private boolean isEmptyModifierList() {
return getTextLength() == 0 || getModifiers().length == 0 && getRawAnnotations().length == 0;
}