| /** |
| * Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (Heidelberg) |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Florian Pirchner - Initial implementation |
| */ |
| package org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance; |
| |
| import java.beans.PropertyChangeListener; |
| import java.beans.PropertyChangeSupport; |
| import java.util.HashMap; |
| import java.util.Locale; |
| import org.eclipse.osbp.runtime.common.i18n.ITranslator; |
| import org.slf4j.Logger; |
| |
| @SuppressWarnings("all") |
| public class TestsClassinheritanceTranslator implements ITranslator { |
| private static Logger log = org.slf4j.LoggerFactory.getLogger("translations by translator"); |
| |
| private static org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.TestsClassinheritanceTranslator instance = null; |
| |
| private static Locale lastLocale = null; |
| |
| private PropertyChangeSupport pcs = new java.beans.PropertyChangeSupport(this); |
| |
| private HashMap<String, String> translations = new HashMap<String,String>() {{ |
| put("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.base_by_class","base_by_class"); |
| put("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.base_by_subclass","base_by_subclass"); |
| put("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.id","id"); |
| put("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.name","name"); |
| put("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.one_by_class","one_by_class"); |
| put("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.one_by_subclass","one_by_subclass"); |
| put("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.stuff","stuff"); |
| put("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.two_by_class","two_by_class"); |
| put("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.two_by_subclass","two_by_subclass"); |
| put("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.version","version"); |
| }}; |
| |
| private static String base_by_class; |
| |
| private static String base_by_subclass; |
| |
| private static String id; |
| |
| private static String name; |
| |
| private static String one_by_class; |
| |
| private static String one_by_subclass; |
| |
| private static String stuff; |
| |
| private static String two_by_class; |
| |
| private static String two_by_subclass; |
| |
| private static String version; |
| |
| public static org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.TestsClassinheritanceTranslator getInstance(final Locale locale) { |
| if(instance == null) { |
| instance = new org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.TestsClassinheritanceTranslator(); |
| if (lastLocale == null) { |
| instance.changeLocale(locale); |
| } |
| } |
| return instance; |
| } |
| |
| public void addPropertyChangeListener(final PropertyChangeListener listener) { |
| this.pcs.addPropertyChangeListener(listener); |
| } |
| |
| public void removePropertyChangeListener(final PropertyChangeListener listener) { |
| this.pcs.removePropertyChangeListener(listener); |
| } |
| |
| public void mergeTranslations() { |
| |
| } |
| |
| public HashMap<String, String> getTranslations() { |
| return translations; |
| } |
| |
| public String getBase_by_class() { |
| if (log.isDebugEnabled()) log.debug("getBase_by_class returns:"+this.base_by_class); |
| return this.base_by_class; |
| } |
| |
| public String getBase_by_subclass() { |
| if (log.isDebugEnabled()) log.debug("getBase_by_subclass returns:"+this.base_by_subclass); |
| return this.base_by_subclass; |
| } |
| |
| public String getId() { |
| if (log.isDebugEnabled()) log.debug("getId returns:"+this.id); |
| return this.id; |
| } |
| |
| public String getName() { |
| if (log.isDebugEnabled()) log.debug("getName returns:"+this.name); |
| return this.name; |
| } |
| |
| public String getOne_by_class() { |
| if (log.isDebugEnabled()) log.debug("getOne_by_class returns:"+this.one_by_class); |
| return this.one_by_class; |
| } |
| |
| public String getOne_by_subclass() { |
| if (log.isDebugEnabled()) log.debug("getOne_by_subclass returns:"+this.one_by_subclass); |
| return this.one_by_subclass; |
| } |
| |
| public String getStuff() { |
| if (log.isDebugEnabled()) log.debug("getStuff returns:"+this.stuff); |
| return this.stuff; |
| } |
| |
| public String getTwo_by_class() { |
| if (log.isDebugEnabled()) log.debug("getTwo_by_class returns:"+this.two_by_class); |
| return this.two_by_class; |
| } |
| |
| public String getTwo_by_subclass() { |
| if (log.isDebugEnabled()) log.debug("getTwo_by_subclass returns:"+this.two_by_subclass); |
| return this.two_by_subclass; |
| } |
| |
| public String getVersion() { |
| if (log.isDebugEnabled()) log.debug("getVersion returns:"+this.version); |
| return this.version; |
| } |
| |
| public void setBase_by_class(final String newBase_by_class) { |
| if (log.isDebugEnabled()) log.debug("setBase_by_class called:"+newBase_by_class); |
| String oldBase_by_class = this.base_by_class; |
| this.base_by_class = newBase_by_class; |
| translations.put("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.base_by_class", newBase_by_class); |
| this.pcs.firePropertyChange("base_by_class", oldBase_by_class, newBase_by_class); |
| } |
| |
| public void setBase_by_subclass(final String newBase_by_subclass) { |
| if (log.isDebugEnabled()) log.debug("setBase_by_subclass called:"+newBase_by_subclass); |
| String oldBase_by_subclass = this.base_by_subclass; |
| this.base_by_subclass = newBase_by_subclass; |
| translations.put("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.base_by_subclass", newBase_by_subclass); |
| this.pcs.firePropertyChange("base_by_subclass", oldBase_by_subclass, newBase_by_subclass); |
| } |
| |
| public void setId(final String newId) { |
| if (log.isDebugEnabled()) log.debug("setId called:"+newId); |
| String oldId = this.id; |
| this.id = newId; |
| translations.put("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.id", newId); |
| this.pcs.firePropertyChange("id", oldId, newId); |
| } |
| |
| public void setName(final String newName) { |
| if (log.isDebugEnabled()) log.debug("setName called:"+newName); |
| String oldName = this.name; |
| this.name = newName; |
| translations.put("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.name", newName); |
| this.pcs.firePropertyChange("name", oldName, newName); |
| } |
| |
| public void setOne_by_class(final String newOne_by_class) { |
| if (log.isDebugEnabled()) log.debug("setOne_by_class called:"+newOne_by_class); |
| String oldOne_by_class = this.one_by_class; |
| this.one_by_class = newOne_by_class; |
| translations.put("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.one_by_class", newOne_by_class); |
| this.pcs.firePropertyChange("one_by_class", oldOne_by_class, newOne_by_class); |
| } |
| |
| public void setOne_by_subclass(final String newOne_by_subclass) { |
| if (log.isDebugEnabled()) log.debug("setOne_by_subclass called:"+newOne_by_subclass); |
| String oldOne_by_subclass = this.one_by_subclass; |
| this.one_by_subclass = newOne_by_subclass; |
| translations.put("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.one_by_subclass", newOne_by_subclass); |
| this.pcs.firePropertyChange("one_by_subclass", oldOne_by_subclass, newOne_by_subclass); |
| } |
| |
| public void setStuff(final String newStuff) { |
| if (log.isDebugEnabled()) log.debug("setStuff called:"+newStuff); |
| String oldStuff = this.stuff; |
| this.stuff = newStuff; |
| translations.put("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.stuff", newStuff); |
| this.pcs.firePropertyChange("stuff", oldStuff, newStuff); |
| } |
| |
| public void setTwo_by_class(final String newTwo_by_class) { |
| if (log.isDebugEnabled()) log.debug("setTwo_by_class called:"+newTwo_by_class); |
| String oldTwo_by_class = this.two_by_class; |
| this.two_by_class = newTwo_by_class; |
| translations.put("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.two_by_class", newTwo_by_class); |
| this.pcs.firePropertyChange("two_by_class", oldTwo_by_class, newTwo_by_class); |
| } |
| |
| public void setTwo_by_subclass(final String newTwo_by_subclass) { |
| if (log.isDebugEnabled()) log.debug("setTwo_by_subclass called:"+newTwo_by_subclass); |
| String oldTwo_by_subclass = this.two_by_subclass; |
| this.two_by_subclass = newTwo_by_subclass; |
| translations.put("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.two_by_subclass", newTwo_by_subclass); |
| this.pcs.firePropertyChange("two_by_subclass", oldTwo_by_subclass, newTwo_by_subclass); |
| } |
| |
| public void setVersion(final String newVersion) { |
| if (log.isDebugEnabled()) log.debug("setVersion called:"+newVersion); |
| String oldVersion = this.version; |
| this.version = newVersion; |
| translations.put("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.version", newVersion); |
| this.pcs.firePropertyChange("version", oldVersion, newVersion); |
| } |
| |
| public void changeLocale(final Locale locale) { |
| // avoid unnecessary settings |
| if (locale == null) { |
| if (log.isDebugEnabled()) log.debug("locale for org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance is null."); |
| return; |
| } |
| if (locale.equals(lastLocale)) { |
| if (log.isDebugEnabled()) log.debug("locale for org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance already set to "+locale.getDisplayLanguage()); |
| return; |
| } |
| if (log.isDebugEnabled()) log.debug("locale for org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance set to "+locale.getDisplayLanguage()); |
| lastLocale = locale; |
| // call the imported translators change locale method |
| try { |
| java.util.ResourceBundle resource = java.util.ResourceBundle.getBundle("i18n.I18N", locale, getClass().getClassLoader()); |
| try { |
| setBase_by_class(resource.getString("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.base_by_class")); |
| } catch (Exception e) { |
| log.error(getClass().getCanonicalName()+" - "+e.getLocalizedMessage()); |
| } |
| try { |
| setBase_by_subclass(resource.getString("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.base_by_subclass")); |
| } catch (Exception e) { |
| log.error(getClass().getCanonicalName()+" - "+e.getLocalizedMessage()); |
| } |
| try { |
| setId(resource.getString("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.id")); |
| } catch (Exception e) { |
| log.error(getClass().getCanonicalName()+" - "+e.getLocalizedMessage()); |
| } |
| try { |
| setName(resource.getString("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.name")); |
| } catch (Exception e) { |
| log.error(getClass().getCanonicalName()+" - "+e.getLocalizedMessage()); |
| } |
| try { |
| setOne_by_class(resource.getString("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.one_by_class")); |
| } catch (Exception e) { |
| log.error(getClass().getCanonicalName()+" - "+e.getLocalizedMessage()); |
| } |
| try { |
| setOne_by_subclass(resource.getString("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.one_by_subclass")); |
| } catch (Exception e) { |
| log.error(getClass().getCanonicalName()+" - "+e.getLocalizedMessage()); |
| } |
| try { |
| setStuff(resource.getString("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.stuff")); |
| } catch (Exception e) { |
| log.error(getClass().getCanonicalName()+" - "+e.getLocalizedMessage()); |
| } |
| try { |
| setTwo_by_class(resource.getString("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.two_by_class")); |
| } catch (Exception e) { |
| log.error(getClass().getCanonicalName()+" - "+e.getLocalizedMessage()); |
| } |
| try { |
| setTwo_by_subclass(resource.getString("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.two_by_subclass")); |
| } catch (Exception e) { |
| log.error(getClass().getCanonicalName()+" - "+e.getLocalizedMessage()); |
| } |
| try { |
| setVersion(resource.getString("org.eclipse.osbp.dsl.entity.xtext.tests.classinheritance.version")); |
| } catch (Exception e) { |
| log.error(getClass().getCanonicalName()+" - "+e.getLocalizedMessage()); |
| } |
| } catch (java.util.MissingResourceException mre) { |
| System.err.println(getClass().getCanonicalName()+" - "+mre.getLocalizedMessage()); |
| } |
| |
| } |
| } |