Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Get the ConnectionNodeEditPart from a CreateRelationshipRequest
Get the ConnectionNodeEditPart from a CreateRelationshipRequest [message #703549] Wed, 27 July 2011 13:20 Go to next message
Eclipse UserFriend
I have a CreateRelationshipRequest which I got from the method getAfterCreateRelationshipCommand inside my own EditHelperAdvice class.

package mypackage.extend.helper.advice;

import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;

public class ExpressionEditHelperAdvice extends AbstractEditHelperAdvice
{
  @Override
  protected ICommand getAfterDestroyReferenceCommand(DestroyReferenceRequest request)
  {
  }

}


Is there a way to get to the ConnectionNodeEditPart that should get created with the command that triggers the getAfterCreateRelationshipCommand method?

I want to react to this command and change the value of one the labels depending on which anchor is used for the connection. I want to get the anchor instance from the ConnectionNodeEditPart.
Re: Get the ConnectionNodeEditPart from a CreateRelationshipRequest [message #704044 is a reply to message #703549] Thu, 28 July 2011 03:43 Go to previous messageGo to next message
Eclipse UserFriend
I think there is a getNewObject method either on the CreateRequest or on
the CreateCommand, which provides you an adapter that you can use to
resolve to the created item...

--
http://mickaelistria.wordpress.com
http://twitter.com/#!/mickaelistria
http://www.petalslink.com
Re: Get the ConnectionNodeEditPart from a CreateRelationshipRequest [message #708878 is a reply to message #704044] Wed, 03 August 2011 04:50 Go to previous message
Eclipse UserFriend
At this point I do have a CreateRelationshipRequest which is used to get a CreateRelationshipCommand.

Both have the method getNewElement() which always seems to return null.

The EditHelperAdvice is of the package org.eclipse.gmf.runtime.emf.type.core.edithelper which makes me believe that it will only return events on the model base. The anchors are part of the EditPart and therefore in the controller of GMF. This assumption is supported b the fact that from the CreateRelationshipRequest and the CreateRelationshipCommand (using getSource() and getTarget()) I only seem to get Impls and never EditParts.

So I'm getting to a point where I think it simply isn't possible to get the resulting ConnectionEditPart with the EditHelperAdvice.

Am I wrong or does anyone know a similar approach to this on a pure GMF level?
Previous Topic:How to create connection with popup buttons
Next Topic:Copy & Paste within CompartmentEditParts
Goto Forum:
  


Current Time: Tue Jul 08 14:26:24 EDT 2025

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

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

Back to the top