예제 #1
0
    public void saveFilters(LogFilter[] filters) {
      StringBuilder sb = new StringBuilder();
      for (LogFilter f : filters) {
        String filterString = f.toString();
        sb.append(filterString);
        sb.append('|');
      }

      DdmsPlugin.getDefault().getPreferenceStore().setValue(PREFS_FILTERS, sb.toString());
    }
예제 #2
0
    public LogFilter[] getFilterFromStore() {
      String filterPrefs = DdmsPlugin.getDefault().getPreferenceStore().getString(PREFS_FILTERS);

      // split in a string per filter
      String[] filters = filterPrefs.split("\\|"); // $NON-NLS-1$

      ArrayList<LogFilter> list = new ArrayList<LogFilter>(filters.length);

      for (String f : filters) {
        if (f.length() > 0) {
          LogFilter logFilter = new LogFilter();
          if (logFilter.loadFromString(f)) {
            list.add(logFilter);
          }
        }
      }

      return list.toArray(new LogFilter[list.size()]);
    }