Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.StringLiteral


     */
    public void addEnumConstant(String name, String doc, String value) {
        if (m_class instanceof EnumDeclaration) {
            EnumConstantDeclaration enumdecl = getAST().newEnumConstantDeclaration();
            enumdecl.setName(getAST().newSimpleName(name));
            StringLiteral strlit = getAST().newStringLiteral();
            strlit.setLiteralValue(value);
            enumdecl.arguments().add(strlit);
            addJavaDoc(doc, enumdecl);
            ((EnumDeclaration)m_class).enumConstants().add(enumdecl);
        } else {
            // should not be possible, but just in case of added types in future
View Full Code Here


     * @return instance creation
     */
    public NewInstanceBuilder newInstanceFromString(String type, String value) {
        ClassInstanceCreation create = getAST().newClassInstanceCreation();
        create.setType(createType(type));
        StringLiteral literal = getAST().newStringLiteral();
        literal.setLiteralValue(value);
        create.arguments().add(literal);
        return new NewInstanceBuilder(this, create);
    }
View Full Code Here

     * @return instance creation
     */
    public NewInstanceBuilder newInstanceFromStrings(String type, String value1, String value2) {
        ClassInstanceCreation create = getAST().newClassInstanceCreation();
        create.setType(createType(type));
        StringLiteral literal = getAST().newStringLiteral();
        literal.setLiteralValue(value1);
        create.arguments().add(literal);
        literal = getAST().newStringLiteral();
        literal.setLiteralValue(value2);
        create.arguments().add(literal);
        return new NewInstanceBuilder(this, create);
    }
View Full Code Here

     * @param text literal text
     * @return string concatenation expression
     */
    public InfixExpressionBuilder buildStringConcatenation(String text) {
        InfixExpression expr = getAST().newInfixExpression();
        StringLiteral strlit = getAST().newStringLiteral();
        strlit.setLiteralValue(text);
        expr.setOperator(Operator.PLUS);
        return new InfixExpressionBuilder(this, expr, strlit);
    }
View Full Code Here

     *
     * @param value literal value
     * @return literal
     */
    public StringLiteral stringLiteral(String value) {
        StringLiteral literal = m_ast.newStringLiteral();
        literal.setLiteralValue(value);
        return literal;
    }
View Full Code Here

     *
     * @param value
     */
    public void setStringInitializer(String value) {
        VariableDeclarationFragment frag = (VariableDeclarationFragment)m_field.fragments().get(0);
        StringLiteral literal = m_ast.newStringLiteral();
        literal.setLiteralValue(value);
        frag.setInitializer(literal);
    }
View Full Code Here

     * Add a string literal operand to expression.
     *
     * @param value
     */
    public void addStringLiteralOperand(String value) {
        StringLiteral strlit = m_ast.newStringLiteral();
        strlit.setLiteralValue(value);
        addOperand(strlit);
    }
View Full Code Here

        if (arg instanceof MethodInvocation) {
          MethodInvocation mi = (MethodInvocation) arg;
          args = mi.arguments();
          arg = (Expression) args.get(0);
          if (arg instanceof StringLiteral) {
            StringLiteral sl = (StringLiteral) arg;
            String path = sl.getLiteralValue();
            return new ResourceIcon(icon, path);
          }
        }
      }
    }
View Full Code Here

        if (arg instanceof MethodInvocation) {
          mi = (MethodInvocation) arg;
          args = mi.arguments();
          arg = (Expression) args.get(0);
          if (arg instanceof StringLiteral) {
            StringLiteral sl = (StringLiteral) arg;
            String path = sl.getLiteralValue();
            return new ResourceImage(icon, path);
          }
        }
      }
    }
View Full Code Here

        if (arg instanceof MethodInvocation) {
          MethodInvocation mi = (MethodInvocation) arg;
          args = mi.arguments();
          arg = (Expression) args.get(0);
          if (arg instanceof StringLiteral) {
            StringLiteral sl = (StringLiteral) arg;
            String path = sl.getLiteralValue();
            return new ResourceIcon(icon, path);
          }
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.StringLiteral

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.