@Override public void setRangeIndication(int offset, int length, boolean moveCursor) { IRegion rangeIndication= getRangeIndication(); if (moveCursor && fProjectionAnnotationModel != null && (rangeIndication == null || offset != rangeIndication.getOffset() || length != rangeIndication.getLength())) { List<ProjectionAnnotation> expand= new ArrayList<>(2); // expand the immediate affected collapsed regions Iterator<Annotation> iterator= fProjectionAnnotationModel.getAnnotationIterator(); while (iterator.hasNext()) { ProjectionAnnotation annotation= (ProjectionAnnotation)iterator.next(); if (annotation.isCollapsed() && willAutoExpand(fProjectionAnnotationModel.getPosition(annotation), offset, length)) expand.add(annotation); } if (!expand.isEmpty()) { Iterator<ProjectionAnnotation> e= expand.iterator(); while (e.hasNext()) fProjectionAnnotationModel.expand(e.next()); } } super.setRangeIndication(offset, length, moveCursor); }
@Override public void setRangeIndication(int offset, int length, boolean moveCursor) { IRegion rangeIndication= getRangeIndication(); if (moveCursor && fProjectionAnnotationModel != null && (rangeIndication == null || offset != rangeIndication.getOffset() || length != rangeIndication.getLength())) { List<ProjectionAnnotation> expand= new ArrayList<>(2); // expand the immediate affected collapsed regions Iterator<Annotation> iterator= fProjectionAnnotationModel.getAnnotationIterator(); while (iterator.hasNext()) { ProjectionAnnotation annotation= (ProjectionAnnotation)iterator.next(); if (annotation.isCollapsed() && willAutoExpand(fProjectionAnnotationModel.getPosition(annotation), offset, length)) expand.add(annotation); } if (!expand.isEmpty()) { Iterator<ProjectionAnnotation> e= expand.iterator(); while (e.hasNext()) fProjectionAnnotationModel.expand(e.next()); } } super.setRangeIndication(offset, length, moveCursor); }
private void expand() { if (isProjectionMode()) { Position found= null; Annotation bestMatch= null; Point selection= getSelectedRange(); for (Iterator<Annotation> e= fProjectionAnnotationModel.getAnnotationIterator(); e.hasNext();) { ProjectionAnnotation annotation= (ProjectionAnnotation) e.next(); if (annotation.isCollapsed()) { Position position= fProjectionAnnotationModel.getPosition(annotation); // take the first most fine grained match if (position != null && touches(selection, position)) if (found == null || position.includes(found.offset) && position.includes(found.offset + found.length)) { found= position; bestMatch= annotation; } } } if (bestMatch != null) { fProjectionAnnotationModel.expand(bestMatch); revealRange(selection.x, selection.y); } } }
private void expand() { if (isProjectionMode()) { Position found= null; Annotation bestMatch= null; Point selection= getSelectedRange(); for (Iterator<Annotation> e= fProjectionAnnotationModel.getAnnotationIterator(); e.hasNext();) { ProjectionAnnotation annotation= (ProjectionAnnotation) e.next(); if (annotation.isCollapsed()) { Position position= fProjectionAnnotationModel.getPosition(annotation); // take the first most fine grained match if (position != null && touches(selection, position)) if (found == null || position.includes(found.offset) && position.includes(found.offset + found.length)) { found= position; bestMatch= annotation; } } } if (bestMatch != null) { fProjectionAnnotationModel.expand(bestMatch); revealRange(selection.x, selection.y); } } }