Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 366568

Summary: [Compatibility] command service refreshElements(*) not implemented
Product: [Eclipse Project] Platform Reporter: Paul Webster <pwebster>
Component: UIAssignee: Remy Suen <remy.suen>
Status: VERIFIED FIXED QA Contact: Paul Webster <pwebster>
Severity: normal    
Priority: P3 CC: emoffatt, remy.suen, sbushkov
Version: 4.2   
Target Milestone: 4.2 M6   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 374289    
Bug Blocks: 366554    
Attachments:
Description Flags
Patch
none
Patch v02
none
Patch v03 none

Description Paul Webster CLA 2011-12-13 11:02:21 EST
org.eclipse.ui.commands.ICommandService.refreshElements(String, Map) tries to get the handler from the command, but org.eclipse.ui.internal.MakeHandlersGo is not an IElementUpdater.

This blocks:
org.eclipse.ui.tests.commands.CommandCallbackTest.testNoParametersWithCallbacks()
org.eclipse.ui.tests.commands.CommandCallbackTest.testParametersWithCallbacks()
org.eclipse.ui.tests.commands.CommandCallbackTest.testParmsToSameCommand()
org.eclipse.ui.tests.commands.CommandCallbackTest.testParmsToDifferentProtocol()

org.eclipse.ui.tests.commands.CommandCallbackTest.testCommandThroughWindow()
org.eclipse.ui.tests.commands.CommandCallbackTest.testCallbackCleanup()
Comment 1 Paul Webster CLA 2012-02-21 14:57:19 EST
*** Bug 371821 has been marked as a duplicate of this bug. ***
Comment 2 Remy Suen CLA 2012-02-28 15:10:00 EST
Created attachment 211760 [details]
Patch

Need slave services to ensure that the registered element updaters are removed when the window gets disposed.

The code in MakeHandlersGo is suspect but does seem to work. All seven tests in CommandCallbackTest are green anyway.
Comment 3 Paul Webster CLA 2012-02-28 15:16:02 EST
That's probably half of the loop.  But we converted most CCIs to HCIs in 4.x, so we probably need some kind of register pattern similar to what we do in the CCI constructor for the MHMIs and MHTIs.

Either in the HCI (but abstracted because HCI can't see the 3.x command service) or by walking the model at some point from org.eclipse.ui.workbench.  Then the handler calls methods on the UIElement which updates the model element which is then rendered correctly.  Ta Da!

PW
Comment 4 Remy Suen CLA 2012-02-29 10:13:47 EST
Created attachment 211804 [details]
Patch v02

(In reply to comment #3)
> Either in the HCI (but abstracted because HCI can't see the 3.x command
> service) or by walking the model at some point from org.eclipse.ui.workbench.

First approach seemed more straightforward than the other.
Comment 5 Remy Suen CLA 2012-02-29 11:00:49 EST
Created attachment 211815 [details]
Patch v03
Comment 7 Remy Suen CLA 2012-03-13 09:00:14 EDT
Verified by source code inspection with I20120312-1730.