From 3228500d632b8dba23c294ff38fcd9a1e4780d99 Mon Sep 17 00:00:00 2001 From: YourDaddyIsHere Date: Wed, 7 Feb 2018 21:15:28 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E6=A0=91=E5=90=8C=E5=90=8D=E6=96=87=E4=BB=B6=E5=A4=B9=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/ms509/ui/menu/FileManagerPopMenu.java | 7 ++-- src/com/ms509/ui/panel/FileManagerPanel.java | 2 ++ src/com/ms509/util/Common.java | 2 ++ src/com/ms509/util/FileManager.java | 1 + src/com/ms509/util/TreeMethod.java | 33 +++++++++++++++++++ 5 files changed, 43 insertions(+), 2 deletions(-) diff --git a/src/com/ms509/ui/menu/FileManagerPopMenu.java b/src/com/ms509/ui/menu/FileManagerPopMenu.java index 44ec5b5..6e53a5f 100644 --- a/src/com/ms509/ui/menu/FileManagerPopMenu.java +++ b/src/com/ms509/ui/menu/FileManagerPopMenu.java @@ -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(); diff --git a/src/com/ms509/ui/panel/FileManagerPanel.java b/src/com/ms509/ui/panel/FileManagerPanel.java index 6e10fec..5f92e82 100644 --- a/src/com/ms509/ui/panel/FileManagerPanel.java +++ b/src/com/ms509/ui/panel/FileManagerPanel.java @@ -207,6 +207,8 @@ public FileManagerPanel() { Runnable run = new Runnable() { public void run() { arrtmp = fm.doAction("readindex"); + //System.out.println("arrtmp is:"); + //System.out.println(arrtmp); // System.out.println(arrtmp); if (arrtmp.indexOf("HTTP/1.") > -1 || arrtmp.indexOf("/") < 0 diff --git a/src/com/ms509/util/Common.java b/src/com/ms509/util/Common.java index ecaec95..337d00c 100644 --- a/src/com/ms509/util/Common.java +++ b/src/com/ms509/util/Common.java @@ -22,6 +22,8 @@ public class Common { public static String purData(String data) { String datas = data; + //System.out.println("datas is:"); + //System.out.println(datas); String regex = Common.purRegex(Safe.SPL) + "(.*)" + Common.purRegex(Safe.SPR); Matcher m = Pattern.compile(regex, Pattern.DOTALL).matcher(data); diff --git a/src/com/ms509/util/FileManager.java b/src/com/ms509/util/FileManager.java index f904425..2e2c25b 100644 --- a/src/com/ms509/util/FileManager.java +++ b/src/com/ms509/util/FileManager.java @@ -430,6 +430,7 @@ public String[] makeleft(String path) { } String[] left = al.toArray(new String[] {}); return left; + } catch (Exception e) { return filedicts = new String[]{}; } diff --git a/src/com/ms509/util/TreeMethod.java b/src/com/ms509/util/TreeMethod.java index e1fdbb8..c570e39 100644 --- a/src/com/ms509/util/TreeMethod.java +++ b/src/com/ms509/util/TreeMethod.java @@ -94,10 +94,43 @@ public static DefaultMutableTreeNode searchNode( Enumeration e = root.breadthFirstEnumeration(); while (e.hasMoreElements()) { node = (DefaultMutableTreeNode) e.nextElement(); + System.out.println("the current visiting node is:"); + //System.out.println(node.getUserObject()); if (name.equalsIgnoreCase(node.getUserObject().toString())) { return node; } } 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 Date: Wed, 7 Feb 2018 21:33:13 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=88=A0=E9=99=A4comments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/ms509/ui/panel/FileManagerPanel.java | 4 ---- src/com/ms509/util/Common.java | 2 -- src/com/ms509/util/FileManager.java | 3 +-- src/com/ms509/util/TreeMethod.java | 2 -- 4 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/com/ms509/ui/panel/FileManagerPanel.java b/src/com/ms509/ui/panel/FileManagerPanel.java index 5f92e82..08d8f76 100644 --- a/src/com/ms509/ui/panel/FileManagerPanel.java +++ b/src/com/ms509/ui/panel/FileManagerPanel.java @@ -207,10 +207,6 @@ public FileManagerPanel() { Runnable run = new Runnable() { public void run() { arrtmp = fm.doAction("readindex"); - //System.out.println("arrtmp is:"); - //System.out.println(arrtmp); - // System.out.println(arrtmp); - if (arrtmp.indexOf("HTTP/1.") > -1 || arrtmp.indexOf("/") < 0 && arrtmp.indexOf("\\") < 0) { SwingUtilities.invokeLater(new Runnable() { diff --git a/src/com/ms509/util/Common.java b/src/com/ms509/util/Common.java index 337d00c..ecaec95 100644 --- a/src/com/ms509/util/Common.java +++ b/src/com/ms509/util/Common.java @@ -22,8 +22,6 @@ public class Common { public static String purData(String data) { String datas = data; - //System.out.println("datas is:"); - //System.out.println(datas); String regex = Common.purRegex(Safe.SPL) + "(.*)" + Common.purRegex(Safe.SPR); Matcher m = Pattern.compile(regex, Pattern.DOTALL).matcher(data); diff --git a/src/com/ms509/util/FileManager.java b/src/com/ms509/util/FileManager.java index 2e2c25b..b3f2b71 100644 --- a/src/com/ms509/util/FileManager.java +++ b/src/com/ms509/util/FileManager.java @@ -429,8 +429,7 @@ public String[] makeleft(String path) { } } String[] left = al.toArray(new String[] {}); - return left; - + return left; } catch (Exception e) { return filedicts = new String[]{}; } diff --git a/src/com/ms509/util/TreeMethod.java b/src/com/ms509/util/TreeMethod.java index c570e39..c6a7d4b 100644 --- a/src/com/ms509/util/TreeMethod.java +++ b/src/com/ms509/util/TreeMethod.java @@ -94,8 +94,6 @@ public static DefaultMutableTreeNode searchNode( Enumeration e = root.breadthFirstEnumeration(); while (e.hasMoreElements()) { node = (DefaultMutableTreeNode) e.nextElement(); - System.out.println("the current visiting node is:"); - //System.out.println(node.getUserObject()); if (name.equalsIgnoreCase(node.getUserObject().toString())) { return node; }