Bug 88534 - [ActionSets] action creation too eager
Summary: [ActionSets] action creation too eager
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: performance
Depends on:
Blocks:
 
Reported: 2005-03-18 17:56 EST by Jeff McAffer CLA
Modified: 2019-09-18 12:59 EDT (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff McAffer CLA 2005-03-18 17:56:50 EST
in 0315

I have an application that *had* some action delegates contributed in the 
plugin.xml.  I changed them to all be IActions and directly contribute them to 
the menus.  I forgot to remove the actionSet contribution in plugin.xml.  When 
I started my application, the following was posted in the console...

Could not create action delegate for id: org.eclipsercp.hyperbola.addExtensions
Reason:
Plug-in "org.eclipsercp.hyperbola" was unable to instantiate 
class "org.eclipsercp.hyperbola.update.AddExtensionsAction".
Could not create action delegate for id: 
org.eclipsercp.hyperbola.manageExtensions

There was one for each action.  The failures are happening because the classes 
are no longer action delegates.  Anyway, the failures are not interesting, the 
fact that someone is trying to instantiate the classes is a performance 
problem.  Perhaps I am using an incorrect coding/contrbution pattern?

Note that this was just starting the applicatoin.  I did not touch anything in 
the UI.
Comment 1 Nick Edgar CLA 2005-03-20 13:44:40 EST
Was the plug-in activated by the action set creation, or by some other means?
We have logic in there to eagerly instantiate the action set delegates then a
plug-in is active, but just having an action set should not cause plug-in
activation.
Comment 2 Nick Edgar CLA 2005-03-20 13:46:07 EST
s/then a plug-in is active/when a plug-in is active
Comment 3 Nick Edgar CLA 2005-03-20 13:46:50 EST
woops, didn't mean to mark as fixed
Comment 4 Jeff McAffer CLA 2005-03-21 00:13:33 EST
right.  the plugin was active.  My impression was that the action class would 
not be loaded unless it was actually needed.  Loading it typically will start 
to bring in a bunch more domain/model classes that may well not be needed until 
the action is run.
Comment 5 Nick Edgar CLA 2005-03-21 11:02:37 EST
The reason we do it this way is that users expect more accurate enablement logic
for the actions than can often be expressed in the XML declarative enablement
rules when the containing plug-in is active (while users don't necessarily know
about plug-in boundaries, they do know "I'm using the Java tooling, so why is
this Java action enabled when it should know that it can't be run now").

This has been in here for a -long- time (I couldn't find the original PR, but
see bug 6623).  I would be very hesitant to remove it now.
Comment 6 Jeff McAffer CLA 2005-03-21 11:18:40 EST
as far as I can see, my actions do not have any enablement behaviour.  They are 
just on.
Comment 7 Nick Edgar CLA 2005-03-21 11:57:57 EST
Yes, but other actions might, and we don't know that without instantiating them <g>.
Comment 8 Jeff McAffer CLA 2005-03-21 12:35:49 EST
you could know if you made people tell you.  Seems harsh from a performance 
point of view to load all classes just in case.

Perhaps we can get some real numbers as to how many classes are loaded as a 
result of this.  Is there anything in the performance infrastructure that would 
help?
Comment 9 Nick Edgar CLA 2005-03-21 13:58:54 EST
Will look at instrumenting this early in M7.
Comment 10 Nick Edgar CLA 2005-05-12 11:47:52 EDT
I don't feel comfortable addressing this for 3.1.  Will investigate in 3.2.
Comment 11 Chris Laffra CLA 2005-08-05 09:20:25 EDT
This causes *serious* pain for a large product like RAD. Many of our plugins 
are activated now, even when the activities they belong too are not active 
whatsoever.

This eager plugin activation causes some popup menus to take up to 6 seconds, 
and completely irrelevant plugins are now activated. This takes lots of time, 
but what is worse, they eagerly warm up caches that never go away.

Is there a workaround for Eclipse 3.0 or 3.1?

Please raise the severity of this bug to 'major'.
Comment 12 Nick Edgar CLA 2005-08-05 12:02:06 EDT
Chris, this bug is about action set action delegates being created eagerly when
the plug-in is activated.  Somebody else has to have already triggered plug-in
activation.

See also bug 53979.  But that is only for action set delegates implementing
IWorkbenchWindowPulldownDelegate2.

The object contributions mechanism (which appear in context menus) should not be
causing early activation.
Comment 13 Nick Edgar CLA 2006-02-10 15:28:44 EST
No changes planned here for 3.2.  Reassigning to Doug who owns this area.

Comment 14 Michael Van Meekeren CLA 2006-04-21 13:12:25 EDT
Moving Dougs bugs
Comment 15 Paul Webster CLA 2007-04-05 19:04:06 EDT
Assigning to component owner
PW
Comment 16 Paul Webster CLA 2007-08-31 09:06:01 EDT
I think this comes down to policy.  Right now, a declarative action is enabled until a user clicks on it (and it can activate the plugin).  Then a common occurrence is to get a pop up: "That operation is not currently available" or something.

From that point on, all actions contributed from that plugin will reflect their programmic enabled state, since they will all be loaded by our proxy actions.

Commands and handlers sorta work the same way, but are more likely to write an error in the error log (which frightens people) than open the pop up.

But we always get compaints about this.  Either users don't like the fact that the menus are enabled when they shouldn't be or we have problems with the performance impacts of loading the delegates so that their enabled state can be correct.

Commands is in slightly better shape because the interface is more restricted than actions, but it still suffers from the same question ... show the users the correct state or delay loading as much as possible until a user action.

While I don't expect to actually fix this problem in 3.4 I do hope that we will pick a consistent policy and that actions and commands will follow it (as much as the platform has control over these 2 things).

PW
Comment 17 Kevin McGuire CLA 2007-09-04 11:50:52 EDT
There will clearly always be cases where we must run some Java code to determine enablement state.  However, I am interested whether we can reduce this occurance significantly through the use of JavaScript to make basic state queries (by basic, I mean avoiding loading of a complex model and associated classes).  ie. Is this a function of core expressions being too limited, or too hard to write?

If we could reduce the occurance significantly, then the occasional "Sorry I actually couldn't perform that action" message wouldn't be too bad, given that even now there are cases where the enablement computation is too expensive to perform and must be left for command execution time. 

Of course, the message is less annoying if it actually contains useful information ("Sorry but you need to create a Blort first" vs. what we do now, "Sorry but we just couldn't run the action for you. Who knew?").

Agree that current approach, while providing better user experience, doesn't scale well for large products such as RAD and WID.
Comment 18 Jeff McAffer CLA 2007-09-04 20:54:05 EDT
Yikes!  Javascript! well, not yikes Javascript, yikes shipping the SDK with Rhino and having it run as part of the normal operation of the platform.  While interesting I suspect that this would raise a number of issues.
Comment 19 Paul Webster CLA 2007-09-05 14:37:25 EDT
(In reply to comment #17)
> There will clearly always be cases where we must run some Java code to
> determine enablement state.  However, I am interested whether we can reduce
> this occurance significantly through the use of JavaScript to make basic state
> queries (by basic, I mean avoiding loading of a complex model and associated
> classes).  ie. Is this a function of core expressions being too limited, or too
> hard to write?
>

Our inaccurate menu items aren't so much about core expressions (i.e. JavaScript wouldn't buy you much in this regard).  Even with a core expression you can always write a test element and code whatever you want in your test(*) method.

I think the number one reason we don't reflect an action state is that we haven't loaded their model.  An example I see all the time: I want my connect action to be enabled when I have no connection and my disconnect action to be enabled with I have a connection ... but at the beginning they're both enabled.

This bug itself is about the middle state: after the user takes one action that starts a bundle, the menus/toolbars feel free to load any action delegates (or handler implementations) for that plugin so they can programmatically update their enabled state.  I have other bugs about both ends of the continuum ("My startup state is wrong" and "I didn't do anything but loaded everything").

I was just nudging this bug because I hope that in 3.4 we will have some policy that the framework will try to follow.

PW
Comment 20 Paul Webster CLA 2009-03-02 11:39:38 EST
Updated as per http://wiki.eclipse.org/Platform_UI/Bug_Triage
PW
Comment 21 Mickael Istria CLA 2016-11-10 13:02:40 EST
Action extensions are deprecated in favor of org.eclipse.ui.commands/org.eclipse.ui.menus. No work will be planned about actions.
Comment 22 Eclipse Genie CLA 2019-09-18 12:59:26 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.