TableViewer使用

1.自定义编辑器激活方式  

/**
     * Create a customized editor whose activation process is customized
     *
     * @param viewer
     *            the viewer the editor is created for
     * @param editorActivationStrategy
     *            activation strategy to control if an editor activated
     * @param feature
     *            bit mask controlling the editor
     *            <ul>
     *            <li>{@link ColumnViewerEditor#DEFAULT}</li>
     *            <li>{@link ColumnViewerEditor#TABBING_CYCLE_IN_ROW}</li>
     *            <li>{@link ColumnViewerEditor#TABBING_HORIZONTAL}</li>
     *            <li>{@link ColumnViewerEditor#TABBING_MOVE_TO_ROW_NEIGHBOR}</li>
     *            <li>{@link ColumnViewerEditor#TABBING_VERTICAL}</li>
     *            </ul>
     */
    public static void create(TableViewer viewer,
            ColumnViewerEditorActivationStrategy editorActivationStrategy,
            int feature) {

}

附例子:           

TableViewerEditor .create(viewer,
                            new DoubleClickColumnViewerEditorActivationStrategy(
                                    viewer), ColumnViewerEditor.DEFAULT);

/**
 * 双击编辑策略
 *
 * @author pang
 *
 */
public class DoubleClickColumnViewerEditorActivationStrategy extends
        ColumnViewerEditorActivationStrategy implements CommonUse {

    public DoubleClickColumnViewerEditorActivationStrategy(TableViewer viewer) {
        super(viewer);
    }

    /**
     * 設置編輯器觸發方式
     */
    @Override
    protected boolean isEditorActivationEvent(
            ColumnViewerEditorActivationEvent event) {

        boolean singleSelect = ((IStructuredSelection) getViewer()
                .getSelection()).size() == 1;
        return singleSelect
                && (event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION
                        || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL);
    }
}

 

转载于:https://www.cnblogs.com/huadoumi/p/4767112.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值