Cannot delete an object??? [message #221353] |
Fri, 11 August 2006 19:39 |
Eclipse User |
|
|
|
Originally posted by: guerreroderrick.gmail.com
The delete key has no effect in my project.
I have been creating a graph editor using the ShapesEditor as an
example. However, I do not seem to be able to delete any nodes. In my
GraphNodeEditPart class I have installed a new NodeComponentEditPolicy,
in which I create a new GraphNodeDeleteCommand. Stepping through the
project in debug, I have noticed that when I select a node, the
GraphNodeDeleteCommand is created with the correct graph and graphNode
variables. It also calls my canExecute() method which returns true when
the graph and graphNode variables are not null (they are not null when I
step through with debug). But hitting the delete key does absolutely
nothing. (Neither execute() nor redo() is called).
I assumed I was missing something in the key handler, but I use
GraphicalViewerKeyHandler(viewer) exactly like the ShapesEditor example.
And I cannot find any other differences involving delete.
Am I missing some fundamental step in deleting an object? Or do I need
to do anything to configure the GraphicalViewerKeyHandler.
Any help would be greatly appreciated.
Thanks in advance,
Guerrero
|
|
|
Re: Cannot delete an object??? [message #221387 is a reply to message #221353] |
Fri, 11 August 2006 20:49 |
Eclipse User |
|
|
|
Originally posted by: guerreroderrick.gmail.com
I figured it out. Apparently I needed to also create an
ActionBarContributor and include it in the contributorClass extension
for the editor. I also needed to override the protected method
buildActions(), and add the line
addRetargetAction(new DeleteRetargetAction());
Since the class extending ActionBarContributor wasn't mentioned anywhere
in code, only in the plugin extension, this took forever to find.
Guerrero.
Derrick Guerrero wrote:
> The delete key has no effect in my project.
>
> I have been creating a graph editor using the ShapesEditor as an
> example. However, I do not seem to be able to delete any nodes. In my
> GraphNodeEditPart class I have installed a new NodeComponentEditPolicy,
> in which I create a new GraphNodeDeleteCommand. Stepping through the
> project in debug, I have noticed that when I select a node, the
> GraphNodeDeleteCommand is created with the correct graph and graphNode
> variables. It also calls my canExecute() method which returns true when
> the graph and graphNode variables are not null (they are not null when I
> step through with debug). But hitting the delete key does absolutely
> nothing. (Neither execute() nor redo() is called).
>
> I assumed I was missing something in the key handler, but I use
> GraphicalViewerKeyHandler(viewer) exactly like the ShapesEditor example.
> And I cannot find any other differences involving delete.
>
> Am I missing some fundamental step in deleting an object? Or do I need
> to do anything to configure the GraphicalViewerKeyHandler.
>
> Any help would be greatly appreciated.
> Thanks in advance,
> Guerrero
|
|
|
Powered by
FUDForum. Page generated in 0.02744 seconds