Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to give feedback via a MessageBox within an EditPolicy
How to give feedback via a MessageBox within an EditPolicy [message #221846] Mon, 21 August 2006 13:53 Go to next message
Eclipse UserFriend
Originally posted by: robert.moestl.joanneum.at

Hello!

Under certain circumstances deleting of editparts should not be possible
in my graphical editor because otherwise my underlying model would
become corrupt. If deleting of an editpart is not allowed I want to show
a MessageBox to inform the user about the reason.

I open the MessageBox within the overridden
ComponentEditPolicy#createDeleteCommand. Unfortunately the MessageBox -
when deleting is not allowed - is always shown just when the editpart
got selected and that's too early. When the key 'DEL' is pressed nothing
happens (the selected editparts won't be deleted) what means that no
MessageBox comes up.

So what I want to do is that when the user tries to delete something
which can't be deleted for some reasons, a MessageBox should inform the
user.

Does somebody know how to manage this?

Thanks in advance
Robert
Re: How to give feedback via a MessageBox within an EditPolicy [message #221887 is a reply to message #221846] Mon, 21 August 2006 14:45 Go to previous messageGo to next message
Andreas Werner is currently offline Andreas WernerFriend
Messages: 55
Registered: July 2009
Member
Hi Robert,

how about open the MessageDialog inside the execute() of the
DeleteCommand???
But why don't you just make the command unexecutable (Command#canExecute())?

Andreas

Robert Möstl schrieb:
> Hello!
>
> Under certain circumstances deleting of editparts should not be possible
> in my graphical editor because otherwise my underlying model would
> become corrupt. If deleting of an editpart is not allowed I want to show
> a MessageBox to inform the user about the reason.
>
> I open the MessageBox within the overridden
> ComponentEditPolicy#createDeleteCommand. Unfortunately the MessageBox -
> when deleting is not allowed - is always shown just when the editpart
> got selected and that's too early. When the key 'DEL' is pressed nothing
> happens (the selected editparts won't be deleted) what means that no
> MessageBox comes up.
>
> So what I want to do is that when the user tries to delete something
> which can't be deleted for some reasons, a MessageBox should inform the
> user.
>
> Does somebody know how to manage this?
>
> Thanks in advance
> Robert
Re: How to give feedback via a MessageBox within an EditPolicy [message #221900 is a reply to message #221846] Mon, 21 August 2006 14:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Even the workbench's undo framework doesn't seem to handle this. You
probably want canExecute() to return an IStatus, instead of a boolean. There
would also be the issue of combining the status from multiple contributions
to the command.

So, would you have the "Delete" menuitem enabled, and then popup a message
when the user invokes the menuitem? That seems a bit odd, unless it is a
rare case.

"Robert M
Re: How to give feedback via a MessageBox within an EditPolicy [message #221914 is a reply to message #221900] Mon, 21 August 2006 15:18 Go to previous message
Eclipse UserFriend
Originally posted by: robert.moestl.joanneum.at

Thanks for the answers!

Yes I want to have the "Delete" menuitem enabled and then popup a
message when the user invokes it. I know that's a little bit strange,
but I can't forbid the user to press "DEL" on the keyboard. So if the
user does so and nothing happens he would not know what is going on.
Therefore I want to give the user feedback that he have to delete
something else before he is able to delete that.

Hope the requirement is clear?!

Best regards Robert

Randy Hudson schrieb:
> Even the workbench's undo framework doesn't seem to handle this. You
> probably want canExecute() to return an IStatus, instead of a boolean. There
> would also be the issue of combining the status from multiple contributions
> to the command.
>
> So, would you have the "Delete" menuitem enabled, and then popup a message
> when the user invokes the menuitem? That seems a bit odd, unless it is a
> rare case.
>
> "Robert Möstl" <robert.moestl@joanneum.at> wrote in message
> news:eccdqp$8pd$1@utils.eclipse.org...
>> Hello!
>>
>> Under certain circumstances deleting of editparts should not be possible
>> in my graphical editor because otherwise my underlying model would become
>> corrupt. If deleting of an editpart is not allowed I want to show a
>> MessageBox to inform the user about the reason.
>>
>> I open the MessageBox within the overridden
>> ComponentEditPolicy#createDeleteCommand. Unfortunately the MessageBox -
>> when deleting is not allowed - is always shown just when the editpart got
>> selected and that's too early. When the key 'DEL' is pressed nothing
>> happens (the selected editparts won't be deleted) what means that no
>> MessageBox comes up.
>>
>> So what I want to do is that when the user tries to delete something which
>> can't be deleted for some reasons, a MessageBox should inform the user.
>>
>> Does somebody know how to manage this?
>>
>> Thanks in advance
>> Robert
>
>
Previous Topic:figure of TextCompartmentEditPart is not visible
Next Topic:How to manage a CellEditor
Goto Forum:
  


Current Time: Wed Jan 22 18:07:32 GMT 2025

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

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

Back to the top