This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 370590 - [Compatibility] In CDT, the buttons inside the macro explorer are disabled
Summary: [Compatibility] In CDT, the buttons inside the macro explorer are disabled
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 4.2.2   Edit
Assignee: Paul Webster CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 331444
  Show dependency tree
 
Reported: 2012-02-03 13:06 EST by Marc-André Laperle CLA
Modified: 2013-01-30 03:12 EST (History)
3 users (show)

See Also:


Attachments
LegacyHandlerService patch v1 (1.78 KB, patch)
2012-03-06 15:02 EST, Remy Suen CLA
no flags Details | Diff
Workaround for CDT (1.33 KB, patch)
2012-09-22 14:47 EDT, Marc-André Laperle CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marc-André Laperle CLA 2012-02-03 13:06:11 EST
Using Build id: 20120202-1513 (Juno M5 C/C++)

1. Create a c++ project and paste this code

#define FOO(a) a++
#define BAR(a) FOO(a)

int main() {
  int b;
  BAR(b); // hover on BAR
  return 0;
}

2. Hover on BAR in main, click on the hover window to open macro explorer.
3. Buttons are disabled at the bottom the window.

It works correctly with Indigo SR2-RC2.
Comment 1 Remy Suen CLA 2012-02-03 14:26:33 EST
(In reply to comment #0)
> It works correctly with Indigo SR2-RC2.

Also confirmed to be working with 3.8M5. Will poke around.

Cool feature, by the way. :)
Comment 2 Remy Suen CLA 2012-02-03 14:56:54 EST
When we try to look for the "org.eclipse.cdt.ui.hover.backwardMacroExpansion" handler, we don't find anything so mark the item as being disabled.
Comment 3 Remy Suen CLA 2012-02-03 16:04:13 EST
Looks like the handlers are activated globally.
http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/tree/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CMacroExpansionExplorationControl.java?id=d2ba7a5b346d568eb26a84666b15c2a944dea8fc

IWorkbench workbench= PlatformUI.getWorkbench();
fHandlerService= (IHandlerService) workbench.getService(IHandlerService.class);
fContextService= (IContextService) workbench.getService(IContextService.class);
fContextActivation= fContextService.activateContext(CONTEXT_ID_MACRO_EXPANSION_HOVER);
fHandlerActivations= new ArrayList<IHandlerActivation>();
fHandlerActivations.add(fHandlerService.activateHandler(COMMAND_ID_EXPANSION_BACK, backwardHandler));
fHandlerActivations.add(fHandlerService.activateHandler(COMMAND_ID_EXPANSION_FORWARD, forwardHandler));
fHandlerActivations.add(fHandlerService.activateHandler(ICEditorActionDefinitionIds.OPEN_DECL, gotoDefinitionHandler));
Comment 4 Remy Suen CLA 2012-02-07 09:12:34 EST
The items are created first and then the handlers are registered. Our CCIs don't seem to be notified of this fact so the items stay disabled.
Comment 5 Remy Suen CLA 2012-03-06 15:02:47 EST
Created attachment 212158 [details]
LegacyHandlerService patch v1

If we force an event to be fired when the handler becomes active this problem goes away.
Comment 6 Marc-André Laperle CLA 2012-09-22 14:47:38 EDT
Created attachment 221376 [details]
Workaround for CDT

Patch for CDT in case the bug is not fixed in Platform for 4.2.2.
Comment 8 Paul Webster CLA 2013-01-17 12:57:10 EST
In M20130116-1800

PW