use of org.eclipse.jdt.core.dom.Javadoc in project AutoRefactor by JnRouvignac.
the class CommentsCleanUp method getNextNode.
private ASTNode getNextNode(final Comment node) {
int nodeEndPosition = node.getStartPosition() + node.getLength();
ASTNode coveringNode = getCoveringNode(node);
int parentNodeEndPosition = coveringNode.getStartPosition() + coveringNode.getLength();
NodeFinder finder = new NodeFinder(coveringNode, nodeEndPosition, parentNodeEndPosition - nodeEndPosition);
if (node instanceof Javadoc) {
return finder.getCoveringNode();
}
return finder.getCoveredNode();
}
use of org.eclipse.jdt.core.dom.Javadoc in project xtext-xtend by eclipse.
the class JavaASTFlattener method visit.
@Override
public boolean visit(final PackageDeclaration it) {
Javadoc _javadoc = it.getJavadoc();
boolean _tripleNotEquals = (_javadoc != null);
if (_tripleNotEquals) {
it.getJavadoc().accept(this);
}
this.visitAll(it.annotations(), " ");
this.appendToBuffer("package ");
it.getName().accept(this);
this.appendLineWrapToBuffer();
return false;
}
use of org.eclipse.jdt.core.dom.Javadoc in project xtext-xtend by eclipse.
the class JavaASTFlattener method visit.
@Override
public boolean visit(final Initializer it) {
Javadoc _javadoc = it.getJavadoc();
boolean _tripleNotEquals = (_javadoc != null);
if (_tripleNotEquals) {
it.getJavadoc().accept(this);
}
this.appendModifiers(it, it.modifiers());
boolean _isStatic = this._aSTFlattenerUtils.isStatic(it.modifiers());
if (_isStatic) {
if (((it.getParent() instanceof TypeDeclaration) && IterableExtensions.<FieldDeclaration>forall(IterableExtensions.<FieldDeclaration>filter(((Iterable<FieldDeclaration>) Conversions.doWrapArray(((TypeDeclaration) it.getParent()).getFields())), ((Function1<FieldDeclaration, Boolean>) (FieldDeclaration it_1) -> {
return Boolean.valueOf((this._aSTFlattenerUtils.isStatic(it_1.modifiers()) && this._aSTFlattenerUtils.isFinal(it_1.modifiers())));
})), ((Function1<FieldDeclaration, Boolean>) (FieldDeclaration f) -> {
final Function1<VariableDeclarationFragment, Boolean> _function = (VariableDeclarationFragment fragment) -> {
Boolean _isAssignedInBody = this._aSTFlattenerUtils.isAssignedInBody(it.getBody(), fragment);
return Boolean.valueOf((!(_isAssignedInBody).booleanValue()));
};
return Boolean.valueOf(IterableExtensions.<VariableDeclarationFragment>forall(f.fragments(), _function));
})))) {
this.appendToBuffer(" final Void static_initializer = {");
this.appendLineWrapToBuffer();
it.getBody().accept(this);
this.appendToBuffer("null }");
this.appendLineWrapToBuffer();
} else {
this.addProblem(it, "Static initializer is not fully supported");
this.appendToBuffer("{/*FIXME ");
it.getBody().accept(this);
this.appendToBuffer("*/}");
}
} else {
ASTNode _parent = it.getParent();
if ((_parent instanceof AnonymousClassDeclaration)) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("Initializer is not supported in ");
String _simpleName = ASTNode.nodeClassForType(it.getParent().getNodeType()).getSimpleName();
_builder.append(_simpleName);
this.addProblem(it, _builder.toString());
}
it.getBody().accept(this);
}
return false;
}
use of org.eclipse.jdt.core.dom.Javadoc in project xtext-xtend by eclipse.
the class JavaASTFlattener method visit.
@Override
public boolean visit(final FieldDeclaration it) {
Javadoc _javadoc = it.getJavadoc();
boolean _tripleNotEquals = (_javadoc != null);
if (_tripleNotEquals) {
it.getJavadoc().accept(this);
}
final Consumer<VariableDeclarationFragment> _function = (VariableDeclarationFragment frag) -> {
this.appendModifiers(it, it.modifiers());
boolean _isPackageVisibility = this._aSTFlattenerUtils.isPackageVisibility(Iterables.<Modifier>filter(it.modifiers(), Modifier.class));
if (_isPackageVisibility) {
ASTNode _parent = it.getParent();
if ((_parent instanceof TypeDeclaration)) {
ASTNode _parent_1 = it.getParent();
boolean _isInterface = ((TypeDeclaration) _parent_1).isInterface();
boolean _not = (!_isInterface);
if (_not) {
this.appendToBuffer("package ");
}
}
}
it.getType().accept(this);
this.appendExtraDimensions(frag.getExtraDimensions());
this.appendSpaceToBuffer();
frag.accept(this);
};
it.fragments().forEach(_function);
return false;
}
use of org.eclipse.jdt.core.dom.Javadoc in project xtext-xtend by eclipse.
the class JavaASTFlattener method visit.
@Override
public boolean visit(final TypeDeclaration it) {
boolean _isDummyType = this._aSTFlattenerUtils.isDummyType(it);
if (_isDummyType) {
this.visitAll(it.bodyDeclarations(), this.nl());
return false;
}
boolean _isNotSupportedInnerType = this._aSTFlattenerUtils.isNotSupportedInnerType(it);
if (_isNotSupportedInnerType) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("/* FIXME Non-static inner classes are not supported.*/");
this.appendToBuffer(_builder.toString());
this.addProblem(it, "Non-static inner classes are not supported.");
}
Javadoc _javadoc = it.getJavadoc();
boolean _tripleNotEquals = (_javadoc != null);
if (_tripleNotEquals) {
it.getJavadoc().accept(this);
}
this.appendModifiers(it, it.modifiers());
boolean _isInterface = it.isInterface();
if (_isInterface) {
this.appendToBuffer("interface ");
} else {
boolean _isPackageVisibility = this._aSTFlattenerUtils.isPackageVisibility(Iterables.<Modifier>filter(it.modifiers(), Modifier.class));
if (_isPackageVisibility) {
this.appendToBuffer("package ");
}
this.appendToBuffer("class ");
}
it.getName().accept(this);
boolean _isEmpty = it.typeParameters().isEmpty();
boolean _not = (!_isEmpty);
if (_not) {
this.appendTypeParameters(it.typeParameters());
}
this.appendSpaceToBuffer();
Type _superclassType = it.getSuperclassType();
boolean _tripleNotEquals_1 = (_superclassType != null);
if (_tripleNotEquals_1) {
this.appendToBuffer("extends ");
it.getSuperclassType().accept(this);
this.appendSpaceToBuffer();
}
boolean _isEmpty_1 = it.superInterfaceTypes().isEmpty();
boolean _not_1 = (!_isEmpty_1);
if (_not_1) {
boolean _isInterface_1 = it.isInterface();
if (_isInterface_1) {
this.appendToBuffer("extends ");
} else {
this.appendToBuffer("implements ");
}
this.visitAllSeparatedByComma(it.superInterfaceTypes());
}
this.appendToBuffer("{");
this.increaseIndent();
BodyDeclaration prev = null;
List _bodyDeclarations = it.bodyDeclarations();
for (final BodyDeclaration body : ((Iterable<BodyDeclaration>) _bodyDeclarations)) {
{
if ((prev instanceof EnumConstantDeclaration)) {
if ((body instanceof EnumConstantDeclaration)) {
this.appendToBuffer(", ");
} else {
this.appendToBuffer("; ");
}
}
this.appendLineWrapToBuffer();
body.accept(this);
prev = body;
}
}
ASTNode _root = it.getRoot();
if ((_root instanceof CompilationUnit)) {
ASTNode _root_1 = it.getRoot();
final CompilationUnit cu = ((CompilationUnit) _root_1);
final Consumer<Comment> _function = (Comment it_1) -> {
it_1.accept(this);
this.assignedComments.add(it_1);
};
this.unAssignedComments(cu).forEach(_function);
}
this.decreaseIndent();
this.appendLineWrapToBuffer();
this.appendToBuffer("}");
return false;
}
Aggregations