diff options
author | Kalyan Prasad Tatavarthi | 2019-03-27 11:28:22 +0000 |
---|---|---|
committer | Kalyan Prasad Tatavarthi | 2019-03-27 11:28:22 +0000 |
commit | 7e78e535caf4f15e637d628cac5cfaabc2c47fae (patch) | |
tree | f028c9d221e78d9dde5525a0494d1d8e184b69f2 | |
parent | 0a8ebd58cb4fbb2a64f8b96360a25bed561aaa88 (diff) | |
download | eclipse.platform.team-7e78e535caf4f15e637d628cac5cfaabc2c47fae.tar.gz eclipse.platform.team-7e78e535caf4f15e637d628cac5cfaabc2c47fae.tar.xz eclipse.platform.team-7e78e535caf4f15e637d628cac5cfaabc2c47fae.zip |
Bug 544904: Japanese Calendar - Wrong Japanese era of Data tag in CVSS4_12_0_M1I20190412-1800I20190412-0520I20190411-0625I20190410-1800I20190410-0600I20190409-1800I20190409-0600I20190408-1800I20190408-0600I20190407-1800I20190406-1800I20190405-1800I20190404-1800I20190403-1800I20190402-1800I20190401-1800I20190331-1800I20190330-1800I20190329-1800I20190329-0120I20190328-1800I20190327-1800
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.java | 26 |
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) { |