title: How to filter a list of required elements in list using listviewer in swt jface
body: <p>I have created a list using SWT which displays a list of animals ex:cat,dog,camel,elephant. and now I need to search for a specific animal ex dog in search coloumn andonly that animal has to be displayed in the list. I have written the code to filter the list  but the list is not getting filtered and I am not able to find where the problem is. The sample code is as follows</p>
  
  <pre><code>final List list = new List(listComposite, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
  
  
              gridData = new GridData();
              gridData.horizontalAlignment = SWT.FILL;
              gridData.grabExcessHorizontalSpace = true;
              gridData.verticalAlignment = SWT.FILL;
              gridData.grabExcessVerticalSpace = true;
              list.setLayoutData(gridData);
  
  
              final Map&lt;String,String&gt; descriptionMappernewer = DescriptionParsers.getListOfFXToolMethods();
              for(String key: descriptionMappernewer.keySet())
                  list.add(key);
  
  
               final MyFilter filter = new MyFilter();
  
              final ListViewer viewer = new ListViewer(listComposite);
              //viewer.getList();
              viewer.getList().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
              //viewer.getList();
              viewer.setContentProvider(new ArrayContentProvider());
              viewer.setInput(list);
              //viewer.setComparer( list);
  
  
              /*
              comparator = new MyViewerComparator();
              viewer.setComparator(comparator);
              viewer.setSorter(sorter);
              */
  
              txtName.addListener(SWT.Verify, new Listener()
              {
                  @Override
                  public void handleEvent(Event e)
                  {
                      final String oldS = ((Text) e.widget).getText();
                      final String newS = oldS.substring(0, e.start) + e.text + oldS.substring(e.end);
                      System.out.println(newS);
                      //MyFilter filter;
                      filter.setSearchText(newS);
                      viewer.refresh();
                  }
              });
              viewer.addFilter(filter);
  </code></pre>
  
  <p>The MyFilterClass is as follows</p>
  
  <pre><code>private static class MyFilter extends ViewerFilter
      {
          private String searchString;
  
          public void setSearchText(String s)
          {
              this.searchString = ".*" + s + ".*";
              System.out.println(s);
          }
  
          @Override
          public boolean select(Viewer viewer, Object parentElement, Object element)
          {
              if (searchString == null || searchString.length() == 0)
              {
                  System.out.println("no string");
                  return true;
              }
  
              String p = (String) element;
  
              if (p.matches(searchString))
              {
                  System.out.println(searchString);
                  return true;
              }
  
              return false;
          }
      }    
  </code></pre>
  
  <p>Please help me to filter the list as I am new to jface not able to find the error</p>