Browse Source

working on SD-1527 - A display binding's supported files should be independent from the files it handles by default:

- add mimeType to file extensions
- implement new methods IsPreferredBindingForFile and AutoDetectFileContent for IDisplayBinding
4.1
Siegfried Pammer 15 years ago
parent
commit
5a943271ea
  1. 5
      src/AddIns/Analysis/Profiler/Frontend/AddIn/ICSharpCode.Profiler.AddIn.addin
  2. 12
      src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Views/ProfilerDisplayBinding.cs
  3. 3
      src/AddIns/BackendBindings/Boo/BooBinding/Project/BooBinding.addin
  4. 3
      src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.addin
  5. 3
      src/AddIns/BackendBindings/CppBinding/CppBinding/CppBinding.addin
  6. 3
      src/AddIns/BackendBindings/FSharpBinding/FSharpBinding.addin
  7. 161
      src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.addin
  8. 165
      src/AddIns/BackendBindings/Ruby/RubyBinding/Project/RubyBinding.addin
  9. 3
      src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.addin
  10. 3
      src/AddIns/BackendBindings/WixBinding/Project/WixBinding.addin
  11. 3
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlBinding.addin
  12. 26
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/AvalonEditDisplayBinding.cs
  13. 1
      src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/ClassDiagramAddin.addin
  14. 12
      src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/Src/ClassDiagramDisplayBinding.cs
  15. 3
      src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/ICSharpCode.Data.addin
  16. 12
      src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/DisplayBinding/EDMDesignerDisplayBinding.cs
  17. 3
      src/AddIns/DisplayBindings/HexEditor/Project/HexEditor.addin
  18. 51
      src/AddIns/DisplayBindings/HexEditor/Project/Src/View/HexEditDisplayBinding.cs
  19. 2
      src/AddIns/DisplayBindings/IconEditor/IconEditorAddIn/IconEditorAddIn.addin
  20. 10
      src/AddIns/DisplayBindings/IconEditor/IconEditorAddIn/Src/IconDisplayBinding.cs
  21. 13
      src/AddIns/DisplayBindings/ResourceEditor/Project/Src/DisplayDefinition.cs
  22. 10
      src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsDisplayBinding.cs
  23. 3
      src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsEditor.addin
  24. 10
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfDisplayBinding.cs
  25. 2
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/WpfDesign.addin
  26. 10
      src/AddIns/Misc/AddInManager/Project/Src/AddInInstallBinding.cs
  27. 5
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/ICSharpCode.ReportDesigner.addin
  28. 13
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/DesignerBinding/ReportDesignerDisplayBinding.cs
  29. 27
      src/AddIns/Misc/TextTemplating/Project/TextTemplating.addin
  30. 10
      src/Main/Base/Project/Src/Gui/BrowserDisplayBinding/BrowserDisplayBinding.cs
  31. 10
      src/Main/Base/Project/Src/Project/MSBuildBasedProject.cs
  32. 6
      src/Main/Base/Project/Src/Services/DisplayBinding/DisplayBindingDescriptor.cs
  33. 7
      src/Main/Base/Project/Src/Services/DisplayBinding/DisplayBindingService.cs
  34. 10
      src/Main/Base/Project/Src/Services/DisplayBinding/ExternalProcessDisplayBinding.cs
  35. 51
      src/Main/Base/Project/Src/Services/DisplayBinding/IDisplayBinding.cs
  36. 12
      src/Main/Base/Project/Src/Services/DisplayBinding/ShellExecuteDisplayBinding.cs
  37. 10
      src/Main/Base/Project/Src/Services/File/FileService.cs
  38. 4
      src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/FileFilterDoozer.cs

5
src/AddIns/Analysis/Profiler/Frontend/AddIn/ICSharpCode.Profiler.AddIn.addin

@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
<Path name = "/SharpDevelop/Workbench/DisplayBindings">
<DisplayBinding id = "ProfilerDisplayBinding"
insertbefore="Text"
fileNamePattern=".sdps"
fileNamePattern="\.(sdps)$"
title = "${res:AddIns.Profiler.ProfilingView.Title}"
class = "ICSharpCode.Profiler.AddIn.Views.ProfilerDisplayBinding"/>
</Path>
@ -78,7 +78,8 @@ @@ -78,7 +78,8 @@
<FileFilter id = "SharpDevelopProfilingSession"
insertbefore="AllFiles"
name = "${res:AddIns.Profiler.FileExtensionDescription}"
extensions = "*.sdps"/>
extensions = "*.sdps"
mimeType = "application/x-sharpdevelop-profiler"/>
</Path>
<Path name="/SharpDevelop/Dialogs/OptionsDialog/ToolsOptions">

12
src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/Views/ProfilerDisplayBinding.cs

@ -21,7 +21,7 @@ namespace ICSharpCode.Profiler.AddIn.Views @@ -21,7 +21,7 @@ namespace ICSharpCode.Profiler.AddIn.Views
public bool CanCreateContentForFile(string fileName)
{
return Path.GetExtension(fileName) == ".sdps";
return true; // definition in .addin does extension-based filtering
}
public ICSharpCode.SharpDevelop.Gui.IViewContent CreateContentForFile(OpenedFile file)
@ -45,5 +45,15 @@ namespace ICSharpCode.Profiler.AddIn.Views @@ -45,5 +45,15 @@ namespace ICSharpCode.Profiler.AddIn.Views
}
return new WpfViewer(file, provider);
}
public bool IsPreferredBindingForFile(string fileName)
{
return true;
}
public double AutoDetectFileContent(string fileName, Stream fileContent, string detectedMimeType)
{
return 1;
}
}
}

3
src/AddIns/BackendBindings/Boo/BooBinding/Project/BooBinding.addin

@ -29,7 +29,8 @@ @@ -29,7 +29,8 @@
<FileFilter id = "Boo"
insertbefore="AllFiles"
name = "${res:SharpDevelop.FileFilter.Boo} (*.boo)"
extensions = "*.boo"/>
extensions = "*.boo"
mimeType = "text/plain"/>
</Path>
<!-- Makes SharpDevelop show the text 'Compiling ProjectName...' whenever an MSBuild task named 'booc' is started -->

3
src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.addin

@ -36,7 +36,8 @@ @@ -36,7 +36,8 @@
<FileFilter id = "C#"
insertbefore="AllFiles"
name = "${res:SharpDevelop.FileFilter.CSharpFiles}"
extensions = "*.cs"/>
extensions = "*.cs"
mimeType = "text/plain"/>
</Path>
<Path name = "/SharpDevelop/Workbench/Combine/FileFilter">

3
src/AddIns/BackendBindings/CppBinding/CppBinding/CppBinding.addin

@ -65,7 +65,8 @@ @@ -65,7 +65,8 @@
insertafter="C#"
insertbefore="Resources"
name="C++ files (*.cpp, *.h)"
extensions="*.cpp;*.c;*.hpp;*.h"/>
extensions="*.cpp;*.c;*.hpp;*.h"
mimeType = "text/plain"/>
</Path>
<Path name="/SharpDevelop/Workbench/ProjectBindings">

3
src/AddIns/BackendBindings/FSharpBinding/FSharpBinding.addin

@ -41,7 +41,8 @@ @@ -41,7 +41,8 @@
<FileFilter id = "F#"
insertbefore="AllFiles"
name = "F# (*.fs)"
extensions = "*.fs"/>
extensions = "*.fs"
mimeType = "text/plain"/>
</Path>
<Path name = "/SharpDevelop/Workbench/Combine/FileFilter">

