Example usage for org.eclipse.jdt.core.dom Javadoc getProperty

List of usage examples for org.eclipse.jdt.core.dom Javadoc getProperty

Introduction

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

Prototype

public final Object getProperty(String propertyName) 

Source Link

Document

Returns the value of the named property of this node, or null if none.

Usage

From source file:com.crispico.flower.mp.metamodel.codesyncjava.algorithm.JavaSyncUtils.java

License:Open Source License

/**
 * This is a common method for {@link ReverseJavaType} and
 * {@link ReverseJavaDeclaration} used for retrieving the comment feature.
 * /*w ww .  j av  a  2s.com*/
 * @param astElement
 *            must be of type {@link CompilationUnit} or
 *            {@link BodyDeclaration}
 * @return the comment list for this <code>astElement</code>
 * 
 * @author Luiza
 */
public static List<Comment> getComment(ASTNode astElement) {
    List<Comment> listComments = new ArrayList<Comment>();
    String documentation = "";
    Javadoc javaDoc = null;

    if (astElement instanceof CompilationUnit) { // class or interface
        javaDoc = JavaSyncUtils.getMasterClass((CompilationUnit) astElement).getJavadoc();
    } else if (astElement instanceof BodyDeclaration) { // attribute or method
        javaDoc = ((BodyDeclaration) astElement).getJavadoc();
    } else {
        return null;
    }

    if (javaDoc != null) {
        documentation = (String) javaDoc.getProperty("comment"); // the comment as it is in the file
    }
    if (documentation != null && documentation.length() > 0) {
        listComments.add(SyncUtils.createComment(documentation));
    }
    return listComments;
}

From source file:com.crispico.flower.mp.metamodel.codesyncjava.algorithm.reverse.ReverseJavaClass_OwnedFields.java

License:Open Source License

/**
 * @flowerModelElementId _zb9VMpiOEd6aNMdNFvR5WQ
 *//*from  w  w w.  j a va  2s .  c  o m*/
@Override
protected String getUIDForAstElement(FieldDeclaration astElement) {
    Javadoc docComment = astElement.getJavadoc();
    if (docComment == null)
        return null;
    else
        return SyncUtils.getFlowerModelElementID((String) docComment.getProperty("comment"));
}

From source file:com.crispico.flower.mp.metamodel.codesyncjava.algorithm.reverse.ReverseJavaClass_OwnedMethods.java

License:Open Source License

/**
 * @flowerModelElementId _zb9VX5iOEd6aNMdNFvR5WQ
 */// ww  w .  jav a 2s  . c  o m
@Override
protected String getUIDForAstElement(MethodDeclaration astElement) {
    Javadoc docComment = astElement.getJavadoc();
    if (docComment == null)
        return null;
    else
        return SyncUtils.getFlowerModelElementID((String) docComment.getProperty("comment"));
}

From source file:com.crispico.flower.mp.metamodel.codesyncjava.algorithm.reverse.ReversePackage_JavaTypes.java

License:Open Source License

@Override
protected String getUIDForAstElement(FileAndAST<CompilationUnit> astElement) {
    TypeDeclaration type = JavaSyncUtils.getMasterClass(astElement.getAstElement());
    Javadoc docComment = type == null ? null : type.getJavadoc();
    if (docComment == null)
        return null;
    else//  w  ww.  j  a va2s  . c o  m
        return SyncUtils.getFlowerModelElementID((String) docComment.getProperty("comment"));
}