/** * Triggers a redraw in the display thread. */ private final void postRedraw() { if (isConnected() && !fControl.isDisposed()) { Display d= fControl.getDisplay(); if (d != null) { d.asyncExec(new Runnable() { @Override public void run() { redraw(); } }); } } }
/** * Triggers a redraw in the display thread. */ private final void postRedraw() { if (isConnected() && !fControl.isDisposed()) { Display d= fControl.getDisplay(); if (d != null) { d.asyncExec(() -> redraw()); } } }
/** * Ensures that the column is fully instantiated, i.e. has a control, and that the viewer is * visible. */ private void connectIfNeeded() { if (isConnected() || fParentRuler == null) return; fViewer= fParentRuler.getTextViewer(); if (fViewer == null) return; fWidget= fViewer.getTextWidget(); if (fWidget == null) return; fControl= fColumn.getControl(); if (fControl == null) return; fControl.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { handleDispose(); } }); }
/** * Ensures that the column is fully instantiated, i.e. has a control, and that the viewer is * visible. */ private void connectIfNeeded() { if (isConnected() || fParentRuler == null) return; fViewer= fParentRuler.getTextViewer(); if (fViewer == null) return; fWidget= fViewer.getTextWidget(); if (fWidget == null) return; fControl= fColumn.getControl(); if (fControl == null) return; fControl.addDisposeListener(e -> handleDispose()); }
/** * Delegates the painting of the quick diff colors to this painter. The painter will draw the * color boxes onto the passed {@link GC} for all model (document) lines in * <code>visibleModelLines</code>. * * @param gc the {@link GC} to draw onto * @param visibleModelLines the lines (in document offsets) that are currently (perhaps only * partially) visible */ public void paint(GC gc, ILineRange visibleModelLines) { connectIfNeeded(); if (!isConnected()) return; // draw diff info final int lastLine= end(visibleModelLines); final int width= getWidth(); final Color deletionColor= getDeletionColor(); for (int line= visibleModelLines.getStartLine(); line < lastLine; line++) { paintLine(line, gc, width, deletionColor); } }
/** * Delegates the painting of the quick diff colors to this painter. The painter will draw the * color boxes onto the passed {@link GC} for all model (document) lines in * <code>visibleModelLines</code>. * * @param gc the {@link GC} to draw onto * @param visibleModelLines the lines (in document offsets) that are currently (perhaps only * partially) visible */ public void paint(GC gc, ILineRange visibleModelLines) { connectIfNeeded(); if (!isConnected()) return; // draw diff info final int lastLine= end(visibleModelLines); final int width= getWidth(); final Color deletionColor= getDeletionColor(); for (int line= visibleModelLines.getStartLine(); line < lastLine; line++) { paintLine(line, gc, width, deletionColor); } }