Bug 41676 - [CommandMgmt] Next/Previous in Search view no longer working
Summary: [CommandMgmt] Next/Previous in Search view no longer working
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P2 normal (vote)
Target Milestone: 3.0 M6   Edit
Assignee: Chris McLaren CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 33105 33531 41672 42271 42933 43627 44461 44942 46495 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-08-19 07:59 EDT by Dani Megert CLA
Modified: 2003-12-11 15:55 EST (History)
11 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2003-08-19 07:59:09 EDT
I20030813

The search view sets the global action handler for the goto next match action
like this:

action.setActionDefinitionId("org.eclipse.ui.navigate.next"); //$NON-NLS-1$
and in the view:
actionBars.setGlobalActionHandler(IWorkbenchActionConstants.NEXT, action);

I suspect the reason why it stopped working is that platform text introduced an
action via XML:
<action id="org.eclipse.ui.edit.text.gotoNextAnnotation"
	label="%goToNextAnnotation.label"
	tooltip="%goToNextAnnotation.tooltip"
	toolbarPath="org.eclipse.ui.workbench.navigate/history.group"
        retarget="true"
	style="pulldown"
	allowLabelUpdate="true"
        definitionId="org.eclipse.ui.navigate.next"
	icon="icons/full/etool16/next_nav.gif"
        disabledIcon="icons/full/dtool16/next_nav.gif"
        hoverIcon="icons/full/ctool16/next_nav.gif"			
	class="org.eclipse.ui.internal.texteditor.NextPulldownActionDelegate"/>

which is retargeted by the Java editor and also retargets
IWorkbenchActionConstants.NEXT:
bars.setGlobalActionHandler(ITextEditorActionDefinitionIds.GOTO_NEXT_ANNOTATION,
fNextAnnotation);
bars.setGlobalActionHandler(ITextEditorActionConstants.NEXT, fNextAnnotation);

I can still step through the results if the results are not opened in the Java
editor. Once the Java editor gets opened (with activate == false) the shortcuts
stop working. It looks as if the control is transferred to the Java editor but
not fully returned to the Search view.
Comment 1 Tod Creasey CLA 2003-08-19 09:32:50 EDT
*** Bug 41672 has been marked as a duplicate of this bug. ***
Comment 2 Chris McLaren CLA 2003-09-09 19:50:57 EDT
please look at this.. thanks..
Comment 3 Douglas Pollock CLA 2003-09-10 11:13:22 EDT
*** Bug 42271 has been marked as a duplicate of this bug. ***
Comment 4 Douglas Pollock CLA 2003-09-10 16:13:37 EDT
This is painful.  The problem was introduced sometime in between the I20030806
build and the I20030813 build.  It appears the the actionsById held by the
CommandManager is modified by bringing the Java source editor to the top.  It's
at this point that the actionsById changes from non-Java commands to Java
commands.  This changed is triggered by the match navigation code.  Here's a
rough trace where the actionsById actually changes:

org.eclipse.ui.internal.Workbench.updateActiveCommandIdsAndActiveContextIds(Workbench.java:638)
	at
org.eclipse.ui.internal.WorkbenchWindow.registerActionSets(WorkbenchWindow.java:450)
	at
org.eclipse.ui.internal.WorkbenchWindow.updateActiveActions(WorkbenchWindow.java:1160)
	at
org.eclipse.ui.internal.WorkbenchWindow.updateActionSets(WorkbenchWindow.java:2009)
	at
org.eclipse.ui.internal.WorkbenchPage$ActionSwitcher.updateActionSets(WorkbenchPage.java:350)
	at
org.eclipse.ui.internal.WorkbenchPage$ActionSwitcher.updateTopEditor(WorkbenchPage.java:256)
	at org.eclipse.ui.internal.WorkbenchPage.bringToTop(WorkbenchPage.java:555)
	at org.eclipse.ui.internal.WorkbenchPage.showEditor(WorkbenchPage.java:2124)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2062)
	at org.eclipse.ui.internal.WorkbenchPage.access$6(WorkbenchPage.java:2029)
	at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.java:2016)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:84)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2011)
	at org.eclipse.ui.internal.WorkbenchPage.openMarker(WorkbenchPage.java:1988)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:1928)
	at
org.eclipse.search.internal.ui.text.GotoMarkerAction.showWithoutReuse(GotoMarkerAction.java:137)
	at
org.eclipse.search.internal.ui.text.GotoMarkerAction.show(GotoMarkerAction.java:58)
	at
org.eclipse.search.internal.ui.text.GotoMarkerAction.run(GotoMarkerAction.java:50)
	at
org.eclipse.search.internal.ui.SearchResultViewer.openCurrentSelection(SearchResultViewer.java:543)
	at
org.eclipse.search.internal.ui.SearchResultViewer.showNextResult(SearchResultViewer.java:484)
	at
