/**
   * @return The locales that should be topped. The default implementation returns the application
   *     and diagram locales from user settings along with all locales for which an entry exists in
   *     this input.
   */
  protected LinkedHashSet<Locale> getSuggestedLocales() {
    LinkedHashSet<Locale> result = new LinkedHashSet<Locale>(2);

    Configuration conf = ServiceLocator.get(ConfigurationManager.class).get();

    boolean isSetForLocale = false, isSetForDiagramLocale = false;

    Locale locale = conf.getLocale();
    for (LangString s : strings) {
      if (s.getLang().equals(locale)) {
        isSetForLocale = true;
        break;
      }
    }

    Locale diagramLocale = conf.getDiagramLocale();
    if (diagramLocale.equals(locale)) {
      isSetForDiagramLocale = isSetForLocale;
    } else {
      for (LangString s : strings) {
        if (s.getLang().equals(diagramLocale)) {
          isSetForDiagramLocale = true;
          break;
        }
      }
    }

    if (isSetForLocale) result.add(conf.getLocale());
    if (isSetForDiagramLocale) result.add(conf.getDiagramLocale());

    for (LangString s : strings) result.add(s.getLang());

    if (!isSetForLocale) result.add(conf.getLocale());
    if (!isSetForDiagramLocale) result.add(conf.getDiagramLocale());

    return result;
  }
 /**
  * Return the {@link LangString} from <code>strings</code> for the given {@link Locale}.
  *
  * @param l The locale which to find the {@link LangString} for.
  * @return The {@link LangString} from <code>strings</code> for the given {@link Locale} or <code>
  *     null</code> if the list doesn't contain any {@link LangString} for the given {@link
  *     Locale}.
  */
 protected LangString getLangString(Locale l) {
   for (LangString s : strings) {
     if (s.getLang().equals(l)) return s;
   }
   return null;
 }