161
src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.addin

@ -19,33 +19,34 @@ @@ -19,33 +19,34 @@
<Path name="/SharpDevelop/ViewContent/AvalonEdit/SyntaxModes">
<SyntaxMode id="Python.SyntaxMode"
extensions=".py"
name="Python"
resource="ICSharpCode.PythonBinding.Resources.Python.xshd"/>
extensions=".py"
name="Python"
resource="ICSharpCode.PythonBinding.Resources.Python.xshd"/>
</Path>
<Path name="/SharpDevelop/Workbench/LanguageBindings">
<LanguageBinding id="Python"
class="ICSharpCode.PythonBinding.PythonLanguageBinding"
extensions=".py" />
class="ICSharpCode.PythonBinding.PythonLanguageBinding"
extensions=".py" />
</Path>
<!-- Add the "Python" entry to the Open File Dialog -->
<Path name="/SharpDevelop/Workbench/FileFilter">
<FileFilter id="Python"
insertbefore="Resources"
insertafter="Icons"
name="${res:ICSharpCode.PythonBinding.PythonFiles} (*.py)"
extensions="*.py"/>
insertbefore="Resources"
insertafter="Icons"
name="${res:ICSharpCode.PythonBinding.PythonFiles} (*.py)"
extensions="*.py"
mimeType = "text/plain"/>
</Path>
<!-- Add the "Python" entry to the Open Project Dialog -->
<Path name="/SharpDevelop/Workbench/Combine/FileFilter">
<FileFilter id="PythonProject"
insertbefore="AllFiles"
name="${res:ICSharpCode.PythonBinding.PythonProjectFiles} (*.pyproj)"
class="ICSharpCode.SharpDevelop.Project.LoadProject"
extensions="*.pyproj"/>
insertbefore="AllFiles"
name="${res:ICSharpCode.PythonBinding.PythonProjectFiles} (*.pyproj)"
class="ICSharpCode.SharpDevelop.Project.LoadProject"
extensions="*.pyproj"/>
</Path>
<!-- File templates -->
@ -57,36 +58,36 @@ @@ -57,36 +58,36 @@
<Path name="/SharpDevelop/Workbench/MainMenu">
<Condition name="ActiveContentExtension" activeextension=".py">
<MenuItem id="Python"
insertafter="Search"
insertbefore="Tools"
label="&amp;Python"
type="Menu">
insertafter="Search"
insertbefore="Tools"
label="&amp;Python"
type="Menu">
<Condition name="IsProcessRunning" isprocessrunning="False" isdebugging="False" action="Disable">
<MenuItem id="Run"
icon="Icons.16x16.RunProgramIcon"
class="ICSharpCode.PythonBinding.RunDebugPythonCommand"
label="${res:XML.MainMenu.RunMenu.Run}"
shortcut="Control|Shift|R"/>
icon="Icons.16x16.RunProgramIcon"
class="ICSharpCode.PythonBinding.RunDebugPythonCommand"
label="${res:XML.MainMenu.RunMenu.Run}"
shortcut="Control|Shift|R"/>
<MenuItem id="RunWithoutDebugger"
icon="Icons.16x16.Debug.StartWithoutDebugging"
class="ICSharpCode.PythonBinding.RunPythonCommand"
label="${res:XML.MainMenu.DebugMenu.RunWithoutDebug}"
shortcut="Control|Shift|W"/>
icon="Icons.16x16.Debug.StartWithoutDebugging"
class="ICSharpCode.PythonBinding.RunPythonCommand"
label="${res:XML.MainMenu.DebugMenu.RunWithoutDebug}"
shortcut="Control|Shift|W"/>
</Condition>
<Condition name="IsProcessRunning" isdebugging="True" action="Disable">
<MenuItem id="Stop"
icon="Icons.16x16.StopProcess"
class="ICSharpCode.SharpDevelop.Project.Commands.StopDebuggingCommand"
label="${res:XML.MainMenu.DebugMenu.Stop}"/>
icon="Icons.16x16.StopProcess"
class="ICSharpCode.SharpDevelop.Project.Commands.StopDebuggingCommand"
label="${res:XML.MainMenu.DebugMenu.Stop}"/>
</Condition>
<MenuItem id="SendToPythonConsoleSeparator" type="Separator"/>
<MenuItem id="SendLineToPythonConsole"
class="ICSharpCode.PythonBinding.SendLineToPythonConsoleCommand"
label="${res:ICSharpCode.PythonBinding.SendLineToPythonConsole}"/>
class="ICSharpCode.PythonBinding.SendLineToPythonConsoleCommand"
label="${res:ICSharpCode.PythonBinding.SendLineToPythonConsole}"/>
<Condition name="IsTextSelected" action="Disable">
<MenuItem id="SendSelectedTextToPythonConsole"
class="ICSharpCode.PythonBinding.SendSelectedTextToPythonConsoleCommand"
label="${res:ICSharpCode.PythonBinding.SendSelectedTextToPythonConsole}"/>
class="ICSharpCode.PythonBinding.SendSelectedTextToPythonConsoleCommand"
label="${res:ICSharpCode.PythonBinding.SendSelectedTextToPythonConsole}"/>
</Condition>
</MenuItem>
</Condition>
@ -95,18 +96,18 @@ @@ -95,18 +96,18 @@
<!-- Python parser -->
<Path name="/Workspace/Parser">
<Parser id="Python"
supportedextensions=".py"
projectfileextension=".pyproj"
class="ICSharpCode.PythonBinding.PythonParser"/>
supportedextensions=".py"
projectfileextension=".pyproj"
class="ICSharpCode.PythonBinding.PythonParser"/>
</Path>
<!-- Register Python MSBuild project (.pyproj) -->
<Path name="/SharpDevelop/Workbench/ProjectBindings">
<ProjectBinding id="Python"
guid="{FD48973F-F585-4F70-812B-4D0503B36CE9}"
supportedextensions=".py"
projectfileextension=".pyproj"
class="ICSharpCode.PythonBinding.PythonProjectBinding" />
guid="{FD48973F-F585-4F70-812B-4D0503B36CE9}"
supportedextensions=".py"
projectfileextension=".pyproj"
class="ICSharpCode.PythonBinding.PythonProjectBinding" />
</Path>
<!-- The Python code completion binding -->
@ -127,33 +128,33 @@ @@ -127,33 +128,33 @@
<!-- Options panel -->
<Path name="/SharpDevelop/Dialogs/OptionsDialog/ToolsOptions">
<OptionPanel id="PythonOptionsPanel"
label="Python"
class="ICSharpCode.PythonBinding.PythonOptionsPanel"/>
label="Python"
class="ICSharpCode.PythonBinding.PythonOptionsPanel"/>
</Path>
<!-- Project options panels -->
<Path path="/SharpDevelop/BackendBindings/ProjectOptions/Python">
<OptionPanel id="Application"
label="${res:Dialog.ProjectOptions.ApplicationSettings}"
class="ICSharpCode.PythonBinding.ApplicationSettingsPanel"/>
label="${res:Dialog.ProjectOptions.ApplicationSettings}"
class="ICSharpCode.PythonBinding.ApplicationSettingsPanel"/>
<OptionPanel id="BuildEvents"
label="${res:Dialog.ProjectOptions.BuildEvents}"
class="ICSharpCode.SharpDevelop.Gui.OptionPanels.BuildEvents"/>
label="${res:Dialog.ProjectOptions.BuildEvents}"
class="ICSharpCode.SharpDevelop.Gui.OptionPanels.BuildEvents"/>
<OptionPanel id="CompilingOptions"
label="${res:Dialog.ProjectOptions.BuildOptions}"
class="ICSharpCode.PythonBinding.CompilingOptionsPanel"/>
label="${res:Dialog.ProjectOptions.BuildOptions}"
class="ICSharpCode.PythonBinding.CompilingOptionsPanel"/>
<OptionPanel id="DebugOptions"
label="${res:Dialog.ProjectOptions.DebugOptions}"
class="ICSharpCode.SharpDevelop.Gui.OptionPanels.DebugOptions"/>
label="${res:Dialog.ProjectOptions.DebugOptions}"
class="ICSharpCode.SharpDevelop.Gui.OptionPanels.DebugOptions"/>
</Path>
<!-- Python display binding -->
<Path name="/SharpDevelop/Workbench/DisplayBindings">
<DisplayBinding id="PythonDisplayBinding"
type="Secondary"
fileNamePattern="\.py$"
languagePattern="^Python$"
class="ICSharpCode.PythonBinding.PythonFormsDesignerDisplayBinding" />
type="Secondary"
fileNamePattern="\.py$"
languagePattern="^Python$"
class="ICSharpCode.PythonBinding.PythonFormsDesignerDisplayBinding" />
</Path>
<Path name="/SharpDevelop/Workbench/MainMenu/Tools/ConvertCode">
@ -163,63 +164,63 @@ @@ -163,63 +164,63 @@
<Condition name="ActiveContentExtension" activeextension=".vb"/>
</Or>
<MenuItem id="ConvertToPython"
insertafter="CSharp"
insertbefore="VBNet"
label="Python"
class="ICSharpCode.PythonBinding.ConvertToPythonMenuCommand"/>
insertafter="CSharp"
insertbefore="VBNet"
label="Python"
class="ICSharpCode.PythonBinding.ConvertToPythonMenuCommand"/>
</ComplexCondition>
</Path>
<Path name="/SharpDevelop/Pads/ProjectBrowser/ContextMenu/ProjectActions/Convert">
<Condition name="ProjectActive" activeproject="C#">
<MenuItem id="CSharpProjectToPythonProjectConverter"
label="${res:ICSharpCode.PythonBinding.ConvertCSharpProjectToPythonProject}"
class="ICSharpCode.PythonBinding.ConvertProjectToPythonProjectCommand"/>
label="${res:ICSharpCode.PythonBinding.ConvertCSharpProjectToPythonProject}"
class="ICSharpCode.PythonBinding.ConvertProjectToPythonProjectCommand"/>
</Condition>
<Condition name="ProjectActive" activeproject="VBNet">
<MenuItem id="VBNetProjectToPythonProjectConverter"
label="${res:ICSharpCode.PythonBinding.ConvertVBNetProjectToPythonProject}"
class="ICSharpCode.PythonBinding.ConvertProjectToPythonProjectCommand"/>
label="${res:ICSharpCode.PythonBinding.ConvertVBNetProjectToPythonProject}"
class="ICSharpCode.PythonBinding.ConvertProjectToPythonProjectCommand"/>
</Condition>
</Path>
<Path name="/SharpDevelop/Workbench/Pads">
<Pad id="PythonConsole"
category="Tools"
title="${res:ICSharpCode.PythonBinding.PythonConsole}"
insertbefore="DefinitionView"
icon="PadIcons.Output"
defaultPosition="Bottom, Hidden"
class="ICSharpCode.PythonBinding.PythonConsolePad"/>
category="Tools"
title="${res:ICSharpCode.PythonBinding.PythonConsole}"
insertbefore="DefinitionView"
icon="PadIcons.Output"
defaultPosition="Bottom, Hidden"
class="ICSharpCode.PythonBinding.PythonConsolePad"/>
</Path>
<Path name="/Workspace/Icons">
<Icon id="PythonFileIcon"
extensions=".py"
resource="Python.ProjectBrowser.File"/>
extensions=".py"
resource="Python.ProjectBrowser.File"/>
<Icon id="PythonProjectIcon"
language="Python"
resource="Python.ProjectBrowser.Project"/>
language="Python"
resource="Python.ProjectBrowser.Project"/>
</Path>
<Path name="/SharpDevelop/UnitTesting/TestFrameworks">
<TestFramework id="pyunit"
class="ICSharpCode.PythonBinding.PythonTestFramework"
supportedProjects=".pyproj"/>
class="ICSharpCode.PythonBinding.PythonTestFramework"
supportedProjects=".pyproj"/>
</Path>
<Path name="/SharpDevelop/ViewContent/TextEditor/ContextMenu">
<Condition name="ActiveContentExtension" activeextension=".py">
<MenuItem id="SendToPythonConsoleSeparator"
insertafter="Indent"
type="Separator"/>
insertafter="Indent"
type="Separator"/>
<MenuItem id="SendLineToPythonConsole"
class="ICSharpCode.PythonBinding.SendLineToPythonConsoleCommand"
label="${res:ICSharpCode.PythonBinding.SendLineToPythonConsole}"/>
class="ICSharpCode.PythonBinding.SendLineToPythonConsoleCommand"
label="${res:ICSharpCode.PythonBinding.SendLineToPythonConsole}"/>
<Condition name="IsTextSelected" action="Disable">
<MenuItem id="SendSelectedTextToPythonConsole"
class="ICSharpCode.PythonBinding.SendSelectedTextToPythonConsoleCommand"
label="${res:ICSharpCode.PythonBinding.SendSelectedTextToPythonConsole}"/>
class="ICSharpCode.PythonBinding.SendSelectedTextToPythonConsoleCommand"
label="${res:ICSharpCode.PythonBinding.SendSelectedTextToPythonConsole}"/>
</Condition>
</Condition>
</Path>

