return false;
}
private boolean storeNewDocument() {
AdminNode[] nodes = null;
HasStorage store = null;
AdminNode refresh = null;
TreePath path = browser.getSelectionPath();
Object[] components = null;
if ( path != null ) {
components = path.getPath();
java.util.List list = new ArrayList();
for ( int i = 0; i < components.length; i++ ) {
DefaultMutableTreeNode n = (DefaultMutableTreeNode)components[i];
list.add(n.getUserObject());
}
nodes = (AdminNode[])list.toArray(EmptyAdminNodes);
for ( int i = nodes.length-1; store == null && i >= 0; i-- ) {
if ( nodes[i] instanceof HasStorage ) {
store = (HasStorage)nodes[i];
refresh = store.getRefreshTarget();
}
}
}
if ( store == null ) {
StringBuffer sb = new StringBuffer();
sb.append("There is currently no container selected.\n");
sb.append("Please select a container to save the Document.");
JOptionPane.showMessageDialog(this, sb.toString(), "Save Document", JOptionPane.OK_OPTION);
return false;
}
StringBuffer sb = new StringBuffer();
sb.append("Please type a name for your new Document.");
String name = JOptionPane.showInputDialog(this, sb.toString(), "New Document", JOptionPane.OK_CANCEL_OPTION);
if ( name != null && name.length() > 0 )
doc.setName(name);
else
return false;
Stopwatch sw = new Stopwatch("Document Storage", true);
TabbedNodeEditor ne = (TabbedNodeEditor)paneEdit.getSelectedComponent();
if ( ne.deactivate() ) {
store.storeDocWrapper(doc);
ne.activate(readOnly);
nodeEditor = ne;
}
sw.stop();
statusBar.setText(sw.toString());