List of usage examples for org.eclipse.jdt.core.dom VariableDeclarationExpression getLength
public final int getLength()
From source file:br.uff.ic.gems.resources.ast.Visitor.java
@Override public boolean visit(VariableDeclarationExpression node) { List<VariableDeclarationFragment> fragments = node.fragments(); for (VariableDeclarationFragment fragment : fragments) { int beginLine = cu.getLineNumber(fragment.getStartPosition()); int endLine = cu.getLineNumber(fragment.getStartPosition() + fragment.getLength()); int beginColumn = cu.getColumnNumber(node.getStartPosition()); int endColumn = cu.getColumnNumber(node.getStartPosition() + node.getLength()); SimpleName name = fragment.getName(); if (name != null) { endLine = cu.getLineNumber(name.getStartPosition() + name.getLength()); endColumn = cu.getColumnNumber(name.getStartPosition() + name.getLength()); }//from w w w . j a v a 2s .c o m languageConstructs.add(new LanguageConstruct(node.getClass().getSimpleName(), beginLine, endLine, beginColumn, endColumn, fragment.getName().getIdentifier())); } return true; }
From source file:br.uff.ic.mergeguider.javaparser.DepVisitor.java
@Override public boolean visit(VariableDeclarationExpression node) { Location location;//from w ww . j av a 2 s. c o m List<VariableDeclarationFragment> fragments = node.fragments(); for (VariableDeclarationFragment fragment : fragments) { int elementLineBegin = cu.getLineNumber(fragment.getStartPosition()); int elementLineEnd = cu.getLineNumber(fragment.getStartPosition() + node.getLength()); int elementColumnBegin = cu.getColumnNumber(fragment.getStartPosition()); int elementColumnEnd = cu.getColumnNumber(fragment.getStartPosition() + node.getLength()); location = new Location(elementLineBegin, elementLineEnd, elementColumnBegin, elementColumnEnd); MyVariableDeclaration myVariableDeclaration = new MyVariableDeclaration(fragment, location); if (!classLanguageConstructsList.isEmpty()) { classLanguageConstructsList.get(classLanguageConstructsList.size() - 1).getVariableDeclarations() .add(myVariableDeclaration); } } return true; }