Example usage for org.eclipse.jgit.internal.storage.file GC setProgressMonitor

List of usage examples for org.eclipse.jgit.internal.storage.file GC setProgressMonitor

Introduction

In this page you can find the example usage for org.eclipse.jgit.internal.storage.file GC setProgressMonitor.

Prototype

public GC setProgressMonitor(ProgressMonitor pm) 

Source Link

Document

Set the progress monitor used for garbage collection methods.

Usage

From source file:org.eclipse.egit.core.op.GarbageCollectOperation.java

License:Open Source License

/**
 * Execute garbage collection/*  www. j  ava 2 s. c o  m*/
 */
public void execute(IProgressMonitor monitor) throws CoreException {
    GC gc = new GC((FileRepository) repository);
    gc.setProgressMonitor(new EclipseGitProgressTransformer(monitor));
    try {
        gc.gc();
    } catch (IOException e) {
        throw new CoreException(new Status(IStatus.ERROR, Activator.getPluginId(), e.getMessage(), e));
    } catch (ParseException e) {
        throw new CoreException(new Status(IStatus.ERROR, Activator.getPluginId(), e.getMessage(), e));
    }
}

From source file:org.eclipse.orion.server.git.jobs.GitJobUtils.java

License:Open Source License

/**
 * Calls pack refs for a given repository
 * //from w  w w  .  jav  a2 s. c o  m
 * @param Repository
 *            the git repository
 */
public static void packRefs(Repository repo, ProgressMonitor monitor) {
    if (repo != null && repo instanceof FileRepository) {
        GC gc = new GC(((FileRepository) repo));
        gc.setProgressMonitor(monitor);
        try {
            gc.packRefs();
        } catch (IOException ex) {
            // ignore IOException since packing is an optimization (not essential for the callers doClone/doFetch) 
        }
    }
}