Package org.eclipse.jdt.core.dom

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


                parentNode = parentNode.getParent();
                if (parentNode instanceof VariableDeclarationStatement) {
                  VariableDeclarationStatement varDeclStmt = (VariableDeclarationStatement) parentNode;
                  Type varDeclType = varDeclStmt.getType();
                  if (varDeclType instanceof SimpleType) {
                    SimpleType sType = (SimpleType) varDeclType;
                    parentNode = parentNode.getParent();
                    if (parentNode instanceof Block) {
                      Block block = (Block) parentNode;

                      try {
                        if (viewer.getDocument().getChar(block.getStartPosition()) != '{') {
                          parentNode = parentNode.getParent();
                          if (parentNode instanceof MethodDeclaration) {
                            MethodDeclaration methodDecl = (MethodDeclaration) parentNode;
                            return getProposals(methodDecl, sType.getName()
                                .getFullyQualifiedName(), invocationOffset,
                                varDeclStmt, javaContext);
                          }
                        }
                      }
                      catch (BadLocationException e) {
                        StatusHandler.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e
                            .getMessage(), e));
                      }
                    }
                  }
                }
              }

              // cursor is at the start of a param type
              else if (parentNode instanceof SimpleType) {
                SimpleType sType = (SimpleType) parentNode;
                parentNode = sType.getParent();
                if (parentNode instanceof SingleVariableDeclaration) {
                  SingleVariableDeclaration varDecl = (SingleVariableDeclaration) parentNode;
                  parentNode = varDecl.getParent();
                  if (parentNode instanceof MethodDeclaration) {
                    MethodDeclaration methodDecl = (MethodDeclaration) parentNode;
                    return getProposals(methodDecl, sType.getName().getFullyQualifiedName(),
                        invocationOffset, sType, javaContext);
                  }
                }
              }
            }
View Full Code Here


      }
    }, true, "variableName");

    SingleVariableDeclaration paramDecl = ast.newSingleVariableDeclaration();

    SimpleType variableType = ast.newSimpleType(ast.newSimpleName("String"));
    paramDecl.setType(variableType);
    addLinkedPosition(astRewrite.track(variableType), false, "variableType");

    SimpleName variableName = ast.newSimpleName(variable.getVariableName());
    paramDecl.setName(variableName);
View Full Code Here

   
    AST ast = param.getAST();
    ASTRewrite astRewrite = ASTRewrite.create(ast);
   
    SimpleName newTypeName = ast.newSimpleName(paramType);
    SimpleType newType = ast.newSimpleType(newTypeName);
    astRewrite.replace(param.getType(), newType, null);
   
    return astRewrite;     
  }
View Full Code Here

    ClassInstanceCreation invocation = QuickfixUtils.getMockConstructorInvocation(className, argTypes);

    Type type = invocation.getType();
    assertTrue("Expects invocation type to be a SimpleType", type instanceof SimpleType);

    SimpleType simpleType = (SimpleType) type;
    assertEquals("Expects invocation class name = " + className, className, simpleType.getName()
        .getFullyQualifiedName());

    assertEquals("Expects number of arguments = " + argTypes.length, argTypes.length, invocation.arguments().size());
  }
View Full Code Here

TOP

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

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.