[Monodevelop-patches-list] r1225 - in trunk/MonoDevelop: . src/Main/Base/Gui/Pads/ProjectBrowser/BrowserNode src/Main/Base/Gui/Workbench/Layouts src/Main/Base/Services/File src/Main/Base/Services/Project
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Mon Mar 22 09:42:19 EST 2004
Author: illan
Date: 2004-03-22 09:42:19 -0500 (Mon, 22 Mar 2004)
New Revision: 1225
Modified:
trunk/MonoDevelop/ChangeLog
trunk/MonoDevelop/src/Main/Base/Gui/Pads/ProjectBrowser/BrowserNode/FileNode.cs
trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
trunk/MonoDevelop/src/Main/Base/Services/File/DefaultFileService.cs
trunk/MonoDevelop/src/Main/Base/Services/File/IFileService.cs
trunk/MonoDevelop/src/Main/Base/Services/Project/DefaultProjectService.cs
Log:
Modified: trunk/MonoDevelop/ChangeLog
===================================================================
--- trunk/MonoDevelop/ChangeLog 2004-03-22 04:45:35 UTC (rev 1224)
+++ trunk/MonoDevelop/ChangeLog 2004-03-22 14:42:19 UTC (rev 1225)
@@ -1,3 +1,18 @@
+2004-03-22 Iñigo Illán <kodeport AT terra.es>
+
+ * Base/Gui/Pads/ProjectBrowser/BrowserNode/FileNode.cs:
+ * Base/Services/File/IFileService.cs:
+ * Base/Services/Project/DefaultProjectService.cs:
+ * Base/Services/File/DefaultFileService.cs:
+ Reject the operations made by me.
+
+ * Base/Services/File/DefaultFileService.cs:
+ Make OpenFile look if the file is a project file and make it
+ display correctly on the window manager.
+
+ * Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs:
+ Make title be displayed correctly
+
2004-03-21 Todd Berman <tberman at sevenl.net>
* monodevelop.xml: updated with a lot of mime-types, and submitted
Modified: trunk/MonoDevelop/src/Main/Base/Gui/Pads/ProjectBrowser/BrowserNode/FileNode.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Pads/ProjectBrowser/BrowserNode/FileNode.cs 2004-03-22 04:45:35 UTC (rev 1224)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Pads/ProjectBrowser/BrowserNode/FileNode.cs 2004-03-22 14:42:19 UTC (rev 1225)
@@ -89,26 +89,10 @@
public override void ActivateItem()
{
- string relativepath;
- int index;
-
if (userData != null && userData is ProjectFile) {
IFileService fileService = (IFileService)MonoDevelop.Core.Services.ServiceManager.Services.GetService(typeof(IFileService));
-
- if ((index = ((ProjectFile) userData).Name.IndexOf (this.Project.BaseDirectory)) == 0)
- {
- relativepath = ((ProjectFile) userData).Name.Substring(this.Project.BaseDirectory.Length);
- if (relativepath.StartsWith(Path.DirectorySeparatorChar.ToString()))
- {
- relativepath = relativepath.Substring(1);
- }
- }
- else
- {
- relativepath = System.IO.Path.GetFileName(((ProjectFile)userData).Name);
- }
- fileService.OpenFileFromProject(((ProjectFile)userData).Name, this.Combine.Name, relativepath); // System.IO.Path.GetFileName(((ProjectFile)userData).Name));
+ fileService.OpenFile (((ProjectFile)userData).Name);
}
}
Modified: trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs 2004-03-22 04:45:35 UTC (rev 1224)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs 2004-03-22 14:42:19 UTC (rev 1225)
@@ -446,7 +446,14 @@
if (ActiveWorkbenchwindow.ViewContent.IsUntitled) {
((Gtk.Window)WorkbenchSingleton.Workbench).Title = "MonoDevelop";
} else {
- ((Gtk.Window)WorkbenchSingleton.Workbench).Title = ActiveWorkbenchwindow.ViewContent.ContentName + " - MonoDevelop";
+ if (ActiveWorkbenchwindow.ViewContent.HasProject)
+ {
+ ((Gtk.Window)WorkbenchSingleton.Workbench).Title = ActiveWorkbenchwindow.ViewContent.ProjectName + " - " + ActiveWorkbenchwindow.ViewContent.PathRelativeToProject + " - MonoDevelop";
+ }
+ else
+ {
+ ((Gtk.Window)WorkbenchSingleton.Workbench).Title = ActiveWorkbenchwindow.ViewContent.ContentName + " - MonoDevelop";
+ }
}
} catch {
((Gtk.Window)WorkbenchSingleton.Workbench).Title = "MonoDevelop";
Modified: trunk/MonoDevelop/src/Main/Base/Services/File/DefaultFileService.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Services/File/DefaultFileService.cs 2004-03-22 04:45:35 UTC (rev 1224)
+++ trunk/MonoDevelop/src/Main/Base/Services/File/DefaultFileService.cs 2004-03-22 14:42:19 UTC (rev 1225)
@@ -6,6 +6,7 @@
// </file>
using System;
+using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Xml;
@@ -77,7 +78,7 @@
}
}
- public void OpenFileFromProject (string fileName, string projectname, string pathrelativetoproject)
+ public void OpenFile (string fileName)
{
if (fileName == null)
return;
@@ -116,9 +117,23 @@
IDisplayBinding binding = displayBindingService.GetBindingPerFileName(fileName);
if (binding != null) {
- if (fileUtilityService.ObservedLoad(new NamedFileOperationDelegate(new LoadFileWrapper(binding, projectname, pathrelativetoproject).Invoke), fileName) == FileOperationResult.OK) {
- fileService.RecentOpen.AddLastFile(fileName);
+ IProject project = null;
+ Combine combine = null;
+ GetProjectAndCombineFromFile (fileName, out project, out combine);
+ string pathrelativetoproject = GetRelativePath (project, fileName);
+
+ if (combine != null && project != null)
+ {
+ if (fileUtilityService.ObservedLoad(new NamedFileOperationDelegate(new LoadFileWrapper(binding, project.Name, pathrelativetoproject).Invoke), fileName) == FileOperationResult.OK) {
+ fileService.RecentOpen.AddLastFile(fileName);
+ }
}
+ else
+ {
+ if (fileUtilityService.ObservedLoad(new NamedFileOperationDelegate(new LoadFileWrapper(binding, null, null).Invoke), fileName) == FileOperationResult.OK) {
+ fileService.RecentOpen.AddLastFile(fileName);
+ }
+ }
} else {
try {
Gnome.Url.Show ("file://" + fileName);
@@ -130,11 +145,47 @@
}
}
- public void OpenFile (string filename)
+ protected void GetProjectAndCombineFromFile (string fileName, out IProject project, out Combine combine)
{
- this.OpenFileFromProject (filename, null, null);
+ IProjectService projectService = (IProjectService) ServiceManager.Services.GetService(typeof(IProjectService));
+ combine = projectService.CurrentOpenCombine;
+ project = null;
+
+ if (combine != null)
+ {
+ ArrayList projectslist = Combine.GetAllProjects(combine);
+
+ foreach (ProjectCombineEntry projectaux in projectslist)
+ {
+ if (projectaux.Project.IsFileInProject (fileName))
+ {
+ project = projectaux.Project;
+ }
+ }
+ }
}
+ protected string GetRelativePath (IProject project, string fileName)
+ {
+ string relativepath;
+
+ if (project != null && fileName.IndexOf (project.BaseDirectory) == 0)
+ {
+ relativepath = fileName.Substring (project.BaseDirectory.Length);
+
+ if (relativepath.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString()))
+ {
+ relativepath = relativepath.Substring (1);
+ }
+ }
+ else
+ {
+ relativepath = System.IO.Path.GetFileName (fileName);
+ }
+
+ return relativepath;
+ }
+
public void NewFile(string defaultName, string language, string content)
{
DisplayBindingService displayBindingService = (DisplayBindingService)MonoDevelop.Core.Services.ServiceManager.Services.GetService(typeof(DisplayBindingService));
Modified: trunk/MonoDevelop/src/Main/Base/Services/File/IFileService.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Services/File/IFileService.cs 2004-03-22 04:45:35 UTC (rev 1224)
+++ trunk/MonoDevelop/src/Main/Base/Services/File/IFileService.cs 2004-03-22 14:42:19 UTC (rev 1225)
@@ -36,10 +36,6 @@
void OpenFile(string fileName);
/// <remarks>
- /// Opens the file filename in MonoDevelop atached to projectname
- void OpenFileFromProject (string filename, string projectname, string pathrelativetoproject);
-
- /// <remarks>
/// Opens a new file with a given name, language and file content
/// in the workbench window.
/// </remarks>
Modified: trunk/MonoDevelop/src/Main/Base/Services/Project/DefaultProjectService.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Services/Project/DefaultProjectService.cs 2004-03-22 04:45:35 UTC (rev 1224)
+++ trunk/MonoDevelop/src/Main/Base/Services/Project/DefaultProjectService.cs 2004-03-22 14:42:19 UTC (rev 1225)
@@ -495,24 +495,7 @@
foreach (XmlElement el in root["Files"].ChildNodes) {
string fileName = fileUtilityService.RelativeToAbsolutePath(combinepath, el.Attributes["filename"].InnerText);
if (File.Exists(fileName)) {
- string relativepath;
-
- if (!Path.IsPathRooted(el.Attributes["filename"].InnerText) && !el.Attributes["filename"].InnerText.StartsWith (".."))
- {
- if (el.Attributes["filename"].InnerText.IndexOf ("." + Path.DirectorySeparatorChar.ToString()) == 0)
- {
- relativepath = el.Attributes["filename"].InnerText.Substring(2);
- }
- else
- {
- relativepath = el.Attributes["filename"].InnerText;
- }
- }
- else
- {
- relativepath = System.IO.Path.GetFileName (fileName);
- }
- fileService.OpenFileFromProject (fileName, combine.Name, relativepath);
+ fileService.OpenFile (fileName);
}
}
}
More information about the Monodevelop-patches-list
mailing list