mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-19 11:07:43 +00:00
Current open case not displayed in Open Recent Cases
This commit is contained in:
parent
9a989506e7
commit
c53636c8ef
@ -18,9 +18,6 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.casemodule;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Event;
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.io.File;
|
||||
|
@ -30,6 +30,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import javax.swing.JMenuItem;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.openide.util.HelpCtx;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.actions.CallableSystemAction;
|
||||
@ -45,7 +46,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
*/
|
||||
final class RecentCases extends CallableSystemAction implements Presenter.Menu {
|
||||
|
||||
static final int LENGTH = 5;
|
||||
static final int LENGTH = 6;
|
||||
static final String NAME_PROP_KEY = "LBL_RecentCase_Name"; //NON-NLS
|
||||
static final String PATH_PROP_KEY = "LBL_RecentCase_Path"; //NON-NLS
|
||||
static final RecentCase BLANK_RECENTCASE = new RecentCase("", "");
|
||||
@ -358,7 +359,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
/**
|
||||
* Gets the recent case names.
|
||||
*
|
||||
* @return caseNames An array String[LENGTH], newest case first, with any
|
||||
* @return caseNames An array String[LENGTH - 1], newest case first, with any
|
||||
* extra spots filled with ""
|
||||
*/
|
||||
public String[] getRecentCaseNames() {
|
||||
@ -366,9 +367,20 @@ import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
|
||||
Iterator<RecentCase> mostRecentFirst = recentCases.descendingIterator();
|
||||
int i = 0;
|
||||
String currentCaseName = null;
|
||||
try {
|
||||
currentCaseName = Case.getCurrentCase().getName();
|
||||
} catch (IllegalStateException ex) {
|
||||
// in case there is no current case.
|
||||
}
|
||||
|
||||
while (mostRecentFirst.hasNext()) {
|
||||
caseNames[i] = mostRecentFirst.next().name;
|
||||
i++;
|
||||
String name = mostRecentFirst.next().name;
|
||||
if ((currentCaseName != null && !name.equals(currentCaseName)) || currentCaseName == null) {
|
||||
// exclude currentCaseName from the caseNames[]
|
||||
caseNames[i] = name;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
while (i < caseNames.length) {
|
||||
@ -376,23 +388,34 @@ import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
i++;
|
||||
}
|
||||
|
||||
return caseNames;
|
||||
// return last 5 case names
|
||||
return (String[]) ArrayUtils.subarray(caseNames, 0, LENGTH - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the recent case paths.
|
||||
*
|
||||
* @return casePaths An array String[LENGTH], newest case first, with any
|
||||
* @return casePaths An array String[LENGTH - 1], newest case first, with any
|
||||
* extra spots filled with ""
|
||||
*/
|
||||
public String[] getRecentCasePaths() {
|
||||
String[] casePaths = new String[LENGTH];
|
||||
String currentCasePath = null;
|
||||
try {
|
||||
currentCasePath = Case.getCurrentCase().getName();
|
||||
} catch (IllegalStateException ex) {
|
||||
// in case there is no current case.
|
||||
}
|
||||
|
||||
Iterator<RecentCase> mostRecentFirst = recentCases.descendingIterator();
|
||||
int i = 0;
|
||||
while (mostRecentFirst.hasNext()) {
|
||||
casePaths[i] = mostRecentFirst.next().path;
|
||||
i++;
|
||||
String path = mostRecentFirst.next().path;
|
||||
if ((currentCasePath != null && !path.equals(currentCasePath)) || currentCasePath == null) {
|
||||
// exclude currentCasePath from the casePaths[]
|
||||
casePaths[i] = path;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
while (i < casePaths.length) {
|
||||
@ -400,7 +423,8 @@ import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
i++;
|
||||
}
|
||||
|
||||
return casePaths;
|
||||
// return last 5 case paths
|
||||
return (String[]) ArrayUtils.subarray(casePaths, 0, LENGTH - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,7 +36,8 @@ import org.openide.util.actions.SystemAction;
|
||||
|
||||
/** the constructor */
|
||||
UpdateRecentCases(){
|
||||
length = RecentCases.LENGTH;
|
||||
// display last 5 cases.
|
||||
length = RecentCases.LENGTH - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user