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
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ActionGroupDisplayBinding.cs1
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderDisplayBinding.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/BaseViewContent.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/FileViewer.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs41
5 files changed, 33 insertions, 18 deletions
diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ActionGroupDisplayBinding.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ActionGroupDisplayBinding.cs
index d472880aeb..3d8ce1c890 100644
--- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ActionGroupDisplayBinding.cs
+++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ActionGroupDisplayBinding.cs
@@ -87,6 +87,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder
GtkDesignInfo info = GtkDesignInfo.FromProject ((DotNetProject) ownerProject);
var content = db.CreateContent (fileName, mimeType, ownerProject);
+ content.Binding = db;
ActionGroupView view = new ActionGroupView (content, GetActionGroup (fileName), info.GuiBuilderProject);
excludeThis = false;
return view;
diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderDisplayBinding.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderDisplayBinding.cs
index c9f93016f6..1a4ff83c4c 100644
--- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderDisplayBinding.cs
+++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderDisplayBinding.cs
@@ -73,6 +73,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder
excludeThis = true;
var db = DisplayBindingService.GetDefaultViewBinding (fileName, mimeType, ownerProject);
var content = db.CreateContent (fileName, mimeType, ownerProject);
+ content.Binding = db;
var window = GetWindow (fileName, ownerProject);
if (window == null)
throw new InvalidOperationException ("GetWindow == null");
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/BaseViewContent.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/BaseViewContent.cs
index a879a3d30c..1762462f49 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/BaseViewContent.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/BaseViewContent.cs
@@ -147,6 +147,12 @@ namespace MonoDevelop.Ide.Gui
return ProjectReloadCapability.None;
}
}
+
+ /// <summary>
+ /// Gets the display binding of this view.
+ /// </summary>
+ /// <value>The display binding used to create this view.</value>
+ public IDisplayBinding Binding { get; internal set; }
}
public enum ProjectReloadCapability
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/FileViewer.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/FileViewer.cs
index a39569c75c..87c60c2123 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/FileViewer.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/FileViewer.cs
@@ -93,7 +93,7 @@ namespace MonoDevelop.Ide.Gui
public Task<Document> OpenFile (string filePath, Encoding encoding)
{
if (binding != null)
- return IdeApp.Workbench.OpenDocument (filePath, null, -1, -1, OpenDocumentOptions.Default, encoding, binding);
+ return IdeApp.Workbench.OpenDocument (filePath, null, -1, -1, OpenDocumentOptions.Default & ~OpenDocumentOptions.TryToReuseViewer, encoding, binding);
else {
app.Launch (filePath);
return Task.FromResult<Document> (null);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs
index a9740894c3..5f40296907 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs
@@ -556,32 +556,37 @@ namespace MonoDevelop.Ide.Gui
// Ensure that paths like /a/./a.cs are equalized
using (Counters.OpenDocumentTimer.BeginTiming ("Opening file " + info.FileName)) {
NavigationHistoryService.LogActiveDocument ();
- if (info.Options.HasFlag (OpenDocumentOptions.TryToReuseViewer)) {
- Counters.OpenDocumentTimer.Trace ("Look for open document");
- foreach (Document doc in Documents) {
- BaseViewContent vcFound = null;
-
- //search all ViewContents to see if they can "re-use" this filename
- if (doc.Window.ViewContent.CanReuseView (info.FileName))
- vcFound = doc.Window.ViewContent;
-
- //old method as fallback
- if ((vcFound == null) && (doc.FileName.CanonicalPath == info.FileName)) // info.FileName is already Canonical
- vcFound = doc.Window.ViewContent;
- //if found, select window and jump to line
- if (vcFound != null) {
+ Counters.OpenDocumentTimer.Trace ("Look for open document");
+ foreach (Document doc in Documents) {
+ BaseViewContent vcFound = null;
+
+ //search all ViewContents to see if they can "re-use" this filename
+ if (doc.Window.ViewContent.CanReuseView (info.FileName))
+ vcFound = doc.Window.ViewContent;
+
+ //old method as fallback
+ if ((vcFound == null) && (doc.FileName.CanonicalPath == info.FileName)) // info.FileName is already Canonical
+ vcFound = doc.Window.ViewContent;
+ //if found, try to reuse or close the old view
+ if (vcFound != null) {
+ // reuse the view if the binidng didn't change
+ if (info.Options.HasFlag (OpenDocumentOptions.TryToReuseViewer) || vcFound.Binding == info.DisplayBinding) {
if (info.Project != null && doc.Project != info.Project) {
- doc.SetProject (info.Project);
+ doc.SetProject (info.Project);
}
ScrollToRequestedCaretLocation (doc, info);
-
+
if (info.Options.HasFlag (OpenDocumentOptions.BringToFront)) {
doc.Select ();
doc.Window.SelectWindow ();
NavigationHistoryService.LogActiveDocument ();
}
return doc;
+ } else {
+ if (!doc.Close ())
+ return doc;
+ break;
}
}
}
@@ -673,6 +678,7 @@ namespace MonoDevelop.Ide.Gui
newContent.UntitledName = defaultName;
newContent.IsDirty = true;
+ newContent.Binding = binding;
workbench.ShowView (newContent, true, binding);
var document = WrapDocument (newContent.WorkbenchWindow);
@@ -1541,7 +1547,8 @@ namespace MonoDevelop.Ide.Gui
monitor.ReportError (GettextCatalog.GetString ("The file '{0}' could not be opened.", fileName), null);
return false;
}
-
+
+ newContent.Binding = binding;
if (project != null)
newContent.Project = project;