[text] actionSetPartAssociations deprecated -> how to replace this with commands? [message #892731] |
Fri, 29 June 2012 11:39 |
Dennis Hendriks Messages: 74 Registered: January 2010 Location: The Netherlands |
Member |
|
|
Hi all,
I use org.eclipse.ui.actionSetPartAssociations to contribute the org.eclipse.ui.edit.text.actionSet.presentation to my custom text editor. This ensured that the 'Toggle block selection mode' and 'Show whitespace characters' toolbar buttons are shown when my editor is active.
This worked fine in Eclipse 3.7 (Indigo) and still seems to work in Eclipse 4.2 (Juno). However, it seems the extension point is now deprecated, and I should use the org.eclipse.ui.commands extension point instead. I could not find a replacement for the block selection mode action in the form of a block selection mode command, nor could I find a command variant of the action sets concept.
Is there a way to get rid of this warning by switching to commands, or are these actions not yet (re)implemented in the commands framework?
Thanks,
Dennis
|
|
|
|
Re: [text] actionSetPartAssociations deprecated -> how to replace this with commands? [message #983901 is a reply to message #983024] |
Wed, 14 November 2012 08:32 |
Dennis Hendriks Messages: 74 Registered: January 2010 Location: The Netherlands |
Member |
|
|
No, I never found a solution that allows me to use commands.
Instead, I now have the following code in my text editor class:
@Override
public void init(IEditorSite site, IEditorInput input)
throws PartInitException
{
// Perform normal initialization.
super.init(site, input);
// Show the 'presentation' action set with the 'Toggle Block Selection
// Mode' and 'Show Whitespace Characters' actions.
IWorkbenchPage page = site.getPage();
page.showActionSet("org.eclipse.ui.edit.text.actionSet.presentation");
}
which overrides org.eclipse.ui.texteditor.AbstractTextEditor.init(IEditorSite, IEditorInput).
One of the problems with this 'solution', is that I show the action set, but never hide it. As such, the buttons are now always visible in the toolbar. They are however disabled if the current editor (the one with the focus) does not support them.
It works good enough for me, although I would probably prefer a proper commands solution, if one were available.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03726 seconds