Skip to main content



      Home
Home » Eclipse Projects » GEF » Toolbar EditPartAction disabled
Toolbar EditPartAction disabled [message #12881] Wed, 10 July 2002 09:42 Go to next message
Eclipse UserFriend
Originally posted by: terra.us.ibm.com

I have built some actions for my GEF Editor, which inherits
EditPartAction,at the first time the editor is activated, these actions
are enabled on the toolbar, and when I deactivated the editor by clicking
elsewhere(for example, another view), these toolbar action are disabled.

While the problem here is when I re-activate the editor, those action are
no longer enabled any more. (I traced into the MyActionBarContributor
class and found the setActiveEditor get called). I modified the
canPerformAction method of my action to let it always return true, but it
doesn't work.

While for a SelectionAction, there is no such kind of problem. Whenever a
certain editpart in the canvas get selected, the canPerfromAction function
get called and corresponding action enabled on the toolbar.

The problem only happens on toolbar, so I can still see all action enabled
in the popup menu.

Have anyone met such kind of problem before?
Re: Toolbar EditPartAction disabled [message #12933 is a reply to message #12881] Tue, 09 July 2002 22:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.ibm.com

Make sure you haven't used the wrong constructor for Actions which are not
DYNAMIC (for example, popup only actions do not need to listen to anything,
they will calculate enabled state only on popup). By default,
EditorPartAction *IS* DYNAMIC, and will call hookEditorPart() to add
listeners to whatever is important to that Action.

"Terra" <terra@us.ibm.com> wrote in message
news:aghdku$4ud$1@rogue.oti.com...
> I have built some actions for my GEF Editor, which inherits
> EditPartAction,at the first time the editor is activated, these actions
[EditorPartAction]
> are enabled on the toolbar, and when I deactivated the editor by clicking
> elsewhere(for example, another view), these toolbar action are disabled.

Eclipse does this.

> While the problem here is when I re-activate the editor, those action are
> no longer enabled any more. (I traced into the MyActionBarContributor
> class and found the setActiveEditor get called). I modified the
> canPerformAction method of my action to let it always return true, but it
> doesn't work.

It seems like to me that Eclipse should re-enable those actions that is
disabled, perhaps. This doesn't happen? SelectionActions get re-enabled
because when you click on your EditorPart, the SelectionService fires a new
SelectionEvent, which results in those Actions setting themselves to ENABLED
even if Eclipse doesn't do this.
Re: Toolbar EditPartAction disabled [message #13100 is a reply to message #12933] Fri, 12 July 2002 08:14 Go to previous message
Eclipse UserFriend
Originally posted by: terra.us.ibm.com

I traced into the setActiveEditor method, only to found that at the moment
after the default setActiveEditor(of ActionBarContributor) get called, the
ENABLED status of these actions are TRUE. I think the
IToolBarManager.update(false) method should do the work to re-enable the
action, but it doesn't.

Whatever, I finally solve the problem by re-creating all the actions at
the setActiveEditor method (every time the editor get activated). And
these actions are not put into the registry, which still maintain a list
of actions, which will be used by MenuBarProviders.

The same program runs well under GEF 1.0 (WSAD 4.0), while under GEF0604
proposal(EClipse 2.0), the problems happens, I don't know whether this is
caused by the upgrade of GEF.

Randy Hudson wrote:

> Make sure you haven't used the wrong constructor for Actions which are not
> DYNAMIC (for example, popup only actions do not need to listen to anything,
> they will calculate enabled state only on popup). By default,
> EditorPartAction *IS* DYNAMIC, and will call hookEditorPart() to add
> listeners to whatever is important to that Action.

> "Terra" <terra@us.ibm.com> wrote in message
> news:aghdku$4ud$1@rogue.oti.com...
> > I have built some actions for my GEF Editor, which inherits
> > EditPartAction,at the first time the editor is activated, these actions
> [EditorPartAction]
> > are enabled on the toolbar, and when I deactivated the editor by clicking
> > elsewhere(for example, another view), these toolbar action are disabled.

> Eclipse does this.

> > While the problem here is when I re-activate the editor, those action are
> > no longer enabled any more. (I traced into the MyActionBarContributor
> > class and found the setActiveEditor get called). I modified the
> > canPerformAction method of my action to let it always return true, but it
> > doesn't work.

> It seems like to me that Eclipse should re-enable those actions that is
> disabled, perhaps. This doesn't happen? SelectionActions get re-enabled
> because when you click on your EditorPart, the SelectionService fires a new
> SelectionEvent, which results in those Actions setting themselves to ENABLED
> even if Eclipse doesn't do this.
Previous Topic:problem with Reconnecting a connection
Next Topic:JFace: How do I know when my EditorPart has closed?
Goto Forum:
  


Current Time: Wed Apr 30 17:44:06 EDT 2025

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

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

Back to the top