Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit » Use of RepositoryListener (especially RefsChangedListener)
icon5.gif  Use of RepositoryListener (especially RefsChangedListener) [message #1061649] Mon, 03 June 2013 11:52 Go to next message
Frank Blechschmidt is currently offline Frank BlechschmidtFriend
Messages: 1
Registered: June 2013
Junior Member
Hi! Smile

Is there an Example how to use RefsChangedListener or any other Listener?
I want to get notified if a user do a pull on a local repository.

GitListener listener = new GitListener(String name);
Repository localRepo = new FileRepository(gitPath); //gitPath is like C:\Users\frabl_000\SoCoTestGit\socoLocal\socoLocal\.git
localRepo.getListenerList().addRefsChangedListener(listener);


Does the onRefsChanged() only get called if you use the localRepo variable or will it also be called if you modify the repository via command line or EGit?

My Goal:
Get notified if the user pull from origin; reset a HashMap which saves if a file was opened.

Best regards
Frank
Re: Use of RepositoryListener (especially RefsChangedListener) [message #1061984 is a reply to message #1061649] Wed, 05 June 2013 09:12 Go to previous message
Stefan Lay is currently offline Stefan LayFriend
Messages: 342
Registered: July 2009
Senior Member
AFAIK the listeners are only notified on the instance where they are registered.

In EGit there is a dedicated class which periodically scans the repos if they are changed by others: org.eclipse.egit.ui.Activator.RepositoryChangeScanner

You may have a look there to find inspiration for your task.

Stefan
Previous Topic:"Switch to" list is empty
Next Topic:[Newbie] New Repository without moving original files
Goto Forum:
  


Current Time: Fri Dec 19 16:03:11 GMT 2014

Powered by FUDForum. Page generated in 0.02357 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software