Class ConfigNameFilter


  • public class ConfigNameFilter
    extends AbstractConfigurationFilter
    Shows only variable where its name matches to a given regular expression.
    Author:
    El-Sharkawy
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.regex.Pattern namePattern  
    • Constructor Summary

      Constructors 
      Constructor Description
      ConfigNameFilter​(java.lang.String name)
      Creates a name filter.
      ConfigNameFilter​(java.lang.String name, boolean showAllNestedElements)
      Creates a name filter.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean checkVariable​(GUIVariable variable)
      Determines whether a given variable should be shown inside the editor or not.
      • Methods inherited from class org.eclipse.jface.viewers.ViewerFilter

        filter, filter, isFilterProperty
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • namePattern

        private java.util.regex.Pattern namePattern
    • Constructor Detail

      • ConfigNameFilter

        public ConfigNameFilter​(java.lang.String name)
                         throws java.util.regex.PatternSyntaxException
        Creates a name filter.
        Parameters:
        name - A regular expression, only variables matching to this regular expressions will be displayed.
        Throws:
        java.util.regex.PatternSyntaxException - If the expression's syntax is invalid
      • ConfigNameFilter

        public ConfigNameFilter​(java.lang.String name,
                                boolean showAllNestedElements)
                         throws java.util.regex.PatternSyntaxException
        Creates a name filter.
        Parameters:
        name - A regular expression, only variables matching to this regular expressions will be displayed.
        showAllNestedElements - whether nested elements of a shown variable will also be filtered
        Throws:
        java.util.regex.PatternSyntaxException - If the expression's syntax is invalid
    • Method Detail

      • checkVariable

        protected boolean checkVariable​(GUIVariable variable)
        Description copied from class: AbstractConfigurationFilter
        Determines whether a given variable should be shown inside the editor or not. Parents of variables which shall be shown should not be filtered. The AbstractConfigurationFilter ensures that.
        This method must also ensure that nested elements of a shown variable are also displayed. Therefore, this method should also be written in a recursive manner to check nested elements of displayed variables. This should be done in the following way:
        if(checkVariable(variable)) {
          for(GUIVariable nestedVariable : variable.getNestedVars()) {
            checkVariable(nestedVariable);
          }
        }
        Specified by:
        checkVariable in class AbstractConfigurationFilter
        Parameters:
        variable - The variable which should be tested whether it should be displayed inside the editor
        Returns:
        true if the variable should be displayed, false otherwise.