Java Code Examples for org.eclipse.jgit.treewalk.filter.PathFilter#include()

The following examples show how to use org.eclipse.jgit.treewalk.filter.PathFilter#include() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StatusCommand.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Any filter includes this path but only by denoting any of it's ancestors or the path itself
 * Any filter that applies to a file/folder under the given path will not be taken into account
 * @param filters
 * @param treeWalk
 * @return 
 */
public static boolean includes (Collection<PathFilter> filters, TreeWalk treeWalk) {
    boolean retval = filters.isEmpty();
    for (PathFilter filter : filters) {
        if (filter.include(treeWalk) && treeWalk.getPathString().length() >= filter.getPath().length()) {
            retval = true;
            break;
        }
    }
    return retval;
}
 
Example 2
Source File: Utils.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Returns true if the current file/folder specified by the given TreeWalk lies under any of the given filters
 * @param treeWalk
 * @param filters
 * @return
 */
public static boolean isUnderOrEqual (TreeWalk treeWalk, Collection<PathFilter> filters) {
    boolean retval = filters.isEmpty();
    for (PathFilter filter : filters) {
        if (filter.include(treeWalk) && treeWalk.getPathString().length() >= filter.getPath().length()) {
            retval = true;
            break;
        }
    }
    return retval;
}