예제 #1
0
 private void retrieve() {
   if (propertiesComponent.isValueSet(RefreshActionBase.OLD_EXCLUDE_IMPORT_LIST)) {
     setOldImportsAsPatternAndState(
         propertiesComponent.getValue(RefreshActionBase.OLD_EXCLUDE_IMPORT_LIST));
     propertiesComponent.unsetValue(RefreshActionBase.OLD_EXCLUDE_IMPORT_LIST);
   }
   if (propertiesComponent.isValueSet(RefreshActionBase.EXCLUDE_IMPORT_PATTERN)
       && propertiesComponent.isValueSet(RefreshActionBase.EXCLUDE_IMPORT_STATE)) {
     String[] excludeImportStates =
         propertiesComponent.getValues(RefreshActionBase.EXCLUDE_IMPORT_STATE);
     String[] excludeImportPatterns =
         propertiesComponent.getValues(RefreshActionBase.EXCLUDE_IMPORT_PATTERN);
     if (excludeImportPatterns != null && excludeImportStates != null) {
       List<ClassFilter> filters =
           getClassFiltersFromPatternAndState(excludeImportPatterns, excludeImportStates);
       this.setFilterList(filters);
     }
   } else {
     List<ClassFilter> filters = new ArrayList<>();
     ClassFilter filter1 = new ClassFilter(DEFAULT_PATTERN_1);
     ClassFilter filter2 = new ClassFilter(DEFAULT_PATTERN_2);
     filter1.setEnabled(true);
     filter2.setEnabled(true);
     filters.add(filter1);
     filters.add(filter2);
     this.setFilterList(filters);
   }
   this.setExcludeImportsCheckBoxValue(
       Boolean.parseBoolean(
           propertiesComponent.getValue(
               RefreshActionBase.EXCLUDE_IMPORT_CHECKBOX_VALUE,
               RefreshActionBase.EXCLUDE_IMPORT_DEFAULT_CHECKBOX_VALUE)));
 }
예제 #2
0
  public final List<ClassFilter> getClassFiltersFromPatternAndState(
      final String[] pExcludeImportPatterns, final String[] pExcludeImportStates) {

    List<ClassFilter> filtersList = new ArrayList<>();
    List<String> excludeImportPatterns = Arrays.asList(pExcludeImportPatterns);
    List<String> excludeImportStates = Arrays.asList(pExcludeImportStates);
    if (excludeImportPatterns.size() == excludeImportStates.size()
        && !containsOnlyEmptyString(excludeImportPatterns)
        && !containsOnlyEmptyString(excludeImportStates)) {
      for (int i = 0; i < excludeImportPatterns.size(); i++) {
        String pattern = excludeImportPatterns.get(i);
        boolean state = Boolean.valueOf(excludeImportStates.get(i));
        ClassFilter classFilter = new ClassFilter(pattern);
        classFilter.setEnabled(state);
        filtersList.add(classFilter);
      }
    }
    return filtersList;
  }