[Monodevelop-patches-list] r2171 - in trunk/MonoDevelop/Core/src/MonoDevelop.Base: . Gui Gui/Workbench Internal/Templates/ProjectTemplates Services/File Services/Project
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Wed Jan 26 19:33:22 EST 2005
Author: lluis
Date: 2005-01-26 19:33:22 -0500 (Wed, 26 Jan 2005)
New Revision: 2171
Modified:
trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/IWorkbench.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/DefaultWorkbench.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/ProjectTemplate.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/File/DefaultFileService.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/File/IFileService.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/DefaultProjectService.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/IProjectService.cs
Log:
2005-01-27 Lluis Sanchez Gual <lluis at novell.com>
* Gui/IWorkbench.cs:
* Gui/Workbench/DefaultWorkbench.cs:
* Services/File/IFileService.cs:
* Services/File/DefaultFileService.cs: Added BringToFront parameter
in OpenFile.
* IProjectService.cs:
* Services/Project/DefaultProjectService.cs: Return IAsyncOperation
in OpenCombine, so the load operation can be controlled.
Use the new BringToFront parameter set to false when opening the
files of a combine. No more window dances.
* Internal/Templates/ProjectTemplates/ProjectTemplate.cs: Wait for
the combine to be completely loaded before opening the project
files. This fixes #61028.
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog 2005-01-26 23:54:31 UTC (rev 2170)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog 2005-01-27 00:33:22 UTC (rev 2171)
@@ -1,3 +1,21 @@
+2005-01-27 Lluis Sanchez Gual <lluis at novell.com>
+
+ * Gui/IWorkbench.cs:
+ * Gui/Workbench/DefaultWorkbench.cs:
+ * Services/File/IFileService.cs:
+ * Services/File/DefaultFileService.cs: Added BringToFront parameter
+ in OpenFile.
+
+ * IProjectService.cs:
+ * Services/Project/DefaultProjectService.cs: Return IAsyncOperation
+ in OpenCombine, so the load operation can be controlled.
+ Use the new BringToFront parameter set to false when opening the
+ files of a combine. No more window dances.
+
+ * Internal/Templates/ProjectTemplates/ProjectTemplate.cs: Wait for
+ the combine to be completely loaded before opening the project
+ files. This fixes #61028.
+
2005-01-26 Lluis Sanchez Gual <lluis at novell.com>
* Services/Tasks/StatusProgressMonitor.cs: Forgot to save the
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/IWorkbench.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/IWorkbench.cs 2005-01-26 23:54:31 UTC (rev 2170)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/IWorkbench.cs 2005-01-27 00:33:22 UTC (rev 2171)
@@ -58,7 +58,7 @@
/// <summary>
/// Inserts a new <see cref="IViewContent"/> object in the workspace.
/// </summary>
- void ShowView(IViewContent content);
+ void ShowView (IViewContent content, bool bringToFront);
/// <summary>
/// Inserts a new <see cref="IPadContent"/> object in the workspace.
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/DefaultWorkbench.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/DefaultWorkbench.cs 2005-01-26 23:54:31 UTC (rev 2170)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/DefaultWorkbench.cs 2005-01-27 00:33:22 UTC (rev 2171)
@@ -267,7 +267,7 @@
}
}
- public virtual void ShowView(IViewContent content)
+ public virtual void ShowView (IViewContent content, bool bringToFront)
{
Debug.Assert(layout != null);
ViewContentCollection.Add(content);
@@ -284,7 +284,9 @@
layout.ShowView(content);
- content.WorkbenchWindow.SelectWindow();
+ if (bringToFront)
+ content.WorkbenchWindow.SelectWindow();
+
ShowAll ();
RedrawAllComponents ();
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/ProjectTemplate.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/ProjectTemplate.cs 2005-01-26 23:54:31 UTC (rev 2170)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/ProjectTemplate.cs 2005-01-27 00:33:22 UTC (rev 2171)
@@ -194,10 +194,11 @@
public void OpenCreatedCombine()
{
- Runtime.ProjectService.OpenCombine(lastCombine);
-
- foreach (OpenFileAction action in actions) {
- action.Run(projectCreateInformation);
+ IAsyncOperation op = Runtime.ProjectService.OpenCombine (lastCombine);
+ op.WaitForCompleted ();
+ if (op.Success) {
+ foreach (OpenFileAction action in actions)
+ action.Run(projectCreateInformation);
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/File/DefaultFileService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/File/DefaultFileService.cs 2005-01-26 23:54:31 UTC (rev 2170)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/File/DefaultFileService.cs 2005-01-27 00:33:22 UTC (rev 2171)
@@ -29,6 +29,7 @@
{
public FileOpeningFinished OnFileOpened;
public string FileName;
+ public bool BringToFront;
}
public RecentOpen RecentOpen {
@@ -52,14 +53,17 @@
{
IDisplayBinding binding;
Project project;
+ bool select;
- public LoadFileWrapper(IDisplayBinding binding)
+ public LoadFileWrapper(IDisplayBinding binding, bool select)
{
+ this.select = select;
this.binding = binding;
}
- public LoadFileWrapper(IDisplayBinding binding, Project project)
+ public LoadFileWrapper(IDisplayBinding binding, Project project, bool select)
{
+ this.select = select;
this.binding = binding;
this.project = project;
}
@@ -72,23 +76,34 @@
newContent.HasProject = true;
newContent.Project = project;
}
- WorkbenchSingleton.Workbench.ShowView(newContent);
+ WorkbenchSingleton.Workbench.ShowView (newContent, select);
Runtime.Gui.DisplayBindings.AttachSubWindows(newContent.WorkbenchWindow);
}
}
public void OpenFile (string fileName)
{
+ OpenFile (fileName, true);
+ }
+
+ public void OpenFile (string fileName, bool bringToFront)
+ {
FileInformation openFileInfo=new FileInformation();
openFileInfo.OnFileOpened=null;
openFileInfo.FileName=fileName;
+ openFileInfo.BringToFront = bringToFront;
Runtime.DispatchService.GuiDispatch (new StatefulMessageHandler (realOpenFile), openFileInfo);
}
- public void OpenFile (string fileName, FileOpeningFinished OnFileOpened){
+ public void OpenFile (string fileName, FileOpeningFinished OnFileOpened) {
+ OpenFile (fileName, true, OnFileOpened);
+ }
+
+ public void OpenFile (string fileName, bool bringToFront, FileOpeningFinished OnFileOpened){
FileInformation openFileInfo=new FileInformation();
openFileInfo.OnFileOpened=OnFileOpened;
openFileInfo.FileName=fileName;
+ openFileInfo.BringToFront = bringToFront;
Runtime.DispatchService.GuiDispatch (new StatefulMessageHandler (realOpenFile), openFileInfo);
}
@@ -154,13 +169,13 @@
if (combine != null && project != null)
{
- if (Runtime.FileUtilityService.ObservedLoad(new NamedFileOperationDelegate(new LoadFileWrapper(binding, project).Invoke), fileName) == FileOperationResult.OK) {
+ if (Runtime.FileUtilityService.ObservedLoad(new NamedFileOperationDelegate(new LoadFileWrapper(binding, project, oFileInfo.BringToFront).Invoke), fileName) == FileOperationResult.OK) {
Runtime.FileService.RecentOpen.AddLastFile (fileName, project.Name);
}
}
else
{
- if (Runtime.FileUtilityService.ObservedLoad(new NamedFileOperationDelegate(new LoadFileWrapper(binding, null).Invoke), fileName) == FileOperationResult.OK) {
+ if (Runtime.FileUtilityService.ObservedLoad(new NamedFileOperationDelegate(new LoadFileWrapper(binding, null, oFileInfo.BringToFront).Invoke), fileName) == FileOperationResult.OK) {
Runtime.FileService.RecentOpen.AddLastFile (fileName, null);
}
}
@@ -174,7 +189,7 @@
Gnome.Url.Show ("file://" + fileName);
}
} catch {
- if (Runtime.FileUtilityService.ObservedLoad(new NamedFileOperationDelegate (new LoadFileWrapper (Runtime.Gui.DisplayBindings.LastBinding, null).Invoke), fileName) == FileOperationResult.OK) {
+ if (Runtime.FileUtilityService.ObservedLoad(new NamedFileOperationDelegate (new LoadFileWrapper (Runtime.Gui.DisplayBindings.LastBinding, null, oFileInfo.BringToFront).Invoke), fileName) == FileOperationResult.OK) {
Runtime.FileService.RecentOpen.AddLastFile (fileName, null);
}
}
@@ -208,7 +223,7 @@
}
newContent.UntitledName = defaultName;
newContent.IsDirty = false;
- WorkbenchSingleton.Workbench.ShowView(newContent);
+ WorkbenchSingleton.Workbench.ShowView(newContent, true);
Runtime.Gui.DisplayBindings.AttachSubWindows(newContent.WorkbenchWindow);
} else {
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/File/IFileService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/File/IFileService.cs 2005-01-26 23:54:31 UTC (rev 2170)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/File/IFileService.cs 2005-01-27 00:33:22 UTC (rev 2171)
@@ -33,10 +33,11 @@
/// Opens the file fileName in SharpDevelop (shows the file in
/// the workbench window)
/// </remarks>
- void OpenFile(string fileName);
+ void OpenFile (string fileName);
+ void OpenFile (string fileName, bool bringToFront);
+ void OpenFile (string fileName, FileOpeningFinished onFileOpened);
+ void OpenFile (string fileName, bool bringToFront, FileOpeningFinished onFileOpened);
- void OpenFile(string fileName, FileOpeningFinished onFileOpened);
-
/// <remarks>
/// Opens a new file with a given name, language and file content
/// in the workbench window.
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/DefaultProjectService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/DefaultProjectService.cs 2005-01-26 23:54:31 UTC (rev 2170)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/DefaultProjectService.cs 2005-01-27 00:33:22 UTC (rev 2171)
@@ -205,7 +205,7 @@
return format != null;
}
- public void OpenCombine(string filename)
+ public IAsyncOperation OpenCombine(string filename)
{
if (openCombine != null) {
SaveCombine();
@@ -215,25 +215,32 @@
if (filename.StartsWith ("file://"))
filename = filename.Substring (7);
- Runtime.DispatchService.BackgroundDispatch (new StatefulMessageHandler (backgroundLoadCombine), filename);
+ IProgressMonitor monitor = Runtime.TaskService.GetLoadProgressMonitor ();
+
+ object[] data = new object[] { filename, monitor };
+ Runtime.DispatchService.BackgroundDispatch (new StatefulMessageHandler (backgroundLoadCombine), data);
+ return monitor.AsyncOperation;
}
-
+
void backgroundLoadCombine (object arg)
{
- string filename = arg as string;
- if (!fileUtilityService.TestFileExists(filename)) {
- return;
- }
+ object[] data = (object[]) arg;
+ string filename = data[0] as string;
+ IProgressMonitor monitor = data [1] as IProgressMonitor;
- string validcombine = Path.ChangeExtension (filename, ".cmbx");
+ try {
+ if (!fileUtilityService.TestFileExists(filename)) {
+ monitor.ReportError (string.Format (GettextCatalog.GetString ("File not found: {0}"), filename), null);
+ return;
+ }
+
+ string validcombine = Path.ChangeExtension (filename, ".cmbx");
+
+ if (Path.GetExtension (filename).ToLower() != ".cmbx") {
+ if (File.Exists (validcombine))
+ filename = validcombine;
+ }
- if (Path.GetExtension (filename).ToLower() != ".cmbx") {
- if (File.Exists (validcombine))
- filename = validcombine;
- }
-
- IProgressMonitor monitor = Runtime.TaskService.GetLoadProgressMonitor ();
- try {
CombineEntry entry = ReadFile (filename, monitor);
if (!(entry is Combine)) {
Combine loadingCombine = new Combine();
@@ -669,7 +676,7 @@
foreach (XmlElement el in root["Files"].ChildNodes) {
string fileName = fileUtilityService.RelativeToAbsolutePath(combinepath, el.Attributes["filename"].InnerText);
if (File.Exists(fileName)) {
- Runtime.FileService.OpenFile (fileName);
+ Runtime.FileService.OpenFile (fileName, false);
}
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/IProjectService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/IProjectService.cs 2005-01-26 23:54:31 UTC (rev 2170)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/Project/IProjectService.cs 2005-01-27 00:33:22 UTC (rev 2171)
@@ -121,7 +121,7 @@
/// <remarks>
/// Opens a new root combine, closes the old root combine automatically.
/// </remarks>
- void OpenCombine(string filename);
+ IAsyncOperation OpenCombine (string filename);
/// <remarks>
/// Saves the whole root combine.
More information about the Monodevelop-patches-list
mailing list