private int getImageType(IJavaAnnotation annotation) { int imageType= NO_IMAGE; if (annotation.hasOverlay()) imageType= OVERLAY_IMAGE; else if (!annotation.isMarkedDeleted()) { if (showQuickFix(annotation)) { if (JavaMarkerAnnotation.ERROR_ANNOTATION_TYPE.equals(annotation.getType())) { imageType= QUICKFIX_ERROR_IMAGE; } else if (JavaMarkerAnnotation.WARNING_ANNOTATION_TYPE.equals(annotation.getType())) { imageType= QUICKFIX_WARNING_IMAGE; } else { imageType= QUICKFIX_INFO_IMAGE; } } } else { imageType= GRAY_IMAGE; } return imageType; }
private int getImageType(IJavaAnnotation annotation) { int imageType= NO_IMAGE; if (annotation.hasOverlay()) imageType= OVERLAY_IMAGE; else if (!annotation.isMarkedDeleted()) { if (showQuickFix(annotation)) { if (JavaMarkerAnnotation.ERROR_ANNOTATION_TYPE.equals(annotation.getType())) { imageType= QUICKFIX_ERROR_IMAGE; } else if (JavaMarkerAnnotation.WARNING_ANNOTATION_TYPE.equals(annotation.getType())) { imageType= QUICKFIX_WARNING_IMAGE; } else { imageType= QUICKFIX_INFO_IMAGE; } } } else { imageType= GRAY_IMAGE; } return imageType; }
public ProblemLocation(int offset, int length, IJavaAnnotation annotation) { fId= annotation.getId(); fArguments= annotation.getArguments(); fOffset= offset; fLength= length; fIsError= JavaMarkerAnnotation.ERROR_ANNOTATION_TYPE.equals(annotation.getType()); String markerType= annotation.getMarkerType(); fMarkerType= markerType != null ? markerType : IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER; }
private int getImageType(IJavaAnnotation annotation) { int imageType= NO_IMAGE; if (annotation.hasOverlay()) imageType= OVERLAY_IMAGE; else if (!annotation.isMarkedDeleted()) { if (showQuickFix(annotation)) imageType= JavaMarkerAnnotation.ERROR_ANNOTATION_TYPE.equals(annotation.getType()) ? QUICKFIX_ERROR_IMAGE : QUICKFIX_IMAGE; } else { imageType= GRAY_IMAGE; } return imageType; }
public ProblemLocation(int offset, int length, IJavaAnnotation annotation) { fId= annotation.getId(); String[] arguments= annotation.getArguments(); fArguments= arguments != null ? arguments : new String[0]; fOffset= offset; fLength= length; fIsError= JavaMarkerAnnotation.ERROR_ANNOTATION_TYPE.equals(annotation.getType()); String markerType= annotation.getMarkerType(); fMarkerType= markerType != null ? markerType : IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER; }
public ProblemLocation(int offset, int length, IJavaAnnotation annotation) { super(offset, length, annotation.getId(), annotation.getArguments() != null ? annotation.getArguments() : new String[0], JavaMarkerAnnotation.ERROR_ANNOTATION_TYPE.equals(annotation.getType()), annotation.getMarkerType() != null ? annotation.getMarkerType() : IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER); }
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()]); }
break; case GRAY_IMAGE: { String annotationType= annotation.getType(); if (JavaMarkerAnnotation.ERROR_ANNOTATION_TYPE.equals(annotationType)) { image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_ERROR_ALT);
break; case GRAY_IMAGE: { String annotationType= annotation.getType(); if (JavaMarkerAnnotation.ERROR_ANNOTATION_TYPE.equals(annotationType)) { image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_ERROR_ALT);
private boolean isIncluded(IJavaAnnotation annotation, boolean showTemporaryProblems) { // XXX: see https://bugs.eclipse.org/bugs/show_bug.cgi?id=138601 if (annotation instanceof ProblemAnnotation && JavaMarkerAnnotation.TASK_ANNOTATION_TYPE.equals(annotation.getType())) return false; if (!annotation.isProblem()) return true; if (annotation.isMarkedDeleted() && !annotation.hasOverlay()) return true; if (annotation.hasOverlay() && !annotation.isMarkedDeleted()) return true; if (annotation.hasOverlay()) return (!isIncluded(annotation.getOverlay(), showTemporaryProblems)); return showTemporaryProblems && JavaCorrectionProcessor.hasCorrections((Annotation)annotation); }
private boolean isIncluded(IJavaAnnotation annotation, boolean showTemporaryProblems) { // XXX: see https://bugs.eclipse.org/bugs/show_bug.cgi?id=138601 if (annotation instanceof ProblemAnnotation && JavaMarkerAnnotation.TASK_ANNOTATION_TYPE.equals(annotation.getType())) return false; if (!annotation.isProblem()) return true; if (annotation.isMarkedDeleted() && !annotation.hasOverlay()) return true; if (annotation.hasOverlay() && !annotation.isMarkedDeleted()) return true; if (annotation.hasOverlay()) return (!isIncluded(annotation.getOverlay(), showTemporaryProblems)); return showTemporaryProblems && JavaCorrectionProcessor.hasCorrections((Annotation)annotation); }
private boolean isIncluded(IJavaAnnotation annotation, boolean showTemporaryProblems) { // XXX: see https://bugs.eclipse.org/bugs/show_bug.cgi?id=138601 if (annotation instanceof ProblemAnnotation && JavaMarkerAnnotation.TASK_ANNOTATION_TYPE.equals(annotation.getType())) return false; if (!annotation.isProblem()) return true; if (annotation.isMarkedDeleted() && !annotation.hasOverlay()) return true; if (annotation.hasOverlay() && !annotation.isMarkedDeleted()) return true; if (annotation.hasOverlay()) return (!isIncluded(annotation.getOverlay(), showTemporaryProblems)); return showTemporaryProblems && JavaCorrectionProcessor.hasCorrections((Annotation)annotation); }
case GRAY_IMAGE: { ISharedImages sharedImages= PlatformUI.getWorkbench().getSharedImages(); String annotationType= annotation.getType(); if (JavaMarkerAnnotation.ERROR_ANNOTATION_TYPE.equals(annotationType)) { image= sharedImages.getImage(ISharedImages.IMG_OBJS_ERROR_TSK);