Example usage for org.eclipse.jdt.core.dom Comment delete

List of usage examples for org.eclipse.jdt.core.dom Comment delete

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom Comment delete.

Prototype

public final void delete() 

Source Link

Document

Removes this node from its parent.

Usage

From source file:org.whole.lang.java.JavaImportExportTests.java

License:Open Source License

@SuppressWarnings("unchecked")
private boolean performTest(String source) throws Exception {
    CompilationUnit cu = JDTUtils.parseAsCompilationUnit(source);
    IEntity model = JDTTransformerVisitor.transform(source, cu);

    String newSource = PrettyPrinterOperation.toPrettyPrintString(model);
    CompilationUnit cuReparsed = JDTUtils.parseAsCompilationUnit(newSource);

    for (Comment element : (List<Comment>) cu.getCommentList())
        element.delete();

    boolean subtreeMatch = cu.subtreeMatch(new SemanticASTMatcher(), cuReparsed);
    return subtreeMatch;
}