User Tools

Site Tools


blog:view_versus_editor_in_rcp

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
blog:view_versus_editor_in_rcp [2008/06/02 16:30]
djo
blog:view_versus_editor_in_rcp [2014/10/17 22:08] (current)
Line 1: Line 1:
 +====== View versus Editor in RCP ======
 +
 +At http://​blog.cypal-solutions.com/​2008/​05/​to-view-or-not-to-view.html,​ Prakash describes the following distinctions between views and editors:
 +
 +    * Editors contribute to the global action bars, and views to its local action bar.
 +    * In the layout, editors have a special place called editorArea where all the editors will go. Views can go anywhere else, including fast views, detachable ones, etc.
 +
 +He also points out that it's a common misconception that views don't support the save action. ​ The save action will be enabled for a view if it implements ISaveablePart.
 +
 +To me, this isn't the crux of the issue, however.
 +
 +===== When to use a View versus an Editor =====
 +
 +The only real difference between a view and an editor is that there is exactly 1 editor area and once visible, it is always visible even if no editors are open.
 +
 +When would one care?
 +
 +If your application has an open/​edit/​close life cycle (even if saving is implicit), the thing you edit probably should be an editor.
 +
 +For example, in an order entry application,​ the order editor probably should be an Eclipse Editor, not a View.  The thing that opens the order editor will likely be a View (or maybe another Editor, depending on the application).
 +
 +If you try to make the thing you open, edit, and close into a view, then if the user closes all of the "​editing views",​ the space occupied by the view stack will disappear.
 +
 +But if you make it an editor, then the editor area will remain even when all currently-opened editors are closed. ​ This way it will be obvious to the user that s/he can still open a new thing to edit.
 +
 +===== Conclusion =====
 +
 +Use an editor for things you want the user to be able to open, edit, and close. ​ And if it's reasonable, design your application around this user interface idiom since Eclipse supports it well.
 +
 +Use a View as a device for browsing the things you can edit and/or for supplying additional information about the thing currently being edited.
 +
 +~~LINKBACK~~
 +~~DISCUSSION:​closed~~