Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » EWL UserPrompt
EWL UserPrompt [message #1017765] Tue, 12 March 2013 13:54 Go to next message
serhat gezgin is currently offline serhat gezginFriend
Messages: 243
Registered: January 2013
Location: Izmir
Senior Member
Hi,

I want to model refactoring using ewl.

But i can't find ewl libraries.

for example i want to use UserPromt but dont know what kind of userPromt available with ewl.


So where can i find this informations. anyone can help me

i use from epsilon book;

var newName : String;
var message : String := "Please provide a name for the file";
newName := UserInput.prompt(message, self.name);
newName.println();


But when i cancel the prompt from model i always get String value how can i understand when user click to cancel button on prompt ?

regards

[Updated on: Tue, 12 March 2013 19:09]

Report message to a moderator

Re: EWL UserPrompt [message #1018320 is a reply to message #1017765] Wed, 13 March 2013 15:58 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

Have you tried checking if its value is defined?

var newName : String;
var message : String := "Please provide a name for the file";
newName := UserInput.prompt(message, self.name);
if (newName.isDefined()) {
  // user hit OK
}
newName.println();

Re: EWL UserPrompt [message #1018393 is a reply to message #1018320] Wed, 13 March 2013 18:58 Go to previous messageGo to next message
serhat gezgin is currently offline serhat gezginFriend
Messages: 243
Registered: January 2013
Location: Izmir
Senior Member
Hi Antonio,

Yes i have tried this too. But always it gives me default string value (Okey or Cancel dont matter all the same)
Re: EWL UserPrompt [message #1019023 is a reply to message #1018393] Thu, 14 March 2013 22:42 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

It seems this particular behaviour is by design. Consider this paragraph from the Epsilon book (section 3.7, "Context-independent User Input"):

Quote:

As displayed above, all the methods of the IUserInput interface accept a default pa-
rameter. The purpose of this parameter is dual. First, it enables the designer of the model management program to prompt the user with the most likely value as a default choice and secondly it enables a concrete implementation of the interface UnattendedExecutionUserInput) which returns the default values without prompting the user at all and thus, can be used for unattended execution of interactive Epsilon programs.


If you want to detect that the user hit Cancel, I would suggest using an invalid default value and compare against that.

If that doesn't work out for you, please file a bug request and we'll look into it. I'm not sure if there may be some EOL code out there relying on this particular behaviour, and we wouldn't really want to break it unless necessary.
Re: EWL UserPrompt [message #1019167 is a reply to message #1019023] Fri, 15 March 2013 06:56 Go to previous messageGo to next message
serhat gezgin is currently offline serhat gezginFriend
Messages: 243
Registered: January 2013
Location: Izmir
Senior Member
Hi,

Yes u right. When i delete default value of string prompt the cancel button worked. But

when i give default value to prompt, cancel button work too but just give me default

value (not prompt textfield text) when i click ok button prompt give me prompt

textfield text.

Regards
Re: EWL UserPrompt [message #1019259 is a reply to message #1019167] Fri, 15 March 2013 10:31 Go to previous message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

That's because the default value is intended to be used when the script is used from a non-interactive environment (e.g. an Ant task).

If you need the interactive IUserInput implementations to return null instead of the default value, please file a bug report and we'll look into it.
Previous Topic:Emfatic Annotations
Next Topic:GMF Palette Divison
Goto Forum:
  


Current Time: Wed Apr 24 20:31:39 GMT 2024

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

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

Back to the top