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()]); }
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()]); }
IStatus status= collectCorrections(context, problemLocations, proposals); if (!status.isOK()) { resStatus= new MultiStatus(JavaUI.ID_PLUGIN, IStatus.ERROR, CorrectionMessages.JavaCorrectionProcessor_error_quickfix_message, null);
IStatus status= collectCorrections(context, problemLocations, proposals); if (!status.isOK()) { resStatus= new MultiStatus(JavaUI.ID_PLUGIN, IStatus.ERROR, CorrectionMessages.JavaCorrectionProcessor_error_quickfix_message, null);
IStatus status= collectCorrections(context, problemLocations, proposals); if (!status.isOK()) { resStatus= new MultiStatus(JavaUI.ID_PLUGIN, IStatus.ERROR, CorrectionMessages.JavaCorrectionProcessor_error_quickfix_message, null);
private static IMarkerResolution[] internalGetResolutions(IMarker marker) { if (!internalHasResolutions(marker)) { return NO_RESOLUTIONS; } ICompilationUnit cu= getCompilationUnit(marker); if (cu != null) { IEditorInput input= EditorUtility.getEditorInput(cu); if (input != null) { IProblemLocation location= findProblemLocation(input, marker); if (location != null) { IInvocationContext context= new AssistContext(cu, location.getOffset(), location.getLength()); if (!hasProblem (context.getASTRoot().getProblems(), location)) return NO_RESOLUTIONS; ArrayList<IJavaCompletionProposal> proposals= new ArrayList<>(); JavaCorrectionProcessor.collectCorrections(context, new IProblemLocation[] { location }, proposals); Collections.sort(proposals, new CompletionProposalComparator()); int nProposals= proposals.size(); IMarkerResolution[] resolutions= new IMarkerResolution[nProposals]; for (int i= 0; i < nProposals; i++) { resolutions[i]= new CorrectionMarkerResolution(context.getCompilationUnit(), location.getOffset(), location.getLength(), proposals.get(i), marker); } return resolutions; } } } return NO_RESOLUTIONS; }
private static IMarkerResolution[] internalGetResolutions(IMarker marker) { if (!internalHasResolutions(marker)) { return NO_RESOLUTIONS; } ICompilationUnit cu= getCompilationUnit(marker); if (cu != null) { IEditorInput input= EditorUtility.getEditorInput(cu); if (input != null) { IProblemLocation location= findProblemLocation(input, marker); if (location != null) { IInvocationContext context= new AssistContext(cu, location.getOffset(), location.getLength()); if (!hasProblem(context.getASTRoot().getProblems(), location) && !(marker.getResource() instanceof IFolder)) return NO_RESOLUTIONS; ArrayList<IJavaCompletionProposal> proposals= new ArrayList<>(); JavaCorrectionProcessor.collectCorrections(context, new IProblemLocation[] { location }, proposals); Collections.sort(proposals, new CompletionProposalComparator()); int nProposals= proposals.size(); IMarkerResolution[] resolutions= new IMarkerResolution[nProposals]; for (int i= 0; i < nProposals; i++) { resolutions[i]= new CorrectionMarkerResolution(context.getCompilationUnit(), location.getOffset(), location.getLength(), proposals.get(i), marker); } return resolutions; } } } return NO_RESOLUTIONS; }
JavaCorrectionProcessor.collectCorrections(context, new IProblemLocation[] { location }, proposals); Collections.sort(proposals, new CompletionProposalComparator());