isLeaf fixed (root was sometimes not a leaf, if classpath was empty)

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@962 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 31043993ef
commit 4cc97ada87
  1. 13
      jode/jode/swingui/PackagesTreeModel.java

@ -41,10 +41,10 @@ public class PackagesTreeModel implements TreeModel {
String name; String name;
boolean leaf; boolean leaf;
public TreeElement(String prefix, String name) { public TreeElement(String prefix, String name, boolean isLeaf) {
this.fullName = prefix+name; this.fullName = prefix+name;
this.name = name; this.name = name;
this.leaf = !ClassInfo.isPackage(fullName); this.leaf = isLeaf;
} }
public String getFullName() { public String getFullName() {
@ -81,7 +81,7 @@ public class PackagesTreeModel implements TreeModel {
} }
} }
TreeElement root = new TreeElement("",""); TreeElement root = new TreeElement("", "", false);
Vector listeners = new Vector(); Vector listeners = new Vector();
public void rebuild() { public void rebuild() {
@ -107,10 +107,13 @@ public class PackagesTreeModel implements TreeModel {
while (enum.hasMoreElements()) { while (enum.hasMoreElements()) {
//insert sorted and remove double elements; //insert sorted and remove double elements;
String name = (String)enum.nextElement(); String name = (String)enum.nextElement();
if (Decompiler.skipClass(ClassInfo.forName(prefix+name))) String fqn = prefix+name;
boolean isClass = !ClassInfo.isPackage(fqn);
if (isClass && Decompiler.skipClass(ClassInfo.forName(fqn)))
continue; continue;
TreeElement newElem = new TreeElement(prefix, name); TreeElement newElem = new TreeElement(prefix, name, isClass);
for (int i=0; ; i++) { for (int i=0; ; i++) {
if (i == v.size()) { if (i == v.size()) {
v.addElement(newElem); v.addElement(newElem);

Loading…
Cancel
Save