Package org.eclipse.jdt.core.dom

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


    }

    ASTNode decl = getSurroundingDecl(coveringNode);
    if (decl != null) {
      if (decl instanceof FieldDeclaration) {
        FieldDeclaration fieldDecl = (FieldDeclaration) decl;

        // if cursor is inside a specific variable declaration fragment,
        // only get assists for that fragment
        VariableDeclarationFragment coveringFragment = getSurroundingFragment(coveringNode);
        if (coveringFragment != null) {
          return checkAndReturnAssists(fieldDecl, coveringFragment.getName(), context);
        }

        // cannot tell which fragment cursor is on, so get assists for
        // all fragments
        List<VariableDeclarationFragment> fragments = fieldDecl.fragments();
        List<IJavaCompletionProposal> proposals = new ArrayList<IJavaCompletionProposal>();

        for (VariableDeclarationFragment fragment : fragments) {
          SimpleName name = fragment.getName();
          proposals.addAll(checkAndReturnAssists(fieldDecl, name, context));
View Full Code Here


      assistContext = new AssistContext(javaContext.getCompilationUnit(), sourceViewer,
          fieldSourceRange.getOffset(), fieldSourceRange.getLength());
      node = assistContext.getCoveringNode();
      if (node instanceof FieldDeclaration) {
        // int invocationOffset = javaContext.getInvocationOffset();
        FieldDeclaration fieldDecl = (FieldDeclaration) node;
        // Set<Annotation> annotations =
        // ProposalCalculatorUtil.findAnnotations("Qualifier",
        // invocationOffset,
        // fieldDecl);
        // for (Annotation a : annotations) {
        // LocationInformation info = getLocationSourceRange(a,
        // javaContext.getViewer(), invocationOffset);
        // int locationOffset = info.getOffset();
        // int locationLength = info.getLength();
        // if (invocationOffset >= locationOffset && invocationOffset <=
        // locationOffset + locationLength) {
        ITypeBinding typeBinding = fieldDecl.getType().resolveBinding();
        proposals.addAll(getMatchingBeansProposal(locationInfo.getFilter(), typeBinding, fieldDecl,
            javaContext, locationInfo));
      }
    }
View Full Code Here

              proposals.addAll(new AutowireRequiredNotFoundAnnotationQuickAssistProcessor().getAssists(
                  decl, assistContext));
            }
          }
          else if (node instanceof FieldDeclaration) {
            FieldDeclaration decl = (FieldDeclaration) node;
            List<VariableDeclarationFragment> fragments = decl.fragments();
            // SimpleName name = fragments.get(0).getName();
            if (fragments.size() > 0) {
              if (problemType.equals(AutowireDependencyProvider.TOO_MANY_MATCHING_BEANS)) {
                proposals.addAll(new QualifierAnnotationQuickAssistProcessor().getAssists(decl,
                    assistContext));
View Full Code Here

  }

  public void testFieldWithNoAutowired() throws JavaModelException {
    IField field = type.getField("testBean1");
    ISourceRange sourceRange = field.getSourceRange();
    FieldDeclaration fieldDecl = (FieldDeclaration) getASTNode(sourceRange, type, viewer);
    IInvocationContext context = getContext(sourceRange, field, fieldDecl);

    List<IJavaCompletionProposal> proposals = processor.getAssists(fieldDecl, context);
    assertTrue("No proposals expected", proposals.isEmpty());
  }
View Full Code Here

  }

  public void testField() throws JavaModelException {
    IField field = type.getField("testBean2");
    ISourceRange sourceRange = field.getSourceRange();
    FieldDeclaration fieldDecl = (FieldDeclaration) getASTNode(sourceRange, type, viewer);
    IInvocationContext context = getContext(sourceRange, field, fieldDecl);

    List<IJavaCompletionProposal> proposals = processor.getAssists(fieldDecl, context);
    assertEquals("1 proposal is expected", 1, proposals.size());
    assertTrue("AddQualiferCompletionProposal expected", proposals.get(0) instanceof AddQualiferCompletionProposal);
View Full Code Here

  }

  public void testField() throws JavaModelException {
    IField field = type.getField("testBean1");
    ISourceRange sourceRange = field.getSourceRange();
    FieldDeclaration fieldDecl = (FieldDeclaration) getASTNode(sourceRange, type, viewer);
    IInvocationContext context = getContext(sourceRange, field, fieldDecl);

    List<IJavaCompletionProposal> proposals = processor.getAssists(fieldDecl, context);
    assertTrue("2 proposals are expected", proposals.size() == 2);
    assertTrue("AddAutowireCompletionProposal expected", proposals.get(0) instanceof AddAutowireCompletionProposal);
View Full Code Here

  }

  public void testFieldWithAutowired() throws JavaModelException {
    IField field = type.getField("testBean2");
    ISourceRange sourceRange = field.getSourceRange();
    FieldDeclaration fieldDecl = (FieldDeclaration) getASTNode(sourceRange, type, viewer);
    IInvocationContext context = getContext(sourceRange, field, fieldDecl);

    List<IJavaCompletionProposal> proposals = processor.getAssists(fieldDecl, context);
    assertTrue("No proposals expected", proposals.isEmpty());
  }
View Full Code Here

TOP

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

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.