LH: date formatting

This commit is contained in:
Anton Makeev
2010-07-05 11:16:47 +04:00
parent cd4207d955
commit a0ee79a781
4 changed files with 10 additions and 5 deletions
@@ -16,6 +16,8 @@
package com.intellij.history.integration;
import com.intellij.openapi.util.text.StringUtil;
import java.text.DateFormat;
import java.util.Date;
@@ -23,7 +25,10 @@ public class FormatUtil {
public static final DateFormat FORMAT = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
public static String formatTimestamp(long t) {
DateFormat f = FORMAT;
return f.format(new Date(t));
return FORMAT.format(new Date(t));
}
public static String formatRelativeTimestamp(long t) {
return StringUtil.formatDate(t, FORMAT);
}
}
@@ -58,7 +58,7 @@ public abstract class FileDifferenceModel {
}
private String formatTitle(Entry e, boolean isAvailable) {
String result = FormatUtil.formatTimestamp(e.getTimestamp()) + " - " + e.getName();
String result = FormatUtil.formatRelativeTimestamp(e.getTimestamp()) + " - " + e.getName();
if (!isAvailable) {
result += " - " + LocalHistoryBundle.message("content.not.available");
}
@@ -108,7 +108,7 @@ public class RecentChangesPopup {
public Component getListCellRendererComponent(JList l, Object val, int i, boolean isSelected, boolean cellHasFocus) {
RecentChange c = (RecentChange)val;
myActionLabel.setText(c.getChangeName());
myDateLabel.setText(FormatUtil.formatTimestamp(c.getTimestamp()));
myDateLabel.setText(FormatUtil.formatRelativeTimestamp(c.getTimestamp()));
updateColors(isSelected);
return myPanel;
@@ -309,7 +309,7 @@ public class RevisionsList {
myBorder.set(row == table.getModel().getRowCount() - 1);
myDateLabel.setText(ensureString(StringUtil.formatDate(r.revision.getTimestamp(), FormatUtil.FORMAT)));
myDateLabel.setText(ensureString(FormatUtil.formatRelativeTimestamp(r.revision.getTimestamp())));
myFilesCountLabel.setText(ensureString(labelsAndColor.filesCount));
myTitleLabel.setFont(myTitleLabel.getFont().deriveFont(labelsAndColor.isNamed ? Font.BOLD : Font.PLAIN));