165
src/AddIns/BackendBindings/Ruby/RubyBinding/Project/RubyBinding.addin

@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
<AddIn name = "Ruby Binding"
author = "Matt Ward"
copyright = "prj:///doc/copyright.txt"
description = "IronRuby addin"
addInManagerHidden = "preinstalled">
author = "Matt Ward"
copyright = "prj:///doc/copyright.txt"
description = "IronRuby addin"
addInManagerHidden = "preinstalled">
<Manifest>
<Identity name="ICSharpCode.RubyBinding"/>
@ -19,27 +19,28 @@ @@ -19,27 +19,28 @@
<Path name="/SharpDevelop/ViewContent/AvalonEdit/SyntaxModes">
<SyntaxMode id="Ruby.SyntaxMode"
extensions=".rb"
name="Ruby"
resource="ICSharpCode.RubyBinding.Resources.Ruby.xshd"/>
</Path>
extensions=".rb"
name="Ruby"
resource="ICSharpCode.RubyBinding.Resources.Ruby.xshd"/>
</Path>
<!-- Add the "Ruby" entry to the Open File Dialog -->
<Path name="/SharpDevelop/Workbench/FileFilter">
<FileFilter id="Ruby"
insertbefore="Resources"
insertafter="Icons"
name="Ruby Files (*.rb)"
extensions="*.rb"/>
insertbefore="Resources"
insertafter="Icons"
name="Ruby Files (*.rb)"
extensions="*.rb"
mimeType = "text/plain"/>
</Path>
<!-- Add the "Ruby" entry to the Open Project Dialog -->
<Path name = "/SharpDevelop/Workbench/Combine/FileFilter">
<FileFilter id="RubyProject"
insertbefore="AllFiles"
name="Ruby Project Files (*.rbproj)"
class="ICSharpCode.SharpDevelop.Project.LoadProject"
extensions="*.rbproj"/>
insertbefore="AllFiles"
name="Ruby Project Files (*.rbproj)"
class="ICSharpCode.SharpDevelop.Project.LoadProject"
extensions="*.rbproj"/>
</Path>
<!-- File templates -->
@ -51,36 +52,36 @@ @@ -51,36 +52,36 @@
<Path name="/SharpDevelop/Workbench/MainMenu">
<Condition name="ActiveContentExtension" activeextension=".rb">
<MenuItem id="Ruby"
insertafter="Search"
insertbefore="Tools"
label="&amp;Ruby"
type="Menu">
insertafter="Search"
insertbefore="Tools"
label="&amp;Ruby"
type="Menu">
<Condition name="IsProcessRunning" isprocessrunning="False" isdebugging="False" action="Disable">
<MenuItem id="Run"
icon="Icons.16x16.RunProgramIcon"
class="ICSharpCode.RubyBinding.RunDebugRubyCommand"
label="${res:XML.MainMenu.RunMenu.Run}"
shortcut="Control|Shift|R"/>
icon="Icons.16x16.RunProgramIcon"
class="ICSharpCode.RubyBinding.RunDebugRubyCommand"
label="${res:XML.MainMenu.RunMenu.Run}"
shortcut="Control|Shift|R"/>
<MenuItem id="RunWithoutDebugger"
icon="Icons.16x16.Debug.StartWithoutDebugging"
class="ICSharpCode.RubyBinding.RunRubyCommand"
label="${res:XML.MainMenu.DebugMenu.RunWithoutDebug}"
shortcut="Control|Shift|W"/>
icon="Icons.16x16.Debug.StartWithoutDebugging"
class="ICSharpCode.RubyBinding.RunRubyCommand"
label="${res:XML.MainMenu.DebugMenu.RunWithoutDebug}"
shortcut="Control|Shift|W"/>
</Condition>
<Condition name="IsProcessRunning" isdebugging="True" action="Disable">
<MenuItem id="Stop"
icon="Icons.16x16.StopProcess"
class="ICSharpCode.SharpDevelop.Project.Commands.StopDebuggingCommand"
label="${res:XML.MainMenu.DebugMenu.Stop}"/>
icon="Icons.16x16.StopProcess"
class="ICSharpCode.SharpDevelop.Project.Commands.StopDebuggingCommand"
label="${res:XML.MainMenu.DebugMenu.Stop}"/>
</Condition>
<MenuItem id="SendToRubyConsoleSeparator" type="Separator"/>
<MenuItem id="SendLineToRubyConsole"
class="ICSharpCode.RubyBinding.SendLineToRubyConsoleCommand"
label="${res:ICSharpCode.RubyBinding.SendLineToRubyConsole}"/>
class="ICSharpCode.RubyBinding.SendLineToRubyConsoleCommand"
label="${res:ICSharpCode.RubyBinding.SendLineToRubyConsole}"/>
<Condition name="IsTextSelected" action="Disable">
<MenuItem id="SendSelectedTextToRubyConsole"
class="ICSharpCode.RubyBinding.SendSelectedTextToRubyConsoleCommand"
label="${res:ICSharpCode.RubyBinding.SendSelectedTextToRubyConsole}"/>
class="ICSharpCode.RubyBinding.SendSelectedTextToRubyConsoleCommand"
label="${res:ICSharpCode.RubyBinding.SendSelectedTextToRubyConsole}"/>
</Condition>
</MenuItem>
</Condition>
@ -89,28 +90,28 @@ @@ -89,28 +90,28 @@
<!-- Ruby parser -->
<Path name="/Workspace/Parser">
<Parser id="Ruby"
supportedextensions=".rb"
projectfileextension=".rbproj"
class="ICSharpCode.RubyBinding.RubyParser"/>
supportedextensions=".rb"
projectfileextension=".rbproj"
class="ICSharpCode.RubyBinding.RubyParser"/>
</Path>
<!-- Register Ruby MSBuild project (.rbproj) -->
<Path name="/SharpDevelop/Workbench/ProjectBindings">
<ProjectBinding id="Ruby"
guid="{BD8E9625-815A-4BDB-B228-5D4F9C2541A1}"
supportedextensions=".rb"
projectfileextension=".rbproj"
class="ICSharpCode.RubyBinding.RubyProjectBinding" />
guid="{BD8E9625-815A-4BDB-B228-5D4F9C2541A1}"
supportedextensions=".rb"
projectfileextension=".rbproj"
class="ICSharpCode.RubyBinding.RubyProjectBinding" />
</Path>
<Path name="/SharpDevelop/Workbench/LanguageBindings">
<LanguageBinding id="Ruby"
class="ICSharpCode.RubyBinding.RubyLanguageBinding"
extensions=".rb" />
class="ICSharpCode.RubyBinding.RubyLanguageBinding"
extensions=".rb" />
</Path>
<!-- The Ruby code completion binding -->
<!-- <Path name = "/AddIns/DefaultTextEditor/CodeCompletion">
<!-- <Path name = "/AddIns/DefaultTextEditor/CodeCompletion">
<CodeCompletionBinding id="Ruby"
extensions=".rb"
class="ICSharpCode.RubyBinding.RubyCodeCompletionBinding"/>
@ -119,24 +120,24 @@ @@ -119,24 +120,24 @@
<!-- Options panel -->
<Path name="/SharpDevelop/Dialogs/OptionsDialog/ToolsOptions">
<OptionPanel id="RubyOptionsPanel"
label="Ruby"
class="ICSharpCode.RubyBinding.RubyOptionsPanel"/>
label="Ruby"
class="ICSharpCode.RubyBinding.RubyOptionsPanel"/>
</Path>
<!-- Project options panels -->
<Path path="/SharpDevelop/BackendBindings/ProjectOptions/Ruby">
<OptionPanel id="DebugOptions"
label="${res:Dialog.ProjectOptions.DebugOptions}"
class="ICSharpCode.SharpDevelop.Gui.OptionPanels.DebugOptions"/>
label="${res:Dialog.ProjectOptions.DebugOptions}"
class="ICSharpCode.SharpDevelop.Gui.OptionPanels.DebugOptions"/>
</Path>
<!-- Ruby display binding -->
<Path name="/SharpDevelop/Workbench/DisplayBindings">
<DisplayBinding id="RubyDisplayBinding"
type="Secondary"
fileNamePattern="\.rb$"
languagePattern="^Ruby$"
class="ICSharpCode.RubyBinding.RubyFormsDesignerDisplayBinding" />
type="Secondary"
fileNamePattern="\.rb$"
languagePattern="^Ruby$"
class="ICSharpCode.RubyBinding.RubyFormsDesignerDisplayBinding" />
</Path>
<Path name="/AddIns/DefaultTextEditor/Formatter/Ruby">
@ -150,64 +151,64 @@ @@ -150,64 +151,64 @@
<Condition name="ActiveContentExtension" activeextension=".vb"/>
</Or>
<MenuItem id="ConvertToRuby"
insertafter="CSharp"
insertbefore="VBNet"
label="Ruby"
class="ICSharpCode.RubyBinding.ConvertToRubyMenuCommand"/>
insertafter="CSharp"
insertbefore="VBNet"
label="Ruby"
class="ICSharpCode.RubyBinding.ConvertToRubyMenuCommand"/>
</ComplexCondition>
</Path>
<Path name = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/ProjectActions/Convert">
<Condition name="ProjectActive" activeproject="C#">
<MenuItem id="CSharpProjectToRubyProjectConverter"
label="From C# to Ruby"
class="ICSharpCode.RubyBinding.ConvertProjectToRubyProjectCommand"/>
label="From C# to Ruby"
class="ICSharpCode.RubyBinding.ConvertProjectToRubyProjectCommand"/>
</Condition>
<Condition name="ProjectActive" activeproject="VBNet">
<MenuItem id="VBNetProjectToRubyProjectConverter"
label="From VB.NET to Ruby"
class="ICSharpCode.RubyBinding.ConvertProjectToRubyProjectCommand"/>
label="From VB.NET to Ruby"
class="ICSharpCode.RubyBinding.ConvertProjectToRubyProjectCommand"/>
</Condition>
</Path>
<Path name = "/SharpDevelop/Workbench/Pads">
<Pad id="RubyConsole"
category="Tools"
title="Ruby Console"
insertbefore="DefinitionView"
icon="PadIcons.Output"
defaultPosition="Bottom, Hidden"
class="ICSharpCode.RubyBinding.RubyConsolePad"/>
category="Tools"
title="Ruby Console"
insertbefore="DefinitionView"
icon="PadIcons.Output"
defaultPosition="Bottom, Hidden"
class="ICSharpCode.RubyBinding.RubyConsolePad"/>
</Path>
<Path name = "/Workspace/Icons">
<Icon id="RubyFileIcon"
extensions=".rb"
resource="Ruby.ProjectBrowser.File"/>
extensions=".rb"
resource="Ruby.ProjectBrowser.File"/>
<Icon id="RubyProjectIcon"
language="Ruby"
resource="Ruby.ProjectBrowser.Project"/>
language="Ruby"
resource="Ruby.ProjectBrowser.Project"/>
</Path>
<Path name="/SharpDevelop/UnitTesting/TestFrameworks">
<TestFramework id="rbunit"
class="ICSharpCode.RubyBinding.RubyTestFramework"
supportedProjects=".rbproj"/>
class="ICSharpCode.RubyBinding.RubyTestFramework"
supportedProjects=".rbproj"/>
</Path>
<Path name="/SharpDevelop/ViewContent/TextEditor/ContextMenu">
<Condition name="ActiveContentExtension" activeextension=".rb">
<MenuItem id="SendToRubyConsoleSeparator"
insertafter="Indent"
type="Separator"/>
insertafter="Indent"
type="Separator"/>
<MenuItem id="SendLineToRubyConsole"
class="ICSharpCode.RubyBinding.SendLineToRubyConsoleCommand"
label="${res:ICSharpCode.RubyBinding.SendLineToRubyConsole}"/>
class="ICSharpCode.RubyBinding.SendLineToRubyConsoleCommand"
label="${res:ICSharpCode.RubyBinding.SendLineToRubyConsole}"/>
<Condition name="IsTextSelected" action="Disable">
<MenuItem id="SendSelectedTextToRubyConsole"
class="ICSharpCode.RubyBinding.SendSelectedTextToRubyConsoleCommand"
label="${res:ICSharpCode.RubyBinding.SendSelectedTextToRubyConsole}"/>
class="ICSharpCode.RubyBinding.SendSelectedTextToRubyConsoleCommand"
label="${res:ICSharpCode.RubyBinding.SendSelectedTextToRubyConsole}"/>
</Condition>
</Condition>
</Path>
</Path>
</AddIn>

