analyze panel bug fixes

This commit is contained in:
Reinhard Pointner 2007-12-25 15:30:50 +00:00
parent 3f2d16d03d
commit 490101af81
4 changed files with 24 additions and 25 deletions

View File

@ -88,15 +88,16 @@ public class FileBotTree extends JTree implements TransferablePolicySupport {
} }
private void walk(TreeModel model, Object o, LinkedList<File> list) { private void walk(TreeModel model, Object node, LinkedList<File> list) {
int cc = model.getChildCount(o); for (int i = 0; i < model.getChildCount(node); i++) {
DefaultMutableTreeNode child = (DefaultMutableTreeNode) model.getChild(node, i);
for (int i = 0; i < cc; i++) { if (model.isLeaf(child)) {
DefaultMutableTreeNode child = (DefaultMutableTreeNode) model.getChild(o, i); File file = (File) child.getUserObject();
if (model.isLeaf(child)) if (file.isFile())
list.add((File) child.getUserObject()); list.add(file);
else } else {
walk(model, child, list); walk(model, child, list);
}
} }
} }

View File

@ -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(); String name = f.getName();
int dotIndex = name.lastIndexOf("."); int dotIndex = name.lastIndexOf(".");
if (dotIndex > 1) { // .config -> no suffix
String suffix = name.substring(dotIndex + 1, name.length()); if (dotIndex >= 1) {
if (dot) int startIndex = dotIndex;
return "." + suffix;
else if (!includeDot)
return suffix; startIndex += 1;
} else
return ""; if (startIndex <= name.length()) {
return name.substring(dotIndex + 1, name.length());
}
}
return "";
} }

View File

@ -2,7 +2,6 @@
package net.sourceforge.filebot.ui.panel.analyze; package net.sourceforge.filebot.ui.panel.analyze;
import java.awt.datatransfer.Transferable;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import java.io.File; 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 @Override
protected void clear() { protected void clear() {
FileTree.this.clear(); FileTree.this.clear();

View File

@ -38,7 +38,7 @@ public class TypePanel extends ToolPanel {
setLoadingOverlayPane(loadingOverlay); setLoadingOverlayPane(loadingOverlay);
} }
UpdateTask latestUpdateTask; private UpdateTask latestUpdateTask;
@Override @Override