Skip to content

Commit

Permalink
Fixed bug when adding when resources
Browse files Browse the repository at this point in the history
  • Loading branch information
CrazyPants committed Dec 30, 2015
1 parent 39d3afe commit 5b93cee
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ public EditorTreeNode(Object owner, IAttributeAccessor aa, Object currentValue,
this.treeModel = treeModel;
data = new NodeData(owner, aa, currentValue, this);
setUserObject(data);
if( addChildrenOfResources || !(currentValue instanceof IResource) || (currentValue instanceof LootCategories)) {
addChildren(currentValue);
}
addChildren(currentValue, addChildrenOfResources);
}

public NodeData getData() {
Expand All @@ -46,9 +44,20 @@ public void dataChanged(boolean structureChanged) {
}

public void addChildren(Object obj) {
addChildren(obj, false);
}

public void addChildren(Object obj, boolean addChildrenOfResources) {
if(obj == null) {
return;
}


if( !addChildrenOfResources && obj instanceof IResource && !(obj instanceof LootCategories)) {
return;
}


if(obj instanceof List<?>) {
addChildren((List<?>) obj, treeModel);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,14 @@ private void updateOptions() {
if(vals != null) {
options.addAll(vals);
}
}

// else { //Primitives / Basic types
// try {
// options.add(type.newInstance());
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
if(!options.isEmpty()) {
} else { //Primitives / Basic types
try {
options.add(type.newInstance());
} catch (Exception e) {
e.printStackTrace();
}
}
if(options.size() > 1) {
cb.setModel(new DefaultComboBoxModel<Object>(options.toArray(new Object[options.size()])));
}

Expand Down

0 comments on commit 5b93cee

Please sign in to comment.