Bug 6929 - [ActionSets] Menu in new action set does not appear until .metadata deleted
Summary: [ActionSets] Menu in new action set does not appear until .metadata deleted
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.0 RC1   Edit
Assignee: Debbie Wilson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 36107 43097 60071 63008 (view as bug list)
Depends on:
Blocks:
 
Reported: 2001-12-13 22:28 EST by Nick Edgar CLA
Modified: 2005-05-11 12:37 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Edgar CLA 2001-12-13 22:28:47 EST
Build 20011206

In EC post: "Caching when using PDE", Chemi writes:

This is a suggestion/comment about an annoying situation I have faced
twice times already developing/testing plugins within PDE.

Well, I execute the plugin selecting plugin.xml file and pressing Run ->
Run-time Workbench, which starts a new Eclipse instance. The workspace
of this new instance is a directory called runtime-workspace. And at the
end of the execution it saves the .metadata directory where many things
are cached. For example, Help system and Window Menus.

So the problem is that when I am developing a new pluging I execute it
many times for testing purposes and I have to be aware of this caching.
For instance, any change in a Help pluging won't be shown, and any
change in an ActionSet plugin adding a new menu won't be show too.

To be able to be sure that I see the last state of the plugin I have to
delete that .metada directory each time (I know that for example, for
the Help system I can change the version of the plugin and it is
refreshed).

But, what I think is that PDE should have a propertie where I am able to
enable/disable the save of the .metadata directory when I am testing
plugins. So I have not to tale care about deleting, renaming or what
ever I need to do to avoid caching.

Does it make sense for you?

------

To reproduce:

- create a self-hosting workspace
- launch it once, and exit the target
- create a new PDE project Test
- replace its plugin.xml with:

<?xml version="1.0" encoding="UTF-8"?>
<!-- File written by PDE 1.0 -->
<plugin
   id="Test"
   name="Test"
   version="1.0.0">
<requires>
   <import plugin="org.eclipse.ui"/>
   <import plugin="org.eclipse.core.resources"/>
</requires>

<runtime>
   <library name="Test.jar"/>
</runtime>

<extension point="org.eclipse.ui.views">
	<category name="Games" id="es.org.chemi.games.category">
	</category>
	<view name="Minesweeper" icon="icons/minesweeper.gif"
		category="es.org.chemi.games.category"
		class="es.org.chemi.games.minesweeper.views.MainView"
		id="es.org.chemi.games.minesweeper.views.MainView">
	</view>
</extension>

<extension point="org.eclipse.ui.actionSets">
	<actionSet label="Minesweeper Actions" visible="true"
		id="es.org.chemi.games.minesweeper.actionSet">
		<menu label="&amp;Games" 
id="es.org.chemi.games.minesweeper.menu">
			<separator 
name="es.org.chemi.games.minesweeper.separator"/>
		</menu>
		<action label="&amp;Minesweeper" icon="icons/minesweeper.gif"
		
	class="es.org.chemi.games.minesweeper.actions.WorkbenchWindowActionDeleg
ate"
		
	menubarPath="es.org.chemi.games.minesweeper.menu/separator"
			id="es.org.chemi.games.minesweeper.action">
		</action>
	</actionSet>
</extension>

</plugin>

- launch the target again
- the menu does not show up
- delete the .metadata for the target workspace (not the dev workspace)
- try again
- this time it appears.

A workaround is to choose Perspective / Customize... and check the MineSweeper 
Actions item under Other.
Comment 1 Kevin Haaland CLA 2002-05-02 17:05:01 EDT
Tod, pls try this in the latest 2.0 builds. 
Comment 2 Tod Creasey CLA 2002-05-07 15:15:33 EDT
This is still an issue in 20020502.
Comment 3 Eduardo Pereira CLA 2002-08-13 11:08:16 EDT
See Perspective.save/restoreState(....)
Comment 4 Pat McCarthy CLA 2003-05-13 12:00:48 EDT
Understand the confusion, but it is working as designed (right or wrong).
The 2.1 PDE launch option of clear workspace is a heavyweight resolution (you 
loose projects too).

I'm about to enter a request the PDE launcher add a "clear .log" option, so you 
can easily tell if you have new errors during a test cycle.

Maybe there is room for a similar request to reset the workspace .metadata, or 
maybe just zapping the workbench.xml file would be enough?
Comment 5 Nick Edgar CLA 2003-05-13 14:09:47 EDT
Yes, deleting the workbench.xml would suffice.

However, we're going to have to do better for R3.0 to support dynamic plugins.
The UI should update appropriately when extensions come and go, or change 
(whether dynamically or not).
Comment 6 Simon Arsenault CLA 2003-05-22 16:00:20 EDT
*** Bug 36107 has been marked as a duplicate of this bug. ***
Comment 7 Nick Edgar CLA 2004-04-27 10:16:07 EDT
*** Bug 60071 has been marked as a duplicate of this bug. ***
Comment 8 Debbie Wilson CLA 2004-05-13 15:11:17 EDT
In the current support for dynamic plugins, if you add this plugin 
dynamically, you will be prompted to reset the current perspective (because 
you are adding something new to the menubar).  If you respond "yes" and reset 
the perspective, the new menubar entry appears.  Bug 61162 suggests this is a 
bit harsh.  Watch bug 61162 for a more elegant solution.

