/** * Enables projection mode. If not yet done, installs the projection ruler column in the viewer's * vertical ruler and installs a painter that indicate the locations of collapsed regions. */ protected void doEnableProjection() { if (fPainter == null) { fPainter = new ProjectionAnnotationsPainter(fViewer, fAnnotationAccess); fPainter.addDrawingStrategy(PROJECTION, getDrawingStrategy()); fPainter.addAnnotationType(ProjectionAnnotation.TYPE, PROJECTION); fPainter.setAnnotationTypeColor( ProjectionAnnotation.TYPE, fSharedTextColors.getColor(getColor())); fViewer.addPainter(fPainter); } if (fColumn == null) { fColumn = new ProjectionRulerColumn(9, fAnnotationAccess); fColumn.addAnnotationType(ProjectionAnnotation.TYPE); fColumn.setHover(createProjectionAnnotationHover()); fViewer.addVerticalRulerColumn(fColumn); } fColumn.setModel(fViewer.getVisualAnnotationModel()); }
/** Removes the projection ruler column and the painter from the projection viewer. */ protected void doDisableProjection() { if (fPainter != null) { fViewer.removePainter(fPainter); fPainter.dispose(); fPainter = null; } if (fColumn != null) { fViewer.removeVerticalRulerColumn(fColumn); fColumn = null; } }