Skip to main content
summaryrefslogtreecommitdiffstats
blob: 48ccfdd04db7f1beef3e908f5d7583f8a86c3166 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package org.eclipse.papyrus.infra.gmfdiag.common.linklf.router.provider;

import org.eclipse.draw2d.FreeformLayer;
import org.eclipse.draw2d.FreeformLayeredPane;
import org.eclipse.draw2d.LayeredPane;
import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemsAwareFreeFormLayer;
import org.eclipse.gmf.runtime.diagram.ui.render.editparts.RenderedDiagramRootEditPart;
import org.eclipse.gmf.runtime.draw2d.ui.internal.figures.ConnectionLayerEx;
import org.eclipse.gmf.runtime.notation.MeasurementUnit;

public class CustomRoutersDiagramRootEditPart extends RenderedDiagramRootEditPart {

	private CustomRoutersConnectionLayer myConnectionLayer;

	public CustomRoutersDiagramRootEditPart(MeasurementUnit mUnit) {
		super(mUnit);
	}

	/**
	 * Overridden to allow customization of the routers installed into the connection layers.
	 * @see #createConnectionLayer()
	 */
	@Override
	protected LayeredPane createPrintableLayers() {
		FreeformLayeredPane layeredPane = new FreeformLayeredPane();

		layeredPane.add(new BorderItemsAwareFreeFormLayer(), PRIMARY_LAYER);
		layeredPane.add(createConnectionLayer(), CONNECTION_LAYER);
		layeredPane.add(new FreeformLayer(), DECORATION_PRINTABLE_LAYER);

		return layeredPane;
	}

	protected ConnectionLayerEx createConnectionLayer() {
		myConnectionLayer = new CustomRoutersConnectionLayer();
		return myConnectionLayer;
	}

	@Override
	protected void register() {
		super.register();
		myConnectionLayer.setEditPartViewer(getViewer());

	}

	@Override
	protected void unregister() {
		myConnectionLayer.setEditPartViewer(null);
		super.unregister();
	}

}

Back to the top