Al-Zabur

Eclipse Gef Tutorial Instant

@Override protected void initializeGraphicalViewer() super.initializeGraphicalViewer(); GraphicalViewer viewer = getGraphicalViewer(); viewer.setContents(createDiagram()); viewer.getControl().setBackground(ColorConstants.white);

:

public abstract class Shape public static final String LOCATION_PROP = "location"; public static final String SIZE_PROP = "size";

@Override protected List<Shape> getModelChildren() return ((Diagram) getModel()).getShapes(); eclipse gef tutorial

– Base class for all shapes:

(root) – manages children:

// similarly for y, width, height...

:

@Override protected PaletteRoot getPaletteRoot() // return palette with creation tools (optional) return null; // for minimal

@Override protected void createEditPolicies() // For now, no edit policies – just static content @Override protected void initializeGraphicalViewer() super

@Override protected IFigure createFigure() Shape model = (Shape) getModel(); if (model instanceof RectangleShape) return new RectangleFigure(); else if (model instanceof EllipseShape) return new EllipseFigure(); // create similar return null;

@Override public void setBounds(Rectangle rect) super.setBounds(rect); // any custom layout logic