Examples of IInvocationContext


Examples of org.eclipse.jdt.ui.text.java.IInvocationContext

  @Test
  public void testQuickFixProcessor() {
    long start = System.nanoTime();

    QWickieQuickFixProcessor processor = new QWickieQuickFixProcessor();
    IInvocationContext context = new IInvocationContext() {

      public int getSelectionOffset() {
        return 10;
      }

      public int getSelectionLength() {
        return 10;
      }

      public ASTNode getCoveringNode() {
        return null;
      }

      public ASTNode getCoveredNode() {
        return null;
      }

      public ICompilationUnit getCompilationUnit() {
        return JavaCore.createCompilationUnitFrom(javaFile);
      }

      public CompilationUnit getASTRoot() {
        return null;
      }
    };
    IProblemLocation location = new IProblemLocation() {

      public boolean isError() {
        return false;
      }

      public int getProblemId() {
        return 0;
      }

      public String[] getProblemArguments() {
        return null;
      }

      public int getOffset() {
        return 0;
      }

      public String getMarkerType() {
        return null;
      }

      public int getLength() {
        return 0;
      }

      public ASTNode getCoveringNode(final CompilationUnit arg0) {
        return null;
      }

      public ASTNode getCoveredNode(final CompilationUnit arg0) {
        return null;
      }
    };
    IProblemLocation[] locations = new IProblemLocation[] { location };
    try {
      final IJavaCompletionProposal[] corrections = processor.getCorrections(context, locations);
      assertEquals(corrections.length, 1);
      assertEquals(corrections[0].getDisplayString(), "add new SubmitLink(\"wicketId\")");
    } catch (CoreException e) {
    }

    assertFalse(processor.hasCorrections(context.getCompilationUnit(), 1));

    System.out.println("testQuickFixProcessor:\t\t" + (System.nanoTime() - start));
  }
View Full Code Here

Examples of org.eclipse.jdt.ui.text.java.IInvocationContext

      ICompilationUnit cu = ((JavaContentAssistInvocationContext) context).getCompilationUnit();
      BodyDeclaration bodyDecl = QuickfixUtils.getTypeDecl(label, cu);
      if (bodyDecl instanceof TypeDeclaration) {
        TypeDeclaration typeDecl = (TypeDeclaration) bodyDecl;

        IInvocationContext invocationContext = new AssistContext(cu, invocationOffset, 0);
        if (computer.isQuickfixAvailable(typeDecl, invocationContext)) {
          SimpleName name = typeDecl.getName();
          List<IJavaCompletionProposal> proposals = computer.getAssistsForType(typeDecl, name, cu);
          return proposals;
        }
View Full Code Here

Examples of org.eclipse.jdt.ui.text.java.IInvocationContext

  public void testNoControllerNoRequestMappingMethod() throws JavaModelException {
    IMethod method = type.getType("NoAnnotation").getMethod("noAnnotation", new String[0]);
    ISourceRange sourceRange = method.getSourceRange();
    MethodDeclaration methodDecl = (MethodDeclaration) getASTNode(sourceRange, type, viewer);
    IInvocationContext context = getContext(sourceRange, method, methodDecl);

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

Examples of org.eclipse.jdt.ui.text.java.IInvocationContext

  public void testNoControllerRequestMappingMethod() throws JavaModelException {
    IMethod method = type.getType("NoAnnotation").getMethod("requestMappingAnnotation", new String[0]);
    ISourceRange sourceRange = method.getSourceRange();
    MethodDeclaration methodDecl = (MethodDeclaration) getASTNode(sourceRange, type, viewer);
    IInvocationContext context = getContext(sourceRange, method, methodDecl);

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

Examples of org.eclipse.jdt.ui.text.java.IInvocationContext

  public void testControllerNoRequestMappingMethod() throws JavaModelException {
    IMethod method = type.getType("ControllerAnnotation").getMethod("noAnnotation", new String[0]);
    ISourceRange sourceRange = method.getSourceRange();
    MethodDeclaration methodDecl = (MethodDeclaration) getASTNode(sourceRange, type, viewer);
    IInvocationContext context = getContext(sourceRange, method, methodDecl);

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

Examples of org.eclipse.jdt.ui.text.java.IInvocationContext

  public void testControllerRequestMappingMethod() throws JavaModelException {
    IMethod method = type.getType("ControllerAnnotation").getMethod("requestMappingAnnotation", new String[0]);
    ISourceRange sourceRange = method.getSourceRange();
    MethodDeclaration methodDecl = (MethodDeclaration) getASTNode(sourceRange, type, viewer);
    IInvocationContext context = getContext(sourceRange, method, methodDecl);

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

Examples of org.eclipse.jdt.ui.text.java.IInvocationContext

  public void testNoControllerNoRequestMappingMethods() throws JavaModelException {
    IType type = this.type.getType("NoAnnotationNoRequestMapping");
    ISourceRange sourceRange = type.getSourceRange();
    TypeDeclaration typeDecl = (TypeDeclaration) getASTNode(sourceRange, type, viewer);
    IInvocationContext context = getContext(sourceRange, type, typeDecl);

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

Examples of org.eclipse.jdt.ui.text.java.IInvocationContext

  public void testNoControllerRequestMappingMethods() throws JavaModelException {
    IType type = this.type.getType("NoAnnotation");
    ISourceRange sourceRange = type.getSourceRange();
    TypeDeclaration typeDecl = (TypeDeclaration) getASTNode(sourceRange, type, viewer);
    IInvocationContext context = getContext(sourceRange, type, typeDecl);

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

Examples of org.eclipse.jdt.ui.text.java.IInvocationContext

  public void testNoControllerRequestMappingNoRequestMappingMethods() throws JavaModelException {
    IType type = this.type.getType("RequestMappingAnnotationNoRequestMapping");
    ISourceRange sourceRange = type.getSourceRange();
    TypeDeclaration typeDecl = (TypeDeclaration) getASTNode(sourceRange, type, viewer);
    IInvocationContext context = getContext(sourceRange, type, typeDecl);

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

Examples of org.eclipse.jdt.ui.text.java.IInvocationContext

  public void testControllerNoRequestMappingMethods() throws JavaModelException {
    IType type = this.type.getType("ControllerAnnotationNoRequestMapping");
    ISourceRange sourceRange = type.getSourceRange();
    TypeDeclaration typeDecl = (TypeDeclaration) getASTNode(sourceRange, type, viewer);
    IInvocationContext context = getContext(sourceRange, type, typeDecl);

    List<IJavaCompletionProposal> proposals = processor.getAssists(typeDecl.getName(), context);
    assertTrue("No proposals expected", proposals.isEmpty());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.