Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse RedDeer » Graphiti - create connection using pad button
Graphiti - create connection using pad button [message #1819626] Sat, 18 January 2020 21:21 Go to next message
Marek Jagielski is currently offline Marek JagielskiFriend
Messages: 97
Registered: April 2012
I would like to create a connection between two GraphitiEditParts. As a user I do it by ContextButton. However, I need to keep the click pushed until I move mouse over second object.
Thank you in advance for some hints or ideas?
Re: Graphiti - create connection using pad button [message #1819627 is a reply to message #1819626] Sat, 18 January 2020 23:34 Go to previous message
Marek Jagielski is currently offline Marek JagielskiFriend
Messages: 97
Registered: April 2012
As a workaround I create connection programatically by using the same ConnectionFeature as pad button:

public class CreateSimpleConnection {

  private IFeatureProvider featureProvider;
  private TransactionalEditingDomain editDomain;
  private CreateConnectionContext context;

  public CreateSimpleConnection(GEFEditor gefEditor, GraphitiEditPart sourceEp,
      GraphitiEditPart destinationEp) {
    RuminaqEditor ruminaqEditor = ((RuminaqEditor) gefEditor.getEditorPart());
    this.editDomain = ruminaqEditor.getDiagramBehavior().getEditingDomain();
    this.featureProvider = ruminaqEditor.getDiagramTypeProvider().getFeatureProvider();
    PictogramElement sourcePe = Optional.of(sourceEp)
        .map(o -> (ContainerShapeEditPart) o)
    PictogramElement destinationPe = Optional.of(destinationEp)
        .map(o -> (ContainerShapeEditPart) o)

    this.context = new CreateConnectionContext();

  private Anchor getAnchor(PictogramElement pe) {
    Anchor ret = null;
    if (pe instanceof Anchor) {
      ret = (Anchor) pe;
    } else if (pe instanceof AnchorContainer) {
      ret = Graphiti.getPeService().getChopboxAnchor((AnchorContainer) pe);
    return ret;

  public void execute() {
    CreateSimpleConnectionFeature f = new CreateSimpleConnectionFeature(featureProvider);
    ModelUtil.runModelChange(() -> f.create(context),
        "Add connection");
Previous Topic:Is there an example of using Red Deer with a (non Eclipse) E4 Application?
Goto Forum:

Current Time: Sat May 25 07:21:51 GMT 2024

Powered by FUDForum. Page generated in 0.03979 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top