コード例 #1
0
 @Override
 public void dispose() {
   if (myDndManager != null) {
     if (myDropTarget != null) {
       myDndManager.unregisterTarget(myDropTarget, myTree);
       myDropTarget = null;
     }
     if (myDragSource != null) {
       myDndManager.unregisterSource(myDragSource, myTree);
       myDragSource = null;
     }
     myDndManager = null;
   }
   setTreeBuilder(null);
   myTree = null;
   myTreeStructure = null;
 }
コード例 #2
0
  protected void enableDnD() {
    if (!ApplicationManager.getApplication().isHeadlessEnvironment()) {
      myDropTarget =
          new ProjectViewDropTarget(
              myTree,
              new Retriever() {
                @Override
                public PsiElement getPsiElement(@Nullable TreeNode node) {
                  return getPSIElement(getElementFromTreeNode(node));
                }

                @Override
                public Module getModule(TreeNode treeNode) {
                  return getNodeModule(getElementFromTreeNode(treeNode));
                }
              },
              myProject);
      myDragSource = new MyDragSource();
      myDndManager = DnDManager.getInstance();
      myDndManager.registerSource(myDragSource, myTree);
      myDndManager.registerTarget(myDropTarget, myTree);
    }
  }