Browse Source

Web references in Boo projects are now supported.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1663 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
8b52417845
  1. 44
      src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/BooLanguageBinding.cs
  2. 12
      src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/BooLanguageProperties.cs
  3. 2
      src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/BooProject.cs
  4. 67
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpLanguageBinding.cs
  5. 16
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/Project/CSharpProject.cs
  6. 68
      src/AddIns/BackendBindings/ILAsmBinding/Project/Src/ILAsmLanguageBinding.cs
  7. 7
      src/AddIns/BackendBindings/ILAsmBinding/Project/Src/ILAsmProject.cs
  8. 15
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/Project/VBNetProject.cs
  9. 65
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetLanguageBinding.cs
  10. 29
      src/AddIns/BackendBindings/WixBinding/Project/Src/WixLanguageBinding.cs
  11. 55
      src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/WebReference.cs
  12. 4
      src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/Commands/FolderNodeCommands.cs
  13. 33
      src/Main/Base/Project/Src/Services/LanguageBinding/ILanguageBinding.cs
  14. 14
      src/Main/Base/Project/Src/Services/LanguageBinding/LanguageBindingDescriptor.cs
  15. 36
      src/Main/Base/Project/Src/Services/LanguageBinding/LanguageBindingService.cs
  16. 38
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/LanguageProperties.cs

44
src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/BooLanguageBinding.cs

@ -6,19 +6,10 @@ @@ -6,19 +6,10 @@
// </file>
using System;
using System.IO;
using System.Diagnostics;
using System.Collections;
using System.Reflection;
using System.Resources;
using System.Windows.Forms;
using System.Xml;
using System.CodeDom.Compiler;
using System.Threading;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Internal.Templates;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
namespace Grunwald.BooBinding
{
@ -32,31 +23,6 @@ namespace Grunwald.BooBinding @@ -32,31 +23,6 @@ namespace Grunwald.BooBinding
}
}
#region routines for single file compilation
public bool CanCompile(string fileName)
{
string ext = Path.GetExtension(fileName);
if (ext == null)
return false;
return string.Equals(ext, ".BOO", StringComparison.InvariantCultureIgnoreCase);
}
public string GetCompiledOutputName(string fileName)
{
return Path.ChangeExtension(fileName, ".exe");
}
public CompilerResults CompileFile(string fileName)
{
throw new NotImplementedException();
}
public void Execute(string fileName, bool debug)
{
throw new NotImplementedException(); // only needed for single-file compilation
}
#endregion
public IProject LoadProject(string fileName, string projectName)
{
return new BooProject(fileName, projectName);
@ -69,5 +35,11 @@ namespace Grunwald.BooBinding @@ -69,5 +35,11 @@ namespace Grunwald.BooBinding
p.ImportOptions(projectOptions.Attributes);
return p;
}
public LanguageProperties LanguageProperties {
get {
return BooLanguageProperties.Instance;
}
}
}
}

12
src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/BooLanguageProperties.cs

@ -47,6 +47,12 @@ namespace Grunwald.BooBinding @@ -47,6 +47,12 @@ namespace Grunwald.BooBinding
}
}
public override bool SupportsImplicitInterfaceImplementation {
get {
return true;
}
}
public override RefactoringProvider RefactoringProvider {
get {
return CodeCompletion.BooRefactoringProvider.BooProvider;
@ -58,5 +64,11 @@ namespace Grunwald.BooBinding @@ -58,5 +64,11 @@ namespace Grunwald.BooBinding
return BooCodeGenerator.Instance;
}
}
public override System.CodeDom.Compiler.CodeDomProvider CodeDomProvider {
get {
return new Boo.Lang.CodeDom.BooCodeProvider();
}
}
}
}

2
src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/BooProject.cs

@ -68,7 +68,7 @@ namespace Grunwald.BooBinding @@ -68,7 +68,7 @@ namespace Grunwald.BooBinding
public override bool CanCompile(string fileName)
{
return new BooLanguageBinding().CanCompile(fileName);
return string.Equals(Path.GetExtension(fileName), ".boo", StringComparison.OrdinalIgnoreCase);
}
internal static IProjectContent BooCompilerPC;

67
src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpLanguageBinding.cs

