Example usage for org.eclipse.jgit.ignore IgnoreNode getRules

List of usage examples for org.eclipse.jgit.ignore IgnoreNode getRules

Introduction

In this page you can find the example usage for org.eclipse.jgit.ignore IgnoreNode getRules.

Prototype

public List<FastIgnoreRule> getRules() 

Source Link

Document

Get list of all ignore rules held by this node

Usage

From source file:com.github.shyiko.ijignore.IjignoreFileContentIndexingVoter.java

License:Apache License

private IgnoreNode parseIgnoreFile(VirtualFile file) throws IOException {
    InputStream inputStream = file.getInputStream();
    try {/*  w w w.  j  av  a 2  s .  c  o m*/
        IgnoreNode ignoreNode = new IgnoreNode();
        ignoreNode.parse(inputStream);
        if (!ignoreNode.getRules().isEmpty()) {
            return ignoreNode;
        }
    } finally {
        inputStream.close();
    }
    return null;
}

From source file:org.eclipse.ptp.internal.rdt.sync.git.core.GitSyncFileFilter.java

License:Open Source License

/**
 * Load filtering rules from the file system
 * @throws IOException/*from w w w  .j a v a2 s .c  o  m*/
 *          on problems reading from the file system
 */
public void loadFilter() throws IOException {
    Repository repo = jgitRepo.getRepository();
    File exclude = repo.getFS().resolve(repo.getDirectory(), Constants.INFO_EXCLUDE);
    if (exclude.exists()) {
        FileInputStream in = new FileInputStream(exclude);
        try {
            IgnoreNode node = new IgnoreNode();
            node.parse(in);
            for (org.eclipse.jgit.ignore.IgnoreRule rule : node.getRules()) {
                rules.add(new GitIgnoreRule(rule));
            }
        } finally {
            in.close();
        }
    } else {
        initialize(SyncManager.getDefaultFileFilter());
    }
}