3
src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.addin

@ -23,7 +23,8 @@ @@ -23,7 +23,8 @@
<FileFilter id = "VBNet"
insertbefore="AllFiles"
name = "${res:SharpDevelop.FileFilter.VBNetFiles}"
extensions = "*.vb"/>
extensions = "*.vb"
mimeType = "text/plain"/>
</Path>
<Path name = "/SharpDevelop/Workbench/Combine/FileFilter">

3
src/AddIns/BackendBindings/WixBinding/Project/WixBinding.addin

@ -28,7 +28,8 @@ @@ -28,7 +28,8 @@
<FileFilter id = "Wix"
insertbefore="AllFiles"
name = "${res:ICSharpCode.WixBinding.WixFileFilterName} (*.wxs;*.wxi)"
extensions = "*.wxs;*.wxi"/>
extensions = "*.wxs;*.wxi"
mimeType = "text/xml"/>
</Path>
<Path name = "/SharpDevelop/MSBuildEngine/CompileTaskNames">

3
src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlBinding.addin

@ -29,7 +29,8 @@ @@ -29,7 +29,8 @@
<FileFilter id = "Xaml"
insertbefore="AllFiles"
name = "Xaml files (*.xaml)"
extensions = "*.xaml"/>
extensions = "*.xaml"
mimeType = "text/xml"/>
</Path>
<Path name = "/Workspace/Parser">

