List of usage examples for org.eclipse.jdt.core.dom Comment getProperty
public final Object getProperty(String propertyName)
null
if none. From source file:org.eclipse.wb.internal.core.utils.ast.AstEditor.java
License:Open Source License
/** * @return the {@link List} of {@link Comment}'s in this {@link CompilationUnit}. */// ww w . j a v a 2 s.c om public List<Comment> getCommentList() throws Exception { List<Comment> comments = Lists.newArrayList(); comments.addAll(DomGenerics.getCommentList(m_astUnit)); // clean up int documentLength = m_document.getLength(); for (Iterator<Comment> I = comments.iterator(); I.hasNext();) { Comment comment = I.next(); if (comment.getProperty(REMOVED_COMMENT) != null) { I.remove(); continue; } if (AstNodeUtils.getSourceBegin(comment) < 0 || AstNodeUtils.getSourceEnd(comment) > documentLength) { I.remove(); } else if (comment instanceof LineComment) { if (!getSource(comment).startsWith("//")) { I.remove(); } } else if (comment instanceof BlockComment) { if (!getSource(comment).startsWith("/*")) { I.remove(); } } } // protect from modifications return Collections.unmodifiableList(comments); }