Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Basic Dialog Example? Where? Set the name of a created object.
Basic Dialog Example? Where? Set the name of a created object. [message #1829261] Mon, 29 June 2020 19:21 Go to next message
Brandon Lewis is currently offline Brandon LewisFriend
Messages: 206
Registered: May 2012
Senior Member
I'm trying to find a very basic example of using a dialog. I have a node creation tool, and I'd like to pop a dialog up to allow the user to edit the name of the node before creating it.

I found an 11 second video on youtube for Sirius 5.0 that appears to do exactly this with the Family tutorial. I got very excited. Alas, there was no documentation and it just has a link to https://www.eclipse.org/sirius/ and I can't find any docs on dialogs other than two very brief paragraphs that mention "let" for setting a variable.

I can't find an example of a dialog in the Family tutorial that matches the video. The current family tutorial "cheats" and calculates the name for you without an intervention dialog.

I just need a basic example of figuring out how to get the value of a text field and use that variable/value in a set command on my model.

Seems easy, but I can't seem to get it right.

An easy example -> What's the "weird" thing I have to type in the set command to access a text field in my dialog?

[Updated on: Tue, 30 June 2020 03:52]

Report message to a moderator

Re: Basic Dialog Example? Where? Set the name of a created object. [message #1829370 is a reply to message #1829261] Thu, 02 July 2020 07:41 Go to previous messageGo to next message
Laurent Fasani is currently offline Laurent FasaniFriend
Messages: 173
Registered: October 2014
Senior Member
Hello

You have many ways to achieve what you want:
* under your creation tool, add a changeContext operation that will call your own java service. This service will pop up a dialog and return the value entered by the user.
* you can also use the "Open dialog" [1] operation that will help you build the dialog without java code

Then add a "Set" operation [2] to change the name


[1] https://www.eclipse.org/sirius/doc/specifier/general/Model_Operations.html#dialog
[2] https://www.eclipse.org/sirius/doc/specifier/general/Model_Operations.html#set
Best regards
Laurent


Laurent Fasani - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Basic Dialog Example? Where? Set the name of a created object. [message #1829478 is a reply to message #1829370] Sat, 04 July 2020 16:09 Go to previous messageGo to next message
Brandon Lewis is currently offline Brandon LewisFriend
Messages: 206
Registered: May 2012
Senior Member
Laurent Fasani wrote on Thu, 02 July 2020 03:41

Then add a "Set" operation [2] to change the name
[1] https://www.eclipse.org/sirius/doc/specifier/general/Model_Operations.html#dialog
[2] https://www.eclipse.org/sirius/doc/specifier/general/Model_Operations.html#set
Best regards
Laurent


Thank you for trying to help Laurent.

It's the "Set" operation to change the name that I'm having issues figuring out. I'm sure it seems very simple. And after I see it once for the first time, I'm sure we'll all have a laugh that it was mysterious at all.

On creation of a Man Node using the tutorial example, I want to set the name feature of a Man when I hit OK on the dialog. When the user hits OK, I believe that's when I need to execute the create instance operation. When I create that instance, I want to use data from text fields from the dialog I am within.

The dialog has a textfield with the label name.

How do I get the value of the text field in order to set name = value of (name text field)?

index.php/fa/38490/0/

[Updated on: Sat, 04 July 2020 16:10]

Report message to a moderator

Re: Basic Dialog Example? Where? Set the name of a created object. [message #1829479 is a reply to message #1829478] Sat, 04 July 2020 16:14 Go to previous messageGo to next message
Brandon Lewis is currently offline Brandon LewisFriend
Messages: 206
Registered: May 2012
Senior Member
When I set name, I want the Value Expression of the set operation to be = "the value of the NameTextField" - but I can't figure out how to express that? What do I type in the Value Expression field to obtain the value of the NameFieldField Text object of the dialog I have created?

I put var: and try to auto-complete and it doesn't suggest anything to do with the dialog I'm within.

I don't think the Text field itself is the entity responsible for setting the name. I think the OK operation should do the setting. Have I got that wrong/

[Updated on: Sat, 04 July 2020 16:15]

Report message to a moderator

Re: Basic Dialog Example? Where? Set the name of a created object. [message #1829675 is a reply to message #1829479] Wed, 08 July 2020 14:39 Go to previous message
Julien Dupont is currently offline Julien DupontFriend
Messages: 172
Registered: July 2009
Senior Member
Hello Brandon,

You must use a Create Instance and add a dialog in the Create Instance operation and not the inverse.
I put screenshots to explain you how to do what do you want to do.
To answer your question you must use the variable newValue corresponding to text set by the user in the dialog.
Don't h├ęsitate if you have any questions.

Regards,
  • Attachment: ManPage.png
    (Size: 23.54KB, Downloaded 18 times)
  • Attachment: ManGroup.png
    (Size: 20.61KB, Downloaded 18 times)
  • Attachment: Name.png
    (Size: 17.69KB, Downloaded 16 times)
  • Attachment: SetName.png
    (Size: 16.58KB, Downloaded 23 times)
Previous Topic:How to set height and width
Next Topic:Can I create more than one model files in one model project ?
Goto Forum:
  


Current Time: Mon Oct 26 11:20:11 GMT 2020

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

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

Back to the top