26
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/AvalonEditDisplayBinding.cs

@ -3,13 +3,14 @@ @@ -3,13 +3,14 @@
using System;
using System.IO;
using System.Linq;
using System.Text;
using ICSharpCode.AvalonEdit.Highlighting;
using ICSharpCode.AvalonEdit.Utils;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.AvalonEdit.AddIn
{
@ -37,6 +38,19 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -37,6 +38,19 @@ namespace ICSharpCode.AvalonEdit.AddIn
{
return new AvalonEditViewContent(file);
}
public bool IsPreferredBindingForFile(string fileName)
{
string extension = Path.GetExtension(fileName);
var fileFilter = ProjectService.GetFileFilters().FirstOrDefault(ff => ff.ContainsExtension(extension));
return fileFilter != null && fileFilter.MimeType.StartsWith("text/", StringComparison.OrdinalIgnoreCase);
}
public double AutoDetectFileContent(string fileName, Stream fileContent, string detectedMimeType)
{
return detectedMimeType.StartsWith("text/") ? 0.5 : 0;
}
}
public class ChooseEncodingDisplayBinding : IDisplayBinding
@ -62,5 +76,15 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -62,5 +76,15 @@ namespace ICSharpCode.AvalonEdit.AddIn
return null;
}
}
public bool IsPreferredBindingForFile(string fileName)
{
return false;
}
public double AutoDetectFileContent(string fileName, Stream fileContent, string detectedMimeType)
{
return double.NegativeInfinity;
}
}
}

1
src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/ClassDiagramAddin.addin

@ -132,6 +132,7 @@ @@ -132,6 +132,7 @@
<FileFilter id = "ClassDiagramFileFilter"
name = "Class Diagrams (*.cd)"
extensions = "*.cd"
mimeType="text/xml"
insertbefore = "Boo"/>
</Path>

12
src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/Src/ClassDiagramDisplayBinding.cs

