cleanup and internationalize OpenTimelineAction

This commit is contained in:
jmillman 2016-03-18 16:25:27 -04:00
parent fa0fc5f396
commit 1e6673bbee
2 changed files with 25 additions and 29 deletions

View File

@ -1,4 +1,4 @@
CTL_MakeTimeline="Timeline" CTL_MakeTimeline=Timeline
CTL_TimeLineTopComponentAction=TimeLineTopComponent CTL_TimeLineTopComponentAction=TimeLineTopComponent
CTL_TimeLineTopComponent=Timeline Window CTL_TimeLineTopComponent=Timeline Window
HINT_TimeLineTopComponent=This is a Timeline window HINT_TimeLineTopComponent=This is a Timeline window
@ -24,7 +24,5 @@ TimelinePanel.jButton7.text=3d
TimelinePanel.jButton2.text=1m TimelinePanel.jButton2.text=1m
TimelinePanel.jButton3.text=3m TimelinePanel.jButton3.text=3m
TimelinePanel.jButton4.text=2w TimelinePanel.jButton4.text=2w
OpenTimelineAction.title=Timeline
OpenTimeLineAction.msgdlg.text=Could not create timeline, there are no data sources.
ProgressWindow.progressHeader.text=\ ProgressWindow.progressHeader.text=\

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2013 Basis Technology Corp. * Copyright 2013-16 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -20,7 +20,6 @@ package org.sleuthkit.autopsy.timeline;
import java.io.IOException; import java.io.IOException;
import java.util.logging.Level; import java.util.logging.Level;
import javax.swing.JOptionPane;
import org.openide.awt.ActionID; import org.openide.awt.ActionID;
import org.openide.awt.ActionReference; import org.openide.awt.ActionReference;
import org.openide.awt.ActionReferences; import org.openide.awt.ActionReferences;
@ -28,7 +27,6 @@ import org.openide.awt.ActionRegistration;
import org.openide.util.HelpCtx; import org.openide.util.HelpCtx;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.openide.util.actions.CallableSystemAction; import org.openide.util.actions.CallableSystemAction;
import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.core.Installer; import org.sleuthkit.autopsy.core.Installer;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
@ -60,39 +58,39 @@ public class OpenTimelineAction extends CallableSystemAction {
return Case.isCaseOpen() && fxInited;// && Case.getCurrentCase().hasData(); return Case.isCaseOpen() && fxInited;// && Case.getCurrentCase().hasData();
} }
@NbBundle.Messages({
"OpenTimelineAction.settingsErrorMessage=Failed to initialize timeline settings.",
"OpenTimeLineAction.msgdlg.text=Could not create timeline, there are no data sources."})
@Override @Override
@ThreadConfined(type = ThreadConfined.ThreadType.AWT) @ThreadConfined(type = ThreadConfined.ThreadType.AWT)
public void performAction() { public void performAction() {
//check case
if (!Case.isCaseOpen()) {
return;
}
final Case currentCase = Case.getCurrentCase();
if (currentCase.hasData() == false) {
JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(),
NbBundle.getMessage(this.getClass(), "OpenTimeLineAction.msgdlg.text"));
LOGGER.log(Level.INFO, "Could not create timeline, there are no data sources.");// NON-NLS
return;
}
try { try {
if (timeLineController == null) { Case currentCase = Case.getCurrentCase();
timeLineController = new TimeLineController(currentCase); if (currentCase.hasData() == false) {
} else if (timeLineController.getAutopsyCase() != currentCase) { MessageNotifyUtil.Message.info(Bundle.OpenTimeLineAction_msgdlg_text());
timeLineController.shutDownTimeLine(); LOGGER.log(Level.INFO, "Could not create timeline, there are no data sources.");// NON-NLS
timeLineController = new TimeLineController(currentCase); return;
} }
timeLineController.openTimeLine(); try {
} catch (IOException iOException) { if (timeLineController == null) {
MessageNotifyUtil.Notify.error("Timeline", "Failed to initialize timeline settings."); timeLineController = new TimeLineController(currentCase);
LOGGER.log(Level.SEVERE, "Failed to initialize per case timeline settings."); } else if (timeLineController.getAutopsyCase() != currentCase) {
timeLineController.shutDownTimeLine();
timeLineController = new TimeLineController(currentCase);
}
timeLineController.openTimeLine();
} catch (IOException iOException) {
MessageNotifyUtil.Message.error(Bundle.OpenTimelineAction_settingsErrorMessage());
LOGGER.log(Level.SEVERE, "Failed to initialize per case timeline settings.", iOException);
}
} catch (IllegalStateException e) {
//there is no case... Do nothing.
} }
} }
@Override @Override
public String getName() { public String getName() {
return NbBundle.getMessage(TimeLineTopComponent.class, "OpenTimelineAction.title"); return NbBundle.getMessage(OpenTimelineAction.class, "CTL_MakeTimeline");
} }
@Override @Override