[Monodevelop-patches-list] r807 - in trunk/MonoDevelop/src: AddIns/DisplayBindings/SourceEditor/Gui AddIns/DisplayBindings/TextEditor/Gui/Editor Main/Base/Gui/BrowserDisplayBinding Main/Base/Internal/Codons/DisplayBinding Main/Base/Services/DisplayBinding
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Sat Feb 7 15:31:02 EST 2004
Author: tberman
Date: 2004-02-07 15:31:02 -0500 (Sat, 07 Feb 2004)
New Revision: 807
Modified:
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Gui/Editor/TextEditorDisplayBinding.cs
trunk/MonoDevelop/src/Main/Base/Gui/BrowserDisplayBinding/BrowserDisplayBinding.cs
trunk/MonoDevelop/src/Main/Base/Internal/Codons/DisplayBinding/IDisplayBinding.cs
trunk/MonoDevelop/src/Main/Base/Services/DisplayBinding/DisplayBindingService.cs
Log:
we are attempting to load based on mimetype *FIRST* then on filename, lets see what kinda results we get from this, and if everything is working out well, we will remove the by filename and launch external progs for mimetypes we dont understand.
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs 2004-02-07 19:08:28 UTC (rev 806)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs 2004-02-07 20:31:02 UTC (rev 807)
@@ -24,6 +24,12 @@
{
return true;
}
+
+ public virtual bool CanCreateContentForMimeType (string mimetype)
+ {
+ if (mimetype.StartsWith ("text")) return true;
+ return false;
+ }
public virtual bool CanCreateContentForLanguage (string language)
{
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Gui/Editor/TextEditorDisplayBinding.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Gui/Editor/TextEditorDisplayBinding.cs 2004-02-07 19:08:28 UTC (rev 806)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Gui/Editor/TextEditorDisplayBinding.cs 2004-02-07 20:31:02 UTC (rev 807)
@@ -44,6 +44,12 @@
{
return true;
}
+
+ public virtual bool CanCreateContentForMimeType (string mimetype)
+ {
+ if (mimetype.StartsWith ("text")) return true;
+ return false;
+ }
public virtual bool CanCreateContentForLanguage(string language)
{
Modified: trunk/MonoDevelop/src/Main/Base/Gui/BrowserDisplayBinding/BrowserDisplayBinding.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/BrowserDisplayBinding/BrowserDisplayBinding.cs 2004-02-07 19:08:28 UTC (rev 806)
+++ trunk/MonoDevelop/src/Main/Base/Gui/BrowserDisplayBinding/BrowserDisplayBinding.cs 2004-02-07 20:31:02 UTC (rev 807)
@@ -24,6 +24,16 @@
{
return fileName.StartsWith("http") || fileName.StartsWith("ftp");
}
+
+ public bool CanCreateContentForMimeType (string mimetype)
+ {
+ switch (mimetype) {
+ case "text/html":
+ return true;
+ default:
+ return false;
+ }
+ }
public bool CanCreateContentForLanguage(string language)
{
Modified: trunk/MonoDevelop/src/Main/Base/Internal/Codons/DisplayBinding/IDisplayBinding.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Internal/Codons/DisplayBinding/IDisplayBinding.cs 2004-02-07 19:08:28 UTC (rev 806)
+++ trunk/MonoDevelop/src/Main/Base/Internal/Codons/DisplayBinding/IDisplayBinding.cs 2004-02-07 20:31:02 UTC (rev 807)
@@ -31,6 +31,8 @@
/// </returns>
bool CanCreateContentForFile(string fileName);
+ bool CanCreateContentForMimeType (string mimetype);
+
/// <remarks>
/// Creates a new IViewContent object for the file fileName
/// </remarks>
Modified: trunk/MonoDevelop/src/Main/Base/Services/DisplayBinding/DisplayBindingService.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Services/DisplayBinding/DisplayBindingService.cs 2004-02-07 19:08:28 UTC (rev 806)
+++ trunk/MonoDevelop/src/Main/Base/Services/DisplayBinding/DisplayBindingService.cs 2004-02-07 20:31:02 UTC (rev 807)
@@ -44,7 +44,14 @@
public DisplayBindingCodon GetCodonPerFileName(string filename)
{
+ string mimetype = MonoDevelop.GuiUtils.Vfs.GetMimeType (filename);
foreach (DisplayBindingCodon binding in bindings) {
+ if (binding.DisplayBinding != null && binding.DisplayBinding.CanCreateContentForMimeType (mimetype)) {
+ return binding;
+ }
+ }
+ Console.WriteLine ("Didnt match on mimetype, trying filename");
+ foreach (DisplayBindingCodon binding in bindings) {
if (binding.DisplayBinding != null && binding.DisplayBinding.CanCreateContentForFile(filename)) {
return binding;
}
More information about the Monodevelop-patches-list
mailing list