Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLluis Sanchez <lluis@xamarin.com>2019-09-06 18:33:17 +0300
committerGitHub <noreply@github.com>2019-09-06 18:33:17 +0300
commitc561487480e8ff4ce3db0ba3de1ed8d90abb6560 (patch)
tree6ad924ae36bf6a5d689b0b60dfc2b24e6c4c41ac
parent13b83fb95e81138984784492e46382a8defa9735 (diff)
parent5f24a5dbe06db615f71e50e762031c92af289c8a (diff)
Merge pull request #8652 from mono/backport-pr-8645-to-release-8.3-prebiew3.1monodevelop-8.3.0.1583release-8.3-prebiew3.1
[release-8.3-prebiew3.1] [release-8.3] Revert "[VersionControl] Document controller now reacts on file status change."
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlDocumentController.cs77
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/DocumentView.cs8
2 files changed, 8 insertions, 77 deletions
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlDocumentController.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlDocumentController.cs
index 0b9082bfd3..e843005e61 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlDocumentController.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlDocumentController.cs
@@ -49,7 +49,6 @@ namespace MonoDevelop.VersionControl
DocumentView blameView;
DocumentView logView;
DocumentView mergeView;
- private DocumentView mainView;
public override async Task<bool> SupportsController (DocumentController controller)
{
@@ -71,84 +70,22 @@ namespace MonoDevelop.VersionControl
repo = VersionControlService.GetRepository (project);
if (repo == null)
return false;
-
- return true;
+ return repo.TryGetVersionInfo (fileController.FilePath, out var info) && info.IsVersioned;
}
protected internal override async Task<DocumentView> OnInitializeView ()
{
- mainView = await base.OnInitializeView ();
+ var mainView = await base.OnInitializeView ();
var controller = (FileDocumentController)Controller;
var item = new VersionControlItem (repo, project, controller.FilePath, false, null);
vcInfo = new VersionControlDocumentInfo (this, Controller, item, item.Repository);
vcInfo.Document = Controller.Document;
- await UpdateSubviewsAsync ();
- VersionControlService.FileStatusChanged += VersionControlService_FileStatusChanged;
- return mainView;
- }
-
- public override void Dispose ()
- {
- VersionControlService.FileStatusChanged -= VersionControlService_FileStatusChanged;
- base.Dispose ();
- }
-
- void VersionControlService_FileStatusChanged (object sender, FileUpdateEventArgs args)
- {
-
- foreach (var file in args) {
- if (!vcInfo.Document.FilePath.IsNullOrEmpty && vcInfo.Document.FilePath.Equals (file.FilePath)) {
- Runtime.RunInMainThread (async () => {
- await UpdateSubviewsAsync ();
- });
- }
- }
- }
- bool showSubviews;
- async Task UpdateSubviewsAsync ()
- {
- var hasVersionInfo = repo.TryGetVersionInfo (this.vcInfo.Document.FilePath, out var info);
- if (hasVersionInfo)
- vcInfo.Item.VersionInfo = info;
-
- if (!hasVersionInfo || !info.IsVersioned) {
- if (!showSubviews)
- return;
- showSubviews = false;
- if (diffView != null) {
- mainView.AttachedViews.Remove (diffView);
- diffView.Dispose ();
- diffView = null;
- }
-
- if (blameView != null) {
- mainView.AttachedViews.Remove (blameView);
- blameView.Dispose ();
- blameView = null;
- }
-
- if (logView != null) {
- mainView.AttachedViews.Remove (logView);
- logView.Dispose ();
- logView = null;
- }
-
- if (mergeView != null) {
- mainView.AttachedViews.Remove (mergeView);
- mergeView.Dispose ();
- mergeView = null;
- }
-
- } else {
- if (showSubviews)
- return;
- showSubviews = true;
- diffView = await TryAttachView (mainView, vcInfo, DiffCommand.DiffViewHandlers, GettextCatalog.GetString ("Changes"), GettextCatalog.GetString ("Shows the differences in the code between the current code and the version in the repository"));
- blameView = await TryAttachView (mainView, vcInfo, BlameCommand.BlameViewHandlers, GettextCatalog.GetString ("Authors"), GettextCatalog.GetString ("Shows the authors of the current file"));
- logView = await TryAttachView (mainView, vcInfo, LogCommand.LogViewHandlers, GettextCatalog.GetString ("Log"), GettextCatalog.GetString ("Shows the source control log for the current file"));
- mergeView = await TryAttachView (mainView, vcInfo, MergeCommand.MergeViewHandlers, GettextCatalog.GetString ("Merge"), GettextCatalog.GetString ("Shows the merge view for the current file"));
- }
+ diffView = await TryAttachView (mainView, vcInfo, DiffCommand.DiffViewHandlers, GettextCatalog.GetString ("Changes"), GettextCatalog.GetString ("Shows the differences in the code between the current code and the version in the repository"));
+ blameView = await TryAttachView (mainView, vcInfo, BlameCommand.BlameViewHandlers, GettextCatalog.GetString ("Authors"), GettextCatalog.GetString ("Shows the authors of the current file"));
+ logView = await TryAttachView (mainView, vcInfo, LogCommand.LogViewHandlers, GettextCatalog.GetString ("Log"), GettextCatalog.GetString ("Shows the source control log for the current file"));
+ mergeView = await TryAttachView (mainView, vcInfo, MergeCommand.MergeViewHandlers, GettextCatalog.GetString ("Merge"), GettextCatalog.GetString ("Shows the merge view for the current file"));
+ return mainView;
}
async Task<DocumentView> TryAttachView (DocumentView mainView, VersionControlDocumentInfo info, string type, string title, string description)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/DocumentView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/DocumentView.cs
index 4653c8cc37..c942826160 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/DocumentView.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/DocumentView.cs
@@ -363,7 +363,6 @@ namespace MonoDevelop.Ide.Gui.Documents
mainShellView.LostFocus += ShellContentView_LostFocus;
if (IsRoot && AttachedViews.Count > 0) {
CreateAttachmentsContainer ();
- InitializeAttachmentsContainer ();
} else
shellView = mainShellView;
@@ -383,16 +382,12 @@ namespace MonoDevelop.Ide.Gui.Documents
int pos = 1;
foreach (var attachedView in AttachedViews)
attachmentsContainer.InsertView (pos++, attachedView.CreateShellView (window));
- shellView = attachmentsContainer;
- }
-
- private void InitializeAttachmentsContainer ()
- {
if (activeAttachedView == this)
attachmentsContainer.ActiveView = mainShellView;
else
attachmentsContainer.ActiveView = activeAttachedView?.ShellView;
attachmentsContainer.ActiveViewChanged += AttachmentsContainer_ActiveViewChanged;
+ shellView = attachmentsContainer;
}
private void ShellContentView_GotFocus (object sender, EventArgs e)
@@ -453,7 +448,6 @@ namespace MonoDevelop.Ide.Gui.Documents
CreateAttachmentsContainer ();
UpdateTitle ();
ReplaceViewInParent ();
- InitializeAttachmentsContainer ();
}
} else {
if (attachmentsContainer != null) {