加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – 在Eclipse RCP中使用导航历史记录

发布时间:2020-12-14 19:19:25 所属栏目:Java 来源:网络整理
导读:我喜欢在我的RCP应用程序中使用Eclipse提供的导航历史记录.不幸的是,这个功能没有很好的记录事实上我只找到了这个Wiki条目:http://wiki.eclipse.org/FAQ_How_do_I_hook_my_editor_to_the_Back_and_Forward_buttons%3F 它提到可以在导航历史记录中标记每个编

我喜欢在我的RCP应用程序中使用Eclipse提供的导航历史记录.不幸的是,这个功能没有很好的记录事实上我只找到了这个Wiki条目:http://wiki.eclipse.org/FAQ_How_do_I_hook_my_editor_to_the_Back_and_Forward_buttons%3F

它提到可以在导航历史记录中标记每个编辑器,而无需指定位置.这正是我想要的.

Regardless of whether the specific editor has any support for navigation history,markLocation will work. If the editor doesn’t implement INavigationLocationProvider,a history entry will be added,allowing the user to jump back to that editor but without returning to any particular location.

我在应用程序中添加了以下代码行,以便每次打开新的编辑器时添加导航条目.

IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorPart editor = page.openEditor( input,MyEditor.ID );
page.getNavigationHistory().markLocation( editor );

我的问题是代码不起作用.命令org.eclipse.ui.navigate.backwardHistory和org.eclipse.ui.navigate.forwardHistory的工具栏图标保持灰色.

最佳答案
我找到了解决方案.要在Eclipse RCP应用程序中使用导航历史记录,您必须将以下代码行添加到ApplicationActionBarAdvisor.

/**
 * Fills the cool bar with the main toolbars for the window.
 * 

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读