Skip to main content



      Home
Home » Eclipse Projects » GEF » Bug somewhere in AbstractTreeEditPart (I think)
Bug somewhere in AbstractTreeEditPart (I think) [message #32870] Wed, 16 October 2002 16:54 Go to next message
Eclipse UserFriend
(oops... I meant to post this as a new thread.)

Randy- I think I've made some progress with this.

When I was searching through, I noticed that the Logic Editor uses a
TreeViewer in the OutlineView, thus it uses AbstractTreeEditParts. What I
noticed is when you select an item in the main editor (where the edit part
is based on AbstractGraphicalEditPart), the Edit menu provides options for
Undo/Redo and Delete (as does the right-mouse context menu when an item is
selected). However, when you select an item in the OutlineView, the context
menu provides the Undo/Redo/Delete options, but the Edit menu in the main
menu bar does not--it remains completely disabled.

Do you know what would be causing this behavior. Is it a bug? Intended
behavior? How about workarounds/fixes???

Thanks,
Erik


"Erik Johnson" <ejohnson@avaya.com> wrote in message
news:aokd29$rss$1@rogue.oti.com...
> Did that. DeleteAction#calculateEnabled returns true. I stepped through
> and the command contains my DeleteCommand. Stepping up into
> EditorPartAction, the enabled state is true (it calls setEnabled(true) but
> the action's state is already true so it doesn't fire any property change
> events).
>
> I put a breakpoint in Action#setEnabled and when I open my editor, the
Undo
> and Delete action change states from disabled to enabled. When I select
> items in my tree viewer they remain enabled, yet the items are never
enabled
> in the menu...
>
> Any ideas?
>
> Thanks,
> Erik
>
>
> "Randy Hudson" <hudsonr@us.eye-bee-em.com> wrote in message
> news:aoik5d$pdo$1@rogue.oti.com...
> > Put a breakpoint in DeleteAction#calculateEnabled() and then select
> > something in your TreeViewer.
> > Step into the enabledment code to find out why the command obtained
there
> > isn't executable (or if you are getting a null command).
> >
> > "Erik Johnson" <ejohnson@avaya.com> wrote in message
> > news:aoih5r$o0v$1@rogue.oti.com...
> > > How do you get the delete commands to work with a TreeEditPart??
> > > I am using a TreeViewer and I'm exposing my model using extensions of
> > > AbstractTreeEditPart. In createEditPolicies, I install edit policies
> for
> > > the COMPONENT_ROLE and TREE_CONTAINER_ROLE. The edit policy for the
> > > TREE_CONTAINER_ROLE works fine; however the edit policy for the
> > > COMPONENT_ROLE isn't quite working right.
> > >
> > > My edit policy for the COMPONENT_ROLE extends ComponentEditPolicy and
I
> > > successfully create DeleteCommands for the DeleteRequests (I have
> printlns
> > > that prove this); however these commands never execute. Also I am not
> > able
> > > to get the Delete (and undo/redo) menu items in the Edit menu to be
> > enabled.
> > >
> > > I've looked through all of the Shapes example source as well as the
> Logic
> > > example and I can't find any special code that enables the menu items.
> > The
> > > only thing I can think of that is different is that I'm using
> > > AbstractTreeEditParts rather than AbstractGraphicalEditPart. I think
> once
> > I
> > > get the menu items enabled, my delete commands should be able to
> execute.
> > >
> > > Thanks in advance for any help,
> > > Erik
> > >
> > >
> >
> >
>
>
Re: Bug somewhere in AbstractTreeEditPart (I think) [message #32976 is a reply to message #32870] Wed, 16 October 2002 19:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: hudsonr.us.eye-bee-em.com

"Erik Johnson" <ejohnson@avaya.com> wrote in message
news:aoki44$uve$1@rogue.oti.com...
> (oops... I meant to post this as a new thread.)
>
> Randy- I think I've made some progress with this.
>
> When I was searching through, I noticed that the Logic Editor uses a
> TreeViewer in the OutlineView, thus it uses AbstractTreeEditParts. What I
> noticed is when you select an item in the main editor (where the edit part
> is based on AbstractGraphicalEditPart), the Edit menu provides options for
> Undo/Redo and Delete (as does the right-mouse context menu when an item is
> selected). However, when you select an item in the OutlineView, the
context
> menu provides the Undo/Redo/Delete options, but the Edit menu in the main
> menu bar does not--it remains completely disabled.
>
> Do you know what would be causing this behavior. Is it a bug? Intended
> behavior? How about workarounds/fixes???

This happens anytime in Eclipse which you switch from the EditorPart to some
ViewPart. Basically, Eclipse doesn't consider your Editor to be active, so
you have to re-register the GlobalActions, such as Undo/Redo.

In addition to this, every Action that your EditorPart places on the Menu or
Toolbar will be disabled. To fix this, you'd have to use retargetable
actions, and retarget in a similar way to Undo/Redo.

> Thanks,
> Erik
>
>
> "Erik Johnson" <ejohnson@avaya.com> wrote in message
> news:aokd29$rss$1@rogue.oti.com...
> > Did that. DeleteAction#calculateEnabled returns true. I stepped
through
> > and the command contains my DeleteCommand. Stepping up into
> > EditorPartAction, the enabled state is true (it calls setEnabled(true)
but
> > the action's state is already true so it doesn't fire any property
change
> > events).
> >
> > I put a breakpoint in Action#setEnabled and when I open my editor, the
> Undo
> > and Delete action change states from disabled to enabled. When I select
> > items in my tree viewer they remain enabled, yet the items are never
> enabled
> > in the menu...
> >
> > Any ideas?
> >
> > Thanks,
> > Erik
> >
> >
> > "Randy Hudson" <hudsonr@us.eye-bee-em.com> wrote in message
> > news:aoik5d$pdo$1@rogue.oti.com...
> > > Put a breakpoint in DeleteAction#calculateEnabled() and then select
> > > something in your TreeViewer.
> > > Step into the enabledment code to find out why the command obtained
> there
> > > isn't executable (or if you are getting a null command).
> > >
> > > "Erik Johnson" <ejohnson@avaya.com> wrote in message
> > > news:aoih5r$o0v$1@rogue.oti.com...
> > > > How do you get the delete commands to work with a TreeEditPart??
> > > > I am using a TreeViewer and I'm exposing my model using extensions
of
> > > > AbstractTreeEditPart. In createEditPolicies, I install edit
policies
> > for
> > > > the COMPONENT_ROLE and TREE_CONTAINER_ROLE. The edit policy for the
> > > > TREE_CONTAINER_ROLE works fine; however the edit policy for the
> > > > COMPONENT_ROLE isn't quite working right.
> > > >
> > > > My edit policy for the COMPONENT_ROLE extends ComponentEditPolicy
and
> I
> > > > successfully create DeleteCommands for the DeleteRequests (I have
> > printlns
> > > > that prove this); however these commands never execute. Also I am
not
> > > able
> > > > to get the Delete (and undo/redo) menu items in the Edit menu to be
> > > enabled.
> > > >
> > > > I've looked through all of the Shapes example source as well as the
> > Logic
> > > > example and I can't find any special code that enables the menu
items.
> > > The
> > > > only thing I can think of that is different is that I'm using
> > > > AbstractTreeEditParts rather than AbstractGraphicalEditPart. I
think
> > once
> > > I
> > > > get the menu items enabled, my delete commands should be able to
> > execute.
> > > >
> > > > Thanks in advance for any help,
> > > > Erik
> > > >
> > > >
> > >
> > >
> >
> >
>
>
>
Re: Bug somewhere in AbstractTreeEditPart (I think) [message #33115 is a reply to message #32976] Wed, 16 October 2002 20:59 Go to previous message
Eclipse UserFriend
Ahhh... I got it fixed...
Turns out that I didn't have an ActionBarContributor registered as a
contributorClass for my editor. Once I added that in, undo/redo/delete all
worked fine...

Silly me jumping to the conclusion that it was a GEF bug...
as usual, it's just operator error. :)

thanks again,
Erik

"Randy Hudson" <hudsonr@us.eye-bee-em.com> wrote in message
news:aokqi2$3gf$1@rogue.oti.com...
>
> "Erik Johnson" <ejohnson@avaya.com> wrote in message
> news:aoki44$uve$1@rogue.oti.com...
> > (oops... I meant to post this as a new thread.)
> >
> > Randy- I think I've made some progress with this.
> >
> > When I was searching through, I noticed that the Logic Editor uses a
> > TreeViewer in the OutlineView, thus it uses AbstractTreeEditParts. What
I
> > noticed is when you select an item in the main editor (where the edit
part
> > is based on AbstractGraphicalEditPart), the Edit menu provides options
for
> > Undo/Redo and Delete (as does the right-mouse context menu when an item
is
> > selected). However, when you select an item in the OutlineView, the
> context
> > menu provides the Undo/Redo/Delete options, but the Edit menu in the
main
> > menu bar does not--it remains completely disabled.
> >
> > Do you know what would be causing this behavior. Is it a bug? Intended
> > behavior? How about workarounds/fixes???
>
> This happens anytime in Eclipse which you switch from the EditorPart to
some
> ViewPart. Basically, Eclipse doesn't consider your Editor to be active,
so
> you have to re-register the GlobalActions, such as Undo/Redo.
>
> In addition to this, every Action that your EditorPart places on the Menu
or
> Toolbar will be disabled. To fix this, you'd have to use retargetable
> actions, and retarget in a similar way to Undo/Redo.
>
> > Thanks,
> > Erik
> >
> >
> > "Erik Johnson" <ejohnson@avaya.com> wrote in message
> > news:aokd29$rss$1@rogue.oti.com...
> > > Did that. DeleteAction#calculateEnabled returns true. I stepped
> through
> > > and the command contains my DeleteCommand. Stepping up into
> > > EditorPartAction, the enabled state is true (it calls setEnabled(true)
> but
> > > the action's state is already true so it doesn't fire any property
> change
> > > events).
> > >
> > > I put a breakpoint in Action#setEnabled and when I open my editor, the
> > Undo
> > > and Delete action change states from disabled to enabled. When I
select
> > > items in my tree viewer they remain enabled, yet the items are never
> > enabled
> > > in the menu...
> > >
> > > Any ideas?
> > >
> > > Thanks,
> > > Erik
> > >
> > >
> > > "Randy Hudson" <hudsonr@us.eye-bee-em.com> wrote in message
> > > news:aoik5d$pdo$1@rogue.oti.com...
> > > > Put a breakpoint in DeleteAction#calculateEnabled() and then select
> > > > something in your TreeViewer.
> > > > Step into the enabledment code to find out why the command obtained
> > there
> > > > isn't executable (or if you are getting a null command).
> > > >
> > > > "Erik Johnson" <ejohnson@avaya.com> wrote in message
> > > > news:aoih5r$o0v$1@rogue.oti.com...
> > > > > How do you get the delete commands to work with a TreeEditPart??
> > > > > I am using a TreeViewer and I'm exposing my model using extensions
> of
> > > > > AbstractTreeEditPart. In createEditPolicies, I install edit
> policies
> > > for
> > > > > the COMPONENT_ROLE and TREE_CONTAINER_ROLE. The edit policy for
the
> > > > > TREE_CONTAINER_ROLE works fine; however the edit policy for the
> > > > > COMPONENT_ROLE isn't quite working right.
> > > > >
> > > > > My edit policy for the COMPONENT_ROLE extends ComponentEditPolicy
> and
> > I
> > > > > successfully create DeleteCommands for the DeleteRequests (I have
> > > printlns
> > > > > that prove this); however these commands never execute. Also I am
> not
> > > > able
> > > > > to get the Delete (and undo/redo) menu items in the Edit menu to
be
> > > > enabled.
> > > > >
> > > > > I've looked through all of the Shapes example source as well as
the
> > > Logic
> > > > > example and I can't find any special code that enables the menu
> items.
> > > > The
> > > > > only thing I can think of that is different is that I'm using
> > > > > AbstractTreeEditParts rather than AbstractGraphicalEditPart. I
> think
> > > once
> > > > I
> > > > > get the menu items enabled, my delete commands should be able to
> > > execute.
> > > > >
> > > > > Thanks in advance for any help,
> > > > > Erik
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
> >
>
>
Previous Topic:Multiple tabs Graphic Editor
Next Topic:[contribution] Hello Gef 4, minimalist GEF code sample with bendable connections posted on EclipseWi
Goto Forum:
  


Current Time: Fri May 09 22:11:08 EDT 2025

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

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

Back to the top