test
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
using System;
|
||||
|
||||
using Codice.Client.BaseCommands;
|
||||
using Codice.Client.BaseCommands.CheckIn.Progress;
|
||||
using Codice.Client.Commands.CheckIn;
|
||||
using Codice.CM.Common;
|
||||
using PlasticGui;
|
||||
using PlasticGui.WorkspaceWindow;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Developer
|
||||
{
|
||||
internal class CheckinProgress
|
||||
{
|
||||
internal bool CancelPressed;
|
||||
|
||||
internal CheckinProgress(WorkspaceInfo wkInfo, WorkspaceWindow workspaceWindow)
|
||||
{
|
||||
mWkInfo = wkInfo;
|
||||
mWorkspaceWindow = workspaceWindow;
|
||||
|
||||
mWorkspaceWindow.Progress.CanCancelProgress = true;
|
||||
|
||||
mProgressRender = new CheckinUploadProgressRender(
|
||||
PlasticLocalization.GetString(
|
||||
PlasticLocalization.Name.CheckinProgressMultiThreadUploading),
|
||||
PlasticLocalization.GetString(
|
||||
PlasticLocalization.Name.CheckinProgressMultiThreadNumOfBlocks),
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.CheckinProgressUploadingFiles),
|
||||
PlasticLocalization.GetString(
|
||||
PlasticLocalization.Name.CheckinProgressUploadingFileData),
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.CheckinProgressOf),
|
||||
PlasticLocalization.GetString(
|
||||
PlasticLocalization.Name.RemainingProgressMessage));
|
||||
}
|
||||
|
||||
internal void Refresh(
|
||||
CheckinStatus checkinStatus,
|
||||
BuildProgressSpeedAndRemainingTime.ProgressData progressData)
|
||||
{
|
||||
if (checkinStatus == null)
|
||||
return;
|
||||
|
||||
var progress = mWorkspaceWindow.Progress;
|
||||
|
||||
progress.ProgressHeader = checkinStatus.StatusString;
|
||||
|
||||
if (checkinStatus.Status >= EnumCheckinStatus.eciConfirming)
|
||||
progress.CanCancelProgress = false;
|
||||
|
||||
if (checkinStatus.Status == EnumCheckinStatus.eciCancelling)
|
||||
return;
|
||||
|
||||
int nowTicks = Environment.TickCount;
|
||||
|
||||
progress.TotalProgressMessage = mProgressRender.GetUploadSize(
|
||||
checkinStatus.TransferredSize, checkinStatus.TotalSize, progressData);
|
||||
|
||||
progress.TotalProgressPercent = GetProgressBarPercent.ForTransfer(
|
||||
checkinStatus.TransferredSize, checkinStatus.TotalSize) / 100f;
|
||||
|
||||
progress.ShowCurrentBlock = mProgressRender.
|
||||
NeedShowCurrentBlockForCheckinStatus(checkinStatus, nowTicks);
|
||||
|
||||
string currentFileInfo = mProgressRender.GetCurrentFileInfo(
|
||||
checkinStatus.CurrentCheckinBlock, mWkInfo.ClientPath);
|
||||
|
||||
progress.ProgressHeader = currentFileInfo;
|
||||
|
||||
float fileProgressBarValue = GetProgressBarPercent.ForTransfer(
|
||||
checkinStatus.CurrentCheckinBlock.UploadedSize,
|
||||
checkinStatus.CurrentCheckinBlock.BlockSize) / 100f;
|
||||
|
||||
progress.CurrentBlockProgressPercent = fileProgressBarValue;
|
||||
|
||||
progress.CurrentBlockProgressMessage = mProgressRender.GetCurrentBlockUploadSize(
|
||||
checkinStatus.CurrentCheckinBlock, nowTicks);
|
||||
}
|
||||
|
||||
CheckinUploadProgressRender mProgressRender;
|
||||
WorkspaceWindow mWorkspaceWindow;
|
||||
WorkspaceInfo mWkInfo;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a0528634c1324f47b7e2e59266dfa4c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,24 @@
|
||||
using PlasticGui.WorkspaceWindow;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Developer
|
||||
{
|
||||
internal class GenericProgress
|
||||
{
|
||||
internal GenericProgress(WorkspaceWindow workspaceWindow)
|
||||
{
|
||||
mWorkspaceWindow = workspaceWindow;
|
||||
mWorkspaceWindow.Progress.CanCancelProgress = false;
|
||||
}
|
||||
|
||||
internal void RefreshProgress(ProgressData progressData)
|
||||
{
|
||||
var progress = mWorkspaceWindow.Progress;
|
||||
|
||||
progress.ProgressHeader = progressData.Status;
|
||||
progress.TotalProgressMessage = progressData.Details;
|
||||
progress.TotalProgressPercent = progressData.ProgressValue / 100f;
|
||||
}
|
||||
|
||||
WorkspaceWindow mWorkspaceWindow;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc0cbec450c3bd54eb12276dcfdc27d3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,89 @@
|
||||
using PlasticGui.WorkspaceWindow;
|
||||
using Unity.PlasticSCM.Editor.UI.StatusBar;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Developer
|
||||
{
|
||||
internal class IncomingChangesNotifier :
|
||||
IIncomingChangesNotifier,
|
||||
CheckIncomingChanges.IUpdateIncomingChanges
|
||||
{
|
||||
bool IIncomingChangesNotifier.HasNotification
|
||||
{
|
||||
get { return mHasNotification; }
|
||||
}
|
||||
|
||||
IncomingChangesNotification IIncomingChangesNotifier.Notification
|
||||
{
|
||||
get { return mNotification; }
|
||||
}
|
||||
|
||||
internal IncomingChangesNotifier(
|
||||
PlasticWindow plasticWindow)
|
||||
{
|
||||
mPlasticWindow = plasticWindow;
|
||||
}
|
||||
|
||||
void CheckIncomingChanges.IUpdateIncomingChanges.Hide()
|
||||
{
|
||||
PlasticPlugin.SetNotificationStatus(
|
||||
mPlasticWindow,
|
||||
PlasticNotification.Status.None);
|
||||
|
||||
mNotification.Clear();
|
||||
|
||||
mHasNotification = false;
|
||||
|
||||
mPlasticWindow.Repaint();
|
||||
}
|
||||
|
||||
void CheckIncomingChanges.IUpdateIncomingChanges.Show(
|
||||
string infoText,
|
||||
string actionText,
|
||||
string tooltipText,
|
||||
CheckIncomingChanges.Severity severity,
|
||||
CheckIncomingChanges.Action action)
|
||||
{
|
||||
PlasticNotification.Status status = PlasticNotification.Status.None;
|
||||
if (severity == CheckIncomingChanges.Severity.Info)
|
||||
status = PlasticNotification.Status.IncomingChanges;
|
||||
else if (severity == CheckIncomingChanges.Severity.Warning)
|
||||
status = PlasticNotification.Status.Conflicts;
|
||||
|
||||
PlasticPlugin.SetNotificationStatus(
|
||||
mPlasticWindow,
|
||||
status);
|
||||
|
||||
UpdateData(
|
||||
mNotification,
|
||||
infoText,
|
||||
actionText,
|
||||
tooltipText,
|
||||
status,
|
||||
action);
|
||||
|
||||
mHasNotification = true;
|
||||
|
||||
mPlasticWindow.Repaint();
|
||||
}
|
||||
|
||||
static void UpdateData(
|
||||
IncomingChangesNotification data,
|
||||
string infoText,
|
||||
string actionText,
|
||||
string tooltipText,
|
||||
PlasticNotification.Status status,
|
||||
CheckIncomingChanges.Action action)
|
||||
{
|
||||
data.InfoText = infoText;
|
||||
data.ActionText = actionText;
|
||||
data.TooltipText = tooltipText;
|
||||
data.HasUpdateAction = action == CheckIncomingChanges.Action.Update;
|
||||
data.Status = status;
|
||||
}
|
||||
|
||||
bool mHasNotification;
|
||||
IncomingChangesNotification mNotification = new IncomingChangesNotification();
|
||||
|
||||
PlasticWindow mPlasticWindow;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cc9b578c680471e41965738c85cbabbf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,123 @@
|
||||
using Codice.Client.BaseCommands;
|
||||
using Codice.Client.Commands.CheckIn;
|
||||
using Codice.Client.Common;
|
||||
using Codice.CM.Common;
|
||||
using PlasticGui;
|
||||
using PlasticGui.WorkspaceWindow;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Developer
|
||||
{
|
||||
internal class ProgressOperationHandler
|
||||
{
|
||||
internal ProgressOperationHandler(WorkspaceInfo wkInfo, WorkspaceWindow workspaceWindow)
|
||||
{
|
||||
mWkInfo = wkInfo;
|
||||
mWorkspaceWindow = workspaceWindow;
|
||||
}
|
||||
|
||||
internal void Update(double elapsedSeconds)
|
||||
{
|
||||
if (mUpdateProgress == null)
|
||||
return;
|
||||
|
||||
mSecondsSinceLastProgressUpdate += elapsedSeconds;
|
||||
if (mSecondsSinceLastProgressUpdate > UPDATE_INTERVAL_SECONDS)
|
||||
{
|
||||
mUpdateProgress.OnUpdateProgress();
|
||||
mSecondsSinceLastProgressUpdate -= UPDATE_INTERVAL_SECONDS;
|
||||
}
|
||||
}
|
||||
|
||||
internal bool CheckOperationInProgress()
|
||||
{
|
||||
if (IsOperationInProgress())
|
||||
{
|
||||
GuiMessage.ShowInformation(
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.OperationRunning),
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.OperationInProgress));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
internal bool IsOperationInProgress()
|
||||
{
|
||||
return mProgress != null
|
||||
|| mUpdateProgress != null
|
||||
|| mCheckinProgress != null;
|
||||
}
|
||||
|
||||
internal void ShowProgress()
|
||||
{
|
||||
mProgress = new GenericProgress(mWorkspaceWindow);
|
||||
}
|
||||
|
||||
internal void RefreshProgress(ProgressData progressData)
|
||||
{
|
||||
mProgress.RefreshProgress(progressData);
|
||||
}
|
||||
|
||||
internal void EndProgress()
|
||||
{
|
||||
mProgress = null;
|
||||
mWorkspaceWindow.Progress.ResetProgress();
|
||||
mWorkspaceWindow.RequestRepaint();
|
||||
}
|
||||
|
||||
internal void ShowUpdateProgress(string title, UpdateNotifier notifier)
|
||||
{
|
||||
mUpdateProgress = new UpdateProgress(
|
||||
notifier, mWkInfo.ClientPath, title, mWorkspaceWindow);
|
||||
mUpdateProgress.OnUpdateProgress();
|
||||
mSecondsSinceLastProgressUpdate = 0;
|
||||
}
|
||||
|
||||
internal void ShowCheckinProgress()
|
||||
{
|
||||
mCheckinProgress = new CheckinProgress(mWkInfo, mWorkspaceWindow);
|
||||
}
|
||||
|
||||
internal void RefreshCheckinProgress(
|
||||
CheckinStatus checkinStatus,
|
||||
BuildProgressSpeedAndRemainingTime.ProgressData progressData)
|
||||
{
|
||||
mCheckinProgress.Refresh(checkinStatus, progressData);
|
||||
}
|
||||
|
||||
internal void CancelCheckinProgress()
|
||||
{
|
||||
mCheckinProgress.CancelPressed = true;
|
||||
}
|
||||
|
||||
internal void EndUpdateProgress()
|
||||
{
|
||||
mUpdateProgress = null;
|
||||
mWorkspaceWindow.Progress.ResetProgress();
|
||||
mWorkspaceWindow.RequestRepaint();
|
||||
}
|
||||
|
||||
internal void EndCheckinProgress()
|
||||
{
|
||||
mCheckinProgress = null;
|
||||
mWorkspaceWindow.Progress.ResetProgress();
|
||||
mWorkspaceWindow.RequestRepaint();
|
||||
}
|
||||
|
||||
internal bool HasCheckinCancelled()
|
||||
{
|
||||
return mCheckinProgress.CancelPressed;
|
||||
}
|
||||
|
||||
double mSecondsSinceLastProgressUpdate = 0;
|
||||
|
||||
GenericProgress mProgress;
|
||||
UpdateProgress mUpdateProgress;
|
||||
CheckinProgress mCheckinProgress;
|
||||
WorkspaceInfo mWkInfo;
|
||||
|
||||
WorkspaceWindow mWorkspaceWindow;
|
||||
|
||||
const double UPDATE_INTERVAL_SECONDS = 0.5;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f1b80531a496e644abedd795c21274cb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
|
||||
using Codice.Client.BaseCommands;
|
||||
using Codice.Client.Commands;
|
||||
using PlasticGui.WorkspaceWindow;
|
||||
using PlasticGui.WorkspaceWindow.Update;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Developer
|
||||
{
|
||||
internal class UpdateProgress
|
||||
{
|
||||
internal UpdateProgress(
|
||||
UpdateNotifier notifier, string wkPath, string title,
|
||||
WorkspaceWindow workspaceWindow)
|
||||
{
|
||||
mNotifier = notifier;
|
||||
mWkPath = wkPath;
|
||||
mWorkspaceWindow = workspaceWindow;
|
||||
|
||||
mProgressData = new BuildProgressSpeedAndRemainingTime.ProgressData(DateTime.Now);
|
||||
|
||||
mWorkspaceWindow.Progress.ProgressHeader = title;
|
||||
mWorkspaceWindow.Progress.CanCancelProgress = false;
|
||||
}
|
||||
|
||||
internal void OnUpdateProgress()
|
||||
{
|
||||
var progress = mWorkspaceWindow.Progress;
|
||||
|
||||
progress.ProgressHeader = UpdateProgressRender.FixNotificationPath(
|
||||
mWkPath, mNotifier.GetNotificationMessage());
|
||||
|
||||
UpdateOperationStatus status = mNotifier.GetUpdateStatus();
|
||||
|
||||
progress.TotalProgressMessage = UpdateProgressRender.GetProgressString(
|
||||
status, mProgressData);
|
||||
|
||||
progress.TotalProgressPercent = GetProgressBarPercent.ForTransfer(
|
||||
status.UpdatedSize, status.TotalSize) / 100f;
|
||||
}
|
||||
|
||||
readonly BuildProgressSpeedAndRemainingTime.ProgressData mProgressData;
|
||||
readonly WorkspaceWindow mWorkspaceWindow;
|
||||
readonly string mWkPath;
|
||||
readonly UpdateNotifier mNotifier;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce652d891ad5ed540b0d6e474d00130c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cca926c65e360cf4f8637f7c853a7513
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,273 @@
|
||||
using System.Collections;
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
using Codice.Client.BaseCommands;
|
||||
using Codice.Client.Commands;
|
||||
using Codice.CM.Common;
|
||||
using PlasticGui;
|
||||
using PlasticGui.WorkspaceWindow.Update;
|
||||
using Unity.PlasticSCM.Editor.UI;
|
||||
using Unity.PlasticSCM.Editor.UI.Progress;
|
||||
using Unity.PlasticSCM.Editor.UI.Tree;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Developer.UpdateReport
|
||||
{
|
||||
internal class UpdateReportDialog :
|
||||
PlasticDialog,
|
||||
IUpdateReportDialog
|
||||
{
|
||||
protected override Rect DefaultRect
|
||||
{
|
||||
get
|
||||
{
|
||||
var baseRect = base.DefaultRect;
|
||||
return new Rect(baseRect.x, baseRect.y, 810, 385);
|
||||
}
|
||||
}
|
||||
|
||||
internal static ResponseType ShowReportDialog(
|
||||
WorkspaceInfo wkInfo,
|
||||
IList reportLines,
|
||||
EditorWindow parentWindow)
|
||||
{
|
||||
UpdateReportDialog dialog = Create(
|
||||
wkInfo,
|
||||
reportLines,
|
||||
new ProgressControlsForDialogs());
|
||||
|
||||
return dialog.RunModal(parentWindow);
|
||||
}
|
||||
|
||||
protected override void SaveSettings()
|
||||
{
|
||||
TreeHeaderSettings.Save(mPathsListView.multiColumnHeader.state,
|
||||
UnityConstants.DEVELOPER_UPDATE_REPORT_TABLE_SETTINGS_NAME);
|
||||
}
|
||||
|
||||
protected override void OnModalGUI()
|
||||
{
|
||||
Title(PlasticLocalization.GetString(PlasticLocalization.Name.UpdateResultsTitle));
|
||||
|
||||
Paragraph(PlasticLocalization.GetString(PlasticLocalization.Name.UpdateResultsError));
|
||||
|
||||
DoListArea(
|
||||
mPathsListView,
|
||||
mErrorDetailsSplitterState);
|
||||
|
||||
GUILayout.Space(10);
|
||||
|
||||
DoSelectAllArea();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Space(4);
|
||||
DrawProgressForDialogs.For(
|
||||
mProgressControls.ProgressData);
|
||||
GUILayout.Space(4);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.Space(2);
|
||||
|
||||
DoButtonsArea(mIsAnyLineChecked);
|
||||
|
||||
mProgressControls.ForcedUpdateProgress(this);
|
||||
}
|
||||
|
||||
protected override string GetTitle()
|
||||
{
|
||||
return PlasticLocalization.GetString(
|
||||
PlasticLocalization.Name.UpdateResultsTitle);
|
||||
}
|
||||
|
||||
void IUpdateReportDialog.Reload()
|
||||
{
|
||||
SetReportLines(mReportLines);
|
||||
}
|
||||
|
||||
void OnCheckedReportLineChanged()
|
||||
{
|
||||
mIsAnyLineChecked =
|
||||
mPathsListView.IsAnyLineChecked();
|
||||
mAreAllLinesChecked =
|
||||
mPathsListView.AreAllLinesChecked();
|
||||
}
|
||||
|
||||
void DoListArea(
|
||||
UpdateReportListView errorsListView,
|
||||
object splitterState)
|
||||
{
|
||||
EditorGUILayout.BeginVertical();
|
||||
PlasticSplitterGUILayout.BeginHorizontalSplit(splitterState);
|
||||
|
||||
DoErrorsListViewArea(errorsListView);
|
||||
DoErrorDetailsTextArea(errorsListView.GetSelectedError());
|
||||
|
||||
PlasticSplitterGUILayout.EndHorizontalSplit();
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
|
||||
static void DoErrorsListViewArea(
|
||||
UpdateReportListView errorsListView)
|
||||
{
|
||||
Rect treeRect = GUILayoutUtility.GetRect(0, 100000, 0, 100000);
|
||||
|
||||
errorsListView.OnGUI(treeRect);
|
||||
}
|
||||
|
||||
void DoErrorDetailsTextArea(ReportLine selectedReportLine)
|
||||
{
|
||||
string errorDetailsText = selectedReportLine == null ?
|
||||
string.Empty : selectedReportLine.Message;
|
||||
|
||||
EditorGUILayout.BeginVertical();
|
||||
|
||||
GUILayout.Space(8);
|
||||
GUILayout.Label(PlasticLocalization.GetString(PlasticLocalization.Name.ProblemColumn));
|
||||
|
||||
mErrorDetailsScrollPosition = GUILayout.BeginScrollView(
|
||||
mErrorDetailsScrollPosition);
|
||||
|
||||
GUILayout.TextArea(
|
||||
errorDetailsText, UnityStyles.TextFieldWithWrapping,
|
||||
GUILayout.ExpandHeight(true));
|
||||
|
||||
GUILayout.EndScrollView();
|
||||
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
|
||||
void DoSelectAllArea()
|
||||
{
|
||||
bool toggleValue = GUILayout.Toggle(
|
||||
mAreAllLinesChecked,
|
||||
PlasticLocalization.GetString(
|
||||
PlasticLocalization.Name.SelectAll));
|
||||
|
||||
if (toggleValue != mAreAllLinesChecked && toggleValue)
|
||||
{
|
||||
mPathsListView.CheckAllLines();
|
||||
return;
|
||||
}
|
||||
|
||||
if (toggleValue != mAreAllLinesChecked && !toggleValue)
|
||||
{
|
||||
mPathsListView.UnCheckAllLines();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void DoButtonsArea(bool areUpdateButtonsEneabled)
|
||||
{
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
DoRetryUpdateButton(areUpdateButtonsEneabled);
|
||||
DoUpdateForcedButton(areUpdateButtonsEneabled);
|
||||
|
||||
GUILayout.FlexibleSpace();
|
||||
|
||||
DoCloseButton();
|
||||
}
|
||||
}
|
||||
|
||||
void DoRetryUpdateButton(bool isEnabled)
|
||||
{
|
||||
GUI.enabled = isEnabled;
|
||||
|
||||
bool pressed = NormalButton(PlasticLocalization.GetString(
|
||||
PlasticLocalization.Name.RetryUpdate));
|
||||
|
||||
GUI.enabled = true;
|
||||
|
||||
if (!pressed)
|
||||
return;
|
||||
|
||||
SelectiveUpdateOperation.SelectiveUpdate(
|
||||
mWkInfo, mReportLines, mPathsListView.GetCheckedLines(),
|
||||
UpdateFlags.None, this, mProgressControls);
|
||||
}
|
||||
|
||||
void DoUpdateForcedButton(bool isEnabled)
|
||||
{
|
||||
GUI.enabled = isEnabled;
|
||||
|
||||
bool pressed = NormalButton(PlasticLocalization.GetString(
|
||||
PlasticLocalization.Name.UpdateForced));
|
||||
|
||||
GUI.enabled = true;
|
||||
|
||||
if (!pressed)
|
||||
return;
|
||||
|
||||
SelectiveUpdateOperation.SelectiveUpdate(
|
||||
mWkInfo, mReportLines, mPathsListView.GetCheckedLines(),
|
||||
UpdateFlags.Forced, this, mProgressControls);
|
||||
}
|
||||
|
||||
void DoCloseButton()
|
||||
{
|
||||
if (!NormalButton(PlasticLocalization.GetString(
|
||||
PlasticLocalization.Name.CloseButton)))
|
||||
return;
|
||||
|
||||
CancelButtonAction();
|
||||
}
|
||||
|
||||
static UpdateReportDialog Create(
|
||||
WorkspaceInfo wkInfo,
|
||||
IList reportLines,
|
||||
ProgressControlsForDialogs progressControls)
|
||||
{
|
||||
var instance = CreateInstance<UpdateReportDialog>();
|
||||
instance.mWkInfo = wkInfo;
|
||||
instance.mReportLines = reportLines;
|
||||
instance.mProgressControls = progressControls;
|
||||
instance.mEscapeKeyAction = instance.CloseButtonAction;
|
||||
instance.BuildComponents(wkInfo);
|
||||
instance.SetReportLines(reportLines);
|
||||
return instance;
|
||||
}
|
||||
|
||||
void SetReportLines(IList reportLines)
|
||||
{
|
||||
mReportLines = reportLines;
|
||||
|
||||
mPathsListView.BuildModel(reportLines);
|
||||
mPathsListView.Reload();
|
||||
mAreAllLinesChecked = false;
|
||||
}
|
||||
|
||||
void BuildComponents(WorkspaceInfo wkInfo)
|
||||
{
|
||||
mErrorDetailsSplitterState = PlasticSplitterGUILayout.InitSplitterState(
|
||||
new float[] { 0.50f, 0.50f },
|
||||
new int[] { 100, 100 },
|
||||
new int[] { 100000, 100000 }
|
||||
);
|
||||
|
||||
UpdateReportListHeaderState errorsListHeaderState =
|
||||
UpdateReportListHeaderState.GetDefault();
|
||||
TreeHeaderSettings.Load(errorsListHeaderState,
|
||||
UnityConstants.DEVELOPER_UPDATE_REPORT_TABLE_SETTINGS_NAME,
|
||||
UnityConstants.UNSORT_COLUMN_ID);
|
||||
|
||||
mPathsListView = new UpdateReportListView(
|
||||
wkInfo,
|
||||
errorsListHeaderState,
|
||||
OnCheckedReportLineChanged);
|
||||
|
||||
mPathsListView.Reload();
|
||||
}
|
||||
|
||||
bool mIsAnyLineChecked = false;
|
||||
bool mAreAllLinesChecked = false;
|
||||
UpdateReportListView mPathsListView;
|
||||
|
||||
object mErrorDetailsSplitterState;
|
||||
Vector2 mErrorDetailsScrollPosition;
|
||||
|
||||
WorkspaceInfo mWkInfo;
|
||||
IList mReportLines;
|
||||
ProgressControlsForDialogs mProgressControls;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3cc230fb0050a994480d907e02d3508b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,20 @@
|
||||
using UnityEditor.IMGUI.Controls;
|
||||
|
||||
using Codice.Client.BaseCommands;
|
||||
using Codice.Client.Commands;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Developer.UpdateReport
|
||||
{
|
||||
internal class UpdateReportLineListViewItem : TreeViewItem
|
||||
{
|
||||
internal ReportLine ReportLine { get; private set; }
|
||||
|
||||
internal UpdateReportLineListViewItem(int id, ReportLine reportLine)
|
||||
: base(id, 0)
|
||||
{
|
||||
ReportLine = reportLine;
|
||||
|
||||
displayName = reportLine.ItemPath;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 146c16184e337574f9f3baf6d467907a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
|
||||
using UnityEditor.IMGUI.Controls;
|
||||
using UnityEngine;
|
||||
|
||||
using PlasticGui;
|
||||
using Unity.PlasticSCM.Editor.UI.Tree;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Developer.UpdateReport
|
||||
{
|
||||
internal enum ErrorsListColumn
|
||||
{
|
||||
Path,
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
internal class UpdateReportListHeaderState : MultiColumnHeaderState, ISerializationCallbackReceiver
|
||||
{
|
||||
internal static UpdateReportListHeaderState GetDefault()
|
||||
{
|
||||
return new UpdateReportListHeaderState(BuildColumns());
|
||||
}
|
||||
|
||||
static string GetColumnName(ErrorsListColumn column)
|
||||
{
|
||||
switch (column)
|
||||
{
|
||||
case ErrorsListColumn.Path:
|
||||
return PlasticLocalization.GetString(PlasticLocalization.Name.PathColumn);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
void ISerializationCallbackReceiver.OnAfterDeserialize()
|
||||
{
|
||||
if (mHeaderTitles != null)
|
||||
TreeHeaderColumns.SetTitles(columns, mHeaderTitles);
|
||||
}
|
||||
|
||||
void ISerializationCallbackReceiver.OnBeforeSerialize()
|
||||
{
|
||||
}
|
||||
|
||||
static Column[] BuildColumns()
|
||||
{
|
||||
return new Column[]
|
||||
{
|
||||
new Column()
|
||||
{
|
||||
width = 605,
|
||||
headerContent = new GUIContent(
|
||||
GetColumnName(ErrorsListColumn.Path)),
|
||||
minWidth = 200,
|
||||
allowToggleVisibility = false,
|
||||
canSort = false,
|
||||
sortingArrowAlignment = TextAlignment.Right
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
UpdateReportListHeaderState(Column[] columns)
|
||||
: base(columns)
|
||||
{
|
||||
if (mHeaderTitles == null)
|
||||
mHeaderTitles = TreeHeaderColumns.GetTitles(columns);
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
string[] mHeaderTitles;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5b37b989e50b35043bba89d7d660e31e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,287 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using UnityEditor.IMGUI.Controls;
|
||||
using UnityEngine;
|
||||
|
||||
using Codice.Client.BaseCommands;
|
||||
using Codice.Client.Commands;
|
||||
using Codice.Client.Common;
|
||||
using Codice.CM.Common;
|
||||
using Unity.PlasticSCM.Editor.UI;
|
||||
using Unity.PlasticSCM.Editor.UI.Tree;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Developer.UpdateReport
|
||||
{
|
||||
internal class UpdateReportListView : TreeView
|
||||
{
|
||||
internal UpdateReportListView(
|
||||
WorkspaceInfo wkInfo,
|
||||
UpdateReportListHeaderState headerState,
|
||||
Action onCheckedReportLineChanged)
|
||||
: base(new TreeViewState())
|
||||
{
|
||||
mWkInfo = wkInfo;
|
||||
mOnCheckedReportLineChanged = onCheckedReportLineChanged;
|
||||
|
||||
multiColumnHeader = new MultiColumnHeader(headerState);
|
||||
multiColumnHeader.canSort = false;
|
||||
|
||||
rowHeight = UnityConstants.TREEVIEW_ROW_HEIGHT;
|
||||
showAlternatingRowBackgrounds = false;
|
||||
}
|
||||
|
||||
internal List<ReportLine> GetCheckedLines()
|
||||
{
|
||||
List<ReportLine> result = new List<ReportLine>();
|
||||
|
||||
foreach (UpdateReportLineListViewItem item in mCheckedLines)
|
||||
result.Add(item.ReportLine);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
internal bool IsAnyLineChecked()
|
||||
{
|
||||
return mCheckedLines.Count > 0;
|
||||
}
|
||||
|
||||
internal bool AreAllLinesChecked()
|
||||
{
|
||||
if (mReportLines.Count == 0)
|
||||
return false;
|
||||
|
||||
return mCheckedLines.Count == mReportLines.Count;
|
||||
}
|
||||
|
||||
internal void CheckAllLines()
|
||||
{
|
||||
mCheckedLines.Clear();
|
||||
|
||||
foreach (UpdateReportLineListViewItem row in mRows)
|
||||
{
|
||||
mCheckedLines.Add(row);
|
||||
}
|
||||
|
||||
mOnCheckedReportLineChanged();
|
||||
}
|
||||
|
||||
internal void UnCheckAllLines()
|
||||
{
|
||||
mCheckedLines.Clear();
|
||||
mOnCheckedReportLineChanged();
|
||||
}
|
||||
|
||||
internal void BuildModel(IList reportLines)
|
||||
{
|
||||
mReportLines = reportLines;
|
||||
mCheckedLines.Clear();
|
||||
mOnCheckedReportLineChanged();
|
||||
}
|
||||
|
||||
internal ReportLine GetSelectedError()
|
||||
{
|
||||
List<ReportLine> selectedErrors = GetSelectedErrors(this);
|
||||
|
||||
if (selectedErrors.Count != 1)
|
||||
return null;
|
||||
|
||||
return selectedErrors[0];
|
||||
}
|
||||
|
||||
public override IList<TreeViewItem> GetRows()
|
||||
{
|
||||
return mRows;
|
||||
}
|
||||
|
||||
protected override TreeViewItem BuildRoot()
|
||||
{
|
||||
return new TreeViewItem(0, -1, string.Empty);
|
||||
}
|
||||
|
||||
protected override IList<TreeViewItem> BuildRows(
|
||||
TreeViewItem rootItem)
|
||||
{
|
||||
RegenerateRows(
|
||||
this, mReportLines, rootItem, mRows);
|
||||
|
||||
return mRows;
|
||||
}
|
||||
|
||||
protected override void BeforeRowsGUI()
|
||||
{
|
||||
int firstRowVisible;
|
||||
int lastRowVisible;
|
||||
GetFirstAndLastVisibleRows(out firstRowVisible, out lastRowVisible);
|
||||
|
||||
GUI.DrawTexture(new Rect(0,
|
||||
firstRowVisible * rowHeight,
|
||||
GetRowRect(0).width + 500,
|
||||
(lastRowVisible * rowHeight) + 1000),
|
||||
Images.GetTreeviewBackgroundTexture());
|
||||
|
||||
DrawTreeViewItem.InitializeStyles();
|
||||
base.BeforeRowsGUI();
|
||||
}
|
||||
|
||||
protected override void RowGUI(RowGUIArgs args)
|
||||
{
|
||||
if (args.item is UpdateReportLineListViewItem)
|
||||
{
|
||||
UpdateReportListViewItemGUI(
|
||||
mWkInfo.ClientPath,
|
||||
(UpdateReportLineListViewItem)args.item,
|
||||
args,
|
||||
rowHeight,
|
||||
mReportLines.Count,
|
||||
mOnCheckedReportLineChanged,
|
||||
mCheckedLines);
|
||||
return;
|
||||
}
|
||||
|
||||
base.RowGUI(args);
|
||||
}
|
||||
|
||||
static List<ReportLine> GetSelectedErrors(
|
||||
UpdateReportListView listView)
|
||||
{
|
||||
List<ReportLine> result = new List<ReportLine>();
|
||||
|
||||
IList<int> selectedIds = listView.GetSelection();
|
||||
|
||||
if (selectedIds.Count == 0)
|
||||
return result;
|
||||
|
||||
foreach (UpdateReportLineListViewItem treeViewItem in
|
||||
listView.FindRows(selectedIds))
|
||||
{
|
||||
result.Add(treeViewItem.ReportLine);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static void RegenerateRows(
|
||||
UpdateReportListView listView,
|
||||
IList reportLines,
|
||||
TreeViewItem rootItem,
|
||||
List<TreeViewItem> rows)
|
||||
{
|
||||
ClearRows(rootItem, rows);
|
||||
|
||||
if (reportLines.Count == 0)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < reportLines.Count; i++)
|
||||
{
|
||||
UpdateReportLineListViewItem errorListViewItem =
|
||||
new UpdateReportLineListViewItem(i + 1, (ReportLine)reportLines[i]);
|
||||
|
||||
rootItem.AddChild(errorListViewItem);
|
||||
rows.Add(errorListViewItem);
|
||||
}
|
||||
|
||||
listView.SetSelection(new List<int> { 1 });
|
||||
}
|
||||
|
||||
static void ClearRows(
|
||||
TreeViewItem rootItem,
|
||||
List<TreeViewItem> rows)
|
||||
{
|
||||
if (rootItem.hasChildren)
|
||||
rootItem.children.Clear();
|
||||
|
||||
rows.Clear();
|
||||
}
|
||||
|
||||
static void UpdateReportListViewItemGUI(
|
||||
string wkPath,
|
||||
UpdateReportLineListViewItem item,
|
||||
RowGUIArgs args,
|
||||
float rowHeight,
|
||||
int totalLinesCount,
|
||||
Action onCheckedReportLineChanged,
|
||||
HashSet<UpdateReportLineListViewItem> checkedLines)
|
||||
{
|
||||
for (int visibleColumnIdx = 0; visibleColumnIdx < args.GetNumVisibleColumns(); visibleColumnIdx++)
|
||||
{
|
||||
Rect cellRect = args.GetCellRect(visibleColumnIdx);
|
||||
|
||||
ErrorsListColumn column =
|
||||
(ErrorsListColumn)args.GetColumn(visibleColumnIdx);
|
||||
|
||||
UpdateReportListViewItemCellGUI(
|
||||
cellRect,
|
||||
wkPath,
|
||||
item,
|
||||
column,
|
||||
rowHeight,
|
||||
args.selected,
|
||||
args.focused,
|
||||
totalLinesCount,
|
||||
onCheckedReportLineChanged,
|
||||
checkedLines);
|
||||
}
|
||||
}
|
||||
|
||||
static void UpdateReportListViewItemCellGUI(
|
||||
Rect rect,
|
||||
string wkPath,
|
||||
UpdateReportLineListViewItem item,
|
||||
ErrorsListColumn column,
|
||||
float rowHeight,
|
||||
bool isSelected,
|
||||
bool isFocused,
|
||||
int totalLinesCount,
|
||||
Action onCheckedReportLineChanged,
|
||||
HashSet<UpdateReportLineListViewItem> checkedLines)
|
||||
{
|
||||
string label = WorkspacePath.GetWorkspaceRelativePath(
|
||||
wkPath,
|
||||
item.ReportLine.ItemPath);
|
||||
|
||||
bool wasChecked = checkedLines.Contains(item);
|
||||
bool isChecked = DrawTreeViewItem.ForCheckableItemCell(
|
||||
rect,
|
||||
rowHeight,
|
||||
0,
|
||||
null,
|
||||
null,
|
||||
label,
|
||||
isSelected,
|
||||
isFocused,
|
||||
false,
|
||||
wasChecked);
|
||||
|
||||
if (wasChecked != isChecked)
|
||||
{
|
||||
UpdateCheckedState(checkedLines, item, isChecked);
|
||||
onCheckedReportLineChanged();
|
||||
}
|
||||
}
|
||||
|
||||
static void UpdateCheckedState(
|
||||
HashSet<UpdateReportLineListViewItem> checkedLines,
|
||||
UpdateReportLineListViewItem item,
|
||||
bool isChecked)
|
||||
{
|
||||
if (isChecked)
|
||||
{
|
||||
checkedLines.Add(item);
|
||||
return;
|
||||
}
|
||||
|
||||
checkedLines.Remove(item);
|
||||
}
|
||||
|
||||
List<TreeViewItem> mRows = new List<TreeViewItem>();
|
||||
IList mReportLines = new ArrayList();
|
||||
|
||||
HashSet<UpdateReportLineListViewItem> mCheckedLines =
|
||||
new HashSet<UpdateReportLineListViewItem>();
|
||||
|
||||
readonly WorkspaceInfo mWkInfo;
|
||||
readonly Action mOnCheckedReportLineChanged;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e8bf7425cfbdd094da5dc809a5eaa8ff
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user