public synchronized Object getManagedProperty(Object client, String memberName, Object key) { if (!(client instanceof IInstallableUnit)) return null; IInstallableUnit iu = (IInstallableUnit) client; if (InstallableUnit.MEMBER_TRANSLATED_PROPERTIES.equals(memberName)) { if (translationSupport == null) translationSupport = new TranslationSupport(this); return key instanceof KeyWithLocale ? translationSupport.getIUProperty(iu, (KeyWithLocale) key) : translationSupport.getIUProperty(iu, key.toString()); } return null; }
public String getProperty(String key, String locale) { return TranslationSupport.getInstance().getIUProperty(this, key, locale); }
public ICopyright getCopyright(String locale) { return TranslationSupport.getInstance().getCopyright(this, locale); }
/** * Return the localized value for the specified IInstallableUnit * property using the default locale. * * @param iu the IInstallableUnit in question * @param propertyKey the name of the property to be retrieved * @return the localized property value, or <code>null</code> if no * such property is defined. */ public String getIUProperty(IInstallableUnit iu, String propertyKey) { return getIUProperty(iu, propertyKey, null); }
public synchronized static TranslationSupport getInstance() { if (instance == null) instance = new TranslationSupport(); return instance; }
/** * If the current profile for self is marked as a roaming profile, we need * to update its install and bundle pool locations. */ private void updateSelfProfile(Map<String, Profile> profileMap) { if (profileMap == null) return; Profile selfProfile = profileMap.get(self); if (selfProfile == null) return; //register default locale provider where metadata translations are found //TODO ideally this should not be hard-coded to the current profile TranslationSupport.getInstance().setTranslationSource(selfProfile); if (DebugHelper.DEBUG_PROFILE_REGISTRY) DebugHelper.debug(PROFILE_REGISTRY, "SimpleProfileRegistry.updateSelfProfile"); //$NON-NLS-1$ boolean changed = false; //only update if self is a roaming profile if (Boolean.parseBoolean(selfProfile.getProperty(IProfile.PROP_ROAMING))) changed = updateRoamingProfile(selfProfile); if (changed) saveProfile(selfProfile); }
public Collection<ILicense> getLicenses(String locale) { return CollectionUtils.unmodifiableList(TranslationSupport.getInstance().getLicenses(this, locale)); }
private String getLocalizedIUProperty(IInstallableUnit iu, String actualKey, String locale) { String localizedKey = makeLocalizedKey(actualKey, locale); String localizedValue = null; return localizedValue; final List<String> locales = buildLocaleVariants(locale); final IInstallableUnit theUnit = iu; IQueryResult<IInstallableUnit> localizationFragments = getLocalizationFragments(locales, locale); IInstallableUnit localizationIU = iter.next(); for (Iterator<String> jter = locales.iterator(); jter.hasNext();) { String localeKey = makeLocalizedKey(actualKey, jter.next()); translation = localizationIU.getProperty(localeKey); if (translation != null) return cacheResult(iu, localizedKey, translation); String localeKey = makeLocalizedKey(actualKey, nextLocale); String nextValue = iu.getProperty(localeKey); if (nextValue != null) return cacheResult(iu, localizedKey, nextValue); return cacheResult(iu, localizedKey, actualKey);
/** * Creates a label provider. * * @param showVersion whether version information should be shown in labels * @param appendResolvedVariables whether locations with variables should be shown * with variables resolved, in addition to unresolved */ public StyledBundleLabelProvider(boolean showVersion, boolean appendResolvedVariables) { PDEPlugin.getDefault().getLabelProvider().connect(this); fShowVersion = showVersion; fAppendResolvedVariables = appendResolvedVariables; fTranslations = TranslationSupport.getInstance(); }
/** * Return the localized value for the specified IInstallableUnit * property using the locale specified in the <code>propertyKey</code>. * * @param iu the IInstallableUnit in question * @param propertyKey the name and locale of the property to be retrieved * @return the localized property value, or <code>null</code> if no * such property is defined. */ public String getIUProperty(IInstallableUnit iu, KeyWithLocale propertyKey) { return getIUProperty(iu, propertyKey.getKey(), propertyKey.getLocale().toString()); }
/** * If the current profile for self is marked as a roaming profile, we need * to update its install and bundle pool locations. */ private void updateSelfProfile(Map<String, Profile> profileMap) { if (profileMap == null) return; Profile selfProfile = profileMap.get(self); if (selfProfile == null) return; //register default locale provider where metadata translations are found //TODO ideally this should not be hard-coded to the current profile TranslationSupport.getInstance().setTranslationSource(selfProfile); if (DebugHelper.DEBUG_PROFILE_REGISTRY) DebugHelper.debug(PROFILE_REGISTRY, "SimpleProfileRegistry.updateSelfProfile"); //$NON-NLS-1$ boolean changed = false; //only update if self is a roaming profile if (Boolean.parseBoolean(selfProfile.getProperty(IProfile.PROP_ROAMING))) changed = updateRoamingProfile(selfProfile); if (changed) saveProfile(selfProfile); }
public synchronized Object getManagedProperty(Object client, String memberName, Object key) { if (!(client instanceof IInstallableUnit)) return null; IInstallableUnit iu = (IInstallableUnit) client; if (InstallableUnit.MEMBER_TRANSLATED_PROPERTIES.equals(memberName)) { if (translationSupport == null) translationSupport = new TranslationSupport(this); return key instanceof KeyWithLocale ? translationSupport.getIUProperty(iu, (KeyWithLocale) key) : translationSupport.getIUProperty(iu, key.toString()); } return null; }
} else if (element instanceof IInstallableUnit) { IInstallableUnit iu = (IInstallableUnit) element; String name = fTranslations.getIUProperty(iu, IInstallableUnit.PROP_NAME); if (name == null) { name = iu.getId();
public synchronized Object getManagedProperty(Object client, String memberName, Object key) { if (!(client instanceof IInstallableUnit)) return null; IInstallableUnit iu = (IInstallableUnit) client; if (InstallableUnit.MEMBER_TRANSLATED_PROPERTIES.equals(memberName)) { if (translationSupport == null) translationSupport = new TranslationSupport(this); return key instanceof KeyWithLocale ? translationSupport.getIUProperty(iu, (KeyWithLocale) key) : translationSupport.getIUProperty(iu, key.toString()); } return null; }
public synchronized Object getManagedProperty(Object client, String memberName, Object key) { if (!(client instanceof IInstallableUnit)) return null; IInstallableUnit iu = (IInstallableUnit) client; if (InstallableUnit.MEMBER_TRANSLATED_PROPERTIES.equals(memberName)) { if (translationSupport == null) translationSupport = new TranslationSupport(this); return key instanceof KeyWithLocale ? translationSupport.getIUProperty(iu, (KeyWithLocale) key) : translationSupport.getIUProperty(iu, key.toString()); } return null; }
public synchronized Object getManagedProperty(Object client, String memberName, Object key) { if (!(client instanceof IInstallableUnit)) return null; IInstallableUnit iu = (IInstallableUnit) client; if (InstallableUnit.MEMBER_TRANSLATED_PROPERTIES.equals(memberName)) { if (translationSupport == null) translationSupport = new TranslationSupport(this); return key instanceof KeyWithLocale ? translationSupport.getIUProperty(iu, (KeyWithLocale) key) : translationSupport.getIUProperty(iu, key.toString()); } return null; }
public synchronized Object getManagedProperty(Object client, String memberName, Object key) { if (!(client instanceof IInstallableUnit)) return null; IInstallableUnit iu = (IInstallableUnit) client; if (InstallableUnit.MEMBER_TRANSLATED_PROPERTIES.equals(memberName)) { if (translationSupport == null) translationSupport = new TranslationSupport(this); return key instanceof KeyWithLocale ? translationSupport.getIUProperty(iu, (KeyWithLocale) key) : translationSupport.getIUProperty(iu, key.toString()); } return null; }
@Override public synchronized Object getManagedProperty(Object client, String memberName, Object key) { if (!(client instanceof IInstallableUnit)) return null; IInstallableUnit iu = (IInstallableUnit) client; if (InstallableUnit.MEMBER_TRANSLATED_PROPERTIES.equals(memberName)) { if (translationSupport == null) translationSupport = new TranslationSupport(this); return key instanceof KeyWithLocale ? translationSupport.getIUProperty(iu, (KeyWithLocale) key) : translationSupport.getIUProperty(iu, key.toString()); } return null; } }
public Object getManagedProperty(Object client, String memberName, Object key) { if (!(client instanceof IInstallableUnit)) return null; IInstallableUnit iu = (IInstallableUnit) client; if (InstallableUnit.MEMBER_PROFILE_PROPERTIES.equals(memberName) && key instanceof String) return getInstallableUnitProperty(iu, (String) key); if (InstallableUnit.MEMBER_TRANSLATED_PROPERTIES.equals(memberName)) { synchronized (this) { if (translationSupport == null) translationSupport = new TranslationSupport(this); return key instanceof KeyWithLocale ? translationSupport.getIUProperty(iu, (KeyWithLocale) key) : translationSupport.getIUProperty(iu, key.toString()); } } return null; }
@Override public Object getManagedProperty(Object client, String memberName, Object key) { if (!(client instanceof IInstallableUnit)) return null; IInstallableUnit iu = (IInstallableUnit) client; if (InstallableUnit.MEMBER_PROFILE_PROPERTIES.equals(memberName) && key instanceof String) return getInstallableUnitProperty(iu, (String) key); if (InstallableUnit.MEMBER_TRANSLATED_PROPERTIES.equals(memberName)) { synchronized (this) { if (translationSupport == null) translationSupport = new TranslationSupport(this); return key instanceof KeyWithLocale ? translationSupport.getIUProperty(iu, (KeyWithLocale) key) : translationSupport.getIUProperty(iu, key.toString()); } } return null; }