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