Package org.eclipse.jdt.core.dom

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


    if( astRoot == null )
    {
      return null;
    }

    ASTNode node = NodeFinder.perform(astRoot, region.getOffset(), 1);

    if( node instanceof SimpleName && node.getParent() instanceof MethodDeclaration )
    {
      MethodDeclaration mdec = (MethodDeclaration) node.getParent();
      mockMethod = mdec.resolveBinding();

      paramType = MockUtil.findMockedType(mdec, mockMethod);

      wordRegion = new Region(node.getStartPosition(), node.getLength());

      if( paramType != null && mockMethod != null )
      {
        realMethod = MockUtil.findRealMethodInType(paramType, mockMethod, astRoot.getAST());
      }
View Full Code Here


      ((VariableDeclarationFragment) it.next()).accept(this);
    }
  }
 
  private boolean simpleNameIsConstructorDecl(SimpleName node) {
    ASTNode parent = node.getParent();
    if (parent instanceof MethodDeclaration) {
      if (((MethodDeclaration) parent).isConstructor() && ((MethodDeclaration) parent).getName() == node) {
        return true;
      }
    }
View Full Code Here

  }
 
  public boolean visit(AnonymousClassDeclaration node) {
    insert(containment, getParent(), ownValue);
    // enum constant declaration and classinstancecreation gives types for anonymousclasses
    ASTNode parent = node.getParent();
    if (parent instanceof ClassInstanceCreation) {
      ISourceLocation superclass = resolveBinding(((ClassInstanceCreation) parent).getType());
      insert(typeDependency, ownValue, superclass);
      IConstructor type = bindingsResolver.resolveType(((ClassInstanceCreation) parent).getType().resolveBinding(), false);
        insert(types, ownValue, type);
View Full Code Here

    return true;
  }
 
  public void endVisit(MethodDeclaration node) {
    ownValue = scopeManager.pop();
    ASTNode parent = node.getParent();
    if (parent instanceof TypeDeclaration) {
      // TODO: why can this node.resolveBinding sometimes be null?
      fillOverrides(node.resolveBinding(), ((TypeDeclaration)parent).resolveBinding());
    }
    else if (parent instanceof AnonymousClassDeclaration) {
View Full Code Here

      insert(messages, values.constructor(DATATYPE_RASCAL_MESSAGE_ERROR_NODE_TYPE,
          values.string("No binding for: " + node),
          values.sourceLocation(loc, 0, 0)));
    }
   
    ASTNode parentASTNode = node.getParent();
    if (parentASTNode instanceof FieldDeclaration) {
      FieldDeclaration parent = (FieldDeclaration)parentASTNode;
      parent.getType().accept(this);
      visitListOfModifiers(parent.modifiers());
      if (parent.getJavadoc() != null) {
View Full Code Here

  @SuppressWarnings({"rawtypes"})
  protected IValueList parseExtendedModifiers(List ext) {
    IValueList extendedModifierList = new IValueList(values);
 
    for (Iterator it = ext.iterator(); it.hasNext();) {
      ASTNode p = (ASTNode) it.next();
      IValue val = visitChild(p);
      if (p instanceof Annotation) {
        val = constructModifierNode("annotation", val);
      }
      extendedModifierList.add(val);
View Full Code Here

    private void handleImportNotFound(ISigilProjectModel project,
        final IInvocationContext context, IProblemLocation location,
        final HashMap<Object, IJavaCompletionProposal> results) throws CoreException
    {
        ASTNode selectedNode = location.getCoveringNode(context.getASTRoot());
        if (selectedNode == null)
            return;

        // check QualifiedName for search results as well -
        // happens if import package is already added but exported package has been removed
View Full Code Here

        }
    }

    private Name findNode(IInvocationContext context, IProblemLocation problem)
    {
        ASTNode selectedNode = problem.getCoveringNode(context.getASTRoot());
        if (selectedNode == null)
        {
            return null;
        }

        while (selectedNode.getLocationInParent() == QualifiedName.NAME_PROPERTY)
        {
            selectedNode = selectedNode.getParent();
        }

        Name node = null;

        if (selectedNode instanceof Type)
View Full Code Here

    RunScript runScript = new RunScript(getWindow());
    runScript.withContents(
        "var person = Find.typeByName('Person');\n" +
        "var ast = AST.parseCompilationUnit(person.getCompilationUnit());\n", null, "inline script");
   
    ASTNode ast = runScript.getProperty(ASTNode.class, "ast");
   
    assertThat(ast, is(notNullValue()));
    assertThat(ast.toString(), containsString("public class Person"));
    assertThat(ast.toString(), containsString("public Person("));
  }
View Full Code Here

      fMarkOccurrenceModificationStamp = currentModificationStamp;
    }

    OccurrenceLocation[] matches = null;

    ASTNode selectedNode = NodeFinder.perform(astRoot,
        selection.getOffset(), selection.getLength());

    if (fMarkExceptions || fMarkTypeOccurrences) {
      ExceptionOccurrencesFinder exceptionFinder = new ExceptionOccurrencesFinder();
      String message = exceptionFinder.initialize(astRoot, selectedNode);
View Full Code Here

TOP

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

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.