/**
* Generates the archiver menu
* @return The generated menu tree model
*/
private TreeModel buildTreeModel() {
GenericTreeNode root, gtn;
GenericTreeModel gtm = new GenericTreeModel();
root = new GenericTreeNode();
root.setTitle(translate("menu.index"));
root.setUserObject(CMD_INDEX);
root.setAltText(translate("menu.index.alt"));
gtm.setRootNode(root);
if (archiverCallback.mayArchiveQtiResults()) {
gtn = new GenericTreeNode();
gtn.setTitle(translate("menu.qtiresults"));
gtn.setUserObject(CMD_QTIRESULTS);
gtn.setAltText(translate("menu.qtiresults.alt"));
root.addChild(gtn);
}
if (archiverCallback.mayArchiveProperties()) {
gtn = new GenericTreeNode();
gtn.setTitle(translate("menu.scoreaccounting"));
gtn.setUserObject(CMD_SCOREACCOUNTING);
gtn.setAltText(translate("menu.scoreaccounting.alt"));
root.addChild(gtn);
}
if (archiverCallback.mayArchiveHandedInTasks()) {
gtn = new GenericTreeNode();
gtn.setTitle(translate("menu.handedintasks"));
gtn.setUserObject(CMD_HANDEDINTASKS);
gtn.setAltText(translate("menu.handedintasks.alt"));
root.addChild(gtn);
}
if (archiverCallback.mayArchiveProjectBroker()) {
gtn = new GenericTreeNode();
gtn.setTitle(translate("menu.projectbroker"));
gtn.setUserObject(CMD_PROJECTBROKER);
gtn.setAltText(translate("menu.projectbroker.alt"));
root.addChild(gtn);
}
if (archiverCallback.mayArchiveLogfiles()) {
gtn = new GenericTreeNode();
gtn.setTitle(translate("menu.archivelogfiles"));
gtn.setUserObject(CMD_ARCHIVELOGFILES);
gtn.setAltText(translate("menu.archivelogfiles.alt"));
root.addChild(gtn);
}
if (archiverCallback.mayArchiveForums()) {
gtn = new GenericTreeNode();
gtn.setTitle(translate("menu.forums"));
gtn.setUserObject(CMD_FORUMS);
gtn.setAltText(translate("menu.forums.alt"));
root.addChild(gtn);
}
if (archiverCallback.mayArchiveDialogs()) {
gtn = new GenericTreeNode();
gtn.setTitle(translate("menu.dialogs"));
gtn.setUserObject(CMD_DIALOGS);
gtn.setAltText(translate("menu.dialogs.alt"));
root.addChild(gtn);
}
if (archiverCallback.mayArchiveWikis()) {
gtn = new GenericTreeNode();
gtn.setTitle(translate("menu.wikis"));
gtn.setUserObject(CMD_WIKIS);
gtn.setAltText(translate("menu.wikis.alt"));
root.addChild(gtn);
}
//add extension menues
ExtManager extm = ExtManager.getInstance();
Class extensionPointMenu = this.getClass();
int cnt = extm.getExtensionCnt();
for (int i = 0; i < cnt; i++) {
Extension anExt = extm.getExtension(i);
// check for sites
ActionExtension ae = (ActionExtension) anExt.getExtensionFor(extensionPointMenu.getName());
if (ae != null) {
gtn = new GenericTreeNode();
String menuText = ae.getActionText(locale);
gtn.setTitle(menuText);
gtn.setUserObject(ae);
gtn.setAltText(ae.getDescription(locale));
root.addChild(gtn);
// inform only once
if (!extensionLogged) {
extensionLogged = true;
extm.inform(extensionPointMenu, anExt, "added menu entry (for locale " + locale.toString() + " '" + menuText + "'");
}