public class SymbolLibrary {
public static ICanvasContext create(ISymbolItem item) {
+ return create(item, true);
+ }
+
+ public static ICanvasContext create(ISymbolItem item, boolean selection) {
IDiagram diagram = Diagram.spawnNew(DiagramClass.DEFAULT);
diagram.setHint(FlowLayout.HGAP, 5.0);
diagram.setHint(FlowLayout.VGAP, 5.0);
IThreadWorkQueue thread = AWTThread.getThreadAccess();
CanvasContext ctx = new CanvasContext(thread);
- initializeCanvasContext(ctx);
+ initializeCanvasContext(ctx,selection);
IHintContext hintCtx = ctx.getDefaultHintContext();
hintCtx.setHint(DiagramHints.KEY_DIAGRAM, diagram);
return item.getAdapter(Resource.class);
}
- private static void initializeCanvasContext(final CanvasContext canvasContext) {
+ private static void initializeCanvasContext(final CanvasContext canvasContext, boolean selection) {
// Create canvas context and a layer of interactors
final IHintContext h = canvasContext.getDefaultHintContext();
canvasContext.add( pi );
canvasContext.add( new Selection() );
canvasContext.add( new DiagramParticipant() );
- canvasContext.add( new ElementPainter() );
+ canvasContext.add( new ElementPainter(selection) );
canvasContext.add( new ElementInteractor() );
canvasContext.add( new TooltipParticipant());