Nessuna descrizione
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.

GetChangesOverlayIcon.cs 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. using UnityEngine;
  2. using Codice.Client.BaseCommands;
  3. using Codice.Client.Commands;
  4. using Codice.ThemeImages;
  5. using PlasticGui.WorkspaceWindow.Merge;
  6. using PlasticGui.WorkspaceWindow.PendingChanges;
  7. using Unity.PlasticSCM.Editor.AssetsOverlays;
  8. using GluonIncomingChangeInfo = PlasticGui.Gluon.WorkspaceWindow.Views.IncomingChanges.IncomingChangeInfo;
  9. using GluonIncomingChangeCategory = PlasticGui.Gluon.WorkspaceWindow.Views.IncomingChanges.IncomingChangeCategory;
  10. namespace Unity.PlasticSCM.Editor.UI.Tree
  11. {
  12. static class GetChangesOverlayIcon
  13. {
  14. internal static Texture ForPlasticIncomingChange(
  15. MergeChangeInfo incomingChange,
  16. bool isSolvedConflict)
  17. {
  18. if (incomingChange.CategoryType == MergeChangesCategory.Type.FileConflicts ||
  19. incomingChange.CategoryType == MergeChangesCategory.Type.DirectoryConflicts)
  20. return ForConflict(isSolvedConflict);
  21. if (incomingChange.IsXLink())
  22. return ForXLink();
  23. if (incomingChange.CategoryType == MergeChangesCategory.Type.Deleted)
  24. return ForDeletedOnServer();
  25. if (incomingChange.CategoryType == MergeChangesCategory.Type.Changed)
  26. return ForOutOfDate();
  27. if (incomingChange.CategoryType == MergeChangesCategory.Type.Added)
  28. return ForAdded();
  29. return null;
  30. }
  31. internal static Texture ForGluonIncomingChange(
  32. GluonIncomingChangeInfo incomingChange,
  33. bool isSolvedConflict)
  34. {
  35. if (incomingChange.CategoryType == GluonIncomingChangeCategory.Type.Conflicted)
  36. return ForConflict(isSolvedConflict);
  37. if (incomingChange.IsXLink())
  38. return ForXLink();
  39. if (incomingChange.CategoryType == GluonIncomingChangeCategory.Type.Deleted)
  40. return ForDeletedOnServer();
  41. if (incomingChange.CategoryType == GluonIncomingChangeCategory.Type.Changed)
  42. return ForOutOfDate();
  43. if (incomingChange.CategoryType == GluonIncomingChangeCategory.Type.Added)
  44. return ForAdded();
  45. return null;
  46. }
  47. internal static Texture ForPendingChange(
  48. ChangeInfo changeInfo,
  49. bool isConflict)
  50. {
  51. if (isConflict)
  52. return ForConflicted();
  53. ItemIconImageType type = ChangeInfoView.
  54. GetIconImageType(changeInfo);
  55. if (ChangeTypesOperator.AreAllSet(
  56. changeInfo.ChangeTypes, ChangeTypes.Added))
  57. return ForAdded();
  58. switch (type)
  59. {
  60. case ItemIconImageType.Ignored:
  61. return ForIgnored();
  62. case ItemIconImageType.Private:
  63. return ForPrivated();
  64. case ItemIconImageType.Deleted:
  65. return ForDeleted();
  66. case ItemIconImageType.CheckedOut:
  67. return ForCheckedOut();
  68. default:
  69. return null;
  70. }
  71. }
  72. static Texture ForConflict(bool isResolved)
  73. {
  74. if (isResolved)
  75. return ForConflictResolved();
  76. return ForConflicted();
  77. }
  78. static Texture ForXLink()
  79. {
  80. return Images.GetImage(Images.Name.XLink);
  81. }
  82. static Texture ForIgnored()
  83. {
  84. return Images.GetIgnoredOverlayIcon();
  85. }
  86. static Texture ForPrivated()
  87. {
  88. return Images.GetPrivatedOverlayIcon();
  89. }
  90. static Texture ForAdded()
  91. {
  92. return Images.GetAddedOverlayIcon();
  93. }
  94. static Texture ForDeleted()
  95. {
  96. return Images.GetDeletedLocalOverlayIcon();
  97. }
  98. static Texture ForCheckedOut()
  99. {
  100. return Images.GetCheckedOutOverlayIcon();
  101. }
  102. static Texture ForDeletedOnServer()
  103. {
  104. return Images.GetDeletedRemoteOverlayIcon();
  105. }
  106. static Texture ForOutOfDate()
  107. {
  108. return Images.GetOutOfSyncOverlayIcon();
  109. }
  110. static Texture ForConflicted()
  111. {
  112. return Images.GetConflictedOverlayIcon();
  113. }
  114. static Texture ForConflictResolved()
  115. {
  116. return Images.GetConflictResolvedOverlayIcon();
  117. }
  118. }
  119. }