eclipse - 如何在 Eclipse 的工具栏中添加撤消/重做按钮?

标签 eclipse toolbar undo-redo

问这个问题我有点尴尬,但是我怎么能在 eclipse 的工具栏中获得常规的撤消/重做按钮?

我经常在德语和英语键盘布局之间切换。 Z 在这些布局上是互换的,因此我不断触发撤消/重做的错误操作。我已经观察到自己是如何在没有其他编辑器的情况下计算出来的:我只是使用工具栏进行此操作。

我已经尝试过谷歌等,以及通过自定义透视对话框,但无法找到我正在寻找的东西:-(

最佳答案

一种方法是使用自定义插件。事实上,这样的自定义插件不需要做任何事情,只需使用现有的撤消/重做命令声明新的工具栏贡献。

我已经为你构建了这样的插件:http://www.foglyn.com/misc/undoredo_1.0.0.jar .绝对没有代码,只有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"
                  label="Undo/Redo">
            <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>

和 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

您可以下载它,然后放入 Eclipse 的“dropins”目录,重新启动,您将在工具栏上看到撤消/重做按钮。

适用于 Eclipse 3.4 和 Eclipse 3.5M7。

关于eclipse - 如何在 Eclipse 的工具栏中添加撤消/重做按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/819846/

相关文章:

java - 如何在 Eclipse 中使用条件断点?

eclipse - Jersey :找不到 Java 类和 MIME 媒体类型应用程序/json 的消息正文编写器

java - 扩展 Swing 的 UndoManager 以提供重复和多个撤消/重做

linux - 如何检查我的 Eclipse 的 gcc C++ 编译器版本?

android - 带有文本选择控件的 float 工具栏

在StackPanel中时,WPF ToolBar Separator缩小为零

vb6 - 为什么 VB6 中的工具栏图标在作为 EXE 运行时看起来质量最差?

iphone - 在 iPhone 中实现撤消重做的最佳实践

events - 我们在Fabric.js中有 Canvas 修改事件吗?

java - 将文件夹添加到 Eclipse 类路径