private void findJavaAnnotation() { fPosition = null; fAnnotation = null; fHasCorrection = false; AbstractMarkerAnnotationModel model = getAnnotationModel(); IAnnotationAccessExtension annotationAccess = getAnnotationAccessExtension(); IDocument document = getDocument(); if (model == null) return; boolean hasAssistLightbulb = fStore.getBoolean(PreferenceConstants.EDITOR_QUICKASSIST_LIGHTBULB); Iterator iter = model.getAnnotationIterator(); int layer = Integer.MIN_VALUE; while (iter.hasNext()) { Annotation annotation = (Annotation) iter.next(); if (annotation.isMarkedDeleted()) continue; int annotationLayer = layer; if (annotationAccess != null) { annotationLayer = annotationAccess.getLayer(annotation); if (annotationLayer < layer) continue; } Position position = model.getPosition(annotation); if (!includesRulerLine(position, document)) continue; boolean isReadOnly = fTextEditor instanceof ITextEditorExtension && ((ITextEditorExtension) fTextEditor).isEditorInputReadOnly(); if (!isReadOnly && (((hasAssistLightbulb && annotation instanceof AssistAnnotation) || JavaCorrectionProcessor.hasCorrections(annotation)))) { fPosition = position; fAnnotation = annotation; fHasCorrection = true; layer = annotationLayer; continue; } else if (!fHasCorrection) { AnnotationPreference preference = fAnnotationPreferenceLookup.getAnnotationPreference(annotation); if (preference == null) continue; String key = preference.getVerticalRulerPreferenceKey(); if (key == null) continue; if (fStore.getBoolean(key)) { fPosition = position; fAnnotation = annotation; layer = annotationLayer; } } } }
/** * Returns a list of markers that exist at the current ruler location. * * @return a list of markers that exist at the current ruler location */ protected List getMarkers() { List breakpoints = new ArrayList(); IResource resource = getResource(); IDocument document = getDocument(); AbstractMarkerAnnotationModel model = getAnnotationModel(); if (model != null) { try { IMarker[] markers = null; if (resource instanceof IFile) markers = resource.findMarkers(IBreakpoint.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE); else { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); markers = root.findMarkers(IBreakpoint.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE); } if (markers != null) { IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager(); for (int i = 0; i < markers.length; i++) { IBreakpoint breakpoint = breakpointManager.getBreakpoint(markers[i]); if (breakpoint != null && breakpointManager.isRegistered(breakpoint) && includesRulerLine(model.getMarkerPosition(markers[i]), document)) breakpoints.add(markers[i]); } } } catch (CoreException x) { JDIDebugUIPlugin.log(x.getStatus()); } } return breakpoints; }