Ohanes Dadian
Ohanes Dadian

Reputation: 635

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.

Upvotes: 3

Views: 1102

Answers (1)

VonC
VonC

Reputation: 1324557

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.

Upvotes: 2

Related Questions