Stopping the exit of a toolpart

Today I had a strange problem. 

Situation: 
I had 2 peopleEditors and I needed to check if both of them didn’t had the same value. 
If this was the case an error should appear, whether this was via a label or errormessage from the peopleEditor. The error needed to be shown. 

So the test is in applychanges event (could be syncchanges event, but this event is also run when the toolpart is opened). 
The problem was that the toolpart did the check and wrote a message that the 2 editors contain the same info but still continued to exit. So I had to stop the exit. 

Solution: 

Throw an exception 🙂 , just as simpel as that. The user will not see the exception only the error message. 
But I believe that this isn’t the best solution but it’s the only one I could find. 
If someone has a better method please post it. We’re all learning 😉

Kind regards 
andy 

Leave a Reply

Your email address will not be published. Required fields are marked *