Example usage for org.eclipse.jgit.events RefsChangedEvent RefsChangedEvent

List of usage examples for org.eclipse.jgit.events RefsChangedEvent RefsChangedEvent

Introduction

In this page you can find the example usage for org.eclipse.jgit.events RefsChangedEvent RefsChangedEvent.

Prototype

RefsChangedEvent

Source Link

Usage

From source file:org.cicomponents.git.impl.AbstractLocalGitMonitor.java

License:Mozilla Public License

@SneakyThrows
protected void pull() {
    synchronized (git) {
        git.pull().setRebase(true).call();
        RefsChangedEvent event = new RefsChangedEvent();
        event.setRepository(git.getRepository());
        emitRevisionIfNecessary(event);//from   ww  w.j a  v  a 2 s.  c  o m
    }
}

From source file:org.cicomponents.git.impl.LatestRevisionGitBranchMonitor.java

License:Mozilla Public License

private void checkLatest() throws IOException {
    synchronized (git) {
        String headRefName = git.getRepository().findRef("refs/heads/" + branch).getObjectId().getName();
        String knownHead = (String) persistentMap.get(headRefName);
        if (knownHead != null) {
            head = ObjectId.fromString(knownHead);
        }//from   w w w  . j a va2 s  .c o m
        RefsChangedEvent event = new RefsChangedEvent();
        event.setRepository(git.getRepository());
        git.getRepository().fireEvent(event);
    }
}

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

License:Open Source License

public void execute(IProgressMonitor monitor) throws CoreException {
    IWorkspaceRunnable action = new IWorkspaceRunnable() {

        public void run(IProgressMonitor pm) throws CoreException {
            pm.beginTask("", 1); //$NON-NLS-1$
            StashDropCommand command = Git.wrap(repo).stashDrop();
            command.setStashRef(index);//w  ww  .j  a  v  a 2s.  c  om
            try {
                command.call();
                repo.fireEvent(new RefsChangedEvent());
            } catch (JGitInternalException e) {
                throw new TeamException(e.getLocalizedMessage(), e.getCause());
            } catch (GitAPIException e) {
                throw new TeamException(e.getLocalizedMessage(), e.getCause());
            } finally {
                pm.done();
            }
        }
    };
    ResourcesPlugin.getWorkspace().run(action, monitor != null ? monitor : new NullProgressMonitor());
}