use of org.eclipse.jdt.core.dom.IExtendedModifier in project AutoRefactor by JnRouvignac.
the class ObsoleteStaticInnerClassThanNonStaticCleanUp method makeStatic.
private void makeStatic(final TypeDeclaration node) {
ASTRewrite rewrite = cuRewrite.getASTRewrite();
ASTNodeFactory ast = cuRewrite.getASTBuilder();
TextEditGroup group = new TextEditGroup(MultiFixMessages.ObsoleteStaticInnerClassThanNonStaticCleanUp_description);
List<IExtendedModifier> modifiers = node.modifiers();
Modifier static0 = ast.static0();
if (modifiers.isEmpty()) {
rewrite.insertBefore(static0, node, group);
} else {
IExtendedModifier lastModifier = modifiers.get(modifiers.size() - 1);
if (!lastModifier.isModifier()) {
rewrite.insertAfter(static0, (Annotation) lastModifier, group);
} else if (((Modifier) lastModifier).isFinal()) {
rewrite.insertBefore(static0, (Modifier) lastModifier, group);
} else {
rewrite.insertAfter(static0, (Modifier) lastModifier, group);
}
}
}
Aggregations