Java Code Examples for org.eclipse.jdt.core.dom.NumberLiteral#setToken()

The following examples show how to use org.eclipse.jdt.core.dom.NumberLiteral#setToken() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UpperEllQuickfix.java    From eclipse-cs with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected ASTVisitor handleGetCorrectingASTVisitor(final IRegion lineInfo,
        final int markerStartOffset) {
  return new ASTVisitor() {

    @Override
    public boolean visit(NumberLiteral node) {
      if (containsPosition(node, markerStartOffset)) {

        String token = node.getToken();
        if (token.endsWith("l")) { //$NON-NLS-1$
          token = token.replace('l', 'L');
          node.setToken(token);
        }
      }
      return true;
    }
  };
}
 
Example 2
Source File: UpperEllQuickFix.java    From vscode-checkstyle with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public ASTVisitor getCorrectingASTVisitor(IRegion lineInfo, int markerStartOffset) {
    return new ASTVisitor() {

        @Override
        public boolean visit(NumberLiteral node) {
            if (containsPosition(node, markerStartOffset)) {

                String token = node.getToken();
                if (token.endsWith("l")) { //$NON-NLS-1$
                    token = token.replace('l', 'L');
                    node.setToken(token);
                }
            }
            return true;
        }
    };
}
 
Example 3
Source File: GetterSetterUtil.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private static Expression createInfixInvocationFromPostPrefixExpression(InfixExpression.Operator operator, Expression getterExpression, AST ast, ITypeBinding variableType, boolean is50OrHigher) {
	InfixExpression infix= ast.newInfixExpression();
	infix.setLeftOperand(getterExpression);
	infix.setOperator(operator);
	NumberLiteral number= ast.newNumberLiteral();
	number.setToken("1"); //$NON-NLS-1$
	infix.setRightOperand(number);
	ITypeBinding infixType= infix.resolveTypeBinding();
	return createNarrowCastIfNessecary(infix, infixType, ast, variableType, is50OrHigher);
}