19 package org.sleuthkit.autopsy.centralrepository;
21 import java.awt.event.ActionEvent;
22 import java.util.logging.Level;
23 import javax.swing.AbstractAction;
24 import javax.swing.Action;
25 import org.apache.commons.lang.StringUtils;
26 import org.openide.DialogDisplayer;
27 import org.openide.NotifyDescriptor;
28 import org.openide.util.NbBundle.Messages;
42 @Messages({
"AddEditCentralRepoCommentAction.menuItemText.addEditCentralRepoCommentEmptyFile=Add/Edit Central Repository Comment (Empty File)",
43 "AddEditCentralRepoCommentAction.menuItemText.addEditCentralRepoCommentNoMD5=Add/Edit Central Repository Comment (No MD5 Hash)",
44 "AddEditCentralRepoCommentAction.menuItemText.addEditCentralRepoComment=Add/Edit Central Repository Comment"})
48 private static final long serialVersionUID = 1L;
63 fileId = file.getId();
65 if (correlationAttributeInstance == null) {
69 if (file.getSize() == 0) {
70 putValue(Action.NAME, Bundle.AddEditCentralRepoCommentAction_menuItemText_addEditCentralRepoCommentEmptyFile());
71 }
else if (StringUtils.isBlank(file.getMd5Hash())) {
72 putValue(Action.NAME, Bundle.AddEditCentralRepoCommentAction_menuItemText_addEditCentralRepoCommentNoMD5());
74 putValue(Action.NAME, Bundle.AddEditCentralRepoCommentAction_menuItemText_addEditCentralRepoComment());
91 CentralRepoCommentDialog centralRepoCommentDialog =
new CentralRepoCommentDialog(correlationAttributeInstance);
92 centralRepoCommentDialog.display();
96 if (centralRepoCommentDialog.isCommentUpdated()) {
108 comment = centralRepoCommentDialog.getComment();
112 logger.log(Level.WARNING,
"Case not open after changing central repository comment", ex);
115 logger.log(Level.SEVERE,
"Error adding comment", ex);
116 NotifyDescriptor notifyDescriptor =
new NotifyDescriptor.Message(
117 "An error occurred while trying to save the comment to the central repository.",
118 NotifyDescriptor.ERROR_MESSAGE);
119 DialogDisplayer.getDefault().notify(notifyDescriptor);
141 return correlationAttributeInstance;
static CorrelationAttributeInstance makeCorrAttrFromFile(AbstractFile file)
void notifyCentralRepoCommentChanged(long contentId, String newComment)
void updateAttributeInstanceComment(CorrelationAttributeInstance eamArtifact)
void addArtifactInstance(CorrelationAttributeInstance eamArtifact)
static CorrelationAttributeInstance getCorrAttrForFile(AbstractFile file)
synchronized static Logger getLogger(String name)
static Case getCurrentCaseThrows()
static CentralRepository getInstance()