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/Views/IncomingChanges/Gluon/IncomingChangesTreeHeaderState.cs
0 → 100644
View file @
1c847220
using
System
;
using
System.Collections.Generic
;
using
UnityEditor.IMGUI.Controls
;
using
UnityEngine
;
using
PlasticGui
;
using
Unity.PlasticSCM.Editor.UI.Tree
;
namespace
Unity.PlasticSCM.Editor.Views.IncomingChanges.Gluon
{
internal
enum
IncomingChangesTreeColumn
{
Path
,
LastEditedBy
,
Size
,
DateModififed
}
[
Serializable
]
internal
class
IncomingChangesTreeHeaderState
:
MultiColumnHeaderState
,
ISerializationCallbackReceiver
{
internal
static
IncomingChangesTreeHeaderState
GetDefault
()
{
return
new
IncomingChangesTreeHeaderState
(
BuildColumns
());
}
internal
static
List
<
string
>
GetColumnNames
()
{
List
<
string
>
result
=
new
List
<
string
>();
result
.
Add
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PathColumn
));
result
.
Add
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
LastEditedByColumn
));
result
.
Add
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
SizeColumn
));
result
.
Add
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
DateModifiedColumn
));
return
result
;
}
internal
static
string
GetColumnName
(
IncomingChangesTreeColumn
column
)
{
switch
(
column
)
{
case
IncomingChangesTreeColumn
.
Path
:
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PathColumn
);
case
IncomingChangesTreeColumn
.
LastEditedBy
:
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
LastEditedByColumn
);
case
IncomingChangesTreeColumn
.
Size
:
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
SizeColumn
);
case
IncomingChangesTreeColumn
.
DateModififed
:
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
DateModifiedColumn
);
default
:
return
null
;
}
}
void
ISerializationCallbackReceiver
.
OnAfterDeserialize
()
{
if
(
mHeaderTitles
!=
null
)
TreeHeaderColumns
.
SetTitles
(
columns
,
mHeaderTitles
);
if
(
mColumsAllowedToggleVisibility
!=
null
)
TreeHeaderColumns
.
SetVisibilities
(
columns
,
mColumsAllowedToggleVisibility
);
}
void
ISerializationCallbackReceiver
.
OnBeforeSerialize
()
{
}
static
Column
[]
BuildColumns
()
{
return
new
Column
[]
{
new
Column
()
{
width
=
440
,
headerContent
=
new
GUIContent
(
GetColumnName
(
IncomingChangesTreeColumn
.
Path
)),
minWidth
=
200
,
allowToggleVisibility
=
false
,
},
new
Column
()
{
width
=
150
,
headerContent
=
new
GUIContent
(
GetColumnName
(
IncomingChangesTreeColumn
.
LastEditedBy
)),
minWidth
=
80
},
new
Column
()
{
width
=
80
,
headerContent
=
new
GUIContent
(
GetColumnName
(
IncomingChangesTreeColumn
.
Size
)),
minWidth
=
45
},
new
Column
()
{
width
=
260
,
headerContent
=
new
GUIContent
(
GetColumnName
(
IncomingChangesTreeColumn
.
DateModififed
)),
minWidth
=
100
}
};
}
IncomingChangesTreeHeaderState
(
Column
[]
columns
)
:
base
(
columns
)
{
if
(
mHeaderTitles
==
null
)
mHeaderTitles
=
TreeHeaderColumns
.
GetTitles
(
columns
);
if
(
mColumsAllowedToggleVisibility
==
null
)
mColumsAllowedToggleVisibility
=
TreeHeaderColumns
.
GetVisibilities
(
columns
);
}
[
SerializeField
]
string
[]
mHeaderTitles
;
[
SerializeField
]
bool
[]
mColumsAllowedToggleVisibility
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Views/IncomingChanges/Gluon/IncomingChangesTreeView.cs
0 → 100644
View file @
1c847220
using
System
;
using
System.IO
;
using
System.Collections.Generic
;
using
UnityEditor.IMGUI.Controls
;
using
UnityEngine
;
using
Codice.CM.Common
;
using
Codice.Client.Common
;
using
PlasticGui.Gluon.WorkspaceWindow.Views.IncomingChanges
;
using
Unity.PlasticSCM.Editor.UI
;
using
Unity.PlasticSCM.Editor.UI.Tree
;
namespace
Unity.PlasticSCM.Editor.Views.IncomingChanges.Gluon
{
internal
class
IncomingChangesTreeView
:
TreeView
{
internal
IncomingChangesTreeView
(
WorkspaceInfo
wkInfo
,
IncomingChangesTreeHeaderState
headerState
,
List
<
string
>
columnNames
,
IncomingChangesViewMenu
menu
,
Action
onCheckedNodeChanged
)
:
base
(
new
TreeViewState
())
{
mWkInfo
=
wkInfo
;
mColumnNames
=
columnNames
;
mMenu
=
menu
;
mOnCheckedNodeChanged
=
onCheckedNodeChanged
;
multiColumnHeader
=
new
MultiColumnHeader
(
headerState
);
multiColumnHeader
.
canSort
=
true
;
multiColumnHeader
.
sortingChanged
+=
SortingChanged
;
customFoldoutYOffset
=
UnityConstants
.
TREEVIEW_FOLDOUT_Y_OFFSET
;
rowHeight
=
UnityConstants
.
TREEVIEW_ROW_HEIGHT
;
showAlternatingRowBackgrounds
=
true
;
}
public
override
IList
<
TreeViewItem
>
GetRows
()
{
return
mRows
;
}
protected
override
bool
CanChangeExpandedState
(
TreeViewItem
item
)
{
return
item
is
ChangeCategoryTreeViewItem
;
}
protected
override
TreeViewItem
BuildRoot
()
{
return
new
TreeViewItem
(
0
,
-
1
,
string
.
Empty
);
}
protected
override
IList
<
TreeViewItem
>
BuildRows
(
TreeViewItem
rootItem
)
{
try
{
RegenerateRows
(
mIncomingChangesTree
,
mTreeViewItemIds
,
this
,
rootItem
,
mRows
,
mExpandCategories
);
}
finally
{
mExpandCategories
=
false
;
}
return
mRows
;
}
protected
override
void
CommandEventHandling
()
{
// NOTE - empty override to prevent crash when pressing ctrl-a in the treeview
}
protected
override
void
ContextClickedItem
(
int
id
)
{
mMenu
.
Popup
();
Repaint
();
}
protected
override
void
RowGUI
(
RowGUIArgs
args
)
{
DrawTreeViewItem
.
InitializeStyles
();
if
(
args
.
item
is
ChangeCategoryTreeViewItem
)
{
CategoryTreeViewItemGUI
(
args
.
rowRect
,
rowHeight
,
(
ChangeCategoryTreeViewItem
)
args
.
item
,
mOnCheckedNodeChanged
,
mSolvedConflicts
.
Count
,
args
.
selected
,
args
.
focused
);
return
;
}
if
(
args
.
item
is
ChangeTreeViewItem
)
{
ChangeTreeViewItem
changeTreeViewItem
=
(
ChangeTreeViewItem
)
args
.
item
;
IncomingChangeInfo
changeInfo
=
changeTreeViewItem
.
ChangeInfo
;
IncomingChangeInfo
metaChangeInfo
=
mIncomingChangesTree
.
GetMetaChange
(
changeInfo
);
bool
isCurrentConflict
=
IsCurrentConflict
(
changeInfo
,
metaChangeInfo
,
mCurrentConflict
);
bool
isSolvedConflict
=
IsSolvedConflict
(
changeInfo
,
metaChangeInfo
,
mSolvedConflicts
);
IncomingChangeTreeViewItemGUI
(
mWkInfo
.
ClientPath
,
mIncomingChangesTree
,
this
,
changeTreeViewItem
,
mOnCheckedNodeChanged
,
args
,
isCurrentConflict
,
isSolvedConflict
);
return
;
}
base
.
RowGUI
(
args
);
}
internal
void
BuildModel
(
UnityIncomingChangesTree
tree
)
{
mTreeViewItemIds
.
Clear
();
mIncomingChangesTree
=
tree
;
mSolvedConflicts
=
new
List
<
IncomingChangeInfo
>();
mCurrentConflict
=
null
;
mExpandCategories
=
true
;
}
internal
void
UpdateSolvedFileConflicts
(
List
<
IncomingChangeInfo
>
solvedConflicts
,
IncomingChangeInfo
currentConflict
)
{
mSolvedConflicts
=
solvedConflicts
;
mCurrentConflict
=
currentConflict
;
}
internal
void
Sort
()
{
int
sortedColumnIdx
=
multiColumnHeader
.
state
.
sortedColumnIndex
;
bool
sortAscending
=
multiColumnHeader
.
IsSortedAscending
(
sortedColumnIdx
);
mIncomingChangesTree
.
Sort
(
mColumnNames
[
sortedColumnIdx
],
sortAscending
);
}
internal
IncomingChangeInfo
GetMetaChange
(
IncomingChangeInfo
change
)
{
if
(
change
==
null
)
return
null
;
return
mIncomingChangesTree
.
GetMetaChange
(
change
);
}
internal
void
FillWithMeta
(
List
<
IncomingChangeInfo
>
changes
)
{
mIncomingChangesTree
.
FillWithMeta
(
changes
);
}
internal
bool
SelectionHasMeta
()
{
IncomingChangeInfo
selectedChangeInfo
=
GetSelectedIncomingChange
();
if
(
selectedChangeInfo
==
null
)
return
false
;
return
mIncomingChangesTree
.
HasMeta
(
selectedChangeInfo
);
}
internal
IncomingChangeInfo
GetSelectedIncomingChange
()
{
IList
<
int
>
selectedIds
=
GetSelection
();
if
(
selectedIds
.
Count
!=
1
)
return
null
;
int
selectedId
=
selectedIds
[
0
];
foreach
(
KeyValuePair
<
IncomingChangeInfo
,
int
>
item
in
mTreeViewItemIds
.
GetInfoItems
())
{
if
(
selectedId
==
item
.
Value
)
return
item
.
Key
;
}
return
null
;
}
internal
List
<
IncomingChangeInfo
>
GetSelectedIncomingChanges
()
{
List
<
IncomingChangeInfo
>
result
=
new
List
<
IncomingChangeInfo
>();
IList
<
int
>
selectedIds
=
GetSelection
();
if
(
selectedIds
.
Count
==
0
)
return
result
;
foreach
(
KeyValuePair
<
IncomingChangeInfo
,
int
>
item
in
mTreeViewItemIds
.
GetInfoItems
())
{
if
(!
selectedIds
.
Contains
(
item
.
Value
))
continue
;
result
.
Add
(
item
.
Key
);
}
return
result
;
}
internal
List
<
IncomingChangeInfo
>
GetSelectedFileConflicts
()
{
List
<
IncomingChangeInfo
>
result
=
new
List
<
IncomingChangeInfo
>();
IList
<
int
>
selectedIds
=
GetSelection
();
if
(
selectedIds
.
Count
==
0
)
return
result
;
foreach
(
KeyValuePair
<
IncomingChangeInfo
,
int
>
item
in
mTreeViewItemIds
.
GetInfoItems
())
{
if
(!
selectedIds
.
Contains
(
item
.
Value
))
continue
;
if
(
item
.
Key
.
CategoryType
!=
IncomingChangeCategory
.
Type
.
Conflicted
)
continue
;
result
.
Add
(
item
.
Key
);
}
return
result
;
}
void
SortingChanged
(
MultiColumnHeader
multiColumnHeader
)
{
Sort
();
Reload
();
}
static
bool
IsCurrentConflict
(
IncomingChangeInfo
changeInfo
,
IncomingChangeInfo
metaChangeInfo
,
IncomingChangeInfo
currentConflict
)
{
if
(
metaChangeInfo
==
null
)
return
currentConflict
==
changeInfo
;
return
currentConflict
==
changeInfo
||
currentConflict
==
metaChangeInfo
;
}
static
bool
IsSolvedConflict
(
IncomingChangeInfo
changeInfo
,
IncomingChangeInfo
metaChangeInfo
,
List
<
IncomingChangeInfo
>
solvedConflicts
)
{
if
(
metaChangeInfo
==
null
)
return
solvedConflicts
.
Contains
(
changeInfo
);
return
solvedConflicts
.
Contains
(
changeInfo
)
&&
solvedConflicts
.
Contains
(
metaChangeInfo
);
}
static
void
RegenerateRows
(
UnityIncomingChangesTree
incomingChangesTree
,
TreeViewItemIds
<
IncomingChangeCategory
,
IncomingChangeInfo
>
treeViewItemIds
,
IncomingChangesTreeView
treeView
,
TreeViewItem
rootItem
,
List
<
TreeViewItem
>
rows
,
bool
expandCategories
)
{
if
(
incomingChangesTree
==
null
)
return
;
ClearRows
(
rootItem
,
rows
);
List
<
IncomingChangeCategory
>
categories
=
incomingChangesTree
.
GetNodes
();
if
(
categories
==
null
)
return
;
List
<
int
>
categoriesToExpand
=
new
List
<
int
>();
foreach
(
IncomingChangeCategory
category
in
categories
)
{
int
categoryId
;
if
(!
treeViewItemIds
.
TryGetCategoryItemId
(
category
,
out
categoryId
))
categoryId
=
treeViewItemIds
.
AddCategoryItem
(
category
);
ChangeCategoryTreeViewItem
categoryTreeViewItem
=
new
ChangeCategoryTreeViewItem
(
categoryId
,
category
);
rootItem
.
AddChild
(
categoryTreeViewItem
);
rows
.
Add
(
categoryTreeViewItem
);
if
(!
ShouldExpandCategory
(
treeView
,
categoryTreeViewItem
,
categories
.
Count
,
expandCategories
))
continue
;
categoriesToExpand
.
Add
(
categoryTreeViewItem
.
id
);
foreach
(
IncomingChangeInfo
incomingChange
in
category
.
GetChanges
())
{
int
changeId
;
if
(!
treeViewItemIds
.
TryGetInfoItemId
(
incomingChange
,
out
changeId
))
changeId
=
treeViewItemIds
.
AddInfoItem
(
incomingChange
);
TreeViewItem
changeTreeViewItem
=
new
ChangeTreeViewItem
(
changeId
,
incomingChange
);
categoryTreeViewItem
.
AddChild
(
changeTreeViewItem
);
rows
.
Add
(
changeTreeViewItem
);
}
}
treeView
.
state
.
expandedIDs
=
categoriesToExpand
;
}
static
void
ClearRows
(
TreeViewItem
rootItem
,
List
<
TreeViewItem
>
rows
)
{
if
(
rootItem
.
hasChildren
)
rootItem
.
children
.
Clear
();
rows
.
Clear
();
}
static
void
UpdateCheckStateForSelection
(
IncomingChangesTreeView
treeView
,
ChangeTreeViewItem
senderTreeViewItem
)
{
IList
<
int
>
selectedIds
=
treeView
.
GetSelection
();
if
(
selectedIds
.
Count
<=
1
)
return
;
if
(!
selectedIds
.
Contains
(
senderTreeViewItem
.
id
))
return
;
bool
isChecked
=
senderTreeViewItem
.
ChangeInfo
.
IsChecked
();
foreach
(
TreeViewItem
treeViewItem
in
treeView
.
FindRows
(
selectedIds
))
{
if
(
treeViewItem
is
ChangeCategoryTreeViewItem
)
{
((
ChangeCategoryTreeViewItem
)
treeViewItem
).
Category
.
UpdateCheckedState
(
isChecked
);
continue
;
}
((
ChangeTreeViewItem
)
treeViewItem
).
ChangeInfo
.
UpdateCheckedState
(
isChecked
);
}
}
static
void
CategoryTreeViewItemGUI
(
Rect
rowRect
,
float
rowHeight
,
ChangeCategoryTreeViewItem
item
,
Action
onCheckedNodeChanged
,
int
solvedConflictsCount
,
bool
isSelected
,
bool
isFocused
)
{
Texture
icon
=
GetCategoryIcon
(
item
.
Category
.
CategoryType
);
string
label
=
item
.
Category
.
GetHeaderText
();
bool
wasChecked
=
item
.
Category
.
IsChecked
();
bool
hadCheckedChildren
=
item
.
Category
.
GetCheckedChangesCount
()
>
0
;
DefaultStyles
.
label
=
GetCategoryStyle
(
item
.
Category
,
solvedConflictsCount
,
isSelected
);
bool
isChecked
=
DrawTreeViewItem
.
ForCheckableCategoryItem
(
rowRect
,
rowHeight
,
item
.
depth
,
icon
,
label
,
isSelected
,
isFocused
,
wasChecked
,
hadCheckedChildren
);
DefaultStyles
.
label
=
UnityStyles
.
Tree
.
Label
;
if
(!
wasChecked
&&
isChecked
)
{
item
.
Category
.
UpdateCheckedState
(
true
);
onCheckedNodeChanged
();
return
;
}
if
(
wasChecked
&&
!
isChecked
)
{
item
.
Category
.
UpdateCheckedState
(
false
);
onCheckedNodeChanged
();
return
;
}
}
static
void
IncomingChangeTreeViewItemGUI
(
string
wkPath
,
UnityIncomingChangesTree
incomingChangesTree
,
IncomingChangesTreeView
treeView
,
ChangeTreeViewItem
item
,
Action
onCheckedNodeChanged
,
RowGUIArgs
args
,
bool
isCurrentConflict
,
bool
isSolvedConflict
)
{
for
(
int
visibleColumnIdx
=
0
;
visibleColumnIdx
<
args
.
GetNumVisibleColumns
();
visibleColumnIdx
++)
{
Rect
cellRect
=
args
.
GetCellRect
(
visibleColumnIdx
);
IncomingChangesTreeColumn
column
=
(
IncomingChangesTreeColumn
)
args
.
GetColumn
(
visibleColumnIdx
);
IncomingChangeTreeViewItemCellGUI
(
wkPath
,
cellRect
,
treeView
.
rowHeight
,
incomingChangesTree
,
treeView
,
item
,
onCheckedNodeChanged
,
column
,
args
.
selected
,
args
.
focused
,
isCurrentConflict
,
isSolvedConflict
);
}
}
static
void
IncomingChangeTreeViewItemCellGUI
(
string
wkPath
,
Rect
rect
,
float
rowHeight
,
UnityIncomingChangesTree
incomingChangesTree
,
IncomingChangesTreeView
treeView
,
ChangeTreeViewItem
item
,
Action
onCheckedNodeChanged
,
IncomingChangesTreeColumn
column
,
bool
isSelected
,
bool
isFocused
,
bool
isCurrentConflict
,
bool
isSolvedConflict
)
{
IncomingChangeInfo
incomingChange
=
item
.
ChangeInfo
;
string
label
=
incomingChange
.
GetColumnText
(
IncomingChangesTreeHeaderState
.
GetColumnName
(
column
));
if
(
column
==
IncomingChangesTreeColumn
.
Path
)
{
if
(
incomingChangesTree
.
HasMeta
(
item
.
ChangeInfo
))
label
=
string
.
Concat
(
label
,
UnityConstants
.
TREEVIEW_META_LABEL
);
Texture
icon
=
GetIcon
(
wkPath
,
incomingChange
);
GetChangesOverlayIcon
.
Data
overlayIconData
=
GetChangesOverlayIcon
.
ForGluonIncomingChange
(
incomingChange
,
isSolvedConflict
);
bool
wasChecked
=
incomingChange
.
IsChecked
();
bool
isChecked
=
DrawTreeViewItem
.
ForCheckableItemCell
(
rect
,
rowHeight
,
item
.
depth
,
icon
,
overlayIconData
,
label
,
isSelected
,
isFocused
,
isCurrentConflict
,
wasChecked
);
incomingChange
.
UpdateCheckedState
(
isChecked
);
if
(
wasChecked
!=
isChecked
)
{
UpdateCheckStateForSelection
(
treeView
,
item
);
onCheckedNodeChanged
();
}
return
;
}
if
(
column
==
IncomingChangesTreeColumn
.
Size
)
{
DrawTreeViewItem
.
ForSecondaryLabelRightAligned
(
rect
,
label
,
isSelected
,
isFocused
,
isCurrentConflict
);
return
;
}
DrawTreeViewItem
.
ForSecondaryLabel
(
rect
,
label
,
isSelected
,
isFocused
,
isCurrentConflict
);
}
static
Texture
GetCategoryIcon
(
IncomingChangeCategory
.
Type
categoryType
)
{
switch
(
categoryType
)
{
case
IncomingChangeCategory
.
Type
.
Conflicted
:
return
Images
.
GetImage
(
Images
.
Name
.
IconMergeConflict
);
case
IncomingChangeCategory
.
Type
.
Changed
:
return
Images
.
GetImage
(
Images
.
Name
.
IconChanged
);
case
IncomingChangeCategory
.
Type
.
Moved
:
return
Images
.
GetImage
(
Images
.
Name
.
IconMoved
);
case
IncomingChangeCategory
.
Type
.
Deleted
:
return
Images
.
GetImage
(
Images
.
Name
.
IconDeleted
);
case
IncomingChangeCategory
.
Type
.
Added
:
return
Images
.
GetImage
(
Images
.
Name
.
IconAdded
);
default
:
return
null
;
}
}
static
Texture
GetIcon
(
string
wkPath
,
IncomingChangeInfo
incomingChange
)
{
bool
isDirectory
=
incomingChange
.
GetRevision
().
Type
==
EnumRevisionType
.
enDirectory
;
if
(
isDirectory
||
incomingChange
.
IsXLink
())
return
Images
.
GetDirectoryIcon
();
string
fullPath
=
WorkspacePath
.
GetWorkspacePathFromCmPath
(
wkPath
,
incomingChange
.
GetPath
(),
Path
.
DirectorySeparatorChar
);
return
Images
.
GetFileIcon
(
fullPath
);
}
static
GUIStyle
GetCategoryStyle
(
IncomingChangeCategory
category
,
int
solvedConflictsCount
,
bool
isSelected
)
{
if
(
isSelected
)
return
UnityStyles
.
Tree
.
Label
;
if
(
category
.
CategoryType
!=
IncomingChangeCategory
.
Type
.
Conflicted
)
return
UnityStyles
.
Tree
.
Label
;
return
category
.
GetChildrenCount
()
>
solvedConflictsCount
?
UnityStyles
.
Tree
.
RedLabel
:
UnityStyles
.
Tree
.
GreenLabel
;
}
static
bool
ShouldExpandCategory
(
IncomingChangesTreeView
treeView
,
ChangeCategoryTreeViewItem
categoryTreeViewItem
,
int
categoriesCount
,
bool
expandCategories
)
{
if
(
expandCategories
)
{
if
(
categoriesCount
==
1
)
return
true
;
if
(
categoryTreeViewItem
.
Category
.
CategoryType
==
IncomingChangeCategory
.
Type
.
Conflicted
)
return
true
;
if
(
categoryTreeViewItem
.
Category
.
GetChildrenCount
()
>
NODES_TO_EXPAND_CATEGORY
)
return
false
;
return
true
;
}
return
treeView
.
IsExpanded
(
categoryTreeViewItem
.
id
);
}
bool
mExpandCategories
;
TreeViewItemIds
<
IncomingChangeCategory
,
IncomingChangeInfo
>
mTreeViewItemIds
=
new
TreeViewItemIds
<
IncomingChangeCategory
,
IncomingChangeInfo
>();
List
<
TreeViewItem
>
mRows
=
new
List
<
TreeViewItem
>();
IncomingChangeInfo
mCurrentConflict
;
List
<
IncomingChangeInfo
>
mSolvedConflicts
;
UnityIncomingChangesTree
mIncomingChangesTree
;
readonly
Action
mOnCheckedNodeChanged
;
readonly
IncomingChangesViewMenu
mMenu
;
readonly
List
<
string
>
mColumnNames
;
readonly
WorkspaceInfo
mWkInfo
;
const
int
NODES_TO_EXPAND_CATEGORY
=
10
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Views/IncomingChanges/Gluon/IncomingChangesViewMenu.cs
0 → 100644
View file @
1c847220
using
UnityEngine
;
using
UnityEditor
;
using
PlasticGui
;
using
PlasticGui.Gluon.WorkspaceWindow.Views.IncomingChanges
;
using
Unity.PlasticSCM.Editor.UI
;
namespace
Unity.PlasticSCM.Editor.Views.IncomingChanges.Gluon
{
internal
class
IncomingChangesViewMenu
{
internal
interface
IMetaMenuOperations
{
void
DiffIncomingChanges
();
void
DiffYoursWithIncoming
();
bool
SelectionHasMeta
();
}
internal
IncomingChangesViewMenu
(
IIncomingChangesViewMenuOperations
incomingChangesViewMenuOperations
,
IMetaMenuOperations
incomingChangesMetaMenuOperations
)
{
mIncomingChangesViewMenuOperations
=
incomingChangesViewMenuOperations
;
mIncomingChangesMetaMenuOperations
=
incomingChangesMetaMenuOperations
;
BuildComponents
();
}
internal
void
Popup
()
{
GenericMenu
menu
=
new
GenericMenu
();
UpdateMenuItems
(
menu
);
menu
.
ShowAsContext
();
}
void
MergeSelectedFilesMenuItem_Click
()
{
mIncomingChangesViewMenuOperations
.
MergeContributors
();
}
void
MergeKeepingSourceChangesMenuItem_Click
()
{
mIncomingChangesViewMenuOperations
.
MergeKeepingSourceChanges
();
}
void
MergeKeepingWorkspaceChangesMenuItem_Click
()
{
mIncomingChangesViewMenuOperations
.
MergeKeepingWorkspaceChanges
();
}
void
DiffYoursWithIncomingMenuItem_Click
()
{
mIncomingChangesViewMenuOperations
.
DiffYoursWithIncoming
();
}
void
DiffIncomingChangesMenuItem_Click
()
{
mIncomingChangesViewMenuOperations
.
DiffIncomingChanges
();
}
void
DiffMetaYoursWithIncomingMenuItem_Click
()
{
mIncomingChangesMetaMenuOperations
.
DiffYoursWithIncoming
();
}
void
DiffMetaIncomingChangesMenuItem_Click
()
{
mIncomingChangesMetaMenuOperations
.
DiffIncomingChanges
();
}
void
UpdateMenuItems
(
GenericMenu
menu
)
{
SelectedIncomingChangesGroupInfo
info
=
mIncomingChangesViewMenuOperations
.
GetSelectedIncomingChangesGroupInfo
();
IncomingChangesMenuOperations
operations
=
UpdateIncomingChangesMenu
.
GetAvailableMenuOperations
(
info
);
if
(
operations
==
IncomingChangesMenuOperations
.
None
)
{
menu
.
AddDisabledItem
(
GetNoActionMenuItemContent
());
return
;
}
AddMergeActions
(
menu
,
operations
);
menu
.
AddSeparator
(
string
.
Empty
);
AddDiffActions
(
menu
,
operations
);
if
(!
mIncomingChangesMetaMenuOperations
.
SelectionHasMeta
())
return
;
menu
.
AddSeparator
(
string
.
Empty
);
AddMetaActions
(
menu
,
operations
);
}
void
AddMergeActions
(
GenericMenu
menu
,
IncomingChangesMenuOperations
operations
)
{
if
(
operations
.
HasFlag
(
IncomingChangesMenuOperations
.
MergeContributors
))
menu
.
AddItem
(
mMergeSelectedFilesMenuItemContent
,
false
,
MergeSelectedFilesMenuItem_Click
);
else
menu
.
AddDisabledItem
(
mMergeSelectedFilesMenuItemContent
);
if
(
operations
.
HasFlag
(
IncomingChangesMenuOperations
.
MergeKeepingSourceChanges
))
menu
.
AddItem
(
mMergeKeepingSourceChangesMenuItemContent
,
false
,
MergeKeepingSourceChangesMenuItem_Click
);
else
menu
.
AddDisabledItem
(
mMergeKeepingSourceChangesMenuItemContent
);
if
(
operations
.
HasFlag
(
IncomingChangesMenuOperations
.
MergeKeepingWorkspaceChanges
))
menu
.
AddItem
(
mMergeKeepingWorkspaceChangesMenuItemContent
,
false
,
MergeKeepingWorkspaceChangesMenuItem_Click
);
else
menu
.
AddDisabledItem
(
mMergeKeepingWorkspaceChangesMenuItemContent
);
}
void
AddDiffActions
(
GenericMenu
menu
,
IncomingChangesMenuOperations
operations
)
{
if
(
operations
.
HasFlag
(
IncomingChangesMenuOperations
.
DiffYoursWithIncoming
))
menu
.
AddItem
(
mDiffYoursWithIncomingMenuItemContent
,
false
,
DiffYoursWithIncomingMenuItem_Click
);
else
menu
.
AddDisabledItem
(
mDiffYoursWithIncomingMenuItemContent
);
if
(
operations
.
HasFlag
(
IncomingChangesMenuOperations
.
DiffIncomingChanges
))
menu
.
AddItem
(
mDiffIncomingChangesMenuItemContent
,
false
,
DiffIncomingChangesMenuItem_Click
);
else
menu
.
AddDisabledItem
(
mDiffIncomingChangesMenuItemContent
);
}
void
AddMetaActions
(
GenericMenu
menu
,
IncomingChangesMenuOperations
operations
)
{
if
(
operations
.
HasFlag
(
IncomingChangesMenuOperations
.
DiffYoursWithIncoming
))
menu
.
AddItem
(
mDiffMetaYoursWithIncomingMenuItemContent
,
false
,
DiffMetaYoursWithIncomingMenuItem_Click
);
else
menu
.
AddDisabledItem
(
mDiffMetaYoursWithIncomingMenuItemContent
);
if
(
operations
.
HasFlag
(
IncomingChangesMenuOperations
.
DiffIncomingChanges
))
menu
.
AddItem
(
mDiffMetaIncomingChangesMenuItemContent
,
false
,
DiffMetaIncomingChangesMenuItem_Click
);
else
menu
.
AddDisabledItem
(
mDiffMetaIncomingChangesMenuItemContent
);
}
GUIContent
GetNoActionMenuItemContent
()
{
if
(
mNoActionMenuItemContent
==
null
)
{
mNoActionMenuItemContent
=
new
GUIContent
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
NoActionMenuItem
));
}
return
mNoActionMenuItemContent
;
}
void
BuildComponents
()
{
mMergeSelectedFilesMenuItemContent
=
new
GUIContent
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
MergeSelectedFiles
));
mMergeKeepingSourceChangesMenuItemContent
=
new
GUIContent
(
UnityMenuItem
.
EscapedText
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
IncomingChangesMenuItemMergeKeepingSourceChanges
)));
mMergeKeepingWorkspaceChangesMenuItemContent
=
new
GUIContent
(
UnityMenuItem
.
EscapedText
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
IncomingChangesMenuItemMergeKeepingWorkspaceChanges
)));
string
diffYoursWithIncomingText
=
UnityMenuItem
.
EscapedText
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
IncomingChangesMenuItemDiffYoursWithIncoming
));
string
diffIncomingChangesText
=
UnityMenuItem
.
EscapedText
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
IncomingChangesMenuItemDiffIncomingChanges
));
mDiffYoursWithIncomingMenuItemContent
=
new
GUIContent
(
diffYoursWithIncomingText
);
mDiffIncomingChangesMenuItemContent
=
new
GUIContent
(
diffIncomingChangesText
);
mDiffMetaYoursWithIncomingMenuItemContent
=
new
GUIContent
(
string
.
Format
(
"{0}/{1}"
,
MetaPath
.
META_EXTENSION
,
diffYoursWithIncomingText
));
mDiffMetaIncomingChangesMenuItemContent
=
new
GUIContent
(
string
.
Format
(
"{0}/{1}"
,
MetaPath
.
META_EXTENSION
,
diffIncomingChangesText
));
}
GUIContent
mNoActionMenuItemContent
;
GUIContent
mMergeSelectedFilesMenuItemContent
;
GUIContent
mMergeKeepingSourceChangesMenuItemContent
;
GUIContent
mMergeKeepingWorkspaceChangesMenuItemContent
;
GUIContent
mDiffYoursWithIncomingMenuItemContent
;
GUIContent
mDiffIncomingChangesMenuItemContent
;
GUIContent
mDiffMetaYoursWithIncomingMenuItemContent
;
GUIContent
mDiffMetaIncomingChangesMenuItemContent
;
readonly
IIncomingChangesViewMenuOperations
mIncomingChangesViewMenuOperations
;
readonly
IMetaMenuOperations
mIncomingChangesMetaMenuOperations
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Views/IncomingChanges/Gluon/UnityIncomingChangesTree.cs
0 → 100644
View file @
1c847220
using
System.Collections.Generic
;
using
PlasticGui.Gluon.WorkspaceWindow.Views.IncomingChanges
;
namespace
Unity.PlasticSCM.Editor.Views.IncomingChanges.Gluon
{
internal
class
UnityIncomingChangesTree
{
internal
static
UnityIncomingChangesTree
BuildIncomingChangeCategories
(
IncomingChangesTree
tree
)
{
return
new
UnityIncomingChangesTree
(
tree
);
}
UnityIncomingChangesTree
(
IncomingChangesTree
tree
)
{
mInnerTree
=
tree
;
mMetaCache
.
Build
(
mInnerTree
.
GetNodes
());
}
internal
List
<
IncomingChangeCategory
>
GetNodes
()
{
return
mInnerTree
.
GetNodes
();
}
internal
bool
HasMeta
(
IncomingChangeInfo
changeInfo
)
{
return
mMetaCache
.
ContainsMeta
(
changeInfo
);
}
internal
IncomingChangeInfo
GetMetaChange
(
IncomingChangeInfo
change
)
{
return
mMetaCache
.
GetExistingMeta
(
change
);
}
internal
void
FillWithMeta
(
List
<
IncomingChangeInfo
>
changes
)
{
changes
.
AddRange
(
mMetaCache
.
GetExistingMeta
(
changes
));
}
internal
void
Sort
(
string
key
,
bool
isAscending
)
{
mInnerTree
.
Sort
(
key
,
isAscending
);
}
MetaCache
mMetaCache
=
new
MetaCache
();
IncomingChangesTree
mInnerTree
;
class
MetaCache
{
internal
bool
ContainsMeta
(
IncomingChangeInfo
changeInfo
)
{
string
key
=
BuildKey
.
ForMetaChange
(
changeInfo
);
return
mCache
.
ContainsKey
(
key
);
}
internal
IncomingChangeInfo
GetExistingMeta
(
IncomingChangeInfo
change
)
{
IncomingChangeInfo
result
;
if
(!
mCache
.
TryGetValue
(
BuildKey
.
ForMetaChange
(
change
),
out
result
))
return
null
;
return
result
;
}
internal
List
<
IncomingChangeInfo
>
GetExistingMeta
(
List
<
IncomingChangeInfo
>
changes
)
{
List
<
IncomingChangeInfo
>
result
=
new
List
<
IncomingChangeInfo
>();
foreach
(
IncomingChangeInfo
change
in
changes
)
{
string
key
=
BuildKey
.
ForMetaChange
(
change
);
IncomingChangeInfo
metaChange
;
if
(!
mCache
.
TryGetValue
(
key
,
out
metaChange
))
continue
;
result
.
Add
(
metaChange
);
}
return
result
;
}
internal
void
Build
(
List
<
IncomingChangeCategory
>
incomingChangesCategories
)
{
mCache
.
Clear
();
foreach
(
IncomingChangeCategory
category
in
incomingChangesCategories
)
{
ExtractMetaToCache
(
category
,
mCache
);
}
}
static
void
ExtractMetaToCache
(
IncomingChangeCategory
category
,
Dictionary
<
string
,
IncomingChangeInfo
>
cache
)
{
List
<
IncomingChangeInfo
>
changes
=
category
.
GetChanges
();
HashSet
<
string
>
indexedKeys
=
BuildIndexedKeys
(
changes
);
for
(
int
i
=
changes
.
Count
-
1
;
i
>=
0
;
i
--)
{
IncomingChangeInfo
currentChange
=
changes
[
i
];
string
path
=
currentChange
.
GetPath
();
if
(!
MetaPath
.
IsMetaPath
(
path
))
continue
;
string
realPath
=
MetaPath
.
GetPathFromMetaPath
(
path
);
if
(!
indexedKeys
.
Contains
(
BuildKey
.
BuildCacheKey
(
currentChange
.
CategoryType
,
realPath
)))
continue
;
// found foo.c and foo.c.meta - move .meta to cache
cache
.
Add
(
BuildKey
.
ForChange
(
currentChange
),
currentChange
);
changes
.
RemoveAt
(
i
);
}
}
static
HashSet
<
string
>
BuildIndexedKeys
(
List
<
IncomingChangeInfo
>
changes
)
{
HashSet
<
string
>
result
=
new
HashSet
<
string
>();
foreach
(
IncomingChangeInfo
change
in
changes
)
{
if
(
MetaPath
.
IsMetaPath
(
change
.
GetPath
()))
continue
;
result
.
Add
(
BuildKey
.
ForChange
(
change
));
}
return
result
;
}
Dictionary
<
string
,
IncomingChangeInfo
>
mCache
=
new
Dictionary
<
string
,
IncomingChangeInfo
>();
static
class
BuildKey
{
internal
static
string
ForChange
(
IncomingChangeInfo
change
)
{
return
BuildCacheKey
(
change
.
CategoryType
,
change
.
GetPath
());
}
internal
static
string
ForMetaChange
(
IncomingChangeInfo
change
)
{
return
BuildCacheKey
(
change
.
CategoryType
,
MetaPath
.
GetMetaPath
(
change
.
GetPath
()));
}
internal
static
string
BuildCacheKey
(
IncomingChangeCategory
.
Type
type
,
string
path
)
{
return
string
.
Concat
(
type
,
":"
,
path
);
}
}
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Views/IncomingChanges/IIncomingChangesTab.cs
0 → 100644
View file @
1c847220
namespace
Unity.PlasticSCM.Editor.Views.IncomingChanges
{
internal
interface
IIncomingChangesTab
{
bool
IsVisible
{
get
;
set
;
}
void
OnDisable
();
void
Update
();
void
OnGUI
();
void
AutoRefresh
();
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Views/LaunchOperation.cs
0 → 100644
View file @
1c847220
using
System.Collections.Generic
;
using
Codice.Client.BaseCommands
;
using
Codice.Client.BaseCommands.EventTracking
;
using
Codice.CM.Common
;
using
PlasticGui
;
namespace
Unity.PlasticSCM.Editor.Views
{
internal
static
class
LaunchOperation
{
internal
static
void
CheckinForMode
(
WorkspaceInfo
wkInfo
,
bool
isGluonMode
,
bool
keepItemsLocked
,
PlasticGUIClient
plasticClient
)
{
TrackFeatureUseEvent
.
For
(
Plastic
.
API
.
GetRepositorySpec
(
wkInfo
),
isGluonMode
?
TrackFeatureUseEvent
.
Features
.
PartialCheckin
:
TrackFeatureUseEvent
.
Features
.
Checkin
);
if
(
isGluonMode
)
{
plasticClient
.
PartialCheckin
(
keepItemsLocked
);
return
;
}
plasticClient
.
Checkin
();
}
internal
static
void
UndoForMode
(
bool
isGluonMode
,
PlasticGUIClient
plasticClient
)
{
if
(
isGluonMode
)
{
plasticClient
.
PartialUndo
();
return
;
}
plasticClient
.
Undo
();
}
internal
static
void
UndoChangesForMode
(
bool
isGluonMode
,
PlasticGUIClient
plasticClient
,
List
<
ChangeInfo
>
changesToUndo
,
List
<
ChangeInfo
>
dependenciesCandidates
)
{
if
(
isGluonMode
)
{
plasticClient
.
PartialUndoChanges
(
changesToUndo
,
dependenciesCandidates
);
return
;
}
plasticClient
.
UndoChanges
(
changesToUndo
,
dependenciesCandidates
);
}
internal
static
void
UpdateWorkspaceForMode
(
bool
isGluonMode
,
PlasticGUIClient
plasticClient
)
{
if
(
isGluonMode
)
{
plasticClient
.
PartialUpdateWorkspace
();
return
;
}
plasticClient
.
UpdateWorkspace
();
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Views/PendingChanges/ChangeCategoryTreeViewItem.cs
0 → 100644
View file @
1c847220
using
UnityEditor.IMGUI.Controls
;
using
PlasticGui.WorkspaceWindow.PendingChanges
;
namespace
Unity.PlasticSCM.Editor.Views.PendingChanges
{
internal
class
ChangeCategoryTreeViewItem
:
TreeViewItem
{
internal
PendingChangeCategory
Category
{
get
;
private
set
;
}
internal
ChangeCategoryTreeViewItem
(
int
id
,
PendingChangeCategory
category
)
:
base
(
id
,
0
)
{
Category
=
category
;
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Views/PendingChanges/ChangeTreeViewItem.cs
0 → 100644
View file @
1c847220
using
UnityEditor.IMGUI.Controls
;
using
PlasticGui
;
using
PlasticGui.WorkspaceWindow.PendingChanges
;
namespace
Unity.PlasticSCM.Editor.Views.PendingChanges
{
internal
class
ChangeTreeViewItem
:
TreeViewItem
{
internal
PendingChangeInfo
ChangeInfo
{
get
;
private
set
;
}
internal
ChangeTreeViewItem
(
int
id
,
PendingChangeInfo
change
)
:
base
(
id
,
1
)
{
ChangeInfo
=
change
;
displayName
=
change
.
GetColumnText
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
ItemColumn
));
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Views/PendingChanges/Dialogs/CheckinConflictsDialog.cs
0 → 100644
View file @
1c847220
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
UnityEditor
;
using
UnityEngine
;
using
Codice.Client.GameUI.Checkin
;
using
PlasticGui
;
using
Unity.PlasticSCM.Editor.UI
;
namespace
Unity.PlasticSCM.Editor.Views.PendingChanges.Dialogs
{
internal
class
CheckinConflictsDialog
:
PlasticDialog
{
protected
override
Rect
DefaultRect
{
get
{
var
baseRect
=
base
.
DefaultRect
;
return
new
Rect
(
baseRect
.
x
,
baseRect
.
y
,
600
,
418
);
}
}
internal
static
ResponseType
Show
(
IList
<
CheckinConflict
>
conflicts
,
PlasticLocalization
.
Name
dialogTitle
,
PlasticLocalization
.
Name
dialogExplanation
,
PlasticLocalization
.
Name
okButtonCaption
,
EditorWindow
parentWindow
)
{
CheckinConflictsDialog
dialog
=
Create
(
PlasticLocalization
.
GetString
(
dialogTitle
),
PlasticLocalization
.
GetString
(
dialogExplanation
),
GetConflictsText
(
conflicts
),
PlasticLocalization
.
GetString
(
okButtonCaption
));
return
dialog
.
RunModal
(
parentWindow
);
}
protected
override
void
OnModalGUI
()
{
Title
(
mDialogTitle
);
Paragraph
(
mDialogExplanation
);
Title
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
ItemColumn
));
ConflictsArea
();
GUILayout
.
Space
(
20
);
DoButtonsArea
();
}
protected
override
string
GetTitle
()
{
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
CheckinConflictsTitle
);
}
void
ConflictsArea
()
{
mScrollPosition
=
EditorGUILayout
.
BeginScrollView
(
mScrollPosition
,
EditorStyles
.
helpBox
,
GUILayout
.
Height
(
205
));
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
Space
(
6
);
Paragraph
(
mConflictsText
);
}
EditorGUILayout
.
EndScrollView
();
}
void
DoButtonsArea
()
{
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
FlexibleSpace
();
if
(
Application
.
platform
==
RuntimePlatform
.
WindowsEditor
)
{
DoOkButton
();
DoCancelButton
();
return
;
}
DoCancelButton
();
DoOkButton
();
}
}
void
DoOkButton
()
{
if
(!
AcceptButton
(
mOkButtonCaption
))
return
;
OkButtonAction
();
}
void
DoCancelButton
()
{
if
(!
NormalButton
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
CancelButton
)))
return
;
CancelButtonAction
();
}
static
string
GetConflictsText
(
IList
<
CheckinConflict
>
conflicts
)
{
StringBuilder
sb
=
new
StringBuilder
();
foreach
(
CheckinConflict
conflict
in
conflicts
)
{
sb
.
AppendFormat
(
"{0} {1}{2}"
,
conflict
.
Description
,
conflict
.
ActionMessage
,
Environment
.
NewLine
);
}
return
sb
.
ToString
();
}
static
CheckinConflictsDialog
Create
(
string
dialogTitle
,
string
dialogExplanation
,
string
conflictsText
,
string
okButtonCaption
)
{
var
instance
=
CreateInstance
<
CheckinConflictsDialog
>();
instance
.
mDialogTitle
=
dialogTitle
;
instance
.
mDialogExplanation
=
dialogExplanation
;
instance
.
mConflictsText
=
conflictsText
;
instance
.
mOkButtonCaption
=
okButtonCaption
;
instance
.
mEnterKeyAction
=
instance
.
OkButtonAction
;
instance
.
mEscapeKeyAction
=
instance
.
CancelButtonAction
;
return
instance
;
}
Vector2
mScrollPosition
;
string
mDialogTitle
;
string
mDialogExplanation
;
string
mConflictsText
;
string
mOkButtonCaption
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Views/PendingChanges/Dialogs/CheckinMergeNeededDialog.cs
0 → 100644
View file @
1c847220
using
UnityEditor
;
using
UnityEngine
;
using
Codice.CM.Common
;
using
PlasticGui
;
using
PlasticGui.WorkspaceWindow.PendingChanges
;
using
Unity.PlasticSCM.Editor.UI
;
using
Unity.PlasticSCM.Editor.UI.Progress
;
namespace
Unity.PlasticSCM.Editor.Views.PendingChanges.Dialogs
{
internal
class
CheckinMergeNeededDialog
:
PlasticDialog
{
protected
override
Rect
DefaultRect
{
get
{
var
baseRect
=
base
.
DefaultRect
;
return
new
Rect
(
baseRect
.
x
,
baseRect
.
y
,
650
,
390
);
}
}
internal
static
CheckinMergeNeededData
Merge
(
WorkspaceInfo
wkInfo
,
EditorWindow
parentWindow
)
{
RepositorySpec
repSpec
=
Plastic
.
API
.
GetRepositorySpec
(
wkInfo
);
BranchInfo
parentBranchInfo
=
Plastic
.
API
.
GetWorkingBranch
(
wkInfo
);
CheckinMergeNeededDialog
dialog
=
Create
(
repSpec
,
parentBranchInfo
,
new
ProgressControlsForDialogs
());
ResponseType
dialogResult
=
dialog
.
RunModal
(
parentWindow
);
CheckinMergeNeededData
result
=
new
CheckinMergeNeededData
(
repSpec
,
parentBranchInfo
,
dialog
.
mMergeNow
,
dialog
.
mChildBranchName
);
result
.
Result
=
dialogResult
==
ResponseType
.
Ok
;
return
result
;
}
protected
override
void
OnModalGUI
()
{
Title
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
CheckinMergeRequest
));
Paragraph
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
CheckinMergeRequestMessage
));
Paragraph
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
CheckinMergeRequestQuestion
));
DoMergeNowArea
();
DoMergeLaterArea
();
GUILayout
.
Space
(
10
);
DrawProgressForDialogs
.
For
(
mProgressControls
.
ProgressData
);
GUILayout
.
Space
(
10
);
DoButtonsArea
();
mProgressControls
.
ForcedUpdateProgress
(
this
);
}
protected
override
string
GetTitle
()
{
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
CheckinMergeTitle
);
}
void
DoMergeNowArea
()
{
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
Space
(
20
);
EditorGUI
.
BeginChangeCheck
();
bool
mergeNowChecked
=
RadioToggle
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
CheckinMergeNow
),
mMergeNow
);
if
(
EditorGUI
.
EndChangeCheck
()
&&
mergeNowChecked
)
{
mMergeNow
=
mergeNowChecked
;
// Just check
}
GUILayout
.
FlexibleSpace
();
}
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
Space
(
45
);
Paragraph
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
CheckinMergeNowMessage
));
}
}
void
DoMergeLaterArea
()
{
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
Space
(
20
);
EditorGUI
.
BeginChangeCheck
();
bool
mergeLaterChecked
=
RadioToggle
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
CheckinMergeLater
),
!
mMergeNow
);
if
(
EditorGUI
.
EndChangeCheck
()
&&
mergeLaterChecked
)
{
mMergeNow
=
!
mergeLaterChecked
;
// Just uncheck
}
GUILayout
.
FlexibleSpace
();
}
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
Space
(
45
);
Paragraph
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
CheckinMergeLaterMessage
,
mCurrentBranchInfo
.
BranchName
));
}
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
Space
(
60
);
GUILayout
.
Label
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
CheckinMergeBranch
),
UnityStyles
.
Paragraph
);
GUILayout
.
Space
(-
10
);
using
(
new
EditorGUILayout
.
VerticalScope
())
{
GUILayout
.
Space
(
6
);
GUI
.
enabled
=
!
mMergeNow
;
mChildBranchName
=
EditorGUILayout
.
TextField
(
string
.
Empty
,
mChildBranchName
);
GUI
.
enabled
=
true
;
}
}
}
void
DoButtonsArea
()
{
using
(
new
EditorGUI
.
DisabledScope
(
mProgressControls
.
ProgressData
.
IsWaitingAsyncResult
))
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
FlexibleSpace
();
if
(
Application
.
platform
==
RuntimePlatform
.
WindowsEditor
)
{
DoMergeButton
();
DoCancelButton
();
return
;
}
DoCancelButton
();
DoMergeButton
();
}
}
void
DoMergeButton
()
{
if
(!
AcceptButton
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
MergeButton
)))
return
;
MergeButtonAction
();
}
void
DoCancelButton
()
{
if
(!
NormalButton
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
CancelButton
)))
return
;
CancelButtonAction
();
}
void
MergeButtonAction
()
{
CheckinMergeNeededData
data
=
new
CheckinMergeNeededData
(
mRepSpec
,
mCurrentBranchInfo
,
mMergeNow
,
mChildBranchName
);
CheckinMergeNeededValidation
.
AsyncValidation
(
data
,
this
,
mProgressControls
);
}
bool
RadioToggle
(
string
text
,
bool
isOn
)
{
var
rect
=
GUILayoutUtility
.
GetRect
(
new
GUIContent
(
text
),
UnityStyles
.
Dialog
.
RadioToggle
);
bool
isOnAfter
=
EditorGUI
.
Toggle
(
rect
,
isOn
,
UnityStyles
.
Dialog
.
RadioToggle
);
GUI
.
Label
(
new
Rect
(
rect
.
x
+
rect
.
height
,
rect
.
y
,
rect
.
xMax
-
rect
.
height
,
rect
.
height
),
text
,
UnityStyles
.
Paragraph
);
return
isOnAfter
;
}
static
CheckinMergeNeededDialog
Create
(
RepositorySpec
repSpec
,
BranchInfo
currentBranchInfo
,
ProgressControlsForDialogs
progressControls
)
{
var
instance
=
CreateInstance
<
CheckinMergeNeededDialog
>();
instance
.
mRepSpec
=
repSpec
;
instance
.
mCurrentBranchInfo
=
currentBranchInfo
;
instance
.
mProgressControls
=
progressControls
;
instance
.
mEnterKeyAction
=
instance
.
MergeButtonAction
;
instance
.
mEscapeKeyAction
=
instance
.
CancelButtonAction
;
return
instance
;
}
[
SerializeField
]
bool
mMergeNow
=
true
;
[
SerializeField
]
string
mChildBranchName
=
DEFAULT_BRANCH_NAME
;
ProgressControlsForDialogs
mProgressControls
;
BranchInfo
mCurrentBranchInfo
;
RepositorySpec
mRepSpec
;
const
string
DEFAULT_BRANCH_NAME
=
"task000"
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Views/PendingChanges/Dialogs/DependenciesDialog.cs
0 → 100644
View file @
1c847220
using
System.Collections.Generic
;
using
UnityEditor
;
using
UnityEngine
;
using
Codice.Client.BaseCommands
;
using
Codice.CM.Common
;
using
PlasticGui
;
using
PlasticGui.WorkspaceWindow.PendingChanges
;
using
Unity.PlasticSCM.Editor.UI
;
namespace
Unity.PlasticSCM.Editor.Views.PendingChanges.Dialogs
{
internal
class
DependenciesDialog
:
PlasticDialog
{
protected
override
Rect
DefaultRect
{
get
{
var
baseRect
=
base
.
DefaultRect
;
return
new
Rect
(
baseRect
.
x
,
baseRect
.
y
,
650
,
430
);
}
}
internal
static
bool
IncludeDependencies
(
WorkspaceInfo
wkInfo
,
IList
<
ChangeDependencies
<
ChangeInfo
>>
changesDependencies
,
string
operation
,
EditorWindow
parentWindow
)
{
DependenciesDialog
dialog
=
Create
(
wkInfo
,
changesDependencies
,
operation
);
return
dialog
.
RunModal
(
parentWindow
)
==
ResponseType
.
Ok
;
}
protected
override
void
OnModalGUI
()
{
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
Title
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
DependenciesDialogTitle
));
}
Paragraph
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
DependenciesExplanation
,
mOperation
));
Title
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
ItemColumn
));
Rect
scrollWidth
=
GUILayoutUtility
.
GetRect
(
0
,
position
.
width
,
1
,
1
);
GUI
.
DrawTexture
(
new
Rect
(
scrollWidth
.
x
,
scrollWidth
.
y
,
scrollWidth
.
width
,
200
),
Texture2D
.
whiteTexture
);
DoDependenciesArea
();
GUILayout
.
Space
(
20
);
DoButtonsArea
();
}
protected
override
string
GetTitle
()
{
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
DependenciesDialogTitle
);
}
void
DoDependenciesArea
()
{
// NOTE(rafa): We cannot use a tree view here because it misbehaves with the way we create the modals
mScrollPosition
=
EditorGUILayout
.
BeginScrollView
(
mScrollPosition
,
GUILayout
.
Height
(
200
));
for
(
int
i
=
0
;
i
<
mChangesDependencies
.
Count
;
i
++)
{
var
dependant
=
mChangesDependencies
[
i
];
bool
isExpanded
=
mExpandedDependencies
[
i
];
isExpanded
=
EditorGUILayout
.
Foldout
(
isExpanded
,
ChangeInfoView
.
GetPathDescription
(
mWkInfo
.
ClientPath
,
dependant
.
Change
),
UnityStyles
.
Dialog
.
Foldout
);
mExpandedDependencies
[
i
]
=
isExpanded
;
if
(
isExpanded
)
{
for
(
int
j
=
0
;
j
<
dependant
.
Dependencies
.
Count
;
j
++)
{
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
Space
(
20
);
GUILayout
.
Label
(
ChangeInfoView
.
GetPathDescription
(
mWkInfo
.
ClientPath
,
dependant
.
Dependencies
[
j
]),
UnityStyles
.
Paragraph
);
}
}
}
}
EditorGUILayout
.
EndScrollView
();
}
void
DoButtonsArea
()
{
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
FlexibleSpace
();
if
(
Application
.
platform
==
RuntimePlatform
.
WindowsEditor
)
{
DoOkButton
();
DoCancelButton
();
return
;
}
DoCancelButton
();
DoOkButton
();
}
}
void
DoOkButton
()
{
if
(!
AcceptButton
(
mOperation
))
return
;
OkButtonAction
();
}
void
DoCancelButton
()
{
if
(!
NormalButton
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
CancelButton
)))
return
;
CancelButtonAction
();
}
static
DependenciesDialog
Create
(
WorkspaceInfo
wkInfo
,
IList
<
ChangeDependencies
<
ChangeInfo
>>
changesDependencies
,
string
operation
)
{
var
instance
=
CreateInstance
<
DependenciesDialog
>();
instance
.
mWkInfo
=
wkInfo
;
instance
.
mChangesDependencies
=
changesDependencies
;
instance
.
mOperation
=
operation
;
instance
.
mEnterKeyAction
=
instance
.
OkButtonAction
;
instance
.
mEscapeKeyAction
=
instance
.
CancelButtonAction
;
instance
.
mExpandedDependencies
=
new
bool
[
changesDependencies
.
Count
];
for
(
int
i
=
0
;
i
<
changesDependencies
.
Count
;
i
++)
instance
.
mExpandedDependencies
[
i
]
=
true
;
return
instance
;
}
bool
[]
mExpandedDependencies
;
Vector2
mScrollPosition
;
string
mOperation
;
IList
<
ChangeDependencies
<
ChangeInfo
>>
mChangesDependencies
;
WorkspaceInfo
mWkInfo
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Views/PendingChanges/Dialogs/FilterRulesConfirmationDialog.cs
0 → 100644
View file @
1c847220
using
System
;
using
System.Reflection
;
using
UnityEditor
;
using
UnityEngine
;
using
PlasticGui
;
using
PlasticGui.WorkspaceWindow.Items
;
using
Unity.PlasticSCM.Editor.UI
;
namespace
Unity.PlasticSCM.Editor.Views.PendingChanges.Dialogs
{
internal
class
FilterRulesConfirmationDialog
:
PlasticDialog
{
protected
override
Rect
DefaultRect
{
get
{
var
baseRect
=
base
.
DefaultRect
;
return
new
Rect
(
baseRect
.
x
,
baseRect
.
y
,
520
,
350
);
}
}
internal
static
FilterRulesConfirmationData
AskForConfirmation
(
string
[]
rules
,
bool
isAddOperation
,
bool
isApplicableToAllWorkspaces
,
EditorWindow
parentWindow
)
{
string
explanation
=
PlasticLocalization
.
GetString
(
isAddOperation
?
PlasticLocalization
.
Name
.
FilterRulesConfirmationAddMessage
:
PlasticLocalization
.
Name
.
FilterRulesConfirmationRemoveMessage
);
FilterRulesConfirmationDialog
dialog
=
Create
(
explanation
,
GetRulesText
(
rules
),
isApplicableToAllWorkspaces
);
ResponseType
dialogResult
=
dialog
.
RunModal
(
parentWindow
);
FilterRulesConfirmationData
result
=
new
FilterRulesConfirmationData
(
dialog
.
mApplyRulesToAllWorkspace
,
dialog
.
GetRules
());
result
.
Result
=
dialogResult
==
ResponseType
.
Ok
;
return
result
;
}
protected
override
void
OnModalGUI
()
{
Title
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
FilterRulesConfirmationTitle
));
Paragraph
(
mDialogExplanation
);
RulesArea
();
GUILayout
.
Space
(
20
);
DoButtonsArea
();
}
protected
override
string
GetTitle
()
{
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
FilterRulesConfirmationTitle
);
}
void
RulesArea
()
{
mScrollPosition
=
EditorGUILayout
.
BeginScrollView
(
mScrollPosition
);
mRulesText
=
EditorGUILayout
.
TextArea
(
mRulesText
,
GUILayout
.
ExpandHeight
(
true
));
mIsTextAreaFocused
=
FixTextAreaSelectionIfNeeded
(
mIsTextAreaFocused
);
EditorGUILayout
.
EndScrollView
();
if
(!
mIsApplicableToAllWorkspaces
)
return
;
mApplyRulesToAllWorkspace
=
EditorGUILayout
.
ToggleLeft
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
ApplyRulesToAllWorkspaceCheckButton
),
mApplyRulesToAllWorkspace
,
GUILayout
.
Width
(
200
));
}
void
DoButtonsArea
()
{
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
FlexibleSpace
();
if
(
Application
.
platform
==
RuntimePlatform
.
WindowsEditor
)
{
DoOkButton
();
DoCancelButton
();
return
;
}
DoCancelButton
();
DoOkButton
();
}
}
void
DoOkButton
()
{
if
(!
AcceptButton
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
OkButton
)))
return
;
OkButtonAction
();
}
void
DoCancelButton
()
{
if
(!
NormalButton
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
CancelButton
)))
return
;
CancelButtonAction
();
}
string
[]
GetRules
()
{
if
(
string
.
IsNullOrEmpty
(
mRulesText
))
return
new
string
[
0
];
return
mRulesText
.
Split
(
Environment
.
NewLine
.
ToCharArray
(),
StringSplitOptions
.
RemoveEmptyEntries
);
}
static
bool
FixTextAreaSelectionIfNeeded
(
bool
isTextAreaFocused
)
{
TextEditor
textEditor
=
typeof
(
EditorGUI
)
.
GetField
(
"activeEditor"
,
BindingFlags
.
Static
|
BindingFlags
.
NonPublic
)
.
GetValue
(
null
)
as
TextEditor
;
// text editor is null when it is not focused
if
(
textEditor
==
null
)
return
false
;
// restore the selection the first time that has selected text
// because it is done automatically by Unity
if
(
isTextAreaFocused
)
return
true
;
if
(
string
.
IsNullOrEmpty
(
textEditor
.
SelectedText
))
return
false
;
textEditor
.
SelectNone
();
textEditor
.
MoveTextEnd
();
return
true
;
}
static
string
GetRulesText
(
string
[]
rules
)
{
if
(
rules
==
null
)
return
string
.
Empty
;
return
string
.
Join
(
Environment
.
NewLine
,
rules
)
+
Environment
.
NewLine
;
}
static
FilterRulesConfirmationDialog
Create
(
string
explanation
,
string
rulesText
,
bool
isApplicableToAllWorkspaces
)
{
var
instance
=
CreateInstance
<
FilterRulesConfirmationDialog
>();
instance
.
mDialogExplanation
=
explanation
;
instance
.
mRulesText
=
rulesText
;
instance
.
mIsApplicableToAllWorkspaces
=
isApplicableToAllWorkspaces
;
instance
.
mEnterKeyAction
=
instance
.
OkButtonAction
;
instance
.
mEscapeKeyAction
=
instance
.
CancelButtonAction
;
return
instance
;
}
bool
mIsTextAreaFocused
;
Vector2
mScrollPosition
;
bool
mApplyRulesToAllWorkspace
;
bool
mIsApplicableToAllWorkspaces
;
string
mRulesText
;
string
mDialogExplanation
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Views/PendingChanges/Dialogs/LaunchCheckinConflictsDialog.cs
0 → 100644
View file @
1c847220
using
System.Collections.Generic
;
using
UnityEditor
;
using
Codice.Client.GameUI.Checkin
;
using
GluonGui.Dialog
;
using
GluonGui.WorkspaceWindow.Views.Checkin.Operations
;
using
PlasticGui
;
using
Unity.PlasticSCM.Editor.UI
;
namespace
Unity.PlasticSCM.Editor.Views.PendingChanges.Dialogs
{
internal
class
LaunchCheckinConflictsDialog
:
CheckinUIOperation
.
ICheckinConflictsDialog
{
internal
LaunchCheckinConflictsDialog
(
EditorWindow
window
)
{
mWindow
=
window
;
}
Result
CheckinUIOperation
.
ICheckinConflictsDialog
.
Show
(
IList
<
CheckinConflict
>
conflicts
,
PlasticLocalization
.
Name
dialogTitle
,
PlasticLocalization
.
Name
dialogExplanation
,
PlasticLocalization
.
Name
okButtonCaption
)
{
ResponseType
responseType
=
CheckinConflictsDialog
.
Show
(
conflicts
,
dialogTitle
,
dialogExplanation
,
okButtonCaption
,
mWindow
);
return
responseType
==
ResponseType
.
Ok
?
Result
.
Ok
:
Result
.
Cancel
;
}
EditorWindow
mWindow
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Views/PendingChanges/Dialogs/LaunchDependenciesDialog.cs
0 → 100644
View file @
1c847220
using
System.Collections.Generic
;
using
UnityEditor
;
using
Codice.Client.BaseCommands
;
using
Codice.CM.Common
;
using
GluonGui.WorkspaceWindow.Views.Checkin.Operations
;
namespace
Unity.PlasticSCM.Editor.Views.PendingChanges.Dialogs
{
internal
class
LaunchDependenciesDialog
:
DependenciesHandler
.
IDependenciesDialog
{
internal
LaunchDependenciesDialog
(
string
operation
,
EditorWindow
parentWindow
)
{
mOperation
=
operation
;
mParentWindow
=
parentWindow
;
}
bool
DependenciesHandler
.
IDependenciesDialog
.
IncludeDependencies
(
WorkspaceInfo
wkInfo
,
IList
<
ChangeDependencies
<
ChangeInfo
>>
dependencies
)
{
return
DependenciesDialog
.
IncludeDependencies
(
wkInfo
,
dependencies
,
mOperation
,
mParentWindow
);
}
string
mOperation
;
EditorWindow
mParentWindow
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Views/PendingChanges/Dialogs/PendingChangesOptionsDialog.cs
0 → 100644
View file @
1c847220
using
UnityEditor
;
using
UnityEngine
;
using
Codice.Client.Commands
;
using
Codice.Client.Common.FsNodeReaders
;
using
Codice.Client.Common.Threading
;
using
Codice.CM.Common
;
using
Codice.Utils
;
using
PlasticGui
;
using
PlasticGui.WorkspaceWindow.PendingChanges
;
using
Unity.PlasticSCM.Editor.UI
;
namespace
Unity.PlasticSCM.Editor.Views.PendingChanges.Dialogs
{
internal
class
PendingChangesOptionsDialog
:
PlasticDialog
{
internal
interface
IAutorefreshView
{
void
DisableAutorefresh
();
void
EnableAutorefresh
();
}
protected
override
Rect
DefaultRect
{
get
{
var
baseRect
=
base
.
DefaultRect
;
return
new
Rect
(
baseRect
.
x
,
baseRect
.
y
,
667
,
660
);
}
}
internal
static
void
ChangeOptions
(
WorkspaceInfo
wkInfo
,
IRefreshableView
view
,
IAutorefreshView
autorefreshView
,
EditorWindow
window
)
{
PendingChangesOptionsDialog
dialog
=
Build
(
wkInfo
);
autorefreshView
.
DisableAutorefresh
();
bool
isDialogDirty
=
false
;
try
{
if
(
dialog
.
RunModal
(
window
)
!=
ResponseType
.
Ok
)
return
;
PendingChangesOptions
currentOptions
=
dialog
.
GetOptions
();
isDialogDirty
=
dialog
.
IsDirty
(
currentOptions
);
if
(!
isDialogDirty
)
return
;
currentOptions
.
SavePreferences
();
}
finally
{
autorefreshView
.
EnableAutorefresh
();
if
(
isDialogDirty
)
view
.
Refresh
();
}
}
protected
override
void
OnModalGUI
()
{
DoToolbarArea
();
DoOptionsArea
();
DoButtonsArea
();
}
protected
override
string
GetTitle
()
{
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesOptionsTitle
);
}
void
DoToolbarArea
()
{
var
toolbarRect
=
GUILayoutUtility
.
GetRect
(
0
,
position
.
width
,
BOX_TOOLBAR_HEIGHT
,
BOX_TOOLBAR_HEIGHT
);
GUI
.
Box
(
new
Rect
(
toolbarRect
.
x
,
toolbarRect
.
y
+
toolbarRect
.
height
/
2
,
toolbarRect
.
width
,
BOX_HEIGHT
),
GUIContent
.
none
);
EditorGUI
.
BeginChangeCheck
();
mSelectedTab
=
(
Tab
)
GUI
.
Toolbar
(
toolbarRect
,
(
int
)
mSelectedTab
,
new
string
[]{
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesWhatToFindTab
),
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesWhatToShowTab
),
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesMoveDetectionTab
)});
if
(
EditorGUI
.
EndChangeCheck
())
EditorGUIUtility
.
keyboardControl
=
-
1
;
}
void
DoOptionsArea
()
{
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
Space
(
BOX_PADDING
);
using
(
new
EditorGUILayout
.
VerticalScope
(
GUILayout
.
Height
(
BOX_HEIGHT
)))
{
GUILayout
.
Space
(
BOX_PADDING
);
switch
(
mSelectedTab
)
{
case
Tab
.
WhatToFind
:
DoWhatToFindTab
();
break
;
case
Tab
.
WhatToShow
:
DoWhatToShowTab
();
break
;
case
Tab
.
MoveDetection
:
DoMoveDetectionTab
();
break
;
}
GUILayout
.
Space
(
BOX_PADDING
);
}
GUILayout
.
Space
(
BOX_PADDING
);
}
}
void
DoWhatToFindTab
()
{
mCanShowCheckouts
=
TitleToggle
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesShowCheckouts
),
mCanShowCheckouts
);
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
Space
(
20
);
Paragraph
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesShowCheckoutsExplanation
));
}
GUILayout
.
Space
(
5
);
mCanFindChanged
=
TitleToggle
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesFindChanged
),
mCanFindChanged
);
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
Space
(
20
);
Paragraph
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesFindChangedExplanation
));
}
GUILayout
.
Space
(
5
);
mCanCheckFileContent
=
TitleToggle
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesCheckFileContent
),
mCanCheckFileContent
);
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
Space
(
20
);
Paragraph
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesCheckFileContentExplanation
));
}
GUILayout
.
Space
(
60
);
DoFsWatcherMessage
(
mIsFileSystemWatcherEnabled
);
}
void
DoWhatToShowTab
()
{
mCanAutoRefresh
=
TitleToggle
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesAutoRefresh
),
mCanAutoRefresh
);
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
Space
(
20
);
Paragraph
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesAutoRefreshExplanation
));
}
GUILayout
.
Space
(
5
);
mCanShowPrivateFields
=
TitleToggle
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesShowPrivateFiles
),
mCanShowPrivateFields
);
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
Space
(
20
);
Paragraph
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesShowPrivateFilesExplanation
));
}
GUILayout
.
Space
(
5
);
mCanShowIgnoredFiles
=
TitleToggle
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesShowIgnoredFiles
),
mCanShowIgnoredFiles
);
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
Space
(
20
);
Paragraph
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesShowIgnoredFilesExplanation
));
}
GUILayout
.
Space
(
5
);
mCanShowHiddenFiles
=
TitleToggle
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesShowHiddenFiles
),
mCanShowHiddenFiles
);
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
Space
(
20
);
Paragraph
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesShowHiddenFilesExplanation
));
}
GUILayout
.
Space
(
5
);
mCanShowDeletedFiles
=
TitleToggle
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesShowDeletedFiles
),
mCanShowDeletedFiles
);
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
Space
(
20
);
Paragraph
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesShowDeletedFilesExplanation
));
}
}
void
DoMoveDetectionTab
()
{
Paragraph
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesMoveDetectionExplanation
));
mCanFindMovedFiles
=
TitleToggle
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesFindMovedFiles
),
mCanFindMovedFiles
);
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
Space
(
20
);
Paragraph
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesFindMovedFilesExplanation
));
}
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
Space
(
20
);
Paragraph
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesMoveDetectionFineTune
));
}
GUILayout
.
Space
(
5
);
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
Space
(
20
);
GUI
.
enabled
=
mCanFindMovedFiles
;
mCanMatchBinarySameExtension
=
TitleToggle
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesMatchBinarySameExtension
),
mCanMatchBinarySameExtension
);
GUI
.
enabled
=
true
;
}
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
Space
(
40
);
Paragraph
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesMatchBinarySameExtensionExplanation
));
}
GUILayout
.
Space
(
5
);
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
Space
(
20
);
GUI
.
enabled
=
mCanFindMovedFiles
;
mCanMatchTextSameExtension
=
TitleToggle
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesMatchTextSameExtension
),
mCanMatchTextSameExtension
);
GUI
.
enabled
=
true
;
}
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
Space
(
40
);
Paragraph
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesMatchTextSameExtensionExplanation
));
}
GUILayout
.
Space
(
5
);
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
Space
(
20
);
GUILayout
.
Label
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesSimilarityPercentage
),
UnityStyles
.
Dialog
.
Toggle
);
GUILayout
.
FlexibleSpace
();
using
(
new
EditorGUILayout
.
VerticalScope
())
{
GUILayout
.
Space
(
8
);
mSimilarityPercent
=
Mathf
.
RoundToInt
(
GUILayout
.
HorizontalSlider
(
mSimilarityPercent
,
40
,
100
,
GUILayout
.
Width
(
300
)));
}
GUILayout
.
Space
(
2
);
using
(
new
EditorGUILayout
.
VerticalScope
())
{
GUILayout
.
Space
(
8
);
GUILayout
.
Label
(
mSimilarityPercent
+
"%"
);
}
}
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
Space
(
40
);
Paragraph
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesSimilarityPercentageExplanation
));
}
}
void
DoFsWatcherMessage
(
bool
isEnabled
)
{
GUIContent
message
=
new
GUIContent
(
isEnabled
?
GetFsWatcherEnabledMessage
()
:
GetFsWatcherDisabledMessage
(),
isEnabled
?
Images
.
GetInfoIcon
()
:
Images
.
GetWarnIcon
());
GUILayout
.
Label
(
message
,
UnityStyles
.
Dialog
.
Toggle
,
GUILayout
.
Height
(
32
));
GUILayout
.
Space
(-
10
);
string
formattedExplanation
=
isEnabled
?
GetFsWatcherEnabledExplanation
():
GetFsWatcherDisabledExplanation
();
string
helpLink
=
GetHelpLink
();
TextBlockWithEndLink
(
helpLink
,
formattedExplanation
,
UnityStyles
.
Paragraph
);
}
void
DoButtonsArea
()
{
using
(
new
EditorGUILayout
.
HorizontalScope
())
{
GUILayout
.
FlexibleSpace
();
if
(
Application
.
platform
==
RuntimePlatform
.
WindowsEditor
)
{
DoOkButton
();
DoCancelButton
();
return
;
}
DoCancelButton
();
DoOkButton
();
}
}
void
DoOkButton
()
{
if
(!
AcceptButton
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
OkButton
)))
return
;
OkButtonAction
();
}
void
DoCancelButton
()
{
if
(!
NormalButton
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
CancelButton
)))
return
;
CancelButtonAction
();
}
bool
IsDirty
(
PendingChangesOptions
currentOptions
)
{
return
!
mInitialOptions
.
AreSameOptions
(
currentOptions
);
}
PendingChangesOptions
GetOptions
()
{
WorkspaceStatusOptions
resultWkStatusOptions
=
WorkspaceStatusOptions
.
None
;
if
(
mCanShowCheckouts
)
{
resultWkStatusOptions
|=
WorkspaceStatusOptions
.
FindCheckouts
;
resultWkStatusOptions
|=
WorkspaceStatusOptions
.
FindReplaced
;
resultWkStatusOptions
|=
WorkspaceStatusOptions
.
FindCopied
;
}
if
(
mCanFindChanged
)
resultWkStatusOptions
|=
WorkspaceStatusOptions
.
FindChanged
;
if
(
mCanShowPrivateFields
)
resultWkStatusOptions
|=
WorkspaceStatusOptions
.
FindPrivates
;
if
(
mCanShowDeletedFiles
)
resultWkStatusOptions
|=
WorkspaceStatusOptions
.
FindLocallyDeleted
;
if
(
mCanShowIgnoredFiles
)
resultWkStatusOptions
|=
WorkspaceStatusOptions
.
ShowIgnored
;
if
(
mCanShowHiddenFiles
)
resultWkStatusOptions
|=
WorkspaceStatusOptions
.
ShowHiddenChanges
;
if
(
mCanFindMovedFiles
)
resultWkStatusOptions
|=
WorkspaceStatusOptions
.
CalculateLocalMoves
;
MovedMatchingOptions
matchingOptions
=
new
MovedMatchingOptions
();
matchingOptions
.
AllowedChangesPerUnit
=
(
100
-
mSimilarityPercent
)
/
100f
;
matchingOptions
.
bBinMatchingOnlySameExtension
=
mCanMatchBinarySameExtension
;
matchingOptions
.
bTxtMatchingOnlySameExtension
=
mCanMatchTextSameExtension
;
return
new
PendingChangesOptions
(
resultWkStatusOptions
,
matchingOptions
,
mCanAutoRefresh
,
false
,
mCanCheckFileContent
,
false
);
}
void
SetOptions
(
PendingChangesOptions
options
)
{
mCanShowCheckouts
=
IsEnabled
(
WorkspaceStatusOptions
.
FindCheckouts
,
options
.
WorkspaceStatusOptions
);
mCanFindChanged
=
IsEnabled
(
WorkspaceStatusOptions
.
FindChanged
,
options
.
WorkspaceStatusOptions
);
mCanCheckFileContent
=
options
.
CheckFileContentForChanged
;
mCanAutoRefresh
=
options
.
AutoRefresh
;
mCanShowPrivateFields
=
IsEnabled
(
WorkspaceStatusOptions
.
FindPrivates
,
options
.
WorkspaceStatusOptions
);
mCanShowIgnoredFiles
=
IsEnabled
(
WorkspaceStatusOptions
.
ShowIgnored
,
options
.
WorkspaceStatusOptions
);
mCanShowHiddenFiles
=
IsEnabled
(
WorkspaceStatusOptions
.
ShowHiddenChanges
,
options
.
WorkspaceStatusOptions
);
mCanShowDeletedFiles
=
IsEnabled
(
WorkspaceStatusOptions
.
FindLocallyDeleted
,
options
.
WorkspaceStatusOptions
);
mCanFindMovedFiles
=
IsEnabled
(
WorkspaceStatusOptions
.
CalculateLocalMoves
,
options
.
WorkspaceStatusOptions
);
mCanMatchBinarySameExtension
=
options
.
MovedMatchingOptions
.
bBinMatchingOnlySameExtension
;
mCanMatchTextSameExtension
=
options
.
MovedMatchingOptions
.
bTxtMatchingOnlySameExtension
;
mSimilarityPercent
=
(
int
)((
1
-
options
.
MovedMatchingOptions
.
AllowedChangesPerUnit
)
*
100f
);
}
void
CheckFsWatcher
(
WorkspaceInfo
wkInfo
)
{
bool
isFileSystemWatcherEnabled
=
false
;
IThreadWaiter
waiter
=
ThreadWaiter
.
GetWaiter
(
10
);
waiter
.
Execute
(
/*threadOperationDelegate*/
delegate
{
isFileSystemWatcherEnabled
=
IsFileSystemWatcherEnabled
(
wkInfo
);
},
/*afterOperationDelegate*/
delegate
{
if
(
waiter
.
Exception
!=
null
)
return
;
mIsFileSystemWatcherEnabled
=
isFileSystemWatcherEnabled
;
});
}
static
bool
IsEnabled
(
WorkspaceStatusOptions
option
,
WorkspaceStatusOptions
options
)
{
return
(
options
&
option
)
==
option
;
}
static
bool
IsFileSystemWatcherEnabled
(
WorkspaceInfo
wkInfo
)
{
return
WorkspaceWatcherFsNodeReadersCache
.
Get
().
IsWatcherEnabled
(
wkInfo
);
}
static
string
GetFsWatcherEnabledMessage
()
{
if
(
PlatformIdentifier
.
IsWindows
()
||
PlatformIdentifier
.
IsMac
())
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesFilesystemWatcherEnabled
);
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesINotifyEnabled
);
}
static
string
GetFsWatcherDisabledMessage
()
{
if
(
PlatformIdentifier
.
IsWindows
()
||
PlatformIdentifier
.
IsMac
())
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesFilesystemWatcherDisabled
);
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesINotifyDisabled
);
}
static
string
GetFsWatcherEnabledExplanation
()
{
if
(
PlatformIdentifier
.
IsWindows
()
||
PlatformIdentifier
.
IsMac
())
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesFilesystemWatcherEnabledExplanation
);
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesINotifyEnabledExplanation
);
}
static
string
GetFsWatcherDisabledExplanation
()
{
if
(
PlatformIdentifier
.
IsWindows
()
||
PlatformIdentifier
.
IsMac
())
{
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesFilesystemWatcherDisabledExplanation
)
.
Replace
(
"[[HELP_URL|{0}]]"
,
"{0}"
);
}
return
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PendingChangesINotifyDisabledExplanation
);
}
static
string
GetHelpLink
()
{
if
(
PlatformIdentifier
.
IsWindows
()
||
PlatformIdentifier
.
IsMac
())
return
FS_WATCHER_HELP_URL
;
return
INOTIFY_HELP_URL
;
}
static
PendingChangesOptionsDialog
Build
(
WorkspaceInfo
wkInfo
)
{
PendingChangesOptionsDialog
result
=
Create
();
result
.
CheckFsWatcher
(
wkInfo
);
result
.
mInitialOptions
=
new
PendingChangesOptions
();
result
.
mInitialOptions
.
LoadPendingChangesOptions
();
result
.
SetOptions
(
result
.
mInitialOptions
);
return
result
;
}
static
PendingChangesOptionsDialog
Create
()
{
var
instance
=
CreateInstance
<
PendingChangesOptionsDialog
>();
instance
.
mEnterKeyAction
=
instance
.
OkButtonAction
;
instance
.
mEscapeKeyAction
=
instance
.
CancelButtonAction
;
return
instance
;
}
enum
Tab
{
WhatToFind
,
WhatToShow
,
MoveDetection
}
Tab
mSelectedTab
=
Tab
.
WhatToFind
;
bool
mCanShowCheckouts
;
bool
mCanAutoRefresh
;
bool
mCanFindChanged
;
bool
mCanCheckFileContent
;
bool
mCanShowPrivateFields
;
bool
mIsFileSystemWatcherEnabled
;
bool
mCanShowIgnoredFiles
;
bool
mCanShowHiddenFiles
;
bool
mCanShowDeletedFiles
;
bool
mCanFindMovedFiles
;
bool
mCanMatchBinarySameExtension
;
bool
mCanMatchTextSameExtension
;
int
mSimilarityPercent
;
PendingChangesOptions
mInitialOptions
;
const
float
BOX_PADDING
=
22f
;
const
float
BOX_TOOLBAR_HEIGHT
=
20f
;
const
float
BOX_HEIGHT
=
560f
;
const
string
FS_WATCHER_HELP_URL
=
"https://plasticscm.com/download/help/support"
;
const
string
INOTIFY_HELP_URL
=
"https://plasticscm.com/download/help/inotify"
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Views/PendingChanges/DrawCommentTextArea.cs
0 → 100644
View file @
1c847220
using
System.Reflection
;
using
UnityEditor
;
using
UnityEngine
;
using
PlasticGui
;
using
Unity.PlasticSCM.Editor.UI
;
namespace
Unity.PlasticSCM.Editor.Views.PendingChanges
{
static
class
DrawCommentTextArea
{
internal
static
void
For
(
PlasticGUIClient
plasticClient
,
float
width
,
bool
isOperationRunning
)
{
using
(
new
GuiEnabled
(!
isOperationRunning
))
{
EditorGUILayout
.
BeginHorizontal
();
Rect
textAreaRect
=
BuildTextAreaRect
(
plasticClient
.
CommentText
,
width
);
EditorGUI
.
BeginChangeCheck
();
plasticClient
.
CommentText
=
DoTextArea
(
plasticClient
.
CommentText
??
string
.
Empty
,
plasticClient
.
ForceToShowComment
,
textAreaRect
);
plasticClient
.
ForceToShowComment
=
false
;
if
(
EditorGUI
.
EndChangeCheck
())
OnTextAreaChanged
(
plasticClient
,
plasticClient
.
CommentText
);
if
(
string
.
IsNullOrEmpty
(
plasticClient
.
CommentText
))
{
DoPlaceholderIfNeeded
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
CheckinComment
),
textAreaRect
);
}
EditorGUILayout
.
EndHorizontal
();
}
}
static
void
OnTextAreaChanged
(
PlasticGUIClient
plasticClient
,
string
text
)
{
plasticClient
.
UpdateIsCommentWarningNeeded
(
text
);
}
static
string
DoTextArea
(
string
text
,
bool
forceToShowText
,
Rect
textAreaRect
)
{
// while the text area has the focus, the changes to
// the source string will not be picked up by the text editor.
// so, when we want to change the text programmatically
// we have to remove the focus, set the text and then reset the focus.
TextEditor
textEditor
=
typeof
(
EditorGUI
)
.
GetField
(
"activeEditor"
,
BindingFlags
.
Static
|
BindingFlags
.
NonPublic
)
.
GetValue
(
null
)
as
TextEditor
;
bool
shouldBeFocusFixed
=
forceToShowText
&&
textEditor
!=
null
;
if
(
shouldBeFocusFixed
)
EditorGUIUtility
.
keyboardControl
=
0
;
text
=
EditorGUI
.
TextArea
(
textAreaRect
,
text
,
EditorStyles
.
textArea
);
if
(
shouldBeFocusFixed
)
EditorGUIUtility
.
keyboardControl
=
textEditor
.
controlID
;
return
text
;
}
static
void
DoPlaceholderIfNeeded
(
string
placeholder
,
Rect
textAreaRect
)
{
int
textAreaControlId
=
GUIUtility
.
GetControlID
(
FocusType
.
Passive
)
-
1
;
if
(
EditorGUIUtility
.
keyboardControl
==
textAreaControlId
)
return
;
Rect
hintRect
=
textAreaRect
;
hintRect
.
height
=
EditorStyles
.
textArea
.
lineHeight
;
GUI
.
Label
(
hintRect
,
placeholder
,
UnityStyles
.
PendingChangesTab
.
CommentPlaceHolder
);
}
static
Rect
BuildTextAreaRect
(
string
text
,
float
width
)
{
GUIStyle
commentTextAreaStyle
=
UnityStyles
.
PendingChangesTab
.
CommentTextArea
;
float
contentWidth
=
width
-
commentTextAreaStyle
.
margin
.
left
-
commentTextAreaStyle
.
margin
.
right
;
float
requiredHeight
=
commentTextAreaStyle
.
CalcHeight
(
new
GUIContent
(
text
),
contentWidth
);
Rect
result
=
GUILayoutUtility
.
GetRect
(
contentWidth
,
Mathf
.
Max
(
requiredHeight
,
42
));
result
.
x
+=
commentTextAreaStyle
.
margin
.
left
;
result
.
width
=
contentWidth
;
result
.
height
=
Mathf
.
Max
(
result
.
height
,
42
);
return
result
;
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Views/PendingChanges/FilesFilterPatternsMenuBuilder.cs
0 → 100644
View file @
1c847220
using
UnityEditor
;
using
UnityEngine
;
using
Codice.Client.BaseCommands
;
using
PlasticGui
;
using
PlasticGui.WorkspaceWindow.Items
;
namespace
Unity.PlasticSCM.Editor.Views.PendingChanges
{
internal
interface
IFilesFilterPatternsMenuOperations
{
void
AddFilesFilterPatterns
(
FilterTypes
type
,
FilterActions
action
,
FilterOperationType
operation
);
}
internal
class
FilesFilterPatternsMenuBuilder
{
internal
FilesFilterPatternsMenuBuilder
(
IFilesFilterPatternsMenuOperations
operations
)
{
mOperations
=
operations
;
}
internal
void
BuildIgnoredSubmenuItem
()
{
mIgnoredSubmenuItem
=
new
GUIContent
(
string
.
Empty
);
mIgnoredByNameMenuItemContent
=
new
GUIContent
(
string
.
Empty
);
mIgnoredByExtensionMenuItemContent
=
new
GUIContent
(
string
.
Empty
);
mIgnoredByFullPathMenuItemContent
=
new
GUIContent
(
string
.
Empty
);
}
internal
void
BuildHiddenChangesSubmenuItem
()
{
mHiddenChangesSubmenuItem
=
new
GUIContent
(
string
.
Empty
);
mHiddenChangesByNameMenuItemContent
=
new
GUIContent
(
string
.
Empty
);
mHiddenChangesByExtensionMenuItemContent
=
new
GUIContent
(
string
.
Empty
);
mHiddenChangesByFullPathMenuItemContent
=
new
GUIContent
(
string
.
Empty
);
}
internal
void
UpdateMenuItems
(
GenericMenu
menu
,
FilterMenuActions
actions
)
{
if
(
mIgnoredSubmenuItem
!=
null
)
UpdateIgnoredMenuItems
(
menu
,
actions
.
Operations
);
if
(
mHiddenChangesSubmenuItem
!=
null
)
UpdateHiddenChangesMenuItems
(
menu
,
actions
.
Operations
);
SetFilterMenuItemsLabels
(
actions
);
}
void
UpdateIgnoredMenuItems
(
GenericMenu
menu
,
FilterMenuOperations
operations
)
{
if
(!
operations
.
HasFlag
(
FilterMenuOperations
.
Ignore
))
{
menu
.
AddDisabledItem
(
mIgnoredSubmenuItem
);
return
;
}
menu
.
AddItem
(
mIgnoredByNameMenuItemContent
,
false
,
IgnoredByName_Click
);
menu
.
AddItem
(
mIgnoredByExtensionMenuItemContent
,
false
,
IgnoredByExtension_Click
);
if
(!
operations
.
HasFlag
(
FilterMenuOperations
.
IgnoreByExtension
))
return
;
menu
.
AddItem
(
mIgnoredByFullPathMenuItemContent
,
false
,
IgnoredByFullPath_Click
);
}
void
UpdateHiddenChangesMenuItems
(
GenericMenu
menu
,
FilterMenuOperations
operations
)
{
if
(!
operations
.
HasFlag
(
FilterMenuOperations
.
HideChanged
))
{
menu
.
AddDisabledItem
(
mHiddenChangesSubmenuItem
);
return
;
}
menu
.
AddItem
(
mHiddenChangesByNameMenuItemContent
,
false
,
HiddenChangesByName_Click
);
menu
.
AddItem
(
mHiddenChangesByExtensionMenuItemContent
,
false
,
HiddenChangesByExtension_Click
);
if
(!
operations
.
HasFlag
(
FilterMenuOperations
.
HideChangedByExtension
))
return
;
menu
.
AddItem
(
mHiddenChangesByFullPathMenuItemContent
,
false
,
HiddenChangesByFullPath_Click
);
}
void
IgnoredByName_Click
()
{
mOperations
.
AddFilesFilterPatterns
(
FilterTypes
.
Ignored
,
FilterActions
.
ByName
,
GetIgnoredFilterOperationType
());
}
void
IgnoredByExtension_Click
()
{
mOperations
.
AddFilesFilterPatterns
(
FilterTypes
.
Ignored
,
FilterActions
.
ByExtension
,
GetIgnoredFilterOperationType
());
}
void
IgnoredByFullPath_Click
()
{
mOperations
.
AddFilesFilterPatterns
(
FilterTypes
.
Ignored
,
FilterActions
.
ByFullPath
,
GetIgnoredFilterOperationType
());
}
void
HiddenChangesByName_Click
()
{
mOperations
.
AddFilesFilterPatterns
(
FilterTypes
.
HiddenChanges
,
FilterActions
.
ByName
,
GetHiddenChangesFilterOperationType
());
}
void
HiddenChangesByExtension_Click
()
{
mOperations
.
AddFilesFilterPatterns
(
FilterTypes
.
HiddenChanges
,
FilterActions
.
ByExtension
,
GetHiddenChangesFilterOperationType
());
}
void
HiddenChangesByFullPath_Click
()
{
mOperations
.
AddFilesFilterPatterns
(
FilterTypes
.
HiddenChanges
,
FilterActions
.
ByFullPath
,
GetHiddenChangesFilterOperationType
());
}
FilterOperationType
GetIgnoredFilterOperationType
()
{
if
(
mIgnoredByNameMenuItemContent
.
text
.
StartsWith
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
MenuAddToIgnoreList
)))
{
return
FilterOperationType
.
Add
;
}
return
FilterOperationType
.
Remove
;
}
FilterOperationType
GetHiddenChangesFilterOperationType
()
{
if
(
mHiddenChangesByNameMenuItemContent
.
text
.
StartsWith
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
MenuAddToHiddenChangesList
)))
{
return
FilterOperationType
.
Add
;
}
return
FilterOperationType
.
Remove
;
}
void
SetFilterMenuItemsLabels
(
FilterMenuActions
actions
)
{
if
(
mIgnoredSubmenuItem
!=
null
)
{
mIgnoredSubmenuItem
.
text
=
actions
.
IgnoredTitle
;
mIgnoredByNameMenuItemContent
.
text
=
GetSubMenuText
(
actions
.
IgnoredTitle
,
actions
.
FilterByName
);
mIgnoredByExtensionMenuItemContent
.
text
=
GetSubMenuText
(
actions
.
IgnoredTitle
,
actions
.
FilterByExtension
);
mIgnoredByFullPathMenuItemContent
.
text
=
GetSubMenuText
(
actions
.
IgnoredTitle
,
actions
.
FilterByFullPath
);
}
if
(
mHiddenChangesSubmenuItem
!=
null
)
{
mHiddenChangesSubmenuItem
.
text
=
actions
.
HiddenChangesTitle
;
mHiddenChangesByNameMenuItemContent
.
text
=
GetSubMenuText
(
actions
.
HiddenChangesTitle
,
actions
.
FilterByName
);
mHiddenChangesByExtensionMenuItemContent
.
text
=
GetSubMenuText
(
actions
.
HiddenChangesTitle
,
actions
.
FilterByExtension
);
mHiddenChangesByFullPathMenuItemContent
.
text
=
GetSubMenuText
(
actions
.
HiddenChangesTitle
,
actions
.
FilterByFullPath
);
}
}
static
string
GetSubMenuText
(
string
menuName
,
string
subMenuName
)
{
return
string
.
Format
(
"{0}/{1}"
,
menuName
,
subMenuName
.
Replace
(
'/'
,
'\\'
));
}
GUIContent
mIgnoredSubmenuItem
;
GUIContent
mHiddenChangesSubmenuItem
;
GUIContent
mIgnoredByNameMenuItemContent
;
GUIContent
mHiddenChangesByNameMenuItemContent
;
GUIContent
mIgnoredByExtensionMenuItemContent
;
GUIContent
mHiddenChangesByExtensionMenuItemContent
;
GUIContent
mIgnoredByFullPathMenuItemContent
;
GUIContent
mHiddenChangesByFullPathMenuItemContent
;
IFilesFilterPatternsMenuOperations
mOperations
;
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Views/PendingChanges/PendingChangesMultiColumnHeader.cs
0 → 100644
View file @
1c847220
using
System.Collections.Generic
;
using
UnityEditor
;
using
UnityEditor.IMGUI.Controls
;
using
UnityEngine
;
using
PlasticGui.WorkspaceWindow.PendingChanges
;
using
Unity.PlasticSCM.Editor.UI
;
namespace
Unity.PlasticSCM.Editor.Views.PendingChanges
{
internal
class
PendingChangesMultiColumnHeader
:
MultiColumnHeader
{
internal
PendingChangesMultiColumnHeader
(
MultiColumnHeaderState
headerState
,
UnityPendingChangesTree
tree
)
:
base
(
headerState
)
{
mPendingChangesTree
=
tree
;
}
protected
override
void
ColumnHeaderGUI
(
MultiColumnHeaderState
.
Column
column
,
Rect
headerRect
,
int
columnIndex
)
{
if
(
columnIndex
==
0
)
{
bool
checkAllWasMixed
=
IsMixedCheckedState
();
bool
checkAllWasTrue
=
IsAllCheckedState
();
var
checkRect
=
new
Rect
(
headerRect
.
x
+
UnityConstants
.
TREEVIEW_BASE_INDENT
,
headerRect
.
y
+
3
+
UnityConstants
.
TREEVIEW_HEADER_CHECKBOX_Y_OFFSET
,
// Custom offset because header labels are not centered
UnityConstants
.
TREEVIEW_CHECKBOX_SIZE
,
headerRect
.
height
);
EditorGUI
.
showMixedValue
=
checkAllWasMixed
;
bool
checkAllIsTrue
=
EditorGUI
.
Toggle
(
checkRect
,
checkAllWasTrue
);
EditorGUI
.
showMixedValue
=
false
;
if
(
checkAllWasTrue
!=
checkAllIsTrue
)
{
UpdateCheckedState
(
checkAllIsTrue
);
}
headerRect
.
x
=
checkRect
.
xMax
;
}
base
.
ColumnHeaderGUI
(
column
,
headerRect
,
columnIndex
);
}
internal
bool
IsAllCheckedState
()
{
List
<
PendingChangeCategory
>
categories
=
mPendingChangesTree
.
GetNodes
();
if
(
categories
==
null
)
return
false
;
foreach
(
PendingChangeCategory
category
in
categories
)
{
if
(!
category
.
IsChecked
())
return
false
;
}
return
true
;
}
protected
bool
IsMixedCheckedState
()
{
List
<
PendingChangeCategory
>
categories
=
mPendingChangesTree
.
GetNodes
();
if
(
categories
==
null
)
return
false
;
if
(
IsAllCheckedState
())
return
false
;
foreach
(
PendingChangeCategory
category
in
categories
)
{
if
(
category
.
GetCheckedChangesCount
()
>
0
)
return
true
;
}
return
false
;
}
internal
void
UpdateCheckedState
(
bool
isChecked
)
{
List
<
PendingChangeCategory
>
categories
=
mPendingChangesTree
.
GetNodes
();
if
(
categories
==
null
)
return
;
foreach
(
PendingChangeCategory
category
in
categories
)
category
.
UpdateCheckedState
(
isChecked
);
}
protected
UnityPendingChangesTree
mPendingChangesTree
;
}
}
\ No newline at end of file
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Views/PendingChanges/PendingChangesSelection.cs
0 → 100644
View file @
1c847220
using
System.Collections.Generic
;
using
System.IO
;
using
System.Linq
;
using
Codice.Client.BaseCommands
;
using
Codice.Client.Commands
;
using
PlasticGui.WorkspaceWindow.Diff
;
using
PlasticGui.WorkspaceWindow.PendingChanges
;
namespace
Unity.PlasticSCM.Editor.Views.PendingChanges
{
internal
static
class
PendingChangesSelection
{
internal
static
void
SelectChanges
(
PendingChangesTreeView
treeView
,
List
<
ChangeInfo
>
changesToSelect
)
{
if
(
changesToSelect
==
null
||
changesToSelect
.
Count
==
0
)
{
treeView
.
SelectFirstPendingChangeOnTree
();
return
;
}
treeView
.
SelectPreviouslySelectedPendingChanges
(
changesToSelect
);
if
(
treeView
.
HasSelection
())
return
;
treeView
.
SelectFirstPendingChangeOnTree
();
}
internal
static
List
<
string
>
GetSelectedPathsWithoutMeta
(
PendingChangesTreeView
treeView
)
{
return
treeView
.
GetSelectedChanges
(
false
)
.
Select
(
change
=>
change
.
GetFullPath
()).
ToList
();
}
internal
static
List
<
string
>
GetSelectedPaths
(
PendingChangesTreeView
treeView
)
{
return
treeView
.
GetSelectedChanges
(
true
)
.
Select
(
change
=>
change
.
GetFullPath
()).
ToList
();
}
internal
static
List
<
string
>
GetSelectedMetaPaths
(
PendingChangesTreeView
treeView
)
{
List
<
ChangeInfo
>
selectedChanges
=
PendingChangesSelection
.
GetSelectedChanges
(
treeView
);
List
<
string
>
result
=
new
List
<
string
>();
foreach
(
ChangeInfo
change
in
selectedChanges
)
{
string
path
=
change
.
GetFullPath
();
if
(!
MetaPath
.
IsMetaPath
(
path
))
continue
;
result
.
Add
(
path
);
}
return
result
;
}
internal
static
List
<
ChangeInfo
>
GetAllChanges
(
PendingChangesTreeView
treeView
)
{
return
treeView
.
GetAllChanges
();
}
internal
static
List
<
ChangeInfo
>
GetChangesToFocus
(
PendingChangesTreeView
treeView
)
{
List
<
ChangeInfo
>
selectedChanges
=
treeView
.
GetSelectedChanges
(
true
);
if
(
selectedChanges
.
Count
==
0
)
return
selectedChanges
;
List
<
ChangeInfo
>
changesToFocus
=
selectedChanges
.
Where
(
change
=>
!
IsAddedFile
(
change
)).
ToList
();
if
(
changesToFocus
.
Count
()
==
0
)
{
ChangeInfo
nearestAddedChange
=
treeView
.
GetNearestAddedChange
();
if
(
nearestAddedChange
!=
null
)
changesToFocus
.
Add
(
nearestAddedChange
);
}
return
changesToFocus
;
}
internal
static
SelectedChangesGroupInfo
GetSelectedChangesGroupInfo
(
PendingChangesTreeView
treeView
)
{
SelectedChangesGroupInfo
result
=
treeView
.
GetSelectedChangesGroupInfo
();
result
.
IsApplicableDiffWorkspaceContent
=
IsApplicableDiffWorkspaceContent
(
treeView
);
return
result
;
}
internal
static
List
<
ChangeInfo
>
GetSelectedChanges
(
PendingChangesTreeView
treeView
)
{
return
treeView
.
GetSelectedChanges
(
true
);
}
internal
static
ChangeInfo
GetSelectedChange
(
PendingChangesTreeView
treeView
)
{
return
treeView
.
GetSelectedRow
();
}
static
bool
IsApplicableDiffWorkspaceContent
(
PendingChangesTreeView
treeView
)
{
ChangeInfo
selectedRow
=
GetSelectedChange
(
treeView
);
if
(
selectedRow
==
null
)
return
false
;
return
DiffOperation
.
IsApplicableDiffWorkspaceContent
(
selectedRow
);
}
static
bool
IsAddedFile
(
ChangeInfo
change
)
{
return
ChangeTypesClassifier
.
IsInAddedCategory
(
change
.
ChangeTypes
)
&&
!(
Directory
.
Exists
(
change
.
Path
)
||
File
.
Exists
(
change
.
Path
));
}
}
}
ydk2021/New Unity Project/Library/PackageCache/com.unity.collab-proxy@1.5.7/Editor/PlasticSCM/Views/PendingChanges/PendingChangesTab.cs
0 → 100644
View file @
1c847220
using
System
;
using
System.Collections.Generic
;
using
UnityEditor
;
using
UnityEditor.IMGUI.Controls
;
using
UnityEngine
;
using
Codice.Client.BaseCommands
;
using
Codice.Client.Common.FsNodeReaders
;
using
Codice.Client.Common.Threading
;
using
Codice.CM.Common
;
using
Codice.LogWrapper
;
using
PlasticGui
;
using
PlasticGui.Help.Actions
;
using
PlasticGui.Help.Conditions
;
using
PlasticGui.WorkspaceWindow
;
using
PlasticGui.WorkspaceWindow.Diff
;
using
PlasticGui.WorkspaceWindow.Items
;
using
PlasticGui.WorkspaceWindow.Open
;
using
PlasticGui.WorkspaceWindow.PendingChanges
;
using
Unity.PlasticSCM.Editor.AssetUtils
;
using
Unity.PlasticSCM.Editor.Help
;
using
Unity.PlasticSCM.Editor.UI
;
using
Unity.PlasticSCM.Editor.UI.Progress
;
using
Unity.PlasticSCM.Editor.UI.Tree
;
using
Unity.PlasticSCM.Editor.Views.PendingChanges.Dialogs
;
using
Unity.PlasticSCM.Editor.Views.PendingChanges.PendingMergeLinks
;
using
Unity.PlasticSCM.Editor.AssetsOverlays.Cache
;
using
Unity.PlasticSCM.Editor.AssetsOverlays
;
namespace
Unity.PlasticSCM.Editor.Views.PendingChanges
{
internal
class
PendingChangesTab
:
IRefreshableView
,
PendingChangesViewMenu
.
IMetaMenuOperations
,
IPendingChangesMenuOperations
,
IOpenMenuOperations
,
IFilesFilterPatternsMenuOperations
,
PendingChangesOptionsDialog
.
IAutorefreshView
{
internal
IProgressControls
ProgressControlsForTesting
{
get
{
return
mProgressControls
;
}
}
internal
HelpPanel
HelpPanelForTesting
{
get
{
return
mHelpPanel
;
}
}
internal
PendingChangesTab
(
WorkspaceInfo
wkInfo
,
PlasticGUIClient
plasticClient
,
bool
isGluonMode
,
PlasticGui
.
WorkspaceWindow
.
PendingChanges
.
PendingChanges
pendingChanges
,
NewIncomingChangesUpdater
developerNewIncomingChangesUpdater
,
IHistoryViewLauncher
historyViewLauncher
,
IAssetStatusCache
assetStatusCache
,
EditorWindow
parentWindow
)
{
mWkInfo
=
wkInfo
;
mPlasticClient
=
plasticClient
;
mIsGluonMode
=
isGluonMode
;
mDeveloperNewIncomingChangesUpdater
=
developerNewIncomingChangesUpdater
;
mPendingChanges
=
pendingChanges
;
mHistoryViewLauncher
=
historyViewLauncher
;
mAssetStatusCache
=
assetStatusCache
;
mParentWindow
=
parentWindow
;
mNewChangesInWk
=
NewChangesInWk
.
Build
(
mWkInfo
,
new
BuildWorkspacekIsRelevantNewChange
());
BuildComponents
(
plasticClient
,
isGluonMode
,
parentWindow
);
mProgressControls
=
new
ProgressControlsForViews
();
plasticClient
.
RegisterPendingChangesGuiControls
(
mProgressControls
,
mPendingChangesTreeView
,
mMergeLinksListView
);
InitIgnoreRulesAndRefreshView
(
mWkInfo
.
ClientPath
,
this
);
}
internal
void
AutoRefresh
()
{
if
(
mIsAutoRefreshDisabled
)
return
;
if
(!
PlasticGuiConfig
.
Get
().
Configuration
.
CommitAutoRefresh
)
return
;
if
(
mPlasticClient
.
IsRefreshing
()
||
mPlasticClient
.
IsOperationInProgress
())
return
;
if
(
mNewChangesInWk
!=
null
&&
!
mNewChangesInWk
.
Detected
())
return
;
((
IRefreshableView
)
this
).
Refresh
();
}
internal
void
OnDisable
()
{
mSearchField
.
downOrUpArrowKeyPressed
-=
SearchField_OnDownOrUpArrowKeyPressed
;
TreeHeaderSettings
.
Save
(
mPendingChangesTreeView
.
multiColumnHeader
.
state
,
UnityConstants
.
PENDING_CHANGES_TABLE_SETTINGS_NAME
);
}
internal
void
Update
()
{
mProgressControls
.
UpdateProgress
(
mParentWindow
);
}
internal
void
OnGUI
()
{
DrawCommentTextArea
.
For
(
mPlasticClient
,
mParentWindow
.
position
.
width
,
mProgressControls
.
IsOperationRunning
());
DoOperationsToolbar
(
mPlasticClient
,
mWkInfo
,
mIsGluonMode
,
mAdvancedDropdownMenu
,
mProgressControls
.
IsOperationRunning
());
if
(!
string
.
IsNullOrEmpty
(
mPlasticClient
.
GluonWarningMessage
))
DoWarningMessage
(
mPlasticClient
.
GluonWarningMessage
);
DoActionsToolbar
(
mWkInfo
,
mIsGluonMode
,
this
,
mProgressControls
,
mParentWindow
);
DoChangesArea
(
mPendingChangesTreeView
,
mProgressControls
.
IsOperationRunning
());
if
(
mPlasticClient
.
HasPendingMergeLinks
())
DoMergeLinksArea
(
mMergeLinksListView
,
mParentWindow
.
position
.
width
);
if
(
mProgressControls
.
HasNotification
())
{
DrawProgressForViews
.
ForNotificationArea
(
mProgressControls
.
ProgressData
);
}
DrawHelpPanel
.
For
(
mHelpPanel
);
}
void
IRefreshableView
.
Refresh
()
{
if
(!
mAreIgnoreRulesInitialized
)
return
;
DrawAssetOverlay
.
ClearCache
();
mPlasticClient
.
GetPendingChanges
(
mNewChangesInWk
);
}
void
PendingChangesOptionsDialog
.
IAutorefreshView
.
DisableAutorefresh
()
{
mIsAutoRefreshDisabled
=
true
;
}
void
PendingChangesOptionsDialog
.
IAutorefreshView
.
EnableAutorefresh
()
{
mIsAutoRefreshDisabled
=
false
;
}
bool
PendingChangesViewMenu
.
IMetaMenuOperations
.
SelectionHasMeta
()
{
return
mPendingChangesTreeView
.
SelectionHasMeta
();
}
void
PendingChangesViewMenu
.
IMetaMenuOperations
.
DiffMeta
()
{
ChangeInfo
selectedChange
=
PendingChangesSelection
.
GetSelectedChange
(
mPendingChangesTreeView
);
ChangeInfo
selectedChangeMeta
=
mPendingChangesTreeView
.
GetMetaChange
(
selectedChange
);
ChangeInfo
changedForMoved
=
mPendingChanges
.
GetChangedForMoved
(
selectedChange
);
ChangeInfo
changedForMovedMeta
=
(
changedForMoved
==
null
)
?
null
:
mPendingChangesTreeView
.
GetMetaChange
(
changedForMoved
);
DiffOperation
.
DiffWorkspaceContent
(
mWkInfo
,
selectedChangeMeta
,
changedForMovedMeta
,
mProgressControls
,
null
,
null
);
}
void
PendingChangesViewMenu
.
IMetaMenuOperations
.
HistoryMeta
()
{
ChangeInfo
selectedChange
=
PendingChangesSelection
.
GetSelectedChange
(
mPendingChangesTreeView
);
ChangeInfo
selectedChangeMeta
=
mPendingChangesTreeView
.
GetMetaChange
(
selectedChange
);
mHistoryViewLauncher
.
ShowHistoryView
(
selectedChangeMeta
.
RepositorySpec
,
selectedChangeMeta
.
RevInfo
.
ItemId
,
selectedChangeMeta
.
Path
,
selectedChangeMeta
.
IsDirectory
);
}
void
PendingChangesViewMenu
.
IMetaMenuOperations
.
OpenMeta
()
{
List
<
string
>
selectedPaths
=
PendingChangesSelection
.
GetSelectedMetaPaths
(
mPendingChangesTreeView
);
FileSystemOperation
.
Open
(
selectedPaths
);
}
void
PendingChangesViewMenu
.
IMetaMenuOperations
.
OpenMetaWith
()
{
List
<
string
>
selectedPaths
=
PendingChangesSelection
.
GetSelectedMetaPaths
(
mPendingChangesTreeView
);
OpenOperation
.
OpenWith
(
FileSystemOperation
.
GetExePath
(),
selectedPaths
);
}
void
PendingChangesViewMenu
.
IMetaMenuOperations
.
OpenMetaInExplorer
()
{
List
<
string
>
selectedPaths
=
PendingChangesSelection
.
GetSelectedMetaPaths
(
mPendingChangesTreeView
);
if
(
selectedPaths
.
Count
<
1
)
return
;
FileSystemOperation
.
OpenInExplorer
(
selectedPaths
[
0
]);
}
SelectedChangesGroupInfo
IPendingChangesMenuOperations
.
GetSelectedChangesGroupInfo
()
{
return
PendingChangesSelection
.
GetSelectedChangesGroupInfo
(
mPendingChangesTreeView
);
}
void
IPendingChangesMenuOperations
.
Diff
()
{
ChangeInfo
selectedChange
=
PendingChangesSelection
.
GetSelectedChange
(
mPendingChangesTreeView
);
DiffOperation
.
DiffWorkspaceContent
(
mWkInfo
,
selectedChange
,
mPendingChanges
.
GetChangedForMoved
(
selectedChange
),
null
,
null
,
null
);
}
void
IPendingChangesMenuOperations
.
UndoChanges
()
{
List
<
ChangeInfo
>
changesToUndo
=
PendingChangesSelection
.
GetSelectedChanges
(
mPendingChangesTreeView
);
List
<
ChangeInfo
>
dependenciesCandidates
=
mPendingChangesTreeView
.
GetDependenciesCandidates
(
changesToUndo
,
true
);
LaunchOperation
.
UndoChangesForMode
(
mIsGluonMode
,
mPlasticClient
,
changesToUndo
,
dependenciesCandidates
);
}
void
IPendingChangesMenuOperations
.
SearchMatches
()
{
ChangeInfo
selectedChange
=
PendingChangesSelection
.
GetSelectedChange
(
mPendingChangesTreeView
);
if
(
selectedChange
==
null
)
return
;
SearchMatchesOperation
operation
=
new
SearchMatchesOperation
(
mWkInfo
,
mPlasticClient
,
mPlasticClient
,
mProgressControls
,
mDeveloperNewIncomingChangesUpdater
);
operation
.
SearchMatches
(
selectedChange
,
PendingChangesSelection
.
GetAllChanges
(
mPendingChangesTreeView
));
}
void
IPendingChangesMenuOperations
.
ApplyLocalChanges
()
{
List
<
ChangeInfo
>
selectedChanges
=
PendingChangesSelection
.
GetSelectedChanges
(
mPendingChangesTreeView
);
if
(
selectedChanges
.
Count
==
0
)
return
;
ApplyLocalChangesOperation
operation
=
new
ApplyLocalChangesOperation
(
mWkInfo
,
mPlasticClient
,
mPlasticClient
,
mProgressControls
,
mDeveloperNewIncomingChangesUpdater
);
operation
.
ApplyLocalChanges
(
selectedChanges
,
PendingChangesSelection
.
GetAllChanges
(
mPendingChangesTreeView
));
}
void
IPendingChangesMenuOperations
.
Delete
()
{
List
<
string
>
privateDirectoriesToDelete
;
List
<
string
>
privateFilesToDelete
;
if
(!
mPendingChangesTreeView
.
GetSelectedPathsToDelete
(
out
privateDirectoriesToDelete
,
out
privateFilesToDelete
))
return
;
DeleteOperation
.
Delete
(
mPlasticClient
,
mProgressControls
,
privateDirectoriesToDelete
,
privateFilesToDelete
,
mDeveloperNewIncomingChangesUpdater
,
RefreshAsset
.
UnityAssetDatabase
);
}
void
IPendingChangesMenuOperations
.
Annotate
()
{
throw
new
NotImplementedException
();
}
void
IPendingChangesMenuOperations
.
History
()
{
ChangeInfo
selectedChange
=
PendingChangesSelection
.
GetSelectedChange
(
mPendingChangesTreeView
);
mHistoryViewLauncher
.
ShowHistoryView
(
selectedChange
.
RepositorySpec
,
selectedChange
.
RevInfo
.
ItemId
,
selectedChange
.
Path
,
selectedChange
.
IsDirectory
);
}
void
IOpenMenuOperations
.
Open
()
{
List
<
string
>
selectedPaths
=
PendingChangesSelection
.
GetSelectedPathsWithoutMeta
(
mPendingChangesTreeView
);
FileSystemOperation
.
Open
(
selectedPaths
);
}
void
IOpenMenuOperations
.
OpenWith
()
{
List
<
string
>
selectedPaths
=
PendingChangesSelection
.
GetSelectedPathsWithoutMeta
(
mPendingChangesTreeView
);
OpenOperation
.
OpenWith
(
FileSystemOperation
.
GetExePath
(),
selectedPaths
);
}
void
IOpenMenuOperations
.
OpenWithCustom
(
string
exePath
,
string
args
)
{
List
<
string
>
selectedPaths
=
PendingChangesSelection
.
GetSelectedPathsWithoutMeta
(
mPendingChangesTreeView
);
OpenOperation
.
OpenWith
(
exePath
,
selectedPaths
);
}
void
IOpenMenuOperations
.
OpenInExplorer
()
{
List
<
string
>
selectedPaths
=
PendingChangesSelection
.
GetSelectedPathsWithoutMeta
(
mPendingChangesTreeView
);
if
(
selectedPaths
.
Count
<
1
)
return
;
FileSystemOperation
.
OpenInExplorer
(
selectedPaths
[
0
]);
}
void
IFilesFilterPatternsMenuOperations
.
AddFilesFilterPatterns
(
FilterTypes
type
,
FilterActions
action
,
FilterOperationType
operation
)
{
List
<
string
>
selectedPaths
=
PendingChangesSelection
.
GetSelectedPaths
(
mPendingChangesTreeView
);
string
[]
rules
=
FilterRulesGenerator
.
GenerateRules
(
selectedPaths
,
mWkInfo
.
ClientPath
,
action
,
operation
);
bool
isApplicableToAllWorkspaces
=
!
mIsGluonMode
;
bool
isAddOperation
=
operation
==
FilterOperationType
.
Add
;
FilterRulesConfirmationData
filterRulesConfirmationData
=
FilterRulesConfirmationDialog
.
AskForConfirmation
(
rules
,
isAddOperation
,
isApplicableToAllWorkspaces
,
mParentWindow
);
AddFilesFilterPatternsOperation
.
Run
(
mWkInfo
,
mPlasticClient
,
type
,
operation
,
filterRulesConfirmationData
);
}
void
SearchField_OnDownOrUpArrowKeyPressed
()
{
mPendingChangesTreeView
.
SetFocusAndEnsureSelectedItem
();
}
void
InitIgnoreRulesAndRefreshView
(
string
wkPath
,
IRefreshableView
view
)
{
IThreadWaiter
waiter
=
ThreadWaiter
.
GetWaiter
(
10
);
waiter
.
Execute
(
/*threadOperationDelegate*/
delegate
{
if
(
IsIgnoreConfigDefined
.
For
(
wkPath
))
return
;
AddIgnoreRules
.
WriteRules
(
wkPath
,
UnityConditions
.
GetMissingIgnoredRules
(
wkPath
));
},
/*afterOperationDelegate*/
delegate
{
mAreIgnoreRulesInitialized
=
true
;
view
.
Refresh
();
if
(
waiter
.
Exception
==
null
)
return
;
mLog
.
ErrorFormat
(
"Error adding ignore rules for Unity: {0}"
,
waiter
.
Exception
);
mLog
.
DebugFormat
(
"Stack trace: {0}"
,
waiter
.
Exception
.
StackTrace
);
});
}
static
void
DoOperationsToolbar
(
PlasticGUIClient
plasticClient
,
WorkspaceInfo
wkInfo
,
bool
isGluonMode
,
GenericMenu
advancedDropdownMenu
,
bool
isOperationRunning
)
{
EditorGUILayout
.
BeginHorizontal
(
EditorStyles
.
toolbar
);
GUISpace
.
ForToolbar
();
using
(
new
GuiEnabled
(!
isOperationRunning
))
{
using
(
new
GuiEnabled
(!
plasticClient
.
IsCommentWarningNeeded
))
{
var
checkinchanges
=
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
CheckinChanges
);
if
(
DrawActionButton
.
For
(
checkinchanges
))
{
LaunchOperation
.
CheckinForMode
(
wkInfo
,
isGluonMode
,
plasticClient
.
KeepItemsLocked
,
plasticClient
);
}
}
var
undochanges
=
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
UndoChanges
);
if
(
DrawActionButton
.
For
(
undochanges
))
{
LaunchOperation
.
UndoForMode
(
isGluonMode
,
plasticClient
);
}
if
(
isGluonMode
)
{
plasticClient
.
KeepItemsLocked
=
EditorGUILayout
.
ToggleLeft
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
KeepLocked
),
plasticClient
.
KeepItemsLocked
,
GUILayout
.
Width
(
UnityConstants
.
EXTRA_LARGE_BUTTON_WIDTH
));
}
//TODO: Codice - beta: hide the advanced menu until the behavior is implemented
/*else
{
var dropDownContent = new GUIContent(string.Empty);
var dropDownRect = GUILayoutUtility.GetRect(
dropDownContent, EditorStyles.toolbarDropDown);
if (EditorGUI.DropdownButton(dropDownRect, dropDownContent,
FocusType.Passive, EditorStyles.toolbarDropDown))
advancedDropdownMenu.DropDown(dropDownRect);
}*/
}
if
(
plasticClient
.
IsCommentWarningNeeded
)
{
GUILayout
.
Space
(
5
);
DoCheckinWarningMessage
();
}
GUILayout
.
FlexibleSpace
();
EditorGUILayout
.
EndHorizontal
();
}
static
void
DoWarningMessage
(
string
message
)
{
GUILayout
.
Label
(
message
,
UnityStyles
.
WarningMessage
);
}
static
void
DoCheckinWarningMessage
()
{
string
label
=
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
PleaseComment
);
GUILayout
.
Label
(
new
GUIContent
(
label
,
Images
.
GetWarnIcon
()),
UnityStyles
.
PendingChangesTab
.
CommentWarningIcon
);
}
void
DoActionsToolbar
(
WorkspaceInfo
workspaceInfo
,
bool
isGluonMode
,
IRefreshableView
refreshableView
,
ProgressControlsForViews
progressControls
,
EditorWindow
editorWindow
)
{
EditorGUILayout
.
BeginHorizontal
(
EditorStyles
.
toolbar
);
string
checkinHeader
=
string
.
Format
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
CheckinHeader
),
mPendingChangesTreeView
.
GetSelectedItemCount
(),
mPendingChangesTreeView
.
GetTotalItemCount
());
GUILayout
.
Label
(
checkinHeader
,
UnityStyles
.
PendingChangesTab
.
HeaderLabel
);
if
(
progressControls
.
IsOperationRunning
())
{
DrawProgressForViews
.
ForIndeterminateProgress
(
progressControls
.
ProgressData
);
}
GUILayout
.
FlexibleSpace
();
DrawSearchField
.
For
(
mSearchField
,
mPendingChangesTreeView
,
UnityConstants
.
SEARCH_FIELD_WIDTH
);
if
(
GUILayout
.
Button
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
Options
),
EditorStyles
.
toolbarButton
,
GUILayout
.
Width
(
UnityConstants
.
REGULAR_BUTTON_WIDTH
)))
{
PendingChangesOptionsDialog
.
ChangeOptions
(
workspaceInfo
,
refreshableView
,
this
,
editorWindow
);
GUIUtility
.
ExitGUI
();
}
DoRefreshButton
(
refreshableView
,
progressControls
.
IsOperationRunning
());
EditorGUILayout
.
EndHorizontal
();
}
static
void
DoChangesArea
(
PendingChangesTreeView
changesTreeView
,
bool
isOperationRunning
)
{
GUI
.
enabled
=
!
isOperationRunning
;
Rect
rect
=
GUILayoutUtility
.
GetRect
(
0
,
100000
,
0
,
100000
);
changesTreeView
.
OnGUI
(
rect
);
GUI
.
enabled
=
true
;
}
static
void
DoMergeLinksArea
(
MergeLinksListView
mergeLinksListView
,
float
width
)
{
GUILayout
.
Label
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
MergeLinkDescriptionColumn
),
EditorStyles
.
boldLabel
);
float
desiredTreeHeight
=
mergeLinksListView
.
DesiredHeight
;
Rect
treeRect
=
GUILayoutUtility
.
GetRect
(
0
,
width
,
desiredTreeHeight
,
desiredTreeHeight
);
mergeLinksListView
.
OnGUI
(
treeRect
);
}
static
void
DoRefreshButton
(
IRefreshableView
refreshableView
,
bool
isOperationRunning
)
{
EditorGUI
.
BeginDisabledGroup
(
isOperationRunning
);
if
(
GUILayout
.
Button
(
new
GUIContent
(
Images
.
GetRefreshIcon
()),
EditorStyles
.
toolbarButton
))
refreshableView
.
Refresh
();
EditorGUI
.
EndDisabledGroup
();
}
void
BuildComponents
(
PlasticGUIClient
plasticClient
,
bool
isGluonMode
,
EditorWindow
plasticWindow
)
{
mHelpPanel
=
new
HelpPanel
(
plasticWindow
);
mAdvancedDropdownMenu
=
new
GenericMenu
();
mAdvancedDropdownMenu
.
AddItem
(
new
GUIContent
(
PlasticLocalization
.
GetString
(
PlasticLocalization
.
Name
.
UndoUnchangedButton
)),
false
,
()
=>
{
});
mSearchField
=
new
SearchField
();
mSearchField
.
downOrUpArrowKeyPressed
+=
SearchField_OnDownOrUpArrowKeyPressed
;
PendingChangesTreeHeaderState
headerState
=
PendingChangesTreeHeaderState
.
GetDefault
(
isGluonMode
);
TreeHeaderSettings
.
Load
(
headerState
,
UnityConstants
.
PENDING_CHANGES_TABLE_SETTINGS_NAME
,
(
int
)
PendingChangesTreeColumn
.
Item
,
true
);
mPendingChangesTreeView
=
new
PendingChangesTreeView
(
mWkInfo
,
mIsGluonMode
,
headerState
,
PendingChangesTreeHeaderState
.
GetColumnNames
(),
new
PendingChangesViewMenu
(
this
,
this
,
this
,
this
),
mAssetStatusCache
);
mPendingChangesTreeView
.
Reload
();
mMergeLinksListView
=
new
MergeLinksListView
();
mMergeLinksListView
.
Reload
();
}
SearchField
mSearchField
;
INewChangesInWk
mNewChangesInWk
;
GenericMenu
mAdvancedDropdownMenu
;
PendingChangesTreeView
mPendingChangesTreeView
;
MergeLinksListView
mMergeLinksListView
;
HelpPanel
mHelpPanel
;
bool
mIsAutoRefreshDisabled
;
volatile
bool
mAreIgnoreRulesInitialized
=
false
;
readonly
ProgressControlsForViews
mProgressControls
;
readonly
EditorWindow
mParentWindow
;
readonly
IAssetStatusCache
mAssetStatusCache
;
readonly
IHistoryViewLauncher
mHistoryViewLauncher
;
readonly
PlasticGui
.
WorkspaceWindow
.
PendingChanges
.
PendingChanges
mPendingChanges
;
readonly
NewIncomingChangesUpdater
mDeveloperNewIncomingChangesUpdater
;
readonly
bool
mIsGluonMode
;
readonly
PlasticGUIClient
mPlasticClient
;
readonly
WorkspaceInfo
mWkInfo
;
static
readonly
ILog
mLog
=
LogManager
.
GetLogger
(
"PendingChangesTab"
);
}
}
Prev
1
…
27
28
29
30
31
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