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

发布于 2024-07-19 00:52:44 字数 262 浏览 12 评论 0原文

我觉得问这个问题有点尴尬,但是我到底怎样才能将常规的撤消/重做按钮放入 Eclipse 的工具栏中呢?

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

我已经尝试过 Google 等,以及浏览“自定义视角”对话框,但无法找到我要查找的内容:-(

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 :-(

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

忘年祭陌 2024-07-26 00:52:44

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

我已经为您构建了这样的插件: 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。

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"
                  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>

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.

没有伤那来痛 2024-07-26 00:52:44

也许如果无法使撤消工具栏正常工作,您可以将撤消/重做组合键的映射更改为您更熟悉的组合。

在 Eclipse 中,转到“窗口”>“ 首选项,然后在左侧树中,转到“常规”>“ 钥匙。

在“键入过滤器文本”框中,键入“撤消”,您将看到“撤消”命令出现在底部列表中。 您可以随意将此映射从默认的 Ctrl + Z 更改为其他映射。 您也可以对重做和任何其他操作执行相同的操作,例如删除尾随空格等。

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.

柳若烟 2024-07-26 00:52:44

编辑:这现在包含在Peter Štibraný的答案

旧线程中,但仍然有帮助......对 Peter Štibraný 的出色答案做了一点补充。 将打开的工具栏标记更改为:

<toolbar
    id="undoredo.toolbar"
    label="Undo/Redo">

这使得新工具栏在“自定义透视”对话框中显示为带有撤消/重做标签,而不是显示为空白条目。 (没有足够的代表将其添加到评论中!)

Edit: this is now included in Peter Štibraný's answer

Old thread, but still helpful... Made a small addition to Peter Štibraný's excellent answer. Changed the opening toolbar tag to:

<toolbar
    id="undoredo.toolbar"
    label="Undo/Redo">

This makes the new toolbar show up with the label Undo/Redo in the Customize Perspective dialog instead of showing up as a blank entry. (Don't have enough rep to add it to the comments!)

乄_柒ぐ汐 2024-07-26 00:52:44

工具栏和菜单取决于当前视角。
要更改它们,请转到窗口>; 自定义视角...

The toolbars and menus are dependent on the current perspective.
To change them go to Window > Customize Perspective...

夜清冷一曲。 2024-07-26 00:52:44

2021 更新

这是 eclipse 2020-12 中的快速修复:窗口 --> 观点--> 自定义视角 --> 单击编辑复选框 --> 应用并关闭。

这会将撤消/重做按钮放在工具栏上,但位于左侧。 要移动它们,请单击撤消按钮左侧的三个点,然后拖动到编辑器窗口上方更方便的位置。

2021 UPDATE

It's a quick fix in eclipse 2020-12: Window --> Perspective --> Customize Perspective --> click Edit checkbox --> Apply and Close.

That puts undo/redo buttons on the toolbar, but way to the left. To move them, click the three dots to the left of the undo button and drag to a more convenient location above your editor window.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文