コード例 #1
0
 /**
  * Attempt to localize the provided key. Return the localized variant if found or the key itself
  * otherwise.
  *
  * @param key the possible key reference
  * @param modelElement the defining model element
  * @return the localized variant if found, or the key
  */
 private String localize(String key, MApplicationElement modelElement) {
   if (key == null) {
     return null;
   }
   String localized = LocalizationHelper.getLocalized(key, modelElement);
   return localized == null ? key : localized;
 }
コード例 #2
0
 private void defineContexts(MBindingContext parent, MBindingContext current) {
   if (current.getName() == null || current.getElementId() == null) {
     logger.error("Binding context name or id is null for: " + current); // $NON-NLS-1$
     return;
   }
   Context context = contextManager.getContext(current.getElementId());
   if (!context.isDefined()) {
     String localizedName =
         LocalizationHelper.getLocalized(current.getName(), current, application.getContext());
     String localizedDescriptor =
         LocalizationHelper.getLocalized(
             current.getDescription(), current, application.getContext());
     context.define(
         localizedName, localizedDescriptor, parent == null ? null : parent.getElementId());
   }
   for (MBindingContext child : current.getChildren()) {
     defineContexts(current, child);
   }
 }