if (file != null && SecurityCentre.getInstance().getUser().isAdmin() && dco.getModule().isFileBacked()) {
JMenu menuFile = ComponentFactory.getMenu(IconLibrary._icoDriveManager, DcResources.getText("lblFile"));
JMenuItem miDelete = ComponentFactory.getMenuItem(IconLibrary._icoDelete, DcResources.getText("lblDeleteFile"));
miDelete.addActionListener(this);
miDelete.setActionCommand("deleteFile");
miDelete.setEnabled(file.exists());
JMenuItem miMove = ComponentFactory.getMenuItem(DcResources.getText("lblMoveFile"));
miMove.addActionListener(this);
miMove.setActionCommand("moveFile");
miMove.setEnabled(file.exists());
JMenuItem miLocateHP = ComponentFactory.getMenuItem(IconLibrary._icoDriveScanner, DcResources.getText("lblLocateFile", DcResources.getText("lblMatchOnHashAndSize")));
miLocateHP.addActionListener(this);
miLocateHP.setActionCommand("locateFileHP");
miLocateHP.setEnabled(!file.exists() && dco.isFilled(DcObject._SYS_FILEHASH) && dco.isFilled(DcObject._SYS_FILESIZE));
JMenuItem miLocateMP = ComponentFactory.getMenuItem(IconLibrary._icoDriveScanner, DcResources.getText("lblLocateFile", DcResources.getText("lblMatchOnFilenameAndSize")));
miLocateMP.addActionListener(this);
miLocateMP.setActionCommand("locateFileMP");
miLocateMP.setEnabled(!file.exists() && dco.isFilled(DcObject._SYS_FILESIZE));
JMenuItem miLocateLP = ComponentFactory.getMenuItem(IconLibrary._icoDriveScanner, DcResources.getText("lblLocateFile", DcResources.getText("lblMatchOnFilename")));
miLocateLP.addActionListener(this);
miLocateLP.setActionCommand("locateFileLP");
miLocateLP.setEnabled(!file.exists());
menuFile.add(miDelete);
menuFile.add(miMove);
menuFile.add(miLocateHP);
menuFile.add(miLocateMP);
menuFile.add(miLocateLP);
addSeparator();
add(menuFile);
}
} else {
PluginHelper.add(this, "RemoveRow", DcModules.getCurrent().getIndex());
PluginHelper.add(this, "AddRow", DcModules.getCurrent().getIndex());
}
if (viewType == View._TYPE_SEARCH &&
module.getIndex() == DcModules._USER &&
SecurityCentre.getInstance().getUser().isAuthorized("SetPassword")) {
addSeparator();
PluginHelper.add(this, "SetPassword", "", dco, null, viewType, DcModules.getCurrent().getIndex());
}
if (!DcModules.getCurrent().isAbstract()) {
addSeparator();
PluginHelper.add(this, "ItemExporterWizard", "", dco, null, viewIdx, dco.getModule().getIndex());
}
if (viewType == View._TYPE_SEARCH && DcModules.getCurrent().hasReports()) {
PluginHelper.add(this, "Report", "", dco, null, viewIdx, DcModules.getCurrent().getIndex());
}
addSeparator();
PluginHelper.add(this, "Sort");
if ( viewType == View._TYPE_SEARCH &&
module.canBeLend() &&
SecurityCentre.getInstance().getUser().isAuthorized("Loan")) {
addSeparator();
PluginHelper.add(this, "Loan");
}
addSeparator();
JMenu menuAdmin = ComponentFactory.getMenu(IconLibrary._icoModuleTypeProperty16, DcResources.getText("lblAdministration"));
Collection<DcPropertyModule> modules = new ArrayList<DcPropertyModule>();
for (DcFieldDefinition definition : module.getFieldDefinitions().getDefinitions()) {
DcField field = module.getField(definition.getIndex());
DcPropertyModule pm = DcModules.getPropertyModule(field);
if (pm != null && !modules.contains(pm))
modules.add(pm);
}
for (DcModule pm : modules) {
try {
Plugin plugin = Plugins.getInstance().get("ManageItem", dco, null, viewIdx, pm.getIndex());
if ( plugin != null &&SecurityCentre.getInstance().getUser().isAuthorized(plugin) &&
UserMode.isCorrectXpLevel(plugin.getXpLevel())) {
JMenuItem item = ComponentFactory.getMenuItem(plugin);
item.setEnabled(plugin.isEnabled());
item.setIcon(plugin.getIcon());
menuAdmin.add(item);
}
} catch (InvalidPluginException e) {
logger.error(e, e);