/**
  * Gets the selected node in the tags tree and applies all attributes fro the attributes list to
  * it. Do nothing if no node is selected.
  */
 public void apply() {
   JTree tree = (JTree) document.getTagById("tagsTree").getComponent();
   if (tree.getSelectionPath() != null) {
     DefaultMutableTreeNode node =
         (DefaultMutableTreeNode) tree.getSelectionPath().getLastPathComponent();
     Tag tag = (Tag) node.getUserObject();
     for (Attribute attr : attributes) {
       tag.setAttribute(attr.getName(), attr.getValue());
     }
     tag.applyAttributes(tag.getComponent());
   }
 }