diff options
author | Michael Valenta | 2005-01-07 17:01:30 +0000 |
---|---|---|
committer | Michael Valenta | 2005-01-07 17:01:30 +0000 |
commit | ee0a6801c6770e5459384294d58c17121491c681 (patch) | |
tree | 1504c4c36e81f42db4f2b1d3ff497dd6340e8e19 /bundles/org.eclipse.team.cvs.ssh2 | |
parent | 5eab3b11a24410c3538e0d03606efd9c53330d8e (diff) | |
download | eclipse.platform.team-ee0a6801c6770e5459384294d58c17121491c681.tar.gz eclipse.platform.team-ee0a6801c6770e5459384294d58c17121491c681.tar.xz eclipse.platform.team-ee0a6801c6770e5459384294d58c17121491c681.zip |
Bug 82370 Inline Policy.localize to enable NLS tooling
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ssh2')
2 files changed, 14 insertions, 8 deletions
diff --git a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/CVSSSH2Plugin.java b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/CVSSSH2Plugin.java index 7caa88bba..b586b75c9 100644 --- a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/CVSSSH2Plugin.java +++ b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/CVSSSH2Plugin.java @@ -73,8 +73,7 @@ public class CVSSSH2Plugin extends AbstractUIPlugin { } public void start(BundleContext context) throws Exception { - super.start(context); - Policy.localize("org.eclipse.team.internal.ccvs.ssh2.messages"); //$NON-NLS-1$ + super.start(context); initializeDefaultPreferences(); } }
\ No newline at end of file diff --git a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/Policy.java b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/Policy.java index 93fcbd228..6139862fa 100644 --- a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/Policy.java +++ b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/Policy.java @@ -19,13 +19,20 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.OperationCanceledException; public class Policy { - protected static ResourceBundle bundle = null; + private static ResourceBundle bundle = null; + private static final String bundleName = "org.eclipse.team.internal.ccvs.ssh2.messages"; //$NON-NLS-1$ - /** - * Creates a NLS catalog for the given locale. + /* + * Returns a resource bundle, creating one if it none is available. */ - public static void localize(String bundleName) { - bundle = ResourceBundle.getBundle(bundleName); + private static ResourceBundle getResourceBundle() { + // thread safety + ResourceBundle tmpBundle = bundle; + if (tmpBundle != null) + return tmpBundle; + // always create a new classloader to be passed in + // in order to prevent ResourceBundle caching + return bundle = ResourceBundle.getBundle(bundleName); } /** @@ -34,7 +41,7 @@ public class Policy { */ public static String bind(String key) { try { - return bundle.getString(key); + return getResourceBundle().getString(key); } catch (MissingResourceException e) { return key; } catch (NullPointerException e) { |