private void saveRepositories(String key, Set<IHgRepositoryLocation> locations) {
   if (locations == null || locations.isEmpty()) {
     return;
   }
   IPreferenceStore store = MercurialEclipsePlugin.getDefault().getPreferenceStore();
   StringBuilder sb = new StringBuilder();
   for (IHgRepositoryLocation repo : locations) {
     String line = delegator.delegateCreate(repo);
     if (line != null) {
       sb.append(line);
       sb.append('|');
     }
   }
   store.setValue(key, sb.toString());
 }
 private Set<IHgRepositoryLocation> loadRepositories(String key) {
   Set<IHgRepositoryLocation> locations = new LinkedHashSet<IHgRepositoryLocation>();
   IPreferenceStore store = MercurialEclipsePlugin.getDefault().getPreferenceStore();
   String allReposLine = store.getString(key);
   if (StringUtils.isEmpty(allReposLine)) {
     return locations;
   }
   String[] repoLine = allReposLine.split("\\|");
   for (String line : repoLine) {
     if (line == null || line.length() == 0) {
       continue;
     }
     try {
       IHgRepositoryLocation loc = delegator.delegateParse(line);
       if (loc != null) {
         locations.add(loc);
       }
     } catch (Exception e) {
       // log exception, but don't bother the user with it.
       MercurialEclipsePlugin.logError(e);
     }
   }
   return locations;
 }