private ICompletionProposal[] getJavaAnnotationFixes(IJavaAnnotation javaAnnotation) { ProblemLocation location= new ProblemLocation(position.getOffset(), position.getLength(), javaAnnotation); ICompilationUnit cu= javaAnnotation.getCompilationUnit(); if (cu == null) return NO_PROPOSALS; ISourceViewer sourceViewer= null; if (viewer instanceof ISourceViewer) sourceViewer= (ISourceViewer) viewer; IInvocationContext context= new AssistContext(cu, sourceViewer, location.getOffset(), location.getLength(), SharedASTProvider.WAIT_ACTIVE_ONLY); if (!SpellingAnnotation.TYPE.equals(javaAnnotation.getType()) && !hasProblem(context.getASTRoot().getProblems(), location)) return NO_PROPOSALS; ArrayList<IJavaCompletionProposal> proposals= new ArrayList<>(); JavaCorrectionProcessor.collectCorrections(context, new IProblemLocation[] { location }, proposals); Collections.sort(proposals, new CompletionProposalComparator()); return proposals.toArray(new ICompletionProposal[proposals.size()]); }
private ICompletionProposal[] getJavaAnnotationFixes(IJavaAnnotation javaAnnotation) { ProblemLocation location= new ProblemLocation(position.getOffset(), position.getLength(), javaAnnotation); ICompilationUnit cu= javaAnnotation.getCompilationUnit(); if (cu == null) return NO_PROPOSALS; ISourceViewer sourceViewer= null; if (viewer instanceof ISourceViewer) sourceViewer= (ISourceViewer) viewer; IInvocationContext context= new AssistContext(cu, sourceViewer, location.getOffset(), location.getLength(), SharedASTProviderCore.WAIT_ACTIVE_ONLY); if (!SpellingAnnotation.TYPE.equals(javaAnnotation.getType()) && !hasProblem(context.getASTRoot().getProblems(), location)) return NO_PROPOSALS; ArrayList<IJavaCompletionProposal> proposals= new ArrayList<>(); JavaCorrectionProcessor.collectCorrections(context, new IProblemLocation[] { location }, proposals); Collections.sort(proposals, new CompletionProposalComparator()); return proposals.toArray(new ICompletionProposal[proposals.size()]); }
public static boolean hasCorrections(Annotation annotation) { if (annotation instanceof IJavaAnnotation) { IJavaAnnotation javaAnnotation= (IJavaAnnotation) annotation; int problemId= javaAnnotation.getId(); if (problemId != -1) { ICompilationUnit cu= javaAnnotation.getCompilationUnit(); if (cu != null) { return hasCorrections(cu, problemId, javaAnnotation.getMarkerType()); } } } if (annotation instanceof SimpleMarkerAnnotation) { return hasCorrections(((SimpleMarkerAnnotation) annotation).getMarker()); } return false; }
public static boolean hasCorrections(Annotation annotation) { if (annotation instanceof IJavaAnnotation) { IJavaAnnotation javaAnnotation= (IJavaAnnotation) annotation; int problemId= javaAnnotation.getId(); if (problemId != -1) { ICompilationUnit cu= javaAnnotation.getCompilationUnit(); if (cu != null) { return hasCorrections(cu, problemId, javaAnnotation.getMarkerType()); } } } if (annotation instanceof SimpleMarkerAnnotation) { return hasCorrections(((SimpleMarkerAnnotation) annotation).getMarker()); } return false; }
public static boolean hasCorrections(Annotation annotation) { if (annotation instanceof IJavaAnnotation) { IJavaAnnotation javaAnnotation= (IJavaAnnotation) annotation; int problemId= javaAnnotation.getId(); if (problemId != -1) { ICompilationUnit cu= javaAnnotation.getCompilationUnit(); if (cu != null) { return hasCorrections(cu, problemId, javaAnnotation.getMarkerType()); } } } if (annotation instanceof SimpleMarkerAnnotation) { return hasCorrections(((SimpleMarkerAnnotation) annotation).getMarker()); } return false; }
public static boolean hasCorrections(Annotation annotation) { if (annotation instanceof IJavaAnnotation) { IJavaAnnotation javaAnnotation= (IJavaAnnotation) annotation; int problemId= javaAnnotation.getId(); if (problemId != -1) { ICompilationUnit cu= javaAnnotation.getCompilationUnit(); if (cu != null) { return hasCorrections(cu, problemId, javaAnnotation.getMarkerType()); } } } if (annotation instanceof SimpleMarkerAnnotation) { return hasCorrections(((SimpleMarkerAnnotation) annotation).getMarker()); } return false; }