Guarantee uniqueness of labels [message #227203] |
Thu, 30 November 2006 13:09 |
Eclipse User |
|
|
|
Originally posted by: beconico.gmail.com
Hi!
I am working in an editor where objects are labeled. Each label should be
unique. Therefore, when a label is edited (directly or using the
Properties View), I would like to check its uniqueness. If there already
exists a similar label the change should not be allowed. What is the
simplest way to do this?
Thanks,
Nicolás
|
|
|
|
Re: Guarantee uniqueness of labels [message #227263 is a reply to message #227217] |
Fri, 01 December 2006 08:50 |
Eclipse User |
|
|
|
Originally posted by: beconico.gmail.com
Thanks for your answer Alex!
Now I can efficiently control when the id of my object is changed when its
associated graphical label is directly edited. For that I have created a
dedicated command (before the command that was executed was used by all
EditParts), so only the check is not performed for all objects, but only
for those of the type I want.
However, I still have the problem of edition through the Properties view.
I thought on doing something similar, that is, do my validation on the
canExecute() method of the command that is to be executed. However, I do
not know how to associate a dedicated command with such edition. If I
implement the validation in the "general" command, the check will be
performed evry time a property for whatever object is changed, and I would
not like that. Any idea here?
I have tried to do the validation in the setId() method of my EMF object.
The id is only updated if its different from any existing one. The result
is what I want, but I think the solution is not very elegant, since the
command stack gets filled with commands that were executed without actual
changes. So if I select "undo" from the menu, nothing happens in practice.
Any help is very appreciated. Thanks
Nicolás
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03444 seconds