use of org.eclipse.gef.tools.ConnectionCreationTool in project liferay-ide by liferay.
the class StartTransitionActionHandler method run.
@Override
protected Object run(Presentation context) {
WorkflowDefinitionEditor editor = context.part().adapt(WorkflowDefinitionEditor.class);
SapphireDiagramEditor diagramEditor = editor.getDiagramEditor();
ISapphirePart part = context.part();
DiagramNodePart diagramPart = part.nearest(DiagramNodePart.class);
SapphireDiagramEditorPagePart editorPart = part.nearest(SapphireDiagramEditorPagePart.class);
ConnectionPalette connectionPalette = editorPart.getConnectionPalettes().get(0);
CreationFactory factory = new ConnectionCreationFactory(connectionPalette.getConnectionDef());
ConnectionCreationTool tool = new ConnectionCreationTool(factory);
diagramEditor.getEditDomain().setActiveTool(tool);
Event e = new Event();
e.x = diagramPart.getNodeBounds().getX();
e.y = diagramPart.getNodeBounds().getY();
e.widget = diagramEditor.getGraphicalViewer().getControl();
e.button = 1;
MouseEvent me = new MouseEvent(e);
tool.mouseDown(me, diagramEditor.getGraphicalViewer());
return null;
}
Aggregations