GT-3286 - Timestamp review fixes

This commit is contained in:
dragonmacher 2019-11-05 11:46:04 -05:00
parent feaf203365
commit 264b7f1b65
3 changed files with 9 additions and 12 deletions

View file

@ -114,7 +114,7 @@ public class StringTableProvider extends ComponentProviderAdapter implements Dom
setTitle(options.isPascalRequired() ? "Pascal String Search" : "String Search");
setWindowMenuGroup("String Search");
setWindowGroup("String Search");
setTabText("String Search - " + DateUtils.getTimeNow());
setTabText("String Search - " + DateUtils.formatCurrentTime());
}
setIcon(ICON);
setHelpLocation(new HelpLocation(HelpTopics.SEARCH, "String_Search_Results"));

View file

@ -18,8 +18,6 @@ package docking;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.swing.*;
@ -32,8 +30,7 @@ import docking.util.AnimationUtils;
import docking.widgets.EmptyBorderButton;
import docking.widgets.label.GDLabel;
import generic.util.WindowUtilities;
import ghidra.util.HTMLUtilities;
import ghidra.util.SystemUtilities;
import ghidra.util.*;
import ghidra.util.layout.HorizontalLayout;
import ghidra.util.layout.MiddleLayout;
@ -62,7 +59,6 @@ public class StatusBar extends JPanel {
private LinkedList<String> messageQueue = new LinkedList<>();
// fading and flashing members
private DateFormat timeStampFormatter = new SimpleDateFormat("hh:mm:ss");
private Timer messageFadeTimer = new FadeTimer();
private Timer flashTimer = new FlashTimer();
private Timer animationDelayTimer = new AnimationDelayTimer();
@ -132,7 +128,7 @@ public class StatusBar extends JPanel {
* Add a new status item component to the status area. The preferred height and border
* for the component will be altered.
* @param c component
* @param width the preferred width of this status item.
* @param addBorder true if a border is desired
* @param rightSide component will be added to the right-side of the status
* area if true, else it will be added immediately after the status text area
* if false.
@ -234,7 +230,7 @@ public class StatusBar extends JPanel {
if (message.endsWith("\n")) {
message = message.substring(0, message.length() - 1);
}
messageQueue.add(0, message + " [" + timeStampFormatter.format(new Date()) + "]");
messageQueue.add(0, message + " [" + DateUtils.formatCurrentTime() + "]");
if (messageQueue.size() > MESSAGE_QUEUE_MAX_SIZE) {
messageQueue.removeLast();

View file

@ -26,7 +26,7 @@ import ghidra.util.exception.AssertException;
public class DateUtils {
/** Example: Oct 31, 2019 03:24 PM */
private static final String DATE_TIME_FORMAT_STRING = "MMM dd, yyyy hh:mm aaa";
private static final String DATE_TIME_FORMAT_STRING = "MMM dd, yyyy hh:mm a";
private static final String DATE_FORMAT_STRING = "MM/dd/yyyy";
private static final String TIME_FORMAT_STRING = "h:mm";
@ -236,11 +236,12 @@ public class DateUtils {
}
/**
* Returns the current local time zone time-of-day as an HOUR:MIN string.
* Returns the current local time zone time-of-day as simple time string.
* See {@value #TIME_FORMAT_STRING}.
*
* @return current time-of-day as "HOUR:MIN"
* @return current time-of-day a a string
*/
public static String getTimeNow() {
public static String formatCurrentTime() {
return TIME_FORMAT.get().format(new Date());
}