The original problem, however, still exists.  If you reset the perspective, 
the new menubar entry will appear.  Better than the original workaround 
suggested.
Comment 9 Nick Edgar CLA 2004-05-13 15:51:11 EDT
Can we also address the non-dynamic plugin case for 3.0?

- user shuts down
- installs a new plugin adding some always-on action sets, or action sets
associated with open perspectives
- user restarts

Comment 10 Nick Edgar CLA 2004-05-13 15:51:32 EDT
The always-on case is the more important of the two.
Comment 11 Debbie Wilson CLA 2004-05-17 13:16:37 EDT
Fix released to HEAD (class perspective).
Comment 12 Nick Edgar CLA 2004-05-18 22:09:32 EDT
Need to handle the case where the user manually turns off an action set.  It
should not override the user's choice.

For example, the following currently happens:
- new workspace
- Window > Customize Perspective > Commands
- uncheck the Help item
- Help > Help Contents is removed from the menu
- OK
- restart
- Help > Help Contents reappears

But since the Help action set was previously known to the perspective, it should
not be re-added.  

Suggest moving the new logic later in restoreState, after the perspective state
is fully restored from the memento, and checking the alwaysOffActionSets list too.
Comment 13 Nick Edgar CLA 2004-05-18 22:34:55 EDT
The following invariants should be maintained:
- an always-on action set (which has not been turned off) is in
visibleActionSets and alwaysOnActionSets
- an action set added via actionSetPartAssociations (which has not been turned
off ) is in visibleActionSets but not alwaysOnActionSets
- an action set that has been turned off by the user is in alwaysOffActionSets
and not in visibleActionSets or alwaysOnActionSets

Comment 14 Nick Edgar CLA 2004-05-18 22:36:46 EDT
It would be nice to also process action sets added to the perspective via
perspectiveExtensions.
This should be pretty straightforward.  See how it's done for the Navigate >
Show  In items in Perspective.getShowInIdsFromRegistry().
Comment 15 Nick Edgar CLA 2004-05-18 22:54:20 EDT
Forgot one invariant:

- an action set that has been turned on by the user is in visibleActionSets and
alwaysOnActionSets, and not in alwaysOffActionSets

Basically the perspective has each action set it knows about in one of three
states: always-on, always-off, and part-associated.

always-on: in visibleActionSets and alwaysOnActionSets (only)
always-off: in alwaysOffActionSets (only)
part-associated: in visibleActionSets (only)
Comment 16 Debbie Wilson CLA 2004-05-19 14:43:29 EDT
*** Bug 63008 has been marked as a duplicate of this bug. ***
Comment 17 Debbie Wilson CLA 2004-05-19 14:50:18 EDT
This fix has been retracted.  Postponing fix until after M9.
Comment 18 Jeff McAffer CLA 2004-05-20 11:29:14 EDT
This seems to be where the action is so...

I follow much of what is being said but still conclude that forcing a reset of 
the perspective when extensions are added is harsh to the point of making some 
scenarios untenable (e.g., reset throws away all my customizations and since I 
don't have a single uncustomized perspective, it would be quite disappointing).

The original scenario mentioned in the bug is real and important but ultimately 
it is a developer problem that can be resolved (as suggested) in the tooling.  

The user adding new plugins (and thus extensions) while Eclipse is shutdown and 
while it is running seem like the two key scenarios here.
Comment 19 Nick Edgar CLA 2004-05-20 12:00:18 EDT
I concur.  We should never reset the perspective automatically on plugin
addition/removal, whether dynamic or not, since this loses the user's state.
For the dynamic scenarios, it could prompt to reset, but this may not be the
policy the app wants.  It would be better for the workbench's processing of
dynamic addition to do what it can incrementally, and for the cases where it
can't update incrementally, just leave the perspective without the new
functionality.  If the app driving the dynamic update wants a different policy,
it can do so.



Comment 20 Jeff McAffer CLA 2004-05-20 12:57:50 EDT
Yes, doing what you can incrementally (and being able to do that in the common 
cases) is the key.  If there are cases where you can't deferring to someone 
else to do the reset is cool.  
Comment 21 Debbie Wilson CLA 2004-05-26 15:41:39 EDT
Fixed in HEAD for all cases except one:
- add an actionSet in a perspectiveExtension for a perspective that is already 
open (whether active or not) and the actions in the actionSet won't appear 
until you reset the perspective 

Comment 22 Debbie Wilson CLA 2004-05-27 16:29:06 EDT
Fixed last outstanding case in HEAD but not for the 4pm build (try 
I200405272000)
Comment 23 Debbie Wilson CLA 2004-05-31 11:45:26 EDT
Verified in I20040529 using the following variants:
- original test as outlined in the first comment
- customize a perspective and remove commands
- customize a perspective and add commands
- add action set via actionSetPartAssociations
- add action set via perspectiveExtension
Comment 24 Nick Edgar CLA 2005-04-28 16:00:23 EDT
*** Bug 43097 has been marked as a duplicate of this bug. ***
Comment 25 Nick Edgar CLA 2005-05-11 12:37:51 EDT
*** Bug 43097 has been marked as a duplicate of this bug. ***