first commit
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
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, int depth)
|
||||
: base(id, depth)
|
||||
{
|
||||
Category = category;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ade7225274b3d4c32a9eb7e64f83c5a1
|
||||
timeCreated: 1539786107
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,21 @@
|
||||
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, int depth)
|
||||
: base(id, depth)
|
||||
{
|
||||
ChangeInfo = change;
|
||||
|
||||
displayName = change.GetColumnText(PlasticLocalization.GetString(
|
||||
PlasticLocalization.Name.ItemColumn));
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a9e847d045a7744b08c7a37912965cdc
|
||||
timeCreated: 1539688098
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,18 @@
|
||||
using UnityEditor.IMGUI.Controls;
|
||||
|
||||
using PlasticGui.WorkspaceWindow.PendingChanges;
|
||||
using PlasticGui.WorkspaceWindow.PendingChanges.Changelists;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Views.PendingChanges
|
||||
{
|
||||
internal class ChangelistTreeViewItem : TreeViewItem
|
||||
{
|
||||
internal ChangelistNode Changelist { get; private set; }
|
||||
|
||||
internal ChangelistTreeViewItem(int id, ChangelistNode changelist)
|
||||
: base(id, 0)
|
||||
{
|
||||
Changelist = changelist;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e1a6d107a6d177540bc36d82a9449128
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 090403d21f0cddf46805f00282634419
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,190 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
using PlasticGui;
|
||||
using PlasticGui.WorkspaceWindow.PendingChanges.Changelists;
|
||||
using Unity.PlasticSCM.Editor.UI;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Views.PendingChanges.Changelists
|
||||
{
|
||||
internal class ChangelistMenu
|
||||
{
|
||||
internal ChangelistMenu(
|
||||
IChangelistMenuOperations changelistMenuOperations,
|
||||
bool isGluonMode)
|
||||
{
|
||||
mChangelistMenuOperations = changelistMenuOperations;
|
||||
|
||||
BuildComponents(isGluonMode);
|
||||
}
|
||||
|
||||
internal void Popup()
|
||||
{
|
||||
GenericMenu menu = new GenericMenu();
|
||||
|
||||
UpdateMenuItems(menu);
|
||||
|
||||
menu.ShowAsContext();
|
||||
}
|
||||
|
||||
internal bool ProcessKeyActionIfNeeded(Event e)
|
||||
{
|
||||
ChangelistMenuOperations operationToExecute = GetMenuOperations(e);
|
||||
|
||||
if (operationToExecute == ChangelistMenuOperations.None)
|
||||
return false;
|
||||
|
||||
ChangelistMenuOperations operations =
|
||||
ChangelistMenuUpdater.GetAvailableMenuOperations(
|
||||
mChangelistMenuOperations.GetSelectedChangesGroupInfo(),
|
||||
mChangelistMenuOperations.GetSelectedChangelistInfos());
|
||||
|
||||
if (!operations.HasFlag(operationToExecute))
|
||||
return false;
|
||||
|
||||
ProcessMenuOperation(operationToExecute, mChangelistMenuOperations);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CheckinChangelistMenuItem_Click()
|
||||
{
|
||||
mChangelistMenuOperations.Checkin();
|
||||
}
|
||||
|
||||
void ShelveChangelistMenuItem_Click()
|
||||
{
|
||||
mChangelistMenuOperations.Shelve();
|
||||
}
|
||||
|
||||
void UndoChangelistMenuItem_Click()
|
||||
{
|
||||
mChangelistMenuOperations.Undo();
|
||||
}
|
||||
|
||||
void CreateNewChangelistMenuItem_Click()
|
||||
{
|
||||
mChangelistMenuOperations.CreateNew();
|
||||
}
|
||||
|
||||
void EditChangelistMenuItem_Click()
|
||||
{
|
||||
mChangelistMenuOperations.Edit();
|
||||
}
|
||||
|
||||
void DeleteChangelistMenuItem_Click()
|
||||
{
|
||||
mChangelistMenuOperations.Delete();
|
||||
}
|
||||
|
||||
void UpdateMenuItems(GenericMenu menu)
|
||||
{
|
||||
ChangelistMenuOperations operations = ChangelistMenuUpdater.GetAvailableMenuOperations(
|
||||
mChangelistMenuOperations.GetSelectedChangesGroupInfo(),
|
||||
mChangelistMenuOperations.GetSelectedChangelistInfos());
|
||||
|
||||
if (operations == ChangelistMenuOperations.None)
|
||||
{
|
||||
menu.AddDisabledItem(GetNoActionMenuItemContent());
|
||||
return;
|
||||
}
|
||||
|
||||
if (operations.HasFlag(ChangelistMenuOperations.Checkin))
|
||||
menu.AddItem(mCheckinChangelistMenuItemContent, false, CheckinChangelistMenuItem_Click);
|
||||
else
|
||||
menu.AddDisabledItem(mCheckinChangelistMenuItemContent);
|
||||
|
||||
if (mShelveChangelistMenuItemContent != null)
|
||||
{
|
||||
if (operations.HasFlag(ChangelistMenuOperations.Shelve))
|
||||
menu.AddItem(mShelveChangelistMenuItemContent, false, ShelveChangelistMenuItem_Click);
|
||||
else
|
||||
menu.AddDisabledItem(mShelveChangelistMenuItemContent);
|
||||
}
|
||||
|
||||
menu.AddSeparator(string.Empty);
|
||||
|
||||
if (operations.HasFlag(ChangelistMenuOperations.Undo))
|
||||
menu.AddItem(mUndoChangelistMenuItemContent, false, UndoChangelistMenuItem_Click);
|
||||
else
|
||||
menu.AddDisabledItem(mUndoChangelistMenuItemContent);
|
||||
|
||||
menu.AddSeparator(string.Empty);
|
||||
|
||||
if (operations.HasFlag(ChangelistMenuOperations.CreateNew))
|
||||
menu.AddItem(mCreateNewChangelistMenuItemContent, false, CreateNewChangelistMenuItem_Click);
|
||||
else
|
||||
menu.AddDisabledItem(mCreateNewChangelistMenuItemContent);
|
||||
|
||||
if (operations.HasFlag(ChangelistMenuOperations.Edit))
|
||||
menu.AddItem(mEditChangelistMenuItemContent, false, EditChangelistMenuItem_Click);
|
||||
else
|
||||
menu.AddDisabledItem(mEditChangelistMenuItemContent);
|
||||
|
||||
if (operations.HasFlag(ChangelistMenuOperations.Delete))
|
||||
menu.AddItem(mDeleteChangelistMenuItemContent, false, DeleteChangelistMenuItem_Click);
|
||||
else
|
||||
menu.AddDisabledItem(mDeleteChangelistMenuItemContent);
|
||||
}
|
||||
|
||||
GUIContent GetNoActionMenuItemContent()
|
||||
{
|
||||
if (mNoActionMenuItemContent == null)
|
||||
{
|
||||
mNoActionMenuItemContent = new GUIContent(PlasticLocalization.GetString(
|
||||
PlasticLocalization.Name.NoActionMenuItem));
|
||||
}
|
||||
|
||||
return mNoActionMenuItemContent;
|
||||
}
|
||||
|
||||
static ChangelistMenuOperations GetMenuOperations(Event e)
|
||||
{
|
||||
if (Keyboard.IsKeyPressed(e, KeyCode.Delete))
|
||||
return ChangelistMenuOperations.Delete;
|
||||
|
||||
return ChangelistMenuOperations.None;
|
||||
}
|
||||
|
||||
static void ProcessMenuOperation(
|
||||
ChangelistMenuOperations operationToExecute,
|
||||
IChangelistMenuOperations changelistMenuOperations)
|
||||
{
|
||||
if (operationToExecute == ChangelistMenuOperations.Delete)
|
||||
{
|
||||
changelistMenuOperations.Delete();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void BuildComponents(bool isGluonMode)
|
||||
{
|
||||
mCheckinChangelistMenuItemContent = new GUIContent(
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.CheckinChangelist));
|
||||
|
||||
if (!isGluonMode)
|
||||
mShelveChangelistMenuItemContent = new GUIContent(
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.ShelveChangelist));
|
||||
|
||||
mUndoChangelistMenuItemContent = new GUIContent(
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.UndoChangesChangelist));
|
||||
mCreateNewChangelistMenuItemContent = new GUIContent(
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.CreateNewChangelist));
|
||||
mEditChangelistMenuItemContent = new GUIContent(
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.EditChangelist));
|
||||
mDeleteChangelistMenuItemContent = new GUIContent(string.Format("{0} {1}",
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.DeleteChangelist),
|
||||
GetPlasticShortcut.ForDelete()));
|
||||
}
|
||||
|
||||
GUIContent mNoActionMenuItemContent;
|
||||
GUIContent mCheckinChangelistMenuItemContent;
|
||||
GUIContent mShelveChangelistMenuItemContent;
|
||||
GUIContent mUndoChangelistMenuItemContent;
|
||||
GUIContent mCreateNewChangelistMenuItemContent;
|
||||
GUIContent mEditChangelistMenuItemContent;
|
||||
GUIContent mDeleteChangelistMenuItemContent;
|
||||
|
||||
readonly IChangelistMenuOperations mChangelistMenuOperations;
|
||||
bool mIsGluonMode;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1505aa96e5fd82940aacd76e6431e79d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,90 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
using Codice.Client.BaseCommands;
|
||||
using Codice.Client.Commands;
|
||||
using Codice.CM.Common;
|
||||
using PlasticGui;
|
||||
using PlasticGui.WorkspaceWindow.PendingChanges.Changelists;
|
||||
using Unity.PlasticSCM.Editor.UI;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Views.PendingChanges.Changelists
|
||||
{
|
||||
internal class MoveToChangelistMenuBuilder
|
||||
{
|
||||
internal MoveToChangelistMenuBuilder(
|
||||
WorkspaceInfo wkInfo,
|
||||
IChangelistMenuOperations operations)
|
||||
{
|
||||
mWkInfo = wkInfo;
|
||||
mOperations = operations;
|
||||
}
|
||||
|
||||
internal void BuildComponents()
|
||||
{
|
||||
mMoveToChangelistMenuItemContent = new GUIContent(
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.MoveToChangelist));
|
||||
mNewChangelistMenuItemContent = new GUIContent(GetSubMenuText(
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.New)));
|
||||
}
|
||||
|
||||
internal void UpdateMenuItems(
|
||||
GenericMenu menu,
|
||||
ChangelistMenuOperations operations,
|
||||
List<ChangeInfo> changes,
|
||||
List<ChangeListInfo> involvedChangelists)
|
||||
{
|
||||
if (!operations.HasFlag(ChangelistMenuOperations.MoveToChangelist))
|
||||
{
|
||||
menu.AddDisabledItem(mMoveToChangelistMenuItemContent);
|
||||
return;
|
||||
}
|
||||
|
||||
menu.AddItem(
|
||||
mNewChangelistMenuItemContent,
|
||||
false,
|
||||
() => NewChangelist_Click(changes));
|
||||
|
||||
List<string> targetChangelists = GetTargetChangelists.
|
||||
ForInvolvedChangelists(mWkInfo, involvedChangelists);
|
||||
|
||||
if (targetChangelists.Count == 0)
|
||||
return;
|
||||
|
||||
menu.AddSeparator(GetSubMenuText(string.Empty));
|
||||
|
||||
foreach (string changelist in targetChangelists)
|
||||
{
|
||||
menu.AddItem(
|
||||
new GUIContent(GetSubMenuText(changelist)),
|
||||
false,
|
||||
() => MoveToChangelist_Click(changes, changelist));
|
||||
}
|
||||
}
|
||||
|
||||
void NewChangelist_Click(List<ChangeInfo> changes)
|
||||
{
|
||||
mOperations.MoveToNewChangelist(changes);
|
||||
}
|
||||
|
||||
void MoveToChangelist_Click(List<ChangeInfo> changes, string targetChangelist)
|
||||
{
|
||||
mOperations.MoveToChangelist(changes, targetChangelist);
|
||||
}
|
||||
|
||||
static string GetSubMenuText(string subMenuName)
|
||||
{
|
||||
return UnityMenuItem.GetText(
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.MoveToChangelist),
|
||||
UnityMenuItem.EscapedText(subMenuName));
|
||||
}
|
||||
|
||||
GUIContent mMoveToChangelistMenuItemContent;
|
||||
GUIContent mNewChangelistMenuItemContent;
|
||||
|
||||
readonly WorkspaceInfo mWkInfo;
|
||||
readonly IChangelistMenuOperations mOperations;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 466ebd71b4a48b541be6d119d8140603
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e70bba63d1604ffb90a65601cb8abae
|
||||
folderAsset: yes
|
||||
timeCreated: 1541005875
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,150 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
using Codice.Client.GameUI.Checkin;
|
||||
using Codice.CM.Common.Checkin.Partial;
|
||||
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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 615fa68a626934ca28141174234fee26
|
||||
timeCreated: 1542733474
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,245 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
using Codice.Client.Commands;
|
||||
using Codice.CM.Common;
|
||||
using PlasticGui;
|
||||
using PlasticGui.WorkspaceWindow.PendingChanges.Changelists;
|
||||
using Unity.PlasticSCM.Editor.UI;
|
||||
using Unity.PlasticSCM.Editor.UI.Progress;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Views.PendingChanges.Dialogs
|
||||
{
|
||||
class CreateChangelistDialog : PlasticDialog
|
||||
{
|
||||
protected override Rect DefaultRect
|
||||
{
|
||||
get
|
||||
{
|
||||
var baseRect = base.DefaultRect;
|
||||
return new Rect(baseRect.x, baseRect.y, 710, 290);
|
||||
}
|
||||
}
|
||||
|
||||
protected override string GetTitle()
|
||||
{
|
||||
return PlasticLocalization.GetString(PlasticLocalization.Name.CreateChangelistTitle);
|
||||
}
|
||||
|
||||
protected override void OnModalGUI()
|
||||
{
|
||||
DoTitleArea();
|
||||
|
||||
DoFieldsArea();
|
||||
|
||||
DoButtonsArea();
|
||||
}
|
||||
|
||||
internal static ChangelistCreationData CreateChangelist(
|
||||
WorkspaceInfo wkInfo,
|
||||
EditorWindow parentWindow)
|
||||
{
|
||||
CreateChangelistDialog dialog = Create(wkInfo);
|
||||
ResponseType dialogueResult = dialog.RunModal(parentWindow);
|
||||
|
||||
ChangelistCreationData result = dialog.BuildCreationData();
|
||||
result.Result = dialogueResult == ResponseType.Ok;
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static ChangelistCreationData EditChangelist(
|
||||
WorkspaceInfo wkInfo,
|
||||
ChangeListInfo changelistToEdit,
|
||||
EditorWindow parentWindow)
|
||||
{
|
||||
CreateChangelistDialog dialog = Edit(wkInfo, changelistToEdit);
|
||||
ResponseType dialogueResult = dialog.RunModal(parentWindow);
|
||||
|
||||
ChangelistCreationData result = dialog.BuildCreationData();
|
||||
result.Result = dialogueResult == ResponseType.Ok;
|
||||
return result;
|
||||
}
|
||||
|
||||
void DoTitleArea()
|
||||
{
|
||||
GUILayout.BeginVertical();
|
||||
|
||||
Title(PlasticLocalization.GetString(mIsCreateMode ?
|
||||
PlasticLocalization.Name.CreateChangelistTitle :
|
||||
PlasticLocalization.Name.EditChangelistTitle));
|
||||
|
||||
GUILayout.Space(5);
|
||||
|
||||
Paragraph(PlasticLocalization.GetString(mIsCreateMode ?
|
||||
PlasticLocalization.Name.CreateChangelistExplanation :
|
||||
PlasticLocalization.Name.EditChangelistExplanation));
|
||||
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
void DoFieldsArea()
|
||||
{
|
||||
GUILayout.BeginVertical();
|
||||
|
||||
DoNameFieldArea();
|
||||
|
||||
GUILayout.Space(5);
|
||||
|
||||
DoDescriptionFieldArea();
|
||||
|
||||
GUILayout.Space(5);
|
||||
|
||||
DoPersistentFieldArea();
|
||||
|
||||
GUILayout.Space(5);
|
||||
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
void DoNameFieldArea()
|
||||
{
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Label(
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.ChangelistNameEntry),
|
||||
GUILayout.Width(100));
|
||||
|
||||
GUI.SetNextControlName(NAME_FIELD_CONTROL_NAME);
|
||||
mChangelistName = GUILayout.TextField(mChangelistName);
|
||||
|
||||
if (!mWasNameFieldFocused)
|
||||
{
|
||||
EditorGUI.FocusTextInControl(NAME_FIELD_CONTROL_NAME);
|
||||
mWasNameFieldFocused = true;
|
||||
}
|
||||
|
||||
GUILayout.Space(5);
|
||||
}
|
||||
}
|
||||
|
||||
void DoDescriptionFieldArea()
|
||||
{
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
using (new EditorGUILayout.VerticalScope(GUILayout.Width(100)))
|
||||
{
|
||||
GUILayout.Space(49);
|
||||
GUILayout.Label(
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.ChangelistDescriptionEntry),
|
||||
GUILayout.Width(100));
|
||||
}
|
||||
|
||||
mChangelistDescription = GUILayout.TextArea(mChangelistDescription, GUILayout.Height(100));
|
||||
|
||||
GUILayout.Space(5);
|
||||
}
|
||||
}
|
||||
|
||||
void DoPersistentFieldArea()
|
||||
{
|
||||
mIsPersistent = GUILayout.Toggle(
|
||||
mIsPersistent,
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.ChangelistPersistentCheckBoxEntry));
|
||||
}
|
||||
|
||||
void DoButtonsArea()
|
||||
{
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
using (new EditorGUILayout.HorizontalScope(GUILayout.MinWidth(500)))
|
||||
{
|
||||
GUILayout.Space(2);
|
||||
DrawProgressForDialogs.For(
|
||||
mProgressControls.ProgressData);
|
||||
GUILayout.Space(2);
|
||||
}
|
||||
|
||||
GUILayout.FlexibleSpace();
|
||||
|
||||
DoCreateButton();
|
||||
DoCancelButton();
|
||||
}
|
||||
}
|
||||
|
||||
void DoCancelButton()
|
||||
{
|
||||
if (NormalButton(PlasticLocalization.GetString(
|
||||
PlasticLocalization.Name.CancelButton)))
|
||||
{
|
||||
CancelButtonAction();
|
||||
}
|
||||
}
|
||||
|
||||
void DoCreateButton()
|
||||
{
|
||||
if (!NormalButton(PlasticLocalization.GetString(mIsCreateMode ?
|
||||
PlasticLocalization.Name.CreateButton :
|
||||
PlasticLocalization.Name.EditButton)))
|
||||
return;
|
||||
|
||||
ChangelistCreationValidation.Validation(
|
||||
mWkInfo,
|
||||
mChangelistName,
|
||||
mIsCreateMode || !mChangelistName.Equals(mChangelistToEdit.Name),
|
||||
this,
|
||||
mProgressControls);
|
||||
}
|
||||
|
||||
static CreateChangelistDialog Create(WorkspaceInfo wkInfo)
|
||||
{
|
||||
var instance = CreateInstance<CreateChangelistDialog>();
|
||||
instance.IsResizable = false;
|
||||
instance.mEscapeKeyAction = instance.CloseButtonAction;
|
||||
instance.mWkInfo = wkInfo;
|
||||
instance.mChangelistToEdit = null;
|
||||
instance.mChangelistName = string.Empty;
|
||||
instance.mChangelistDescription = string.Empty;
|
||||
instance.mIsPersistent = false;
|
||||
instance.mProgressControls = new ProgressControlsForDialogs();
|
||||
instance.mIsCreateMode = true;
|
||||
return instance;
|
||||
}
|
||||
|
||||
static CreateChangelistDialog Edit(
|
||||
WorkspaceInfo wkInfo,
|
||||
ChangeListInfo changelistToEdit)
|
||||
{
|
||||
var instance = CreateInstance<CreateChangelistDialog>();
|
||||
instance.IsResizable = false;
|
||||
instance.mEscapeKeyAction = instance.CloseButtonAction;
|
||||
instance.mWkInfo = wkInfo;
|
||||
instance.mChangelistToEdit = changelistToEdit;
|
||||
instance.mChangelistName = changelistToEdit.Name;
|
||||
instance.mChangelistDescription = changelistToEdit.Description;
|
||||
instance.mIsPersistent = changelistToEdit.IsPersistent;
|
||||
instance.mProgressControls = new ProgressControlsForDialogs();
|
||||
instance.mIsCreateMode = false;
|
||||
return instance;
|
||||
}
|
||||
|
||||
ChangelistCreationData BuildCreationData()
|
||||
{
|
||||
ChangeListInfo changelistInfo = new ChangeListInfo();
|
||||
changelistInfo.Name = mChangelistName;
|
||||
changelistInfo.Description = mChangelistDescription;
|
||||
changelistInfo.IsPersistent = mIsPersistent;
|
||||
changelistInfo.Type = ChangeListType.UserDefined;
|
||||
|
||||
return new ChangelistCreationData(changelistInfo);
|
||||
}
|
||||
|
||||
ProgressControlsForDialogs mProgressControls;
|
||||
|
||||
WorkspaceInfo mWkInfo;
|
||||
ChangeListInfo mChangelistToEdit;
|
||||
|
||||
string mChangelistName;
|
||||
string mChangelistDescription;
|
||||
bool mIsPersistent;
|
||||
|
||||
bool mIsCreateMode;
|
||||
|
||||
bool mWasNameFieldFocused;
|
||||
const string NAME_FIELD_CONTROL_NAME = "CreateChangelistNameField";
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5aee5a8d0d126ca48a331d298005381f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,166 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c584c584ba20f4daea226141b9e55bd0
|
||||
timeCreated: 1541611814
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,198 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
using PlasticGui;
|
||||
using Unity.PlasticSCM.Editor.UI;
|
||||
using Codice.CM.Client.Gui;
|
||||
using Codice.Client.Common.EventTracking;
|
||||
using Codice.CM.Common;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Views.PendingChanges.Dialogs
|
||||
{
|
||||
internal class EmptyCheckinMessageDialog : PlasticDialog
|
||||
{
|
||||
internal bool UserChoseToNotDisplayWarningAgain { get; private set; }
|
||||
|
||||
protected override string GetTitle()
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
protected override void OnModalGUI()
|
||||
{
|
||||
DoMainContentSection();
|
||||
|
||||
DoCheckboxSection();
|
||||
|
||||
DoButtonsArea();
|
||||
}
|
||||
|
||||
void DoMainContentSection()
|
||||
{
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
|
||||
DoIconArea();
|
||||
|
||||
using (new EditorGUILayout.VerticalScope())
|
||||
{
|
||||
GUILayout.Label(
|
||||
PlasticLocalization.GetString(
|
||||
PlasticLocalization.Name.EmptyCommentsDialogTitle),
|
||||
UnityStyles.Dialog.MessageTitle);
|
||||
|
||||
GUILayout.Space(3f);
|
||||
|
||||
GUILayout.Label(
|
||||
PlasticLocalization.GetString(
|
||||
PlasticLocalization.Name.EmptyCommentsDialogContent),
|
||||
UnityStyles.Dialog.MessageText);
|
||||
|
||||
GUILayout.Space(15f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DoCheckboxSection()
|
||||
{
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.Space(70f);
|
||||
|
||||
UserChoseToNotDisplayWarningAgain = TitleToggle(
|
||||
PlasticLocalization.GetString(
|
||||
PlasticLocalization.Name.DoNotShowMessageAgain),
|
||||
UserChoseToNotDisplayWarningAgain);
|
||||
}
|
||||
}
|
||||
|
||||
void DoButtonsArea()
|
||||
{
|
||||
using (new EditorGUILayout.VerticalScope())
|
||||
{
|
||||
GUILayout.Space(25f);
|
||||
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
GUILayout.FlexibleSpace();
|
||||
|
||||
if (Application.platform == RuntimePlatform.WindowsEditor)
|
||||
{
|
||||
DoCheckInAnywayButton();
|
||||
GUILayout.Space(13f);
|
||||
DoCancelButton();
|
||||
return;
|
||||
}
|
||||
|
||||
DoCancelButton();
|
||||
GUILayout.Space(13f);
|
||||
DoCheckInAnywayButton();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DoCheckInAnywayButton()
|
||||
{
|
||||
if (!AcceptButton(
|
||||
PlasticLocalization.GetString(
|
||||
PlasticLocalization.Name.CheckinAnyway),
|
||||
30))
|
||||
return;
|
||||
|
||||
if (!mSentCheckinAnywayTrackEvent)
|
||||
{
|
||||
TrackFeatureUseEvent.For(
|
||||
PlasticGui.Plastic.API.GetRepositorySpec(mWkInfo),
|
||||
TrackFeatureUseEvent.Features.PendingChangesCheckinDialogCheckinAnyway);
|
||||
|
||||
mSentCheckinAnywayTrackEvent = true;
|
||||
}
|
||||
|
||||
if (UserChoseToNotDisplayWarningAgain && !mSentCheckboxTrackEvent)
|
||||
{
|
||||
TrackFeatureUseEvent.For(
|
||||
PlasticGui.Plastic.API.GetRepositorySpec(mWkInfo),
|
||||
TrackFeatureUseEvent.Features.PendingChangesCheckinDialogDoNotShowMessageAgain);
|
||||
|
||||
mSentCheckboxTrackEvent = true;
|
||||
}
|
||||
|
||||
ApplyButtonAction();
|
||||
}
|
||||
|
||||
void DoCancelButton()
|
||||
{
|
||||
if (!NormalButton(PlasticLocalization.GetString(
|
||||
PlasticLocalization.Name.CancelButton)))
|
||||
return;
|
||||
|
||||
if (!mSentCancelTrackEvent)
|
||||
{
|
||||
TrackFeatureUseEvent.For(
|
||||
PlasticGui.Plastic.API.GetRepositorySpec(mWkInfo),
|
||||
TrackFeatureUseEvent.Features.PendingChangesCheckinDialogCancel);
|
||||
|
||||
mSentCancelTrackEvent = true;
|
||||
}
|
||||
|
||||
CancelButtonAction();
|
||||
}
|
||||
|
||||
void DoIconArea()
|
||||
{
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Space(10);
|
||||
|
||||
Rect iconRect = GUILayoutUtility.GetRect(
|
||||
GUIContent.none, GUIStyle.none,
|
||||
GUILayout.Width(60), GUILayout.Height(60));
|
||||
iconRect.x -= 10;
|
||||
|
||||
GUI.DrawTexture(
|
||||
iconRect,
|
||||
Images.GetPlasticIcon(),
|
||||
ScaleMode.ScaleToFit);
|
||||
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
|
||||
internal static bool ShouldContinueWithCheckin(
|
||||
EditorWindow parentWindow,
|
||||
WorkspaceInfo wkInfo)
|
||||
{
|
||||
var dialog = Create(wkInfo);
|
||||
|
||||
// using the apply response as the 'Check In Anyway' button click
|
||||
if (dialog.RunModal(parentWindow) != ResponseType.Apply)
|
||||
return false;
|
||||
|
||||
if (dialog.UserChoseToNotDisplayWarningAgain)
|
||||
{
|
||||
var guiClientConfig = GuiClientConfig.Get();
|
||||
|
||||
guiClientConfig.Configuration.ShowEmptyCommentWarning = false;
|
||||
|
||||
guiClientConfig.Save();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static EmptyCheckinMessageDialog Create(WorkspaceInfo wkInfo)
|
||||
{
|
||||
var instance = CreateInstance<EmptyCheckinMessageDialog>();
|
||||
instance.mEnterKeyAction = instance.OkButtonAction;
|
||||
instance.mEscapeKeyAction = instance.CancelButtonAction;
|
||||
instance.mWkInfo = wkInfo;
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
WorkspaceInfo mWkInfo;
|
||||
|
||||
// IMGUI evaluates every frame, need to make sure feature tracks get sent only once
|
||||
bool mSentCheckinAnywayTrackEvent = false;
|
||||
bool mSentCancelTrackEvent = false;
|
||||
bool mSentCheckboxTrackEvent = false;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9483d22987a853041909a08d46e8f665
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,186 @@
|
||||
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.ExpandWidth(true));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 45d03e5c984da3448b417289e95e4291
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,37 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
using Codice.Client.GameUI.Checkin;
|
||||
using Codice.CM.Common.Checkin.Partial;
|
||||
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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0caf9dda3147e224daf41ba5bd5cfaf0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,29 @@
|
||||
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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3ccc9b689652f0b40b53c731af81f034
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,119 @@
|
||||
using System.Reflection;
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
using PlasticGui;
|
||||
using Unity.PlasticSCM.Editor.UI;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Views.PendingChanges
|
||||
{
|
||||
internal static class DrawCommentTextArea
|
||||
{
|
||||
internal static void For(
|
||||
PendingChangesTab pendingChangesTab,
|
||||
float width,
|
||||
bool isOperationRunning)
|
||||
{
|
||||
using (new GuiEnabled(!isOperationRunning))
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
Rect textAreaRect = BuildTextAreaRect(
|
||||
pendingChangesTab.CommentText,
|
||||
width);
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
pendingChangesTab.CommentText = DoTextArea(
|
||||
pendingChangesTab.CommentText ?? string.Empty,
|
||||
pendingChangesTab.ForceToShowComment,
|
||||
textAreaRect);
|
||||
|
||||
pendingChangesTab.ForceToShowComment = false;
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
OnTextAreaChanged(pendingChangesTab);
|
||||
|
||||
if (string.IsNullOrEmpty(pendingChangesTab.CommentText))
|
||||
{
|
||||
DoPlaceholderIfNeeded(PlasticLocalization.GetString(PlasticLocalization.Name.CheckinOnlyComment),
|
||||
textAreaRect);
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
|
||||
static void OnTextAreaChanged(PendingChangesTab pendingChangesTab)
|
||||
{
|
||||
pendingChangesTab.ClearIsCommentWarningNeeded();
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
var modifiedTextAreaStyle = new GUIStyle(EditorStyles.textArea);
|
||||
modifiedTextAreaStyle.padding.left = 7;
|
||||
modifiedTextAreaStyle.padding.top = 5;
|
||||
modifiedTextAreaStyle.stretchWidth = false;
|
||||
modifiedTextAreaStyle.stretchHeight = false;
|
||||
|
||||
text = EditorGUI.TextArea(textAreaRect, text, modifiedTextAreaStyle);
|
||||
|
||||
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;
|
||||
commentTextAreaStyle.stretchWidth = false;
|
||||
|
||||
// The number here (230) controls how much the right side buttons are pushed off the
|
||||
// screen when window is at min width
|
||||
float contentWidth = width - 230f;
|
||||
|
||||
Rect result = GUILayoutUtility.GetRect(
|
||||
contentWidth,
|
||||
UnityConstants.PLASTIC_WINDOW_COMMENT_SECTION_HEIGHT);
|
||||
|
||||
result.width = contentWidth;
|
||||
result.height = UnityConstants.PLASTIC_WINDOW_COMMENT_SECTION_HEIGHT;
|
||||
result.xMin = 50f;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 23471c5c18843794fba363cb093b5a05
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,195 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
using Codice.Client.BaseCommands;
|
||||
using PlasticGui;
|
||||
using PlasticGui.WorkspaceWindow.Items;
|
||||
using Unity.PlasticSCM.Editor.UI;
|
||||
|
||||
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 UnityMenuItem.GetText(
|
||||
menuName,
|
||||
UnityMenuItem.EscapedText(subMenuName));
|
||||
}
|
||||
|
||||
GUIContent mIgnoredSubmenuItem;
|
||||
GUIContent mHiddenChangesSubmenuItem;
|
||||
|
||||
GUIContent mIgnoredByNameMenuItemContent;
|
||||
GUIContent mHiddenChangesByNameMenuItemContent;
|
||||
|
||||
GUIContent mIgnoredByExtensionMenuItemContent;
|
||||
GUIContent mHiddenChangesByExtensionMenuItemContent;
|
||||
|
||||
GUIContent mIgnoredByFullPathMenuItemContent;
|
||||
GUIContent mHiddenChangesByFullPathMenuItemContent;
|
||||
|
||||
IFilesFilterPatternsMenuOperations mOperations;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 05d31e83a4093e448b45616d62a12790
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,111 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEditor.IMGUI.Controls;
|
||||
using UnityEngine;
|
||||
|
||||
using PlasticGui;
|
||||
using Unity.PlasticSCM.Editor.UI;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Views.PendingChanges
|
||||
{
|
||||
internal class PendingChangesMultiColumnHeader : MultiColumnHeader
|
||||
{
|
||||
internal PendingChangesMultiColumnHeader(
|
||||
PendingChangesTreeView treeView,
|
||||
MultiColumnHeaderState headerState,
|
||||
UnityPendingChangesTree tree)
|
||||
: base(headerState)
|
||||
{
|
||||
mPendingChangesTreeView = treeView;
|
||||
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);
|
||||
((PendingChangesTreeHeaderState)state).UpdateItemColumnHeader(mPendingChangesTreeView);
|
||||
}
|
||||
|
||||
headerRect.x = checkRect.xMax;
|
||||
headerRect.xMax = column.width;
|
||||
}
|
||||
base.ColumnHeaderGUI(column, headerRect, columnIndex);
|
||||
}
|
||||
|
||||
internal bool IsAllCheckedState()
|
||||
{
|
||||
IEnumerable<IPlasticTreeNode> nodes = mPendingChangesTree.GetNodes();
|
||||
|
||||
if (nodes == null)
|
||||
return false;
|
||||
|
||||
foreach (IPlasticTreeNode node in nodes)
|
||||
{
|
||||
if (!(CheckableItems.GetIsCheckedValue(node) ?? false))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected bool IsMixedCheckedState()
|
||||
{
|
||||
IEnumerable<IPlasticTreeNode> nodes = mPendingChangesTree.GetNodes();
|
||||
|
||||
if (nodes == null)
|
||||
return false;
|
||||
|
||||
bool hasCheckedNode = false;
|
||||
bool hasUncheckedNode = false;
|
||||
foreach (IPlasticTreeNode node in nodes)
|
||||
{
|
||||
if (CheckableItems.GetIsPartiallyCheckedValue(node))
|
||||
return true;
|
||||
|
||||
if (CheckableItems.GetIsCheckedValue(node) ?? false)
|
||||
hasCheckedNode = true;
|
||||
else
|
||||
hasUncheckedNode = true;
|
||||
|
||||
if (hasCheckedNode && hasUncheckedNode)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
internal void UpdateCheckedState(bool isChecked)
|
||||
{
|
||||
IEnumerable<IPlasticTreeNode> nodes = mPendingChangesTree.GetNodes();
|
||||
|
||||
if (nodes == null)
|
||||
return;
|
||||
|
||||
foreach (IPlasticTreeNode node in nodes)
|
||||
CheckableItems.SetCheckedValue(node, isChecked);
|
||||
}
|
||||
|
||||
readonly PendingChangesTreeView mPendingChangesTreeView;
|
||||
protected UnityPendingChangesTree mPendingChangesTree;
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e7b15873dbe9463cad67af4fac8e41ba
|
||||
timeCreated: 1589491970
|
@@ -0,0 +1,166 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
using Codice.Client.BaseCommands;
|
||||
using Codice.Client.Commands;
|
||||
using Codice.CM.Common;
|
||||
using PlasticGui;
|
||||
using PlasticGui.WorkspaceWindow.PendingChanges;
|
||||
using PlasticGui.WorkspaceWindow.PendingChanges.Changelists;
|
||||
|
||||
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<string> result = new List<string>();
|
||||
|
||||
foreach (ChangeInfo change in GetSelectedChanges(treeView))
|
||||
{
|
||||
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(
|
||||
string wkPath, PendingChangesTreeView treeView)
|
||||
{
|
||||
return SelectedChangesGroupInfo.BuildFromChangeInfos(
|
||||
wkPath,
|
||||
treeView.GetSelectedChanges(false),
|
||||
GetInvolvedChangelists(treeView.GetSelectedPendingChangeInfos()));
|
||||
}
|
||||
|
||||
internal static List<ChangeInfo> GetSelectedChanges(
|
||||
PendingChangesTreeView treeView)
|
||||
{
|
||||
return treeView.GetSelectedChanges(true);
|
||||
}
|
||||
|
||||
internal static List<ChangeListInfo> GetSelectedChangeListInfos(
|
||||
PendingChangesTreeView treeView)
|
||||
{
|
||||
List<ChangeListInfo> result = new List<ChangeListInfo>();
|
||||
List<ChangelistNode> nodes = treeView.GetSelectedChangelistNodes();
|
||||
|
||||
foreach (ChangelistNode node in nodes)
|
||||
result.Add(node.ChangelistInfo);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static ChangeListInfo GetSelectedChangeListInfo(
|
||||
PendingChangesTreeView treeView)
|
||||
{
|
||||
List<ChangeListInfo> changeListInfos = GetSelectedChangeListInfos(treeView);
|
||||
|
||||
if (changeListInfos.Count == 0)
|
||||
return null;
|
||||
|
||||
return changeListInfos[0];
|
||||
}
|
||||
|
||||
internal static List<ChangelistNode> GetSelectedChangelistNodes(
|
||||
PendingChangesTreeView treeView)
|
||||
{
|
||||
return treeView.GetSelectedChangelistNodes();
|
||||
}
|
||||
|
||||
internal static ChangeInfo GetSelectedChange(
|
||||
PendingChangesTreeView treeView)
|
||||
{
|
||||
return treeView.GetSelectedRow();
|
||||
}
|
||||
|
||||
static List<ChangeListInfo> GetInvolvedChangelists(List<PendingChangeInfo> changes)
|
||||
{
|
||||
List<ChangeListInfo> result = new List<ChangeListInfo>();
|
||||
|
||||
foreach (PendingChangeInfo pendingChangeInfo in changes)
|
||||
{
|
||||
ChangelistNode changelistNode = GetChangelistAncestor.ForNode(pendingChangeInfo);
|
||||
|
||||
if (changelistNode == null)
|
||||
continue;
|
||||
|
||||
result.Add(changelistNode.ChangelistInfo);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool IsAddedFile(ChangeInfo change)
|
||||
{
|
||||
return ChangeTypesClassifier.IsInAddedCategory(change.ChangeTypes)
|
||||
&& !(Directory.Exists(change.Path) || File.Exists(change.Path));
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a92174abe154af4b99e09e4b6cf31ee
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b2dfd8c552c2468ca523d8dbb93ea5d
|
||||
timeCreated: 1539019322
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,482 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Codice.Client.Commands.CheckIn;
|
||||
using Codice.Client.BaseCommands;
|
||||
using Codice.Client.Common;
|
||||
using Codice.Client.Common.EventTracking;
|
||||
using Codice.Client.Common.Threading;
|
||||
using Codice.CM.Common;
|
||||
using GluonGui.WorkspaceWindow.Views.Checkin.Operations;
|
||||
using PlasticGui;
|
||||
using Unity.PlasticSCM.Editor.AssetUtils;
|
||||
using Unity.PlasticSCM.Editor.Tool;
|
||||
using Unity.PlasticSCM.Editor.UI;
|
||||
using Unity.PlasticSCM.Editor.Views.PendingChanges.Dialogs;
|
||||
using Unity.PlasticSCM.Editor.WebApi;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Views.PendingChanges
|
||||
{
|
||||
internal partial class PendingChangesTab
|
||||
{
|
||||
internal void UndoForMode(
|
||||
WorkspaceInfo wkInfo,
|
||||
bool isGluonMode)
|
||||
{
|
||||
TrackFeatureUseEvent.For(
|
||||
PlasticGui.Plastic.API.GetRepositorySpec(wkInfo),
|
||||
isGluonMode ?
|
||||
TrackFeatureUseEvent.Features.PartialUndo :
|
||||
TrackFeatureUseEvent.Features.Undo);
|
||||
|
||||
if (isGluonMode)
|
||||
{
|
||||
PartialUndo();
|
||||
return;
|
||||
}
|
||||
|
||||
Undo(false);
|
||||
}
|
||||
|
||||
void UndoChangesForMode(
|
||||
WorkspaceInfo wkInfo,
|
||||
bool isGluonMode,
|
||||
List<ChangeInfo> changesToUndo,
|
||||
List<ChangeInfo> dependenciesCandidates)
|
||||
{
|
||||
TrackFeatureUseEvent.For(
|
||||
PlasticGui.Plastic.API.GetRepositorySpec(wkInfo),
|
||||
isGluonMode ?
|
||||
TrackFeatureUseEvent.Features.PartialUndo :
|
||||
TrackFeatureUseEvent.Features.Undo);
|
||||
|
||||
if (isGluonMode)
|
||||
{
|
||||
PartialUndoChanges(
|
||||
changesToUndo, dependenciesCandidates);
|
||||
return;
|
||||
}
|
||||
|
||||
UndoChanges(changesToUndo, dependenciesCandidates, false);
|
||||
}
|
||||
|
||||
void CheckinForMode(
|
||||
WorkspaceInfo wkInfo,
|
||||
bool isGluonMode,
|
||||
bool keepItemsLocked)
|
||||
{
|
||||
TrackFeatureUseEvent.For(
|
||||
PlasticGui.Plastic.API.GetRepositorySpec(wkInfo),
|
||||
isGluonMode ?
|
||||
TrackFeatureUseEvent.Features.PartialCheckin :
|
||||
TrackFeatureUseEvent.Features.Checkin);
|
||||
|
||||
if (isGluonMode)
|
||||
{
|
||||
PartialCheckin(keepItemsLocked);
|
||||
return;
|
||||
}
|
||||
|
||||
Checkin();
|
||||
}
|
||||
|
||||
void CheckinChangesForMode(
|
||||
List<ChangeInfo> changesToCheckin,
|
||||
List<ChangeInfo> dependenciesCandidates,
|
||||
WorkspaceInfo wkInfo,
|
||||
bool isGluonMode,
|
||||
bool keepItemsLocked)
|
||||
{
|
||||
TrackFeatureUseEvent.For(
|
||||
PlasticGui.Plastic.API.GetRepositorySpec(wkInfo),
|
||||
isGluonMode ?
|
||||
TrackFeatureUseEvent.Features.PartialCheckin :
|
||||
TrackFeatureUseEvent.Features.Checkin);
|
||||
|
||||
if (isGluonMode)
|
||||
{
|
||||
PartialCheckinChanges(
|
||||
changesToCheckin, dependenciesCandidates, keepItemsLocked);
|
||||
return;
|
||||
}
|
||||
|
||||
CheckinChanges(
|
||||
changesToCheckin, dependenciesCandidates);
|
||||
}
|
||||
|
||||
void PartialCheckin(bool keepItemsLocked)
|
||||
{
|
||||
List<ChangeInfo> changesToCheckin;
|
||||
List<ChangeInfo> dependenciesCandidates;
|
||||
|
||||
mPendingChangesTreeView.GetCheckedChanges(
|
||||
null,
|
||||
false,
|
||||
out changesToCheckin,
|
||||
out dependenciesCandidates);
|
||||
|
||||
PartialCheckinChanges(
|
||||
changesToCheckin, dependenciesCandidates, keepItemsLocked);
|
||||
}
|
||||
|
||||
void PartialCheckinChanges(
|
||||
List<ChangeInfo> changesToCheckin,
|
||||
List<ChangeInfo> dependenciesCandidates,
|
||||
bool keepItemsLocked)
|
||||
{
|
||||
if (CheckEmptyOperation(changesToCheckin))
|
||||
{
|
||||
((IProgressControls)mProgressControls).ShowWarning(
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.NoItemsAreSelected));
|
||||
return;
|
||||
}
|
||||
|
||||
bool isCancelled;
|
||||
SaveAssets.ForChangesWithConfirmation(
|
||||
changesToCheckin, mWorkspaceOperationsMonitor,
|
||||
out isCancelled);
|
||||
|
||||
if (isCancelled)
|
||||
return;
|
||||
|
||||
CheckinUIOperation ciOperation = new CheckinUIOperation(
|
||||
mWkInfo, mViewHost, mProgressControls, mGuiMessage,
|
||||
new LaunchCheckinConflictsDialog(mParentWindow),
|
||||
new LaunchDependenciesDialog(
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.CheckinButton),
|
||||
mParentWindow),
|
||||
this,
|
||||
mWorkspaceWindow.GluonProgressOperationHandler,
|
||||
null);
|
||||
|
||||
ciOperation.Checkin(
|
||||
changesToCheckin,
|
||||
dependenciesCandidates,
|
||||
CommentText,
|
||||
keepItemsLocked,
|
||||
false,
|
||||
EndCheckin);
|
||||
}
|
||||
|
||||
void Checkin()
|
||||
{
|
||||
List<ChangeInfo> changesToCheckin;
|
||||
List<ChangeInfo> dependenciesCandidates;
|
||||
|
||||
mPendingChangesTreeView.GetCheckedChanges(
|
||||
null,
|
||||
false, out changesToCheckin, out dependenciesCandidates);
|
||||
|
||||
CheckinChanges(changesToCheckin, dependenciesCandidates);
|
||||
}
|
||||
|
||||
void CheckinChanges(
|
||||
List<ChangeInfo> changesToCheckin,
|
||||
List<ChangeInfo> dependenciesCandidates)
|
||||
{
|
||||
if (CheckEmptyOperation(changesToCheckin, HasPendingMergeLinks()))
|
||||
{
|
||||
((IProgressControls)mProgressControls).ShowWarning(
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.NoItemsAreSelected));
|
||||
return;
|
||||
}
|
||||
|
||||
bool isCancelled;
|
||||
SaveAssets.ForChangesWithConfirmation(
|
||||
changesToCheckin, mWorkspaceOperationsMonitor,
|
||||
out isCancelled);
|
||||
|
||||
if (isCancelled)
|
||||
return;
|
||||
|
||||
mPendingChangesOperations.Checkin(
|
||||
changesToCheckin,
|
||||
dependenciesCandidates,
|
||||
CommentText,
|
||||
null,
|
||||
EndCheckin,
|
||||
null);
|
||||
}
|
||||
|
||||
void ShelveChanges(
|
||||
List<ChangeInfo> changesToShelve,
|
||||
List<ChangeInfo> dependenciesCandidates,
|
||||
WorkspaceInfo wkInfo)
|
||||
{
|
||||
ShelveChanges(changesToShelve, dependenciesCandidates);
|
||||
}
|
||||
|
||||
void ShelveChanges(
|
||||
List<ChangeInfo> changesToShelve,
|
||||
List<ChangeInfo> dependenciesCandidates)
|
||||
{
|
||||
bool hasPendingMergeLinks = HasPendingMergeLinks();
|
||||
|
||||
if (hasPendingMergeLinks &&
|
||||
!UserWantsShelveWithPendingMergeLinks(mGuiMessage))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (CheckEmptyOperation(changesToShelve, hasPendingMergeLinks))
|
||||
{
|
||||
((IProgressControls)mProgressControls).ShowWarning(
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.NoItemsAreSelected));
|
||||
return;
|
||||
}
|
||||
|
||||
bool isCancelled;
|
||||
SaveAssets.ForChangesWithConfirmation(
|
||||
changesToShelve, mWorkspaceOperationsMonitor,
|
||||
out isCancelled);
|
||||
|
||||
if (isCancelled)
|
||||
return;
|
||||
|
||||
mPendingChangesOperations.Shelve(
|
||||
changesToShelve,
|
||||
dependenciesCandidates,
|
||||
CommentText,
|
||||
() => {},
|
||||
ShowShelveSuccess);
|
||||
}
|
||||
|
||||
void PartialUndo()
|
||||
{
|
||||
List<ChangeInfo> changesToUndo;
|
||||
List<ChangeInfo> dependenciesCandidates;
|
||||
|
||||
mPendingChangesTreeView.GetCheckedChanges(
|
||||
null, true,
|
||||
out changesToUndo, out dependenciesCandidates);
|
||||
|
||||
PartialUndoChanges(changesToUndo, dependenciesCandidates);
|
||||
}
|
||||
|
||||
void PartialUndoChanges(
|
||||
List<ChangeInfo> changesToUndo,
|
||||
List<ChangeInfo> dependenciesCandidates)
|
||||
{
|
||||
if (CheckEmptyOperation(changesToUndo))
|
||||
{
|
||||
((IProgressControls)mProgressControls).ShowWarning(
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.NoItemsToUndo));
|
||||
return;
|
||||
}
|
||||
|
||||
SaveAssets.ForChangesWithoutConfirmation(
|
||||
changesToUndo, mWorkspaceOperationsMonitor);
|
||||
|
||||
UndoUIOperation undoOperation = new UndoUIOperation(
|
||||
mWkInfo, mViewHost,
|
||||
new LaunchDependenciesDialog(
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.UndoButton),
|
||||
mParentWindow),
|
||||
mProgressControls);
|
||||
|
||||
undoOperation.Undo(
|
||||
changesToUndo,
|
||||
dependenciesCandidates,
|
||||
RefreshAsset.UnityAssetDatabase);
|
||||
}
|
||||
|
||||
void Undo(bool keepLocalChanges)
|
||||
{
|
||||
List<ChangeInfo> changesToUndo;
|
||||
List<ChangeInfo> dependenciesCandidates;
|
||||
|
||||
mPendingChangesTreeView.GetCheckedChanges(
|
||||
null, true,
|
||||
out changesToUndo, out dependenciesCandidates);
|
||||
|
||||
UndoChanges(changesToUndo, dependenciesCandidates, keepLocalChanges);
|
||||
}
|
||||
|
||||
void UndoChanges(
|
||||
List<ChangeInfo> changesToUndo,
|
||||
List<ChangeInfo> dependenciesCandidates,
|
||||
bool keepLocalChanges)
|
||||
{
|
||||
if (CheckEmptyOperation(changesToUndo, HasPendingMergeLinks()))
|
||||
{
|
||||
((IProgressControls)mProgressControls).ShowWarning(
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.NoItemsToUndo));
|
||||
return;
|
||||
}
|
||||
|
||||
SaveAssets.ForChangesWithoutConfirmation(
|
||||
changesToUndo, mWorkspaceOperationsMonitor);
|
||||
|
||||
mPendingChangesOperations.Undo(
|
||||
changesToUndo,
|
||||
dependenciesCandidates,
|
||||
mPendingMergeLinks.Count,
|
||||
keepLocalChanges,
|
||||
() => AfterUndoOperation(changesToUndo, keepLocalChanges),
|
||||
null);
|
||||
}
|
||||
|
||||
void AfterUndoOperation(List<ChangeInfo> changesToUndo, bool keepLocalChanges)
|
||||
{
|
||||
if (keepLocalChanges)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (changesToUndo.Any(change => AssetsPath.IsPackagesRootElement(change.Path) && !IsAddedChange(change)))
|
||||
{
|
||||
RefreshAsset.UnityAssetDatabaseAndPackageManagerAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshAsset.UnityAssetDatabase();
|
||||
}
|
||||
}
|
||||
|
||||
static bool IsAddedChange(ChangeInfo change)
|
||||
{
|
||||
return ChangeTypesOperator.ContainsAny(change.ChangeTypes, ChangeTypesClassifier.ADDED_TYPES);
|
||||
}
|
||||
|
||||
void UndoUnchanged()
|
||||
{
|
||||
List<ChangeInfo> changesToUndo;
|
||||
List<ChangeInfo> dependenciesCandidates;
|
||||
|
||||
mPendingChangesTreeView.GetCheckedChanges(
|
||||
null, true,
|
||||
out changesToUndo, out dependenciesCandidates);
|
||||
|
||||
UndoUnchangedFor(changesToUndo);
|
||||
}
|
||||
|
||||
void UndoUnchangedFor(List<ChangeInfo> changesToUndo)
|
||||
{
|
||||
if (CheckEmptyOperation(changesToUndo, HasPendingMergeLinks()))
|
||||
{
|
||||
((IProgressControls) mProgressControls).ShowWarning(
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.NoItemsToUndo));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
SaveAssets.ForChangesWithoutConfirmation(changesToUndo, mWorkspaceOperationsMonitor);
|
||||
|
||||
mPendingChangesOperations.UndoUnchanged(
|
||||
changesToUndo,
|
||||
RefreshAsset.UnityAssetDatabase,
|
||||
null);
|
||||
}
|
||||
|
||||
void UndoCheckoutsKeepingChanges()
|
||||
{
|
||||
Undo(true);
|
||||
}
|
||||
|
||||
void UndoCheckoutsKeepingChangesFor(List<ChangeInfo> changesToUndo)
|
||||
{
|
||||
UndoChanges(changesToUndo, new List<ChangeInfo>(), true);
|
||||
}
|
||||
|
||||
void EndCheckin()
|
||||
{
|
||||
ShowCheckinSuccess();
|
||||
|
||||
RefreshAsset.UnityAssetDatabase();
|
||||
}
|
||||
|
||||
void ShowCheckinSuccess()
|
||||
{
|
||||
bool isTreeViewEmpty = mPendingChangesTreeView.GetCheckedItemCount() ==
|
||||
mPendingChangesTreeView.GetTotalItemCount();
|
||||
|
||||
if (isTreeViewEmpty)
|
||||
{
|
||||
RepositorySpec repSpec = PlasticGui.Plastic.API.GetRepositorySpec(mWkInfo);
|
||||
bool isFirstCheckin = !BoolSetting.Load(UnityConstants.FIRST_CHECKIN_SUBMITTED, false);
|
||||
|
||||
if (PlasticGui.Plastic.API.IsCloud(repSpec.Server) && isFirstCheckin)
|
||||
{
|
||||
BoolSetting.Save(true, UnityConstants.FIRST_CHECKIN_SUBMITTED);
|
||||
RequestOrganizationToInviteUsers(repSpec.Server);
|
||||
}
|
||||
|
||||
mIsCheckedInSuccessful = true;
|
||||
mCooldownClearCheckinSuccessAction.Ping();
|
||||
return;
|
||||
}
|
||||
|
||||
mStatusBar.Notify(
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.CheckinCompleted),
|
||||
UnityEditor.MessageType.None,
|
||||
Images.GetStepOkIcon());
|
||||
}
|
||||
|
||||
void ShowShelveSuccess(CheckinResult checkinResult)
|
||||
{
|
||||
((IProgressControls)mProgressControls).ShowSuccess(
|
||||
PlasticLocalization.Name.ShelveCreatedMessage.GetString(
|
||||
checkinResult.CreatedChangesets.ToArray()));
|
||||
}
|
||||
|
||||
void DelayedClearCheckinSuccess()
|
||||
{
|
||||
mIsCheckedInSuccessful = false;
|
||||
mOrganizationToInviteUsers = null;
|
||||
}
|
||||
|
||||
void RequestOrganizationToInviteUsers(string server)
|
||||
{
|
||||
string organizationName = ServerOrganizationParser.GetOrganizationFromServer(server);
|
||||
|
||||
CurrentUserAdminCheckResponse response = null;
|
||||
|
||||
IThreadWaiter waiter = ThreadWaiter.GetWaiter(50);
|
||||
waiter.Execute(
|
||||
/*threadOperationDelegate*/
|
||||
delegate
|
||||
{
|
||||
string authToken = AuthToken.GetForServer(server);
|
||||
|
||||
if (string.IsNullOrEmpty(authToken))
|
||||
return;
|
||||
|
||||
response = WebRestApiClient.PlasticScm.IsUserAdmin(organizationName, authToken);
|
||||
},
|
||||
/*afterOperationDelegate*/
|
||||
delegate
|
||||
{
|
||||
if (response == null || !response.IsCurrentUserAdmin)
|
||||
return;
|
||||
|
||||
mOrganizationToInviteUsers = organizationName;
|
||||
|
||||
mParentWindow.Repaint();
|
||||
});
|
||||
}
|
||||
|
||||
static bool CheckEmptyOperation(List<ChangeInfo> elements)
|
||||
{
|
||||
return elements == null || elements.Count == 0;
|
||||
}
|
||||
|
||||
static bool CheckEmptyOperation(List<ChangeInfo> elements, bool bHasPendingMergeLinks)
|
||||
{
|
||||
if (bHasPendingMergeLinks)
|
||||
return false;
|
||||
|
||||
if (elements != null && elements.Count > 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool UserWantsShelveWithPendingMergeLinks(GuiMessage.IGuiMessage guiMessage)
|
||||
{
|
||||
return guiMessage.ShowQuestion(
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.ShelveWithPendingMergeLinksRequest),
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.ShelveWithPendingMergeLinksRequestMessage),
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.ShelveButton));
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 05b4d56bb0dca1b458c2e10c2548663b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,213 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using UnityEditor.IMGUI.Controls;
|
||||
using UnityEngine;
|
||||
|
||||
using PlasticGui;
|
||||
using Unity.PlasticSCM.Editor.UI.Tree;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Views.PendingChanges
|
||||
{
|
||||
internal enum PendingChangesTreeColumn
|
||||
{
|
||||
Item,
|
||||
Status,
|
||||
Size,
|
||||
Extension,
|
||||
Type,
|
||||
DateModififed,
|
||||
Repository
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
internal class PendingChangesTreeHeaderState : MultiColumnHeaderState, ISerializationCallbackReceiver
|
||||
{
|
||||
internal static PendingChangesTreeHeaderState GetDefault(bool isGluonMode)
|
||||
{
|
||||
PendingChangesTreeHeaderState headerState =
|
||||
new PendingChangesTreeHeaderState(BuildColumns());
|
||||
|
||||
headerState.visibleColumns = GetDefaultVisibleColumns();
|
||||
|
||||
SetMode(headerState, isGluonMode);
|
||||
|
||||
return headerState;
|
||||
}
|
||||
|
||||
internal static List<string> GetColumnNames()
|
||||
{
|
||||
List<string> result = new List<string>();
|
||||
result.Add(PlasticLocalization.GetString(PlasticLocalization.Name.ItemColumn));
|
||||
result.Add(PlasticLocalization.GetString(PlasticLocalization.Name.StatusColumn));
|
||||
result.Add(PlasticLocalization.GetString(PlasticLocalization.Name.SizeColumn));
|
||||
result.Add(PlasticLocalization.GetString(PlasticLocalization.Name.ExtensionColumn));
|
||||
result.Add(PlasticLocalization.GetString(PlasticLocalization.Name.TypeColumn));
|
||||
result.Add(PlasticLocalization.GetString(PlasticLocalization.Name.DateModifiedColumn));
|
||||
result.Add(PlasticLocalization.GetString(PlasticLocalization.Name.RepositoryColumn));
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static string GetColumnName(PendingChangesTreeColumn column)
|
||||
{
|
||||
switch (column)
|
||||
{
|
||||
case PendingChangesTreeColumn.Item:
|
||||
return PlasticLocalization.GetString(PlasticLocalization.Name.ItemColumn);
|
||||
case PendingChangesTreeColumn.Status:
|
||||
return PlasticLocalization.GetString(PlasticLocalization.Name.StatusColumn);
|
||||
case PendingChangesTreeColumn.Size:
|
||||
return PlasticLocalization.GetString(PlasticLocalization.Name.SizeColumn);
|
||||
case PendingChangesTreeColumn.Extension:
|
||||
return PlasticLocalization.GetString(PlasticLocalization.Name.ExtensionColumn);
|
||||
case PendingChangesTreeColumn.Type:
|
||||
return PlasticLocalization.GetString(PlasticLocalization.Name.TypeColumn);
|
||||
case PendingChangesTreeColumn.DateModififed:
|
||||
return PlasticLocalization.GetString(PlasticLocalization.Name.DateModifiedColumn);
|
||||
case PendingChangesTreeColumn.Repository:
|
||||
return PlasticLocalization.GetString(PlasticLocalization.Name.RepositoryColumn);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
internal static void SetMode(MultiColumnHeaderState state, bool isGluonMode)
|
||||
{
|
||||
List<int> result = state.visibleColumns.ToList();
|
||||
|
||||
if (!result.Contains((int)PendingChangesTreeColumn.Item))
|
||||
result.Add((int)PendingChangesTreeColumn.Item);
|
||||
|
||||
if (isGluonMode)
|
||||
result.Remove((int)PendingChangesTreeColumn.Type);
|
||||
|
||||
state.columns[(int)PendingChangesTreeColumn.Item].allowToggleVisibility = false;
|
||||
state.columns[(int)PendingChangesTreeColumn.Type].allowToggleVisibility = !isGluonMode;
|
||||
|
||||
state.visibleColumns = result.ToArray();
|
||||
}
|
||||
|
||||
internal void UpdateItemColumnHeader(PendingChangesTreeView treeView)
|
||||
{
|
||||
Column itemColumn = columns[(int)PendingChangesTreeColumn.Item];
|
||||
string columnName = GetColumnName(PendingChangesTreeColumn.Item);
|
||||
int totalItemCount = treeView.GetTotalItemCount();
|
||||
|
||||
if (totalItemCount > 0)
|
||||
{
|
||||
string columnStatus = string.Format(
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.ItemsSelected),
|
||||
treeView.GetCheckedItemCount(),
|
||||
totalItemCount);
|
||||
|
||||
itemColumn.headerContent.text = string.Format("{0} {1}", columnName, columnStatus);
|
||||
}
|
||||
else
|
||||
{
|
||||
itemColumn.headerContent.text = columnName;
|
||||
}
|
||||
}
|
||||
|
||||
void ISerializationCallbackReceiver.OnAfterDeserialize()
|
||||
{
|
||||
if (mHeaderTitles != null)
|
||||
TreeHeaderColumns.SetTitles(columns, mHeaderTitles);
|
||||
|
||||
if (mColumsAllowedToggleVisibility != null)
|
||||
TreeHeaderColumns.SetVisibilities(columns, mColumsAllowedToggleVisibility);
|
||||
}
|
||||
|
||||
void ISerializationCallbackReceiver.OnBeforeSerialize()
|
||||
{
|
||||
}
|
||||
|
||||
static int[] GetDefaultVisibleColumns()
|
||||
{
|
||||
List<int> result = new List<int>();
|
||||
result.Add((int)PendingChangesTreeColumn.Item);
|
||||
result.Add((int)PendingChangesTreeColumn.Status);
|
||||
result.Add((int)PendingChangesTreeColumn.DateModififed);
|
||||
return result.ToArray();
|
||||
}
|
||||
|
||||
static Column[] BuildColumns()
|
||||
{
|
||||
return new Column[]
|
||||
{
|
||||
new Column()
|
||||
{
|
||||
width = 800,
|
||||
headerContent = new GUIContent(
|
||||
GetColumnName(PendingChangesTreeColumn.Item)),
|
||||
minWidth = 200,
|
||||
sortingArrowAlignment = TextAlignment.Right
|
||||
},
|
||||
new Column()
|
||||
{
|
||||
width = 200,
|
||||
headerContent = new GUIContent(
|
||||
GetColumnName(PendingChangesTreeColumn.Status)),
|
||||
minWidth = 80,
|
||||
sortingArrowAlignment = TextAlignment.Right
|
||||
},
|
||||
new Column()
|
||||
{
|
||||
width = 80,
|
||||
headerContent = new GUIContent(
|
||||
GetColumnName(PendingChangesTreeColumn.Size)),
|
||||
minWidth = 45,
|
||||
sortingArrowAlignment = TextAlignment.Right
|
||||
},
|
||||
new Column()
|
||||
{
|
||||
width = 70,
|
||||
headerContent = new GUIContent(
|
||||
GetColumnName(PendingChangesTreeColumn.Extension)),
|
||||
minWidth = 50,
|
||||
sortingArrowAlignment = TextAlignment.Right
|
||||
},
|
||||
new Column()
|
||||
{
|
||||
width = 60,
|
||||
headerContent = new GUIContent(
|
||||
GetColumnName(PendingChangesTreeColumn.Type)),
|
||||
minWidth = 45,
|
||||
sortingArrowAlignment = TextAlignment.Right
|
||||
},
|
||||
new Column()
|
||||
{
|
||||
width = 330,
|
||||
headerContent = new GUIContent(
|
||||
GetColumnName(PendingChangesTreeColumn.DateModififed)),
|
||||
minWidth = 100,
|
||||
sortingArrowAlignment = TextAlignment.Right
|
||||
},
|
||||
new Column()
|
||||
{
|
||||
width = 210,
|
||||
headerContent = new GUIContent(
|
||||
GetColumnName(PendingChangesTreeColumn.Repository)),
|
||||
minWidth = 90,
|
||||
sortingArrowAlignment = TextAlignment.Right
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
PendingChangesTreeHeaderState(Column[] columns)
|
||||
: base(columns)
|
||||
{
|
||||
if (mHeaderTitles == null)
|
||||
mHeaderTitles = TreeHeaderColumns.GetTitles(columns);
|
||||
|
||||
if (mColumsAllowedToggleVisibility == null)
|
||||
mColumsAllowedToggleVisibility = TreeHeaderColumns.GetVisibilities(columns);
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
string[] mHeaderTitles;
|
||||
|
||||
[SerializeField]
|
||||
bool[] mColumsAllowedToggleVisibility;
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e57affb3c41ab402e86f99747be972a2
|
||||
timeCreated: 1539690273
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 594dcd9e9e4804aa281a66d024d30752
|
||||
timeCreated: 1539617947
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,138 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
using Codice.CM.Common;
|
||||
using PlasticGui;
|
||||
using PlasticGui.WorkspaceWindow.Open;
|
||||
using PlasticGui.WorkspaceWindow.PendingChanges;
|
||||
using PlasticGui.WorkspaceWindow.PendingChanges.Changelists;
|
||||
using Unity.PlasticSCM.Editor.Views.PendingChanges.Changelists;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Views.PendingChanges
|
||||
{
|
||||
internal class PendingChangesViewMenu
|
||||
{
|
||||
internal interface IGetSelectedNodes
|
||||
{
|
||||
List<IPlasticTreeNode> GetSelectedNodes();
|
||||
}
|
||||
|
||||
internal PendingChangesViewMenu(
|
||||
WorkspaceInfo wkInfo,
|
||||
IPendingChangesMenuOperations pendingChangesViewOperations,
|
||||
IFilesFilterPatternsMenuOperations filterMenuOperations,
|
||||
IOpenMenuOperations openMenuOperations,
|
||||
PendingChangesViewPendingChangeMenu.IMetaMenuOperations metaMenuOperations,
|
||||
PendingChangesViewPendingChangeMenu.IAdvancedUndoMenuOperations advancedUndoMenuOperations,
|
||||
IChangelistMenuOperations changelistMenuOperations,
|
||||
IGetSelectedNodes getSelectedNodes,
|
||||
bool isGluonMode)
|
||||
{
|
||||
mWkInfo = wkInfo;
|
||||
mPendingChangesViewOperations = pendingChangesViewOperations;
|
||||
mFilterMenuOperations = filterMenuOperations;
|
||||
mOpenMenuOperations = openMenuOperations;
|
||||
mMetaMenuOperations = metaMenuOperations;
|
||||
mAdvancedUndoMenuOperations = advancedUndoMenuOperations;
|
||||
mChangelistMenuOperations = changelistMenuOperations;
|
||||
mGetSelectedNodes = getSelectedNodes;
|
||||
mIsGluonMode = isGluonMode;
|
||||
}
|
||||
|
||||
internal void Popup()
|
||||
{
|
||||
List<IPlasticTreeNode> selectedNodes = mGetSelectedNodes.GetSelectedNodes();
|
||||
|
||||
if (AreAllChangelists(selectedNodes))
|
||||
{
|
||||
GetChangelistMenu().Popup();
|
||||
return;
|
||||
}
|
||||
|
||||
if (AreAllPendingChanges(selectedNodes))
|
||||
{
|
||||
GetPendingChangeMenu().Popup();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
internal bool ProcessKeyActionIfNeeded(Event e)
|
||||
{
|
||||
List<IPlasticTreeNode> selectedNodes = mGetSelectedNodes.GetSelectedNodes();
|
||||
|
||||
if (AreAllChangelists(selectedNodes))
|
||||
{
|
||||
return GetChangelistMenu().ProcessKeyActionIfNeeded(e);
|
||||
}
|
||||
|
||||
if (AreAllPendingChanges(selectedNodes))
|
||||
{
|
||||
return GetPendingChangeMenu().ProcessKeyActionIfNeeded(e);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
PendingChangesViewPendingChangeMenu GetPendingChangeMenu()
|
||||
{
|
||||
if (mPendingChangeMenu == null)
|
||||
{
|
||||
mPendingChangeMenu = new PendingChangesViewPendingChangeMenu(
|
||||
mWkInfo,
|
||||
mPendingChangesViewOperations,
|
||||
mChangelistMenuOperations,
|
||||
mOpenMenuOperations,
|
||||
mMetaMenuOperations,
|
||||
mAdvancedUndoMenuOperations,
|
||||
mFilterMenuOperations,
|
||||
mIsGluonMode);
|
||||
}
|
||||
|
||||
return mPendingChangeMenu;
|
||||
}
|
||||
|
||||
ChangelistMenu GetChangelistMenu()
|
||||
{
|
||||
if (mChangelistMenu == null)
|
||||
mChangelistMenu = new ChangelistMenu(
|
||||
mChangelistMenuOperations,
|
||||
mIsGluonMode);
|
||||
|
||||
return mChangelistMenu;
|
||||
}
|
||||
|
||||
static bool AreAllChangelists(List<IPlasticTreeNode> selectedNodes)
|
||||
{
|
||||
foreach (IPlasticTreeNode node in selectedNodes)
|
||||
{
|
||||
if (!(node is ChangelistNode))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool AreAllPendingChanges(List<IPlasticTreeNode> selectedNodes)
|
||||
{
|
||||
foreach (IPlasticTreeNode node in selectedNodes)
|
||||
{
|
||||
if (!(node is PendingChangeInfo))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
PendingChangesViewPendingChangeMenu mPendingChangeMenu;
|
||||
ChangelistMenu mChangelistMenu;
|
||||
|
||||
readonly WorkspaceInfo mWkInfo;
|
||||
readonly IPendingChangesMenuOperations mPendingChangesViewOperations;
|
||||
readonly IFilesFilterPatternsMenuOperations mFilterMenuOperations;
|
||||
readonly IOpenMenuOperations mOpenMenuOperations;
|
||||
readonly PendingChangesViewPendingChangeMenu.IMetaMenuOperations mMetaMenuOperations;
|
||||
readonly PendingChangesViewPendingChangeMenu.IAdvancedUndoMenuOperations mAdvancedUndoMenuOperations;
|
||||
readonly IChangelistMenuOperations mChangelistMenuOperations;
|
||||
readonly IGetSelectedNodes mGetSelectedNodes;
|
||||
readonly bool mIsGluonMode;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ae4d88034c6d7b42a84b0a53bb700d4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0092dcc3ac595ea43981eedc23012f72
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e91cd01ab44d05b4fabcebe1e4ce2ebe
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,22 @@
|
||||
using UnityEditor.IMGUI.Controls;
|
||||
|
||||
using PlasticGui.WorkspaceWindow.PendingChanges;
|
||||
using Unity.PlasticSCM.Editor.UI;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Views.PendingChanges.PendingMergeLinks
|
||||
{
|
||||
internal class MergeLinkListViewItem : TreeViewItem
|
||||
{
|
||||
internal MountPendingMergeLink MergeLink { get; private set; }
|
||||
|
||||
internal MergeLinkListViewItem(int id, MountPendingMergeLink mergeLink)
|
||||
: base(id, 0)
|
||||
{
|
||||
MergeLink = mergeLink;
|
||||
|
||||
displayName = mergeLink.GetPendingMergeLinkText();
|
||||
icon = Images.GetMergeLinkIcon();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fb7decaf4f8be254dafddd860f82f560
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,138 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
using UnityEditor.IMGUI.Controls;
|
||||
using UnityEngine;
|
||||
|
||||
using Codice.Client.Commands;
|
||||
using Codice.Client.Common;
|
||||
using Codice.CM.Common;
|
||||
using Codice.CM.Common.Merge;
|
||||
using Codice.CM.Common.Mount;
|
||||
using PlasticGui.WorkspaceWindow.PendingChanges;
|
||||
using Unity.PlasticSCM.Editor.UI;
|
||||
using Unity.PlasticSCM.Editor.UI.Tree;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Views.PendingChanges.PendingMergeLinks
|
||||
{
|
||||
internal class MergeLinksListView : TreeView
|
||||
{
|
||||
internal float DesiredHeight
|
||||
{
|
||||
get
|
||||
{
|
||||
return rowHeight * (mMergeLinks.Count + 1);
|
||||
}
|
||||
}
|
||||
|
||||
internal MergeLinksListView()
|
||||
: base(new TreeViewState())
|
||||
{
|
||||
rowHeight = UnityConstants.TREEVIEW_ROW_HEIGHT;
|
||||
showAlternatingRowBackgrounds = false;
|
||||
}
|
||||
|
||||
public override IList<TreeViewItem> GetRows()
|
||||
{
|
||||
return mRows;
|
||||
}
|
||||
|
||||
protected override TreeViewItem BuildRoot()
|
||||
{
|
||||
return new TreeViewItem(0, -1, string.Empty);
|
||||
}
|
||||
|
||||
protected override IList<TreeViewItem> BuildRows(TreeViewItem rootItem)
|
||||
{
|
||||
RegenerateRows(mMergeLinks, rootItem, mRows);
|
||||
return mRows;
|
||||
}
|
||||
|
||||
internal void BuildModel(
|
||||
IDictionary<MountPoint, IList<PendingMergeLink>> pendingMergeLinks)
|
||||
{
|
||||
mMergeLinks = BuildMountPendingMergeLink(pendingMergeLinks);
|
||||
}
|
||||
|
||||
protected override void BeforeRowsGUI()
|
||||
{
|
||||
int firstRowVisible;
|
||||
int lastRowVisible;
|
||||
GetFirstAndLastVisibleRows(out firstRowVisible, out lastRowVisible);
|
||||
|
||||
GUI.DrawTexture(new Rect(0,
|
||||
firstRowVisible * rowHeight,
|
||||
GetRowRect(0).width,
|
||||
(lastRowVisible * rowHeight) + 500),
|
||||
Images.GetTreeviewBackgroundTexture());
|
||||
|
||||
DrawTreeViewItem.InitializeStyles();
|
||||
base.BeforeRowsGUI();
|
||||
}
|
||||
|
||||
static void RegenerateRows(
|
||||
List<MountPendingMergeLink> mergeLinks,
|
||||
TreeViewItem rootItem,
|
||||
List<TreeViewItem> rows)
|
||||
{
|
||||
ClearRows(rootItem, rows);
|
||||
|
||||
if (mergeLinks.Count == 0)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < mergeLinks.Count; i++)
|
||||
{
|
||||
MergeLinkListViewItem mergeLinkListViewItem =
|
||||
new MergeLinkListViewItem(i + 1, mergeLinks[i]);
|
||||
|
||||
rootItem.AddChild(mergeLinkListViewItem);
|
||||
rows.Add(mergeLinkListViewItem);
|
||||
}
|
||||
}
|
||||
|
||||
static void ClearRows(
|
||||
TreeViewItem rootItem,
|
||||
List<TreeViewItem> rows)
|
||||
{
|
||||
if (rootItem.hasChildren)
|
||||
rootItem.children.Clear();
|
||||
|
||||
rows.Clear();
|
||||
}
|
||||
|
||||
static List<MountPendingMergeLink> BuildMountPendingMergeLink(
|
||||
IDictionary<MountPoint, IList<PendingMergeLink>> pendingMergeLinks)
|
||||
{
|
||||
List<MountPendingMergeLink> result = new List<MountPendingMergeLink>();
|
||||
|
||||
if (pendingMergeLinks == null)
|
||||
return result;
|
||||
|
||||
foreach (KeyValuePair<MountPoint, IList<PendingMergeLink>> mountLink
|
||||
in pendingMergeLinks)
|
||||
{
|
||||
result.AddRange(BuildMountPendingMergeLinks(
|
||||
mountLink.Key, mountLink.Value));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static List<MountPendingMergeLink> BuildMountPendingMergeLinks(
|
||||
MountPoint mount, IList<PendingMergeLink> links)
|
||||
{
|
||||
List<MountPendingMergeLink> result = new List<MountPendingMergeLink>();
|
||||
|
||||
RepositoryInfo repInfo = RepositorySpecResolverProvider.Get().
|
||||
GetRepInfo(mount.RepSpec);
|
||||
|
||||
foreach (PendingMergeLink link in links)
|
||||
result.Add(new MountPendingMergeLink(repInfo.GetRepSpec(), link));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
List<TreeViewItem> mRows = new List<TreeViewItem>();
|
||||
|
||||
List<MountPendingMergeLink> mMergeLinks = new List<MountPendingMergeLink>();
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user