如何使用带有复选框的 Common Navigator Framework

How to use the Common Navigator Framework with checkboxes

当我使用 Common Navigator Framework 时,我找不到如何让它像 TreeViewer 一样支持复选框。

一开始打算用Check Tree View,但是不能充分利用RCP机制,所以决定用Common Navigator Framework....

Greg commented, this question has been answered on the Eclipse Forum.

为了创建带有复选框的 CommonViewer,您需要覆盖 createCommonViewerObject 像这样:

protected CommonViewer createCommonViewerObject( Composite parent ) {
  int treeStyle = SWT.CHECK | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL; 
  return new CommonViewer( getViewSite().getId(), parent, treeStyle ); 
}