Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2020-04-28 04:54:33 +0000
committerAlexander Kurtakov2020-04-28 06:33:29 +0000
commite21c925be078745b12480a94e3a40aaa0623f8ed (patch)
tree261c815b0ad909edcd125c74f8e5393f0e1fd7a2
parent61b67eb5c221afba067e55eed231c749b33c6140 (diff)
downloadeclipse.platform.text-Y20200429-0730.tar.gz
eclipse.platform.text-Y20200429-0730.tar.xz
eclipse.platform.text-Y20200429-0730.zip
Some missed cases. Change-Id: Ic6c2b6e96a5a1cc58356697679bb6a148e7adcac Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--org.eclipse.text/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/templates/GlobalTemplateVariables.java21
2 files changed, 13 insertions, 11 deletions
diff --git a/org.eclipse.text/META-INF/MANIFEST.MF b/org.eclipse.text/META-INF/MANIFEST.MF
index 1a693ade3..826cd4a5f 100644
--- a/org.eclipse.text/META-INF/MANIFEST.MF
+++ b/org.eclipse.text/META-INF/MANIFEST.MF
@@ -20,7 +20,4 @@ Require-Bundle:
org.eclipse.equinox.preferences;bundle-version="[3.7.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.14.0,4.0.0)"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Import-Package:
- com.ibm.icu.text,
- com.ibm.icu.util
Automatic-Module-Name: org.eclipse.text
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/templates/GlobalTemplateVariables.java b/org.eclipse.text/src/org/eclipse/jface/text/templates/GlobalTemplateVariables.java
index 58f50cc08..91cacbf11 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/templates/GlobalTemplateVariables.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/templates/GlobalTemplateVariables.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -16,12 +16,11 @@
*******************************************************************************/
package org.eclipse.jface.text.templates;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
import java.util.List;
-
-import com.ibm.icu.text.DateFormat;
-import com.ibm.icu.text.SimpleDateFormat;
-import com.ibm.icu.util.Calendar;
-import com.ibm.icu.util.ULocale;
+import java.util.Locale;
/**
* Global variables which are available in any context.
@@ -153,7 +152,7 @@ public class GlobalTemplateVariables {
* The date variable evaluates to the current date. This supports a <code>pattern</code> and a
* <code>locale</code> as optional parameters. <code>pattern</code> is a pattern compatible with
* {@link SimpleDateFormat}. <code>locale</code> is a string representation of the locale
- * compatible with the constructor parameter {@link ULocale#ULocale(String)}.
+ * compatible with the constructor parameter {@link Locale#Locale(String)}.
*/
public static class Date extends SimpleTemplateVariableResolver {
/**
@@ -179,7 +178,13 @@ public class GlobalTemplateVariables {
// There is a least one parameter (params.get(0) is not null), set the format depending on second parameter:
DateFormat format;
if (params.size() >= 2 && params.get(1) != null) {
- format= new SimpleDateFormat(params.get(0), new ULocale(params.get(1)));
+ String localeString = params.get(1);
+ if (localeString.contains("_")) { //$NON-NLS-1$
+ String[] localeData= localeString.split("_"); //$NON-NLS-1$
+ format= new SimpleDateFormat(params.get(0), new Locale(localeData[0], localeData[1]));
+ } else {
+ format= new SimpleDateFormat(params.get(0), new Locale(localeString));
+ }
} else {
format= new SimpleDateFormat(params.get(0));
}

Back to the top