From 794acc894ee2f5fd3ebc68833ce1f9eae06a07f4 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Tue, 20 Dec 2011 13:23:52 +0100 Subject: [PATCH] temporary solution for mem leak fix --- .../ide/navigationToolbar/NavBarPanel.java | 70 ++++++++++--------- 1 file changed, 37 insertions(+), 33 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarPanel.java b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarPanel.java index ed83e7f47000..c15259f45760 100644 --- a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarPanel.java +++ b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarPanel.java @@ -373,39 +373,8 @@ public class NavBarPanel extends JPanel implements DataProvider, PopupOwner, Dis } public void installActions(final int index, final NavBarItem component) { - DnDSupport.createBuilder(component) - .setBeanProvider(new Function() { - @Override - public DnDDragStartBean fun(DnDActionInfo dnDActionInfo) { - return new DnDDragStartBean(new TransferableWrapper() { - @Override - public List asFileList() { - final Object o = myModel.get(index); - if (o instanceof PsiElement) { - final VirtualFile vf = o instanceof PsiDirectory ? ((PsiDirectory)o).getVirtualFile() - : ((PsiElement)o).getContainingFile().getVirtualFile(); - if (vf != null) { - return Arrays.asList(new File(vf.getPath()).getAbsoluteFile()); - } - } - return Collections.emptyList(); - } - - @Override - public TreeNode[] getTreeNodes() { - return null; - } - - @Override - public PsiElement[] getPsiElements() { - return null; - } - }); - } - }) - .setDisposableParent(component) - .install(); - + //suppress it for a while + //installDnD(index, component); ListenerUtil.addMouseListener(component, new MouseAdapter() { public void mouseReleased(final MouseEvent e) { @@ -446,6 +415,41 @@ public class NavBarPanel extends JPanel implements DataProvider, PopupOwner, Dis }); } + private void installDnD(final int index, NavBarItem component) { + DnDSupport.createBuilder(component) + .setBeanProvider(new Function() { + @Override + public DnDDragStartBean fun(DnDActionInfo dnDActionInfo) { + return new DnDDragStartBean(new TransferableWrapper() { + @Override + public List asFileList() { + final Object o = myModel.get(index); + if (o instanceof PsiElement) { + final VirtualFile vf = o instanceof PsiDirectory ? ((PsiDirectory)o).getVirtualFile() + : ((PsiElement)o).getContainingFile().getVirtualFile(); + if (vf != null) { + return Arrays.asList(new File(vf.getPath()).getAbsoluteFile()); + } + } + return Collections.emptyList(); + } + + @Override + public TreeNode[] getTreeNodes() { + return null; + } + + @Override + public PsiElement[] getPsiElements() { + return null; + } + }); + } + }) + .setDisposableParent(component) + .install(); + } + private void doubleClick(final int index) { doubleClick(myModel.getElement(index)); }