我正在 Eclipse RCP 中使用 TreeViewer 实现一个文件浏览器。最好将它放在编辑器或 ViewPart 中。我问是因为,我需要能够为浏览器传递根路径,但不知道如何通过 View 来传递。由于 View 不是直接实例化的。
最佳答案
来自Eclipse FAQ ,关于编辑器和 View 之间的差异:
- There is generally only one instance of a given view per workbench page, but there can be several instances of the same type of editor.
- Editors can appear in only one region of the page, whereas views can be moved to any part of the page and minimized as fast views.
- Editors can be in a dirty state, meaning that their contents are unsaved and will be lost if the editor is closed without saving.
- Views have a local toolbar, whereas editors contribute buttons to the global toolbar.
- Editors can be associated with a file name or an extension, and this association can be changed by users.
您的文件浏览器真的可以在这里使用 View 而不是编辑器。
您可以通过以下方式获取所有实例化的View:
PlatformUI.getWorkbench().getViewRegistry().getViews();
然后得到它from its view id .
关于java - ViewPart 或编辑器中的 Eclipse RCP 文件浏览器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3401692/