@ -19,12 +19,22 @@ namespace ClassDiagramAddin @@ -19,12 +19,22 @@ namespace ClassDiagramAddin
public bool CanCreateContentForFile(string fileName)
{
return true;
return true; // .addin file filters for *.cd
}
public IViewContent CreateContentForFile(OpenedFile file)
{
return new ClassDiagramViewContent(file);
}
public bool IsPreferredBindingForFile(string fileName)
{
return true;
}
public double AutoDetectFileContent(string fileName, System.IO.Stream fileContent, string detectedMimeType)
{
return 1;
}
}
}

3
src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Addin/ICSharpCode.Data.addin

@ -21,7 +21,8 @@ @@ -21,7 +21,8 @@
<FileFilter id="EntityFramework"
insertbefore="AllFiles"
name="Entity Framework Files (*.edmx)"
extensions="*.edmx" />
extensions="*.edmx"
mimeType="text/xml"/>
</Path>
<Path name="/SharpDevelop/Workbench/Pads">

12
src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/DisplayBinding/EDMDesignerDisplayBinding.cs

@ -19,7 +19,7 @@ namespace ICSharpCode.Data.EDMDesigner.Core.UI.DisplayBinding @@ -19,7 +19,7 @@ namespace ICSharpCode.Data.EDMDesigner.Core.UI.DisplayBinding
{
public bool CanCreateContentForFile(string fileName)
{
return Path.GetExtension(fileName).Equals(".edmx", StringComparison.OrdinalIgnoreCase);
return true; // .addin file filters for *.edmx
}
public IViewContent CreateContentForFile(OpenedFile file)
@ -30,6 +30,16 @@ namespace ICSharpCode.Data.EDMDesigner.Core.UI.DisplayBinding @@ -30,6 +30,16 @@ namespace ICSharpCode.Data.EDMDesigner.Core.UI.DisplayBinding
return null;
}
}
public bool IsPreferredBindingForFile(string fileName)
{
return true;
}
public double AutoDetectFileContent(string fileName, Stream fileContent, string detectedMimeType)
{
return 1;
}
}
public class WizardCancelledException : Exception {}

3
src/AddIns/DisplayBindings/HexEditor/Project/HexEditor.addin

@ -15,9 +15,8 @@ @@ -15,9 +15,8 @@
<Path name = "/SharpDevelop/Workbench/DisplayBindings">
<DisplayBinding id = "HexEditor"
insertbefore = "Text"
insertafter = "Text"
supportedformats = "Binaries"
fileNamePattern="${property:HexEditorOptions/FileTypesAsRegexString??\.(dll|exe)$}"
title = "Hex editor"
class = "HexEditor.View.HexEditDisplayBinding"/>
</Path>

51
src/AddIns/DisplayBindings/HexEditor/Project/Src/View/HexEditDisplayBinding.cs

@ -12,60 +12,21 @@ namespace HexEditor.View @@ -12,60 +12,21 @@ namespace HexEditor.View
{
public class HexEditDisplayBinding : IDisplayBinding
{
static string[] supportedExtensions;
public HexEditDisplayBinding()
{
}
bool IsBinaryFileName(string fileName)
{
if (fileName != null) {
string extension = Path.GetExtension(fileName);
foreach (string supportedExtension in GetSupportedBinaryFileExtensions()) {
if (String.Compare(supportedExtension, extension, StringComparison.OrdinalIgnoreCase) == 0) {
return true;
}
}
}
return false;
}
string[] GetSupportedBinaryFileExtensions()
public bool CanCreateContentForFile(string fileName)
{
if (supportedExtensions == null)
supportedExtensions = Settings.FileTypes;
return supportedExtensions;
return true;
}
bool IsBinary(string fileName)
public bool IsPreferredBindingForFile(string fileName)
{
try {
if (!File.Exists(fileName)) return false;
BinaryReader reader = new BinaryReader(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite));
byte[] data = reader.ReadBytes(1024);
reader.Close();
for (int i = 0; i < data.Length; i++) {
if ((data[i] != 0xA) && (data[i] != 0xD) && (data[i] != 0x9)) {
if (data[i] < 0x20) return true;
}
}
} catch (IOException ex) {
MessageService.ShowException(ex, ex.Message);
} catch (Exception ex) {
System.Diagnostics.Debug.Print(ex.ToString());
}
return false;
}
public bool CanCreateContentForFile(string fileName)
public double AutoDetectFileContent(string fileName, Stream fileContent, string detectedMimeType)
{
return IsBinaryFileName(fileName);
return 0.1;
}
public IViewContent CreateContentForFile(OpenedFile file)
{
return new HexEditView(file);

2
src/AddIns/DisplayBindings/IconEditor/IconEditorAddIn/IconEditorAddIn.addin

@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
<DisplayBinding id = "IconEditor"
class = "ICSharpCode.IconEditorAddIn.IconDisplayBinding"
insertbefore = "Text"
fileNamePattern = "\.ico$"
fileNamePattern = "\.(ico)$"
title = "${res:Gui.ProjectBrowser.OpenWith.Bindings.IconEditor}"/>
</Path>
</AddIn>

10
src/AddIns/DisplayBindings/IconEditor/IconEditorAddIn/Src/IconDisplayBinding.cs

@ -18,5 +18,15 @@ namespace ICSharpCode.IconEditorAddIn @@ -18,5 +18,15 @@ namespace ICSharpCode.IconEditorAddIn
{
return new IconViewContent(file);
}
public bool IsPreferredBindingForFile(string fileName)
{
return true;
}
public double AutoDetectFileContent(string fileName, System.IO.Stream fileContent, string detectedMimeType)
{
return 1;
}
}
}

13
src/AddIns/DisplayBindings/ResourceEditor/Project/Src/DisplayDefinition.cs

@ -18,14 +18,23 @@ namespace ResourceEditor @@ -18,14 +18,23 @@ namespace ResourceEditor
// IDisplayBinding interface
public bool CanCreateContentForFile(string fileName)
{
return Path.GetExtension(fileName).Equals(".RESOURCES", StringComparison.OrdinalIgnoreCase) ||
Path.GetExtension(fileName).Equals(".RESX", StringComparison.OrdinalIgnoreCase);
return true; // definition in .addin does extension-based filtering
}
public IViewContent CreateContentForFile(OpenedFile file)
{
return new ResourceEditWrapper(file);
}
public bool IsPreferredBindingForFile(string fileName)
{
return true;
}
public double AutoDetectFileContent(string fileName, Stream fileContent, string detectedMimeType)
{
return 1;
}
}
/// <summary>

10
src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsDisplayBinding.cs

@ -19,5 +19,15 @@ namespace ICSharpCode.SettingsEditor @@ -19,5 +19,15 @@ namespace ICSharpCode.SettingsEditor
{
return new SettingsViewContent(file);
}
public bool IsPreferredBindingForFile(string fileName)
{
return true;
}
public double AutoDetectFileContent(string fileName, System.IO.Stream fileContent, string detectedMimeType)
{
return 1;
}
}
}

3
src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsEditor.addin

@ -20,7 +20,8 @@ @@ -20,7 +20,8 @@
<FileFilter id = "Settings"
insertbefore="AllFiles"
name = "Settings (*.settings)"
extensions = "*.settings"/>
extensions = "*.settings"
mimeType = "text/xml"/>
</Path>
<Path name = "/SharpDevelop/Workbench/DisplayBindings">

10
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfDisplayBinding.cs

