mirror of https://github.com/zlatinb/muwire
fix focus on uploaded file in tree view
parent
d3cfcef063
commit
f012eaef47
|
@ -1467,9 +1467,26 @@ class MainFrameView {
|
||||||
def node = model.fileToNode.get(sf)
|
def node = model.fileToNode.get(sf)
|
||||||
if (node == null)
|
if (node == null)
|
||||||
return
|
return
|
||||||
def path = new TreePath(node.getPath())
|
|
||||||
tree.setSelectionPath(path)
|
Object[] path = node.getUserObjectPath()
|
||||||
tree.scrollPathToVisible(path)
|
DefaultMutableTreeNode otherNode = model.treeRoot
|
||||||
|
for (int i = 1; i < path.length; i++) {
|
||||||
|
Object o = path[i]
|
||||||
|
DefaultMutableTreeNode next = null
|
||||||
|
for (int j = 0; j < otherNode.childCount; j++) {
|
||||||
|
if (otherNode.getChildAt(j).getUserObject() == o) {
|
||||||
|
next = otherNode.getChildAt(j)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (next == null)
|
||||||
|
return // probably filtered from view
|
||||||
|
otherNode = next
|
||||||
|
}
|
||||||
|
|
||||||
|
def otherPath = new TreePath(otherNode.getPath())
|
||||||
|
tree.setSelectionPath(otherPath)
|
||||||
|
tree.scrollPathToVisible(otherPath)
|
||||||
} else {
|
} else {
|
||||||
def table = builder.getVariable("shared-files-table")
|
def table = builder.getVariable("shared-files-table")
|
||||||
int row = model.shared.indexOf(sf)
|
int row = model.shared.indexOf(sf)
|
||||||
|
|
Loading…
Reference in New Issue