Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalyan Prasad Tatavarthi2019-03-27 11:28:22 +0000
committerKalyan Prasad Tatavarthi2019-03-27 11:28:22 +0000
commit7e78e535caf4f15e637d628cac5cfaabc2c47fae (patch)
treef028c9d221e78d9dde5525a0494d1d8e184b69f2
parent0a8ebd58cb4fbb2a64f8b96360a25bed561aaa88 (diff)
downloadeclipse.platform.team-7e78e535caf4f15e637d628cac5cfaabc2c47fae.tar.gz
eclipse.platform.team-7e78e535caf4f15e637d628cac5cfaabc2c47fae.tar.xz
eclipse.platform.team-7e78e535caf4f15e637d628cac5cfaabc2c47fae.zip
repos view This fix modifies the display string for Date if the year is not just a number. This handles the case for Japanese Calendar Change-Id: If85725e0da3a1d3de6c06135937d74e8f8f9b6c0 Signed-off-by: Kalyan Prasad Tatavarthi <kalyan_prasad@in.ibm.com>
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSTagElement.java26
1 files changed, 23 insertions, 3 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSTagElement.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSTagElement.java
index 5ff8cbf18..d678a5f06 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSTagElement.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSTagElement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -31,6 +31,7 @@ import org.eclipse.team.internal.ccvs.ui.operations.FetchMembersOperation.Remote
import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
import org.eclipse.ui.progress.IElementCollector;
+import com.ibm.icu.text.DateFormat;
import com.ibm.icu.text.SimpleDateFormat;
import com.ibm.icu.util.TimeZone;
@@ -43,15 +44,34 @@ public class CVSTagElement extends CVSModelElement implements IDeferredWorkbench
private static final String TIME_ONLY_COLUMN_FORMAT = "HH:mm:ss"; //$NON-NLS-1$
private static SimpleDateFormat localLongFormat = new SimpleDateFormat(REPO_VIEW_LONG_FORAMT,Locale.getDefault());
private static SimpleDateFormat localShortFormat = new SimpleDateFormat(REPO_VIEW_SHORT_FORMAT,Locale.getDefault());
+ private static DateFormat localLongDateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,DateFormat.MEDIUM);
+ private static DateFormat localShortDateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM);
+ private static DateFormat localYearDateFormat = DateFormat.getInstanceForSkeleton(DateFormat.YEAR);
private static SimpleDateFormat timeColumnFormat = new SimpleDateFormat(TIME_ONLY_COLUMN_FORMAT, Locale.getDefault());
static synchronized public String toDisplayString(Date date){
+ String year = localYearDateFormat.format(date);
+ boolean permitSimpleDateFormat = true;
+ try {
+ Integer.parseInt(year);
+ } catch (NumberFormatException e) {
+ // This can happen if the Year is not a number but also includes an Era eg: JapaneseCalendar
+ permitSimpleDateFormat = false;
+ }
+ DateFormat selectedFormat = localLongFormat;
+ if (!permitSimpleDateFormat) {
+ selectedFormat = localLongDateFormat;
+ }
String localTime = timeColumnFormat.format(date);
timeColumnFormat.setTimeZone(TimeZone.getDefault());
if(localTime.equals("00:00:00")){ //$NON-NLS-1$
- return localShortFormat.format(date);
+ if (permitSimpleDateFormat) {
+ selectedFormat = localShortFormat;
+ } else {
+ selectedFormat = localShortDateFormat;
+ }
}
- return localLongFormat.format(date);
+ return selectedFormat.format(date);
}
public CVSTagElement(CVSTag tag, ICVSRepositoryLocation root) {

Back to the top