Ctrl+1 key binding lost in 3.3 to 3.6 upgrade. [message #664178] |
Thu, 07 April 2011 14:04  |
Eclipse User |
|
|
|
Hello,
I recently upgraded my app from eclipse 3.3 to 3.6.1 platform. The transition has been smooth so far.
There is however a partial loss of functionality in one of text editors with quickassist. Although quickassist does work the way it is intended to.
The entry points for quickassist is either with key binding 'ctrl+1' or right click menu option 'quick fix'.
while the menu option does work as expected, the key binding does not seem to be picked up by the editor.
As per the eclipse docs, the text editor is configured by a subclass of TextSourceViewerConfiguration. For the api call getQuickAssistAssistant(), i return my implementation of IQuickAssistAssistant injected with an implementation of IQuickAssistProcessor.
Based on a blog post, http://eclipsesource.com/blogs/2009/07/08/tip-tracing-keybin dings-in-rcp/
i turned on tracing for the key binding and discovered that this key binding in not handled when invoked.
KEYS >>> WorkbenchKeyboard.press(potentialKeyStrokes = [CTRL+1])
KEYS >>> WorkbenchKeyboard.executeCommand(commandId = 'org.eclipse.jdt.ui.edit.text.java.correction.assist.proposa ls', parameters = {})
KEYS >>> not handled
My understanding was that ctrl+1 is by default registered for quick-fix and should be picked up by the text editor or this was the case with the target platform 3.3
Any pointers as how i should go about wiring up this key binding in eclipse would be great. Is there something in the plugin.xml file that i need to add to inform eclipse that there is a processor wired up for ctrl+1 [ as it is able to do it correctly for the menu option selection]
Thank you,
Adil.
|
|
|
|
Re: Ctrl+1 key binding lost in 3.3 to 3.6 upgrade. [message #664419 is a reply to message #664332] |
Fri, 08 April 2011 14:12   |
Eclipse User |
|
|
|
Paul,
Thank you for your reply.
In v3.3, as per my understanding as long as we subclassed the
org.eclipse.ui.editors.text.TextEditor
class, key bindings were automatically dispatched from the workbench to my custom implementation of IQuickAssistAssistant + IQuickAssistProcessor.
So pressing 'ctrl+1' or 'ctrl+space' used to trigger my code. This does not seem to be happening on 3.6 as i see with the tracing option turned on.
This http://www.eclipse.org/forums/index.php?t=msg&goto=33460 0& forum entry is where i made the above assumption where Dani confirms that subclassing TextEditor basically hooks u up with ctrl+1. As mentioned in my previous post TextSourceViewerConfiguration subclass is where i provide the text editor with my QuickAssistAssitants. This is the reason why i dont have any bindings defined in my plugin.xml [extension point 'org.eclipse.ui.bindings'] as there is no command as such to invoke.
UPDATE:
Paul,
This is how i think my editor informs the workbench to make it quick fix aware [in reply to your q:Where is the quick fix/ctrl+1 coming from? ]
Action action = new ContentAssistAction(mResourceBundle, "ContentAssistProposal.", this);
String id = ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS;
action.setActionDefinitionId(id);
setAction("ContentAssistProposal", action);
markAsStateDependentAction("ContentAssistProposal", true);
getSourceViewer().getTextWidget().addVerifyKeyListener(new ParameterTraverseListener());
getSourceViewer().getTextWidget().addMouseListener(new ParameterMouseListener());
Sorry i am not an expert in the texteditor domain. So i may be stating the obvious
Thank you,
Adil.
[Updated on: Fri, 08 April 2011 18:55] by Moderator
|
|
|
|
Re: Ctrl+1 key binding lost in 3.3 to 3.6 upgrade. [message #672112 is a reply to message #667280] |
Thu, 19 May 2011 18:54  |
Eclipse User |
|
|
|
In case anyone is interested, i had to add key bindings "ctrl+1" and "ctrl+space" and map to unique commands.
Default handlers for these commands then need to get hold of your specific editor instance and use getAdapter() to get the target (instance of ITextOperationTarget) and ask the target if the method[canDoOperation()]is supported on ( ISourceViewer.CONTENTASSIST_PROPOSALS or ISourceViewer.QUICK_ASSIST ).
In my case, i had supplied quickassistants and processors so the api returns a true.
Then its just a matter of target.doOperation(SourceViewer.CONTENTASSIST_PROPOSALS or ISourceViewer.QUICK_ASSIST).
Thank you Paul for your assistance.
|
|
|
Powered by
FUDForum. Page generated in 0.07029 seconds