Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 17:20 Go to next message
Greg is currently offline GregFriend
Messages: 15
Registered: April 2011
Junior Member
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 07:43 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

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 08:50 Go to previous message
Greg is currently offline GregFriend
Messages: 15
Registered: April 2011
Junior Member
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: Thu Apr 18 05:32:19 GMT 2024

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

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

Back to the top