Environment: Eclipse Neon on Win10.
I have an older GEF/SWT RCP application that uses a ScrollingGraphicalViewer to handle scrolling. When I scroll, the original image that should be preserved in the scroll is moved properly, but the new area is not drawn. Sometimes, minimizing and restoring the application window gets it to redraw correctly. although at other times, it will show the image as if it hadn't been scrolled, but the scroll bar indicates that it has.
This happens with both horizontal and vertical scrolling. I'm only testing with thumb scrolling because it's a single move rather than a continuous operation with lots of redraws.
Here's a code sample. It's the paintFigure() method from one of my figures that goes the full width.
protected void paintFigure (Graphics graphics)
{
if (log.isTraceEnabled ()) {
final Rectangle dummy = new Rectangle ();
log.trace (String.format ("Paint rung %s, bounds %s, clip %s", rungId.getText (), getBounds (), graphics.getClip (dummy))); //$NON-NLS-1$
}
super.paintFigure (graphics);
// Draw the vertical bars
Rectangle r = getBounds ().getCopy ();
r.width -= LINE_WIDTH;
r.width += 1; // Coming up 1 short for some reason
r.shrink (MARGIN, 0);
if (log.isTraceEnabled ()) {
log.trace (String.format ("Adjusted bounds %s", r)); //$NON-NLS-1$
}
final int connectionY = r.y + connectionYOffset;
int connectionXStart = instructionsFigure.getBounds ().right ();
int connectionXStop = r.right ();
graphics.drawLine (connectionXStart, connectionY, connectionXStop, connectionY);
connectionXStart = r.x-4;
connectionXStop = instructionsFigure.getBounds ().x;
graphics.drawLine (connectionXStart, connectionY, connectionXStop, connectionY);
graphics.setLineWidth (LINE_WIDTH);
graphics.drawLine (r.getTopRight (), r.getBottomRight ());
graphics.drawLine (r.x - 4, r.y, r.x - 4, r.y+r.height);
}
Here is some trace output. Note that LadderLayer is the parent figure to the Rung.
Initial display: TRACE 2018-06-30 10:08:56,289 10099 com.bas.basplc.ui.editors.ladder_editor.figures.LadderLayer [main] Paint ladder layer, bounds Rectangle(0.0, 0.0, 1200.0, 2190.0), clip Rectangle(0.0, 0.0, 1070.0, 673.0) TRACE 2018-06-30 10:08:56,289 10099 com.bas.basplc.ui.editors.ladder_editor.figures.RungFigure [main] Paint rung 0, bounds Rectangle(3.0, 3.0, 1200.0, 384.0), clip Rectangle(3.0, 3.0, 1067.0, 384.0) TRACE 2018-06-30 10:08:56,290 10100 com.bas.basplc.ui.editors.ladder_editor.figures.RungFigure [main] Adjusted bounds Rectangle(63.0, 3.0, 1078.0, 384.0) Not sure what is being drawn here: TRACE 2018-06-30 10:08:56,370 10180 com.bas.basplc.ui.editors.ladder_editor.figures.LadderLayer [main] Paint ladder layer, bounds Rectangle(0.0, 0.0, 1200.0, 2190.0), clip Rectangle(1047.0, 15.0, 23.0, 658.0) TRACE 2018-06-30 10:08:56,370 10180 com.bas.basplc.ui.editors.ladder_editor.figures.RungFigure [main] Paint rung 0, bounds Rectangle(3.0, 3.0, 1200.0, 384.0), clip Rectangle(1047.0, 15.0, 23.0, 372.0) TRACE 2018-06-30 10:08:56,370 10180 com.bas.basplc.ui.editors.ladder_editor.figures.RungFigure [main] Adjusted bounds Rectangle(63.0, 3.0, 1078.0, 384.0) Thumb scroll right: TRACE 2018-06-30 10:10:16,244 90054 com.bas.basplc.ui.editors.ladder_editor.figures.LadderLayer [main] Paint ladder layer, bounds Rectangle(0.0, 0.0, 1200.0, 2190.0), clip Rectangle(940.0, 0.0, 130.0, 673.0) TRACE 2018-06-30 10:10:16,245 90055 com.bas.basplc.ui.editors.ladder_editor.figures.RungFigure [main] Paint rung 0, bounds Rectangle(3.0, 3.0, 1200.0, 384.0), clip Rectangle(940.0, 3.0, 130.0, 384.0) TRACE 2018-06-30 10:10:16,245 90055 com.bas.basplc.ui.editors.ladder_editor.figures.RungFigure [main] Adjusted bounds Rectangle(63.0, 3.0, 1078.0, 384.0) Redraw after minimize/restore: TRACE 2018-06-30 10:11:56,406 190216 com.bas.basplc.ui.editors.ladder_editor.figures.LadderLayer [main] Paint ladder layer, bounds Rectangle(0.0, 0.0, 1200.0, 2190.0), clip Rectangle(0.0, 0.0, 1070.0, 673.0) TRACE 2018-06-30 10:11:56,406 190216 com.bas.basplc.ui.editors.ladder_editor.figures.RungFigure [main] Paint rung 0, bounds Rectangle(3.0, 3.0, 1200.0, 384.0), clip Rectangle(3.0, 3.0, 1067.0, 384.0) TRACE 2018-06-30 10:11:56,407 190217 com.bas.basplc.ui.editors.ladder_editor.figures.RungFigure [main] Adjusted bounds Rectangle(63.0, 3.0, 1078.0, 384.0)


Solved! I was using SimpleRootEditPart, Viewport, LayeredPane, Layer, AbstractLayout. Switching to the Freeform versions of these and I can now scroll cleanly.