}
public void paste() {
Element theSelectedElement = (Element) getSelectedObject();
BrowserTreeNode theSelectedNode = getSelectedNode();
if ( theSelectedElement == null ) {
displayError( "You must have node selected when pasting.", "Paste Error" );
return;
}
if ( copyBuffer.isEmpty() ) {
displayError( "You must copy or cut something before pasting.", "Paste Error" );
return;
}
if ( theSelectedElement.getName().equals( "project" ) ) {
theSelectedElement = theSelectedElement.getDocument().getRootElement();
theSelectedNode = (BrowserTreeNode) getTreeModel().getRoot();
}
BrowserTreeNode theCutNode = (BrowserTreeNode) copyBuffer.iterator().next();
Element theCutElement = (Element) theCutNode.getUserObject();
Element theNewElement = (Element) theCutElement.clone();
theSelectedElement.addContent( theNewElement );
BrowserTreeNode theNewNode = createNodeFor( theNewElement );
addChildrenToTree( theNewElement, theNewNode );
insertNode( theNewNode, theSelectedNode );
getTreeModel().nodeChanged( theSelectedNode );