use of org.eclipse.jdt.core.dom.IExtendedModifier in project AutoRefactor by JnRouvignac.
the class ObsoleteRedundantModifiersCleanUp method removePrivateModifier.
private boolean removePrivateModifier(final BodyDeclaration visited) {
List<IExtendedModifier> modifiers = visited.modifiers();
for (Modifier modifier : getModifiersOnly(modifiers)) {
if (modifier.isPrivate()) {
TextEditGroup group = new TextEditGroup(MultiFixMessages.ObsoleteRedundantModifiersCleanUp_description);
ASTRewrite rewrite = cuRewrite.getASTRewrite();
rewrite.remove(modifier, group);
return false;
}
}
return true;
}
use of org.eclipse.jdt.core.dom.IExtendedModifier in project AutoRefactor by JnRouvignac.
the class ObsoleteRedundantModifiersCleanUp method maybeRemovePublicStaticFinalModifiers.
private boolean maybeRemovePublicStaticFinalModifiers(final FieldDeclaration visited) {
// Remove modifiers implied by the context
boolean result = true;
List<IExtendedModifier> modifiers = visited.modifiers();
for (Modifier modifier : getModifiersOnly(modifiers)) {
if (modifier.isPublic() || modifier.isStatic() || modifier.isFinal()) {
TextEditGroup group = new TextEditGroup(MultiFixMessages.ObsoleteRedundantModifiersCleanUp_description);
ASTRewrite rewrite = cuRewrite.getASTRewrite();
rewrite.remove(modifier, group);
result = false;
}
}
return result;
}
use of org.eclipse.jdt.core.dom.IExtendedModifier in project AutoRefactor by JnRouvignac.
the class ObsoleteRedundantModifiersCleanUp method removeStaticAbstractModifier.
private boolean removeStaticAbstractModifier(final List<IExtendedModifier> modifiers) {
boolean result = true;
for (Modifier modifier : getModifiersOnly(modifiers)) {
if (modifier.isStatic() || modifier.isAbstract()) {
TextEditGroup group = new TextEditGroup(MultiFixMessages.ObsoleteRedundantModifiersCleanUp_description);
ASTRewrite rewrite = cuRewrite.getASTRewrite();
rewrite.remove(modifier, group);
result = false;
}
}
return result;
}
use of org.eclipse.jdt.core.dom.IExtendedModifier in project AutoRefactor by JnRouvignac.
the class ObsoleteRedundantModifiersCleanUp method reorderModifiers.
private void reorderModifiers(final List<IExtendedModifier> reorderedModifiers) {
ASTRewrite rewrite = cuRewrite.getASTRewrite();
TextEditGroup group = new TextEditGroup(MultiFixMessages.ObsoleteRedundantModifiersCleanUp_description);
for (int i = 0; i < reorderedModifiers.size(); i++) {
IExtendedModifier extendedModifier = reorderedModifiers.get(i);
if (extendedModifier.isModifier()) {
rewrite.moveToIndex((Modifier) extendedModifier, i, ASTNodes.createMoveTarget(rewrite, (Modifier) extendedModifier), group);
} else {
rewrite.moveToIndex((Annotation) extendedModifier, i, ASTNodes.createMoveTarget(rewrite, (Annotation) extendedModifier), group);
}
}
}
use of org.eclipse.jdt.core.dom.IExtendedModifier in project AutoRefactor by JnRouvignac.
the class ObsoleteRedundantModifiersCleanUp method removePublicAbstractModifiers.
private boolean removePublicAbstractModifiers(final BodyDeclaration visited) {
List<IExtendedModifier> modifiers = visited.modifiers();
boolean result = true;
for (Modifier modifier : getModifiersOnly(modifiers)) {
if (modifier.isPublic() || modifier.isAbstract()) {
TextEditGroup group = new TextEditGroup(MultiFixMessages.ObsoleteRedundantModifiersCleanUp_description);
ASTRewrite rewrite = cuRewrite.getASTRewrite();
rewrite.remove(modifier, group);
result = false;
}
}
return result;
}
Aggregations