Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4512 from cra0zy/multundo
[Win Pipeline] Fix Multiselect Undo/Redo
- Loading branch information
Showing
4 changed files
with
79 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
Tools/Pipeline/Common/PipelineController.UpdateContentItemAction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// MonoGame - Copyright (C) The MonoGame Team | ||
// This file is subject to the terms and conditions defined in | ||
// file 'LICENSE.txt', which is part of this source code package. | ||
|
||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace MonoGame.Tools.Pipeline | ||
{ | ||
internal class UpdateContentItemAction : IProjectAction | ||
{ | ||
private readonly IView _view; | ||
private readonly IController _con; | ||
private List<ContentItemState> _states; | ||
|
||
public UpdateContentItemAction(IView view, IController con, IEnumerable<ContentItemState> states) | ||
{ | ||
_view = view; | ||
_con = con; | ||
_states = states.ToList(); | ||
} | ||
|
||
public bool Do() | ||
{ | ||
Toggle(); | ||
return true; | ||
} | ||
|
||
public bool Undo() | ||
{ | ||
Toggle(); | ||
return true; | ||
} | ||
|
||
private void Toggle() | ||
{ | ||
for (int i = 0; i < _states.Count; i++) | ||
{ | ||
var item = (ContentItem)_con.GetItem(_states[i].SourceFile); | ||
var state = ContentItemState.Get(item); | ||
_states[i].Apply(item); | ||
_states[i] = state; | ||
|
||
item.ResolveTypes(); | ||
|
||
_view.BeginTreeUpdate(); | ||
_view.UpdateProperties(item); | ||
_view.UpdateTreeItem(item); | ||
_view.EndTreeUpdate(); | ||
} | ||
} | ||
} | ||
} |
80 changes: 6 additions & 74 deletions
80
Tools/Pipeline/Windows/UpdateAction.cs → ...PipelineController.UpdateProjectAction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d7a383c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TeamCity MonoGame :: Develop (Win) Build 3.5.0.1342 is now running
d7a383c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TeamCity MonoGame :: Develop (Win) Build 3.5.0.1342 outcome was SUCCESS
Summary: Tests passed: 584, ignored: 6 Build time: 00:20:05