Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2014-10-21 12:17:19 +0000
committerLars Vogel2014-10-21 20:15:57 +0000
commit11b0290ebba1d128c21268793b11fe937e626199 (patch)
treec9fd3839b76ccb9cf301b3c0bf9ded9e47129a01
parentb35da07b56912d63e979622c4ddd72eec04b1239 (diff)
downloadorg.eclipse.e4.tools-11b0290ebba1d128c21268793b11fe937e626199.tar.gz
org.eclipse.e4.tools-11b0290ebba1d128c21268793b11fe937e626199.tar.xz
org.eclipse.e4.tools-11b0290ebba1d128c21268793b11fe937e626199.zip
Bug 448068 - Adjust e4 tools to new local handlingI20141022-2200I20141021-2200
Change-Id: I3ae73df26c0461ad6a1b9abbf35f16d87fd36e89 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java10
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ProjectOSGiTranslationProvider.java24
2 files changed, 27 insertions, 7 deletions
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java
index ea1d5ecb..601f235d 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java
@@ -350,7 +350,15 @@ public class ModelEditor implements IGotoObject {
this.context.set(ModelEditor.class, this);
this.obsManager = new ObservablesManager();
if (project != null) {
- ProjectOSGiTranslationProvider translationProvider = new ProjectOSGiTranslationProvider(project, (String) this.context.get(TranslationService.LOCALE)) {
+ String localeString = ""; //$NON-NLS-1$
+ Object object = this.context.get(TranslationService.LOCALE);
+ // TODO simplify once we break e4 tools
+ // compatibility with Luna, in Luna we representation has changed to
+ // be Locale instead of String
+ if (object != null) {
+ localeString = object.toString();
+ }
+ ProjectOSGiTranslationProvider translationProvider = new ProjectOSGiTranslationProvider(project, localeString) {
@Override
protected void updateResourceBundle() {
super.updateResourceBundle();
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ProjectOSGiTranslationProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ProjectOSGiTranslationProvider.java
index 6cefaa95..74c7f6f2 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ProjectOSGiTranslationProvider.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/properties/ProjectOSGiTranslationProvider.java
@@ -55,6 +55,8 @@ public class ProjectOSGiTranslationProvider extends ResourceBundleTranslationPro
* The initial {@link Locale} for which this translation provider
* should be created.
*/
+ // TODO change parameter to Locale instead of String once we break e4 tools
+ // compatibility with Luna
public ProjectOSGiTranslationProvider(IProject project, String locale) {
// create the translation provider with no initial ResourceBundle as we
// need to calculate it first
@@ -91,6 +93,8 @@ public class ProjectOSGiTranslationProvider extends ResourceBundleTranslationPro
}
}
+ // TODO remove once we break e4 tools
+ // compatibility with Luna
@Inject
void setLocale(@Named(TranslationService.LOCALE) String locale, @Optional Boolean performUpdate) {
try {
@@ -103,8 +107,16 @@ public class ProjectOSGiTranslationProvider extends ResourceBundleTranslationPro
updateResourceBundle();
}
+ @Inject
+ void setLocale(@Named(TranslationService.LOCALE) Locale locale, @Optional Boolean performUpdate) {
+ this.locale = locale == null ? Locale.getDefault() : locale;
+
+ if (performUpdate == null || performUpdate)
+ updateResourceBundle();
+ }
+
/**
- *
+ *
* @param delta
* The resource delta that represents the changes in the state of
* a resource tree between two discrete points in time.
@@ -154,7 +166,7 @@ public class ProjectOSGiTranslationProvider extends ResourceBundleTranslationPro
* Will check if the manifest header identifying the base name of the
* bundle's localization entries has changed and if so it will update the
* underlying {@link ResourceBundle} and clear the caches.
- *
+ *
* @param file
* The reference to the manifest file of the current project.
*/
@@ -181,7 +193,7 @@ public class ProjectOSGiTranslationProvider extends ResourceBundleTranslationPro
/**
* Extracts the manifest header identifying the base name of the bundle's
* localization entries.
- *
+ *
* @param file
* The reference to the manifest file of the current project.
* @return The manifest header identifying the base name of the bundle's
@@ -190,7 +202,7 @@ public class ProjectOSGiTranslationProvider extends ResourceBundleTranslationPro
* If loading the contents of the given {@link IFile} fails
* @throws IOException
* If reading out of the given file fails.
- *
+ *
* @see IFile#getContents()
*/
public static String extractBasenameFromManifest(IFile file) throws CoreException, IOException {
@@ -219,7 +231,7 @@ public class ProjectOSGiTranslationProvider extends ResourceBundleTranslationPro
/**
* Specialization of {@link Control} which loads the {@link ResourceBundle}
* by using file structures of a project instead of using a classloader.
- *
+ *
* @author Dirk Fauth
*/
class ProjectResourceBundleControl extends ResourceBundle.Control {
@@ -275,7 +287,7 @@ public class ProjectOSGiTranslationProvider extends ResourceBundleTranslationPro
/**
* Loads the properties file by using the {@link IProject} of the
* {@link ProjectOSGiTranslationProvider}.
- *
+ *
* @param name
* @return The {@link InputStream} to the properties file to load
*/

Back to the top