Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Initialize programmatically created nodes(Setting parameters of a programmatically created node)
Initialize programmatically created nodes [message #870207] Mon, 07 May 2012 09:26 Go to next message
Jérémy Flusin is currently offline Jérémy FlusinFriend
Messages: 2
Registered: May 2012
Junior Member
Hello everyone,

My problem is quite simple: I create "Input" nodes programmatically this way:

CreateViewRequest createInputViewAndElementRequest = CreateViewRequestFactory.getCreateShapeRequest(
				typeNodeInput,
				cmep.getDiagramPreferencesHint());
Command createInputNodeCommand = cmep.getCommand(createInputViewAndElementRequest);
cc.add(createInputNodeCommand);


Where "cmep" is the appropriate EditPart and "cc" is a CompoundCommand I created before. Everything here works fine.

My "Input" nodes have "Description" and "ID" fields visible in the "Properties" view panel when my editor is launched. All I want to do is to set these parameters when I create my node programmatically.

I tried to use the "CreateViewRequest::setExtendedData()" method but I'm not even sure of its purpose. Moreover, I'm not sure of what the map argument should contain.

I also tried to get the factory of my request, but since the method "CreateViewRequest::getFactory()" is protected I couldn't.

What is the easiest way to do this ?

Best regards,
Jérémy.

[Updated on: Mon, 07 May 2012 09:31]

Report message to a moderator

Re: Initialize programmatically created nodes [message #870457 is a reply to message #870207] Tue, 08 May 2012 10:32 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
Hi,

did you try calling getElement() on your view. This should return the model element handeled by this view.

Ralph
Re: Initialize programmatically created nodes [message #880979 is a reply to message #870207] Sun, 03 June 2012 15:01 Go to previous messageGo to next message
Lars Wißler is currently offline Lars WißlerFriend
Messages: 4
Registered: June 2012
Junior Member
Hello,

I am very new to GMF and stuck at understanding the generated diagram workings enough to apply changes. Could you tell me where exactly you put or how you call the code for creating programmatically created nodes? I have found a lot of code snippets but no explanation how to include it in the editor code.

Thank you
Lars
Re: Initialize programmatically created nodes [message #881220 is a reply to message #880979] Mon, 04 June 2012 07:03 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
Hi,

try this command: http://publib.boulder.ibm.com/infocenter/rsmhelp/v7r0m0/index.jsp?topic=/org.eclipse.gmf.doc/reference/api/runtime/org/eclipse/gmf/runtime/diagram/ui/requests/CreateUnspecifiedTypeRequest.html

As far as I know this executes the code that would get executed when creating the model element from palette. The initialization code you can provide in the mapping model through feature sequence initializers.

Ralph
Re: Initialize programmatically created nodes [message #883406 is a reply to message #881220] Fri, 08 June 2012 13:11 Go to previous message
Lars Wißler is currently offline Lars WißlerFriend
Messages: 4
Registered: June 2012
Junior Member
Hi Ralph,

thank you for your answer. The unspecifiedTypeRequest did the trick after a bit of searching.

Lars
Previous Topic:Changing the domain model programmatically
Next Topic:Where to start with GMF
Goto Forum:
  


Current Time: Fri Apr 19 01:41:12 GMT 2024

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

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

Back to the top