Commit 1c847220 authored by jang dong hyeok's avatar jang dong hyeok
Browse files

.

parent 076f0c68
using System.IO;
using UnityEditor;
using Codice.Client.Common;
using PlasticGui;
namespace Unity.PlasticSCM.Editor.Views.History
{
internal static class SaveAction
{
internal static string GetDestinationPath(
string wkPath,
string path,
string defaultFileName)
{
string title = PlasticLocalization.GetString(
PlasticLocalization.Name.SaveRevisionAs);
string parentDirectory = GetDirectoryForSaveAs(wkPath, path);
return EditorUtility.SaveFilePanel(
title, parentDirectory, defaultFileName,
string.Empty);
}
static string GetDirectoryForSaveAs(string wkPath, string path)
{
if (PathHelper.IsContainedOn(path, wkPath))
return Path.GetDirectoryName(path);
return WorkspacePath.GetWorkspacePathFromCmPath(
wkPath,
Path.GetDirectoryName(path),
Path.DirectorySeparatorChar);
}
}
}
using UnityEditor.IMGUI.Controls;
using PlasticGui.WorkspaceWindow.IncomingChanges;
namespace Unity.PlasticSCM.Editor.Views.IncomingChanges.Developer
{
internal class ChangeCategoryTreeViewItem : TreeViewItem
{
internal IncomingChangesCategory Category { get; private set; }
internal ChangeCategoryTreeViewItem(int id, IncomingChangesCategory category)
: base(id, 0, category.CategoryType.ToString())
{
Category = category;
}
}
}
using UnityEditor.IMGUI.Controls;
using PlasticGui.WorkspaceWindow.IncomingChanges;
namespace Unity.PlasticSCM.Editor.Views.IncomingChanges.Developer
{
internal class ChangeTreeViewItem : TreeViewItem
{
internal IncomingChangeInfo ChangeInfo { get; private set; }
internal ChangeTreeViewItem(int id, IncomingChangeInfo change)
: base(id, 1)
{
ChangeInfo = change;
displayName = id.ToString();
}
}
}
using Codice.Client.BaseCommands.Merge;
using Codice.CM.Common.Merge;
using PlasticGui.WorkspaceWindow.Merge;
namespace Unity.PlasticSCM.Editor.Views.IncomingChanges.Developer.DirectoryConflicts
{
internal class ConflictResolutionState
{
internal DirectoryConflictResolveActions ResolveAction { get; set; }
internal string RenameValue { get; set; }
internal bool IsApplyActionsForNextConflictsChecked { get; set; }
internal static ConflictResolutionState Build(
DirectoryConflict directoryConflict,
DirectoryConflictAction[] conflictActions)
{
bool hasRenameOption = DirectoryConflictResolutionInfo.HasRenameOption(
conflictActions);
ConflictResolutionState result = new ConflictResolutionState()
{
IsApplyActionsForNextConflictsChecked = false,
ResolveAction = (hasRenameOption) ?
DirectoryConflictResolveActions.Rename :
DirectoryConflictResolveActions.KeepSource,
};
if (!hasRenameOption)
return result;
result.RenameValue = DirectoryConflictResolutionInfo.GetProposeNewItemName(
directoryConflict, "dst");
return result;
}
}
}
using System;
using UnityEditor;
using UnityEngine;
using Codice.Client.BaseCommands.Merge;
using Codice.CM.Common.Merge;
using PlasticGui;
using PlasticGui.WorkspaceWindow.IncomingChanges;
using PlasticGui.WorkspaceWindow.Merge;
using Unity.PlasticSCM.Editor.UI;
namespace Unity.PlasticSCM.Editor.Views.IncomingChanges.Developer.DirectoryConflicts
{
internal static class DrawDirectoryResolutionPanel
{
internal static void ForConflict(
IncomingChangeInfo conflict,
int pendingConflictsCount,
DirectoryConflictUserInfo conflictUserInfo,
DirectoryConflictAction[] actions,
Action<IncomingChangeInfo> resolveConflictAction,
ref ConflictResolutionState state)
{
bool isResolveButtonEnabled;
string validationMessage = null;
GetValidationData(
conflict,
state,
out isResolveButtonEnabled,
out validationMessage);
GUILayout.Space(2);
DoHeader(
conflictUserInfo.ConflictTitle,
conflict,
resolveConflictAction,
isResolveButtonEnabled,
ref state);
DoConflictExplanation(conflictUserInfo.ConflictExplanation);
DoSourceAndDestinationLabels(
conflictUserInfo.SourceOperation,
conflictUserInfo.DestinationOperation);
DoResolutionOptions(
actions,
validationMessage,
ref state);
DoApplyActionsForNextConflictsCheck(pendingConflictsCount, ref state);
GUILayout.Space(10);
}
static void DoHeader(
string conflictName,
IncomingChangeInfo conflict,
Action<IncomingChangeInfo> resolveConflictAction,
bool isResolveButtonEnabled,
ref ConflictResolutionState state)
{
EditorGUILayout.BeginHorizontal();
GUILayout.Label(conflictName,
UnityStyles.DirectoryConflicts.TitleLabel);
GUI.enabled = isResolveButtonEnabled;
GUILayout.Space(5);
if (GUILayout.Button(PlasticLocalization.GetString(
PlasticLocalization.Name.ResolveDirectoryConflict)))
{
resolveConflictAction(conflict);
}
GUI.enabled = true;
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
}
static void DoConflictExplanation(string explanation)
{
GUILayout.Space(5);
GUILayout.Label(explanation, EditorStyles.wordWrappedLabel);
}
static void DoSourceAndDestinationLabels(
string sourceOperation,
string destinationOperation)
{
GUILayout.Space(5);
GUIStyle boldLabelStyle = UnityStyles.DirectoryConflicts.BoldLabel;
GUIContent srcLabel = new GUIContent(
PlasticLocalization.GetString(
PlasticLocalization.Name.Source));
GUIContent dstLabel = new GUIContent(
PlasticLocalization.GetString(
PlasticLocalization.Name.Destination));
float maxWidth = GetMaxWidth(srcLabel, dstLabel, boldLabelStyle);
EditorGUILayout.BeginHorizontal();
GUILayout.Space(25);
GUILayout.Label(srcLabel, boldLabelStyle, GUILayout.Width(maxWidth));
GUILayout.Label(sourceOperation, EditorStyles.label);
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
GUILayout.Space(25);
GUILayout.Label(dstLabel, boldLabelStyle, GUILayout.Width(maxWidth));
GUILayout.Label(destinationOperation, EditorStyles.label);
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
}
static void DoResolutionOptions(
DirectoryConflictAction[] actions,
string validationMessage,
ref ConflictResolutionState state)
{
GUILayout.Space(10);
GUILayout.Label(PlasticLocalization.GetString(
PlasticLocalization.Name.ResolveDirectoryConflictChooseOption));
foreach (DirectoryConflictAction action in actions)
{
EditorGUILayout.BeginHorizontal();
GUILayout.Space(25);
if (GUILayout.Toggle(
state.ResolveAction == action.ActionKind,
action.ActionText,
EditorStyles.radioButton))
{
state.ResolveAction = action.ActionKind;
}
if (action.ActionKind == DirectoryConflictResolveActions.Rename)
{
GUI.enabled = state.ResolveAction == DirectoryConflictResolveActions.Rename;
state.RenameValue = GUILayout.TextField(
state.RenameValue,
UnityStyles.DirectoryConflicts.FileNameTextField,
GUILayout.Width(250));
GUI.enabled = true;
if (!string.IsNullOrEmpty(validationMessage))
{
GUILayout.Label(new GUIContent(
validationMessage,
Images.GetWarnIcon()),
UnityStyles.DirectoryConflictResolution.WarningLabel,
GUILayout.Height(UnityConstants.DIR_CONFLICT_VALIDATION_WARNING_LABEL_HEIGHT));
}
}
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
}
}
static void DoApplyActionsForNextConflictsCheck(
int pendingConflictsCount,
ref ConflictResolutionState state)
{
if (pendingConflictsCount == 0)
return;
GUILayout.Space(5);
bool isCheckEnabled = state.ResolveAction != DirectoryConflictResolveActions.Rename;
bool isChecked = state.IsApplyActionsForNextConflictsChecked & isCheckEnabled;
GUI.enabled = isCheckEnabled;
EditorGUILayout.BeginHorizontal();
state.IsApplyActionsForNextConflictsChecked = !GUILayout.Toggle(
isChecked,
GetApplyActionCheckButtonText(pendingConflictsCount));
if (!isCheckEnabled)
state.IsApplyActionsForNextConflictsChecked = false;
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
GUI.enabled = true;
}
static bool IsValidName(
string name,
DirectoryConflict conflict,
out string errorMessage)
{
if (string.IsNullOrEmpty(name))
{
errorMessage = PlasticLocalization.GetString(
PlasticLocalization.Name.InputItemNameMessage);
return false;
}
if (name == DirectoryConflictResolutionInfo.GetOldItemName(conflict))
{
errorMessage = PlasticLocalization.GetString(
PlasticLocalization.Name.ProvideDifferentItemNameForRenameResolution);
return false;
}
errorMessage = null;
return true;
}
static void GetValidationData(
IncomingChangeInfo conflict,
ConflictResolutionState state,
out bool isResolveButtonEnabled,
out string renameWarningMessage)
{
if (state.ResolveAction != DirectoryConflictResolveActions.Rename)
{
renameWarningMessage = string.Empty;
isResolveButtonEnabled = true;
return;
}
isResolveButtonEnabled = IsValidName(
state.RenameValue,
conflict.DirectoryConflict,
out renameWarningMessage);
}
static float GetMaxWidth(
GUIContent label1,
GUIContent label2,
GUIStyle style)
{
Vector2 srcLabelSize = style.CalcSize(label1);
Vector2 dstLabelSize = style.CalcSize(label2);
return Math.Max(srcLabelSize.x, dstLabelSize.x);
}
static string GetApplyActionCheckButtonText(int pendingConflictsCount)
{
if (pendingConflictsCount > 1)
return PlasticLocalization.GetString(
PlasticLocalization.Name.ApplyActionForNextConflictsCheckButtonSingular,
pendingConflictsCount);
return PlasticLocalization.GetString(
PlasticLocalization.Name.ApplyActionForNextConflictsCheckButtonPlural,
pendingConflictsCount);
}
}
}
using System.Collections.Generic;
using PlasticGui.WorkspaceWindow.IncomingChanges;
namespace Unity.PlasticSCM.Editor.Views.IncomingChanges.Developer
{
internal static class IncomingChangesSelection
{
internal static List<string> GetPathsFromSelectedFileConflictsIncludingMeta(
IncomingChangesTreeView treeView)
{
List<string> result = new List<string>();
List<IncomingChangeInfo> selection =
treeView.GetSelectedFileConflicts();
treeView.FillWithMeta(selection);
foreach (IncomingChangeInfo incomingChange in selection)
{
result.Add(incomingChange.GetPath());
}
return result;
}
internal static SelectedIncomingChangesGroupInfo GetSelectedGroupInfo(
IncomingChangesTreeView treeView)
{
List<IncomingChangeInfo> selectedIncomingChanges =
treeView.GetSelectedIncomingChanges();
return GetSelectedIncomingChangesGroupInfo.For(
selectedIncomingChanges);
}
internal static IncomingChangeInfo GetSingleSelectedIncomingChange(
IncomingChangesTreeView treeView)
{
return treeView.GetSelectedIncomingChange();
}
}
}
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using Codice.Client.BaseCommands;
using Codice.Client.BaseCommands.Merge;
using Codice.Client.Commands;
using Codice.Client.Common;
using Codice.Client.Common.FsNodeReaders;
using Codice.Client.Common.Threading;
using Codice.CM.Common;
using Codice.CM.Common.Merge;
using PlasticGui;
using PlasticGui.WorkspaceWindow;
using PlasticGui.WorkspaceWindow.BranchExplorer;
using PlasticGui.WorkspaceWindow.Diff;
using PlasticGui.WorkspaceWindow.IncomingChanges;
using PlasticGui.WorkspaceWindow.Merge;
using Unity.PlasticSCM.Editor.AssetUtils;
using Unity.PlasticSCM.Editor.UI;
using Unity.PlasticSCM.Editor.UI.Progress;
using Unity.PlasticSCM.Editor.UI.Tree;
using Unity.PlasticSCM.Editor.Views.IncomingChanges.Developer.DirectoryConflicts;
namespace Unity.PlasticSCM.Editor.Views.IncomingChanges.Developer
{
internal class IncomingChangesTab :
IIncomingChangesTab,
IRefreshableView,
MergeViewLogic.IMergeView,
IncomingChangesTree.IGetConflictResolution,
IIncomingChangesViewMenuOperations,
IncomingChangesViewMenu.IMetaMenuOperations
{
internal IncomingChangesTab(
WorkspaceInfo wkInfo,
IViewSwitcher switcher,
PlasticGUIClient plasticClient,
NewIncomingChangesUpdater newIncomingChangesUpdater,
EditorWindow parentWindow)
{
mWkInfo = wkInfo;
mSwitcher = switcher;
mPlasticClient = plasticClient;
mNewIncomingChangesUpdater = newIncomingChangesUpdater;
mParentWindow = parentWindow;
mGuiMessage = new UnityPlasticGuiMessage(parentWindow);
BuildComponents(mWkInfo);
mProgressControls = new ProgressControlsForViews();
PlasticNotifier plasticNotifier = new PlasticNotifier();
mMergeController = new MergeController(
mWkInfo,
null,
null,
EnumMergeType.IncomingMerge,
true,
plasticNotifier,
null);
mMergeViewLogic = new MergeViewLogic(
mWkInfo,
EnumMergeType.IncomingMerge,
true,
mMergeController,
plasticNotifier,
ShowIncomingChangesFrom.NotificationBar,
null,
mNewIncomingChangesUpdater,
null,
this,
NewChangesInWk.Build(mWkInfo, new BuildWorkspacekIsRelevantNewChange()),
mProgressControls,
null);
((IRefreshableView)this).Refresh();
}
bool IIncomingChangesTab.IsVisible
{
get { return mIsVisible; }
set { mIsVisible = value; }
}
void IIncomingChangesTab.OnDisable()
{
TreeHeaderSettings.Save(
mIncomingChangesTreeView.multiColumnHeader.state,
UnityConstants.DEVELOPER_INCOMING_CHANGES_TABLE_SETTINGS_NAME);
}
void IIncomingChangesTab.Update()
{
mProgressControls.UpdateProgress(mParentWindow);
}
void IIncomingChangesTab.OnGUI()
{
if (Event.current.type == EventType.Layout)
{
mHasPendingDirectoryConflicts =
MergeTreeResultParser.GetUnsolvedDirectoryConflictsCount(mResultConflicts) > 0;
mIsOperationRunning = mProgressControls.IsOperationRunning();
}
DoActionsToolbar(
mIsProcessMergesButtonVisible,
mIsCancelMergesButtonVisible,
mIsProcessMergesButtonEnabled,
mIsCancelMergesButtonEnabled,
mProcessMergesButtonText,
mHasPendingDirectoryConflicts,
mIsOperationRunning,
mPlasticClient,
mMergeViewLogic,
mProgressControls.ProgressData);
DoFileConflictsArea(
mPlasticClient,
mIncomingChangesTreeView,
mResultConflicts,
mSolvedFileConflicts,
mRootMountPoint,
mIsOperationRunning);
List<IncomingChangeInfo> selectedIncomingChanges =
mIncomingChangesTreeView.GetSelectedIncomingChanges();
if (GetSelectedIncomingChangesGroupInfo.For(
selectedIncomingChanges).IsDirectoryConflictsSelection &&
!Mouse.IsRightMouseButtonPressed(Event.current))
{
DoDirectoryConflictResolutionPanel(
selectedIncomingChanges,
new Action<IncomingChangeInfo>(ResolveDirectoryConflict),
mConflictResolutionStates);
}
if (mIsMessageLabelVisible)
DoInfoMessageArea(mMessageLabelText);
if (mIsErrorMessageLabelVisible)
DoErrorMessageArea(mErrorMessageLabelText);
if (mProgressControls.HasNotification())
{
DrawProgressForViews.ForNotificationArea(
mProgressControls.ProgressData);
}
}
void IIncomingChangesTab.AutoRefresh()
{
BranchInfo workingBranch = null;
IThreadWaiter waiter = ThreadWaiter.GetWaiter(10);
waiter.Execute(
/*threadOperationDelegate*/ delegate
{
workingBranch = OverlappedCalculator.GetWorkingBranch(
mWkInfo.ClientPath);
},
/*afterOperationDelegate*/ delegate
{
if (waiter.Exception != null)
{
ExceptionsHandler.DisplayException(waiter.Exception);
return;
}
mMergeController.UpdateMergeObjectInfoIfNeeded(workingBranch);
mMergeViewLogic.AutoRefresh();
});
}
void IRefreshableView.Refresh()
{
BranchInfo workingBranch = null;
IThreadWaiter waiter = ThreadWaiter.GetWaiter(10);
waiter.Execute(
/*threadOperationDelegate*/ delegate
{
workingBranch = OverlappedCalculator.GetWorkingBranch(
mWkInfo.ClientPath);
},
/*afterOperationDelegate*/ delegate
{
if (waiter.Exception != null)
{
ExceptionsHandler.DisplayException(waiter.Exception);
return;
}
mMergeController.UpdateMergeObjectInfoIfNeeded(workingBranch);
mMergeViewLogic.Refresh();
});
}
void MergeViewLogic.IMergeView.UpdateData(
MergeTreeResult resultConflicts,
ExplainMergeData explainMergeData,
MergeSolvedFileConflicts solvedFileConflicts,
MountPointWithPath rootMountPoint,
bool isIncomingMerge,
bool isMergeTo,
bool isUpdateMerge,
bool mergeHasFinished)
{
HideMessage();
ShowProcessMergesButton(MergeViewTexts.GetProcessMergeButtonText(
MergeTreeResultParser.GetFileConflictsCount(resultConflicts) > 0,
true));
mResultConflicts = resultConflicts;
mSolvedFileConflicts = solvedFileConflicts;
mRootMountPoint = rootMountPoint;
mConflictResolutionStates.Clear();
UpdateFileConflictsTree(
IncomingChangesTree.BuildIncomingChangeCategories(
mResultConflicts,
this,
mRootMountPoint),
mIncomingChangesTreeView);
}
void MergeViewLogic.IMergeView.UpdateSolvedFileConflicts(
MergeSolvedFileConflicts solvedFileConflicts)
{
mIncomingChangesTreeView.UpdateSolvedFileConflicts(
solvedFileConflicts);
}
void MergeViewLogic.IMergeView.ShowMessage(
string title,
string message,
bool isErrorMessage)
{
if (isErrorMessage)
{
mErrorMessageLabelText = message;
mIsErrorMessageLabelVisible = true;
return;
}
mMessageLabelText = message;
mIsMessageLabelVisible = true;
}
string MergeViewLogic.IMergeView.GetComments(out bool bCancel)
{
bCancel = false;
return string.Empty;
}
void MergeViewLogic.IMergeView.DisableProcessMergesButton()
{
mIsProcessMergesButtonEnabled = false;
}
void MergeViewLogic.IMergeView.ShowCancelButton()
{
mIsCancelMergesButtonEnabled = true;
mIsCancelMergesButtonVisible = true;
}
void MergeViewLogic.IMergeView.HideCancelButton()
{
mIsCancelMergesButtonEnabled = false;
mIsCancelMergesButtonVisible = false;
}
SelectedIncomingChangesGroupInfo IIncomingChangesViewMenuOperations.GetSelectedIncomingChangesGroupInfo()
{
return IncomingChangesSelection.GetSelectedGroupInfo(mIncomingChangesTreeView);
}
string IncomingChangesTree.IGetConflictResolution.GetConflictResolution(
DirectoryConflict conflict)
{
return mMergeViewLogic.GetConflictResolution(conflict);
}
void IIncomingChangesViewMenuOperations.MergeContributors()
{
List<string> selectedPaths = IncomingChangesSelection.
GetPathsFromSelectedFileConflictsIncludingMeta(
mIncomingChangesTreeView);
mMergeViewLogic.ProcessMerges(
mPlasticClient,
mSwitcher,
mGuiMessage,
selectedPaths,
MergeContributorType.MergeContributors,
RefreshAsset.UnityAssetDatabase);
}
void IIncomingChangesViewMenuOperations.MergeKeepingSourceChanges()
{
List<string> selectedPaths = IncomingChangesSelection.
GetPathsFromSelectedFileConflictsIncludingMeta(
mIncomingChangesTreeView);
mMergeViewLogic.ProcessMerges(
mPlasticClient,
mSwitcher,
mGuiMessage,
selectedPaths,
MergeContributorType.KeepSource,
RefreshAsset.UnityAssetDatabase);
}
void IIncomingChangesViewMenuOperations.MergeKeepingWorkspaceChanges()
{
List<string> selectedPaths = IncomingChangesSelection.
GetPathsFromSelectedFileConflictsIncludingMeta(
mIncomingChangesTreeView);
mMergeViewLogic.ProcessMerges(
mPlasticClient,
mSwitcher,
mGuiMessage,
selectedPaths,
MergeContributorType.KeepDestination,
RefreshAsset.UnityAssetDatabase);
}
void IIncomingChangesViewMenuOperations.DiffYoursWithIncoming()
{
IncomingChangeInfo incomingChange = IncomingChangesSelection.
GetSingleSelectedIncomingChange(mIncomingChangesTreeView);
if (incomingChange == null)
return;
DiffYoursWithIncoming(
incomingChange,
mWkInfo);
}
void IIncomingChangesViewMenuOperations.DiffIncomingChanges()
{
IncomingChangeInfo incomingChange = IncomingChangesSelection.
GetSingleSelectedIncomingChange(mIncomingChangesTreeView);
if (incomingChange == null)
return;
DiffIncomingChanges(
incomingChange,
mWkInfo);
}
void IncomingChangesViewMenu.IMetaMenuOperations.DiffIncomingChanges()
{
IncomingChangeInfo incomingChange = IncomingChangesSelection.
GetSingleSelectedIncomingChange(mIncomingChangesTreeView);
if (incomingChange == null)
return;
DiffIncomingChanges(
mIncomingChangesTreeView.GetMetaChange(incomingChange),
mWkInfo);
}
void IncomingChangesViewMenu.IMetaMenuOperations.DiffYoursWithIncoming()
{
IncomingChangeInfo incomingChange = IncomingChangesSelection.
GetSingleSelectedIncomingChange(mIncomingChangesTreeView);
if (incomingChange == null)
return;
DiffYoursWithIncoming(
mIncomingChangesTreeView.GetMetaChange(incomingChange),
mWkInfo);
}
bool IncomingChangesViewMenu.IMetaMenuOperations.SelectionHasMeta()
{
return mIncomingChangesTreeView.SelectionHasMeta();
}
static void DiffYoursWithIncoming(
IncomingChangeInfo incomingChange,
WorkspaceInfo wkInfo)
{
DiffOperation.DiffYoursWithIncoming(
wkInfo,
incomingChange.GetMount(),
incomingChange.GetRevision(),
incomingChange.GetPath(),
xDiffLauncher: null,
imageDiffLauncher: null);
}
static void DiffIncomingChanges(
IncomingChangeInfo incomingChange,
WorkspaceInfo wkInfo)
{
DiffOperation.DiffRevisions(
wkInfo,
incomingChange.GetMount().RepSpec,
incomingChange.GetBaseRevision(),
incomingChange.GetRevision(),
incomingChange.GetPath(),
incomingChange.GetPath(),
true,
xDiffLauncher: null,
imageDiffLauncher: null);
}
void ShowProcessMergesButton(string processMergesButtonText)
{
mProcessMergesButtonText = processMergesButtonText;
mIsProcessMergesButtonEnabled = true;
mIsProcessMergesButtonVisible = true;
}
void HideMessage()
{
mMessageLabelText = string.Empty;
mIsMessageLabelVisible = false;
mErrorMessageLabelText = string.Empty;
mIsErrorMessageLabelVisible = false;
}
static void DoDirectoryConflictResolutionPanel(
List<IncomingChangeInfo> selectedChangeInfos,
Action<IncomingChangeInfo> resolveDirectoryConflictAction,
Dictionary<DirectoryConflict, ConflictResolutionState> conflictResolutionStates)
{
IncomingChangeInfo selectedDirectoryConflict = selectedChangeInfos[0];
if (selectedDirectoryConflict.DirectoryConflict.IsResolved())
return;
DirectoryConflictUserInfo conflictUserInfo;
DirectoryConflictAction[] conflictActions;
DirectoryConflictResolutionInfo.FromDirectoryConflict(
selectedDirectoryConflict.GetMount(),
selectedDirectoryConflict.DirectoryConflict,
out conflictUserInfo,
out conflictActions);
ConflictResolutionState conflictResolutionState = GetConflictResolutionState(
selectedDirectoryConflict.DirectoryConflict,
conflictActions,
conflictResolutionStates);
int pendingSelectedConflictsCount = GetPendingConflictsCount(
selectedChangeInfos);
DrawDirectoryResolutionPanel.ForConflict(
selectedDirectoryConflict,
(pendingSelectedConflictsCount <= 1) ? 0 : pendingSelectedConflictsCount - 1,
conflictUserInfo,
conflictActions,
resolveDirectoryConflictAction,
ref conflictResolutionState);
}
void ResolveDirectoryConflict(IncomingChangeInfo conflict)
{
ConflictResolutionState state;
if (!mConflictResolutionStates.TryGetValue(conflict.DirectoryConflict, out state))
return;
List<DirectoryConflictResolutionData> conflictResolutions =
new List<DirectoryConflictResolutionData>();
AddConflictResolution(
conflict,
state.ResolveAction,
state.RenameValue,
conflictResolutions);
IncomingChangeInfo metaConflict =
mIncomingChangesTreeView.GetMetaChange(conflict);
if (metaConflict != null)
{
AddConflictResolution(
metaConflict,
state.ResolveAction,
MetaPath.GetMetaPath(state.RenameValue),
conflictResolutions);
}
if (state.IsApplyActionsForNextConflictsChecked)
{
foreach (IncomingChangeInfo otherConflict in mIncomingChangesTreeView.GetSelectedIncomingChanges())
{
AddConflictResolution(
otherConflict,
state.ResolveAction,
state.RenameValue,
conflictResolutions);
}
}
mMergeViewLogic.ResolveDirectoryConflicts(conflictResolutions);
}
static void AddConflictResolution(
IncomingChangeInfo conflict,
DirectoryConflictResolveActions resolveAction,
string renameValue,
List<DirectoryConflictResolutionData> conflictResolutions)
{
conflictResolutions.Add(new DirectoryConflictResolutionData(
conflict.DirectoryConflict,
conflict.Xlink,
conflict.GetMount().Mount,
resolveAction,
renameValue));
}
void DoActionsToolbar(
bool isProcessMergesButtonVisible,
bool isCancelMergesButtonVisible,
bool isProcessMergesButtonEnabled,
bool isCancelMergesButtonEnabled,
string processMergesButtonText,
bool hasPendingDirectoryConflictsCount,
bool isOperationRunning,
PlasticGUIClient plasticClient,
MergeViewLogic mergeViewLogic,
ProgressControlsForViews.Data progressData)
{
EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
if (isProcessMergesButtonVisible)
{
DoProcessMergesButton(
isProcessMergesButtonEnabled && !hasPendingDirectoryConflictsCount,
processMergesButtonText,
mSwitcher,
mPlasticClient,
mGuiMessage,
mergeViewLogic);
}
if (isCancelMergesButtonVisible)
{
DoCancelMergesButton(
isCancelMergesButtonEnabled,
mergeViewLogic);
}
if (hasPendingDirectoryConflictsCount)
{
GUILayout.Space(5);
DoWarningMessage();
}
if (isOperationRunning)
{
DrawProgressForViews.ForIndeterminateProgress(
progressData);
}
GUILayout.FlexibleSpace();
DoRefreshButton(
!isOperationRunning,
plasticClient,
mergeViewLogic);
EditorGUILayout.EndHorizontal();
}
static void DoFileConflictsArea(
PlasticGUIClient plasticClient,
IncomingChangesTreeView incomingChangesTreeView,
MergeTreeResult conflicts,
MergeSolvedFileConflicts solvedConflicts,
MountPointWithPath mount,
bool isOperationRunning)
{
DoConflictsHeader(
conflicts,
solvedConflicts,
mount);
DoConflictsTree(
incomingChangesTreeView,
isOperationRunning);
}
static void DoConflictsTree(
IncomingChangesTreeView incomingChangesTreeView,
bool isOperationRunning)
{
GUI.enabled = !isOperationRunning;
Rect rect = GUILayoutUtility.GetRect(0, 100000, 0, 100000);
incomingChangesTreeView.OnGUI(rect);
GUI.enabled = true;
}
static void DoConflictsHeader(
MergeTreeResult conflicts,
MergeSolvedFileConflicts solvedFileConflicts,
MountPointWithPath mount)
{
if (conflicts == null || mount == null)
return;
EditorGUILayout.BeginHorizontal();
DoDirectoryConflictsHeader(conflicts);
DoFileConflictsHeader(
conflicts,
solvedFileConflicts,
mount);
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
}
static void DoDirectoryConflictsHeader(MergeTreeResult conflicts)
{
int directoryConflictsCount =
MergeTreeResultParser.GetDirectoryConflictsCount(conflicts);
int pendingDirectoryConflictsCount =
MergeTreeResultParser.GetUnsolvedDirectoryConflictsCount(
conflicts);
if (directoryConflictsCount == 0)
return;
GUIStyle pendingDirectoryConflictsOfTotalStyle =
pendingDirectoryConflictsCount > 0 ?
UnityStyles.IncomingChangesTab.RedPendingConflictsOfTotalLabel :
UnityStyles.IncomingChangesTab.GreenPendingConflictsOfTotalLabel;
GUILayout.Label(
string.Format("{0}/{1}", pendingDirectoryConflictsCount, directoryConflictsCount),
pendingDirectoryConflictsOfTotalStyle);
GUILayout.Label(
MergeViewTexts.GetDirectoryConflictsUnsolvedCaption(directoryConflictsCount),
UnityStyles.IncomingChangesTab.PendingConflictsLabel);
}
static void DoFileConflictsHeader(
MergeTreeResult conflicts,
MergeSolvedFileConflicts solvedFileConflicts,
MountPointWithPath mount)
{
int fileConflictsCount = MergeTreeResultParser.GetFileConflictsCount(conflicts);
int pendingFileConflictsCount = MergeTreeResultParser.GetUnsolvedFileConflictsCount(
conflicts, mount.Id, solvedFileConflicts);
GUIStyle pendingFileConflictsOfTotalStyle =
pendingFileConflictsCount > 0 ?
UnityStyles.IncomingChangesTab.RedPendingConflictsOfTotalLabel :
UnityStyles.IncomingChangesTab.GreenPendingConflictsOfTotalLabel;
GUILayout.Label(
string.Format("{0}/{1}", pendingFileConflictsCount, fileConflictsCount),
pendingFileConflictsOfTotalStyle);
GUILayout.Label(
MergeViewTexts.GetFileConflictsCaption(fileConflictsCount, true),
UnityStyles.IncomingChangesTab.PendingConflictsLabel);
GUILayout.Space(5);
GUILayout.Label(
MergeViewTexts.GetChangesToApplyCaption(
MergeTreeResultParser.GetChangesToApplySummary(conflicts)),
UnityStyles.IncomingChangesTab.ChangesToApplySummaryLabel);
}
static void DoProcessMergesButton(
bool isEnabled,
string processMergesButtonText,
IViewSwitcher switcher,
PlasticGUIClient plasticClient,
GuiMessage.IGuiMessage guiMessage,
MergeViewLogic mergeViewLogic)
{
GUI.enabled = isEnabled;
if (DrawActionButton.For(processMergesButtonText))
{
mergeViewLogic.ProcessMerges(
plasticClient,
switcher,
guiMessage,
new List<string>(),
MergeContributorType.MergeContributors,
RefreshAsset.UnityAssetDatabase);
}
GUI.enabled = true;
}
void DoCancelMergesButton(
bool isEnabled,
MergeViewLogic mergeViewLogic)
{
GUI.enabled = isEnabled;
if (DrawActionButton.For(PlasticLocalization.GetString(
PlasticLocalization.Name.CancelButton)))
{
mergeViewLogic.Cancel();
mIsCancelMergesButtonEnabled = false;
}
GUI.enabled = true;
}
static void DoWarningMessage()
{
string label = PlasticLocalization.GetString(PlasticLocalization.Name.SolveConflictsInLable);
GUILayout.Label(
new GUIContent(label, Images.GetWarnIcon()),
UnityStyles.IncomingChangesTab.HeaderWarningLabel);
}
static void DoRefreshButton(
bool isEnabled,
PlasticGUIClient plasticClient,
MergeViewLogic mergeViewLogic)
{
GUI.enabled = isEnabled;
if (GUILayout.Button(new GUIContent(
Images.GetRefreshIcon()), EditorStyles.toolbarButton))
mergeViewLogic.Refresh();
GUI.enabled = true;
}
void UpdateFileConflictsTree(
IncomingChangesTree incomingChangesTree,
IncomingChangesTreeView incomingChangesTreeView)
{
UnityIncomingChangesTree unityIncomingChangesTree = null;
IThreadWaiter waiter = ThreadWaiter.GetWaiter(10);
waiter.Execute(
/*threadOperationDelegate*/ delegate
{
unityIncomingChangesTree = UnityIncomingChangesTree.BuildIncomingChangeCategories(
incomingChangesTree);
incomingChangesTree.ResolveUserNames(
new IncomingChangesTree.ResolveUserName());
},
/*afterOperationDelegate*/ delegate
{
incomingChangesTreeView.BuildModel(unityIncomingChangesTree);
incomingChangesTreeView.Sort();
incomingChangesTreeView.Reload();
incomingChangesTreeView.SelectFirstUnsolvedDirectoryConflict();
});
}
static void DoInfoMessageArea(string message)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.HelpBox(message, MessageType.Info);
EditorGUILayout.EndHorizontal();
}
static void DoErrorMessageArea(string message)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.HelpBox(message, MessageType.Error);
EditorGUILayout.EndHorizontal();
}
void BuildComponents(WorkspaceInfo wkInfo)
{
IncomingChangesTreeHeaderState incomingChangesHeaderState =
IncomingChangesTreeHeaderState.GetDefault();
TreeHeaderSettings.Load(incomingChangesHeaderState,
UnityConstants.DEVELOPER_INCOMING_CHANGES_TABLE_SETTINGS_NAME,
(int)IncomingChangesTreeColumn.Path, true);
mIncomingChangesTreeView = new IncomingChangesTreeView(
wkInfo, incomingChangesHeaderState,
IncomingChangesTreeHeaderState.GetColumnNames(),
new IncomingChangesViewMenu(this, this));
mIncomingChangesTreeView.Reload();
}
static ConflictResolutionState GetConflictResolutionState(
DirectoryConflict directoryConflict,
DirectoryConflictAction[] conflictActions,
Dictionary<DirectoryConflict, ConflictResolutionState> conflictResoltionStates)
{
ConflictResolutionState result;
if (conflictResoltionStates.TryGetValue(directoryConflict, out result))
return result;
result = ConflictResolutionState.Build(directoryConflict, conflictActions);
conflictResoltionStates.Add(directoryConflict, result);
return result;
}
static int GetPendingConflictsCount(
List<IncomingChangeInfo> selectedChangeInfos)
{
int result = 0;
foreach (IncomingChangeInfo changeInfo in selectedChangeInfos)
{
if (changeInfo.DirectoryConflict.IsResolved())
continue;
result++;
}
return result;
}
bool mIsVisible;
bool mIsProcessMergesButtonVisible;
bool mIsCancelMergesButtonVisible;
bool mIsMessageLabelVisible;
bool mIsErrorMessageLabelVisible;
bool mIsProcessMergesButtonEnabled;
bool mIsCancelMergesButtonEnabled;
bool mHasPendingDirectoryConflicts;
bool mIsOperationRunning;
string mProcessMergesButtonText;
string mMessageLabelText;
string mErrorMessageLabelText;
IncomingChangesTreeView mIncomingChangesTreeView;
MergeTreeResult mResultConflicts;
MergeSolvedFileConflicts mSolvedFileConflicts;
MountPointWithPath mRootMountPoint;
Dictionary<DirectoryConflict, ConflictResolutionState> mConflictResolutionStates =
new Dictionary<DirectoryConflict, ConflictResolutionState>();
readonly ProgressControlsForViews mProgressControls;
readonly MergeViewLogic mMergeViewLogic;
readonly MergeController mMergeController;
readonly GuiMessage.IGuiMessage mGuiMessage;
readonly EditorWindow mParentWindow;
readonly NewIncomingChangesUpdater mNewIncomingChangesUpdater;
readonly PlasticGUIClient mPlasticClient;
readonly IViewSwitcher mSwitcher;
readonly WorkspaceInfo mWkInfo;
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using UnityEditor.IMGUI.Controls;
using UnityEngine;
using PlasticGui;
using Unity.PlasticSCM.Editor.UI.Tree;
namespace Unity.PlasticSCM.Editor.Views.IncomingChanges.Developer
{
internal enum IncomingChangesTreeColumn
{
Path,
Size,
Author,
Details,
Resolution
}
[Serializable]
internal class IncomingChangesTreeHeaderState : MultiColumnHeaderState, ISerializationCallbackReceiver
{
internal static IncomingChangesTreeHeaderState GetDefault()
{
return new IncomingChangesTreeHeaderState(BuildColumns());
}
internal static List<string> GetColumnNames()
{
List<string> result = new List<string>();
result.Add(PlasticLocalization.GetString(PlasticLocalization.Name.PathColumn));
result.Add(PlasticLocalization.GetString(PlasticLocalization.Name.SizeColumn));
result.Add(PlasticLocalization.GetString(PlasticLocalization.Name.CreatedByColumn));
result.Add(PlasticLocalization.GetString(PlasticLocalization.Name.DetailsColumn));
result.Add(PlasticLocalization.GetString(PlasticLocalization.Name.ResolutionMethodColumn));
return result;
}
internal static string GetColumnName(IncomingChangesTreeColumn column)
{
switch (column)
{
case IncomingChangesTreeColumn.Path:
return PlasticLocalization.GetString(PlasticLocalization.Name.PathColumn);
case IncomingChangesTreeColumn.Size:
return PlasticLocalization.GetString(PlasticLocalization.Name.SizeColumn);
case IncomingChangesTreeColumn.Author:
return PlasticLocalization.GetString(PlasticLocalization.Name.AuthorColumn);
case IncomingChangesTreeColumn.Details:
return PlasticLocalization.GetString(PlasticLocalization.Name.DetailsColumn);
case IncomingChangesTreeColumn.Resolution:
return PlasticLocalization.GetString(PlasticLocalization.Name.ResolutionMethodColumn);
default:
return null;
}
}
void ISerializationCallbackReceiver.OnAfterDeserialize()
{
if (mHeaderTitles != null)
TreeHeaderColumns.SetTitles(columns, mHeaderTitles);
if (mColumsAllowedToggleVisibility != null)
TreeHeaderColumns.SetVisibilities(columns, mColumsAllowedToggleVisibility);
}
void ISerializationCallbackReceiver.OnBeforeSerialize()
{
}
static Column[] BuildColumns()
{
return new Column[]
{
new Column()
{
width = 450,
headerContent = new GUIContent(
GetColumnName(IncomingChangesTreeColumn.Path)),
minWidth = 200,
allowToggleVisibility = false,
},
new Column()
{
width = 150,
headerContent = new GUIContent(
GetColumnName(IncomingChangesTreeColumn.Size)),
minWidth = 45
},
new Column()
{
width = 150,
headerContent = new GUIContent(
GetColumnName(IncomingChangesTreeColumn.Author)),
minWidth = 80
},
new Column()
{
width = 200,
headerContent = new GUIContent(
GetColumnName(IncomingChangesTreeColumn.Details)),
minWidth = 100
},
new Column()
{
width = 250,
headerContent = new GUIContent(
GetColumnName(IncomingChangesTreeColumn.Resolution)),
minWidth = 120
}
};
}
IncomingChangesTreeHeaderState(Column[] columns)
: base(columns)
{
if (mHeaderTitles == null)
mHeaderTitles = TreeHeaderColumns.GetTitles(columns);
if (mColumsAllowedToggleVisibility == null)
mColumsAllowedToggleVisibility = TreeHeaderColumns.GetVisibilities(columns);
}
[SerializeField]
string[] mHeaderTitles;
[SerializeField]
bool[] mColumsAllowedToggleVisibility;
}
}
using System.Collections.Generic;
using System.IO;
using UnityEditor.IMGUI.Controls;
using UnityEngine;
using Codice.Client.BaseCommands.Merge;
using Codice.Client.Common;
using Codice.CM.Common;
using PlasticGui.WorkspaceWindow.IncomingChanges;
using Unity.PlasticSCM.Editor.UI;
using Unity.PlasticSCM.Editor.UI.Tree;
namespace Unity.PlasticSCM.Editor.Views.IncomingChanges.Developer
{
internal class IncomingChangesTreeView : TreeView
{
internal IncomingChangesTreeView(
WorkspaceInfo wkInfo,
IncomingChangesTreeHeaderState headerState,
List<string> columnNames,
IncomingChangesViewMenu menu)
: base(new TreeViewState())
{
mWkInfo = wkInfo;
mColumnNames = columnNames;
mMenu = menu;
multiColumnHeader = new MultiColumnHeader(headerState);
multiColumnHeader.canSort = true;
multiColumnHeader.sortingChanged += SortingChanged;
customFoldoutYOffset = UnityConstants.TREEVIEW_FOLDOUT_Y_OFFSET;
rowHeight = UnityConstants.TREEVIEW_ROW_HEIGHT;
showAlternatingRowBackgrounds = true;
}
public override IList<TreeViewItem> GetRows()
{
return mRows;
}
protected override bool CanChangeExpandedState(TreeViewItem item)
{
return item is ChangeCategoryTreeViewItem;
}
protected override TreeViewItem BuildRoot()
{
return new TreeViewItem(0, -1, string.Empty);
}
protected override IList<TreeViewItem> BuildRows(TreeViewItem rootItem)
{
try
{
RegenerateRows(
mIncomingChangesTree,
mTreeViewItemIds,
this,
rootItem,
mRows,
mExpandCategories);
}
finally
{
mExpandCategories = false;
}
return mRows;
}
protected override void CommandEventHandling()
{
// NOTE - empty override to prevent crash when pressing ctrl-a in the treeview
}
protected override void ContextClickedItem(int id)
{
mMenu.Popup();
Repaint();
}
protected override void RowGUI(RowGUIArgs args)
{
DrawTreeViewItem.InitializeStyles();
if (args.item is ChangeCategoryTreeViewItem)
{
ChangeCategoryTreeViewItem categoryItem =
(ChangeCategoryTreeViewItem)args.item;
CategoryTreeViewItemGUI(
args.rowRect, rowHeight,
categoryItem,
GetSolvedChildrenCount(categoryItem.Category, mSolvedFileConflicts),
args.selected,
args.focused);
return;
}
if (args.item is ChangeTreeViewItem)
{
ChangeTreeViewItem changeTreeViewItem =
(ChangeTreeViewItem)args.item;
IncomingChangeInfo changeInfo =
changeTreeViewItem.ChangeInfo;
bool isCurrentConflict = IsCurrent.Conflict(
changeInfo,
mIncomingChangesTree.GetMetaChange(changeInfo),
mSolvedFileConflicts);
bool isSolvedConflict = IsSolved.Conflict(
changeInfo,
mIncomingChangesTree.GetMetaChange(changeInfo),
mSolvedFileConflicts);
IncomingChangeTreeViewItemGUI(
mWkInfo.ClientPath,
mIncomingChangesTree,
this,
changeTreeViewItem,
args,
isCurrentConflict,
isSolvedConflict);
return;
}
base.RowGUI(args);
}
internal void SelectFirstUnsolvedDirectoryConflict()
{
foreach (IncomingChangesCategory category in mIncomingChangesTree.GetNodes())
{
if (category.CategoryType != IncomingChangesCategory.Type.DirectoryConflicts)
continue;
foreach (IncomingChangeInfo changeInfo in category.GetChanges())
{
if (changeInfo.DirectoryConflict.IsResolved())
continue;
int itemId = -1;
if (mTreeViewItemIds.TryGetInfoItemId(changeInfo, out itemId))
{
SetSelection(new List<int>() { itemId });
return;
}
}
}
}
internal void BuildModel(UnityIncomingChangesTree tree)
{
mTreeViewItemIds.Clear();
mIncomingChangesTree = tree;
mSolvedFileConflicts = null;
mExpandCategories = true;
}
internal void Sort()
{
int sortedColumnIdx = multiColumnHeader.state.sortedColumnIndex;
bool sortAscending = multiColumnHeader.IsSortedAscending(sortedColumnIdx);
mIncomingChangesTree.Sort(
mColumnNames[sortedColumnIdx],
sortAscending);
}
internal void UpdateSolvedFileConflicts(
MergeSolvedFileConflicts solvedFileConflicts)
{
mSolvedFileConflicts = solvedFileConflicts;
}
internal IncomingChangeInfo GetMetaChange(IncomingChangeInfo change)
{
if (change == null)
return null;
return mIncomingChangesTree.GetMetaChange(change);
}
internal void FillWithMeta(List<IncomingChangeInfo> changes)
{
mIncomingChangesTree.FillWithMeta(changes);
}
internal bool SelectionHasMeta()
{
IncomingChangeInfo selectedChangeInfo = GetSelectedIncomingChange();
if (selectedChangeInfo == null)
return false;
return mIncomingChangesTree.HasMeta(selectedChangeInfo);
}
internal IncomingChangeInfo GetSelectedIncomingChange()
{
IList<int> selectedIds = GetSelection();
if (selectedIds.Count != 1)
return null;
int selectedId = selectedIds[0];
foreach (KeyValuePair<IncomingChangeInfo, int> item
in mTreeViewItemIds.GetInfoItems())
{
if (selectedId == item.Value)
return item.Key;
}
return null;
}
internal List<IncomingChangeInfo> GetSelectedIncomingChanges()
{
List<IncomingChangeInfo> result = new List<IncomingChangeInfo>();
IList<int> selectedIds = GetSelection();
if (selectedIds.Count == 0)
return result;
foreach (KeyValuePair<IncomingChangeInfo, int> item
in mTreeViewItemIds.GetInfoItems())
{
if (!selectedIds.Contains(item.Value))
continue;
result.Add(item.Key);
}
return result;
}
internal List<IncomingChangeInfo> GetSelectedFileConflicts()
{
List<IncomingChangeInfo> result = new List<IncomingChangeInfo>();
IList<int> selectedIds = GetSelection();
if (selectedIds.Count == 0)
return result;
foreach (KeyValuePair<IncomingChangeInfo, int> item
in mTreeViewItemIds.GetInfoItems())
{
if (!selectedIds.Contains(item.Value))
continue;
if (item.Key.CategoryType !=
IncomingChangesCategory.Type.FileConflicts)
continue;
result.Add(item.Key);
}
return result;
}
void SortingChanged(MultiColumnHeader multiColumnHeader)
{
Sort();
Reload();
}
static void RegenerateRows(
UnityIncomingChangesTree incomingChangesTree,
TreeViewItemIds<IncomingChangesCategory, IncomingChangeInfo> treeViewItemIds,
IncomingChangesTreeView treeView,
TreeViewItem rootItem,
List<TreeViewItem> rows,
bool expandCategories)
{
if (incomingChangesTree == null)
return;
ClearRows(rootItem, rows);
List<IncomingChangesCategory> categories = incomingChangesTree.GetNodes();
if (categories == null)
return;
List<int> categoriesToExpand = new List<int>();
foreach (IncomingChangesCategory category in categories)
{
int categoryId;
if (!treeViewItemIds.TryGetCategoryItemId(category, out categoryId))
categoryId = treeViewItemIds.AddCategoryItem(category);
ChangeCategoryTreeViewItem categoryTreeViewItem =
new ChangeCategoryTreeViewItem(categoryId, category);
rootItem.AddChild(categoryTreeViewItem);
rows.Add(categoryTreeViewItem);
if (!ShouldExpandCategory(
treeView,
categoryTreeViewItem,
expandCategories,
categories.Count))
continue;
categoriesToExpand.Add(categoryTreeViewItem.id);
foreach (IncomingChangeInfo changeInfo in category.GetChanges())
{
int differenceId;
if (!treeViewItemIds.TryGetInfoItemId(changeInfo, out differenceId))
differenceId = treeViewItemIds.AddInfoItem(changeInfo);
TreeViewItem changeTreeViewItem =
new ChangeTreeViewItem(differenceId, changeInfo);
categoryTreeViewItem.AddChild(changeTreeViewItem);
rows.Add(changeTreeViewItem);
}
}
treeView.state.expandedIDs = categoriesToExpand;
}
static void ClearRows(
TreeViewItem rootItem,
List<TreeViewItem> rows)
{
if (rootItem.hasChildren)
rootItem.children.Clear();
rows.Clear();
}
static void CategoryTreeViewItemGUI(
Rect rowRect,
float rowHeight,
ChangeCategoryTreeViewItem item,
int solvedChildrenCount,
bool isSelected,
bool isFocused)
{
Texture icon = GetCategoryIcon(item.Category.CategoryType);
string label = item.Category.GetHeaderText();
DefaultStyles.label = GetCategoryStyle(
item.Category,
solvedChildrenCount,
isSelected);
DrawTreeViewItem.ForCategoryItem(
rowRect,
rowHeight,
item.depth,
icon,
label,
isSelected,
isFocused);
DefaultStyles.label = UnityStyles.Tree.Label;
}
static void IncomingChangeTreeViewItemGUI(
string wkPath,
UnityIncomingChangesTree incomingChangesTree,
IncomingChangesTreeView treeView,
ChangeTreeViewItem item,
RowGUIArgs args,
bool isCurrentConflict,
bool isSolvedConflict)
{
for (int visibleColumnIdx = 0; visibleColumnIdx < args.GetNumVisibleColumns(); visibleColumnIdx++)
{
Rect cellRect = args.GetCellRect(visibleColumnIdx);
IncomingChangesTreeColumn column =
(IncomingChangesTreeColumn)args.GetColumn(visibleColumnIdx);
IncomingChangeTreeViewItemCellGUI(
wkPath,
cellRect,
treeView.rowHeight,
incomingChangesTree,
treeView,
item,
column,
args.selected,
args.focused,
isCurrentConflict,
isSolvedConflict);
}
}
static void IncomingChangeTreeViewItemCellGUI(
string wkPath,
Rect rect,
float rowHeight,
UnityIncomingChangesTree incomingChangesTree,
IncomingChangesTreeView treeView,
ChangeTreeViewItem item,
IncomingChangesTreeColumn column,
bool isSelected,
bool isFocused,
bool isCurrentConflict,
bool isSolvedConflict)
{
IncomingChangeInfo incomingChange = item.ChangeInfo;
string label = incomingChange.GetColumnText(
IncomingChangesTreeHeaderState.GetColumnName(column));
if (column == IncomingChangesTreeColumn.Path)
{
if (incomingChangesTree.HasMeta(item.ChangeInfo))
label = string.Concat(label, UnityConstants.TREEVIEW_META_LABEL);
Texture icon = GetIcon(wkPath, incomingChange);
GetChangesOverlayIcon.Data overlayIconData =
GetChangesOverlayIcon.ForPlasticIncomingChange(
incomingChange, isSolvedConflict);
DrawTreeViewItem.ForItemCell(
rect,
rowHeight,
item.depth,
icon,
overlayIconData,
label,
isSelected,
isFocused,
isCurrentConflict,
false);
return;
}
if (column == IncomingChangesTreeColumn.Size)
{
DrawTreeViewItem.ForSecondaryLabelRightAligned(
rect, label, isSelected, isFocused, isCurrentConflict);
return;
}
DrawTreeViewItem.ForSecondaryLabel(
rect, label, isSelected, isFocused, isCurrentConflict);
}
static Texture GetCategoryIcon(
IncomingChangesCategory.Type categoryType)
{
switch (categoryType)
{
case IncomingChangesCategory.Type.DirectoryConflicts:
case IncomingChangesCategory.Type.FileConflicts:
return Images.GetImage(Images.Name.IconMergeConflict);
case IncomingChangesCategory.Type.Changed:
return Images.GetImage(Images.Name.IconChanged);
case IncomingChangesCategory.Type.Moved:
return Images.GetImage(Images.Name.IconMoved);
case IncomingChangesCategory.Type.Deleted:
return Images.GetImage(Images.Name.IconDeleted);
case IncomingChangesCategory.Type.Added:
return Images.GetImage(Images.Name.IconAdded);
default:
return null;
}
}
static Texture GetIcon(
string wkPath,
IncomingChangeInfo incomingChange)
{
RevisionInfo revInfo = incomingChange.GetRevision();
bool isDirectory = revInfo.
Type == EnumRevisionType.enDirectory;
if (isDirectory || incomingChange.IsXLink())
return Images.GetDirectoryIcon();
string fullPath = WorkspacePath.GetWorkspacePathFromCmPath(
wkPath,
incomingChange.GetPath(),
Path.DirectorySeparatorChar);
return Images.GetFileIcon(fullPath);
}
static GUIStyle GetCategoryStyle(
IncomingChangesCategory category,
int solvedChildrenCount,
bool isSelected)
{
if (isSelected)
return UnityStyles.Tree.Label;
if (category.CategoryType == IncomingChangesCategory.Type.FileConflicts ||
category.CategoryType == IncomingChangesCategory.Type.DirectoryConflicts)
{
return category.GetChangesCount() > solvedChildrenCount ?
UnityStyles.Tree.RedLabel : UnityStyles.Tree.GreenLabel;
}
return UnityStyles.Tree.Label;
}
static bool ShouldExpandCategory(
IncomingChangesTreeView treeView,
ChangeCategoryTreeViewItem categoryTreeViewItem,
bool expandCategories,
int categoriesCount)
{
if (expandCategories)
{
if (categoriesCount == 1)
return true;
if (categoryTreeViewItem.Category.CategoryType ==
IncomingChangesCategory.Type.FileConflicts)
return true;
if (categoryTreeViewItem.Category.GetChangesCount() >
NODES_TO_EXPAND_CATEGORY)
return false;
return true;
}
return treeView.IsExpanded(categoryTreeViewItem.id);
}
static int GetSolvedChildrenCount(
IncomingChangesCategory category,
MergeSolvedFileConflicts solvedFileConflicts)
{
int solvedDirConflicts = 0;
if (category.CategoryType == IncomingChangesCategory.Type.DirectoryConflicts)
{
foreach (IncomingChangeInfo change in category.GetChanges())
{
if (change.DirectoryConflict.IsResolved())
solvedDirConflicts++;
}
return solvedDirConflicts;
}
return (solvedFileConflicts == null) ? 0 :
solvedFileConflicts.GetCount();
}
bool mExpandCategories;
TreeViewItemIds<IncomingChangesCategory, IncomingChangeInfo> mTreeViewItemIds =
new TreeViewItemIds<IncomingChangesCategory, IncomingChangeInfo>();
List<TreeViewItem> mRows = new List<TreeViewItem>();
MergeSolvedFileConflicts mSolvedFileConflicts;
UnityIncomingChangesTree mIncomingChangesTree;
readonly IncomingChangesViewMenu mMenu;
readonly List<string> mColumnNames;
readonly WorkspaceInfo mWkInfo;
const int NODES_TO_EXPAND_CATEGORY = 10;
}
}
using UnityEditor;
using UnityEngine;
using PlasticGui;
using PlasticGui.WorkspaceWindow.IncomingChanges;
using Unity.PlasticSCM.Editor.UI;
namespace Unity.PlasticSCM.Editor.Views.IncomingChanges.Developer
{
internal class IncomingChangesViewMenu
{
internal interface IMetaMenuOperations
{
void DiffIncomingChanges();
void DiffYoursWithIncoming();
bool SelectionHasMeta();
}
internal IncomingChangesViewMenu(
IIncomingChangesViewMenuOperations incomingChangesViewMenuOperations,
IMetaMenuOperations incomingChangesMetaMenuOperations)
{
mIncomingChangesViewMenuOperations = incomingChangesViewMenuOperations;
mIncomingChangesMetaMenuOperations = incomingChangesMetaMenuOperations;
BuildComponents();
}
internal void Popup()
{
GenericMenu menu = new GenericMenu();
UpdateMenuItems(menu);
menu.ShowAsContext();
}
void MergeSelectedFilesMenuItem_Click()
{
mIncomingChangesViewMenuOperations.MergeContributors();
}
void MergeKeepingSourceChangesMenuItem_Click()
{
mIncomingChangesViewMenuOperations.MergeKeepingSourceChanges();
}
void MergeKeepingWorkspaceChangesMenuItem_Click()
{
mIncomingChangesViewMenuOperations.MergeKeepingWorkspaceChanges();
}
void DiffYoursWithIncomingMenuItem_Click()
{
mIncomingChangesViewMenuOperations.DiffYoursWithIncoming();
}
void DiffIncomingChangesMenuItem_Click()
{
mIncomingChangesViewMenuOperations.DiffIncomingChanges();
}
void DiffMetaYoursWithIncomingMenuItem_Click()
{
mIncomingChangesMetaMenuOperations.DiffYoursWithIncoming();
}
void DiffMetaIncomingChangesMenuItem_Click()
{
mIncomingChangesMetaMenuOperations.DiffIncomingChanges();
}
void UpdateMenuItems(GenericMenu menu)
{
SelectedIncomingChangesGroupInfo info =
mIncomingChangesViewMenuOperations.GetSelectedIncomingChangesGroupInfo();
IncomingChangesMenuOperations operations =
UpdateIncomingChangesMenu.GetAvailableMenuOperations(info);
if (operations == IncomingChangesMenuOperations.None)
{
menu.AddDisabledItem(GetNoActionMenuItemContent());
return;
}
AddMergeActions(menu, operations);
menu.AddSeparator(string.Empty);
AddDiffActions(menu, operations);
if (!mIncomingChangesMetaMenuOperations.SelectionHasMeta())
return;
menu.AddSeparator(string.Empty);
AddMetaActions(menu, operations);
}
void AddMergeActions(
GenericMenu menu,
IncomingChangesMenuOperations operations)
{
if (operations.HasFlag(IncomingChangesMenuOperations.MergeContributors))
menu.AddItem(mMergeSelectedFilesMenuItemContent, false,
MergeSelectedFilesMenuItem_Click);
else
menu.AddDisabledItem(mMergeSelectedFilesMenuItemContent);
if (operations.HasFlag(IncomingChangesMenuOperations.MergeKeepingSourceChanges))
menu.AddItem(mMergeKeepingSourceChangesMenuItemContent, false,
MergeKeepingSourceChangesMenuItem_Click);
else
menu.AddDisabledItem(mMergeKeepingSourceChangesMenuItemContent);
if (operations.HasFlag(IncomingChangesMenuOperations.MergeKeepingWorkspaceChanges))
menu.AddItem(mMergeKeepingWorkspaceChangesMenuItemContent, false,
MergeKeepingWorkspaceChangesMenuItem_Click);
else
menu.AddDisabledItem(mMergeKeepingWorkspaceChangesMenuItemContent);
}
void AddDiffActions(GenericMenu menu, IncomingChangesMenuOperations operations)
{
if (operations.HasFlag(IncomingChangesMenuOperations.DiffYoursWithIncoming))
menu.AddItem(mDiffYoursWithIncomingMenuItemContent, false,
DiffYoursWithIncomingMenuItem_Click);
else
menu.AddDisabledItem(mDiffYoursWithIncomingMenuItemContent);
if (operations.HasFlag(IncomingChangesMenuOperations.DiffIncomingChanges))
menu.AddItem(mDiffIncomingChangesMenuItemContent, false,
DiffIncomingChangesMenuItem_Click);
else
menu.AddDisabledItem(mDiffIncomingChangesMenuItemContent);
}
void AddMetaActions(GenericMenu menu, IncomingChangesMenuOperations operations)
{
if (operations.HasFlag(IncomingChangesMenuOperations.DiffYoursWithIncoming))
menu.AddItem(mDiffMetaYoursWithIncomingMenuItemContent, false,
DiffMetaYoursWithIncomingMenuItem_Click);
else
menu.AddDisabledItem(mDiffMetaYoursWithIncomingMenuItemContent);
if (operations.HasFlag(IncomingChangesMenuOperations.DiffIncomingChanges))
menu.AddItem(mDiffMetaIncomingChangesMenuItemContent, false,
DiffMetaIncomingChangesMenuItem_Click);
else
menu.AddDisabledItem(mDiffMetaIncomingChangesMenuItemContent);
}
GUIContent GetNoActionMenuItemContent()
{
if (mNoActionMenuItemContent == null)
{
mNoActionMenuItemContent = new GUIContent(
PlasticLocalization.GetString(PlasticLocalization.
Name.NoActionMenuItem));
}
return mNoActionMenuItemContent;
}
void BuildComponents()
{
mMergeSelectedFilesMenuItemContent = new GUIContent(
PlasticLocalization.GetString(PlasticLocalization.
Name.MergeSelectedFiles));
mMergeKeepingSourceChangesMenuItemContent = new GUIContent(
UnityMenuItem.EscapedText(
PlasticLocalization.GetString(PlasticLocalization.
Name.IncomingChangesMenuItemMergeKeepingSourceChanges)));
mMergeKeepingWorkspaceChangesMenuItemContent = new GUIContent(
UnityMenuItem.EscapedText(
PlasticLocalization.GetString(PlasticLocalization.
Name.IncomingChangesMenuItemMergeKeepingWorkspaceChanges)));
string diffYoursWithIncomingText = UnityMenuItem.EscapedText(
PlasticLocalization.GetString(PlasticLocalization.
Name.IncomingChangesMenuItemDiffYoursWithIncoming));
string diffIncomingChangesText = UnityMenuItem.EscapedText(
PlasticLocalization.GetString(PlasticLocalization.
Name.IncomingChangesMenuItemDiffIncomingChanges));
mDiffYoursWithIncomingMenuItemContent = new GUIContent(
diffYoursWithIncomingText);
mDiffIncomingChangesMenuItemContent = new GUIContent(
diffIncomingChangesText);
mDiffMetaYoursWithIncomingMenuItemContent = new GUIContent(
string.Format(
"{0}/{1}",
MetaPath.META_EXTENSION,
diffYoursWithIncomingText));
mDiffMetaIncomingChangesMenuItemContent = new GUIContent(
string.Format(
"{0}/{1}",
MetaPath.META_EXTENSION,
diffIncomingChangesText));
}
GUIContent mNoActionMenuItemContent;
GUIContent mMergeSelectedFilesMenuItemContent;
GUIContent mMergeKeepingSourceChangesMenuItemContent;
GUIContent mMergeKeepingWorkspaceChangesMenuItemContent;
GUIContent mDiffYoursWithIncomingMenuItemContent;
GUIContent mDiffIncomingChangesMenuItemContent;
GUIContent mDiffMetaYoursWithIncomingMenuItemContent;
GUIContent mDiffMetaIncomingChangesMenuItemContent;
readonly IIncomingChangesViewMenuOperations mIncomingChangesViewMenuOperations;
readonly IMetaMenuOperations mIncomingChangesMetaMenuOperations;
}
}
using Codice.Client.BaseCommands.Merge;
using PlasticGui.WorkspaceWindow.IncomingChanges;
namespace Unity.PlasticSCM.Editor.Views.IncomingChanges.Developer
{
// internal for testing purpuses
internal static class IsCurrent
{
internal static bool Conflict(
IncomingChangeInfo changeInfo,
IncomingChangeInfo metaChangeInfo,
MergeSolvedFileConflicts solvedFileConflicts)
{
if (solvedFileConflicts == null)
return false;
MergeSolvedFileConflicts.CurrentConflict currentConflict;
if (!solvedFileConflicts.TryGetCurrentConflict(out currentConflict))
return false;
return IsSameConflict(currentConflict, changeInfo) ||
IsSameConflict(currentConflict, metaChangeInfo);
}
static bool IsSameConflict(
MergeSolvedFileConflicts.CurrentConflict currentConflict,
IncomingChangeInfo changeInfo)
{
if (changeInfo == null)
return false;
return currentConflict.MountId.Equals(changeInfo.GetMount().Id) &&
currentConflict.ItemId == changeInfo.GetRevision().ItemId;
}
}
}
using Codice.Client.BaseCommands.Merge;
using PlasticGui.WorkspaceWindow.IncomingChanges;
namespace Unity.PlasticSCM.Editor.Views.IncomingChanges.Developer
{
internal static class IsSolved
{
internal static bool Conflict(
IncomingChangeInfo changeInfo,
IncomingChangeInfo metaChangeInfo,
MergeSolvedFileConflicts solvedFileConflicts)
{
if (IsDirectoryConflict(changeInfo))
{
if (metaChangeInfo == null)
return IsDirectoryConflictResolved(changeInfo);
return IsDirectoryConflictResolved(changeInfo) &&
IsDirectoryConflictResolved(metaChangeInfo);
}
if (metaChangeInfo == null)
{
return IsFileConflictResolved(
changeInfo, solvedFileConflicts);
}
return IsFileConflictResolved(changeInfo, solvedFileConflicts) &&
IsFileConflictResolved(metaChangeInfo, solvedFileConflicts);
}
static bool IsFileConflictResolved(
IncomingChangeInfo changeInfo,
MergeSolvedFileConflicts solvedFileConflicts)
{
if (solvedFileConflicts == null)
return false;
return solvedFileConflicts.IsResolved(
changeInfo.GetMount().Id,
changeInfo.GetRevision().ItemId);
}
static bool IsDirectoryConflictResolved(IncomingChangeInfo changeInfo)
{
return changeInfo.DirectoryConflict.IsResolved();
}
static bool IsDirectoryConflict(IncomingChangeInfo changeInfo)
{
return (changeInfo.DirectoryConflict != null);
}
}
}
using System.Collections.Generic;
using PlasticGui.WorkspaceWindow.IncomingChanges;
namespace Unity.PlasticSCM.Editor.Views.IncomingChanges.Developer
{
internal class UnityIncomingChangesTree
{
internal static UnityIncomingChangesTree BuildIncomingChangeCategories(
IncomingChangesTree tree)
{
return new UnityIncomingChangesTree(tree);
}
UnityIncomingChangesTree(
IncomingChangesTree tree)
{
mInnerTree = tree;
mMetaCache.Build(mInnerTree.GetNodes());
}
internal List<IncomingChangesCategory> GetNodes()
{
return mInnerTree.GetNodes();
}
internal bool HasMeta(IncomingChangeInfo changeInfo)
{
return mMetaCache.ContainsMeta(changeInfo);
}
internal IncomingChangeInfo GetMetaChange(IncomingChangeInfo change)
{
return mMetaCache.GetExistingMeta(change);
}
internal void FillWithMeta(List<IncomingChangeInfo> changes)
{
changes.AddRange(
mMetaCache.GetExistingMeta(changes));
}
internal void Sort(string key, bool isAscending)
{
mInnerTree.Sort(key, isAscending);
}
internal void ResolveUserNames(
IncomingChangesTree.ResolveUserName resolveUserName)
{
mInnerTree.ResolveUserNames(resolveUserName);
}
MetaCache mMetaCache = new MetaCache();
IncomingChangesTree mInnerTree;
class MetaCache
{
internal bool ContainsMeta(IncomingChangeInfo changeInfo)
{
string key = BuildKey.ForMetaChange(changeInfo);
return mCache.ContainsKey(key);
}
internal IncomingChangeInfo GetExistingMeta(IncomingChangeInfo change)
{
IncomingChangeInfo result;
if (!mCache.TryGetValue(BuildKey.ForMetaChange(change), out result))
return null;
return result;
}
internal List<IncomingChangeInfo> GetExistingMeta(
List<IncomingChangeInfo> changes)
{
List<IncomingChangeInfo> result = new List<IncomingChangeInfo>();
foreach (IncomingChangeInfo change in changes)
{
string key = BuildKey.ForMetaChange(change);
IncomingChangeInfo metaChange;
if (!mCache.TryGetValue(key, out metaChange))
continue;
result.Add(metaChange);
}
return result;
}
internal void Build(List<IncomingChangesCategory> incomingChangesCategories)
{
mCache.Clear();
foreach (IncomingChangesCategory category in incomingChangesCategories)
{
ExtractMetaToCache(category, mCache);
}
}
static void ExtractMetaToCache(
IncomingChangesCategory category,
Dictionary<string, IncomingChangeInfo> cache)
{
List<IncomingChangeInfo> changes = category.GetChanges();
HashSet<string> indexedKeys = BuildIndexedKeys(
changes);
for (int i = changes.Count - 1; i >= 0; i--)
{
IncomingChangeInfo currentChange = changes[i];
string path = currentChange.GetPath();
if (!MetaPath.IsMetaPath(path))
continue;
string realPath = MetaPath.GetPathFromMetaPath(path);
if (!indexedKeys.Contains(BuildKey.BuildCacheKey(
currentChange.CategoryType, realPath)))
continue;
// found foo.c and foo.c.meta - move .meta to cache
cache.Add(BuildKey.ForChange(currentChange), currentChange);
changes.RemoveAt(i);
}
}
static HashSet<string> BuildIndexedKeys(
List<IncomingChangeInfo> changes)
{
HashSet<string> result = new HashSet<string>();
foreach (IncomingChangeInfo change in changes)
{
if (MetaPath.IsMetaPath(change.GetPath()))
continue;
result.Add(BuildKey.ForChange(change));
}
return result;
}
Dictionary<string, IncomingChangeInfo> mCache =
new Dictionary<string, IncomingChangeInfo>();
static class BuildKey
{
internal static string ForChange(
IncomingChangeInfo change)
{
return BuildCacheKey(
change.CategoryType,
change.GetPath());
}
internal static string ForMetaChange(
IncomingChangeInfo change)
{
return BuildCacheKey(
change.CategoryType,
MetaPath.GetMetaPath(change.GetPath()));
}
internal static string BuildCacheKey(
IncomingChangesCategory.Type type,
string path)
{
return string.Concat(type, ":", path);
}
}
}
}
}
using UnityEditor.IMGUI.Controls;
using PlasticGui.Gluon.WorkspaceWindow.Views.IncomingChanges;
namespace Unity.PlasticSCM.Editor.Views.IncomingChanges.Gluon
{
internal class ChangeCategoryTreeViewItem : TreeViewItem
{
internal IncomingChangeCategory Category { get; private set; }
internal ChangeCategoryTreeViewItem(int id, IncomingChangeCategory category)
: base(id, 0)
{
Category = category;
}
}
}
\ No newline at end of file
using UnityEditor.IMGUI.Controls;
using PlasticGui.Gluon.WorkspaceWindow.Views.IncomingChanges;
namespace Unity.PlasticSCM.Editor.Views.IncomingChanges.Gluon
{
internal class ChangeTreeViewItem : TreeViewItem
{
internal IncomingChangeInfo ChangeInfo { get; private set; }
internal ChangeTreeViewItem(int id, IncomingChangeInfo change)
: base(id, 1)
{
ChangeInfo = change;
displayName = change.GetPathString();
}
}
}
using UnityEditor.IMGUI.Controls;
using Codice.Client.BaseCommands;
namespace Unity.PlasticSCM.Editor.Views.IncomingChanges.Gluon.Errors
{
internal class ErrorListViewItem : TreeViewItem
{
internal ErrorMessage ErrorMessage { get; private set; }
internal ErrorListViewItem(int id, ErrorMessage errorMessage)
: base(id, 0)
{
ErrorMessage = errorMessage;
displayName = errorMessage.Path;
}
}
}
using System;
using UnityEditor.IMGUI.Controls;
using UnityEngine;
using PlasticGui;
using Unity.PlasticSCM.Editor.UI.Tree;
namespace Unity.PlasticSCM.Editor.Views.IncomingChanges.Gluon.Errors
{
internal enum ErrorsListColumn
{
Path,
Reason
}
[Serializable]
internal class ErrorsListHeaderState : MultiColumnHeaderState, ISerializationCallbackReceiver
{
internal static ErrorsListHeaderState GetDefault()
{
return new ErrorsListHeaderState(BuildColumns());
}
static string GetColumnName(ErrorsListColumn column)
{
switch (column)
{
case ErrorsListColumn.Path:
return PlasticLocalization.GetString(PlasticLocalization.Name.PathColumn);
case ErrorsListColumn.Reason:
return PlasticLocalization.GetString(PlasticLocalization.Name.Reason);
default:
return null;
}
}
void ISerializationCallbackReceiver.OnAfterDeserialize()
{
if (mHeaderTitles != null)
TreeHeaderColumns.SetTitles(columns, mHeaderTitles);
if (mColumsAllowedToggleVisibility != null)
TreeHeaderColumns.SetVisibilities(columns, mColumsAllowedToggleVisibility);
}
void ISerializationCallbackReceiver.OnBeforeSerialize()
{
}
static Column[] BuildColumns()
{
return new Column[]
{
new Column()
{
width = 300,
headerContent = new GUIContent(
GetColumnName(ErrorsListColumn.Path)),
minWidth = 200,
allowToggleVisibility = false,
canSort = false
},
new Column()
{
width = 600,
headerContent = new GUIContent(
GetColumnName(ErrorsListColumn.Reason)),
minWidth = 200,
canSort = false
}
};
}
ErrorsListHeaderState(Column[] columns)
: base(columns)
{
if (mHeaderTitles == null)
mHeaderTitles = TreeHeaderColumns.GetTitles(columns);
if (mColumsAllowedToggleVisibility == null)
mColumsAllowedToggleVisibility = TreeHeaderColumns.GetVisibilities(columns);
}
[SerializeField]
string[] mHeaderTitles;
[SerializeField]
bool[] mColumsAllowedToggleVisibility;
}
}
using System.Collections.Generic;
using UnityEngine;
using UnityEditor.IMGUI.Controls;
using Codice.Client.BaseCommands;
using Unity.PlasticSCM.Editor.UI;
using Unity.PlasticSCM.Editor.UI.Tree;
namespace Unity.PlasticSCM.Editor.Views.IncomingChanges.Gluon.Errors
{
internal class ErrorsListView : TreeView
{
internal ErrorsListView(ErrorsListHeaderState headerState)
: base(new TreeViewState())
{
multiColumnHeader = new MultiColumnHeader(headerState);
multiColumnHeader.canSort = false;
rowHeight = UnityConstants.TREEVIEW_ROW_HEIGHT;
showAlternatingRowBackgrounds = true;
}
public override IList<TreeViewItem> GetRows()
{
return mRows;
}
protected override TreeViewItem BuildRoot()
{
return new TreeViewItem(0, -1, string.Empty);
}
protected override IList<TreeViewItem> BuildRows(TreeViewItem rootItem)
{
RegenerateRows(
this, mErrorMessages, rootItem, mRows);
return mRows;
}
protected override void RowGUI(RowGUIArgs args)
{
if (args.item is ErrorListViewItem)
{
ErrorListViewItemGUI((ErrorListViewItem)args.item, args);
return;
}
base.RowGUI(args);
}
internal void BuildModel(List<ErrorMessage> errorMessages)
{
mErrorMessages = errorMessages;
}
internal ErrorMessage GetSelectedError()
{
List<ErrorMessage> selectedErrors = GetSelectedErrors(this);
if (selectedErrors.Count != 1)
return null;
return selectedErrors[0];
}
static List<ErrorMessage> GetSelectedErrors(
ErrorsListView listView)
{
List<ErrorMessage> result = new List<ErrorMessage>();
IList<int> selectedIds = listView.GetSelection();
if (selectedIds.Count == 0)
return result;
foreach (ErrorListViewItem treeViewItem in
listView.FindRows(selectedIds))
{
result.Add(treeViewItem.ErrorMessage);
}
return result;
}
static void RegenerateRows(
ErrorsListView listView,
List<ErrorMessage> errorMessages,
TreeViewItem rootItem,
List<TreeViewItem> rows)
{
ClearRows(rootItem, rows);
if (errorMessages.Count == 0)
return;
for (int i = 0; i < errorMessages.Count; i++)
{
ErrorListViewItem errorListViewItem =
new ErrorListViewItem(i + 1, errorMessages[i]);
rootItem.AddChild(errorListViewItem);
rows.Add(errorListViewItem);
}
listView.SetSelection(new List<int> { 1 });
}
static void ClearRows(
TreeViewItem rootItem,
List<TreeViewItem> rows)
{
if (rootItem.hasChildren)
rootItem.children.Clear();
rows.Clear();
}
static void ErrorListViewItemGUI(
ErrorListViewItem item,
RowGUIArgs args)
{
for (int visibleColumnIdx = 0; visibleColumnIdx < args.GetNumVisibleColumns(); visibleColumnIdx++)
{
Rect cellRect = args.GetCellRect(visibleColumnIdx);
ErrorsListColumn column =
(ErrorsListColumn)args.GetColumn(visibleColumnIdx);
ErrorListViewItemCellGUI(
cellRect, item, column, args.selected, args.focused);
}
}
static void ErrorListViewItemCellGUI(
Rect rect,
ErrorListViewItem item,
ErrorsListColumn column,
bool isSelected,
bool isFocused)
{
ErrorMessage errorMessage = item.ErrorMessage;
string label = column == ErrorsListColumn.Path ?
errorMessage.Path : errorMessage.Error;
if (column == ErrorsListColumn.Path)
{
DrawTreeViewItem.ForLabel(
rect, label, isSelected, isFocused, false);
return;
}
DrawTreeViewItem.ForSecondaryLabel(
rect, label, isSelected, isFocused, false);
}
List<TreeViewItem> mRows = new List<TreeViewItem>();
List<ErrorMessage> mErrorMessages = new List<ErrorMessage>();
}
}
using System.Collections.Generic;
using PlasticGui.Gluon.WorkspaceWindow.Views.IncomingChanges;
namespace Unity.PlasticSCM.Editor.Views.IncomingChanges.Gluon
{
internal static class IncomingChangesSelection
{
internal static SelectedIncomingChangesGroupInfo GetSelectedGroupInfo(
IncomingChangesTreeView treeView)
{
List<IncomingChangeInfo> selectedIncomingChanges =
treeView.GetSelectedIncomingChanges();
return GetSelectedIncomingChangesGroupInfo.For(
selectedIncomingChanges);
}
internal static List<IncomingChangeInfo> GetSelectedFileConflictsIncludingMeta(
IncomingChangesTreeView treeView)
{
List<IncomingChangeInfo> result = treeView.GetSelectedFileConflicts();
treeView.FillWithMeta(result);
return result;
}
internal static IncomingChangeInfo GetSingleSelectedIncomingChange(
IncomingChangesTreeView treeView)
{
return treeView.GetSelectedIncomingChange();
}
}
}
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using Codice.Client.BaseCommands;
using Codice.Client.Commands;
using Codice.Client.Common.FsNodeReaders;
using Codice.CM.Common;
using GluonGui;
using PlasticGui;
using PlasticGui.Gluon.WorkspaceWindow;
using PlasticGui.Gluon.WorkspaceWindow.Views.IncomingChanges;
using PlasticGui.WorkspaceWindow.Diff;
using Unity.PlasticSCM.Editor.AssetUtils;
using Unity.PlasticSCM.Editor.UI;
using Unity.PlasticSCM.Editor.UI.Progress;
using Unity.PlasticSCM.Editor.UI.Tree;
using Unity.PlasticSCM.Editor.Views.IncomingChanges.Gluon.Errors;
namespace Unity.PlasticSCM.Editor.Views.IncomingChanges.Gluon
{
internal class IncomingChangesTab :
IIncomingChangesTab,
IRefreshableView,
IncomingChangesViewLogic.IIncomingChangesView,
IIncomingChangesViewMenuOperations,
IncomingChangesViewMenu.IMetaMenuOperations
{
internal IncomingChangesTab(
WorkspaceInfo wkInfo,
ViewHost viewHost,
PlasticGUIClient plasticClient,
NewIncomingChangesUpdater newIncomingChangesUpdater,
CheckIncomingChanges.IUpdateIncomingChanges updateIncomingChanges,
EditorWindow parentWindow)
{
mWkInfo = wkInfo;
mPlasticClient = plasticClient;
mNewIncomingChangesUpdater = newIncomingChangesUpdater;
mParentWindow = parentWindow;
BuildComponents();
mProgressControls = new ProgressControlsForViews();
mErrorsSplitterState = PlasticSplitterGUILayout.InitSplitterState(
new float[] { 0.75f, 0.25f },
new int[] { 100, 100 },
new int[] { 100000, 100000 }
);
mErrorDetailsSplitterState = PlasticSplitterGUILayout.InitSplitterState(
new float[] { 0.60f, 0.40f },
new int[] { 100, 100 },
new int[] { 100000, 100000 }
);
mIncomingChangesViewLogic = new IncomingChangesViewLogic(
wkInfo, viewHost, this, new UnityPlasticGuiMessage(parentWindow),
mProgressControls, updateIncomingChanges,
plasticClient.GluonProgressOperationHandler, plasticClient,
new IncomingChangesViewLogic.ApplyWorkspaceLocalChanges(),
new IncomingChangesViewLogic.OutOfDateItemsOperations(),
new IncomingChangesViewLogic.ResolveUserName(),
new IncomingChangesViewLogic.GetWorkingBranch(),
NewChangesInWk.Build(wkInfo, new BuildWorkspacekIsRelevantNewChange()),
null);
mIncomingChangesViewLogic.Refresh();
}
bool IIncomingChangesTab.IsVisible
{
get { return mIsVisible; }
set { mIsVisible = value ; }
}
void IIncomingChangesTab.OnDisable()
{
TreeHeaderSettings.Save(
mIncomingChangesTreeView.multiColumnHeader.state,
UnityConstants.GLUON_INCOMING_CHANGES_TABLE_SETTINGS_NAME);
TreeHeaderSettings.Save(
mErrorsListView.multiColumnHeader.state,
UnityConstants.GLUON_INCOMING_ERRORS_TABLE_SETTINGS_NAME);
}
void IIncomingChangesTab.Update()
{
mProgressControls.UpdateProgress(mParentWindow);
}
void IIncomingChangesTab.OnGUI()
{
DoActionsToolbar(
mIsProcessMergesButtonVisible,
mIsCancelMergesButtonVisible,
mIsProcessMergesButtonEnabled,
mIsCancelMergesButtonEnabled,
mProcessMergesButtonText,
mIncomingChangesViewLogic,
mIncomingChangesTreeView,
mProgressControls);
bool splitterNeeded = mIsErrorsListVisible;
if (splitterNeeded)
PlasticSplitterGUILayout.BeginVerticalSplit(mErrorsSplitterState);
DoIncomingChangesArea(
mPlasticClient,
mIncomingChangesTreeView,
mPendingConflictsLabelData,
mChangesToApplySummaryLabelText,
mMessageLabelText,
mIsMessageLabelVisible,
mProgressControls.IsOperationRunning());
DoErrorsArea(
mErrorsListView,
mErrorDetailsSplitterState,
mErrorMessageLabelText,
mIsErrorsListVisible,
mIsErrorMessageLabelVisible);
if (splitterNeeded)
PlasticSplitterGUILayout.EndVerticalSplit();
if (mProgressControls.HasNotification())
{
DrawProgressForViews.ForNotificationArea(
mProgressControls.ProgressData);
}
}
void IIncomingChangesTab.AutoRefresh()
{
mIncomingChangesViewLogic.AutoRefresh(DateTime.Now);
}
void IRefreshableView.Refresh()
{
if (mNewIncomingChangesUpdater != null)
mNewIncomingChangesUpdater.Update(DateTime.Now);
mIncomingChangesViewLogic.Refresh();
}
void IncomingChangesViewLogic.IIncomingChangesView.UpdateData(
IncomingChangesTree tree,
List<ErrorMessage> errorMessages,
string processMergesButtonText,
PendingConflictsLabelData conflictsLabelData,
string changesToApplySummaryText)
{
ShowProcessMergesButton(processMergesButtonText);
((IncomingChangesViewLogic.IIncomingChangesView)this).
UpdatePendingConflictsLabel(conflictsLabelData);
mChangesToApplySummaryLabelText = changesToApplySummaryText;
UpdateIncomingChangesTree(mIncomingChangesTreeView, tree);
UpdateErrorsList(mErrorsListView, errorMessages);
mIsErrorsListVisible = errorMessages.Count > 0;
}
void IncomingChangesViewLogic.IIncomingChangesView.UpdatePendingConflictsLabel(
PendingConflictsLabelData data)
{
mPendingConflictsLabelData = data;
}
void IncomingChangesViewLogic.IIncomingChangesView.UpdateSolvedFileConflicts(
List<IncomingChangeInfo> solvedConflicts,
IncomingChangeInfo currentConflict)
{
mIncomingChangesTreeView.UpdateSolvedFileConflicts(
solvedConflicts, currentConflict);
}
void IncomingChangesViewLogic.IIncomingChangesView.ShowMessage(
string message, bool isErrorMessage)
{
if (isErrorMessage)
{
mErrorMessageLabelText = message;
mIsErrorMessageLabelVisible = true;
return;
}
mMessageLabelText = message;
mIsMessageLabelVisible = true;
}
void IncomingChangesViewLogic.IIncomingChangesView.HideMessage()
{
mMessageLabelText = string.Empty;
mIsMessageLabelVisible = false;
mErrorMessageLabelText = string.Empty;
mIsErrorMessageLabelVisible = false;
}
void IncomingChangesViewLogic.IIncomingChangesView.DisableProcessMergesButton()
{
mIsProcessMergesButtonEnabled = false;
}
void IncomingChangesViewLogic.IIncomingChangesView.ShowCancelButton()
{
mIsCancelMergesButtonEnabled = true;
mIsCancelMergesButtonVisible = true;
}
void IncomingChangesViewLogic.IIncomingChangesView.HideCancelButton()
{
mIsCancelMergesButtonEnabled = false;
mIsCancelMergesButtonVisible = false;
}
SelectedIncomingChangesGroupInfo IIncomingChangesViewMenuOperations.GetSelectedIncomingChangesGroupInfo()
{
return IncomingChangesSelection.GetSelectedGroupInfo(mIncomingChangesTreeView);
}
void IIncomingChangesViewMenuOperations.MergeContributors()
{
List<IncomingChangeInfo> fileConflicts = IncomingChangesSelection.
GetSelectedFileConflictsIncludingMeta(mIncomingChangesTreeView);
mIncomingChangesViewLogic.ProcessMergesForConflicts(
MergeContributorType.MergeContributors,
fileConflicts,
RefreshAsset.UnityAssetDatabase);
}
void IIncomingChangesViewMenuOperations.MergeKeepingSourceChanges()
{
List<IncomingChangeInfo> fileConflicts = IncomingChangesSelection.
GetSelectedFileConflictsIncludingMeta(mIncomingChangesTreeView);
mIncomingChangesViewLogic.ProcessMergesForConflicts(
MergeContributorType.KeepSource,
fileConflicts,
RefreshAsset.UnityAssetDatabase);
}
void IIncomingChangesViewMenuOperations.MergeKeepingWorkspaceChanges()
{
List<IncomingChangeInfo> fileConflicts = IncomingChangesSelection.
GetSelectedFileConflictsIncludingMeta(mIncomingChangesTreeView);
mIncomingChangesViewLogic.ProcessMergesForConflicts(
MergeContributorType.KeepDestination,
fileConflicts,
RefreshAsset.UnityAssetDatabase);
}
void IIncomingChangesViewMenuOperations.DiffIncomingChanges()
{
IncomingChangeInfo incomingChange = IncomingChangesSelection.
GetSingleSelectedIncomingChange(mIncomingChangesTreeView);
if (incomingChange == null)
return;
DiffIncomingChanges(
incomingChange,
mWkInfo);
}
void IIncomingChangesViewMenuOperations.DiffYoursWithIncoming()
{
IncomingChangeInfo incomingChange = IncomingChangesSelection.
GetSingleSelectedIncomingChange(mIncomingChangesTreeView);
if (incomingChange == null)
return;
DiffYoursWithIncoming(
incomingChange,
mWkInfo);
}
void IncomingChangesViewMenu.IMetaMenuOperations.DiffIncomingChanges()
{
IncomingChangeInfo incomingChange = IncomingChangesSelection.
GetSingleSelectedIncomingChange(mIncomingChangesTreeView);
if (incomingChange == null)
return;
DiffIncomingChanges(
mIncomingChangesTreeView.GetMetaChange(incomingChange),
mWkInfo);
}
void IncomingChangesViewMenu.IMetaMenuOperations.DiffYoursWithIncoming()
{
IncomingChangeInfo incomingChange = IncomingChangesSelection.
GetSingleSelectedIncomingChange(mIncomingChangesTreeView);
if (incomingChange == null)
return;
DiffYoursWithIncoming(
mIncomingChangesTreeView.GetMetaChange(incomingChange),
mWkInfo);
}
bool IncomingChangesViewMenu.IMetaMenuOperations.SelectionHasMeta()
{
return mIncomingChangesTreeView.SelectionHasMeta();
}
static void DiffIncomingChanges(
IncomingChangeInfo incomingChange,
WorkspaceInfo wkInfo)
{
DiffOperation.DiffRevisions(
wkInfo,
incomingChange.GetMount().RepSpec,
incomingChange.GetBaseRevision(),
incomingChange.GetRevision(),
incomingChange.GetPath(),
incomingChange.GetPath(),
true,
xDiffLauncher: null,
imageDiffLauncher: null);
}
static void DiffYoursWithIncoming(
IncomingChangeInfo incomingChange,
WorkspaceInfo wkInfo)
{
DiffOperation.DiffYoursWithIncoming(
wkInfo,
incomingChange.GetMount(),
incomingChange.GetRevision(),
incomingChange.GetPath(),
xDiffLauncher: null,
imageDiffLauncher: null);
}
static void UpdateErrorsList(
ErrorsListView errorsListView,
List<ErrorMessage> errorMessages)
{
errorsListView.BuildModel(errorMessages);
errorsListView.Reload();
}
void UpdateProcessMergesButtonText()
{
mProcessMergesButtonText =
mIncomingChangesViewLogic.GetProcessMergesButtonText();
}
void ShowProcessMergesButton(string processMergesButtonText)
{
mProcessMergesButtonText = processMergesButtonText;
mIsProcessMergesButtonEnabled = true;
mIsProcessMergesButtonVisible = true;
}
void DoActionsToolbar(
bool isProcessMergesButtonVisible,
bool isCancelMergesButtonVisible,
bool isProcessMergesButtonEnabled,
bool isCancelMergesButtonEnabled,
string processMergesButtonText,
IncomingChangesViewLogic incomingChangesViewLogic,
IncomingChangesTreeView incomingChangesTreeView,
ProgressControlsForViews progressControls)
{
EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
if (isProcessMergesButtonVisible)
{
DoProcessMergesButton(
isProcessMergesButtonEnabled,
processMergesButtonText,
incomingChangesViewLogic,
incomingChangesTreeView);
}
if (isCancelMergesButtonVisible)
{
DoCancelMergesButton(
isCancelMergesButtonEnabled,
incomingChangesViewLogic);
}
if (progressControls.IsOperationRunning())
{
DrawProgressForViews.ForIndeterminateProgress(
progressControls.ProgressData);
}
GUILayout.FlexibleSpace();
DoRefreshButton(
!progressControls.IsOperationRunning(),
incomingChangesViewLogic);
EditorGUILayout.EndHorizontal();
}
static void DoIncomingChangesArea(
PlasticGUIClient plasticClient,
IncomingChangesTreeView incomingChangesTreeView,
PendingConflictsLabelData pendingConflictsLabelData,
string changesToApplySummaryLabelText,
string messageLabelText,
bool isMessageLabelVisible,
bool isOperationRunning)
{
EditorGUILayout.BeginVertical();
DoPendingConflictsAndChangesToApplyLabel(
pendingConflictsLabelData,
changesToApplySummaryLabelText);
DoIncomingChangesTreeViewArea(
incomingChangesTreeView,
isOperationRunning);
if (isMessageLabelVisible)
DoInfoMessageArea(messageLabelText);
EditorGUILayout.EndVertical();
}
static void DoProcessMergesButton(
bool isEnabled,
string processMergesButtonText,
IncomingChangesViewLogic incomingChangesViewLogic,
IncomingChangesTreeView incomingChangesTreeView)
{
GUI.enabled = isEnabled;
if (DrawActionButton.For(processMergesButtonText))
{
List<IncomingChangeInfo> incomingChanges =
incomingChangesViewLogic.GetCheckedChanges();
incomingChangesTreeView.FillWithMeta(incomingChanges);
if (incomingChanges.Count == 0)
return;
incomingChangesViewLogic.ProcessMergesForItems(
incomingChanges,
RefreshAsset.UnityAssetDatabase);
}
GUI.enabled = true;
}
void DoCancelMergesButton(
bool isEnabled,
IncomingChangesViewLogic incomingChangesViewLogic)
{
GUI.enabled = isEnabled;
if (DrawActionButton.For(PlasticLocalization.GetString(
PlasticLocalization.Name.CancelButton)))
{
incomingChangesViewLogic.Cancel();
mIsCancelMergesButtonEnabled = false;
}
GUI.enabled = true;
}
void DoErrorsArea(
ErrorsListView errorsListView,
object splitterState,
string errorMessageLabelText,
bool isErrorsListVisible,
bool isErrorMessageLabelVisible)
{
EditorGUILayout.BeginVertical();
if (isErrorsListVisible)
{
DrawSplitter.ForHorizontalIndicator();
DoErrorsListArea(errorsListView, splitterState);
}
if (isErrorMessageLabelVisible)
DoErrorMessageArea(errorMessageLabelText);
EditorGUILayout.EndVertical();
}
static void DoPendingConflictsAndChangesToApplyLabel(
PendingConflictsLabelData pendingConflictsLabelData,
string changesToApplySummaryLabelText)
{
EditorGUILayout.BeginHorizontal();
GUIStyle pendingConflictsOfTotalStyle =
pendingConflictsLabelData.HasPendingConflicts ?
UnityStyles.IncomingChangesTab.RedPendingConflictsOfTotalLabel :
UnityStyles.IncomingChangesTab.GreenPendingConflictsOfTotalLabel;
GUILayout.Label(
pendingConflictsLabelData.PendingConflictsOfTotalText,
pendingConflictsOfTotalStyle);
GUILayout.Label(
pendingConflictsLabelData.PendingConflictsLabelText,
UnityStyles.IncomingChangesTab.PendingConflictsLabel);
GUILayout.Space(5);
GUILayout.Label(
changesToApplySummaryLabelText,
UnityStyles.IncomingChangesTab.ChangesToApplySummaryLabel);
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
}
static void UpdateIncomingChangesTree(
IncomingChangesTreeView incomingChangesTreeView,
IncomingChangesTree tree)
{
incomingChangesTreeView.BuildModel(
UnityIncomingChangesTree.BuildIncomingChangeCategories(tree));
incomingChangesTreeView.Sort();
incomingChangesTreeView.Reload();
}
static void DoIncomingChangesTreeViewArea(
IncomingChangesTreeView incomingChangesTreeView,
bool isOperationRunning)
{
GUI.enabled = !isOperationRunning;
Rect rect = GUILayoutUtility.GetRect(0, 100000, 0, 100000);
incomingChangesTreeView.OnGUI(rect);
GUI.enabled = true;
}
void DoErrorsListArea(
ErrorsListView errorsListView,
object splitterState)
{
EditorGUILayout.BeginVertical();
GUILayout.Label(
PlasticLocalization.GetString(
PlasticLocalization.Name.IncomingChangesCannotBeApplied),
EditorStyles.boldLabel);
DoErrorsListSplitViewArea(
errorsListView, splitterState);
EditorGUILayout.EndVertical();
}
static void DoErrorMessageArea(string message)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.HelpBox(message, MessageType.Error);
EditorGUILayout.EndHorizontal();
}
void DoErrorsListSplitViewArea(
ErrorsListView errorsListView,
object splitterState)
{
EditorGUILayout.BeginHorizontal();
PlasticSplitterGUILayout.BeginHorizontalSplit(splitterState);
DoErrorsListViewArea(errorsListView);
DoErrorDetailsTextArea(errorsListView.GetSelectedError());
PlasticSplitterGUILayout.EndHorizontalSplit();
EditorGUILayout.EndHorizontal();
}
static void DoErrorsListViewArea(
ErrorsListView errorsListView)
{
Rect treeRect = GUILayoutUtility.GetRect(0, 100000, 0, 100000);
errorsListView.OnGUI(treeRect);
}
void DoErrorDetailsTextArea(ErrorMessage selectedErrorMessage)
{
string errorDetailsText = selectedErrorMessage == null ?
string.Empty : selectedErrorMessage.Error;
mErrorDetailsScrollPosition = GUILayout.BeginScrollView(
mErrorDetailsScrollPosition);
GUILayout.TextArea(
errorDetailsText, UnityStyles.TextFieldWithWrapping,
GUILayout.ExpandHeight(true));
GUILayout.EndScrollView();
}
static void DoRefreshButton(
bool isEnabled,
IncomingChangesViewLogic incomingChangesViewLogic)
{
GUI.enabled = isEnabled;
if (GUILayout.Button(new GUIContent(
Images.GetRefreshIcon()), EditorStyles.toolbarButton))
incomingChangesViewLogic.Refresh();
GUI.enabled = true;
}
static void DoInfoMessageArea(string message)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.HelpBox(message, MessageType.Info);
EditorGUILayout.EndHorizontal();
}
void BuildComponents()
{
IncomingChangesTreeHeaderState incomingChangesHeaderState =
IncomingChangesTreeHeaderState.GetDefault();
TreeHeaderSettings.Load(incomingChangesHeaderState,
UnityConstants.GLUON_INCOMING_CHANGES_TABLE_SETTINGS_NAME,
(int)IncomingChangesTreeColumn.Path, true);
mIncomingChangesTreeView = new IncomingChangesTreeView(
mWkInfo, incomingChangesHeaderState,
IncomingChangesTreeHeaderState.GetColumnNames(),
new IncomingChangesViewMenu(this, this),
UpdateProcessMergesButtonText);
mIncomingChangesTreeView.Reload();
ErrorsListHeaderState errorsListHeaderState =
ErrorsListHeaderState.GetDefault();
TreeHeaderSettings.Load(errorsListHeaderState,
UnityConstants.GLUON_INCOMING_ERRORS_TABLE_SETTINGS_NAME,
UnityConstants.UNSORT_COLUMN_ID);
mErrorsListView = new ErrorsListView(errorsListHeaderState);
mErrorsListView.Reload();
}
bool mIsVisible;
bool mIsProcessMergesButtonVisible;
bool mIsCancelMergesButtonVisible;
bool mIsMessageLabelVisible;
bool mIsErrorMessageLabelVisible;
bool mIsErrorsListVisible;
bool mIsProcessMergesButtonEnabled;
bool mIsCancelMergesButtonEnabled;
string mProcessMergesButtonText;
string mMessageLabelText;
string mErrorMessageLabelText;
PendingConflictsLabelData mPendingConflictsLabelData;
string mChangesToApplySummaryLabelText;
IncomingChangesTreeView mIncomingChangesTreeView;
ErrorsListView mErrorsListView;
object mErrorsSplitterState;
object mErrorDetailsSplitterState;
readonly ProgressControlsForViews mProgressControls;
Vector2 mErrorDetailsScrollPosition;
readonly IncomingChangesViewLogic mIncomingChangesViewLogic;
readonly EditorWindow mParentWindow;
readonly NewIncomingChangesUpdater mNewIncomingChangesUpdater;
readonly PlasticGUIClient mPlasticClient;
readonly WorkspaceInfo mWkInfo;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment