Package org.eclipse.jdt.internal.ui.text.correction

Examples of org.eclipse.jdt.internal.ui.text.correction.AssistContext


    IProject project = src.getJavaProject().getProject();

    ArrayList<ChangeCorrectionProposal> results =
      new ArrayList<ChangeCorrectionProposal>();
    int length = (problem.getSourceEnd() + 1) - problem.getSourceStart();
    AssistContext context = new AssistContext(
        src, problem.getSourceStart(), length);

    IProblemLocation[] locations =
      new IProblemLocation[]{new ProblemLocation(problem)};
    IQuickFixProcessor[] processors = JavaUtils.getQuickFixProcessors(src);
View Full Code Here


  private void setupASTNodes() {
    ICompilationUnit cu = javaContext.getCompilationUnit();
    SourceViewer sourceViewer = (SourceViewer) javaContext.getViewer();
    int invocationOffset = javaContext.getInvocationOffset();
    AssistContext assistContext = new AssistContext(cu, sourceViewer, invocationOffset, 0);
    ASTNode node = ((SourceRefElement) iAnnotation).findNode(assistContext.getASTRoot());
    annotation = (Annotation) node;
    if (node instanceof NormalAnnotation) {
      NormalAnnotation normalAnnotation = (NormalAnnotation) node;
      @SuppressWarnings("unchecked")
      List<MemberValuePair> pairs = normalAnnotation.values();
View Full Code Here

          ITextViewer viewer = javaContext.getViewer();

          if (viewer instanceof SourceViewer) {
            SourceViewer sourceViewer = (SourceViewer) viewer;
            int invocationOffset = context.getInvocationOffset();
            AssistContext assistContext = new AssistContext(cu, sourceViewer, invocationOffset, 0, SharedASTProvider.WAIT_NO);
            ASTNode node = assistContext.getCoveringNode();
            // cursor is at the beginning of an empty param list
            // [method(^)}
            if (node instanceof MethodDeclaration) {
              MethodDeclaration methodDecl = (MethodDeclaration) node;
              if (ProposalCalculatorUtil.hasAnnotation("RequestMapping", methodDecl)) {
View Full Code Here

      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

  private void setupASTNodes() {
    ICompilationUnit cu = javaContext.getCompilationUnit();
    SourceViewer sourceViewer = (SourceViewer) javaContext.getViewer();
    int invocationOffset = javaContext.getInvocationOffset();
    AssistContext assistContext = new AssistContext(cu, sourceViewer, invocationOffset, 0);
    ASTNode node = ((SourceRefElement) iAnnotation).findNode(assistContext.getASTRoot());
    annotation = (Annotation) node;
    if (node instanceof NormalAnnotation) {
      NormalAnnotation normalAnnotation = (NormalAnnotation) node;
      @SuppressWarnings("unchecked")
      List<MemberValuePair> pairs = normalAnnotation.values();
View Full Code Here

          List<IJavaCompletionProposal> proposals = new ArrayList<IJavaCompletionProposal>();

          IMember member = (IMember) javaElement;
          ICompilationUnit compilationUnit = member.getCompilationUnit();
          ISourceRange sourceRange = member.getSourceRange();
          AssistContext assistContext = new AssistContext(compilationUnit, null, sourceRange.getOffset(),
              sourceRange.getLength());
          ASTNode node = assistContext.getCoveringNode();

          if (node instanceof MethodDeclaration) {
            MethodDeclaration decl = (MethodDeclaration) node;
            // SimpleName name = decl.getName();
            if (problemType.equals(AutowireDependencyProvider.TOO_MANY_MATCHING_BEANS)) {
View Full Code Here

    return collectedCorrections.toArray(new IJavaCompletionProposal[collectedCorrections.size()]);
  }

  private Collection<IJavaCompletionProposal> getCorrections(IInvocationContext context, IProblemLocation location) {
    if (MissingPathVariableWarning.MARKER_TYPE.equals(location.getMarkerType())) {
      AssistContext assistContext = new AssistContext(context.getCompilationUnit(), null, location.getOffset(),
          location.getLength());
      ASTNode node = assistContext.getCoveringNode();
      return new PathVariableAnnotationQuickAssistProcessor().getAssists(node, assistContext);
    }
    return EMPTY_RESULT;
  }
View Full Code Here

    ITextViewer viewer = javaContext.getViewer();
    if (viewer instanceof SourceViewer) {
      ICompilationUnit cu = javaContext.getCompilationUnit();
      SourceViewer sourceViewer = (SourceViewer) javaContext.getViewer();
      int invocationOffset = javaContext.getInvocationOffset();
      AssistContext assistContext = new AssistContext(cu, sourceViewer, invocationOffset, 0);
      ASTNode node = ((SourceRefElement) a).findNode(assistContext.getASTRoot());

      if (node == null) {
        node = assistContext.getCoveredNode();
      }

      if (!(a instanceof Annotation)) {
        return Collections.emptyList();
      }
View Full Code Here

      cu = (ICompilationUnit) element;
    }
   
    int startPos = marker.getAttribute(IMarker.CHAR_START, 0);
    int endPos = marker.getAttribute(IMarker.CHAR_END, 0);
    AssistContext assistContext = new AssistContext(cu, startPos, endPos - startPos);
    ASTNode astNode = assistContext.getCoveringNode();
    MethodDeclaration methodDecl = getSurroundingMethod(astNode);
    if (methodDecl == null) {
      return new IMarkerResolution[0];
    }
   
View Full Code Here

    try {
      if (element instanceof IMember) {
        IMember member = (IMember) element;
        ICompilationUnit compilationUnit = member.getCompilationUnit();
        ISourceRange sourceRange = member.getSourceRange();
        AssistContext assistContext = new AssistContext(compilationUnit, null, sourceRange.getOffset(),
            sourceRange.getLength());
        ASTNode node = assistContext.getCoveringNode();
        if (node instanceof BodyDeclaration) {
          return (BodyDeclaration) node;
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.ui.text.correction.AssistContext

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.