@Override public boolean canFix(Annotation annotation) { return annotation instanceof SpellingAnnotation && !annotation.isMarkedDeleted(); }
public Object getType(Annotation annotation) { return annotation.getType(); }
@Override protected Object getHoverInfoInternal(final ITextViewer textViewer, final int lineNumber, final int offset) { final Set<String> messages = Sets.newLinkedHashSet(); List<Annotation> annotations = getAnnotations(lineNumber, offset); for (Annotation annotation : annotations) { if (annotation.getText() != null) { messages.add(annotation.getText().trim()); } } if (messages.size()>0) return formatInfo(messages); return null; }
/** * @since 2.1 */ protected boolean isHandled(Annotation annotation) { return null != annotation && !annotation.isMarkedDeleted() && (markerAnnotationAccess.isSubtype(annotation.getType(), "org.eclipse.ui.workbench.texteditor.error") || markerAnnotationAccess.isSubtype(annotation.getType(), "org.eclipse.ui.workbench.texteditor.warning") || markerAnnotationAccess.isSubtype(annotation.getType(), "org.eclipse.ui.workbench.texteditor.info") || markerAnnotationAccess.isSubtype(annotation.getType(), "org.eclipse.ui.workbench.texteditor.bookmark") || markerAnnotationAccess.isSubtype(annotation.getType(), "org.eclipse.ui.workbench.texteditor.spelling")); }
private void skip() { boolean temp= (fStyle & TEMPORARY) != 0; boolean pers= (fStyle & PERSISTENT) != 0; boolean ignr= (fStyle & IGNORE_BAGS) != 0; while (fIterator.hasNext()) { Annotation next= fIterator.next(); if (next.isMarkedDeleted()) continue; if (ignr && (next instanceof AnnotationBag)) continue; fNext= next; Object annotationType= next.getType(); if (fType == null || fType.equals(annotationType) || !fConfiguredAnnotationTypes.contains(annotationType) && isSubtype(annotationType)) { if (temp && pers) return; if (pers && next.isPersistent()) return; if (temp && !next.isPersistent()) return; } } fNext= null; }
toRemove.remove(fTargetAnnotations.get(p)); } else { Annotation a= new Annotation(TARGET_ANNOTATION_TYPE, false, ""); //$NON-NLS-1$ toAdd.put(a, p); fTargetAnnotations.put(p, a);
public boolean isTemporary(Annotation annotation) { return !annotation.isPersistent(); }
private static int computeLayer(String annotationType, AnnotationPreferenceLookup lookup) { Annotation annotation= new Annotation(annotationType, false, null); AnnotationPreference preference= lookup.getAnnotationPreference(annotation); if (preference != null) return preference.getPresentationLayer() + 1; else return IAnnotationAccessExtension.DEFAULT_LAYER + 1; }
private void cacheAnnotations() { fCachedAnnotations.clear(); if (fModel != null) { Iterator<Annotation> iter= fModel.getAnnotationIterator(); while (iter.hasNext()) { Annotation annotation= iter.next(); if (annotation.isMarkedDeleted()) continue; if (skip(annotation.getType())) continue; fCachedAnnotations.add(annotation); } } }
private void skip() { boolean temp= (fStyle & TEMPORARY) != 0; boolean pers= (fStyle & PERSISTENT) != 0; boolean ignr= (fStyle & IGNORE_BAGS) != 0; while (fIterator.hasNext()) { Annotation next= fIterator.next(); if (next.isMarkedDeleted()) continue; if (ignr && (next instanceof AnnotationBag)) continue; fNext= next; Object annotationType= next.getType(); if (fType == null || fType.equals(annotationType) || !fConfiguredAnnotationTypes.contains(annotationType) && isSubtype(annotationType)) { if (temp && pers) return; if (pers && next.isPersistent()) return; if (temp && !next.isPersistent()) return; } } fNext= null; }
/** * {@inheritDoc} * * @deprecated assumed to always return <code>true</code> */ @Deprecated @Override public boolean isTemporary(Annotation annotation) { return !annotation.isPersistent(); }
public static boolean isQuickFixableType(Annotation annotation) { return (annotation instanceof IJavaAnnotation || annotation instanceof SimpleMarkerAnnotation) && !annotation.isMarkedDeleted(); }
public Object getType(Annotation annotation) { return annotation.getType(); }
private static int computeLayer(String annotationType, AnnotationPreferenceLookup lookup) { Annotation annotation= new Annotation(annotationType, false, null); AnnotationPreference preference= lookup.getAnnotationPreference(annotation); if (preference != null) return preference.getPresentationLayer() + 1; else return IAnnotationAccessExtension.DEFAULT_LAYER + 1; }
@Override protected void computeInformation() { if (fSelection != null) { Rectangle subjectArea= fSelection.canvas.getBounds(); Annotation annotation= fSelection.fAnnotation; String msg; if (annotation != null) msg= annotation.getText(); else msg= null; setInformation(msg, subjectArea); } }
private void cacheAnnotations() { fCachedAnnotations.clear(); if (fModel != null) { Iterator<Annotation> iter= fModel.getAnnotationIterator(); while (iter.hasNext()) { Annotation annotation= iter.next(); if (annotation.isMarkedDeleted()) continue; if (skip(annotation.getType())) continue; fCachedAnnotations.add(annotation); } } }
public static boolean isQuickFixableType(Annotation annotation) { return (annotation instanceof IJavaAnnotation || annotation instanceof SimpleMarkerAnnotation) && !annotation.isMarkedDeleted(); }
private boolean isBreakpointAnnotation(Annotation a) { // HACK to get breakpoints to show up first return a.getType().equals("org.eclipse.debug.core.breakpoint"); //$NON-NLS-1$ } }
/** * Sets the positions that should be highlighted as the target positions, i.e. * as the positions that can be jumped to in a linked set up. * * @param positions the new target positions, or <code>null</code> if no target positions are to be set * @throws BadLocationException in case any of the given positions is invalid */ private void setTargetPositions(List<Position> positions) throws BadLocationException { if (!fMarkTargets) return; // remove all positions which are already there // Algorithm: toRemove contains all mappings at first, but all that are in // positions get removed -> toRemove contains the difference set of previous - new // toAdd are the new positions, which don't exist in previous = new - previous List<Annotation> toRemove= new ArrayList<>(fTargetAnnotations.values()); Map<Annotation, Position> toAdd= new HashMap<>(); if (positions != null) { for (Position p : positions) { if (fTargetAnnotations.containsKey(p)) { toRemove.remove(fTargetAnnotations.get(p)); } else { Annotation a= new Annotation(TARGET_ANNOTATION_TYPE, false, ""); //$NON-NLS-1$ toAdd.put(a, p); fTargetAnnotations.put(p, a); } } } fTargetAnnotations.values().removeAll(toRemove); replaceAnnotations(toRemove.toArray(new Annotation[0]), toAdd, false); }
private boolean includeAnnotation(Annotation annotation, Position position, HashMap<Position, Object> messagesAtPosition) { if (!isIncluded(annotation)) return false; String text= annotation.getText(); return (text != null && !isDuplicateAnnotation(messagesAtPosition, position, text)); }