Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Highlighting Edit Parts in Error
Highlighting Edit Parts in Error [message #191685] Wed, 10 August 2005 20:55 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 #191758 is a reply to message #191726] Thu, 11 August 2005 12:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: harsh.ti.com

Thank you very much WojT. Would you mind sharing the code for your
ErrorManager?

Thank you,
Harsh
Re: Highlighting Edit Parts in Error [message #191948 is a reply to message #191758] Fri, 12 August 2005 06:07 Go to previous message
Eclipse UserFriend
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::..
Previous Topic:Replacing a Figure on the Fly
Next Topic:Sorting entries in the palette
Goto Forum:
  


Current Time: Tue Dec 03 05:51:14 GMT 2024

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

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

Back to the top