final Session session)
{
eventBus_ = eventBus;
globalDisplay_ = globalDisplay;
session_ = session;
final HandlerRegistrations registrations = new HandlerRegistrations();
registrations.add(eventBus_.addHandler(VcsRefreshEvent.TYPE, new VcsRefreshHandler()
{
@Override
public void onVcsRefresh(VcsRefreshEvent event)
{
if (!session.getSessionInfo().isVcsEnabled())
registrations.removeHandler();
if (event.getDelayMs() > 0)
{
Scheduler.get().scheduleFixedDelay(new RepeatingCommand()
{
@Override
public boolean execute()
{
refresh(false);
return false;
}
}, event.getDelayMs());
}
else
{
Scheduler.get().scheduleDeferred(new ScheduledCommand()
{
@Override
public void execute()
{
refresh(false);
}
});
}
}
}));
registrations.add(eventBus_.addHandler(FileChangeEvent.TYPE, new FileChangeHandler()
{
@Override
public void onFileChange(FileChangeEvent event)
{
if (!session.getSessionInfo().isVcsEnabled())
registrations.removeHandler();
FileChange fileChange = event.getFileChange();
FileSystemItem file = fileChange.getFile();
StatusAndPath status = StatusAndPath.fromInfo(