@ -1,25 +1,15 @@ @@ -1,25 +1,15 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version>
// </file>
using System;
using System.IO;
using System.Diagnostics;
using System.Collections;
using System.Reflection;
using System.Resources;
using System.Windows.Forms;
using System.Xml;
using System.CodeDom.Compiler;
using System.Threading;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Internal.Templates;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
namespace CSharpBinding
{
@ -33,57 +23,6 @@ namespace CSharpBinding @@ -33,57 +23,6 @@ namespace CSharpBinding
}
}
#region routines for single file compilation
public bool CanCompile(string fileName)
{
Debug.Assert(fileName != null);
string ext = Path.GetExtension(fileName);
if (ext == null) {
return false;
}
return ext.Equals(".CS", StringComparison.OrdinalIgnoreCase);
}
public string GetCompiledOutputName(string fileName)
{
Debug.Assert(CanCompile(fileName));
return Path.ChangeExtension(fileName, ".exe");
}
public CompilerResults CompileFile(string fileName)
{
Debug.Assert(CanCompile(fileName));
// TODO: Implement me!
return null;
}
public void Execute(string fileName, bool debug)
{
string exe = GetCompiledOutputName(fileName);
if (debug) {
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = exe;
psi.WorkingDirectory = Path.GetDirectoryName(exe);
psi.Arguments = "";
DebuggerService.CurrentDebugger.Start(psi);
} else {
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = Environment.GetEnvironmentVariable("ComSpec");
psi.WorkingDirectory = Path.GetDirectoryName(exe);
psi.Arguments = "/c " + "\"" + exe + "\"" + " & pause";
psi.UseShellExecute = false;
DebuggerService.CurrentDebugger.StartWithoutDebugging(psi);
}
}
#endregion
public IProject LoadProject(string fileName, string projectName)
{
return new CSharpProject(fileName, projectName);

16
src/AddIns/BackendBindings/CSharpBinding/Project/Src/Project/CSharpProject.cs

@ -7,20 +7,12 @@ @@ -7,20 +7,12 @@
using System;
using System.ComponentModel;
using System.IO;
using System.Diagnostics;
using System.Collections;
using System.Reflection;
using System.Resources;
using System.Windows.Forms;
using System.Xml;
using System.CodeDom.Compiler;
using System.Threading;
using System.IO;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Internal.Templates;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Internal.Templates;
using ICSharpCode.SharpDevelop.Project;
namespace CSharpBinding
{
@ -62,7 +54,7 @@ namespace CSharpBinding @@ -62,7 +54,7 @@ namespace CSharpBinding
public override bool CanCompile(string fileName)
{
return new CSharpLanguageBinding().CanCompile(fileName);
return string.Equals(Path.GetExtension(fileName), ".cs", StringComparison.OrdinalIgnoreCase);
}
}
}

68
src/AddIns/BackendBindings/ILAsmBinding/Project/Src/ILAsmLanguageBinding.cs

