Merge pull request #4155 from dannysmyda/4257-hashset-functionality-during-ingest

4257 hashset functionality during ingest
This commit is contained in:
Richard Cordovano 2018-09-28 10:54:50 -04:00 committed by GitHub
commit f53a95b932
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 7 deletions

View File

@ -42,12 +42,16 @@ import org.sleuthkit.datamodel.TskCoreException;
* Instances of this Action allow users to content to a hash database. * Instances of this Action allow users to content to a hash database.
*/ */
final class AddContentToHashDbAction extends AbstractAction implements Presenter.Popup { final class AddContentToHashDbAction extends AbstractAction implements Presenter.Popup {
private static AddContentToHashDbAction instance; private static AddContentToHashDbAction instance;
private final static String SINGLE_SELECTION_NAME = NbBundle.getMessage(AddContentToHashDbAction.class, private final static String SINGLE_SELECTION_NAME = NbBundle.getMessage(AddContentToHashDbAction.class,
"AddContentToHashDbAction.singleSelectionName"); "AddContentToHashDbAction.singleSelectionName");
private final static String MULTIPLE_SELECTION_NAME = NbBundle.getMessage(AddContentToHashDbAction.class, private final static String MULTIPLE_SELECTION_NAME = NbBundle.getMessage(AddContentToHashDbAction.class,
"AddContentToHashDbAction.multipleSelectionName"); "AddContentToHashDbAction.multipleSelectionName");
private final static String SINGLE_SELECTION_NAME_DURING_INGEST = NbBundle.getMessage(AddContentToHashDbAction.class,
"AddContentToHashDbAction.singleSelectionNameDuringIngest");
private final static String MULTIPLE_SELECTION_NAME_DURING_INGEST = NbBundle.getMessage(AddContentToHashDbAction.class,
"AddContentToHashDbAction.multipleSelectionNameDuringIngest");
/** /**
* AddContentToHashDbAction is a singleton to support multi-selection of * AddContentToHashDbAction is a singleton to support multi-selection of
@ -80,15 +84,21 @@ final class AddContentToHashDbAction extends AbstractAction implements Presenter
AddContentToHashDbMenu() { AddContentToHashDbMenu() {
super(SINGLE_SELECTION_NAME); super(SINGLE_SELECTION_NAME);
// Get any AbstractFile objects from the lookup of the currently focused top component.
final Collection<? extends AbstractFile> selectedFiles = Utilities.actionsGlobalContext().lookupAll(AbstractFile.class);
// Disable the menu if file ingest is in progress. // Disable the menu if file ingest is in progress.
if (IngestManager.getInstance().isIngestRunning()) { if (IngestManager.getInstance().isIngestRunning()) {
setEnabled(false); if(selectedFiles.size() > 1) {
//Displays: 'Add Files to Hash Set (Ingest is running)'
setText(MULTIPLE_SELECTION_NAME_DURING_INGEST);
} else {
setText(SINGLE_SELECTION_NAME_DURING_INGEST);
}
setEnabled(false);
return; return;
} }
// Get any AbstractFile objects from the lookup of the currently focused top component.
final Collection<? extends AbstractFile> selectedFiles = Utilities.actionsGlobalContext().lookupAll(AbstractFile.class);
if (selectedFiles.isEmpty()) { if (selectedFiles.isEmpty()) {
setEnabled(false); setEnabled(false);
return; return;

View File

@ -151,8 +151,10 @@ HashDbManager.fileNameExtensionFilter.title=Hash Set File
HashDbSearchAction.dlgMsg.title=File Search by MD5 Hash HashDbSearchAction.dlgMsg.title=File Search by MD5 Hash
HashDbSearchAction.getName.text=Hash Search HashDbSearchAction.getName.text=Hash Search
HashDbSearchPanel.dlgMsg.title=File Search by MD5 Hash HashDbSearchPanel.dlgMsg.title=File Search by MD5 Hash
AddContentToHashDbAction.singleSelectionName=Add file to hash set AddContentToHashDbAction.singleSelectionName=Add File to Hash Set
AddContentToHashDbAction.multipleSelectionName=Add files to hash set AddContentToHashDbAction.multipleSelectionName=Add Files to Hash Set
AddContentToHashDbAction.singleSelectionNameDuringIngest=Add File to Hash Set (Ingest is running)
AddContentToHashDbAction.multipleSelectionNameDuringIngest=Add Files to Hash Set (Ingest is running)
HashDbManager.ingestRunningExceptionMsg=Ingest is ongoing; this service will be unavailable until it finishes. HashDbManager.ingestRunningExceptionMsg=Ingest is ongoing; this service will be unavailable until it finishes.
HashDbManager.saveErrorExceptionMsg=Error saving hash configuration HashDbManager.saveErrorExceptionMsg=Error saving hash configuration
HashLookupSettingsPanel.jButton3.text=Import Hash Set HashLookupSettingsPanel.jButton3.text=Import Hash Set

View File

@ -55,6 +55,11 @@ class SwingMenuAdapter extends Menu {
SwingMenuAdapter(final JMenu jMenu) { SwingMenuAdapter(final JMenu jMenu) {
super(jMenu.getText()); super(jMenu.getText());
this.jMenu = jMenu; this.jMenu = jMenu;
if(!jMenu.isEnabled()) {
//Grey out text if the JMenu that this Menu is wrapping is
//not enabled.
setDisable(true);
}
buildChildren(jMenu); buildChildren(jMenu);
} }