Highlighting Edit Parts in Error [message #191685] |
Wed, 10 August 2005 20:55 |
Eclipse User |
|
|
|
Originally posted by: harsh.ti.com
Hi All,
I have a need to highlight Edit Parts that are not properly connected in
the model. I am creating a freeform editor where the user can drag and
drop various components. However, they are not validated until the user
tries to save the file. How can I accomplish this? I know the logic
example has the ContainerHighlightEditPolicy which is good but I need to
invoke this for all edit parts in error including connections.
Thank you,
Harsh
|
|
|
Re: Highlighting Edit Parts in Error [message #191726 is a reply to message #191685] |
Thu, 11 August 2005 06:16 |
Eclipse User |
|
|
|
Originally posted by: wjancz.\/\/asko.pl(change \/\/ with w)
> Hi All,
>
> I have a need to highlight Edit Parts that are not properly connected in
> the model. I am creating a freeform editor where the user can drag and
> drop various components. However, they are not validated until the user
> tries to save the file. How can I accomplish this? I know the logic
> example has the ContainerHighlightEditPolicy which is good but I need to
> invoke this for all edit parts in error including connections.
>
> Thank you,
> Harsh
>
I have made a model (ErrorManager) where I store elements that are errored.
I validate my diagram all the time (when making connections, changing
connections, changing model parameters that are used on diagram and so
on... ). When I notice error I mark my part as errored in ErrorManager.
Because I need validate and notice user in real time, I refresh my diagram
after every command.
In refreshVisuals when I am refreshing children (EditPart) I am checking my
ErrorManager if my part is there.
If yes, I am changing his model color (setColor()).
Depends of your needs, you can made a refresh on specialized menu (button,
option .. whatewer) which will call refresh on your diagram.
Or in doSave of your editor, first do a validation and if any errors
occurs - show them, and do not allow to save errored diagram.
I think it will be helpful for you.
...::WojT::..
|
|
|
|
Re: Highlighting Edit Parts in Error [message #191948 is a reply to message #191758] |
Fri, 12 August 2005 06:07 |
Eclipse User |
|
|
|
Originally posted by: wjancz.\/\/asko.pl(change \/\/ with w)
> Thank you very much WojT. Would you mind sharing the code for your
> ErrorManager?
Sorry but it is not open source... it is written for my company which do not
allow to share code... :(
But ErrorManager is a simple class which contains a Vector and few simple
methods.
one of them adds a part to a vector if part is errored,
another one removes part from vector if part is not errored anymore
another one returns true if vector contain a part (that means part is
errored) and false if not contain.
In refresh (when you would like to validate diagram) iterate through
children of diagram and check if they are errored.
marking and demarking as errored is easy (depends on restrictions of your
model)..
I think it will be helpful
...::WojT::..
|
|
|
Powered by
FUDForum. Page generated in 0.04425 seconds