首页 > 其他 > 详细

TableViewer使用

时间:2015-08-28 19:30:15      阅读:168      评论:0      收藏:0      [点我收藏+]

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);
    }
}

 

TableViewer使用

原文:http://www.cnblogs.com/huadoumi/p/4767112.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!