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());
}
};
}
精彩评论