return "MoveCategories";
}
public void run() throws IOException {
for (int i = 0; i < categories.size(); i++) {
CategoryTreeNode category = categories.get(i);
CategoryTreeNode parent = parents.get(i);
if (category.isLocal() && parent.isRemote())
throw new IOException("cannot move local category " + category.getName() + " to remote parent " + parent.getName());
if (category.isRemote() && parent.isLocal())
throw new IOException("cannot move remote category " + category.getName() + " to local parent " + parent.getName());
category.getCategory().update(parent.getCategory(), category.getCategory().getName());
}
invokeLater(new Runnable() {
public void run() {
for (int i = 0; i < categories.size(); i++) {
CategoryTreeNode category = categories.get(i);
CategoryTreeNode parent = parents.get(i);
categoryTreeModel.removeNodeFromParent(category);
categoryTreeModel.insertNodeInto(category, parent, 0);
}
if (invokeLaterRunnable != null)
invokeLaterRunnable.run();