GEF, provides its implementation on through the ScaledGraphics implementation. However, the ScaledGraphics is not the only used Graphics implementation; making it difficult for object invocation.
The workaround for this would involve overriding the implementation of setBackgroundPattern. GMF's implementation RenderedMapModeGraphics doesn't serve the purpose as well. The Graphics is always set on the RootLayeredPane. Consequently it would require an implementation of the RootEditpart.
public void setBackgroundPattern(Device dev, float x1, float y1, float x2,float y2, Color color1, Color color2) {if (baseGraphics instanceof SWTGraphics) {
if (pattern != null) {
pattern.dispose();
}
pattern = new Pattern(dev, x1, y1, x2, y2, color1, color2);
baseGraphics.setBackgroundPattern(pattern);
return;
}
if (baseGraphics instanceof RenderedMapModeGraphics) {
((RenderedMapModeGraphics) baseGraphics).setBackgroundPattern(dev, x1,
y1, x2, y2, color1, color2);
return;
}
return;
}
Pattern being SWT.Pattern