@ -21,6 +21,16 @@ namespace ICSharpCode.WpfDesign.AddIn @@ -21,6 +21,16 @@ namespace ICSharpCode.WpfDesign.AddIn
{
return new WpfViewContent(file);
}
public bool IsPreferredBindingForFile(string fileName)
{
throw new NotImplementedException();
}
public double AutoDetectFileContent(string fileName, Stream fileContent, string detectedMimeType)
{
throw new NotImplementedException();
}
}
public class WpfSecondaryDisplayBinding : ISecondaryDisplayBinding

2
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/WpfDesign.addin

@ -19,7 +19,7 @@ @@ -19,7 +19,7 @@
<!--<DisplayBinding id = "WPFDesigner"
class = "ICSharpCode.WpfDesign.AddIn.WpfPrimaryDisplayBinding"
insertbefore = "Text"
fileNamePattern = "\.xaml$"
fileNamePattern = "\.(xaml)$"
title = "WPF designer"/>-->
<DisplayBinding id="WPFDesigner" type="Secondary" class="ICSharpCode.WpfDesign.AddIn.WpfSecondaryDisplayBinding" fileNamePattern="\.xaml$" />
</Path>

10
src/AddIns/Misc/AddInManager/Project/Src/AddInInstallBinding.cs

@ -20,6 +20,16 @@ namespace ICSharpCode.AddInManager @@ -20,6 +20,16 @@ namespace ICSharpCode.AddInManager
ManagerForm.Instance.ShowInstallableAddIns(new string[] { file.FileName });
return null;
}
public bool IsPreferredBindingForFile(string fileName)
{
return true;
}
public double AutoDetectFileContent(string fileName, System.IO.Stream fileContent, string detectedMimeType)
{
return 1;
}
}
#endif
}

5
src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/ICSharpCode.ReportDesigner.addin

@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
<Path name ="/SharpDevelop/Workbench/DisplayBindings">
<DisplayBinding id="SharpDevelopReportsBinding"
insertbefore="Text"
fileNamePattern="\.srd$"
fileNamePattern="\.(srd)$"
languagePattern="^SharpDevelopReports$"
class="ICSharpCode.Reports.Addin.ReportDesignerDisplayBinding"/>
</Path>
@ -32,7 +32,8 @@ @@ -32,7 +32,8 @@
<FileFilter id="SharpDevelopReports"
insertbefore="AllFiles"
name="SharpDevelop Reports (*.srd)"
extensions="*.srd"/>
extensions="*.srd"
mimeType = "text/xml"/>
</Path>
<!-- ReportExplorer -->

13
src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/DesignerBinding/ReportDesignerDisplayBinding.cs

@ -18,10 +18,9 @@ namespace ICSharpCode.Reports.Addin @@ -18,10 +18,9 @@ namespace ICSharpCode.Reports.Addin
public bool CanCreateContentForFile(string fileName)
{
return System.IO.Path.GetExtension(fileName).Equals(".srd",StringComparison.OrdinalIgnoreCase) ;
return true; // definition in .addin does extension-based filtering
}
public IViewContent CreateContentForFile(OpenedFile file)
{
if (file.IsDirty) {
@ -35,5 +34,15 @@ namespace ICSharpCode.Reports.Addin @@ -35,5 +34,15 @@ namespace ICSharpCode.Reports.Addin
ReportDesignerView view = ICSharpCode.Reports.Addin.Commands.StartViewCommand.SetupDesigner(file);
return view;
}
public bool IsPreferredBindingForFile(string fileName)
{
return true;
}
public double AutoDetectFileContent(string fileName, System.IO.Stream fileContent, string detectedMimeType)
{
return 1;
}
}
}

27
src/AddIns/Misc/TextTemplating/Project/TextTemplating.addin

@ -16,29 +16,30 @@ @@ -16,29 +16,30 @@
<Path name="/SharpDevelop/Workbench/FileFilter">
<FileFilter
id="TextTemplating"
insertbefore="AllFiles"
name="Text Template Files (*.tt;*.t4)"
extensions="*.tt;*.t4"/>
insertbefore="AllFiles"
name="Text Template Files (*.tt;*.t4)"
extensions="*.tt;*.t4"
mimeType = "text/plain"/>
</Path>
<Path name="/Workspace/Icons">
<Icon
id="TextTemplateFileIcon"
extensions=".tt;.t4"
resource="TextTemplate.ProjectBrowser.File"/>
</Path>
<Path name="/SharpDevelop/CustomTools">
<CustomTool
<CustomTool
id="TextTemplatingFileGenerator"
class="ICSharpCode.TextTemplating.TextTemplatingFileGeneratorCustomTool"
fileNamePattern="\.t(t|4)$"/>
<CustomTool
class="ICSharpCode.TextTemplating.TextTemplatingFileGeneratorCustomTool"
fileNamePattern="\.t(t|4)$"/>
<CustomTool
id="TextTemplatingFilePreprocessor"
class="ICSharpCode.TextTemplating.TextTemplatingFilePreprocessorCustomTool"
fileNamePattern="\.t(t|4)$"/>
class="ICSharpCode.TextTemplating.TextTemplatingFilePreprocessorCustomTool"
fileNamePattern="\.t(t|4)$"/>
</Path>
<Path name="/SharpDevelop/ViewContent/AvalonEdit/SyntaxModes">
<SyntaxMode
id="TextTemplating.SyntaxMode"
@ -46,7 +47,7 @@ @@ -46,7 +47,7 @@
name="TextTemplating"
resource="ICSharpCode.TextTemplating.Resources.TextTemplating.xshd"/>
</Path>
<Path name="/SharpDevelop/BackendBindings/Templates">
<Directory id="TextTemplating" path="./Templates"/>
</Path>

10
src/Main/Base/Project/Src/Gui/BrowserDisplayBinding/BrowserDisplayBinding.cs

@ -28,5 +28,15 @@ namespace ICSharpCode.SharpDevelop.BrowserDisplayBinding @@ -28,5 +28,15 @@ namespace ICSharpCode.SharpDevelop.BrowserDisplayBinding
}
return browserPane;
}
public bool IsPreferredBindingForFile(string fileName)
{
return CanCreateContentForFile(fileName);
}
public double AutoDetectFileContent(string fileName, System.IO.Stream fileContent, string detectedMimeType)
{
return 1;
}
}
}

10
src/Main/Base/Project/Src/Project/MSBuildBasedProject.cs

