From 490101af816e0b8371244f44583e11513a5594c5 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Tue, 25 Dec 2007 15:30:50 +0000 Subject: [PATCH] analyze panel bug fixes --- .../sourceforge/filebot/ui/FileBotTree.java | 17 +++++++------- .../sourceforge/filebot/ui/FileFormat.java | 23 +++++++++++-------- .../filebot/ui/panel/analyze/FileTree.java | 7 ------ .../ui/panel/analyze/tools/TypePanel.java | 2 +- 4 files changed, 24 insertions(+), 25 deletions(-) diff --git a/source/net/sourceforge/filebot/ui/FileBotTree.java b/source/net/sourceforge/filebot/ui/FileBotTree.java index fcd53cd6..20370587 100644 --- a/source/net/sourceforge/filebot/ui/FileBotTree.java +++ b/source/net/sourceforge/filebot/ui/FileBotTree.java @@ -88,15 +88,16 @@ public class FileBotTree extends JTree implements TransferablePolicySupport { } - private void walk(TreeModel model, Object o, LinkedList list) { - int cc = model.getChildCount(o); - - for (int i = 0; i < cc; i++) { - DefaultMutableTreeNode child = (DefaultMutableTreeNode) model.getChild(o, i); - if (model.isLeaf(child)) - list.add((File) child.getUserObject()); - else + private void walk(TreeModel model, Object node, LinkedList list) { + for (int i = 0; i < model.getChildCount(node); i++) { + DefaultMutableTreeNode child = (DefaultMutableTreeNode) model.getChild(node, i); + if (model.isLeaf(child)) { + File file = (File) child.getUserObject(); + if (file.isFile()) + list.add(file); + } else { walk(model, child, list); + } } } diff --git a/source/net/sourceforge/filebot/ui/FileFormat.java b/source/net/sourceforge/filebot/ui/FileFormat.java index d08eaab1..e52aac3e 100644 --- a/source/net/sourceforge/filebot/ui/FileFormat.java +++ b/source/net/sourceforge/filebot/ui/FileFormat.java @@ -54,18 +54,23 @@ public class FileFormat { } - public static String getSuffix(File f, boolean dot) { + public static String getSuffix(File f, boolean includeDot) { String name = f.getName(); int dotIndex = name.lastIndexOf("."); - if (dotIndex > 1) { - String suffix = name.substring(dotIndex + 1, name.length()); - if (dot) - return "." + suffix; - else - return suffix; - } else - return ""; + // .config -> no suffix + if (dotIndex >= 1) { + int startIndex = dotIndex; + + if (!includeDot) + startIndex += 1; + + if (startIndex <= name.length()) { + return name.substring(dotIndex + 1, name.length()); + } + } + + return ""; } diff --git a/source/net/sourceforge/filebot/ui/panel/analyze/FileTree.java b/source/net/sourceforge/filebot/ui/panel/analyze/FileTree.java index 5652c99d..054a8525 100644 --- a/source/net/sourceforge/filebot/ui/panel/analyze/FileTree.java +++ b/source/net/sourceforge/filebot/ui/panel/analyze/FileTree.java @@ -2,7 +2,6 @@ package net.sourceforge.filebot.ui.panel.analyze; -import java.awt.datatransfer.Transferable; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.File; @@ -92,12 +91,6 @@ public class FileTree extends FileBotTree { } - @Override - public boolean handleTransferable(Transferable tr, boolean add) { - return super.handleTransferable(tr, true); - } - - @Override protected void clear() { FileTree.this.clear(); diff --git a/source/net/sourceforge/filebot/ui/panel/analyze/tools/TypePanel.java b/source/net/sourceforge/filebot/ui/panel/analyze/tools/TypePanel.java index 65bd1534..76ea4e6e 100644 --- a/source/net/sourceforge/filebot/ui/panel/analyze/tools/TypePanel.java +++ b/source/net/sourceforge/filebot/ui/panel/analyze/tools/TypePanel.java @@ -38,7 +38,7 @@ public class TypePanel extends ToolPanel { setLoadingOverlayPane(loadingOverlay); } - UpdateTask latestUpdateTask; + private UpdateTask latestUpdateTask; @Override