initial commit
This commit is contained in:
parent
6715289efe
commit
788c3389af
37645 changed files with 2526849 additions and 80 deletions
|
@ -0,0 +1,135 @@
|
|||
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.History
|
||||
{
|
||||
internal enum HistoryListColumn
|
||||
{
|
||||
Changeset,
|
||||
CreationDate,
|
||||
CreatedBy,
|
||||
Comment,
|
||||
Branch,
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
internal class HistoryListHeaderState : MultiColumnHeaderState, ISerializationCallbackReceiver
|
||||
{
|
||||
internal static HistoryListHeaderState GetDefault()
|
||||
{
|
||||
return new HistoryListHeaderState(BuildColumns());
|
||||
}
|
||||
|
||||
internal static List<string> GetColumnNames()
|
||||
{
|
||||
List<string> result = new List<string>();
|
||||
result.Add(PlasticLocalization.GetString(PlasticLocalization.Name.ChangesetColumn));
|
||||
result.Add(PlasticLocalization.GetString(PlasticLocalization.Name.CreationDateColumn));
|
||||
result.Add(PlasticLocalization.GetString(PlasticLocalization.Name.CreatedByColumn));
|
||||
result.Add(PlasticLocalization.GetString(PlasticLocalization.Name.CommentColumn));
|
||||
result.Add(PlasticLocalization.GetString(PlasticLocalization.Name.BranchColumn));
|
||||
return result;
|
||||
}
|
||||
|
||||
internal static string GetColumnName(HistoryListColumn column)
|
||||
{
|
||||
switch (column)
|
||||
{
|
||||
case HistoryListColumn.Changeset:
|
||||
return PlasticLocalization.GetString(PlasticLocalization.Name.ChangesetColumn);
|
||||
case HistoryListColumn.CreationDate:
|
||||
return PlasticLocalization.GetString(PlasticLocalization.Name.CreationDateColumn);
|
||||
case HistoryListColumn.CreatedBy:
|
||||
return PlasticLocalization.GetString(PlasticLocalization.Name.CreatedByColumn);
|
||||
case HistoryListColumn.Comment:
|
||||
return PlasticLocalization.GetString(PlasticLocalization.Name.CommentColumn);
|
||||
case HistoryListColumn.Branch:
|
||||
return PlasticLocalization.GetString(PlasticLocalization.Name.BranchColumn);
|
||||
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 = 100,
|
||||
headerContent = new GUIContent(
|
||||
GetColumnName(HistoryListColumn.Changeset)),
|
||||
minWidth = 50,
|
||||
sortingArrowAlignment = TextAlignment.Right
|
||||
},
|
||||
new Column()
|
||||
{
|
||||
width = 250,
|
||||
headerContent = new GUIContent(
|
||||
GetColumnName(HistoryListColumn.CreationDate)),
|
||||
minWidth = 100,
|
||||
sortingArrowAlignment = TextAlignment.Right
|
||||
},
|
||||
new Column()
|
||||
{
|
||||
width = 250,
|
||||
headerContent = new GUIContent(
|
||||
GetColumnName(HistoryListColumn.CreatedBy)),
|
||||
minWidth = 100,
|
||||
sortingArrowAlignment = TextAlignment.Right
|
||||
},
|
||||
new Column()
|
||||
{
|
||||
width = 400,
|
||||
headerContent = new GUIContent(
|
||||
GetColumnName(HistoryListColumn.Comment)),
|
||||
minWidth = 100,
|
||||
sortingArrowAlignment = TextAlignment.Right
|
||||
},
|
||||
new Column()
|
||||
{
|
||||
width = 200,
|
||||
headerContent = new GUIContent(
|
||||
GetColumnName(HistoryListColumn.Branch)),
|
||||
minWidth = 100,
|
||||
sortingArrowAlignment = TextAlignment.Right
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
HistoryListHeaderState(Column[] columns)
|
||||
: base(columns)
|
||||
{
|
||||
if (mHeaderTitles == null)
|
||||
mHeaderTitles = TreeHeaderColumns.GetTitles(columns);
|
||||
|
||||
if (mColumsAllowedToggleVisibility == null)
|
||||
mColumsAllowedToggleVisibility = TreeHeaderColumns.GetVisibilities(columns);
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
string[] mHeaderTitles;
|
||||
|
||||
[SerializeField]
|
||||
bool[] mColumsAllowedToggleVisibility;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5b6e8a80709e2264eb383ef6b40e181f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,398 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using UnityEditor.IMGUI.Controls;
|
||||
using UnityEngine;
|
||||
|
||||
using Codice.CM.Common;
|
||||
using PlasticGui;
|
||||
using PlasticGui.WorkspaceWindow.History;
|
||||
using Unity.PlasticSCM.Editor.UI;
|
||||
using Unity.PlasticSCM.Editor.UI.Avatar;
|
||||
using Unity.PlasticSCM.Editor.UI.Tree;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Views.History
|
||||
{
|
||||
internal class HistoryListView : TreeView
|
||||
{
|
||||
internal HistoryListView(
|
||||
string wkPath,
|
||||
RepositorySpec repSpec,
|
||||
HistoryListHeaderState headerState,
|
||||
HistoryListViewMenu menu,
|
||||
List<string> columnNames) :
|
||||
base(new TreeViewState())
|
||||
{
|
||||
mWkPath = wkPath;
|
||||
mRepSpec = repSpec;
|
||||
mMenu = menu;
|
||||
mColumnNames = columnNames;
|
||||
|
||||
multiColumnHeader = new MultiColumnHeader(headerState);
|
||||
multiColumnHeader.canSort = true;
|
||||
multiColumnHeader.sortingChanged += SortingChanged;
|
||||
|
||||
rowHeight = UnityConstants.TREEVIEW_ROW_HEIGHT;
|
||||
showAlternatingRowBackgrounds = false;
|
||||
|
||||
mCooldownFilterAction = new CooldownWindowDelayer(
|
||||
DelayedSearchChanged, UnityConstants.SEARCH_DELAYED_INPUT_ACTION_INTERVAL);
|
||||
}
|
||||
|
||||
public override IList<TreeViewItem> GetRows()
|
||||
{
|
||||
return mRows;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect rect)
|
||||
{
|
||||
base.OnGUI(rect);
|
||||
|
||||
Event e = Event.current;
|
||||
|
||||
if (e.type != EventType.KeyDown)
|
||||
return;
|
||||
|
||||
bool isProcessed = mMenu.ProcessKeyActionIfNeeded(e);
|
||||
|
||||
if (isProcessed)
|
||||
e.Use();
|
||||
}
|
||||
|
||||
protected override TreeViewItem BuildRoot()
|
||||
{
|
||||
return new TreeViewItem(0, -1, string.Empty);
|
||||
}
|
||||
|
||||
protected override IList<TreeViewItem> BuildRows(
|
||||
TreeViewItem rootItem)
|
||||
{
|
||||
if (mRevisionsList == null)
|
||||
{
|
||||
ClearRows(rootItem, mRows);
|
||||
|
||||
return mRows;
|
||||
}
|
||||
|
||||
RegenerateRows(
|
||||
mListViewItemIds,
|
||||
mRevisionsList,
|
||||
rootItem,
|
||||
mRows);
|
||||
|
||||
return mRows;
|
||||
}
|
||||
|
||||
protected override void SearchChanged(string newSearch)
|
||||
{
|
||||
mCooldownFilterAction.Ping();
|
||||
}
|
||||
|
||||
protected override void ContextClickedItem(int id)
|
||||
{
|
||||
mMenu.Popup();
|
||||
Repaint();
|
||||
}
|
||||
|
||||
protected override void BeforeRowsGUI()
|
||||
{
|
||||
int firstRowVisible;
|
||||
int lastRowVisible;
|
||||
GetFirstAndLastVisibleRows(out firstRowVisible, out lastRowVisible);
|
||||
|
||||
GUI.DrawTexture(new Rect(0,
|
||||
firstRowVisible * rowHeight,
|
||||
GetRowRect(0).width,
|
||||
(lastRowVisible * rowHeight) + 1000),
|
||||
Images.GetTreeviewBackgroundTexture());
|
||||
|
||||
DrawTreeViewItem.InitializeStyles();
|
||||
base.BeforeRowsGUI();
|
||||
}
|
||||
|
||||
|
||||
protected override void RowGUI(RowGUIArgs args)
|
||||
{
|
||||
if (args.item is HistoryListViewItem)
|
||||
{
|
||||
HistoryListViewItem historyListViewItem = (HistoryListViewItem)args.item;
|
||||
|
||||
HistoryListViewItemGUI(
|
||||
mWkPath,
|
||||
mRepSpec,
|
||||
rowHeight,
|
||||
historyListViewItem,
|
||||
args,
|
||||
mLoadedRevisionId == historyListViewItem.Revision.Id,
|
||||
Repaint);
|
||||
return;
|
||||
}
|
||||
|
||||
base.RowGUI(args);
|
||||
}
|
||||
|
||||
internal void BuildModel(
|
||||
HistoryRevisionList historyRevisionList,
|
||||
long loadedRevisionId)
|
||||
{
|
||||
mListViewItemIds.Clear();
|
||||
|
||||
mRevisionsList = historyRevisionList;
|
||||
mLoadedRevisionId = loadedRevisionId;
|
||||
}
|
||||
|
||||
internal void Refilter()
|
||||
{
|
||||
if (mRevisionsList == null)
|
||||
return;
|
||||
|
||||
Filter filter = new Filter(searchString);
|
||||
mRevisionsList.Filter(filter, mColumnNames, null);
|
||||
}
|
||||
|
||||
internal void Sort()
|
||||
{
|
||||
if (mRevisionsList == null)
|
||||
return;
|
||||
|
||||
int sortedColumnIdx = multiColumnHeader.state.sortedColumnIndex;
|
||||
bool sortAscending = multiColumnHeader.IsSortedAscending(sortedColumnIdx);
|
||||
|
||||
mRevisionsList.Sort(
|
||||
mColumnNames[sortedColumnIdx],
|
||||
sortAscending);
|
||||
}
|
||||
|
||||
internal long GetLoadedRevisionId()
|
||||
{
|
||||
return mLoadedRevisionId;
|
||||
}
|
||||
|
||||
internal List<RepObjectInfo> GetSelectedRepObjectInfos()
|
||||
{
|
||||
List<RepObjectInfo> result = new List<RepObjectInfo>();
|
||||
|
||||
IList<int> selectedIds = GetSelection();
|
||||
|
||||
if (selectedIds.Count == 0)
|
||||
return result;
|
||||
|
||||
foreach (KeyValuePair<RepObjectInfo, int> item
|
||||
in mListViewItemIds.GetInfoItems())
|
||||
{
|
||||
if (!selectedIds.Contains(item.Value))
|
||||
continue;
|
||||
|
||||
result.Add(item.Key);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
internal List<HistoryRevision> GetSelectedHistoryRevisions()
|
||||
{
|
||||
return GetSelectedRepObjectInfos().OfType<HistoryRevision>().ToList();
|
||||
}
|
||||
|
||||
internal void SelectRepObjectInfos(
|
||||
List<RepObjectInfo> repObjectsToSelect)
|
||||
{
|
||||
List<int> idsToSelect = new List<int>();
|
||||
|
||||
foreach (RepObjectInfo repObjectInfo in repObjectsToSelect)
|
||||
{
|
||||
int repObjectInfoId = GetTreeIdForItem(repObjectInfo);
|
||||
|
||||
if (repObjectInfoId == -1)
|
||||
continue;
|
||||
|
||||
idsToSelect.Add(repObjectInfoId);
|
||||
}
|
||||
|
||||
TableViewOperations.SetSelectionAndScroll(this, idsToSelect);
|
||||
}
|
||||
|
||||
int GetTreeIdForItem(RepObjectInfo currentRepObjectInfo)
|
||||
{
|
||||
foreach (KeyValuePair<RepObjectInfo, int> item in mListViewItemIds.GetInfoItems())
|
||||
{
|
||||
if (!currentRepObjectInfo.Equals(item.Key))
|
||||
continue;
|
||||
|
||||
if (!currentRepObjectInfo.GUID.Equals(item.Key.GUID))
|
||||
continue;
|
||||
|
||||
return item.Value;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void DelayedSearchChanged()
|
||||
{
|
||||
Refilter();
|
||||
|
||||
Sort();
|
||||
|
||||
Reload();
|
||||
|
||||
TableViewOperations.ScrollToSelection(this);
|
||||
}
|
||||
|
||||
void SortingChanged(MultiColumnHeader multiColumnHeader)
|
||||
{
|
||||
Sort();
|
||||
|
||||
Reload();
|
||||
}
|
||||
|
||||
static void RegenerateRows(
|
||||
ListViewItemIds<RepObjectInfo> listViewItemIds,
|
||||
HistoryRevisionList revisions,
|
||||
TreeViewItem rootItem,
|
||||
List<TreeViewItem> rows)
|
||||
{
|
||||
ClearRows(rootItem, rows);
|
||||
|
||||
if (revisions.GetCount() == 0)
|
||||
return;
|
||||
|
||||
foreach (RepObjectInfo objectInfo in revisions.GetRevisions())
|
||||
{
|
||||
int objectId;
|
||||
if (!listViewItemIds.TryGetInfoItemId(objectInfo, out objectId))
|
||||
objectId = listViewItemIds.AddInfoItem(objectInfo);
|
||||
|
||||
HistoryListViewItem changesetListViewItem =
|
||||
new HistoryListViewItem(objectId, objectInfo);
|
||||
|
||||
rootItem.AddChild(changesetListViewItem);
|
||||
rows.Add(changesetListViewItem);
|
||||
}
|
||||
}
|
||||
|
||||
static void ClearRows(
|
||||
TreeViewItem rootItem,
|
||||
List<TreeViewItem> rows)
|
||||
{
|
||||
if (rootItem.hasChildren)
|
||||
rootItem.children.Clear();
|
||||
|
||||
rows.Clear();
|
||||
}
|
||||
|
||||
static void HistoryListViewItemGUI(
|
||||
string wkPath,
|
||||
RepositorySpec repSpec,
|
||||
float rowHeight,
|
||||
HistoryListViewItem item,
|
||||
RowGUIArgs args,
|
||||
bool isBoldText,
|
||||
Action avatarLoadedAction)
|
||||
{
|
||||
for (int visibleColumnIdx = 0; visibleColumnIdx < args.GetNumVisibleColumns(); visibleColumnIdx++)
|
||||
{
|
||||
Rect cellRect = args.GetCellRect(visibleColumnIdx);
|
||||
|
||||
HistoryListColumn column =
|
||||
(HistoryListColumn)args.GetColumn(visibleColumnIdx);
|
||||
|
||||
HistoryListViewItemCellGUI(
|
||||
cellRect,
|
||||
rowHeight,
|
||||
wkPath,
|
||||
repSpec,
|
||||
item,
|
||||
column,
|
||||
avatarLoadedAction,
|
||||
args.selected,
|
||||
args.focused,
|
||||
isBoldText);
|
||||
}
|
||||
}
|
||||
|
||||
static void HistoryListViewItemCellGUI(
|
||||
Rect rect,
|
||||
float rowHeight,
|
||||
string wkPath,
|
||||
RepositorySpec repSpec,
|
||||
HistoryListViewItem item,
|
||||
HistoryListColumn column,
|
||||
Action avatarLoadedAction,
|
||||
bool isSelected,
|
||||
bool isFocused,
|
||||
bool isBoldText)
|
||||
{
|
||||
string columnText = HistoryInfoView.GetColumnText(
|
||||
wkPath, repSpec, item.Revision,
|
||||
HistoryListHeaderState.GetColumnName(column));
|
||||
|
||||
if (column == HistoryListColumn.Changeset)
|
||||
{
|
||||
DrawTreeViewItem.ForItemCell(
|
||||
rect,
|
||||
rowHeight,
|
||||
0,
|
||||
GetRevisionIcon(item.Revision),
|
||||
null,
|
||||
columnText,
|
||||
isSelected,
|
||||
isFocused,
|
||||
isBoldText,
|
||||
false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (column == HistoryListColumn.CreatedBy)
|
||||
{
|
||||
DrawTreeViewItem.ForItemCell(
|
||||
rect,
|
||||
rowHeight,
|
||||
-1,
|
||||
GetAvatar.ForEmail(columnText, avatarLoadedAction),
|
||||
null,
|
||||
columnText,
|
||||
isSelected,
|
||||
isFocused,
|
||||
isBoldText,
|
||||
false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (column == HistoryListColumn.Branch)
|
||||
{
|
||||
DrawTreeViewItem.ForSecondaryLabel(
|
||||
rect, columnText, isSelected, isFocused, isBoldText);
|
||||
return;
|
||||
}
|
||||
|
||||
DrawTreeViewItem.ForLabel(
|
||||
rect, columnText, isSelected, isFocused, isBoldText);
|
||||
}
|
||||
|
||||
static Texture GetRevisionIcon(RepObjectInfo revision)
|
||||
{
|
||||
if (revision is MoveRealizationInfo)
|
||||
return Images.GetMovedIcon();
|
||||
|
||||
if (revision is RemovedRealizationInfo)
|
||||
return Images.GetDeletedIcon();
|
||||
|
||||
return Images.GetFileIcon();
|
||||
}
|
||||
|
||||
ListViewItemIds<RepObjectInfo> mListViewItemIds = new ListViewItemIds<RepObjectInfo>();
|
||||
List<TreeViewItem> mRows = new List<TreeViewItem>();
|
||||
|
||||
HistoryRevisionList mRevisionsList;
|
||||
long mLoadedRevisionId;
|
||||
|
||||
readonly CooldownWindowDelayer mCooldownFilterAction;
|
||||
readonly HistoryListViewMenu mMenu;
|
||||
readonly List<string> mColumnNames;
|
||||
readonly RepositorySpec mRepSpec;
|
||||
readonly string mWkPath;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0ee2845d0d4db9a4a9e8f4f6d0fa4e5e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
using UnityEditor.IMGUI.Controls;
|
||||
|
||||
using Codice.CM.Common;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Views.History
|
||||
{
|
||||
internal class HistoryListViewItem : TreeViewItem
|
||||
{
|
||||
internal RepObjectInfo Revision { get; private set; }
|
||||
|
||||
internal HistoryListViewItem(int id, RepObjectInfo revision)
|
||||
: base(id, 1)
|
||||
{
|
||||
Revision = revision;
|
||||
|
||||
displayName = id.ToString();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b1b8657301e8ead4a9389eda02c15883
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,223 @@
|
|||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
using Codice.Client.BaseCommands.EventTracking;
|
||||
using Codice.CM.Common;
|
||||
using PlasticGui;
|
||||
using PlasticGui.WorkspaceWindow.History;
|
||||
using PlasticGui.WorkspaceWindow.Open;
|
||||
using Unity.PlasticSCM.Editor.UI;
|
||||
using Unity.PlasticSCM.Editor.Tool;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Views.History
|
||||
{
|
||||
internal class HistoryListViewMenu
|
||||
{
|
||||
internal interface IMenuOperations
|
||||
{
|
||||
long GetSelectedChangesetId();
|
||||
}
|
||||
|
||||
internal HistoryListViewMenu(
|
||||
IOpenMenuOperations openMenuOperations,
|
||||
IHistoryViewMenuOperations operations,
|
||||
IMenuOperations menuOperations)
|
||||
{
|
||||
mOpenMenuOperations = openMenuOperations;
|
||||
mOperations = operations;
|
||||
mMenuOperations = menuOperations;
|
||||
|
||||
BuildComponents();
|
||||
}
|
||||
|
||||
internal void Popup()
|
||||
{
|
||||
GenericMenu menu = new GenericMenu();
|
||||
|
||||
UpdateMenuItems(menu);
|
||||
|
||||
menu.ShowAsContext();
|
||||
}
|
||||
|
||||
internal bool ProcessKeyActionIfNeeded(Event e)
|
||||
{
|
||||
HistoryMenuOperations operationToExecute = GetMenuOperation(e);
|
||||
|
||||
if (operationToExecute == HistoryMenuOperations.None)
|
||||
return false;
|
||||
|
||||
SelectedHistoryGroupInfo info =
|
||||
mOperations.GetSelectedHistoryGroupInfo();
|
||||
|
||||
HistoryMenuOperations operations =
|
||||
HistoryMenuUpdater.GetAvailableMenuOperations(info);
|
||||
|
||||
if (!operations.HasFlag(operationToExecute))
|
||||
return false;
|
||||
|
||||
ProcessMenuOperation(operationToExecute);
|
||||
return true;
|
||||
}
|
||||
|
||||
void OpenRevisionMenu_Click()
|
||||
{
|
||||
mOpenMenuOperations.Open();
|
||||
}
|
||||
|
||||
void OpenRevisionWithMenu_Click()
|
||||
{
|
||||
mOpenMenuOperations.OpenWith();
|
||||
}
|
||||
|
||||
void SaveRevisionasMenu_Click()
|
||||
{
|
||||
mOperations.SaveRevisionAs();
|
||||
}
|
||||
|
||||
void DiffWithPreviousMenuItem_Click()
|
||||
{
|
||||
mOperations.DiffWithPrevious();
|
||||
}
|
||||
|
||||
void DiffSelectedRevisionsMenu_Click()
|
||||
{
|
||||
mOperations.DiffSelectedRevisions();
|
||||
}
|
||||
|
||||
void DiffChangesetMenu_Click()
|
||||
{
|
||||
mOperations.DiffChangeset();
|
||||
}
|
||||
void RevertToThisRevisionMenu_Click()
|
||||
{
|
||||
mOperations.RevertToThisRevision();
|
||||
}
|
||||
|
||||
void UpdateMenuItems(GenericMenu menu)
|
||||
{
|
||||
SelectedHistoryGroupInfo info =
|
||||
mOperations.GetSelectedHistoryGroupInfo();
|
||||
|
||||
HistoryMenuOperations operations =
|
||||
HistoryMenuUpdater.GetAvailableMenuOperations(info);
|
||||
|
||||
OpenMenuOperations openOperations =
|
||||
GetOpenMenuOperations.ForHistoryView(info);
|
||||
|
||||
if (operations == HistoryMenuOperations.None &&
|
||||
openOperations == OpenMenuOperations.None)
|
||||
{
|
||||
menu.AddDisabledItem(GetNoActionMenuItemContent(), false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (openOperations.HasFlag(OpenMenuOperations.Open))
|
||||
menu.AddItem(mOpenRevisionMenuItemContent, false, OpenRevisionMenu_Click);
|
||||
else
|
||||
menu.AddDisabledItem(mOpenRevisionMenuItemContent, false);
|
||||
|
||||
if (openOperations.HasFlag(OpenMenuOperations.OpenWith))
|
||||
menu.AddItem(mOpenRevisionWithMenuItemContent, false, OpenRevisionWithMenu_Click);
|
||||
else
|
||||
menu.AddDisabledItem(mOpenRevisionWithMenuItemContent, false);
|
||||
|
||||
if (operations.HasFlag(HistoryMenuOperations.SaveAs))
|
||||
menu.AddItem(mSaveRevisionAsMenuItemContent, false, SaveRevisionasMenu_Click);
|
||||
else
|
||||
menu.AddDisabledItem(mSaveRevisionAsMenuItemContent, false);
|
||||
|
||||
menu.AddSeparator(string.Empty);
|
||||
|
||||
if (operations.HasFlag(HistoryMenuOperations.DiffWithPrevious))
|
||||
menu.AddItem(mDiffWithPreviousMenuItemContent, false, DiffWithPreviousMenuItem_Click);
|
||||
|
||||
if (operations.HasFlag(HistoryMenuOperations.DiffSelected))
|
||||
menu.AddItem(mDiffSelectedRevisionsMenuItemContent, false, DiffSelectedRevisionsMenu_Click);
|
||||
|
||||
mDiffChangesetMenuItemContent.text =
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.HistoryMenuItemDiffChangeset) +
|
||||
string.Format(" {0}", GetSelectedChangesetName(mMenuOperations));
|
||||
|
||||
if (operations.HasFlag(HistoryMenuOperations.DiffChangeset))
|
||||
menu.AddItem(mDiffChangesetMenuItemContent, false, DiffChangesetMenu_Click);
|
||||
else
|
||||
menu.AddDisabledItem(mDiffChangesetMenuItemContent, false);
|
||||
|
||||
menu.AddSeparator(string.Empty);
|
||||
|
||||
if (operations.HasFlag(HistoryMenuOperations.RevertTo))
|
||||
menu.AddItem(mRevertToThisRevisionMenuItemContent, false, RevertToThisRevisionMenu_Click);
|
||||
else
|
||||
menu.AddDisabledItem(mRevertToThisRevisionMenuItemContent, false);
|
||||
}
|
||||
|
||||
static HistoryMenuOperations GetMenuOperation(Event e)
|
||||
{
|
||||
if (Keyboard.IsControlOrCommandKeyPressed(e) && Keyboard.IsKeyPressed(e, KeyCode.D))
|
||||
return HistoryMenuOperations.DiffWithPrevious;
|
||||
|
||||
return HistoryMenuOperations.None;
|
||||
}
|
||||
|
||||
void ProcessMenuOperation(HistoryMenuOperations operationToExecute)
|
||||
{
|
||||
if (operationToExecute == HistoryMenuOperations.DiffWithPrevious)
|
||||
{
|
||||
DiffWithPreviousMenuItem_Click();
|
||||
}
|
||||
}
|
||||
|
||||
GUIContent GetNoActionMenuItemContent()
|
||||
{
|
||||
if (mNoActionMenuItemContent == null)
|
||||
{
|
||||
mNoActionMenuItemContent = new GUIContent(
|
||||
PlasticLocalization.GetString(PlasticLocalization.
|
||||
Name.NoActionMenuItem));
|
||||
}
|
||||
|
||||
return mNoActionMenuItemContent;
|
||||
}
|
||||
|
||||
static string GetSelectedChangesetName(IMenuOperations menuOperations)
|
||||
{
|
||||
long selectedChangesetId = menuOperations.GetSelectedChangesetId();
|
||||
|
||||
if (selectedChangesetId == -1)
|
||||
return string.Empty;
|
||||
|
||||
return selectedChangesetId.ToString();
|
||||
}
|
||||
|
||||
void BuildComponents()
|
||||
{
|
||||
mOpenRevisionMenuItemContent = new GUIContent(PlasticLocalization.
|
||||
GetString(PlasticLocalization.Name.HistoryMenuItemOpen));
|
||||
mOpenRevisionWithMenuItemContent = new GUIContent(PlasticLocalization.
|
||||
GetString(PlasticLocalization.Name.HistoryMenuItemOpenWith));
|
||||
mSaveRevisionAsMenuItemContent = new GUIContent(PlasticLocalization.
|
||||
GetString(PlasticLocalization.Name.SaveThisRevisionAs));
|
||||
mDiffWithPreviousMenuItemContent = new GUIContent(string.Format("{0} {1}",
|
||||
PlasticLocalization.GetString(PlasticLocalization.Name.HistoryMenuItemDiffWithPrevious),
|
||||
GetPlasticShortcut.ForDiff()));
|
||||
mDiffSelectedRevisionsMenuItemContent = new GUIContent(PlasticLocalization.
|
||||
GetString(PlasticLocalization.Name.HistoryMenuItemDiffSelectedRevisions));
|
||||
mDiffChangesetMenuItemContent = new GUIContent();
|
||||
mRevertToThisRevisionMenuItemContent = new GUIContent(PlasticLocalization.
|
||||
GetString(PlasticLocalization.Name.HistoryMenuItemRevertToThisRevision));
|
||||
}
|
||||
|
||||
GUIContent mNoActionMenuItemContent;
|
||||
|
||||
GUIContent mOpenRevisionMenuItemContent;
|
||||
GUIContent mOpenRevisionWithMenuItemContent;
|
||||
GUIContent mSaveRevisionAsMenuItemContent;
|
||||
GUIContent mDiffWithPreviousMenuItemContent;
|
||||
GUIContent mDiffSelectedRevisionsMenuItemContent;
|
||||
GUIContent mDiffChangesetMenuItemContent;
|
||||
GUIContent mRevertToThisRevisionMenuItemContent;
|
||||
readonly IOpenMenuOperations mOpenMenuOperations;
|
||||
readonly IHistoryViewMenuOperations mOperations;
|
||||
readonly IMenuOperations mMenuOperations;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c3cec769cd6ff2849aa09c811b62e611
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,52 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
using Codice.CM.Common;
|
||||
using Unity.PlasticSCM.Editor.UI.Tree;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Views.History
|
||||
{
|
||||
internal static class HistorySelection
|
||||
{
|
||||
internal static void SelectRevisions(
|
||||
HistoryListView listView,
|
||||
List<RepObjectInfo> revisionsToSelect)
|
||||
{
|
||||
if (revisionsToSelect == null || revisionsToSelect.Count == 0)
|
||||
{
|
||||
TableViewOperations.SelectFirstRow(listView);
|
||||
return;
|
||||
}
|
||||
|
||||
listView.SelectRepObjectInfos(revisionsToSelect);
|
||||
|
||||
if (listView.HasSelection())
|
||||
return;
|
||||
|
||||
TableViewOperations.SelectFirstRow(listView);
|
||||
}
|
||||
|
||||
internal static List<RepObjectInfo> GetSelectedRepObjectInfos(
|
||||
HistoryListView listView)
|
||||
{
|
||||
return listView.GetSelectedRepObjectInfos();
|
||||
}
|
||||
|
||||
internal static List<HistoryRevision> GetSelectedHistoryRevisions(
|
||||
HistoryListView listView)
|
||||
{
|
||||
return listView.GetSelectedHistoryRevisions();
|
||||
}
|
||||
|
||||
internal static HistoryRevision GetSelectedHistoryRevision(
|
||||
HistoryListView listView)
|
||||
{
|
||||
List<HistoryRevision> revisions =
|
||||
listView.GetSelectedHistoryRevisions();
|
||||
|
||||
if (revisions.Count == 0)
|
||||
return null;
|
||||
|
||||
return revisions[0];
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9553f392d0be2a24daf3cad457d2c612
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,435 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEditor.IMGUI.Controls;
|
||||
using UnityEngine;
|
||||
|
||||
using Codice.Client.BaseCommands.EventTracking;
|
||||
using Codice.CM.Common;
|
||||
using Codice.Client.Common;
|
||||
|
||||
using GluonGui;
|
||||
using PlasticGui;
|
||||
using PlasticGui.WorkspaceWindow;
|
||||
using PlasticGui.WorkspaceWindow.Diff;
|
||||
using PlasticGui.WorkspaceWindow.History;
|
||||
using PlasticGui.WorkspaceWindow.Open;
|
||||
|
||||
using GluonRevertOperation = GluonGui.WorkspaceWindow.Views.Details.History.RevertOperation;
|
||||
using HistoryDescriptor = GluonGui.WorkspaceWindow.Views.Details.History.HistoryDescriptor;
|
||||
using OpenRevisionOperation = PlasticGui.WorkspaceWindow.History.OpenRevisionOperation;
|
||||
|
||||
using Unity.PlasticSCM.Editor.AssetUtils;
|
||||
using Unity.PlasticSCM.Editor.Tool;
|
||||
using Unity.PlasticSCM.Editor.UI;
|
||||
using Unity.PlasticSCM.Editor.UI.Progress;
|
||||
using Unity.PlasticSCM.Editor.UI.Tree;
|
||||
using Unity.PlasticSCM.Editor.Views.Changesets;
|
||||
|
||||
namespace Unity.PlasticSCM.Editor.Views.History
|
||||
{
|
||||
internal class HistoryTab :
|
||||
IRefreshableView,
|
||||
HistoryViewLogic.IHistoryView,
|
||||
HistoryListViewMenu.IMenuOperations,
|
||||
IOpenMenuOperations,
|
||||
IHistoryViewMenuOperations
|
||||
{
|
||||
internal HistoryTab(
|
||||
WorkspaceInfo wkInfo,
|
||||
IWorkspaceWindow workspaceWindow,
|
||||
RepositorySpec repSpec,
|
||||
LaunchTool.IShowDownloadPlasticExeWindow showDownloadPlasticExeWindow,
|
||||
LaunchTool.IProcessExecutor processExecutor,
|
||||
NewIncomingChangesUpdater newIncomingChangesUpdater,
|
||||
ViewHost viewHost,
|
||||
EditorWindow parentWindow,
|
||||
bool isGluonMode)
|
||||
{
|
||||
mWkInfo = wkInfo;
|
||||
mWorkspaceWindow = workspaceWindow;
|
||||
mRepSpec = repSpec;
|
||||
mShowDownloadPlasticExeWindow = showDownloadPlasticExeWindow;
|
||||
mProcessExecutor = processExecutor;
|
||||
mNewIncomingChangesUpdater = newIncomingChangesUpdater;
|
||||
mViewHost = viewHost;
|
||||
mParentWindow = parentWindow;
|
||||
mIsGluonMode = isGluonMode;
|
||||
|
||||
BuildComponents(wkInfo, repSpec);
|
||||
|
||||
mProgressControls = new ProgressControlsForViews();
|
||||
|
||||
mHistoryViewLogic = new HistoryViewLogic(
|
||||
wkInfo, this, mProgressControls);
|
||||
}
|
||||
|
||||
internal void RefreshForItem(
|
||||
long itemId,
|
||||
string path,
|
||||
bool isDirectory)
|
||||
{
|
||||
mItemId = itemId;
|
||||
mPath = path;
|
||||
mIsDirectory = isDirectory;
|
||||
|
||||
((IRefreshableView)this).Refresh();
|
||||
}
|
||||
|
||||
internal void Update()
|
||||
{
|
||||
mProgressControls.UpdateProgress(mParentWindow);
|
||||
}
|
||||
|
||||
internal void OnGUI()
|
||||
{
|
||||
DoActionsToolbar(
|
||||
this,
|
||||
mProgressControls,
|
||||
mSearchField,
|
||||
mHistoryListView,
|
||||
GetViewTitle(mPath));
|
||||
|
||||
DoHistoryArea(
|
||||
mHistoryListView,
|
||||
mProgressControls.IsOperationRunning());
|
||||
}
|
||||
|
||||
internal void DrawSearchFieldForHistoryTab()
|
||||
{
|
||||
DrawSearchField.For(
|
||||
mSearchField,
|
||||
mHistoryListView,
|
||||
UnityConstants.SEARCH_FIELD_WIDTH);
|
||||
}
|
||||
|
||||
internal void OnDisable()
|
||||
{
|
||||
mSearchField.downOrUpArrowKeyPressed -=
|
||||
SearchField_OnDownOrUpArrowKeyPressed;
|
||||
|
||||
TreeHeaderSettings.Save(
|
||||
mHistoryListView.multiColumnHeader.state,
|
||||
UnityConstants.HISTORY_TABLE_SETTINGS_NAME);
|
||||
}
|
||||
|
||||
void IRefreshableView.Refresh()
|
||||
{
|
||||
mHistoryViewLogic.RefreshForItem(mRepSpec, mItemId);
|
||||
}
|
||||
|
||||
List<RepObjectInfo> HistoryViewLogic.IHistoryView.GetSelectedRevisions()
|
||||
{
|
||||
return HistorySelection.GetSelectedRepObjectInfos(mHistoryListView);
|
||||
}
|
||||
|
||||
void HistoryViewLogic.IHistoryView.SelectRevisions(
|
||||
List<RepObjectInfo> revisionsToSelect)
|
||||
{
|
||||
HistorySelection.SelectRevisions(
|
||||
mHistoryListView, revisionsToSelect);
|
||||
}
|
||||
|
||||
void HistoryViewLogic.IHistoryView.UpdateData(
|
||||
Dictionary<BranchInfo, ChangesetInfo> branchesAndChangesets,
|
||||
BranchInfo workingBranch,
|
||||
HistoryRevisionList list,
|
||||
long loadedRevisionId)
|
||||
{
|
||||
mHistoryListView.BuildModel(list, loadedRevisionId);
|
||||
|
||||
mHistoryListView.Refilter();
|
||||
|
||||
mHistoryListView.Sort();
|
||||
|
||||
mHistoryListView.Reload();
|
||||
}
|
||||
|
||||
long HistoryListViewMenu.IMenuOperations.GetSelectedChangesetId()
|
||||
{
|
||||
HistoryRevision revision = HistorySelection.
|
||||
GetSelectedHistoryRevision(mHistoryListView);
|
||||
|
||||
if (revision == null)
|
||||
return -1;
|
||||
|
||||
return revision.ChangeSet;
|
||||
}
|
||||
|
||||
SelectedHistoryGroupInfo IHistoryViewMenuOperations.GetSelectedHistoryGroupInfo()
|
||||
{
|
||||
return SelectedHistoryGroupInfo.BuildFromSelection(
|
||||
HistorySelection.GetSelectedRepObjectInfos(mHistoryListView),
|
||||
HistorySelection.GetSelectedHistoryRevisions(mHistoryListView),
|
||||
mHistoryListView.GetLoadedRevisionId(),
|
||||
mIsDirectory);
|
||||
}
|
||||
|
||||
void IOpenMenuOperations.Open()
|
||||
{
|
||||
OpenRevisionOperation.Open(
|
||||
mRepSpec,
|
||||
Path.GetFileName(mPath),
|
||||
HistorySelection.GetSelectedHistoryRevisions(
|
||||
mHistoryListView));
|
||||
}
|
||||
|
||||
void IOpenMenuOperations.OpenWith()
|
||||
{
|
||||
List<HistoryRevision> revisions = HistorySelection.
|
||||
GetSelectedHistoryRevisions(mHistoryListView);
|
||||
|
||||
OpenRevisionOperation.OpenWith(
|
||||
mRepSpec,
|
||||
FileSystemOperation.GetExePath(),
|
||||
Path.GetFileName(mPath),
|
||||
revisions);
|
||||
}
|
||||
|
||||
void IOpenMenuOperations.OpenWithCustom(string exePath, string args)
|
||||
{
|
||||
}
|
||||
|
||||
void IOpenMenuOperations.OpenInExplorer()
|
||||
{
|
||||
}
|
||||
|
||||
void IHistoryViewMenuOperations.SaveRevisionAs()
|
||||
{
|
||||
TrackFeatureUseEvent.For(
|
||||
PlasticGui.Plastic.API.GetRepositorySpec(mWkInfo),
|
||||
TrackFeatureUseEvent.Features.SaveRevisionFromFileHistory);
|
||||
|
||||
HistoryRevision revision = HistorySelection.
|
||||
GetSelectedHistoryRevision(mHistoryListView);
|
||||
|
||||
string defaultFileName = DefaultRevisionName.Get(
|
||||
Path.GetFileName(mPath), revision.ChangeSet);
|
||||
|
||||
string destinationPath = SaveAction.GetDestinationPath(
|
||||
mWkInfo.ClientPath, mPath, defaultFileName);
|
||||
|
||||
if (string.IsNullOrEmpty(destinationPath))
|
||||
return;
|
||||
|
||||
SaveRevisionOperation.SaveRevision(
|
||||
mRepSpec,
|
||||
destinationPath,
|
||||
revision,
|
||||
mProgressControls);
|
||||
}
|
||||
|
||||
void IHistoryViewMenuOperations.DiffWithPrevious()
|
||||
{
|
||||
if (mShowDownloadPlasticExeWindow.Show(
|
||||
mRepSpec,
|
||||
mIsGluonMode,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticCloudFromDiffRevision,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticEnterpriseFromDiffRevision,
|
||||
TrackFeatureUseEvent.Features.CancelPlasticInstallationFromDiffRevision))
|
||||
return;
|
||||
|
||||
HistoryRevision revision = HistorySelection.
|
||||
GetSelectedHistoryRevision(mHistoryListView);
|
||||
|
||||
DiffOperation.DiffWithPrevious(
|
||||
mWkInfo,
|
||||
mRepSpec,
|
||||
Path.GetFileName(mPath),
|
||||
string.Empty,
|
||||
revision.Id,
|
||||
mItemId,
|
||||
revision.ChangeSet,
|
||||
mProgressControls,
|
||||
null,
|
||||
null);
|
||||
}
|
||||
|
||||
void IHistoryViewMenuOperations.DiffSelectedRevisions()
|
||||
{
|
||||
if(mShowDownloadPlasticExeWindow.Show(
|
||||
mRepSpec,
|
||||
mIsGluonMode,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticCloudFromDiffSelectedRevisions,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticEnterpriseFromDiffSelectedRevisions,
|
||||
TrackFeatureUseEvent.Features.CancelPlasticInstallationFromDiffSelectedRevisions))
|
||||
return;
|
||||
|
||||
List<HistoryRevision> revisions = HistorySelection.
|
||||
GetSelectedHistoryRevisions(mHistoryListView);
|
||||
|
||||
bool areReversed = revisions[0].Id > revisions[1].Id;
|
||||
|
||||
DiffOperation.DiffRevisions(
|
||||
mWkInfo,
|
||||
mRepSpec,
|
||||
Path.GetFileName(mPath),
|
||||
string.Empty,
|
||||
mItemId,
|
||||
revisions[(areReversed) ? 1 : 0],
|
||||
revisions[(areReversed) ? 0 : 1],
|
||||
mProgressControls,
|
||||
null,
|
||||
null);
|
||||
}
|
||||
|
||||
void IHistoryViewMenuOperations.DiffChangeset()
|
||||
{
|
||||
if (mShowDownloadPlasticExeWindow.Show(
|
||||
mRepSpec,
|
||||
mIsGluonMode,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticCloudFromDiffChangeset,
|
||||
TrackFeatureUseEvent.Features.InstallPlasticEnterpriseFromDiffChangeset,
|
||||
TrackFeatureUseEvent.Features.CancelPlasticInstallationFromDiffChangeset))
|
||||
return;
|
||||
|
||||
HistoryRevision revision = HistorySelection.
|
||||
GetSelectedHistoryRevision(mHistoryListView);
|
||||
|
||||
LaunchDiffOperations.DiffChangeset(
|
||||
mShowDownloadPlasticExeWindow,
|
||||
mProcessExecutor,
|
||||
mRepSpec,
|
||||
revision.ChangeSet,
|
||||
mIsGluonMode);
|
||||
}
|
||||
|
||||
void IHistoryViewMenuOperations.RevertToThisRevision()
|
||||
{
|
||||
HistoryRevision revision = HistorySelection.
|
||||
GetSelectedHistoryRevision(mHistoryListView);
|
||||
|
||||
string fullPath = GetFullPath(mWkInfo.ClientPath, mPath);
|
||||
|
||||
if (mIsGluonMode)
|
||||
{
|
||||
HistoryDescriptor historyDescriptor = new HistoryDescriptor(
|
||||
mRepSpec, fullPath, mItemId, revision.Id, mIsDirectory);
|
||||
|
||||
GluonRevertOperation.RevertToThisRevision(
|
||||
mWkInfo,
|
||||
mViewHost,
|
||||
mProgressControls,
|
||||
historyDescriptor,
|
||||
revision,
|
||||
RefreshAsset.UnityAssetDatabase);
|
||||
return;
|
||||
}
|
||||
|
||||
RevertOperation.RevertToThisRevision(
|
||||
mWkInfo,
|
||||
mProgressControls,
|
||||
mWorkspaceWindow,
|
||||
mRepSpec,
|
||||
revision,
|
||||
fullPath,
|
||||
mNewIncomingChangesUpdater,
|
||||
RefreshAsset.UnityAssetDatabase);
|
||||
}
|
||||
|
||||
void SearchField_OnDownOrUpArrowKeyPressed()
|
||||
{
|
||||
mHistoryListView.SetFocusAndEnsureSelectedItem();
|
||||
}
|
||||
|
||||
static string GetFullPath(string wkPath, string path)
|
||||
{
|
||||
if (PathHelper.IsContainedOn(path, wkPath))
|
||||
return path;
|
||||
|
||||
return WorkspacePath.GetWorkspacePathFromCmPath(
|
||||
wkPath, path, Path.DirectorySeparatorChar);
|
||||
}
|
||||
|
||||
static void DoActionsToolbar(
|
||||
IRefreshableView refreshableView,
|
||||
ProgressControlsForViews progressControls,
|
||||
SearchField searchField,
|
||||
HistoryListView listView,
|
||||
string viewTitle)
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
|
||||
|
||||
GUILayout.Label(
|
||||
viewTitle,
|
||||
UnityStyles.HistoryTab.HeaderLabel);
|
||||
|
||||
if (progressControls.IsOperationRunning())
|
||||
{
|
||||
DrawProgressForViews.ForIndeterminateProgress(
|
||||
progressControls.ProgressData);
|
||||
}
|
||||
|
||||
GUILayout.FlexibleSpace();
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
static void DoHistoryArea(
|
||||
HistoryListView historyListView,
|
||||
bool isOperationRunning)
|
||||
{
|
||||
GUI.enabled = !isOperationRunning;
|
||||
|
||||
Rect rect = GUILayoutUtility.GetRect(0, 100000, 0, 100000);
|
||||
|
||||
historyListView.OnGUI(rect);
|
||||
|
||||
GUI.enabled = true;
|
||||
}
|
||||
|
||||
static string GetViewTitle(string path)
|
||||
{
|
||||
path = PathHelper.RemoveLastSlash(
|
||||
path, Path.DirectorySeparatorChar);
|
||||
|
||||
return PlasticLocalization.GetString(
|
||||
PlasticLocalization.Name.HistoryViewTitle,
|
||||
Path.GetFileName(path));
|
||||
}
|
||||
|
||||
void BuildComponents(
|
||||
WorkspaceInfo wkInfo,
|
||||
RepositorySpec repSpec)
|
||||
{
|
||||
mSearchField = new SearchField();
|
||||
mSearchField.downOrUpArrowKeyPressed += SearchField_OnDownOrUpArrowKeyPressed;
|
||||
|
||||
HistoryListHeaderState headerState =
|
||||
HistoryListHeaderState.GetDefault();
|
||||
TreeHeaderSettings.Load(headerState,
|
||||
UnityConstants.HISTORY_TABLE_SETTINGS_NAME,
|
||||
(int)HistoryListColumn.CreationDate,
|
||||
false);
|
||||
|
||||
mHistoryListView = new HistoryListView(
|
||||
wkInfo.ClientPath,
|
||||
repSpec,
|
||||
headerState,
|
||||
new HistoryListViewMenu(this, this, this),
|
||||
HistoryListHeaderState.GetColumnNames());
|
||||
|
||||
mHistoryListView.Reload();
|
||||
}
|
||||
|
||||
SearchField mSearchField;
|
||||
HistoryListView mHistoryListView;
|
||||
|
||||
long mItemId;
|
||||
string mPath;
|
||||
bool mIsDirectory;
|
||||
|
||||
readonly WorkspaceInfo mWkInfo;
|
||||
readonly HistoryViewLogic mHistoryViewLogic;
|
||||
readonly ProgressControlsForViews mProgressControls;
|
||||
readonly IWorkspaceWindow mWorkspaceWindow;
|
||||
readonly LaunchTool.IProcessExecutor mProcessExecutor;
|
||||
readonly LaunchTool.IShowDownloadPlasticExeWindow mShowDownloadPlasticExeWindow;
|
||||
readonly RepositorySpec mRepSpec;
|
||||
readonly bool mIsGluonMode;
|
||||
readonly EditorWindow mParentWindow;
|
||||
readonly ViewHost mViewHost;
|
||||
readonly NewIncomingChangesUpdater mNewIncomingChangesUpdater;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3a49359b59c12b74386ca6816923ec2c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,38 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 025a530ab434a7e40ad318955f571e50
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue