コード例 #1
0
  public void store(final IDialogSettings settings) {
    settings.put("searchString", filterPattern.getFilterExpression());
    settings.put("isCaseSensitive", filterPattern.isCaseSensitive());
    settings.put("isRegularExpression", filterPattern.isRegularExpression());

    for (Entry<String, Boolean> entry : filterPattern.getEventsToFilter().entrySet()) {
      settings.put(entry.getKey(), entry.getValue());
    }

    for (Entry<Field, Boolean> entry : filterPattern.getFieldsToFilter().entrySet()) {
      settings.put(entry.getKey().toString(), entry.getValue());
    }

    settings.put("scope", this.scope);

    if (workingSets != null) {
      String[] wsIds = new String[workingSets.length];
      for (int i = 0; i < workingSets.length; i++) {
        wsIds[i] = workingSets[i].getName();
      }
      settings.put("workingSets", wsIds);
    } else {
      settings.put("workingSets", new String[0]);
    }
  }
コード例 #2
0
  public static SearchPattern create(final IDialogSettings settings) {
    String loadedSearchString = settings.get("searchString");
    boolean loadedIsCaseSensitive = settings.getBoolean("isCaseSensitive");
    boolean loadedIsRegularExpression = settings.getBoolean("isRegularExpression");

    SortedMap<String, Boolean> loadedEvents = new TreeMap<String, Boolean>();
    for (String entry : Constants.EVENT_CATEGORIES.keySet()) {
      loadedEvents.put(entry, settings.getBoolean(entry));
    }

    Map<Field, Boolean> loadedLimitTo = new HashMap<Field, Boolean>();
    loadedLimitTo.put(Field.SOURCE_INFO, settings.getBoolean(Field.SOURCE_INFO.toString()));
    loadedLimitTo.put(Field.MESSAGE, settings.getBoolean(Field.MESSAGE.toString()));

    FilterPattern loadedFilterPattern =
        new FilterPattern(
            loadedSearchString, loadedLimitTo, loadedIsCaseSensitive, loadedIsRegularExpression);
    loadedFilterPattern.setEventsToFilter(loadedEvents, true, false);

    String[] wsIds = settings.getArray("workingSets"); // $NON-NLS-1$
    IWorkingSet[] workingSets = null;
    if (wsIds != null && wsIds.length > 0) {
      IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
      workingSets = new IWorkingSet[wsIds.length];
      for (int i = 0; workingSets != null && i < wsIds.length; i++) {
        workingSets[i] = workingSetManager.getWorkingSet(wsIds[i]);
        if (workingSets[i] == null) {
          workingSets = null;
        }
      }
    }

    return new SearchPattern(loadedFilterPattern, settings.getInt("scope"), workingSets);
  }
コード例 #3
0
 public boolean match(final LogRecord record) {
   return filterPattern.match(record);
 }
コード例 #4
0
 public boolean isRegularExpression() {
   return filterPattern.isRegularExpression();
 }
コード例 #5
0
 public boolean isCaseSensitive() {
   return filterPattern.isCaseSensitive();
 }
コード例 #6
0
 public Map<Field, Boolean> getLimitTo() {
   return filterPattern.getFieldsToFilter();
 }
コード例 #7
0
 public String getSearchString() {
   return filterPattern.getFilterExpression();
 }
コード例 #8
0
 public SortedMap<String, Boolean> getEvents() {
   return filterPattern.getEventsToFilter();
 }