Пример #1
0
 /**
  * Use the supplied log to display the current settings.
  *
  * @param log Log to send output to.
  */
 public void show(ILog log) {
   StringBuilder info = new StringBuilder();
   info.append(TextUI.box(TextUI.fmt(Resources.INFO_SETTINGS_HEADING)));
   for (Entry<String, String> kv : settings.entrySet()) {
     info.append(String.format("%-12s = %s\n", kv.getKey(), kv.getValue()));
   }
   log.log(new Status(Status.INFO, Activator.PLUGIN_ID, info.toString()));
 }
Пример #2
0
      public void validate() throws VictimsException {

        List<String> modes = new ArrayList<String>();
        modes.add(MODE_FATAL);
        modes.add(MODE_WARNING);
        modes.add(MODE_DISABLED);

        List<String> modeSettings = new ArrayList<String>();
        modeSettings.add(METADATA);
        modeSettings.add(FINGERPRINT);

        for (String item : modeSettings) {
          String value = settings.get(item);
          if (value == null) {
            throw new VictimsException(TextUI.fmt(Resources.ERR_SETTING_MISSING, item));
          }

          if (!modes.contains(value)) {
            String err = TextUI.fmt(Resources.ERR_INVALID_MODE, value, item, modes.toString());
            throw new VictimsException(err);
          }
        }
      }