Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 376441 - [Compatibility] IEvaluationService.requestEvaluation() does not call property tester as it used to
Summary: [Compatibility] IEvaluationService.requestEvaluation() does not call property...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: 4.2 M7   Edit
Assignee: Oleg Besedin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 331444
  Show dependency tree
 
Reported: 2012-04-10 16:18 EDT by Marc Khouzam CLA
Modified: 2012-05-01 11:40 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Khouzam CLA 2012-04-10 16:18:45 EDT
CDT provides a feature to allow to do reverse debugging (step backwards).

When reverse debugging is possible, CDT makes visible 4 new buttons on the debug toolbar: "reverse step into", "reverse step over", "reverse resume", and "uncall" (reverse step return).

This small howto shows screenshots of the buttons and how to enable them:
http://wiki.eclipse.org/CDT/User/FAQ#How_do_I_do_Reverse_Debugging.3F

The problem is that when the 'toggle reverse debugging' is pressed, the buttons don't appear immediately with 4.2.  In 3.8 we achieved the immediate visibility using:

IEvaluationService exprService = (IEvaluationService) PlatformUI.getWorkbench().getService(IEvaluationService.class);
exprService.requestEvaluation("org.eclipse.cdt.debug.ui.isReverseDebuggingEnabled");

This is called in CDT's org.eclipse.cdt.debug.internal.ui.commands.ReverseToggleCommandHandler

In turn, in 3.8, the IEvaluationService calls org.eclipse.cdt.dsf.gdb.internal.ui.actions.ReverseDebuggingPropertyTester right away.

In 4.2, when I press the 'toggle reverse debugging' button, IEvaluationService.requestEvaluation() is being called, but it never gets to the CDT property tester anymore.

If I can help get more info, please let me know.
Comment 1 Marc Khouzam CLA 2012-04-11 08:58:13 EDT
I'm using the latest I-build: I20120321
Comment 2 Marc Khouzam CLA 2012-04-18 11:20:34 EDT
Pawel wrote example code for the the platform's PDS example debugger that reproduce this problem.

Please see Bug 376442 comment 14.

Using that modified PDA example:
1- launch a PDA debugger with the counter.pda sample
2- press on the "Restart enable" button on the debug view toolbar (gray-ish button)
3- nothing happens with 4.2
4- click anywhere else and a new Restart button appears in the debug view toolbar (button with a plus sign)

In this case, the IEvaluationService.requestEvaluation()
is being called by RestartEnableCommandHandler.postExecute which is in the plugin org.eclipse.debug.examples.ui
Comment 3 Marc Khouzam CLA 2012-04-18 11:21:15 EDT
(In reply to comment #2)
> Pawel wrote example code for the the platform's PDS example debugger

Sorry, "PDA" example
Comment 4 Oleg Besedin CLA 2012-04-25 16:04:34 EDT
I'll need to ask Paul about this as I am not familiar with the code.

It seems that in 4.x the ReferenceExpression is not added to the EvaluationService for 
<visibleWhen>
  <reference             
     definitionId="org.eclipse.debug.examples.ui.testIsRestartEnabled">
  </reference>
</visibleWhen>

In 3.x reference is added in the following call stack:

EvaluationAuthority.addEvaluationListener(IEvaluationReference) line: 68	
EvaluationService.addEvaluationListener(Expression, IPropertyChangeListener, String) line: 47	
WorkbenchMenuService.registerVisibleWhen(IContributionItem, Expression, Set, String) line: 884	
ContributionRoot.addContributionItem(IContributionItem, Expression) line: 60	
MenuAdditionCacheEntry.createContributionItems(IServiceLocator, IContributionRoot) line: 188	
WorkbenchMenuService$5.run() line: 584	
SafeRunner.run(ISafeRunnable) line: 42	
WorkbenchMenuService.processAdditions(IServiceLocator, Set, ContributionManager, AbstractContributionFactory, Set) line: 656	
WorkbenchMenuService.addContributionsToManager(IServiceLocator, Set, ContributionManager, String, boolean, List) line: 744	
WorkbenchMenuService.populateContributionManager(IServiceLocator, Set, ContributionManager, String, boolean) line: 730	
SlaveMenuService.populateContributionManager(IServiceLocator, Set, ContributionManager, String, boolean) line: 203	
SlaveMenuService.populateContributionManager(ContributionManager, String) line: 76	
ViewReference.createPartHelper() line: 406	
ViewReference.createPart() line: 240	
ViewReference(WorkbenchPartReference).getPart(boolean) line: 595	
ViewPane(PartPane).setVisible(boolean) line: 315
Comment 5 Paul Webster CLA 2012-04-25 17:43:54 EDT
For menus and toolbars this doesn't go through the IEvaluationService anymore I guess.  It looks like the toolbar contribution RAT would be set up in org.eclipse.e4.ui.workbench.renderers.swt.ToolBarManagerRenderer.processAddition(MToolBar, ToolBarManager, MToolBarContribution)

PW
Comment 6 Paul Webster CLA 2012-04-26 14:51:18 EDT
org.eclipse.ui.internal.services.EvaluationService.requestEvaluation(String) already walks through code that uses the IEvaluationService and will re-evaluate the mentioned property.

The problem in question is that visibleWhen for the toolbars is now managed by a RAT in ToolBarManagerRenderer.processAddition(*).

The RAT has code that calls down to org.eclipse.e4.ui.internal.workbench.ContributionsAnalyzer.isVisible(MCoreExpression, ExpressionContext) which takes the core expression ReferenceExpression and evaluates it against the IEclipseContext contained within the ExpressionContext.

We can get the names of any property testers used by the ReferenceExpression using code like:

ExpressionInfo info = refExpr.computeExpressionInfo();
String[] names = info.getAccessedPropertyNames();

One way to hook them up would be to have the RAT get(*) the property names so they're recorded, and have the requestEvaluation(*) method set them in the application IEclipseContext so that the rats are kicked off.

PW
Comment 8 Marc Khouzam CLA 2012-04-29 21:11:28 EDT
Verified with I20120429-1800

Thanks guys!
Comment 9 Oleg Besedin CLA 2012-05-01 11:40:37 EDT
(In reply to comment #8)
> Verified with I20120429-1800
> 
> Thanks guys!

Thank you!