Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 SWT 树查看器中应用了拖放选项,它工作得很好,但我想只允许 DND 到特定的子树类型。我通过适当的检查做到了。现在的问题是那些我没有应用DND的树节点是可拖动的,尽管由于我的检查它们无法被删除。我也想阻止它们被拖动。
请提出我看不到的问题。
您可以覆盖该方法:
public void org.eclipse.swt.dnd.DragSourceAdapter.dragStart(final DragSourceEvent event) { if (... some condition) { event.doit = false; // this will cancel DnD operation } }