Example usage for org.eclipse.jdt.core.dom Message getLength

List of usage examples for org.eclipse.jdt.core.dom Message getLength

Introduction

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

Prototype

public int getLength() 

Source Link

Document

Returns the length in characters of the original source file indicating where the source fragment corresponding to this message ends.

Usage

From source file:org.modeshape.sequencer.javafile.JdtRecorder.java

License:Apache License

protected void recordCompilerMessages(final CompilationUnit unit, final Node parentNode) throws Exception {
    final Message[] messages = unit.getMessages();

    if ((messages != null) && (messages.length != 0)) {
        final Node containerNode = parentNode.addNode(ClassFileSequencerLexicon.MESSAGES,
                ClassFileSequencerLexicon.MESSAGES);

        for (final Message message : messages) {
            final Node messageNode = containerNode.addNode(ClassFileSequencerLexicon.MESSAGE,
                    ClassFileSequencerLexicon.MESSAGE);
            messageNode.setProperty(ClassFileSequencerLexicon.MESSAGE, message.getMessage());
            messageNode.setProperty(ClassFileSequencerLexicon.START_POSITION, message.getStartPosition());
            messageNode.setProperty(ClassFileSequencerLexicon.LENGTH, message.getLength());
        }/*from  ww  w. j av a2 s .c  om*/
    }
}