org.netbeans.lib.cvsclient.util
Class DefaultIgnoreFileFilter

java.lang.Object
  extended by org.netbeans.lib.cvsclient.util.DefaultIgnoreFileFilter
All Implemented Interfaces:
IgnoreFileFilter

public class DefaultIgnoreFileFilter
extends Object
implements IgnoreFileFilter

Author:
Milos Kleint, Thomas Singer

Constructor Summary
DefaultIgnoreFileFilter()
           
DefaultIgnoreFileFilter(List patternList)
          Creates new DefaultIgnoreFileFilter and fills in patterns.
 
Method Summary
 void addPattern(String pattern)
          Adds a string to the list of ignore file patters using the SimpleStringPattern.
 void addPattern(StringPattern pattern)
          Adds a StringPattern to the list of ignore file patters.
 void clearPatterns()
          Clears the list of patters.
static List parseCvsIgnoreFile(File cvsIgnoreFile)
          Utility method that reads the .cvsignore file and returns a list of Strings.
 boolean shouldBeIgnored(File directory, String noneCvsFile)
          A file is checked against the patterns in the filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultIgnoreFileFilter

public DefaultIgnoreFileFilter()

DefaultIgnoreFileFilter

public DefaultIgnoreFileFilter(List patternList)
Creates new DefaultIgnoreFileFilter and fills in patterns.

Parameters:
patternList - - list of objects, patterns are retrieved via the Object.toString() method.
Method Detail

addPattern

public void addPattern(StringPattern pattern)
Adds a StringPattern to the list of ignore file patters.


addPattern

public void addPattern(String pattern)
Adds a string to the list of ignore file patters using the SimpleStringPattern.


clearPatterns

public void clearPatterns()
Clears the list of patters. To be used when the "!" character is used in any of the .cvsignore lists.


shouldBeIgnored

public boolean shouldBeIgnored(File directory,
                               String noneCvsFile)
A file is checked against the patterns in the filter. If any of these matches, the file should be ignored. A file will also be ignored, if its name matches any local .cvsignore file entry.

Specified by:
shouldBeIgnored in interface IgnoreFileFilter
Parameters:
directory - is a file object that refers to the directory the file resides in.
noneCvsFile - is the name of the file to be checked.

parseCvsIgnoreFile

public static List parseCvsIgnoreFile(File cvsIgnoreFile)
                               throws IOException,
                                      FileNotFoundException
Utility method that reads the .cvsignore file and returns a list of Strings. These strings represent the patterns read from the file.

Throws:
IOException
FileNotFoundException


Copyright © 2011. All Rights Reserved.