开发者

Eclipse GEF. How to enforce single selection?

开发者 https://www.devze.com 2023-02-20 00:35 出处:网络
How do I en开发者_JAVA技巧force single Selection in Eclipse GEF? Only one EditPart should be selectable at a time.See bug 102420

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

精彩评论

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