@ -6,20 +6,10 @@ @@ -6,20 +6,10 @@
// </file>
using System;
using System.IO;
using System.Diagnostics;
using System.Collections;
using System.Reflection;
using System.Resources;
using System.Windows.Forms;
using System.Xml;
using System.CodeDom.Compiler;
using System.Threading;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Internal.Templates;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.ILAsmBinding
{
@ -27,64 +17,12 @@ namespace ICSharpCode.ILAsmBinding @@ -27,64 +17,12 @@ namespace ICSharpCode.ILAsmBinding
{
public const string LanguageName = "ILAsm";
public string Language
{
public string Language {
get {
return LanguageName;
}
}
#region routines for single file compilation
public bool CanCompile(string fileName)
{
Debug.Assert(fileName != null);
string ext = Path.GetExtension(fileName);
if (ext == null) {
return false;
}
return ext.Equals(".IL", StringComparison.OrdinalIgnoreCase);
}
public string GetCompiledOutputName(string fileName)
{
Debug.Assert(CanCompile(fileName));
return Path.ChangeExtension(fileName, ".exe");
}
public CompilerResults CompileFile(string fileName)
{
Debug.Assert(CanCompile(fileName));
// TODO: Implement me!
return null;
}
public void Execute(string fileName, bool debug)
{
string exe = GetCompiledOutputName(fileName);
if (debug) {
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = exe;
psi.WorkingDirectory = Path.GetDirectoryName(exe);
psi.Arguments = "";
DebuggerService.CurrentDebugger.Start(psi);
} else {
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = Environment.GetEnvironmentVariable("ComSpec");
psi.WorkingDirectory = Path.GetDirectoryName(exe);
psi.Arguments = "/c " + "\"" + exe + "\"" + " & pause";
psi.UseShellExecute = false;
DebuggerService.CurrentDebugger.StartWithoutDebugging(psi);
}
}
#endregion
public IProject LoadProject(string fileName, string projectName)
{
return new ILAsmProject(fileName, projectName);

7
src/AddIns/BackendBindings/ILAsmBinding/Project/Src/ILAsmProject.cs

@ -1,11 +1,12 @@ @@ -1,11 +1,12 @@
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version>
// </file>
using System;
using System.IO;
using ICSharpCode.SharpDevelop.Internal.Templates;
using ICSharpCode.SharpDevelop.Project;
@ -30,7 +31,7 @@ namespace ICSharpCode.ILAsmBinding @@ -30,7 +31,7 @@ namespace ICSharpCode.ILAsmBinding
public override bool CanCompile(string fileName)
{
return new ILAsmLanguageBinding().CanCompile(fileName);
return string.Equals(".il", Path.GetExtension(fileName), StringComparison.InvariantCultureIgnoreCase);
}
}
}

15
src/AddIns/BackendBindings/VBNetBinding/Project/Src/Project/VBNetProject.cs

@ -8,19 +8,10 @@ @@ -8,19 +8,10 @@
using System;
using System.ComponentModel;
using System.IO;
using System.Diagnostics;
using System.Collections;
using System.Reflection;
using System.Resources;
using System.Windows.Forms;
using System.Xml;
using System.CodeDom.Compiler;
using System.Threading;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Internal.Templates;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Internal.Templates;
using ICSharpCode.SharpDevelop.Project;
namespace VBNetBinding
{
@ -88,7 +79,7 @@ namespace VBNetBinding @@ -88,7 +79,7 @@ namespace VBNetBinding
public override bool CanCompile(string fileName)
{
return new VBNetLanguageBinding().CanCompile(fileName);
return string.Equals(Path.GetExtension(fileName), ".vb", StringComparison.OrdinalIgnoreCase);
}
}
}

65
src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetLanguageBinding.cs

@ -6,20 +6,10 @@ @@ -6,20 +6,10 @@
// </file>
using System;
using System.IO;
using System.Diagnostics;
using System.Collections;
using System.Reflection;
using System.Resources;
using System.Windows.Forms;
using System.Xml;
using System.CodeDom.Compiler;
using System.Threading;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Internal.Templates;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
namespace VBNetBinding
{
@ -34,57 +24,6 @@ namespace VBNetBinding @@ -34,57 +24,6 @@ namespace VBNetBinding
}
}
#region routines for single file compilation
public bool CanCompile(string fileName)
{
Debug.Assert(fileName != null);
string ext = Path.GetExtension(fileName);
if (ext == null) {
return false;
}
return ext.Equals(".VB", StringComparison.OrdinalIgnoreCase);
}
public string GetCompiledOutputName(string fileName)
{
Debug.Assert(CanCompile(fileName));
return Path.ChangeExtension(fileName, ".exe");
}
public CompilerResults CompileFile(string fileName)
{
Debug.Assert(CanCompile(fileName));
// TODO: Implement me!
return null;
}
public void Execute(string fileName, bool debug)
{
string exe = GetCompiledOutputName(fileName);
if (debug) {
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = exe;
psi.WorkingDirectory = Path.GetDirectoryName(exe);
psi.Arguments = "";
DebuggerService.CurrentDebugger.Start(psi);
} else {
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = Environment.GetEnvironmentVariable("ComSpec");
psi.WorkingDirectory = Path.GetDirectoryName(exe);
psi.Arguments = "/c " + "\"" + exe + "\"" + " & pause";
psi.UseShellExecute = false;
DebuggerService.CurrentDebugger.StartWithoutDebugging(psi);
}
}
#endregion
public IProject LoadProject(string fileName, string projectName)
{
return new VBNetProject(fileName, projectName);

29
src/AddIns/BackendBindings/WixBinding/Project/Src/WixLanguageBinding.cs

@ -6,12 +6,10 @@ @@ -6,12 +6,10 @@
// </file>
using System;
using System.CodeDom.Compiler;
using System.IO;
using System.Xml;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Internal.Templates;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.WixBinding
{
@ -25,29 +23,6 @@ namespace ICSharpCode.WixBinding @@ -25,29 +23,6 @@ namespace ICSharpCode.WixBinding
}
}
public void Execute(string fileName, bool debug)
{
}
public string GetCompiledOutputName(string fileName)
{
return String.Empty;
}
public bool CanCompile(string fileName)
{
string ext = Path.GetExtension(fileName);
if (ext == null) {
return false;
}
return ext.Equals(".wxs", StringComparison.OrdinalIgnoreCase);
}
public CompilerResults CompileFile(string fileName)
{
return null;
}
public IProject LoadProject(string fileName, string projectName)
{
return new WixProject(fileName, projectName);

55
src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/WebReference.cs

@ -21,7 +21,7 @@ using System.Xml.Serialization; @@ -21,7 +21,7 @@ using System.Xml.Serialization;
namespace ICSharpCode.SharpDevelop.Gui
{
public class WebReference
{
{
List<ProjectItem> items;
string url = String.Empty;
string relativePath = String.Empty;
@ -41,7 +41,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -41,7 +41,7 @@ namespace ICSharpCode.SharpDevelop.Gui
this.name = name;
GetRelativePath();
}
public static bool ProjectContainsWebReferencesFolder(IProject project)
{
return GetWebReferencesProjectItem(project) != null;
@ -70,12 +70,12 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -70,12 +70,12 @@ namespace ICSharpCode.SharpDevelop.Gui
}
/// <summary>
/// Returns the reference name. If the folder that will contain the
/// web reference already exists this method looks for a new folder by
/// Returns the reference name. If the folder that will contain the
/// web reference already exists this method looks for a new folder by
/// adding a digit to the end of the reference name.
/// </summary>
public static string GetReferenceName(string webReferenceFolder, string name)
{
{
// If it is already in the project, or it does exists we get a new name.
int count = 1;
string referenceName = name;
@ -84,7 +84,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -84,7 +84,7 @@ namespace ICSharpCode.SharpDevelop.Gui
referenceName = String.Concat(name, count.ToString());
folder = Path.Combine(webReferenceFolder, referenceName);
++count;
}
}
return referenceName;
}
@ -95,13 +95,13 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -95,13 +95,13 @@ namespace ICSharpCode.SharpDevelop.Gui
/// <param name="name">The name of the web reference to look for. This is
/// not the full path of the web reference, just the last folder's name.</param>
/// <remarks>
/// This method does not return the WebReferenceUrl project item only the
/// This method does not return the WebReferenceUrl project item only the
/// files that are part of the web reference.
/// </remarks>
public static List<ProjectItem> GetFileItems(IProject project, string name)
{
List<ProjectItem> items = new List<ProjectItem>();
// Find web references folder.
WebReferencesProjectItem webReferencesProjectItem = GetWebReferencesProjectItem(project);
if (webReferencesProjectItem != null) {
@ -137,7 +137,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -137,7 +137,7 @@ namespace ICSharpCode.SharpDevelop.Gui
}
/// <summary>
/// Gets the web references directory which is the parent folder for
/// Gets the web references directory which is the parent folder for
/// this web reference.
/// </summary>
public string WebReferencesDirectory {
@ -269,23 +269,14 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -269,23 +269,14 @@ namespace ICSharpCode.SharpDevelop.Gui
codeUnit.Namespaces.Add(codeNamespace);
ServiceDescriptionImportWarnings warnings = importer.Import(codeNamespace, codeUnit);
CodeDomProvider provider;
CodeDomProvider provider = null;
switch(Path.GetExtension(fileName).ToLowerInvariant()) {
case ".cs":
provider = new Microsoft.CSharp.CSharpCodeProvider();
break;
case ".vb":
provider = new Microsoft.VisualBasic.VBCodeProvider();
break;
default:
// extension not supported
provider = null;
break;
ICSharpCode.SharpDevelop.Dom.IParser parser = ParserService.GetParser(fileName);
if (parser != null) {
provider = parser.Language.CodeDomProvider;
}
if(provider != null) {
if (provider != null) {
StreamWriter sw = new StreamWriter(fileName);
CodeGeneratorOptions options = new CodeGeneratorOptions();
options.BracingStyle = "C";
@ -307,14 +298,14 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -307,14 +298,14 @@ namespace ICSharpCode.SharpDevelop.Gui
string GetProxyFileNameExtension(string language)
{
switch (language) {
case "C#":
return ".cs";
case "VBNet":
return ".vb";
default:
throw new NotImplementedException(String.Concat("Unhandled language: ", language));
LanguageBindingDescriptor binding = LanguageBindingService.GetCodonPerLanguageName(language);
if (binding != null) {
string[] extensions = binding.CodeFileExtensions;
if (extensions.Length > 0) {
return extensions[0];
}
}
throw new NotSupportedException("Unsupported language: " + language);
}
static WebReferencesProjectItem GetWebReferencesProjectItem(List<ProjectItem> items)
@ -359,7 +350,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -359,7 +350,7 @@ namespace ICSharpCode.SharpDevelop.Gui
List<ProjectItem> CreateProjectItems()
{
List<ProjectItem> items = new List<ProjectItem>();
// Web references item.
if (!ProjectContainsWebReferencesFolder(project)) {
WebReferencesProjectItem webReferencesItem = new WebReferencesProjectItem(project);
@ -429,7 +420,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -429,7 +420,7 @@ namespace ICSharpCode.SharpDevelop.Gui
/// <summary>
/// Checks the file project items against the file items this web reference
/// has and adds any items that have been removed but still exist in the
/// has and adds any items that have been removed but still exist in the
/// project.
/// </summary>
List<ProjectItem> GetRemovedItems(List<ProjectItem> projectWebReferenceItems)

4
src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/Commands/FolderNodeCommands.cs

@ -56,8 +56,8 @@ namespace ICSharpCode.SharpDevelop.Project.Commands @@ -56,8 +56,8 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
LanguageBindingDescriptor languageCodon = LanguageBindingService.GetCodonPerLanguageName(project.Language);
if (languageCodon != null) {
for (int i = 0; i < fileFilters.Length; ++i) {
for (int j = 0; j < languageCodon.Supportedextensions.Length; ++j) {
if (fileFilters[i].ToUpperInvariant().IndexOf(languageCodon.Supportedextensions[j].ToUpperInvariant()) >= 0) {
for (int j = 0; j < languageCodon.CodeFileExtensions.Length; ++j) {
if (fileFilters[i].ToUpperInvariant().IndexOf(languageCodon.CodeFileExtensions[j].ToUpperInvariant()) >= 0) {
return i + 1;
}
}

33
src/Main/Base/Project/Src/Services/LanguageBinding/ILanguageBinding.cs

@ -7,11 +7,10 @@ @@ -7,11 +7,10 @@
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Xml;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Internal.Templates;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.SharpDevelop.Project
{
@ -28,36 +27,6 @@ namespace ICSharpCode.SharpDevelop.Project @@ -28,36 +27,6 @@ namespace ICSharpCode.SharpDevelop.Project
get;
}
#region routines for single file compilation
/// <summary>
/// Is used to determine, if this language binding is able to compile a specific file.
/// </summary>
/// <param name="fileName">The file name of the file to compile.</param>
/// <returns>True, if this language binding can compile the given file.</returns>
bool CanCompile(string fileName);
/// <summary>
/// Compiles a single file.
/// </summary>
/// <param name="fileName">The file name of the file to compile.</param>
/// <returns>The compiler results.</returns>
CompilerResults CompileFile(string fileName);
/// <summary>
/// This function executes a file, the filename is given by filename,
/// the file was compiled by the compiler object before.
/// </summary>
void Execute(string fileName, bool debug);
/// <summary>
/// Returns the name of the file output. (need only to work for CanCompile == true files)
/// </summary>
/// <param name="fileName">The file name of the file to compile.</param>
/// <returns>The compiled assembly name (full path).</returns>
string GetCompiledOutputName(string fileName);
#endregion
IProject LoadProject(string fileName, string projectName);
/// <summary>

14
src/Main/Base/Project/Src/Services/LanguageBinding/LanguageBindingDescriptor.cs

@ -16,7 +16,7 @@ using ICSharpCode.SharpDevelop.Project; @@ -16,7 +16,7 @@ using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.Core
{
public class LanguageBindingDescriptor
public class LanguageBindingDescriptor
{
ILanguageBinding binding = null;
Codon codon;
@ -53,9 +53,17 @@ namespace ICSharpCode.Core @@ -53,9 +53,17 @@ namespace ICSharpCode.Core
}
}
public string[] Supportedextensions {
string[] codeFileExtensions;
public string[] CodeFileExtensions {
get {
return codon.Properties["supportedextensions"].Split(';');
if (codeFileExtensions == null) {
if (codon.Properties["supportedextensions"].Length == 0)
codeFileExtensions = new string[0];
else
codeFileExtensions = codon.Properties["supportedextensions"].ToLowerInvariant().Split(';');
}
return codeFileExtensions;
}
}

36
src/Main/Base/Project/Src/Services/LanguageBinding/LanguageBindingService.cs

@ -1,24 +1,27 @@ @@ -1,24 +1,27 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Xml;
using System.Collections.Generic;
using System.IO;
using System.Collections;
using System.Reflection;
using System.CodeDom.Compiler;
using System.Xml;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.Core
{
public class LanguageBindingService
public static class LanguageBindingService
{
static LanguageBindingDescriptor[] bindings = null;
static IList<LanguageBindingDescriptor> bindings;
static LanguageBindingService()
{
bindings = AddInTree.BuildItems<LanguageBindingDescriptor>("/SharpDevelop/Workbench/LanguageBindings", null, false);
}
public static string GetProjectFileExtension(string languageName)
{
@ -32,9 +35,9 @@ namespace ICSharpCode.Core @@ -32,9 +35,9 @@ namespace ICSharpCode.Core
return descriptor == null ? null : descriptor.Binding;
}
public static ILanguageBinding GetBindingPerFileName(string filename)
public static ILanguageBinding GetBindingCodePerFileName(string filename)
{
LanguageBindingDescriptor descriptor = GetCodonPerFileName(filename);
LanguageBindingDescriptor descriptor = GetCodonPerCodeFileName(filename);
return descriptor == null ? null : descriptor.Binding;
}
@ -54,10 +57,11 @@ namespace ICSharpCode.Core @@ -54,10 +57,11 @@ namespace ICSharpCode.Core
return null;
}
public static LanguageBindingDescriptor GetCodonPerFileName(string filename)
public static LanguageBindingDescriptor GetCodonPerCodeFileName(string filename)
{
string extension = Path.GetExtension(filename).ToLowerInvariant();
foreach (LanguageBindingDescriptor binding in bindings) {
if (binding.Binding.CanCompile(filename)) {
if (Array.IndexOf(binding.CodeFileExtensions, extension) >= 0) {
return binding;
}
}
@ -107,15 +111,5 @@ namespace ICSharpCode.Core @@ -107,15 +111,5 @@ namespace ICSharpCode.Core
}
return newProject;
}
static LanguageBindingService()
{
try {
AddInTreeNode treeNode = AddInTree.GetTreeNode("/SharpDevelop/Workbench/LanguageBindings");
bindings = (LanguageBindingDescriptor[])(treeNode.BuildChildItems(null)).ToArray(typeof(LanguageBindingDescriptor));
} catch (TreePathNotFoundException) {
bindings = new LanguageBindingDescriptor[] {};
}
}
}
}

38
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/LanguageProperties.cs

@ -12,7 +12,20 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -12,7 +12,20 @@ namespace ICSharpCode.SharpDevelop.Dom
{
public class LanguageProperties
{
/// <summary>
/// A case-sensitive dummy language that returns false for all Supports.. properties,
/// uses a dummy code generator and refactoring provider and returns null for CodeDomProvider.
/// </summary>
public readonly static LanguageProperties None = new LanguageProperties(StringComparer.InvariantCulture);
/// <summary>
/// C# 2.0 language properties.
/// </summary>
public readonly static LanguageProperties CSharp = new CSharpProperties();
/// <summary>
/// VB.Net 8 language properties.
/// </summary>
public readonly static LanguageProperties VBNet = new VBNetProperties();
public LanguageProperties(StringComparer nameComparer)
@ -41,9 +54,12 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -41,9 +54,12 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
/// <summary>
/// Gets the CodeDomProvider for this language. Can return null!
/// </summary>
public virtual System.CodeDom.Compiler.CodeDomProvider CodeDomProvider {
get {
return DummyCodeDomProvider.Instance;
return null;
}
}
@ -139,7 +155,7 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -139,7 +155,7 @@ namespace ICSharpCode.SharpDevelop.Dom
/// </summary>
public virtual bool SupportsImplicitInterfaceImplementation {
get {
return true;
return false;
}
}
@ -198,6 +214,18 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -198,6 +214,18 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
public override System.CodeDom.Compiler.CodeDomProvider CodeDomProvider {
get {
return new Microsoft.CSharp.CSharpCodeProvider();
}
}
public override bool SupportsImplicitInterfaceImplementation {
get {
return true;
}
}
public override string ToString()
{
return "[LanguageProperties: C#]";
@ -230,12 +258,6 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -230,12 +258,6 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
public override bool SupportsImplicitInterfaceImplementation {
get {
return false;
}
}
public override bool CanImportClasses {
get {
return true;

Loading…
Cancel
Save