RCP开发中Editor与View的选择

摘录自《Eclipse Rich Client Platform: Designing, Coding, and Packaging Java™ Applications》

Here, Hyperbola is the sample application used in this book, and it is a chatting application, like qq or MSN.

...views and editors contain the "real content" for your application. But how do you choose which one to use?

The rule of thumb is that editors are meant for the primary focus of attention while views provide supporting information for a given task. So, in Hyperbola, chatting is the primary task and browsing or managing contacts is a supporting function. This indicates that the Hyperbola chat area should be implemented as an editor.

Not all decisions are quite that clear-cut, however. Even the choice made here has been hotly discussed by the Hyperbola development team. It is, of course, technically possible to use a view to represent a unique chat instead of using the chat editor (an excellent exercise for the reader).

Here is a short list of differences between views and editors to help you decide which to use for your application:

  • Editors are shared between perspectives in the same window. For example, if you close an editor in one perspective, it is closed in all perspectives.

  • Editors and views cannot be mixed in the same stack. For example, you can't drag and drop views and editors into the same location in the perspective.

  • Views can be detached from a Workbench window.

  • Views can be shown without a title.

  • Editors add contributions to the main toolbar and menu whereas views add contributions to their local toolbar and menu. You can, however, associate action sets to appear when a view is active.

  • It is possible to ask for the active editor even if the editor does not have focus. This makes it easier to synchronize views with editors, for example, linking outline-style views to the current editor.

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值