Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复issue#34中提到的bug #40

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/com/ms509/ui/menu/FileManagerPopMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,11 @@ public void actionPerformed(final ActionEvent e) {
final String abpath = Common.autoPath(path.getText())
+ name + Safe.SYSTEMSP;
filemanagerpanel.showRight(abpath, list);
DefaultMutableTreeNode tn = TreeMethod.searchNode(
filemanagerpanel.getRoot(), name);

//DefaultMutableTreeNode tn = TreeMethod.searchNode(
//filemanagerpanel.getRoot(), name);
DefaultMutableTreeNode tn = TreeMethod.searchNodeByAbsolutePath(
filemanagerpanel.getRoot(), abpath);
if (tn != null) {
TreePath tp = new TreePath(tn.getPath());
DefaultTreeSelectionModel dsmodel = new DefaultTreeSelectionModel();
Expand Down
2 changes: 0 additions & 2 deletions src/com/ms509/ui/panel/FileManagerPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,6 @@ public FileManagerPanel() {
Runnable run = new Runnable() {
public void run() {
arrtmp = fm.doAction("readindex");
// System.out.println(arrtmp);

if (arrtmp.indexOf("HTTP/1.") > -1 || arrtmp.indexOf("/") < 0
&& arrtmp.indexOf("\\") < 0) {
SwingUtilities.invokeLater(new Runnable() {
Expand Down
2 changes: 1 addition & 1 deletion src/com/ms509/util/FileManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ public String[] makeleft(String path) {
}
}
String[] left = al.toArray(new String[] {});
return left;
return left;
} catch (Exception e) {
return filedicts = new String[]{};
}
Expand Down
31 changes: 31 additions & 0 deletions src/com/ms509/util/TreeMethod.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,35 @@ public static DefaultMutableTreeNode searchNode(
}
return null;
}

public static DefaultMutableTreeNode searchNodeByAbsolutePath(
DefaultMutableTreeNode root, String abpath) {
DefaultMutableTreeNode node = null;
Enumeration e = root.breadthFirstEnumeration();
while (e.hasMoreElements()) {
node = (DefaultMutableTreeNode) e.nextElement();
//System.out.println(node.getUserObject());
Object[] treepath = node.getUserObjectPath();
String treepathString = "";
for(int i=0;i<treepath.length;i++)
{
if(i==0)
{
treepathString=treepath[i].toString();
}
else
{
treepathString=treepathString+treepath[i].toString()+Safe.SYSTEMSP;
}
}
if (treepathString.startsWith(abpath)) {
return node;
}
if (abpath.equalsIgnoreCase(node.getUserObject().toString())) {
return node;
}
}
return null;
}

}