org.eclipse.search.internal.ui.ShowNextResultAction.run(ShowNextResultAction.java:28)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:842)
	at org.eclipse.ui.actions.RetargetAction.runWithEvent(RetargetAction.java:203)
Comment 5 Douglas Pollock CLA 2003-09-10 17:33:18 EDT
Commenting out the following line in the plugin.xml makes it work (for both
searching and annotations):

            definitionId="org.eclipse.ui.navigate.next"


Unfortunately, I'm not sure why.  Perhaps Chris can answer this question better
than I. 
Comment 6 Dani Megert CLA 2003-09-11 04:18:04 EDT
*** Bug 42933 has been marked as a duplicate of this bug. ***
Comment 7 Giuseppe Carnevale CLA 2003-09-18 05:59:40 EDT
*** Bug 33531 has been marked as a duplicate of this bug. ***
Comment 8 Douglas Pollock CLA 2003-09-25 09:54:43 EDT
*** Bug 43627 has been marked as a duplicate of this bug. ***
Comment 9 Chris McLaren CLA 2003-10-08 00:41:40 EDT
JDT might consider Doug's suggestion in #5 for the M4 build *only*.

i can't get a proper fix in for the build tomorrow, so here at least is an 
explanation of the problem (for those ui people on the cc: list who may care):

the command system gathers up from the workbench a mapping of command ids to 
action instances. key sequences are bound to command ids, so it is this 
mapping that resolves which action instance to run when a key sequence is 
pressed.

this map is built as a composite of other command id to action instance maps, 
in the following order: 
global actions
actionsets
workbench page action service
workbench part action service

the last two maps are part of the new command system still in progress, the 
first two are the mechanism to get legacy code working with the keybindings.

early on, the search view registers a global action (which goes in the first 
map). everything works fine until a java editor is opened, which causes the an 
action of the same command id to be registered in the action set map. 

as long as the java editor is open, it is this action that is getting the 
command id (and hence the keybindings) - even when part focus changes.

when all java editors close things return to normal. 

as i said, i don't think i can fix safely this tonight. it's late and i just 
ate a big bowl of ice cream and some gummi rats. so hard to think.. :)

i *may* be able to get a safe fix in in the morning, if for some reason we are 
delayed, otherwise this needs to be postponed until after M4.





Comment 10 Dani Megert CLA 2003-10-08 05:19:53 EDT
I wouldn't change the XML for M4 since this might affect other scenarios (e.g.
next/previous hidden due to disabled action set but key binding in editor should
still work).
Comment 11 Tod Creasey CLA 2003-10-08 09:52:30 EDT
Marking for M5 so that a better solution can be explored.
Comment 12 Dani Megert CLA 2003-10-09 06:08:30 EDT
*** Bug 44461 has been marked as a duplicate of this bug. ***
Comment 13 Dani Megert CLA 2003-10-09 06:13:03 EDT
When talking yesterday with the UI team we agreed that next/prev navigation for
the search view is not critical for M4. Maybe this decission has to be revisted
depending on how important this is for the Debug team.
Comment 14 Darin Wright CLA 2003-10-15 12:47:50 EDT
*** Bug 33105 has been marked as a duplicate of this bug. ***
Comment 15 Darin Wright CLA 2003-10-15 16:29:55 EDT
*** Bug 44942 has been marked as a duplicate of this bug. ***
Comment 16 Darin Wright CLA 2003-11-13 13:21:52 EST
*** Bug 46495 has been marked as a duplicate of this bug. ***
Comment 17 Darin Swanson CLA 2003-11-19 11:50:40 EST
*** Bug 46495 has been marked as a duplicate of this bug. ***
Comment 18 Darin Swanson CLA 2003-11-19 11:51:19 EST
What is the status of this bug for M5?
Comment 19 Chris McLaren CLA 2003-11-20 09:13:16 EST
this bug did not get fixed for m5, with activities and roles work taking priority. moving to m6.
Comment 20 Chris McLaren CLA 2003-12-11 15:55:58 EST
fixed.

in org.eclipse.search.internal.ui.SearchResultViewer,
the constructor includes:

	IActionBars actionBars= fOuterPart.getViewSite().getActionBars();
	actionBars.setGlobalActionHandler(ActionFactory.NEXT.getId(), 
fShowNextResultAction);

* this handler is active only when the Search view is active

in org.eclipse.jdt.internal.ui.javaeditor.BasicJavaEditorActionContributor 
init(IActionBars bars, IWorkbenchPage page) includes:

	bars.setGlobalActionHandler(ITextEditorActionConstants.NEXT, 
fNextAnnotation);

* this handler is active only when the java editor or outline view (are there 
others?) is active.

so far so good. 

the problem is that the action set registers as well when the first java 
editor opened (activated or not). we register all actions in active action 
sets to receive keybindings. i made this true so long as no global action is 
registered.