简体   繁体   中英

Eclipse RCP File Browser in ViewPart or Editor?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM