Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
jyb-games
Commits
1c847220
Commit
1c847220
authored
Jun 28, 2021
by
jang dong hyeok
Browse files
.
parent
076f0c68
Changes
638
Show whitespace changes
Inline
Side-by-side
Too many changes to show.
To preserve performance only
638 of 638+
files are displayed.
Plain diff
Email patch
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Developer/IncomingChangesNotificationPanel.cs
0 → 100644
View file @
1c847220
using
UnityEditor
;
using
PlasticGui.WorkspaceWindow
;
namespace
Unity.PlasticSCM.Editor.Developer
{
internal
class
IncomingChangesNotificationPanel
:
IIncomingChangesNotificationPanel
,
CheckIncomingChanges
.
IUpdateIncomingChanges
{
bool
IIncomingChangesNotificationPanel
.
IsVisible
{
get
{
return
mIsVisible
;
}
}
NotificationPanelData
IIncomingChangesNotificationPanel
.
Data
{
get
{
return
mPanelData
;
}
}
internal
IncomingChangesNotificationPanel
(
EditorWindow
window
)
{
mWindow
=
window
;
}
void
CheckIncomingChanges
.
IUpdateIncomingChanges
.
Hide
()
{
mPanelData
.
Clear
();
mIsVisible
=
false
;
mWindow
.
Repaint
();
}
void
CheckIncomingChanges
.
IUpdateIncomingChanges
.
Show
(
string
infoText
,
string
actionText
,
string
tooltipText
,
CheckIncomingChanges
.
Severity
severity
,
CheckIncomingChanges
.
Action
action
)
{
UpdateData
(
mPanelData
,
infoText
,
actionText
,
tooltipText
,
severity
,
action
);
mIsVisible
=
true
;
mWindow
.
Repaint
();
}
static
void
UpdateData
(
NotificationPanelData
data
,
string
infoText
,
string
actionText
,
string
tooltipText
,
CheckIncomingChanges
.
Severity
severity
,
CheckIncomingChanges
.
Action
action
)
{
data
.
HasUpdateAction
=
action
==
CheckIncomingChanges
.
Action
.
Update
;
data
.
InfoText
=
infoText
;
data
.
ActionText
=
actionText
;
data
.
TooltipText
=
tooltipText
;
data
.
NotificationStyle
=
severity
==
CheckIncomingChanges
.
Severity
.
Info
?
NotificationPanelData
.
StyleType
.
Green
:
NotificationPanelData
.
StyleType
.
Red
;
}
bool
mIsVisible
;
NotificationPanelData
mPanelData
=
new
NotificationPanelData
();
EditorWindow
mWindow
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Developer/ProgressOperationHandler.cs
0 → 100644
View file @
1c847220
using
Codice.Client.BaseCommands
;
using
Codice.Client.Commands.CheckIn
;
using
Codice.Client.Common
;
using
Codice.CM.Common
;
using
PlasticGui
;
using
PlasticGui.WorkspaceWindow
;
namespace
Unity.PlasticSCM.Editor.Developer
{
internal
class
ProgressOperationHandler
{
internal
ProgressOperationHandler
(
WorkspaceInfo
wkInfo
,
PlasticGUIClient
guiClient
)
{
mWkInfo
=
wkInfo
;
mGuiClient
=
guiClient
;
}
internal
void
Update
(
double
elapsedSeconds
)
{
if
(
mUpdateProgress
==
null
)
return
;
mSecondsSinceLastProgressUpdate
+=
elapsedSeconds
;
if
(
mSecondsSinceLastProgressUpdate
>
UPDATE_INTERVAL_SECONDS
)
{
mUpdateProgress
.
OnUpdateProgress
();
mSecondsSinceLastProgressUpdate
-=
UPDATE_INTERVAL_SECONDS
;
}
}
internal
bool
CheckOperationInProgress
()
{
if
(
IsOperationInProgress
())
{
GuiMessage
.
ShowInformation
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
OperationRunning
),
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
OperationInProgress
));
return
true
;
}
return
false
;
}
internal
bool
IsOperationInProgress
()
{
return
mProgress
!=
null
||
mUpdateProgress
!=
null
||
mCheckinProgress
!=
null
;
}
internal
void
ShowProgress
()
{
mProgress
=
new
GenericProgress
(
mGuiClient
);
}
internal
void
RefreshProgress
(
ProgressData
progressData
)
{
mProgress
.
RefreshProgress
(
progressData
);
}
internal
void
EndProgress
()
{
mProgress
=
null
;
mGuiClient
.
Progress
.
ResetProgress
();
mGuiClient
.
RequestRepaint
();
}
internal
void
ShowUpdateProgress
(
string
title
,
UpdateNotifier
notifier
)
{
mUpdateProgress
=
new
UpdateProgress
(
notifier
,
mWkInfo
.
ClientPath
,
title
,
mGuiClient
);
mUpdateProgress
.
OnUpdateProgress
();
mSecondsSinceLastProgressUpdate
=
0
;
}
internal
void
ShowCheckinProgress
()
{
mCheckinProgress
=
new
CheckinProgress
(
mWkInfo
,
mGuiClient
);
}
internal
void
RefreshCheckinProgress
(
CheckinStatus
checkinStatus
,
BuildProgressSpeedAndRemainingTime
.
ProgressData
progressData
)
{
mCheckinProgress
.
Refresh
(
checkinStatus
,
progressData
);
}
internal
void
CancelCheckinProgress
()
{
mCheckinProgress
.
CancelPressed
=
true
;
}
internal
void
EndUpdateProgress
()
{
mUpdateProgress
=
null
;
mGuiClient
.
Progress
.
ResetProgress
();
mGuiClient
.
RequestRepaint
();
}
internal
void
EndCheckinProgress
()
{
mCheckinProgress
=
null
;
mGuiClient
.
Progress
.
ResetProgress
();
mGuiClient
.
RequestRepaint
();
}
internal
bool
HasCheckinCancelled
()
{
return
mCheckinProgress
.
CancelPressed
;
}
double
mSecondsSinceLastProgressUpdate
=
0
;
GenericProgress
mProgress
;
UpdateProgress
mUpdateProgress
;
CheckinProgress
mCheckinProgress
;
WorkspaceInfo
mWkInfo
;
PlasticGUIClient
mGuiClient
;
const
double
UPDATE_INTERVAL_SECONDS
=
0.5
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Developer/UpdateProgress.cs
0 → 100644
View file @
1c847220
using
System
;
using
Codice.Client.BaseCommands
;
using
Codice.Client.Commands
;
using
PlasticGui.WorkspaceWindow
;
using
PlasticGui.WorkspaceWindow.Update
;
namespace
Unity.PlasticSCM.Editor.Developer
{
internal
class
UpdateProgress
{
internal
UpdateProgress
(
UpdateNotifier
notifier
,
string
wkPath
,
string
title
,
PlasticGUIClient
guiClient
)
{
mNotifier
=
notifier
;
mWkPath
=
wkPath
;
mGuiClient
=
guiClient
;
mProgressData
=
new
BuildProgressSpeedAndRemainingTime
.
ProgressData
(
DateTime
.
Now
);
mGuiClient
.
Progress
.
ProgressHeader
=
title
;
mGuiClient
.
Progress
.
CanCancelProgress
=
false
;
}
internal
void
OnUpdateProgress
()
{
var
progress
=
mGuiClient
.
Progress
;
progress
.
ProgressHeader
=
UpdateProgressRender
.
FixNotificationPath
(
mWkPath
,
mNotifier
.
GetNotificationMessage
());
UpdateOperationStatus
status
=
mNotifier
.
GetUpdateStatus
();
progress
.
TotalProgressMessage
=
UpdateProgressRender
.
GetProgressString
(
status
,
mProgressData
);
progress
.
TotalProgressPercent
=
GetProgressBarPercent
.
ForTransfer
(
status
.
UpdatedSize
,
status
.
TotalSize
)
/
100f
;
}
readonly
BuildProgressSpeedAndRemainingTime
.
ProgressData
mProgressData
;
readonly
PlasticGUIClient
mGuiClient
;
readonly
string
mWkPath
;
readonly
UpdateNotifier
mNotifier
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Developer/UpdateReport/UpdateReportDialog.cs
0 → 100644
View file @
1c847220
using
System.Collections
;
using
UnityEditor
;
using
UnityEngine
;
using
Codice.Client.BaseCommands
;
using
Codice.Client.Commands
;
using
Codice.CM.Common
;
using
PlasticGui
;
using
PlasticGui.WorkspaceWindow.Update
;
using
Unity.PlasticSCM.Editor.UI
;
using
Unity.PlasticSCM.Editor.UI.Progress
;
using
Unity.PlasticSCM.Editor.UI.Tree
;
namespace
Unity.PlasticSCM.Editor.Developer.UpdateReport
{
internal
class
UpdateReportDialog
:
PlasticDialog
,
IUpdateReportDialog
{
protected
override
Rect
DefaultRect
{
get
{
var
baseRect
=
base
.
DefaultRect
;
return
new
Rect
(
baseRect
.
x
,
baseRect
.
y
,
810
,
385
);
}
}
internal
static
ResponseType
ShowReportDialog
(
WorkspaceInfo
wkInfo
,
IList
reportLines
,
EditorWindow
parentWindow
)
{
UpdateReportDialog
dialog
=
Create
(
wkInfo
,
reportLines
,
new
ProgressControlsForDialogs
());
return
dialog
.
RunModal
(
parentWindow
);
}
protected
override
void
SaveSettings
()
{
TreeHeaderSettings
.
Save
(
mPathsListView
.
multiColumnHeader
.
state
,
UnityConstants
.
DEVELOPER_UPDATE_REPORT_TABLE_SETTINGS_NAME
);
}
protected
override
void
OnModalGUI
()
{
Title
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
UpdateResultsTitle
));
Paragraph
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
UpdateResultsError
));
DoListArea
(
mPathsListView
,
mErrorDetailsSplitterState
);
GUILayout
.
Space
(
10
);
DoSelectAllArea
();
GUILayout
.
BeginHorizontal
();
GUILayout
.
Space
(
4
);
DrawProgressForDialogs
.
For
(
mProgressControls
.
ProgressData
);
GUILayout
.
Space
(
4
);
GUILayout
.
EndHorizontal
();
GUILayout
.
Space
(
2
);
DoButtonsArea
(
mIsAnyLineChecked
);
mProgressControls
.
ForcedUpdateProgress
(
this
);
}
protected
override
string
GetTitle
()
{
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
UpdateResultsTitle
);
}
void
IUpdateReportDialog
.
Reload
()
{
SetReportLines
(
mReportLines
);
}
void
OnCheckedReportLineChanged
()
{
mIsAnyLineChecked
=
mPathsListView
.
IsAnyLineChecked
();
mAreAllLinesChecked
=
mPathsListView
.
AreAllLinesChecked
();
}
void
DoListArea
(
UpdateReportListView
errorsListView
,
object
splitterState
)
{
EditorGUILayout
.
BeginVertical
();
PlasticSplitterGUILayout
.
BeginHorizontalSplit
(
splitterState
);
DoErrorsListViewArea
(
errorsListView
);
DoErrorDetailsTextArea
(
errorsListView
.
GetSelectedError
());
PlasticSplitterGUILayout
.
EndHorizontalSplit
();
EditorGUILayout
.
EndVertical
();
}
static
void
DoErrorsListViewArea
(
UpdateReportListView
errorsListView
)
{
Rect
treeRect
=
GUILayoutUtility
.
GetRect
(
0
,
100000
,
0
,
100000
);
errorsListView
.
OnGUI
(
treeRect
);
}
void
DoErrorDetailsTextArea
(
ReportLine
selectedReportLine
)
{
string
errorDetailsText
=
selectedReportLine
==
null
?
string
.
Empty
:
selectedReportLine
.
Message
;
EditorGUILayout
.
BeginVertical
();
GUILayout
.
Space
(
8
);
GUILayout
.
Label
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
ProblemColumn
));
mErrorDetailsScrollPosition
=
GUILayout
.
BeginScrollView
(
mErrorDetailsScrollPosition
);
GUILayout
.
TextArea
(
errorDetailsText
,
UnityStyles
.
TextFieldWithWrapping
,
GUILayout
.
ExpandHeight
(
true
));
GUILayout
.
EndScrollView
();
EditorGUILayout
.
EndVertical
();
}
void
DoSelectAllArea
()
{
bool
toggleValue
=
GUILayout
.
Toggle
(
mAreAllLinesChecked
,
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
SelectAll
));
if
(
toggleValue
!=
mAreAllLinesChecked
&&
toggleValue
)
{
mPathsListView
.
CheckAllLines
();
return
;
}
if
(
toggleValue
!=
mAreAllLinesChecked
&&
!
toggleValue
)
{
mPathsListView
.
UnCheckAllLines
();
return
;
}
}
void
DoButtonsArea
(
bool
areUpdateButtonsEneabled
)
{
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
DoRetryUpdateButton
(
areUpdateButtonsEneabled
);
DoUpdateForcedButton
(
areUpdateButtonsEneabled
);
GUILayout
.
FlexibleSpace
();
DoCloseButton
();
}
}
void
DoRetryUpdateButton
(
bool
isEnabled
)
{
GUI
.
enabled
=
isEnabled
;
bool
pressed
=
NormalButton
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
RetryUpdate
));
GUI
.
enabled
=
true
;
if
(!
pressed
)
return
;
SelectiveUpdateOperation
.
SelectiveUpdate
(
mWkInfo
,
mReportLines
,
mPathsListView
.
GetCheckedLines
(),
UpdateFlags
.
None
,
this
,
mProgressControls
);
}
void
DoUpdateForcedButton
(
bool
isEnabled
)
{
GUI
.
enabled
=
isEnabled
;
bool
pressed
=
NormalButton
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
UpdateForced
));
GUI
.
enabled
=
true
;
if
(!
pressed
)
return
;
SelectiveUpdateOperation
.
SelectiveUpdate
(
mWkInfo
,
mReportLines
,
mPathsListView
.
GetCheckedLines
(),
UpdateFlags
.
Forced
,
this
,
mProgressControls
);
}
void
DoCloseButton
()
{
if
(!
NormalButton
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
CloseButton
)))
return
;
CancelButtonAction
();
}
static
UpdateReportDialog
Create
(
WorkspaceInfo
wkInfo
,
IList
reportLines
,
ProgressControlsForDialogs
progressControls
)
{
var
instance
=
CreateInstance
<
UpdateReportDialog
>();
instance
.
mWkInfo
=
wkInfo
;
instance
.
mReportLines
=
reportLines
;
instance
.
mProgressControls
=
progressControls
;
instance
.
mEscapeKeyAction
=
instance
.
CloseButtonAction
;
instance
.
BuildComponenets
(
wkInfo
);
instance
.
SetReportLines
(
reportLines
);
return
instance
;
}
void
SetReportLines
(
IList
reportLines
)
{
mReportLines
=
reportLines
;
mPathsListView
.
BuildModel
(
reportLines
);
mPathsListView
.
Reload
();
mAreAllLinesChecked
=
false
;
}
void
BuildComponenets
(
WorkspaceInfo
wkInfo
)
{
mErrorDetailsSplitterState
=
PlasticSplitterGUILayout
.
InitSplitterState
(
new
float
[]
{
0.50f
,
0.50f
},
new
int
[]
{
100
,
100
},
new
int
[]
{
100000
,
100000
}
);
UpdateReportListHeaderState
errorsListHeaderState
=
UpdateReportListHeaderState
.
GetDefault
();
TreeHeaderSettings
.
Load
(
errorsListHeaderState
,
UnityConstants
.
DEVELOPER_UPDATE_REPORT_TABLE_SETTINGS_NAME
,
UnityConstants
.
UNSORT_COLUMN_ID
);
mPathsListView
=
new
UpdateReportListView
(
wkInfo
,
errorsListHeaderState
,
OnCheckedReportLineChanged
);
mPathsListView
.
Reload
();
}
bool
mIsAnyLineChecked
=
false
;
bool
mAreAllLinesChecked
=
false
;
UpdateReportListView
mPathsListView
;
object
mErrorDetailsSplitterState
;
Vector2
mErrorDetailsScrollPosition
;
WorkspaceInfo
mWkInfo
;
IList
mReportLines
;
ProgressControlsForDialogs
mProgressControls
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Developer/UpdateReport/UpdateReportLineListViewItem.cs
0 → 100644
View file @
1c847220
using
UnityEditor.IMGUI.Controls
;
using
Codice.Client.BaseCommands
;
namespace
Unity.PlasticSCM.Editor.Developer.UpdateReport
{
internal
class
UpdateReportLineListViewItem
:
TreeViewItem
{
internal
ReportLine
ReportLine
{
get
;
private
set
;
}
internal
UpdateReportLineListViewItem
(
int
id
,
ReportLine
reportLine
)
:
base
(
id
,
0
)
{
ReportLine
=
reportLine
;
displayName
=
reportLine
.
ItemPath
;
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Developer/UpdateReport/UpdateReportListHeaderState.cs
0 → 100644
View file @
1c847220
using
System
;
using
UnityEditor.IMGUI.Controls
;
using
UnityEngine
;
using
PlasticGui
;
using
Unity.PlasticSCM.Editor.UI.Tree
;
namespace
Unity.PlasticSCM.Editor.Developer.UpdateReport
{
internal
enum
ErrorsListColumn
{
Path
,
}
[
Serializable
]
internal
class
UpdateReportListHeaderState
:
MultiColumnHeaderState
,
ISerializationCallbackReceiver
{
internal
static
UpdateReportListHeaderState
GetDefault
()
{
return
new
UpdateReportListHeaderState
(
BuildColumns
());
}
static
string
GetColumnName
(
ErrorsListColumn
column
)
{
switch
(
column
)
{
case
ErrorsListColumn
.
Path
:
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PathColumn
);
default
:
return
null
;
}
}
void
ISerializationCallbackReceiver
.
OnAfterDeserialize
()
{
if
(
mHeaderTitles
!=
null
)
TreeHeaderColumns
.
SetTitles
(
columns
,
mHeaderTitles
);
}
void
ISerializationCallbackReceiver
.
OnBeforeSerialize
()
{
}
static
Column
[]
BuildColumns
()
{
return
new
Column
[]
{
new
Column
()
{
width
=
605
,
headerContent
=
new
GUIContent
(
GetColumnName
(
ErrorsListColumn
.
Path
)),
minWidth
=
200
,
allowToggleVisibility
=
false
,
canSort
=
false
}
};
}
UpdateReportListHeaderState
(
Column
[]
columns
)
:
base
(
columns
)
{
if
(
mHeaderTitles
==
null
)
mHeaderTitles
=
TreeHeaderColumns
.
GetTitles
(
columns
);
}
[
SerializeField
]
string
[]
mHeaderTitles
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Developer/UpdateReport/UpdateReportListView.cs
0 → 100644
View file @
1c847220
using
System
;
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEditor.IMGUI.Controls
;
using
UnityEngine
;
using
Codice.Client.BaseCommands
;
using
Codice.Client.Common
;
using
Codice.CM.Common
;
using
Unity.PlasticSCM.Editor.UI
;
using
Unity.PlasticSCM.Editor.UI.Tree
;
namespace
Unity.PlasticSCM.Editor.Developer.UpdateReport
{
internal
class
UpdateReportListView
:
TreeView
{
internal
UpdateReportListView
(
WorkspaceInfo
wkInfo
,
UpdateReportListHeaderState
headerState
,
Action
onCheckedReportLineChanged
)
:
base
(
new
TreeViewState
())
{
mWkInfo
=
wkInfo
;
mOnCheckedReportLineChanged
=
onCheckedReportLineChanged
;
multiColumnHeader
=
new
MultiColumnHeader
(
headerState
);
multiColumnHeader
.
canSort
=
false
;
rowHeight
=
UnityConstants
.
TREEVIEW_ROW_HEIGHT
;
showAlternatingRowBackgrounds
=
true
;
}
internal
List
<
ReportLine
>
GetCheckedLines
()
{
List
<
ReportLine
>
result
=
new
List
<
ReportLine
>();
foreach
(
UpdateReportLineListViewItem
item
in
mCheckedLines
)
result
.
Add
(
item
.
ReportLine
);
return
result
;
}
internal
bool
IsAnyLineChecked
()
{
return
mCheckedLines
.
Count
>
0
;
}
internal
bool
AreAllLinesChecked
()
{
if
(
mReportLines
.
Count
==
0
)
return
false
;
return
mCheckedLines
.
Count
==
mReportLines
.
Count
;
}
internal
void
CheckAllLines
()
{
mCheckedLines
.
Clear
();
foreach
(
UpdateReportLineListViewItem
row
in
mRows
)
{
mCheckedLines
.
Add
(
row
);
}
mOnCheckedReportLineChanged
();
}
internal
void
UnCheckAllLines
()
{
mCheckedLines
.
Clear
();
mOnCheckedReportLineChanged
();
}
internal
void
BuildModel
(
IList
reportLines
)
{
mReportLines
=
reportLines
;
mCheckedLines
.
Clear
();
mOnCheckedReportLineChanged
();
}
internal
ReportLine
GetSelectedError
()
{
List
<
ReportLine
>
selectedErrors
=
GetSelectedErrors
(
this
);
if
(
selectedErrors
.
Count
!=
1
)
return
null
;
return
selectedErrors
[
0
];
}
public
override
IList
<
TreeViewItem
>
GetRows
()
{
return
mRows
;
}
protected
override
TreeViewItem
BuildRoot
()
{
return
new
TreeViewItem
(
0
,
-
1
,
string
.
Empty
);
}
protected
override
IList
<
TreeViewItem
>
BuildRows
(
TreeViewItem
rootItem
)
{
RegenerateRows
(
this
,
mReportLines
,
rootItem
,
mRows
);
return
mRows
;
}
protected
override
void
RowGUI
(
RowGUIArgs
args
)
{
if
(
args
.
item
is
UpdateReportLineListViewItem
)
{
UpdateReportListViewItemGUI
(
mWkInfo
.
ClientPath
,
(
UpdateReportLineListViewItem
)
args
.
item
,
args
,
rowHeight
,
mReportLines
.
Count
,
mOnCheckedReportLineChanged
,
mCheckedLines
);
return
;
}
base
.
RowGUI
(
args
);
}
static
List
<
ReportLine
>
GetSelectedErrors
(
UpdateReportListView
listView
)
{
List
<
ReportLine
>
result
=
new
List
<
ReportLine
>();
IList
<
int
>
selectedIds
=
listView
.
GetSelection
();
if
(
selectedIds
.
Count
==
0
)
return
result
;
foreach
(
UpdateReportLineListViewItem
treeViewItem
in
listView
.
FindRows
(
selectedIds
))
{
result
.
Add
(
treeViewItem
.
ReportLine
);
}
return
result
;
}
static
void
RegenerateRows
(
UpdateReportListView
listView
,
IList
reportLines
,
TreeViewItem
rootItem
,
List
<
TreeViewItem
>
rows
)
{
ClearRows
(
rootItem
,
rows
);
if
(
reportLines
.
Count
==
0
)
return
;
for
(
int
i
=
0
;
i
<
reportLines
.
Count
;
i
++)
{
UpdateReportLineListViewItem
errorListViewItem
=
new
UpdateReportLineListViewItem
(
i
+
1
,
(
ReportLine
)
reportLines
[
i
]);
rootItem
.
AddChild
(
errorListViewItem
);
rows
.
Add
(
errorListViewItem
);
}
listView
.
SetSelection
(
new
List
<
int
>
{
1
});
}
static
void
ClearRows
(
TreeViewItem
rootItem
,
List
<
TreeViewItem
>
rows
)
{
if
(
rootItem
.
hasChildren
)
rootItem
.
children
.
Clear
();
rows
.
Clear
();
}
static
void
UpdateReportListViewItemGUI
(
string
wkPath
,
UpdateReportLineListViewItem
item
,
RowGUIArgs
args
,
float
rowHeight
,
int
totalLinesCount
,
Action
onCheckedReportLineChanged
,
HashSet
<
UpdateReportLineListViewItem
>
checkedLines
)
{
for
(
int
visibleColumnIdx
=
0
;
visibleColumnIdx
<
args
.
GetNumVisibleColumns
();
visibleColumnIdx
++)
{
Rect
cellRect
=
args
.
GetCellRect
(
visibleColumnIdx
);
ErrorsListColumn
column
=
(
ErrorsListColumn
)
args
.
GetColumn
(
visibleColumnIdx
);
UpdateReportListViewItemCellGUI
(
cellRect
,
wkPath
,
item
,
column
,
rowHeight
,
args
.
selected
,
args
.
focused
,
totalLinesCount
,
onCheckedReportLineChanged
,
checkedLines
);
}
}
static
void
UpdateReportListViewItemCellGUI
(
Rect
rect
,
string
wkPath
,
UpdateReportLineListViewItem
item
,
ErrorsListColumn
column
,
float
rowHeight
,
bool
isSelected
,
bool
isFocused
,
int
totalLinesCount
,
Action
onCheckedReportLineChanged
,
HashSet
<
UpdateReportLineListViewItem
>
checkedLines
)
{
string
label
=
WorkspacePath
.
GetWorkspaceRelativePath
(
wkPath
,
item
.
ReportLine
.
ItemPath
);
bool
wasChecked
=
checkedLines
.
Contains
(
item
);
bool
isChecked
=
DrawTreeViewItem
.
ForCheckableItemCell
(
rect
,
rowHeight
,
0
,
null
,
null
,
label
,
isSelected
,
isFocused
,
false
,
wasChecked
);
if
(
wasChecked
!=
isChecked
)
{
UpdateCheckedState
(
checkedLines
,
item
,
isChecked
);
onCheckedReportLineChanged
();
}
}
static
void
UpdateCheckedState
(
HashSet
<
UpdateReportLineListViewItem
>
checkedLines
,
UpdateReportLineListViewItem
item
,
bool
isChecked
)
{
if
(
isChecked
)
{
checkedLines
.
Add
(
item
);
return
;
}
checkedLines
.
Remove
(
item
);
}
List
<
TreeViewItem
>
mRows
=
new
List
<
TreeViewItem
>();
IList
mReportLines
=
new
ArrayList
();
HashSet
<
UpdateReportLineListViewItem
>
mCheckedLines
=
new
HashSet
<
UpdateReportLineListViewItem
>();
readonly
WorkspaceInfo
mWkInfo
;
readonly
Action
mOnCheckedReportLineChanged
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/DrawGuiModeSwitcher.cs
0 → 100644
View file @
1c847220
using
UnityEditor
;
using
UnityEditor.IMGUI.Controls
;
using
UnityEngine
;
using
Unity.PlasticSCM.Editor.Views
;
using
Unity.PlasticSCM.Editor.Views.PendingChanges
;
namespace
Unity.PlasticSCM.Editor
{
internal
static
class
DrawGuiModeSwitcher
{
internal
static
void
ForMode
(
bool
isGluonMode
,
PlasticGUIClient
plasticClient
,
TreeView
changesTreeView
,
EditorWindow
editorWindow
)
{
GUI
.
enabled
=
!
plasticClient
.
IsOperationInProgress
();
EditorGUI
.
BeginChangeCheck
();
GuiMode
currentMode
=
isGluonMode
?
GuiMode
.
GluonMode
:
GuiMode
.
DeveloperMode
;
GuiMode
selectedMode
=
(
GuiMode
)
EditorGUILayout
.
EnumPopup
(
currentMode
,
EditorStyles
.
toolbarDropDown
,
GUILayout
.
Width
(
100
));
if
(
EditorGUI
.
EndChangeCheck
())
{
SwitchGuiModeIfUserWants
(
plasticClient
,
currentMode
,
selectedMode
,
changesTreeView
,
editorWindow
);
}
GUI
.
enabled
=
true
;
}
static
void
SwitchGuiModeIfUserWants
(
PlasticGUIClient
plasticClient
,
GuiMode
currentMode
,
GuiMode
selectedMode
,
TreeView
changesTreeView
,
EditorWindow
editorWindow
)
{
if
(
currentMode
==
selectedMode
)
return
;
bool
userConfirmed
=
SwitchModeConfirmationDialog
.
SwitchMode
(
currentMode
==
GuiMode
.
GluonMode
,
editorWindow
);
if
(!
userConfirmed
)
return
;
bool
isGluonMode
=
selectedMode
==
GuiMode
.
GluonMode
;
LaunchOperation
.
UpdateWorkspaceForMode
(
isGluonMode
,
plasticClient
);
PendingChangesTreeHeaderState
.
SetMode
(
changesTreeView
.
multiColumnHeader
.
state
,
isGluonMode
);
}
enum
GuiMode
{
DeveloperMode
,
GluonMode
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/DrawIncomingChangesNotificationPanel.cs
0 → 100644
View file @
1c847220
using
UnityEditor
;
using
UnityEngine
;
using
Codice.CM.Common
;
using
PlasticGui
;
using
PlasticGui.Gluon
;
using
PlasticGui.WorkspaceWindow.PendingChanges
;
using
Unity.PlasticSCM.Editor.UI
;
using
GluonShowIncomingChanges
=
PlasticGui
.
Gluon
.
WorkspaceWindow
.
ShowIncomingChanges
;
namespace
Unity.PlasticSCM.Editor
{
internal
class
NotificationPanelData
{
internal
enum
StyleType
{
None
,
Red
,
Green
,
}
internal
bool
HasUpdateAction
;
internal
string
InfoText
;
internal
string
ActionText
;
internal
string
TooltipText
;
internal
StyleType
NotificationStyle
;
internal
void
Clear
()
{
HasUpdateAction
=
false
;
InfoText
=
string
.
Empty
;
ActionText
=
string
.
Empty
;
TooltipText
=
string
.
Empty
;
NotificationStyle
=
StyleType
.
None
;
}
}
interface
IIncomingChangesNotificationPanel
{
bool
IsVisible
{
get
;
}
NotificationPanelData
Data
{
get
;
}
}
internal
static
class
DrawIncomingChangesNotificationPanel
{
internal
static
void
ForMode
(
WorkspaceInfo
workspaceInfo
,
PlasticGUIClient
plasticClient
,
IMergeViewLauncher
mergeViewLauncher
,
IGluonViewSwitcher
gluonSwitcher
,
bool
isGluonMode
,
bool
isVisible
,
NotificationPanelData
notificationPanelData
)
{
if
(!
isVisible
)
return
;
GUIContent
labelContent
=
new
GUIContent
(
notificationPanelData
.
InfoText
,
notificationPanelData
.
TooltipText
);
GUIContent
buttonContent
=
new
GUIContent
(
notificationPanelData
.
ActionText
,
notificationPanelData
.
TooltipText
);
float
panelWidth
=
GetPanelWidth
(
labelContent
,
buttonContent
,
UnityStyles
.
Notification
.
Label
,
EditorStyles
.
miniButton
);
EditorGUILayout
.
BeginHorizontal
(
GetStyle
(
notificationPanelData
.
NotificationStyle
),
GUILayout
.
Width
(
panelWidth
));
GUILayout
.
Label
(
labelContent
,
UnityStyles
.
Notification
.
Label
);
DoActionButton
(
workspaceInfo
,
plasticClient
,
mergeViewLauncher
,
gluonSwitcher
,
isGluonMode
,
notificationPanelData
.
HasUpdateAction
,
buttonContent
,
EditorStyles
.
miniButton
);
EditorGUILayout
.
EndHorizontal
();
}
static
void
DoActionButton
(
WorkspaceInfo
workspaceInfo
,
PlasticGUIClient
plasticClient
,
IMergeViewLauncher
mergeViewLauncher
,
IGluonViewSwitcher
gluonSwitcher
,
bool
isGluonMode
,
bool
isUpdateAction
,
GUIContent
buttonContent
,
GUIStyle
buttonStyle
)
{
if
(!
GUILayout
.
Button
(
buttonContent
,
buttonStyle
,
GUILayout
.
ExpandHeight
(
true
),
GUILayout
.
MinWidth
(
40
)))
return
;
if
(
isUpdateAction
)
{
plasticClient
.
UpdateWorkspace
();
return
;
}
ShowIncomingChangesForMode
(
workspaceInfo
,
mergeViewLauncher
,
gluonSwitcher
,
isGluonMode
);
}
static
void
ShowIncomingChangesForMode
(
WorkspaceInfo
workspaceInfo
,
IMergeViewLauncher
mergeViewLauncher
,
IGluonViewSwitcher
gluonSwitcher
,
bool
isGluonMode
)
{
if
(
isGluonMode
)
{
GluonShowIncomingChanges
.
FromNotificationBar
(
workspaceInfo
,
gluonSwitcher
);
return
;
}
ShowIncomingChanges
.
FromNotificationBar
(
workspaceInfo
,
mergeViewLauncher
);
}
static
GUIStyle
GetStyle
(
NotificationPanelData
.
StyleType
styleType
)
{
if
(
styleType
==
NotificationPanelData
.
StyleType
.
Red
)
return
UnityStyles
.
Notification
.
RedNotification
;
return
UnityStyles
.
Notification
.
GreenNotification
;
}
static
float
GetPanelWidth
(
GUIContent
labelContent
,
GUIContent
buttonContent
,
GUIStyle
labelStyle
,
GUIStyle
buttonStyle
)
{
return
labelStyle
.
CalcSize
(
labelContent
).
x
+
buttonStyle
.
CalcSize
(
buttonContent
).
x
+
12
;
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/EnumExtensions.cs
0 → 100644
View file @
1c847220
using
System
;
namespace
Unity.PlasticSCM.Editor
{
internal
static
class
EnumExtensions
{
internal
static
bool
HasFlag
(
this
Enum
variable
,
Enum
value
)
{
if
(
variable
.
GetType
()
!=
value
.
GetType
())
throw
new
ArgumentException
(
"The checked flag is not from the same type as the checked variable."
);
Convert
.
ToUInt64
(
value
);
ulong
num
=
Convert
.
ToUInt64
(
value
);
ulong
num2
=
Convert
.
ToUInt64
(
variable
);
return
(
num2
&
num
)
==
num
;
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/FindWorkspace.cs
0 → 100644
View file @
1c847220
using
System.IO
;
using
Codice.Client.Common
;
using
Codice.CM.Common
;
using
PlasticGui
;
namespace
Unity.PlasticSCM.Editor
{
internal
static
class
FindWorkspace
{
internal
static
string
PathForApplicationPath
(
string
path
)
{
return
FindWorkspacePath
(
path
,
ClientConfig
.
Get
().
GetWkConfigDir
());
}
internal
static
WorkspaceInfo
InfoForApplicationPath
(
string
path
,
IPlasticAPI
plasticApi
)
{
string
wkPath
=
PathForApplicationPath
(
path
);
if
(
string
.
IsNullOrEmpty
(
wkPath
))
return
null
;
return
plasticApi
.
GetWorkspaceFromPath
(
wkPath
);
}
static
string
FindWorkspacePath
(
string
path
,
string
wkConfigDir
)
{
while
(!
string
.
IsNullOrEmpty
(
path
))
{
if
(
Directory
.
Exists
(
Path
.
Combine
(
path
,
wkConfigDir
)))
return
path
;
path
=
Path
.
GetDirectoryName
(
path
);
}
return
null
;
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/GetRelativePath.cs
0 → 100644
View file @
1c847220
using
System
;
using
UnityEngine
;
namespace
Unity.PlasticSCM.Editor
{
internal
static
class
GetRelativePath
{
internal
static
string
ToApplication
(
string
path
)
{
Uri
relativeToUri
=
new
Uri
(
Application
.
dataPath
);
Uri
pathUri
=
new
Uri
(
FixVolumeLetterPath
(
path
));
return
Uri
.
UnescapeDataString
(
relativeToUri
.
MakeRelativeUri
(
pathUri
).
ToString
());
}
static
string
FixVolumeLetterPath
(
string
path
)
{
string
volumeLetter
=
new
string
(
new
char
[]
{
path
[
0
]
});
volumeLetter
=
volumeLetter
.
ToUpperInvariant
();
return
string
.
Concat
(
volumeLetter
,
path
.
Substring
(
1
));
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Gluon/CheckinProgress.cs
0 → 100644
View file @
1c847220
using
GluonGui.WorkspaceWindow.Views.Checkin.Operations
;
namespace
Unity.PlasticSCM.Editor.Gluon
{
internal
class
CheckinProgress
{
internal
CheckinProgress
(
PlasticGUIClient
guiClient
)
{
mGuiClient
=
guiClient
;
}
internal
void
Refresh
(
CheckinProgressData
progress
)
{
mGuiClient
.
Progress
.
ProgressHeader
=
progress
.
ProgressText
;
mGuiClient
.
Progress
.
TotalProgressMessage
=
progress
.
TotalProgressText
;
mGuiClient
.
Progress
.
TotalProgressPercent
=
((
double
)
progress
.
TotalProgressValue
)
/
100
;
mGuiClient
.
Progress
.
ShowCurrentBlock
=
progress
.
bShowCurrentBlock
;
mGuiClient
.
Progress
.
CurrentBlockProgressMessage
=
progress
.
CurrentBlockText
;
mGuiClient
.
Progress
.
CurrentBlockProgressPercent
=
((
double
)
progress
.
CurrentBlockProgressValue
)
/
100
;
}
PlasticGUIClient
mGuiClient
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Gluon/IncomingChangesNotificationPanel.cs
0 → 100644
View file @
1c847220
using
UnityEditor
;
using
PlasticGui.Gluon.WorkspaceWindow
;
namespace
Unity.PlasticSCM.Editor.Gluon
{
internal
class
IncomingChangesNotificationPanel
:
IIncomingChangesNotificationPanel
,
CheckIncomingChanges
.
IUpdateIncomingChanges
{
bool
IIncomingChangesNotificationPanel
.
IsVisible
{
get
{
return
mIsVisible
;
}
}
NotificationPanelData
IIncomingChangesNotificationPanel
.
Data
{
get
{
return
mPanelData
;
}
}
internal
IncomingChangesNotificationPanel
(
EditorWindow
window
)
{
mWindow
=
window
;
}
void
CheckIncomingChanges
.
IUpdateIncomingChanges
.
Hide
()
{
mPanelData
.
Clear
();
mIsVisible
=
false
;
mWindow
.
Repaint
();
}
void
CheckIncomingChanges
.
IUpdateIncomingChanges
.
Show
(
string
infoText
,
string
actionText
,
string
tooltipText
,
CheckIncomingChanges
.
Severity
severity
)
{
UpdateData
(
mPanelData
,
infoText
,
actionText
,
tooltipText
,
severity
);
mIsVisible
=
true
;
mWindow
.
Repaint
();
}
static
void
UpdateData
(
NotificationPanelData
data
,
string
infoText
,
string
actionText
,
string
tooltipText
,
CheckIncomingChanges
.
Severity
severity
)
{
data
.
HasUpdateAction
=
false
;
data
.
InfoText
=
infoText
;
data
.
ActionText
=
actionText
;
data
.
TooltipText
=
tooltipText
;
data
.
NotificationStyle
=
severity
==
CheckIncomingChanges
.
Severity
.
Info
?
NotificationPanelData
.
StyleType
.
Green
:
NotificationPanelData
.
StyleType
.
Red
;
}
bool
mIsVisible
;
NotificationPanelData
mPanelData
=
new
NotificationPanelData
();
EditorWindow
mWindow
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Gluon/ProgressOperationHandler.cs
0 → 100644
View file @
1c847220
using
GluonGui.WorkspaceWindow.Views.Checkin.Operations
;
using
GluonGui.WorkspaceWindow.Views.WorkspaceExplorer.Explorer
;
namespace
Unity.PlasticSCM.Editor.Gluon
{
internal
class
ProgressOperationHandler
:
IUpdateProgress
,
ICheckinProgress
{
internal
ProgressOperationHandler
(
PlasticGUIClient
guiClient
)
{
mGuiClient
=
guiClient
;
}
internal
bool
IsOperationInProgress
()
{
return
mUpdateProgress
!=
null
||
mCheckinProgress
!=
null
;
}
internal
void
CancelUpdateProgress
()
{
mUpdateProgress
.
Cancel
();
}
void
ICheckinProgress
.
ShowProgress
()
{
mCheckinProgress
=
new
CheckinProgress
(
mGuiClient
);
}
void
ICheckinProgress
.
RefreshProgress
(
CheckinProgressData
progress
)
{
mCheckinProgress
.
Refresh
(
progress
);
}
void
ICheckinProgress
.
EndProgress
()
{
mCheckinProgress
=
null
;
mGuiClient
.
Progress
.
ResetProgress
();
mGuiClient
.
RequestRepaint
();
}
void
IUpdateProgress
.
ShowNoCancelableProgress
()
{
mUpdateProgress
=
new
UpdateProgress
(
mGuiClient
);
mUpdateProgress
.
SetCancellable
(
false
);
}
void
IUpdateProgress
.
ShowCancelableProgress
()
{
mUpdateProgress
=
new
UpdateProgress
(
mGuiClient
);
mUpdateProgress
.
SetCancellable
(
true
);
}
void
IUpdateProgress
.
RefreshProgress
(
Codice
.
Client
.
BaseCommands
.
UpdateProgress
updateProgress
,
UpdateProgressData
updateProgressData
)
{
mUpdateProgress
.
RefreshProgress
(
updateProgress
,
updateProgressData
);
}
void
IUpdateProgress
.
EndProgress
()
{
mUpdateProgress
=
null
;
mGuiClient
.
Progress
.
ResetProgress
();
mGuiClient
.
RequestRepaint
();
}
UpdateProgress
mUpdateProgress
;
CheckinProgress
mCheckinProgress
;
PlasticGUIClient
mGuiClient
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Gluon/UpdateProgress.cs
0 → 100644
View file @
1c847220
using
GluonGui.WorkspaceWindow.Views.WorkspaceExplorer.Explorer
;
namespace
Unity.PlasticSCM.Editor.Gluon
{
internal
class
UpdateProgress
{
internal
UpdateProgress
(
PlasticGUIClient
guiClient
)
{
mGuiClient
=
guiClient
;
}
internal
void
Cancel
()
{
if
(
mUpdateProgress
==
null
)
return
;
mUpdateProgress
.
Cancel
();
}
internal
void
SetCancellable
(
bool
bCancelable
)
{
mGuiClient
.
Progress
.
CanCancelProgress
=
bCancelable
;
}
internal
void
RefreshProgress
(
Codice
.
Client
.
BaseCommands
.
UpdateProgress
progress
,
UpdateProgressData
updateProgressData
)
{
mUpdateProgress
=
progress
;
mGuiClient
.
Progress
.
ProgressHeader
=
updateProgressData
.
Details
;
mGuiClient
.
Progress
.
TotalProgressMessage
=
updateProgressData
.
Status
;
mGuiClient
.
Progress
.
TotalProgressPercent
=
updateProgressData
.
ProgressValue
/
100
;
}
Codice
.
Client
.
BaseCommands
.
UpdateProgress
mUpdateProgress
;
PlasticGUIClient
mGuiClient
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Gluon/UpdateReport/ErrorListViewItem.cs
0 → 100644
View file @
1c847220
using
UnityEditor.IMGUI.Controls
;
using
Codice.Client.BaseCommands
;
namespace
Unity.PlasticSCM.Editor.Gluon.UpdateReport
{
internal
class
ErrorListViewItem
:
TreeViewItem
{
internal
ErrorMessage
ErrorMessage
{
get
;
private
set
;
}
internal
ErrorListViewItem
(
int
id
,
ErrorMessage
errorMessage
)
:
base
(
id
,
0
)
{
ErrorMessage
=
errorMessage
;
displayName
=
errorMessage
.
Path
;
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Gluon/UpdateReport/UpdateReportDialog.cs
0 → 100644
View file @
1c847220
using
System
;
using
System.Collections.Generic
;
using
UnityEditor
;
using
UnityEngine
;
using
Codice.Client.BaseCommands
;
using
Codice.CM.Common
;
using
GluonGui.WorkspaceWindow.Views.WorkspaceExplorer.Explorer
;
using
PlasticGui
;
using
Unity.PlasticSCM.Editor.UI
;
using
Unity.PlasticSCM.Editor.UI.Tree
;
namespace
Unity.PlasticSCM.Editor.Gluon.UpdateReport
{
internal
class
UpdateReportDialog
:
PlasticDialog
{
protected
override
Rect
DefaultRect
{
get
{
var
baseRect
=
base
.
DefaultRect
;
return
new
Rect
(
baseRect
.
x
,
baseRect
.
y
,
800
,
400
);
}
}
internal
static
UpdateReportResult
ShowUpdateReport
(
WorkspaceInfo
wkInfo
,
List
<
ErrorMessage
>
errors
,
EditorWindow
parentWindow
)
{
UpdateReportDialog
dialog
=
Create
(
wkInfo
,
errors
);
ResponseType
dialogResult
=
dialog
.
RunModal
(
parentWindow
);
UpdateReportResult
result
=
dialog
.
GetUpdateReportResult
();
result
.
Result
=
dialogResult
==
ResponseType
.
Ok
;
return
result
;
}
protected
override
void
SaveSettings
()
{
TreeHeaderSettings
.
Save
(
mUpdateReportListView
.
multiColumnHeader
.
state
,
UnityConstants
.
GLUON_UPDATE_REPORT_TABLE_SETTINGS_NAME
);
}
protected
override
void
OnModalGUI
()
{
Title
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
UpdateResultsTitle
));
Paragraph
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
UpdateResultsExplanation
));
DoUpdateReportArea
(
mUpdateReportListView
,
mErrorDetailsSplitterState
);
GUILayout
.
Space
(
10
);
DoSelectAllArea
();
GUILayout
.
Space
(
20
);
DoButtonsArea
(
mIsUpdateForcedButtonEnabled
);
}
protected
override
string
GetTitle
()
{
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
UpdateResultsTitle
);
}
void
OnCheckedErrorChanged
()
{
mIsUpdateForcedButtonEnabled
=
mUpdateReportListView
.
IsAnyErrorChecked
();
mIsSelectAllToggleChecked
=
mUpdateReportListView
.
AreAllErrorsChecked
();
}
UpdateReportResult
GetUpdateReportResult
()
{
return
new
UpdateReportResult
{
UpdateForcedPaths
=
mUpdateReportListView
.
GetCheckedPaths
(),
UnaffectedErrors
=
mUpdateReportListView
.
GetUncheckedErrors
()
};
}
static
void
UpdateUpdateReportList
(
UpdateReportListView
updateReportListView
,
List
<
ErrorMessage
>
errorMessages
)
{
updateReportListView
.
BuildModel
(
errorMessages
);
updateReportListView
.
Reload
();
}
static
string
GetErrorDetailsText
(
ErrorMessage
selectedErrorMessage
)
{
if
(
selectedErrorMessage
==
null
)
return
string
.
Empty
;
return
string
.
Format
(
"{0}:{1}{2}"
,
selectedErrorMessage
.
Path
,
Environment
.
NewLine
,
selectedErrorMessage
.
Error
);
}
void
DoUpdateReportArea
(
UpdateReportListView
updateReportListView
,
object
splitterState
)
{
PlasticSplitterGUILayout
.
BeginHorizontalSplit
(
splitterState
);
DoUpdateReportViewArea
(
updateReportListView
);
DoErrorDetailsTextArea
(
updateReportListView
.
GetSelectedError
());
PlasticSplitterGUILayout
.
EndHorizontalSplit
();
}
static
void
DoUpdateReportViewArea
(
UpdateReportListView
updateReportListView
)
{
Rect
treeRect
=
GUILayoutUtility
.
GetRect
(
0
,
100000
,
0
,
100000
);
updateReportListView
.
OnGUI
(
treeRect
);
}
void
DoErrorDetailsTextArea
(
ErrorMessage
selectedErrorMessage
)
{
string
errorDetailsText
=
GetErrorDetailsText
(
selectedErrorMessage
);
mErrorDetailsScrollPosition
=
GUILayout
.
BeginScrollView
(
mErrorDetailsScrollPosition
);
GUILayout
.
TextArea
(
errorDetailsText
,
UnityStyles
.
TextFieldWithWrapping
,
GUILayout
.
ExpandHeight
(
true
));
GUILayout
.
EndScrollView
();
}
void
DoSelectAllArea
()
{
bool
wasChecked
=
mIsSelectAllToggleChecked
;
bool
isChecked
=
EditorGUILayout
.
ToggleLeft
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
SelectAll
),
wasChecked
);
if
(!
wasChecked
&&
isChecked
)
{
mIsSelectAllToggleChecked
=
true
;
mUpdateReportListView
.
CheckAllLines
();
return
;
}
if
(
wasChecked
&&
!
isChecked
)
{
mIsSelectAllToggleChecked
=
false
;
mUpdateReportListView
.
UncheckAllLines
();
return
;
}
}
void
DoButtonsArea
(
bool
isUpdateForcedButtonEnabled
)
{
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
FlexibleSpace
();
if
(
Application
.
platform
==
RuntimePlatform
.
WindowsEditor
)
{
DoUpdateForcedButton
(
isUpdateForcedButtonEnabled
);
DoCloseButton
();
return
;
}
DoCloseButton
();
DoUpdateForcedButton
(
isUpdateForcedButtonEnabled
);
}
}
void
DoUpdateForcedButton
(
bool
isEnabled
)
{
GUI
.
enabled
=
isEnabled
;
mEnterKeyAction
=
GetEnterKeyAction
(
isEnabled
);
bool
pressed
=
AcceptButton
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
UpdateForced
));
GUI
.
enabled
=
true
;
if
(!
pressed
)
return
;
OkButtonAction
();
}
void
DoCloseButton
()
{
if
(!
NormalButton
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
CloseButton
)))
return
;
CloseButtonAction
();
}
Action
GetEnterKeyAction
(
bool
isEnabled
)
{
if
(
isEnabled
)
return
OkButtonAction
;
return
null
;
}
void
BuildComponents
(
WorkspaceInfo
wkInfo
)
{
UpdateReportListHeaderState
updateReportListHeaderState
=
UpdateReportListHeaderState
.
GetDefault
();
TreeHeaderSettings
.
Load
(
updateReportListHeaderState
,
UnityConstants
.
GLUON_UPDATE_REPORT_TABLE_SETTINGS_NAME
,
UnityConstants
.
UNSORT_COLUMN_ID
);
mUpdateReportListView
=
new
UpdateReportListView
(
wkInfo
,
updateReportListHeaderState
,
OnCheckedErrorChanged
);
mUpdateReportListView
.
Reload
();
}
static
UpdateReportDialog
Create
(
WorkspaceInfo
wkInfo
,
List
<
ErrorMessage
>
errors
)
{
var
instance
=
CreateInstance
<
UpdateReportDialog
>();
instance
.
mWkInfo
=
wkInfo
;
instance
.
mErrors
=
errors
;
instance
.
mEscapeKeyAction
=
instance
.
CloseButtonAction
;
instance
.
BuildComponents
(
instance
.
mWkInfo
);
instance
.
mErrorDetailsSplitterState
=
PlasticSplitterGUILayout
.
InitSplitterState
(
new
float
[]
{
0.50f
,
0.50f
},
new
int
[]
{
100
,
100
},
new
int
[]
{
100000
,
100000
}
);
UpdateUpdateReportList
(
instance
.
mUpdateReportListView
,
instance
.
mErrors
);
return
instance
;
}
bool
mIsSelectAllToggleChecked
;
bool
mIsUpdateForcedButtonEnabled
;
object
mErrorDetailsSplitterState
;
Vector2
mErrorDetailsScrollPosition
;
UpdateReportListView
mUpdateReportListView
;
List
<
ErrorMessage
>
mErrors
;
WorkspaceInfo
mWkInfo
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Gluon/UpdateReport/UpdateReportListHeaderState.cs
0 → 100644
View file @
1c847220
using
System
;
using
UnityEditor.IMGUI.Controls
;
using
UnityEngine
;
using
PlasticGui
;
using
Unity.PlasticSCM.Editor.UI.Tree
;
namespace
Unity.PlasticSCM.Editor.Gluon.UpdateReport
{
internal
enum
UpdateReportListColumn
{
Path
}
[
Serializable
]
internal
class
UpdateReportListHeaderState
:
MultiColumnHeaderState
,
ISerializationCallbackReceiver
{
internal
static
UpdateReportListHeaderState
GetDefault
()
{
return
new
UpdateReportListHeaderState
(
BuildColumns
());
}
internal
static
string
GetColumnName
(
UpdateReportListColumn
column
)
{
switch
(
column
)
{
case
UpdateReportListColumn
.
Path
:
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PathColumn
);
default
:
return
null
;
}
}
void
ISerializationCallbackReceiver
.
OnAfterDeserialize
()
{
if
(
mHeaderTitles
!=
null
)
TreeHeaderColumns
.
SetTitles
(
columns
,
mHeaderTitles
);
}
void
ISerializationCallbackReceiver
.
OnBeforeSerialize
()
{
}
static
Column
[]
BuildColumns
()
{
return
new
Column
[]
{
new
Column
()
{
width
=
600
,
headerContent
=
new
GUIContent
(
GetColumnName
(
UpdateReportListColumn
.
Path
)),
minWidth
=
200
,
allowToggleVisibility
=
false
,
canSort
=
false
}
};
}
UpdateReportListHeaderState
(
Column
[]
columns
)
:
base
(
columns
)
{
if
(
mHeaderTitles
==
null
)
mHeaderTitles
=
TreeHeaderColumns
.
GetTitles
(
columns
);
}
[
SerializeField
]
string
[]
mHeaderTitles
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Gluon/UpdateReport/UpdateReportListView.cs
0 → 100644
View file @
1c847220
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
UnityEditor.IMGUI.Controls
;
using
UnityEngine
;
using
Codice.Client.BaseCommands
;
using
Codice.Client.Common
;
using
Codice.CM.Common
;
using
PlasticGui
;
using
Unity.PlasticSCM.Editor.UI
;
using
Unity.PlasticSCM.Editor.UI.Tree
;
namespace
Unity.PlasticSCM.Editor.Gluon.UpdateReport
{
internal
class
UpdateReportListView
:
TreeView
{
internal
UpdateReportListView
(
WorkspaceInfo
wkInfo
,
UpdateReportListHeaderState
headerState
,
Action
onCheckedErrorChanged
)
:
base
(
new
TreeViewState
())
{
mWkInfo
=
wkInfo
;
mOnCheckedErrorChanged
=
onCheckedErrorChanged
;
multiColumnHeader
=
new
MultiColumnHeader
(
headerState
);
multiColumnHeader
.
canSort
=
false
;
rowHeight
=
UnityConstants
.
TREEVIEW_ROW_HEIGHT
;
showAlternatingRowBackgrounds
=
true
;
}
public
override
IList
<
TreeViewItem
>
GetRows
()
{
return
mRows
;
}
protected
override
TreeViewItem
BuildRoot
()
{
return
new
TreeViewItem
(
0
,
-
1
,
string
.
Empty
);
}
protected
override
IList
<
TreeViewItem
>
BuildRows
(
TreeViewItem
rootItem
)
{
RegenerateRows
(
this
,
mErrorMessages
,
rootItem
,
mRows
);
return
mRows
;
}
protected
override
void
RowGUI
(
RowGUIArgs
args
)
{
if
(
args
.
item
is
ErrorListViewItem
)
{
ErrorListViewItemGUI
(
rowHeight
,
mWkInfo
,
mCheckedErrors
,
(
ErrorListViewItem
)
args
.
item
,
mOnCheckedErrorChanged
,
args
);
return
;
}
base
.
RowGUI
(
args
);
}
internal
void
BuildModel
(
List
<
ErrorMessage
>
errorMessages
)
{
mCheckedErrors
.
Clear
();
mErrorMessages
=
errorMessages
;
mOnCheckedErrorChanged
();
}
internal
void
CheckAllLines
()
{
mCheckedErrors
.
Clear
();
foreach
(
ErrorMessage
error
in
mErrorMessages
)
mCheckedErrors
.
Add
(
error
);
mOnCheckedErrorChanged
();
}
internal
void
UncheckAllLines
()
{
mCheckedErrors
.
Clear
();
mOnCheckedErrorChanged
();
}
internal
bool
AreAllErrorsChecked
()
{
if
(
mErrorMessages
.
Count
==
0
)
return
false
;
return
mCheckedErrors
.
Count
==
mErrorMessages
.
Count
;
}
internal
bool
IsAnyErrorChecked
()
{
return
mCheckedErrors
.
Count
>
0
;
}
internal
List
<
string
>
GetCheckedPaths
()
{
return
mCheckedErrors
.
Select
(
message
=>
message
.
Path
).
ToList
();
}
internal
List
<
ErrorMessage
>
GetUncheckedErrors
()
{
return
mErrorMessages
.
Where
(
message
=>
!
mCheckedErrors
.
Contains
(
message
)).
ToList
();
}
internal
ErrorMessage
GetSelectedError
()
{
List
<
ErrorMessage
>
selectedErrors
=
GetSelectedErrors
(
this
);
if
(
selectedErrors
.
Count
!=
1
)
return
null
;
return
selectedErrors
[
0
];
}
static
void
UpdateCheckState
(
HashSet
<
ErrorMessage
>
checkedErrors
,
ErrorMessage
errorMessage
,
bool
isChecked
)
{
if
(
isChecked
)
{
checkedErrors
.
Add
(
errorMessage
);
return
;
}
checkedErrors
.
Remove
(
errorMessage
);
}
static
List
<
ErrorMessage
>
GetSelectedErrors
(
UpdateReportListView
listView
)
{
List
<
ErrorMessage
>
result
=
new
List
<
ErrorMessage
>();
IList
<
int
>
selectedIds
=
listView
.
GetSelection
();
if
(
selectedIds
.
Count
==
0
)
return
result
;
foreach
(
ErrorListViewItem
treeViewItem
in
listView
.
FindRows
(
selectedIds
))
{
result
.
Add
(
treeViewItem
.
ErrorMessage
);
}
return
result
;
}
static
void
RegenerateRows
(
UpdateReportListView
listView
,
List
<
ErrorMessage
>
errorMessages
,
TreeViewItem
rootItem
,
List
<
TreeViewItem
>
rows
)
{
ClearRows
(
rootItem
,
rows
);
if
(
errorMessages
.
Count
==
0
)
return
;
for
(
int
i
=
0
;
i
<
errorMessages
.
Count
;
i
++)
{
ErrorListViewItem
errorListViewItem
=
new
ErrorListViewItem
(
i
+
1
,
errorMessages
[
i
]);
rootItem
.
AddChild
(
errorListViewItem
);
rows
.
Add
(
errorListViewItem
);
}
listView
.
SetSelection
(
new
List
<
int
>
{
1
});
}
static
void
ClearRows
(
TreeViewItem
rootItem
,
List
<
TreeViewItem
>
rows
)
{
if
(
rootItem
.
hasChildren
)
rootItem
.
children
.
Clear
();
rows
.
Clear
();
}
static
void
ErrorListViewItemGUI
(
float
rowHeight
,
WorkspaceInfo
wkInfo
,
HashSet
<
ErrorMessage
>
checkedErrors
,
ErrorListViewItem
item
,
Action
onCheckedErrorChanged
,
RowGUIArgs
args
)
{
for
(
int
visibleColumnIdx
=
0
;
visibleColumnIdx
<
args
.
GetNumVisibleColumns
();
visibleColumnIdx
++)
{
Rect
cellRect
=
args
.
GetCellRect
(
visibleColumnIdx
);
UpdateReportListColumn
column
=
(
UpdateReportListColumn
)
args
.
GetColumn
(
visibleColumnIdx
);
ErrorListViewItemCellGUI
(
cellRect
,
rowHeight
,
wkInfo
,
checkedErrors
,
item
,
onCheckedErrorChanged
,
column
,
args
.
selected
,
args
.
focused
);
}
}
static
void
ErrorListViewItemCellGUI
(
Rect
rect
,
float
rowHeight
,
WorkspaceInfo
wkInfo
,
HashSet
<
ErrorMessage
>
checkedErrors
,
ErrorListViewItem
item
,
Action
onCheckedErrorChanged
,
UpdateReportListColumn
column
,
bool
isSelected
,
bool
isFocused
)
{
ErrorMessage
errorMessage
=
item
.
ErrorMessage
;
string
label
=
GetColumnText
(
wkInfo
,
errorMessage
,
UpdateReportListHeaderState
.
GetColumnName
(
column
));
bool
wasChecked
=
checkedErrors
.
Contains
(
errorMessage
);
bool
isChecked
=
DrawTreeViewItem
.
ForCheckableItemCell
(
rect
,
rowHeight
,
0
,
null
,
null
,
label
,
isSelected
,
isFocused
,
false
,
wasChecked
);
if
(
wasChecked
!=
isChecked
)
{
UpdateCheckState
(
checkedErrors
,
errorMessage
,
isChecked
);
onCheckedErrorChanged
();
}
}
static
string
GetColumnText
(
WorkspaceInfo
wkInfo
,
ErrorMessage
message
,
string
columnName
)
{
if
(
columnName
!=
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PathColumn
))
{
return
string
.
Empty
;
}
return
WorkspacePath
.
ClientToCM
(
message
.
Path
,
wkInfo
.
ClientPath
);
}
List
<
TreeViewItem
>
mRows
=
new
List
<
TreeViewItem
>();
HashSet
<
ErrorMessage
>
mCheckedErrors
=
new
HashSet
<
ErrorMessage
>();
List
<
ErrorMessage
>
mErrorMessages
=
new
List
<
ErrorMessage
>();
readonly
Action
mOnCheckedErrorChanged
;
readonly
WorkspaceInfo
mWkInfo
;
}
}
Prev
1
…
19
20
21
22
23
24
25
26
27
…
32
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment