mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 02:07:42 +00:00
Merge pull request #71 from Devin148/master
Save keyword list syncs tables.
This commit is contained in:
commit
a084882733
@ -26,6 +26,8 @@ package org.sleuthkit.autopsy.keywordsearch;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
import javax.swing.JOptionPane;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.corecomponents.OptionsPanel;
|
||||
import org.sleuthkit.autopsy.ingest.IngestManager;
|
||||
@ -70,7 +72,59 @@ public class KeywordSearchConfigurationPanel1 extends javax.swing.JPanel impleme
|
||||
listsManagementPanel.resync();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
editListPanel.addSaveButtonActionPerformed(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
final String FEATURE_NAME = "Save Keyword List";
|
||||
KeywordSearchListsXML writer = KeywordSearchListsXML.getCurrent();
|
||||
KeywordSearchList currentKeywordList = editListPanel.getCurrentKeywordList();
|
||||
|
||||
List<Keyword> keywords = currentKeywordList.getKeywords();
|
||||
if (keywords.isEmpty()) {
|
||||
KeywordSearchUtil.displayDialog(FEATURE_NAME, "Keyword List is empty and cannot be saved", KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
|
||||
return;
|
||||
}
|
||||
|
||||
String listName = (String) JOptionPane.showInputDialog(
|
||||
null,
|
||||
"New keyword list name:",
|
||||
FEATURE_NAME,
|
||||
JOptionPane.PLAIN_MESSAGE,
|
||||
null,
|
||||
null,
|
||||
currentKeywordList != null ? currentKeywordList : "");
|
||||
if (listName == null || listName.trim().equals("")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (writer.listExists(listName) && writer.getList(listName).isLocked()) {
|
||||
KeywordSearchUtil.displayDialog(FEATURE_NAME, "Cannot overwrite default list", KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
|
||||
return;
|
||||
}
|
||||
boolean shouldAdd = false;
|
||||
if (writer.listExists(listName)) {
|
||||
boolean replace = KeywordSearchUtil.displayConfirmDialog(FEATURE_NAME, "Keyword List <" + listName + "> already exists, do you want to replace it?",
|
||||
KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
|
||||
if (replace) {
|
||||
shouldAdd = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
shouldAdd = true;
|
||||
}
|
||||
|
||||
if (shouldAdd) {
|
||||
writer.addList(listName, keywords);
|
||||
}
|
||||
|
||||
currentKeywordList = writer.getList(listName);
|
||||
KeywordSearchUtil.displayDialog(FEATURE_NAME, "Keyword List <" + listName + "> saved", KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
|
||||
listsManagementPanel.resync();
|
||||
}
|
||||
});
|
||||
|
||||
mainSplitPane.setLeftComponent(listsManagementPanel);
|
||||
mainSplitPane.setRightComponent(editListPanel);
|
||||
|
@ -355,9 +355,6 @@
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/keywordsearch/Bundle.properties" key="KeywordSearchEditListPanel.saveListButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="saveListButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="exportButton">
|
||||
<Properties>
|
||||
|
@ -421,11 +421,6 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
|
||||
saveListButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/save16.png"))); // NOI18N
|
||||
saveListButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.saveListButton.text")); // NOI18N
|
||||
saveListButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
saveListButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
exportButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/keywordsearch/export16.png"))); // NOI18N
|
||||
exportButton.setText(org.openide.util.NbBundle.getMessage(KeywordSearchEditListPanel.class, "KeywordSearchEditListPanel.exportButton.text")); // NOI18N
|
||||
@ -560,53 +555,6 @@ class KeywordSearchEditListPanel extends javax.swing.JPanel implements ListSelec
|
||||
initButtons();
|
||||
}//GEN-LAST:event_addWordButtonActionPerformed
|
||||
|
||||
private void saveListButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveListButtonActionPerformed
|
||||
final String FEATURE_NAME = "Save Keyword List";
|
||||
KeywordSearchListsXML writer = KeywordSearchListsXML.getCurrent();
|
||||
|
||||
List<Keyword> keywords = currentKeywordList.getKeywords();
|
||||
if (keywords.isEmpty()) {
|
||||
KeywordSearchUtil.displayDialog(FEATURE_NAME, "Keyword List is empty and cannot be saved", KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
|
||||
return;
|
||||
}
|
||||
|
||||
String listName = (String) JOptionPane.showInputDialog(
|
||||
null,
|
||||
"New keyword list name:",
|
||||
FEATURE_NAME,
|
||||
JOptionPane.PLAIN_MESSAGE,
|
||||
null,
|
||||
null,
|
||||
currentKeywordList != null ? currentKeywordList : "");
|
||||
if (listName == null || listName.trim().equals("")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (writer.listExists(listName) && writer.getList(listName).isLocked()) {
|
||||
KeywordSearchUtil.displayDialog(FEATURE_NAME, "Cannot overwrite default list", KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
|
||||
return;
|
||||
}
|
||||
boolean shouldAdd = false;
|
||||
if (writer.listExists(listName)) {
|
||||
boolean replace = KeywordSearchUtil.displayConfirmDialog(FEATURE_NAME, "Keyword List <" + listName + "> already exists, do you want to replace it?",
|
||||
KeywordSearchUtil.DIALOG_MESSAGE_TYPE.WARN);
|
||||
if (replace) {
|
||||
shouldAdd = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
shouldAdd = true;
|
||||
}
|
||||
|
||||
if (shouldAdd) {
|
||||
writer.addList(listName, keywords);
|
||||
}
|
||||
|
||||
currentKeywordList = writer.getList(listName);
|
||||
KeywordSearchUtil.displayDialog(FEATURE_NAME, "Keyword List <" + listName + "> saved", KeywordSearchUtil.DIALOG_MESSAGE_TYPE.INFO);
|
||||
|
||||
}//GEN-LAST:event_saveListButtonActionPerformed
|
||||
|
||||
private void deleteWordButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteWordButtonActionPerformed
|
||||
if (KeywordSearchUtil.displayConfirmDialog("Removing a keyword"
|
||||
, "This will remove a keyword from the list globally (for all Cases). "
|
||||
@ -756,6 +704,10 @@ private void useForIngestCheckboxActionPerformed(java.awt.event.ActionEvent evt)
|
||||
void addDeleteButtonActionPerformed(ActionListener l) {
|
||||
deleteListButton.addActionListener(l);
|
||||
}
|
||||
|
||||
void addSaveButtonActionPerformed(ActionListener l) {
|
||||
saveListButton.addActionListener(l);
|
||||
}
|
||||
|
||||
|
||||
private class KeywordTableModel extends AbstractTableModel {
|
||||
|
@ -725,7 +725,7 @@ def fill_case_data():
|
||||
case.heap_space = search_logs("Heap memory usage:")[0].rstrip().split(": ")[1]
|
||||
|
||||
ingest_line = search_logs("Ingest (including enqueue)")[0]
|
||||
case.total_ingest_time = get_word_at(ingest_line, 5).rstrip()
|
||||
case.total_ingest_time = get_word_at(ingest_line, 6).rstrip()
|
||||
|
||||
message_line = search_log_set("autopsy", "Ingest messages count:")[0]
|
||||
case.ingest_messages = int(message_line.rstrip().split(": ")[2])
|
||||
|
Loading…
x
Reference in New Issue
Block a user