0

I have a problem figuring out how to override a command, and specifically: org.eclipse.ui.edit.text.showInformation in Eclipse RCP.

It look like extending through org.eclipse.ui.handlers never trigger my handler, and the console always returns:

COMMANDS >>> execute >>> starting: id=org.eclipse.ui.edit.text.showInformation; event=ExecutionEvent(Command(org.eclipse.ui.edit.text.showInformation,Show Tooltip Description,
        Displays information for the current caret location in a focused hover,
        Category(org.eclipse.ui.category.textEditor,Text Editing,Text Editing Commands,true),
        org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@325c29d9,
        ,,true),{},null,org.eclipse.e4.core.commands.internal.HandlerServiceImpl$ExecutionContexts@9a49ddd)
COMMANDS >>> execute >>> success: id=org.eclipse.ui.edit.text.showInformation; returnValue=null
CONTEXTS >>> [org.eclipse.ui.actionSet.keyBindings, org.eclipse.ui.edit.text.actionSet.annotationNavigation, org.eclipse.ui.contexts.dialogAndWindow, org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo, org.eclipse.search.searchActionSet, org.eclipse.ui.edit.text.actionSet.navigation, org.eclipse.ui.cheatsheets.actionSet, org.eclipse.ui.NavigateActionSet, org.eclipse.ui.externaltools.ExternalToolsSet, org.eclipse.ui.contexts.window, org.eclipse.ui.actionSet.openFiles]

Which really smells like I am not doing something necessary (it always goes to the default InformationDispatchAction in AbstractTextEditor).

The comments suggest I don't have org.eclipse.ui.textEditorScope, but how to add a context to the execution of the handler?

Andrea Richiardi
  • 703
  • 6
  • 21
  • What is it you want to do that can't be done using the various extension interfaces supported by `InformationDispatchAction`? Such as `ITextViewerExtension2`, `ITextViewerExtension4`, `ISourceViewerExtension3`, `IInformationProviderExtension2` – greg-449 Jul 26 '14 at 06:59
  • I would like to provide my own ITextHover in a clean way..i guess ...at the moment it is in the SourceViewerConfiguration, I thought that somehow the AbstractTextViewer was going to automatically calling getTextHover on it. – Andrea Richiardi Jul 26 '14 at 09:32
  • The normal way to do all this is through the SourceViewerConfiguration. – greg-449 Jul 26 '14 at 09:34
  • And here it is the reason of my question...I am overriding getTextHover and the over with the mouse worka flawlessly. But on pressing F2 nothing is shown. – Andrea Richiardi Jul 26 '14 at 14:44
  • F2 should be bound to the show information action as long as the `org.eclipse.ui.textEditorScope` context is active. – greg-449 Jul 26 '14 at 15:27
  • As follow up, the org.eclipse.ui.textEditorScope is not active, and that is why I cannot trigger my handler and the hover is not shown. I edited my question and if you can answer I will accept yours. Thanks for your help! – Andrea Richiardi Feb 07 '15 at 09:48

0 Answers0