ActionBarContributor [message #13570] |
Mon, 15 July 2002 18:47  |
Eclipse User |
|
|
|
Originally posted by: melaasar.rational.com
Hello,
I noticed that GEF editors create an action registry for each editor
instance that includes all the EditorPartAction instances used by this
editor instance. When a GEF editor instance gets the focus, the GEF
ActionBarContributor swaps the old editor instance's actions out of the
action bars and replace them by the new instance's actions (using their
respective action registries)
However, I was reading in the eclipse documentation that the rationale
behind ActionBarContributors was to :
"avoid the creation of duplicate actions and action images the editor
concept has been split into two. An action contributor is responsable for
the creation of actions. The editor is responsable for action
implementation. Furthermore, the contributor is shared by each open editor.
As a result of this design there is only 1 set of actions for 1 or more open
editors."
I am just wondering if GEF is still conforming to this design decision?
Another questions is about action contribution. Can GEF editors use actions
contributions defined through eclipse extension points or does it have to be
dynamic through the ActionBarContributor class?
I appreciate your input here.
Maged Elaasar
|
|
|
Re: ActionBarContributor [message #13676 is a reply to message #13570] |
Tue, 16 July 2002 11:16  |
Eclipse User |
|
|
|
Originally posted by: none.ibm.com
> I noticed that GEF editors create an action registry for each editor
> instance that includes all the EditorPartAction instances used by this
> editor instance. When a GEF editor instance gets the focus, the GEF
> ActionBarContributor swaps the old editor instance's actions out of the
> action bars and replace them by the new instance's actions (using their
> respective action registries)
>
> However, I was reading in the eclipse documentation that the rationale
> behind ActionBarContributors was to :
>
> "avoid the creation of duplicate actions and action images the editor
> concept has been split into two. An action contributor is responsable for
> the creation of actions. The editor is responsable for action
> implementation. Furthermore, the contributor is shared by each open
editor.
> As a result of this design there is only 1 set of actions for 1 or more
open
> editors."
>
> I am just wondering if GEF is still conforming to this design decision?
Maybe you didn't notice, but *none* of the Actions contributed by
EditorActionContributors in Eclipse ever disable (except for some global
actions). Why would this be? For example, the find next problem action in
the java editor is always enabled, even if you don't have problems. The
reason has to do with notification. What do you do if your Action needs to
be disposed because it was listening to some notifier (in order to enable
and disable itself)? Well, until late in the 2.0 cycle there was nothing
you could do to remove your Action from the notifier. Therefore, you would
have serious memory leaks. There was NO notification by Eclipse that your
ActionBarContributor instance was being thrown out when the last EditorPart
was closed.
ActionBarContributor.dispose() was added late in the 2.0 cycle. We will be
revisiting our ActionBarContributor eventually to take advantage of this new
API.
I still think that having one contributor per type of Editor is a design
flaw in Eclipse. It requires too much re-mapping on the part of the
developer, and it makes certain things more difficult. For example, what if
you only wanted to show Table Toolbar actions when the Editors cursor was
inside a table? This is straightforward when the contributor is one-to-one,
but a little more difficult when the user can switch editors but the
contributor stays the same.
> Another questions is about action contribution. Can GEF editors use
actions
> contributions defined through eclipse extension points or does it have to
be
> dynamic through the ActionBarContributor class?
I don't know the answer to this question. If this is similar to context
menus, I think you just register a ContributionManager with the workbench at
some point.
|
|
|
Powered by
FUDForum. Page generated in 0.04844 seconds