}
addCustomNode(pluginRoot);
}
private void insertSorted(PluginTreeNode pluginRoot) {
MutableTreeNode rootNode = (MutableTreeNode) this.getRoot();
ArrayList<String> pluginNames = new ArrayList<String>();
for (int i = 0; i < rootNode.getChildCount(); i++) {
pluginNames.add(rootNode.getChildAt(i).toString());
}
Collections.sort(pluginNames);
int index = pluginNames.indexOf(pluginRoot.getUserObject().toString());
if(index == -1) {
index = Collections.binarySearch(pluginNames, pluginRoot.getUserObject().toString());
}
else {
index = -index-1;
}
rootNode.insert(pluginRoot.getMutableTreeNode(), -index-1);
if(pluginRoot.getMutableTreeNode().getIcon() == null) {
if(pluginRoot.getUserObject() instanceof Plugin) {
pluginRoot.getMutableTreeNode().setIcon(PluginProxyManager.getInstance().getActivatedPluginForId(((Plugin)pluginRoot.getUserObject()).getId()).getPluginIcon());
}