Search in sources :

Example 1 with FileDrop

use of com.intellij.openapi.fileChooser.ex.FileDrop in project intellij-community by JetBrains.

the class SelectLocationStep method init.

protected void init() {
    final DefaultActionGroup fileSystemActionGroup = createFileSystemActionGroup();
    myFileSystemToolBar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, fileSystemActionGroup, true);
    final JTree tree = myFileSystemTree.getTree();
    tree.getSelectionModel().addTreeSelectionListener(myTreeSelectionListener);
    tree.setCellRenderer(new NodeRenderer());
    tree.addMouseListener(new PopupHandler() {

        public void invokePopup(Component comp, int x, int y) {
            final ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.UPDATE_POPUP, fileSystemActionGroup);
            popupMenu.getComponent().show(comp, x, y);
        }
    });
    tree.addSelectionPath(tree.getPathForRow(0));
    new FileDrop(tree, new FileDrop.Target() {

        public FileChooserDescriptor getDescriptor() {
            return myChooserDescriptor;
        }

        public boolean isHiddenShown() {
            return myFileSystemTree.areHiddensShown();
        }

        public void dropFiles(final List<VirtualFile> files) {
            if (files.size() > 0) {
                selectInTree(files.toArray(new VirtualFile[files.size()]));
            }
        }
    });
    super.init();
}
Also used : NodeRenderer(com.intellij.ide.util.treeView.NodeRenderer) FileDrop(com.intellij.openapi.fileChooser.ex.FileDrop) VirtualFile(com.intellij.openapi.vfs.VirtualFile) PopupHandler(com.intellij.ui.PopupHandler) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor)

Aggregations

NodeRenderer (com.intellij.ide.util.treeView.NodeRenderer)1 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)1 FileDrop (com.intellij.openapi.fileChooser.ex.FileDrop)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 PopupHandler (com.intellij.ui.PopupHandler)1