No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

IncomingChangesNotifier.cs 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using PlasticGui.WorkspaceWindow;
  2. using Unity.PlasticSCM.Editor.UI.StatusBar;
  3. namespace Unity.PlasticSCM.Editor.Developer
  4. {
  5. internal class IncomingChangesNotifier :
  6. IIncomingChangesNotifier,
  7. CheckIncomingChanges.IUpdateIncomingChanges
  8. {
  9. bool IIncomingChangesNotifier.HasNotification
  10. {
  11. get { return mHasNotification; }
  12. }
  13. IncomingChangesNotification IIncomingChangesNotifier.Notification
  14. {
  15. get { return mNotification; }
  16. }
  17. internal IncomingChangesNotifier(
  18. PlasticWindow plasticWindow)
  19. {
  20. mPlasticWindow = plasticWindow;
  21. }
  22. void CheckIncomingChanges.IUpdateIncomingChanges.Hide()
  23. {
  24. PlasticPlugin.SetNotificationStatus(
  25. mPlasticWindow,
  26. PlasticNotification.Status.None);
  27. mNotification.Clear();
  28. mHasNotification = false;
  29. mPlasticWindow.Repaint();
  30. }
  31. void CheckIncomingChanges.IUpdateIncomingChanges.Show(
  32. string infoText,
  33. string actionText,
  34. string tooltipText,
  35. CheckIncomingChanges.Severity severity,
  36. CheckIncomingChanges.Action action)
  37. {
  38. PlasticNotification.Status status = PlasticNotification.Status.None;
  39. if (severity == CheckIncomingChanges.Severity.Info)
  40. status = PlasticNotification.Status.IncomingChanges;
  41. else if (severity == CheckIncomingChanges.Severity.Warning)
  42. status = PlasticNotification.Status.Conflicts;
  43. PlasticPlugin.SetNotificationStatus(
  44. mPlasticWindow,
  45. status);
  46. UpdateData(
  47. mNotification,
  48. infoText,
  49. actionText,
  50. tooltipText,
  51. status,
  52. action);
  53. mHasNotification = true;
  54. mPlasticWindow.Repaint();
  55. }
  56. static void UpdateData(
  57. IncomingChangesNotification data,
  58. string infoText,
  59. string actionText,
  60. string tooltipText,
  61. PlasticNotification.Status status,
  62. CheckIncomingChanges.Action action)
  63. {
  64. data.InfoText = infoText;
  65. data.ActionText = actionText;
  66. data.TooltipText = tooltipText;
  67. data.HasUpdateAction = action == CheckIncomingChanges.Action.Update;
  68. data.Status = status;
  69. }
  70. bool mHasNotification;
  71. IncomingChangesNotification mNotification = new IncomingChangesNotification();
  72. PlasticWindow mPlasticWindow;
  73. }
  74. }