I am working on an rcp application with a toolbar for quick access to certain actions, including undo and redo. My problem is that these two specific actions don't show up in the toolbar. I have located the cause to the workbench.xmi
file that is generated when the application launches. A tag persistedState
with an attribute key="persp.hiddenItems"
contains persp.hideToolbarSC:org.eclipse.ui.edit.undo,persp.hideToolbarSC:org.eclipse.ui.edit.redo
in the value="..."
attribute. If I delete these entries from workbench.xmi
, the undo and redo actions show up in the toolbar as they should.
My question is: What can I do so that org.eclipse.ui.edit.undo
and org.eclipse.ui.edit.redo
don't end up in this attribute to begin with?
I originally used eclipse neon without this problem, but when updating to eclipse 2018-12 this started happening.
Edit:
I finally got it to work by changing the IDs of my undo and redo actions to something else. I had to set the ID with setId(...)
and setActionDefinedId(...)
in the actions' constructors, and then the commands had to be defined in plugin.xml
under <extension point="org.eclipse.ui.commands">
in a <command id="..." name="Undo"></command>
tag.
This solutions feels more like a workaround than an actual solution, but it works for me.
This is set by the hiddenToolBarItem
element of the org.eclipse.ui.perspectiveExtensions
extension point.
The org.eclipse.ui.ide
plug-in uses this to disable these tool-bar items:
<extension
point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension targetID="*">
<!--
disable "print" button which is defined by org.eclipse.ui.actions.ActionFactory.PRINT
and contributed by org.eclipse.ui.internal.ide.WorkbenchActionBuilder
-->
<hiddenToolBarItem id="print" />
<!--
disable "undo" button which is defined by org.eclipse.ui.actions.ActionFactory.UNDO
and contributed by org.eclipse.ui.internal.ide.WorkbenchActionBuilder
-->
<hiddenToolBarItem id="org.eclipse.ui.edit.undo" />
<!--
disable "redo" button which is defined by org.eclipse.ui.actions.ActionFactory.REDO
and contributed by org.eclipse.ui.internal.ide.WorkbenchActionBuilder
-->
<hiddenToolBarItem id="org.eclipse.ui.edit.redo" />
</perspectiveExtension>
</extension>
I don't see a way to clear this other than leaving out the plug-in.