/** * Installs this range. The range registers itself as background * line painter and text listener. Also, it creates a category with the * viewer's document to maintain its own extent. */ public void install() { TextViewer.this.addTextListener(this); fTextWidget.addLineBackgroundListener(this); IDocument document= TextViewer.this.getDocument(); try { document.addPositionCategory(RANGE_CATEGORY); document.addPosition(RANGE_CATEGORY, fPosition); document.addPositionUpdater(this); } catch (BadPositionCategoryException e) { // should not happen } catch (BadLocationException e) { // should not happen } paint(); }
/** * Installs this range. The range registers itself as background * line painter and text listener. Also, it creates a category with the * viewer's document to maintain its own extent. */ public void install() { TextViewer.this.addTextListener(this); fTextWidget.addLineBackgroundListener(this); IDocument document= TextViewer.this.getDocument(); try { document.addPositionCategory(RANGE_CATEGORY); document.addPosition(RANGE_CATEGORY, fPosition); document.addPositionUpdater(this); } catch (BadPositionCategoryException e) { // should not happen } catch (BadLocationException e) { // should not happen } paint(); }
@Override public void textChanged(TextEvent event) { if (event.getViewerRedrawState()) paint(); }
/** * Sets the highlight color of this range. Causes the range to be redrawn. * * @param color the highlight color */ public void setHighlightColor(Color color) { fHighlightColor= color; paint(); }
/** * Sets the highlight color of this range. Causes the range to be redrawn. * * @param color the highlight color */ public void setHighlightColor(Color color) { fHighlightColor= color; paint(); }
@Override public void textChanged(TextEvent event) { if (event.getViewerRedrawState()) paint(); }