b486678290
Library -Artifacts
106 lines
4.1 KiB
C#
106 lines
4.1 KiB
C#
using System;
|
|
|
|
using Codice.Client.Common;
|
|
using Codice.CM.Common;
|
|
using PlasticGui.WorkspaceWindow;
|
|
using Unity.PlasticSCM.Editor.UI;
|
|
using Unity.PlasticSCM.Editor.UI.StatusBar;
|
|
|
|
using GluonNewIncomingChangesUpdater = PlasticGui.Gluon.WorkspaceWindow.NewIncomingChangesUpdater;
|
|
using GluonCheckIncomingChanges = PlasticGui.Gluon.WorkspaceWindow.CheckIncomingChanges;
|
|
|
|
namespace Unity.PlasticSCM.Editor
|
|
{
|
|
internal static class NewIncomingChanges
|
|
{
|
|
internal static NewIncomingChangesUpdater BuildUpdaterForDeveloper(
|
|
WorkspaceInfo wkInfo,
|
|
ViewSwitcher viewSwitcher,
|
|
IIncomingChangesNotifier incomingChangesNotifier,
|
|
CheckIncomingChanges.IAutoRefreshIncomingChangesView autoRefreshIncomingChangesView,
|
|
CheckIncomingChanges.IUpdateIncomingChanges updateIncomingChanges)
|
|
{
|
|
if (!ClientConfig.Get().GetClientConfigData().IsIncomingChangesEnabled())
|
|
return null;
|
|
|
|
NewIncomingChangesUpdater updater = new NewIncomingChangesUpdater(
|
|
new UnityPlasticTimerBuilder(),
|
|
new CheckIncomingChanges.CalculateIncomingChanges(),
|
|
updateIncomingChanges);
|
|
updater.SetAutoRefreshIncomingChangesView(
|
|
autoRefreshIncomingChangesView);
|
|
|
|
viewSwitcher.SetNewIncomingChanges(
|
|
updater, null, incomingChangesNotifier);
|
|
|
|
updater.SetWorkspace(wkInfo);
|
|
updater.Start();
|
|
return updater;
|
|
}
|
|
|
|
internal static GluonNewIncomingChangesUpdater BuildUpdaterForGluon(
|
|
WorkspaceInfo wkInfo,
|
|
ViewSwitcher viewSwitcher,
|
|
IIncomingChangesNotifier incomingChangesNotifier,
|
|
GluonCheckIncomingChanges.IAutoRefreshIncomingChangesView autoRefreshIncomingChangesView,
|
|
GluonCheckIncomingChanges.IUpdateIncomingChanges updateIncomingChanges,
|
|
GluonCheckIncomingChanges.ICalculateIncomingChanges calculateIncomingChanges)
|
|
{
|
|
if (!ClientConfig.Get().GetClientConfigData().IsGluonIncomingChangesEnabled())
|
|
return null;
|
|
|
|
GluonNewIncomingChangesUpdater updater = new GluonNewIncomingChangesUpdater(
|
|
wkInfo,
|
|
new UnityPlasticTimerBuilder(),
|
|
updateIncomingChanges,
|
|
autoRefreshIncomingChangesView,
|
|
calculateIncomingChanges);
|
|
|
|
viewSwitcher.SetNewIncomingChanges(
|
|
null, updater, incomingChangesNotifier);
|
|
|
|
updater.Start();
|
|
return updater;
|
|
}
|
|
|
|
internal static void LaunchUpdater(
|
|
NewIncomingChangesUpdater developerNewIncomingChangesUpdater,
|
|
GluonNewIncomingChangesUpdater gluonNewIncomingChangesUpdater)
|
|
{
|
|
if (developerNewIncomingChangesUpdater != null)
|
|
{
|
|
developerNewIncomingChangesUpdater.Start();
|
|
developerNewIncomingChangesUpdater.Update(DateTime.Now);
|
|
}
|
|
|
|
if (gluonNewIncomingChangesUpdater != null)
|
|
{
|
|
gluonNewIncomingChangesUpdater.Start();
|
|
gluonNewIncomingChangesUpdater.Update(DateTime.Now);
|
|
}
|
|
}
|
|
|
|
internal static void StopUpdater(
|
|
NewIncomingChangesUpdater developerNewIncomingChangesUpdater,
|
|
GluonNewIncomingChangesUpdater gluonNewIncomingChangesUpdater)
|
|
{
|
|
if (developerNewIncomingChangesUpdater != null)
|
|
developerNewIncomingChangesUpdater.Stop();
|
|
|
|
if (gluonNewIncomingChangesUpdater != null)
|
|
gluonNewIncomingChangesUpdater.Stop();
|
|
}
|
|
|
|
internal static void DisposeUpdater(
|
|
NewIncomingChangesUpdater developerNewIncomingChangesUpdater,
|
|
GluonNewIncomingChangesUpdater gluonNewIncomingChangesUpdater)
|
|
{
|
|
if (developerNewIncomingChangesUpdater != null)
|
|
developerNewIncomingChangesUpdater.Dispose();
|
|
|
|
if (gluonNewIncomingChangesUpdater != null)
|
|
gluonNewIncomingChangesUpdater.Dispose();
|
|
}
|
|
}
|
|
}
|