public MenuItem[] getMenu() {
return Menu;
}
public int menuAction(int action) {
Admin admin = Admin.getInstance();
switch ( action ) {
case ACTION_DELETE:
try {
String title = "Delete File";
String message = "Are you sure you want to delete the\n"
+ "File '"+file.getName()+"'?";
int res = JOptionPane.showConfirmDialog(Admin.getInstance(), message, title, JOptionPane.YES_NO_OPTION);
if ( res == JOptionPane.YES_OPTION ) {
file.delete();
return REMOVE_SELF;
}
}
catch ( Exception e ) {
Admin.getInstance().addMessage(e.getMessage());
}
break;
case ACTION_EDIT:
admin.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
Stopwatch sw = new Stopwatch("Document Retrieval", true);
DocWrapper dw = getDocWrapper();
sw.stop();
admin.setStatus(sw.toString());
admin.editDocument(dw);
admin.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
break;
case ACTION_XSLT:
String name = file.getAbsolutePath();
admin.xsltViewer.setStylesheet(name, getDocWrapper());