mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
support non-DMT-based tree models: reuse tree#getToggleClickCount()
This commit is contained in:
@@ -16,14 +16,12 @@
|
||||
package com.intellij.util;
|
||||
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.ide.util.treeView.NodeDescriptor;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.ui.DoubleClickListener;
|
||||
import com.intellij.ui.treeStructure.treetable.TreeTable;
|
||||
import com.intellij.util.ui.tree.TreeUtil;
|
||||
import com.intellij.util.ui.tree.WideSelectionTreeUI;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -117,7 +115,7 @@ public class EditSourceOnDoubleClickHandler {
|
||||
TreePath selectionPath = myTree.getSelectionPath();
|
||||
if (selectionPath == null || !clickPath.equals(selectionPath)) return false;
|
||||
Object last = selectionPath.getLastPathComponent();
|
||||
if (myTree.getModel().isLeaf(last) || !expandOnDoubleClick(last)) {
|
||||
if (myTree.getModel().isLeaf(last) || myTree.getToggleClickCount() != e.getClickCount()) {
|
||||
//Node expansion for non-leafs has a higher priority
|
||||
processDoubleClick(e, dataContext, selectionPath);
|
||||
return true;
|
||||
@@ -131,10 +129,5 @@ public class EditSourceOnDoubleClickHandler {
|
||||
if (myWhenPerformed != null) myWhenPerformed.run();
|
||||
}
|
||||
|
||||
private static boolean expandOnDoubleClick(Object treeNode) {
|
||||
Object object = TreeUtil.getUserObject(treeNode);
|
||||
return !(object instanceof NodeDescriptor && !((NodeDescriptor)object).expandOnDoubleClick());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user