Пример #1
0
 public Map<String, String> getParameterMapFromConfiguration(final Configuration configuration) {
   final Map<String, String> result = new HashMap<String, String>();
   for (final Parameter p : configuration.getParameters()) {
     if (p.getValue() != null) {
       result.put(p.getName(), p.getValue());
     }
   }
   return result;
 }
 @Override
 public void run() {
   if (filePath == null) {
     final FileDialog fd = new FileDialog(Display.getDefault().getActiveShell(), SWT.OPEN);
     fd.setFilterExtensions(new String[] {"*.properties"});
     filePath = fd.open();
   }
   if (filePath != null) {
     final Properties p = loadProperties(filePath);
     for (final Entry<Object, Object> entry : p.entrySet()) {
       final String name = (String) entry.getKey();
       final String value = (String) entry.getValue();
       for (final Parameter param : configuration.getParameters()) {
         if (param.getName().equals(name)) {
           param.setValue(value);
         }
       }
     }
   }
 }