Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Create node by double clicking
Create node by double clicking [message #226329] Thu, 16 April 2009 09:40 Go to next message
Jose Salazar is currently offline Jose SalazarFriend
Messages: 34
Registered: July 2009
Member
Hello,

I want to create a node and a link with a double click in another node. I
copied a similar code in part#3 of the tutorial (it's a
IObjectActionDelegate) in a AbstractTransactionalCommand but it doesn't
work as I want. The link is not created and the new node doesn't enter in
"Edit mode" and no errors appears.

So could anyone help me?

Thanks in advance.
Re: Create node by double clicking [message #226563 is a reply to message #226329] Fri, 17 April 2009 11:19 Go to previous messageGo to next message
Jose Salazar is currently offline Jose SalazarFriend
Messages: 34
Registered: July 2009
Member
Hello,
If the link points to an existing node, the link is created, however, if
the link points to the node created, the link is not created. This is an
extract of my code:

...
CompoundCommand cc = new CompoundCommand();
CreateViewRequest featureRequest =
CreateViewRequestFactory.getCreateShapeRequest(XXXElementTyp es.Feature_2001,
XXXDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
Command createFeatureCmd = ((EditPart)
projectEditPart).getCommand(featureRequest);
IAdaptable featureViewAdapter = (IAdaptable)
((List)featureRequest.getNewObject()).get(0);
cc.add(createFeatureCmd);

ICommand createSubTopicsCmd = new
DeferredCreateConnectionViewAndElementCommand(new
CreateConnectionViewAndElementRequest(
XXXElementTypes.RelationSelected_4003,((IHintedType)
XXXElementTypes.RelationSelected_4003).getSemanticHint(),
XXXDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT), new
EObjectAdapter((EObject) fatherElement.getModel()),featureViewAdapter,
fatherElement.getViewer());
cc.add(new ICommandProxy(createSubTopicsCmd));
...

I don't know what could be the problem. In an IObjectActionDelegate works
but not on an AbstractTransactionalCommand.

Where is the problem? Is this the right way to do what I want?

Any help is aprecciated.

Thanks in advance.
Re: Create node by double clicking [message #226829 is a reply to message #226563] Tue, 21 April 2009 10:03 Go to previous message
Jose Salazar is currently offline Jose SalazarFriend
Messages: 34
Registered: July 2009
Member
Hello,

Is it possible create a node in an AbstractTransactionalCommand and put it
in edit mode?

CreateViewRequest featureRequest =
CreateViewRequestFactory.getCreateShapeRequest(XXXElementTyp es.Feature_2001,
XXXDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
...
final EditPartViewer viewer = fatherElement.getViewer();
final EditPart elementPart = (EditPart)
viewer.getEditPartRegistry().get(topicViewAdapter.getAdapter (View.class));
if (elementPart != null) {
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
viewer.setSelection(new StructuredSelection(elementPart));
Request der = new Request(RequestConstants.REQ_DIRECT_EDIT);
elementPart.performRequest(der);
}
});
}

elementPart value is always null. In the GMF tutorial part 3 works.
Could someone help me? I don't understand why it doesn't works.



Thanks.
Previous Topic:force connection to be straight line, no bends allowed
Next Topic:show non containment reference inside the node
Goto Forum:
  


Current Time: Tue Apr 23 10:39:38 GMT 2024

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

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

Back to the top