Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Custom Label Parser: call orders
Custom Label Parser: call orders [message #468401] Wed, 05 August 2009 12:39 Go to next message
Hauke Fuhrmann is currently offline Hauke FuhrmannFriend
Messages: 333
Registered: July 2009
Senior Member
Dear GMF folks,

I try to implement a custom label parser, implementing an IParser,
respectively an ISemanticParser.

I don't quite understand, for what purpose the methods there are
intended as they behave different from what I expect.

I'm a bit confused about a few things:

- getPrintString is only called *before* getParseCommand and before the
command is executed. Hence the visible String after editing and parsing
the String is not updated afterwards to display the current value.

- isValidEditString is called every character the user enters. However,
my parser is quite heavy and I don't want to check every single
character again, but only at the end, when the user hits enter.

- getParseCommand is only called when the feature is edited via the
diagram label. It is not called when I edit it via the properties view.
I tried to implement ISemanticParser instead, whose Javadoc indicated
something about getting notified when the semantic element has changed.
But I did not yet figure it out.

My view about the methods is:

getEditString
returns the String displayed in the edit field

getPrintString
returns the String displayed when not editing

getParseCommand
gives the command that performs the actual parsing and update of the

semantic model

isAffectingEvent
checks if the parser is applicable for the feature

isValidEditString
checks if the entered String is valid or not


Could anyone clarifiy these issues for me?

Cheers,
Hauke
Re: Custom Label Parser: call orders [message #478343 is a reply to message #468401] Thu, 06 August 2009 09:10 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Hauke,

> getEditString
> returns the String displayed in the edit field
Right. In the beggining of parsing.

> getPrintString
> returns the String displayed when not editing
Right. So, to get new value displayed you have to set corresponding values
in the model.

> getParseCommand
> gives the command that performs the actual parsing and update of the
> semantic model
Right.

> isAffectingEvent
> checks if the parser is applicable for the feature
Check if the string representation was affected by corresponding change in
underlying model and getPrintString() should be called to update label content.

> isValidEditString
> checks if the entered String is valid or not
Called on each change in inplace editor.

-----------------
Alex Shatalin
Re: Custom Label Parser: call orders [message #478608 is a reply to message #478343] Thu, 06 August 2009 10:38 Go to previous messageGo to next message
Hauke Fuhrmann is currently offline Hauke FuhrmannFriend
Messages: 333
Registered: July 2009
Senior Member
Hello Alex,

thanks for the answers. However, you did not comment on the problems I
have that actually contradict somehow this view. Could you please
comment on those? I would appreciate it.

- getParseCommand is only called when the feature is edited via the
diagram label. It is not called when I edit it via the properties view.
Can you do that?

- getPrintString is only called *before* getParseCommand and before the
command is executed. Hence the visible String after editing and parsing
the String is not updated afterwards to display the current value.

- isValidEditString is called every character the user enters. However,
my parser is quite heavy and I don't want to check every single
character again, but only at the end, when the user hits enter.

Cheers,
Hauke


Alex Shatalin schrieb:
> Hello Hauke,
>
>> getEditString
>> returns the String displayed in the edit field
> Right. In the beggining of parsing.
>
>> getPrintString
>> returns the String displayed when not editing
> Right. So, to get new value displayed you have to set corresponding
> values in the model.
>
>> getParseCommand
>> gives the command that performs the actual parsing and update of the
>> semantic model
> Right.
>
>> isAffectingEvent
>> checks if the parser is applicable for the feature
> Check if the string representation was affected by corresponding change
> in underlying model and getPrintString() should be called to update
> label content.
>
>> isValidEditString
>> checks if the entered String is valid or not
> Called on each change in inplace editor.
>
> -----------------
> Alex Shatalin
>
>
Re: Custom Label Parser: call orders [message #478739 is a reply to message #478608] Thu, 06 August 2009 15:38 Go to previous message
Hauke Fuhrmann is currently offline Hauke FuhrmannFriend
Messages: 333
Registered: July 2009
Senior Member
> - getPrintString is only called *before* getParseCommand and before
> the command is executed. Hence the visible String after editing and
> parsing the String is not updated afterwards to display the current
> value.

Ok, this was my fault: The parser changed the original object in a not
allowed way such that it was accidently removed from the model. Sorry
for bothering.


Hauke
Previous Topic:How to generate different icon for each label?
Next Topic:Same object maximized on double-click
Goto Forum:
  


Current Time: Wed Sep 19 18:16:15 GMT 2018

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

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

Back to the top