Home » Eclipse Projects » GEF » Delete Action disabled
Delete Action disabled [message #89603] |
Tue, 05 August 2003 13:08  |
Eclipse User |
|
|
|
Originally posted by: brian.fernandes.codito.com
I'm trying to allow the deletion of components from my editor by either
choosing delete from the Edit menu or pressing the delete key.
Using put method of the keyHandler, I've mapped the delete key to the delete
action.
I've also called initializeActionRegistry. I've subclassed
ActionBarContributor (this class is specified in plugin.xml and it IS
getting instantiated) and I've also created a context menu.
Now if I right click on an edit part, nothing shows up..
On stepping thru, I come across this code in the context menu
action = actionRegistry.getAction(GEFActionConstants.DELETE);
if(action.isEnabled())
menu.appendToGroup(GEFActionConstants.GROUP_EDIT, action);
but action.isEnabled() returns false so delete does not show up.
Also, when the edit part is selected, none of the Edit menu items (including
Delete) are highlighted.
Similary when I press delete, I do get a DeleteAction , but again,
action.isEnabled returns false.
Also, when I create the edit part (which has a COMPONENT policy installed) ,
the createDeleteCommand gets automatically called. Any idea why this might
be happening ?
Is there any way in which I can enable the DELETE action? even from just the
edit menu (because then everything else will work as well, I suppose)
Also, is it necessary for me to subclass ActionBarContributor ? I'm not
using the outline / overview views right now and I've only added the
following code.
protected void buildActions() {
addRetargetAction(new DeleteRetargetAction());
}
From an eariler post, I read that RetargetActions had something to do with
the using actios while in the outlinve view.
I've spent a day on this and I can't figure out what's wrong.
Thanks,
Brian.
|
|
|
Re: Delete Action disabled [message #89620 is a reply to message #89603] |
Tue, 05 August 2003 13:22   |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
The DeleteAction needs to be updated every time selection changes. See how
GraphicalEditor#selectionChanged() eventually calls update() on the
DeleteAction, which will enable the action.
Also, perhaps update() is being called, but for some reason the action
really is disabled. Either your editparts don't provid a deletecomand, or
they provide one where isExecutable == false.
"Brian Fernandes" <brian.fernandes@codito.com> wrote in message
news:bgonm6$okq$1@eclipse.org...
> I'm trying to allow the deletion of components from my editor by either
> choosing delete from the Edit menu or pressing the delete key.
>
> Using put method of the keyHandler, I've mapped the delete key to the
delete
> action.
>
> I've also called initializeActionRegistry. I've subclassed
> ActionBarContributor (this class is specified in plugin.xml and it IS
> getting instantiated) and I've also created a context menu.
>
> Now if I right click on an edit part, nothing shows up..
> On stepping thru, I come across this code in the context menu
>
> action = actionRegistry.getAction(GEFActionConstants.DELETE);
> if(action.isEnabled())
> menu.appendToGroup(GEFActionConstants.GROUP_EDIT, action);
>
> but action.isEnabled() returns false so delete does not show up.
>
> Also, when the edit part is selected, none of the Edit menu items
(including
> Delete) are highlighted.
> Similary when I press delete, I do get a DeleteAction , but again,
> action.isEnabled returns false.
>
> Also, when I create the edit part (which has a COMPONENT policy installed)
,
> the createDeleteCommand gets automatically called. Any idea why this might
> be happening ?
>
> Is there any way in which I can enable the DELETE action? even from just
the
> edit menu (because then everything else will work as well, I suppose)
>
> Also, is it necessary for me to subclass ActionBarContributor ? I'm not
> using the outline / overview views right now and I've only added the
> following code.
>
> protected void buildActions() {
> addRetargetAction(new DeleteRetargetAction());
> }
>
>
> From an eariler post, I read that RetargetActions had something to do with
> the using actios while in the outlinve view.
>
>
> I've spent a day on this and I can't figure out what's wrong.
>
> Thanks,
> Brian.
>
>
>
>
>
>
>
>
>
>
>
|
|
|
Re: Delete Action disabled [message #89799 is a reply to message #89620] |
Wed, 06 August 2003 00:28  |
Eclipse User |
|
|
|
Originally posted by: brian.fernandes.codito.com
"Randy Hudson" <none@us.ibm.com> wrote in message
news:bgoojp$pke$1@eclipse.org...
> The DeleteAction needs to be updated every time selection changes. See
how
> GraphicalEditor#selectionChanged() eventually calls update() on the
> DeleteAction, which will enable the action.
>
> Also, perhaps update() is being called, but for some reason the action
> really is disabled. Either your editparts don't provid a deletecomand, or
> they provide one where isExecutable == false.
Randy, you da Man. :)
Update was being called, and the editpart did have a delete command in it's
component editpolicy. However, the deleteCommand at present was not written
to work for this editpart, but for other edit parts that subclassed this
one.
As a result, the deletecommand used to fail for this edit part (as soon as I
created it), which led to the deletecommand being permanently disabled for
the children as well.
It's working now.
Thanks again,
Brian.
|
|
|
Goto Forum:
Current Time: Fri May 02 01:52:22 EDT 2025
Powered by FUDForum. Page generated in 0.03277 seconds
|