mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
GT-3286 - Updated usage of timestamps in the UI to be consistent
This commit is contained in:
parent
2cafb27574
commit
feaf203365
17 changed files with 130 additions and 165 deletions
|
@ -16,13 +16,13 @@
|
|||
package docking.widgets;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.text.DateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
|
||||
import docking.widgets.table.GTableCellRenderer;
|
||||
import docking.widgets.table.GTableCellRenderingData;
|
||||
import ghidra.util.DateUtils;
|
||||
|
||||
/**
|
||||
* The JDK-provided DateRenderer does not inherit the backgrounds and such properly.
|
||||
|
@ -30,16 +30,15 @@ import docking.widgets.table.GTableCellRenderingData;
|
|||
* column does not have the correct background. This fixes that.
|
||||
*/
|
||||
public class GenericDateCellRenderer extends GTableCellRenderer {
|
||||
private DateFormat format;
|
||||
|
||||
private String toolTip;
|
||||
|
||||
public GenericDateCellRenderer(DateFormat format, String toolTip) {
|
||||
this.format = format;
|
||||
this.toolTip = toolTip;
|
||||
public GenericDateCellRenderer() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public GenericDateCellRenderer(DateFormat format) {
|
||||
this(format, null);
|
||||
public GenericDateCellRenderer(String toolTip) {
|
||||
this.toolTip = toolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -47,7 +46,8 @@ public class GenericDateCellRenderer extends GTableCellRenderer {
|
|||
|
||||
Date value = (Date) data.getValue();
|
||||
|
||||
GTableCellRenderingData newData = data.copyWithNewValue(format.format(value));
|
||||
GTableCellRenderingData newData =
|
||||
data.copyWithNewValue(DateUtils.formatDateTimestamp(value));
|
||||
|
||||
JComponent c = (JComponent) super.getTableCellRendererComponent(newData);
|
||||
if (toolTip != null) {
|
||||
|
|
|
@ -134,7 +134,7 @@ class DirectoryTable extends GTable implements GhidraFileChooserDirectoryModelIf
|
|||
column.setCellRenderer(new FileSizeRenderer());
|
||||
|
||||
column = columnModel.getColumn(DirectoryTableModel.TIME_COL);
|
||||
column.setCellRenderer(new GenericDateCellRenderer(GhidraFileChooser.format));
|
||||
column.setCellRenderer(new GenericDateCellRenderer());
|
||||
}
|
||||
|
||||
private void maybeSelectItem(MouseEvent e) {
|
||||
|
|
|
@ -25,6 +25,7 @@ import javax.swing.filechooser.FileSystemView;
|
|||
import docking.widgets.DropDownSelectionTextField;
|
||||
import docking.widgets.DropDownTextFieldDataModel;
|
||||
import docking.widgets.list.GListCellRenderer;
|
||||
import ghidra.util.DateUtils;
|
||||
import ghidra.util.HTMLUtilities;
|
||||
import ghidra.util.exception.AssertException;
|
||||
|
||||
|
@ -130,7 +131,7 @@ public class FileDropDownSelectionDataModel implements DropDownTextFieldDataMode
|
|||
"<b>" + HTMLUtilities.escapeHTML(file.getName()) + "</b>" + "</td></tr>" +
|
||||
"<tr><td>Size:</td><td>" + (isDir ? "0" : file.length()) + " bytes" + "</td></tr>" +
|
||||
"<tr><td>Last modified:</td><td>" +
|
||||
GhidraFileChooser.format.format(new Date(file.lastModified())) + "</td></tr>" +
|
||||
DateUtils.formatDateTimestamp(new Date(file.lastModified())) + "</td></tr>" +
|
||||
"</table>";
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ import java.awt.*;
|
|||
import java.awt.event.*;
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
|
@ -126,8 +125,6 @@ public class GhidraFileChooser extends DialogComponentProvider
|
|||
return null;
|
||||
}
|
||||
|
||||
static final SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy hh:mm aaa");
|
||||
|
||||
/** Instruction to display only files. */
|
||||
public static final int FILES_ONLY = 0;
|
||||
/** Instruction to display only directories. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue