1
package org.zaluum.ide.editor.parts.fsm;
3
import org.eclipse.draw2d.ColorConstants;
4
import org.eclipse.draw2d.ConnectionEndpointLocator;
5
import org.eclipse.draw2d.PolygonDecoration;
6
import org.eclipse.draw2d.PolylineConnection;
7
import org.eclipse.draw2d.text.FlowPage;
8
import org.eclipse.draw2d.text.ParagraphTextLayout;
9
import org.eclipse.draw2d.text.TextFlow;
10
import org.eclipse.swt.SWT;
12
public class TransitionFigure extends PolylineConnection {
14
private TextFlow textFlow;
16
public TransitionFigure() {
19
PolygonDecoration arrow = new PolygonDecoration();
21
arrow.setBackgroundColor(ColorConstants.lightGray);
22
arrow.setAntialias(SWT.ON);
23
setTargetDecoration(arrow);
24
ConnectionEndpointLocator conditionLocator = new ConnectionEndpointLocator(
26
conditionLocator.setUDistance(30);
27
conditionLocator.setVDistance(-2);
28
setForegroundColor(ColorConstants.darkGray);
29
FlowPage page = new FlowPage();
30
textFlow = new TextFlow();
31
textFlow.setLayoutManager(new ParagraphTextLayout(textFlow,
32
ParagraphTextLayout.WORD_WRAP_SOFT));
34
add(page, conditionLocator);
37
public void setConditionText(String text) {
38
textFlow.setText(text);