@ -1246,9 +1246,9 @@ namespace ICSharpCode.SharpDevelop.Project @@ -1246,9 +1246,9 @@ namespace ICSharpCode.SharpDevelop.Project
#region Saving
public override void Save(string fileName)
{
watcher.Disable();
watcher.Rename(fileName);
lock (SyncRoot) {
watcher.Disable();
watcher.Rename(fileName);
// we need the global lock - if the file is being renamed,
// MSBuild will update the global project collection
lock (MSBuildInternals.SolutionProjectCollectionLock) {
@ -1259,8 +1259,8 @@ namespace ICSharpCode.SharpDevelop.Project @@ -1259,8 +1259,8 @@ namespace ICSharpCode.SharpDevelop.Project
userProjectFile.Save(userFile);
}
}
watcher.Enable();
}
watcher.Enable();
FileUtility.RaiseFileSaved(new FileNameEventArgs(fileName));
}
#endregion
@ -1381,7 +1381,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -1381,7 +1381,7 @@ namespace ICSharpCode.SharpDevelop.Project
foreach (ProjectPropertyGroupElement g in projectFile.PropertyGroups.Concat(userProjectFile.PropertyGroups)) {
// Rename the default configuration setting
var prop = g.Properties.FirstOrDefault(p => p.Name == "Configuration");
if (prop != null && prop.Value == oldName) {
if (prop != null && prop.Value == oldName) {
prop.Value = newName;
}
@ -1405,7 +1405,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -1405,7 +1405,7 @@ namespace ICSharpCode.SharpDevelop.Project
foreach (ProjectPropertyGroupElement g in projectFile.PropertyGroups.Concat(userProjectFile.PropertyGroups)) {
// Rename the default platform setting
var prop = g.Properties.FirstOrDefault(p => p.Name == "Platform");
if (prop != null && prop.Value == oldName) {
if (prop != null && prop.Value == oldName) {
prop.Value = newName;
}

6
src/Main/Base/Project/Src/Services/DisplayBinding/DisplayBindingDescriptor.cs

@ -107,5 +107,11 @@ namespace ICSharpCode.SharpDevelop @@ -107,5 +107,11 @@ namespace ICSharpCode.SharpDevelop
return false;
return Regex.IsMatch(fileName, fileNameRegex, RegexOptions.IgnoreCase);
}
public override string ToString()
{
return string.Format("[DisplayBindingDescriptor Id={1} Binding={0}]", binding, Id);
}
}
}

7
src/Main/Base/Project/Src/Services/DisplayBinding/DisplayBindingService.cs

@ -110,10 +110,15 @@ namespace ICSharpCode.SharpDevelop @@ -110,10 +110,15 @@ namespace ICSharpCode.SharpDevelop
}
foreach (DisplayBindingDescriptor binding in bindings) {
if (IsPrimaryBindingValidForFileName(binding, filename)) {
if (IsPrimaryBindingValidForFileName(binding, filename) && binding.Binding.IsPreferredBindingForFile(filename)) {
return binding;
}
}
// var autoDetect = new AutoDetectDisplayBinding();
// if (autoDetect.AutoDetectFileContent(filename, new MemoryStream(File.ReadAllBytes(filename))) > double.NegativeInfinity)
// return autoDetect.BestDescriptor;
return null;
}

10
src/Main/Base/Project/Src/Services/DisplayBinding/ExternalProcessDisplayBinding.cs

@ -61,6 +61,16 @@ namespace ICSharpCode.SharpDevelop @@ -61,6 +61,16 @@ namespace ICSharpCode.SharpDevelop
info.WorkingDirectory = workingDir;
Process.Start(info);
}
public bool IsPreferredBindingForFile(string fileName)
{
return false;
}
public double AutoDetectFileContent(string fileName, Stream fileContent, string detectedMimeType)
{
return double.NegativeInfinity;
}
}
sealed class ExternalProcessDisplayBindingConverter : TypeConverter

51
src/Main/Base/Project/Src/Services/DisplayBinding/IDisplayBinding.cs

@ -2,6 +2,9 @@ @@ -2,6 +2,9 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.IO;
using System.Linq;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.SharpDevelop
@ -12,6 +15,8 @@ namespace ICSharpCode.SharpDevelop @@ -12,6 +15,8 @@ namespace ICSharpCode.SharpDevelop
/// </summary>
public interface IDisplayBinding
{
bool IsPreferredBindingForFile(string fileName);
/// <remarks>
/// This function determines, if this display binding is able to create
/// an IViewContent for the file given by fileName.
@ -23,6 +28,8 @@ namespace ICSharpCode.SharpDevelop @@ -23,6 +28,8 @@ namespace ICSharpCode.SharpDevelop
/// </returns>
bool CanCreateContentForFile(string fileName);
double AutoDetectFileContent(string fileName, Stream fileContent, string detectedMimeType);
/// <remarks>
/// Creates a new IViewContent object for the file fileName
/// </remarks>
@ -31,4 +38,48 @@ namespace ICSharpCode.SharpDevelop @@ -31,4 +38,48 @@ namespace ICSharpCode.SharpDevelop
/// </returns>
IViewContent CreateContentForFile(OpenedFile file);
}
public sealed class AutoDetectDisplayBinding : IDisplayBinding
{
DisplayBindingDescriptor bestDescriptor;
public DisplayBindingDescriptor BestDescriptor {
get { return bestDescriptor; }
}
public bool IsPreferredBindingForFile(string fileName)
{
return false;
}
public bool CanCreateContentForFile(string fileName)
{
return true;
}
public double AutoDetectFileContent(string fileName, Stream fileContent, string detectedMimeType)
{
double max = double.MinValue;
// foreach (var codon in DisplayBindingService.GetCodonsPerFileName(fileName)) {
// double value = codon.Binding.AutoDetectFileContent(fileName, fileContent);
// if (value > max) {
// max = value;
// bestDescriptor = codon;
// }
// }
//
// fileContent.Close();
return max;
}
public IViewContent CreateContentForFile(OpenedFile file)
{
if (bestDescriptor == null)
throw new InvalidOperationException();
return bestDescriptor.Binding.CreateContentForFile(file);
}
}
}

12
src/Main/Base/Project/Src/Services/DisplayBinding/ShellExecuteDisplayBinding.cs

@ -15,7 +15,7 @@ namespace ICSharpCode.SharpDevelop @@ -15,7 +15,7 @@ namespace ICSharpCode.SharpDevelop
{
public bool CanCreateContentForFile(string fileName)
{
return !FileUtility.IsUrl(fileName);
return true;
}
public ICSharpCode.SharpDevelop.Gui.IViewContent CreateContentForFile(OpenedFile file)
@ -32,5 +32,15 @@ namespace ICSharpCode.SharpDevelop @@ -32,5 +32,15 @@ namespace ICSharpCode.SharpDevelop
}
return null;
}
public bool IsPreferredBindingForFile(string fileName)
{
return false;
}
public double AutoDetectFileContent(string fileName, Stream fileContent, string detectedMimeType)
{
return double.NegativeInfinity;
}
}
}

10
src/Main/Base/Project/Src/Services/File/FileService.cs

@ -706,6 +706,16 @@ namespace ICSharpCode.SharpDevelop @@ -706,6 +706,16 @@ namespace ICSharpCode.SharpDevelop
{
return new SimpleViewContent(errorMessage) { TitleName = Path.GetFileName(file.FileName) };
}
public bool IsPreferredBindingForFile(string fileName)
{
return false;
}
public double AutoDetectFileContent(string fileName, Stream fileContent, string detectedMimeType)
{
return double.NegativeInfinity;
}
}
}
}

4
src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/FileFilterDoozer.cs

@ -36,7 +36,8 @@ namespace ICSharpCode.Core @@ -36,7 +36,8 @@ namespace ICSharpCode.Core
Codon codon = args.Codon;
return new FileFilterDescriptor {
Name = StringParser.Parse(codon.Properties["name"]),
Extensions = codon.Properties["extensions"]
Extensions = codon.Properties["extensions"],
MimeType = codon.Properties["mimeType"]
};
}
}
@ -45,6 +46,7 @@ namespace ICSharpCode.Core @@ -45,6 +46,7 @@ namespace ICSharpCode.Core
{
public string Name { get; set; }
public string Extensions { get; set; }
public string MimeType { get; set; }
/// <summary>
/// Gets whether this descriptor matches the specified file extension.

Loading…
Cancel
Save