开发者

Eclipse GEF. How to enforce single selection?

How do I en开发者_JAVA技巧force single Selection in Eclipse GEF?

Only one EditPart should be selectable at a time.


See bug 102420

That seems like the only way at the moment.


Override getDragTracker in editPart:

 @Override
 public DragTracker getDragTracker(Request request)
 {
    // Create a drag tracker that will enforce single selection
    return new DragEditPartsTracker(this)
    {
        protected void performSelection()
        {
            if (hasSelectionOccurred())
                return;

            setFlag(FLAG_SELECTION_PERFORMED, true);
            getCurrentViewer().select(getSourceEditPart());
        }
    };
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