[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] The link created by executing a DeferredCreateConnectionViewAndElementCommand is not shown

Hi all,

After reading the posts regarding how to create a link programmatically and 
the example shown  in the MindMap tutorial 
(http://wiki.eclipse.org/GMF_Tutorial_Part_3) I have tryed to do it with no 
success.

I wanted to create a link from the current element to a new one that has 
also been created programmatically. In my code I just create a new command 
from the request and then, it is executed. The problem is that the link is 
not shown in the GMF editor, nothing happens after the execution. Does 
anybody know what is wrong in my approach? is there anything left? The code 
is as follows:

CreateConnectionViewAndElementRequest linkRequest = new 
CreateConnectionViewAndElementRequest(
                                                                             
                            linkType,

                                                                             
                            ((IHintedType) linkType).getSemanticHint(),

                                                                             
                            this.getDiagramPreferencesHint());


DeferredCreateConnectionViewAndElementCommand createLinkCommand =

                                                            new 
DeferredCreateConnectionViewAndElementCommand(

                                                                             
        linkRequest, //request

                                                                             
        new EObjectAdapter((EObject) this.getModel()), //IAdaptable 
sourceViewAdapter

                                                                             
        viewAdapter, //IAdaptable targetViewAdapter

                                                                             
        this.getViewer()); //EditPartViewer currentViewer


this.getDiagramEditDomain().getDiagramCommandStack().execute(new 
ICommandProxy(createLinkCommand));

Best regards