Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalyan Prasad Tatavarthi2019-03-27 07:28:22 -0400
committerKalyan Prasad Tatavarthi2019-03-27 11:13:15 -0400
commitd9591f51593e300e040e2211e68bb7cf344a8b05 (patch)
tree6524a3d0b8bce7507392dfd6d6c3a4fd3f098fb0
parentb20ba27f4b6f11ba53cb2b8297ee4c6ac7398e96 (diff)
downloadeclipse.platform.team-R4_11_maintenance.tar.gz
eclipse.platform.team-R4_11_maintenance.tar.xz
eclipse.platform.team-R4_11_maintenance.zip
Bug 544904: Japanese Calendar - Wrong Japanese era of Data tag in CVSR4_11_maintenance
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> (cherry picked from commit 7e78e535caf4f15e637d628cac5cfaabc2c47fae)
-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