views:

1897

answers:

5

I feel a bit embarrassed asking this questions, but how the heck can I get regular undo/redo buttons into the toolbar of eclipse?

I've often to switch between German and English keyboard layout. Y and Z on those layouts is interchanged and thus I constantly trigger the wrong action for undo / redo. I've observed myself how I figure this without other editors: I just use the toolbars for this operations.

I've already tried Google and such, as well as going through the Customize Perspective dialog, but wasn't able to find what I'm looking for :-(

A: 

I've looked through everything I know but I couldn't find anything. It seems not possible to add these actions to the toolbar, sorry.

boutta
+1  A: 

Perhaps if can't get the undo toolbar working, you can change the mapping of the Undo / Redo key combinations to ones you could become more comfortable with.

In Eclipse, go to Window > Preferences and in the left-tree, go to General > Keys.

In the 'type filter text' box, type Undo and you'll see the Undo command appear in the bottom list. You're free to change this mapping from the default Ctrl + Z to another mapping. You may likewise do the same for Redo and any other actions, such as removing trailing whitespace, etc.

Cuga
Nice suggestion, thanks!
mark
+6  A: 

One way is to use custom plugin. In fact, such custom plugin doesn't need to do anything, only declare new toolbar contribution using existing undo/redo commands.

I've built such plugin for you: http://www.foglyn.com/misc/undoredo_1.0.0.jar. There is absolutely no code, only plugin.xml:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
   <extension
         point="org.eclipse.ui.menus">
      <menuContribution
          locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
         <toolbar
               id="undoredo.toolbar">
            <command
                  commandId="org.eclipse.ui.edit.undo"
                  id="undoredo.undo"
                  style="push">
            </command>
            <command
                  commandId="org.eclipse.ui.edit.redo"
                  id="undoredo.redo"
                  style="push">
            </command>
         </toolbar>
      </menuContribution>
   </extension>

</plugin>

And MANIFEST.MF:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Undoredo
Bundle-SymbolicName: undoredo;singleton:=true
Bundle-Version: 1.0.0
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.ui

You can download it, and drop into your 'dropins' directory of Eclipse, restart, and you'll see Undo/Redo buttons on your toolbar.

Works for me in Eclipse 3.4 and Eclipse 3.5M7.

Peter Štibraný
Incredible answer ...
mark
A: 

Short and clear answer for the question a novice like me was searching for some time. You should be a role model for many others who "answers (confuses)" or others who "talk" but not "communicates".

Thank you

A: 

yes best not to use to man (of these things when you communicate) and come straight "to the point" without using "" these things

stanwilcox