Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » EWL UserPrompt
EWL UserPrompt [message #1017765] Tue, 12 March 2013 09:54 Go to next message
serhat gezgin is currently offline serhat gezgin
Messages: 231
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 15:09]

Report message to a moderator

Re: EWL UserPrompt [message #1018320 is a reply to message #1017765] Wed, 13 March 2013 11:58 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-Dominguez
Messages: 304
Registered: January 2010
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 14:58 Go to previous messageGo to next message
serhat gezgin is currently offline serhat gezgin
Messages: 231
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 18:42 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-Dominguez
Messages: 304
Registered: January 2010
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 02:56 Go to previous messageGo to next message
serhat gezgin is currently offline serhat gezgin
Messages: 231
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 06:31 Go to previous message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-Dominguez
Messages: 304
Registered: January 2010
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: Sat Apr 19 03:06:20 EDT 2014

Powered by FUDForum. Page generated in 0.01609 seconds