开发者

Eclipse RCP File Browser in ViewPart or Editor?

开发者 https://www.devze.com 2023-01-10 06:54 出处:网络
I am implementing a file browser, in Eclipse RCP, using a TreeViewer.Would it be best to put it in an Editor or ViewPart.I ask because, I need to be able to pas开发者_Python百科s the root path for the

I am implementing a file browser, in Eclipse RCP, using a TreeViewer. Would it be best to put it in an Editor or ViewPart. I ask because, I need to be able to pas开发者_Python百科s the root path for the browser and do not know of a way to do so with a view. As views are not instantiated directly.


From the Eclipse FAQ, regarding the differences between Editors and Views:

  • 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.

Your file browser could really use a View instead of an Editor here.

You can get all the instantiated Views through:

 PlatformUI.getWorkbench().getViewRegistry().getViews();

and then get it from its view id.

0

精彩评论

暂无评论...
验证码 换一张
取 消