Example usage for org.eclipse.jdt.core.dom SynchronizedStatement getStartPosition

List of usage examples for org.eclipse.jdt.core.dom SynchronizedStatement getStartPosition

Introduction

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

Prototype

public final int getStartPosition() 

Source Link

Document

Returns the character index into the original source file indicating where the source fragment corresponding to this node begins.

Usage

From source file:br.uff.ic.gems.resources.ast.Visitor.java

@Override
public boolean visit(SynchronizedStatement node) {
    int beginLine = cu.getLineNumber(node.getStartPosition());
    int endLine = cu.getLineNumber(node.getStartPosition() + node.getLength());
    int beginColumn = cu.getColumnNumber(node.getStartPosition());
    int endColumn = cu.getColumnNumber(node.getStartPosition() + node.getLength());

    Block body = node.getBody();// w  w w  .java 2  s .c o  m

    if (body != null) {

        int beginLineBody = cu.getLineNumber(body.getStartPosition());
        int endLineBody = cu.getLineNumber(body.getStartPosition() + body.getLength());
        int beginColumnBody = cu.getColumnNumber(body.getStartPosition());
        int endColumnBody = cu.getColumnNumber(body.getStartPosition() + body.getLength());

        languageConstructs.add(new LanguageConstruct(node.getClass().getSimpleName(), beginLine, endLine,
                beginColumn, endColumn, beginLineBody, endLineBody, beginColumnBody, endColumnBody, null));
    } else {
        languageConstructs.add(new LanguageConstruct(node.getClass().getSimpleName(), beginLine, endLine,
                beginColumn, endColumn));
    }
    return true;
}

From source file:com.chookapp.org.bracketeer.jdt.ClosingBracketHintVisitor.java

License:Open Source License

@Override
public boolean visit(SynchronizedStatement node) {
    String hint = GetNodeText(node.getExpression());
    int startLoc = node.getStartPosition();
    int endLoc = startLoc + node.getLength() - 1;
    try {/* w ww .  j  a  v  a 2  s .  co  m*/
        _container.add(new Hint("synchronized", startLoc, endLoc, "synchronized( " + hint + " )")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    } catch (BadLocationException e) {
        _cancelProcessing.set(true);
    }
    return shouldContinue();
}

From source file:sharpen.core.CSharpBuilder.java

License:Open Source License

public boolean visit(SynchronizedStatement node) {
    CSLockStatement stmt = new CSLockStatement(node.getStartPosition(), mapExpression(node.getExpression()));
    visitBlock(stmt.body(), node.getBody());
    addStatement(stmt);/*from  w ww  .j ava  2 s.  c  o  m*/
    return false;
}