From 1a6fa9846107b4267748e3a4a7e83dc89165ee9b Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Mon, 3 Apr 2006 17:30:23 +0000 Subject: [PATCH] =?UTF-8?q?Added=20simple=20ASPX=20syntax=20highlighting,?= =?UTF-8?q?=20added=20Web=20application=20project=20template=20by=20Tom=20?= =?UTF-8?q?Schr=C3=B6ter.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1262 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../file/CSharp/CSharp.Web.WebControl.xft | 100 ++++ .../file/CSharp/CSharp.Web.WebForm.xft | 194 +++++++ .../file/CSharp/CSharp.Web.WebService.xft | 82 +++ .../project/CSharp/WebpageProject.xpt | 512 ++++++++++++++++++ .../Project/Resources/ASPX.xshd | 54 +- .../Project/Resources/Mode.xsd | 4 +- .../Project/Resources/SyntaxModes.xml | 4 +- .../DefaultHighlightingStrategy.cs | 223 ++++---- .../HighlightingStrategy/HighlightRuleSet.cs | 24 +- .../HighlightingDefinitionParser.cs | 26 +- .../HighlightingManager.cs | 28 +- .../SyntaxModes/FileSyntaxModeProvider.cs | 10 +- .../SyntaxModes/ISyntaxModeFileProvider.cs | 4 +- .../SyntaxModes/ResourceSyntaxModeProvider.cs | 8 +- .../SyntaxModes/SyntaxMode.cs | 6 +- .../Document/HighlightingStrategy/TextWord.cs | 2 +- .../Project/Src/Gui/Dialogs/NewFileDialog.cs | 7 +- .../Commands/FolderNodeCommands.cs | 3 + .../Project/ProjectCreateInformation.cs | 12 + .../Templates/Project/ProjectDescriptor.cs | 6 + .../Project/Src/Project/MSBuildProject.cs | 8 +- .../Codons/AddInTreeSyntaxModeProvider.cs | 12 +- 22 files changed, 1137 insertions(+), 192 deletions(-) create mode 100644 data/templates/file/CSharp/CSharp.Web.WebControl.xft create mode 100644 data/templates/file/CSharp/CSharp.Web.WebForm.xft create mode 100644 data/templates/file/CSharp/CSharp.Web.WebService.xft create mode 100644 data/templates/project/CSharp/WebpageProject.xpt diff --git a/data/templates/file/CSharp/CSharp.Web.WebControl.xft b/data/templates/file/CSharp/CSharp.Web.WebControl.xft new file mode 100644 index 0000000000..3b7afc12f9 --- /dev/null +++ b/data/templates/file/CSharp/CSharp.Web.WebControl.xft @@ -0,0 +1,100 @@ + + diff --git a/data/templates/file/CSharp/CSharp.Web.WebForm.xft b/data/templates/file/CSharp/CSharp.Web.WebForm.xft new file mode 100644 index 0000000000..de10ca6559 --- /dev/null +++ b/data/templates/file/CSharp/CSharp.Web.WebForm.xft @@ -0,0 +1,194 @@ + + diff --git a/data/templates/file/CSharp/CSharp.Web.WebService.xft b/data/templates/file/CSharp/CSharp.Web.WebService.xft new file mode 100644 index 0000000000..6c65d50f45 --- /dev/null +++ b/data/templates/file/CSharp/CSharp.Web.WebService.xft @@ -0,0 +1,82 @@ + + diff --git a/data/templates/project/CSharp/WebpageProject.xpt b/data/templates/project/CSharp/WebpageProject.xpt new file mode 100644 index 0000000000..017efe090f --- /dev/null +++ b/data/templates/project/CSharp/WebpageProject.xpt @@ -0,0 +1,512 @@ + + diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Resources/ASPX.xshd b/src/Libraries/ICSharpCode.TextEditor/Project/Resources/ASPX.xshd index 8650acd8b3..04a5b1edca 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Resources/ASPX.xshd +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Resources/ASPX.xshd @@ -1,49 +1,17 @@ - - - - - - - - - - - - - - - - - - - - - - - + - - <> - - <% - %> - - - - < - > - - - - - - - ' - - + + + <% + %> + + - + + + // + diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Resources/Mode.xsd b/src/Libraries/ICSharpCode.TextEditor/Project/Resources/Mode.xsd index 98dd64e43d..97bbeaf63e 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Resources/Mode.xsd +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Resources/Mode.xsd @@ -320,7 +320,7 @@ - + + + diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Resources/SyntaxModes.xml b/src/Libraries/ICSharpCode.TextEditor/Project/Resources/SyntaxModes.xml index 20ec50e9d0..c14fe14c2a 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Resources/SyntaxModes.xml +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Resources/SyntaxModes.xml @@ -1,7 +1,7 @@ + name = "ASP/XHTML" + extensions = ".asp;.aspx;.asax;.asmx"/> (); + + // check for SPAN BEGIN + if (activeRuleSet != null) { + foreach (Span span in activeRuleSet.Spans) { + if (currentLine.MatchExpr(span.Begin, i, document)) { + PushCurWord(document, ref markNext, words); + string regex = currentLine.GetRegString(span.Begin, i, document); + currentLength += regex.Length; + words.Add(new TextWord(document, currentLine, currentOffset, currentLength, span.BeginColor, false)); + currentOffset += currentLength; + currentLength = 0; + + i += regex.Length - 1; + if (currentSpanStack == null) { + currentSpanStack = new Stack(); + } + currentSpanStack.Push(span); + + UpdateSpanStateVariables(); + + goto skip; } - currentSpanStack.Push(span); - - UpdateSpanStateVariables(); - - goto skip; } } - } - - // check if the char is a delimiter - if (activeRuleSet != null && (int)ch < 256 && activeRuleSet.Delimiters[(int)ch]) { - PushCurWord(document, ref markNext, words); - if (currentOffset + currentLength +1 < currentLine.Length) { - ++currentLength; + + // check if the char is a delimiter + if (activeRuleSet != null && (int)ch < 256 && activeRuleSet.Delimiters[(int)ch]) { PushCurWord(document, ref markNext, words); - goto skip; + if (currentOffset + currentLength +1 < currentLine.Length) { + ++currentLength; + PushCurWord(document, ref markNext, words); + goto skip; + } } + + ++currentLength; + skip: continue; } - - ++currentLength; - skip: continue; - } } } diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/HighlightRuleSet.cs b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/HighlightRuleSet.cs index c01d8236fa..49ee6d89dc 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/HighlightRuleSet.cs +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/HighlightRuleSet.cs @@ -107,7 +107,7 @@ namespace ICSharpCode.TextEditor.Document public HighlightRuleSet(XmlElement el) { - XmlNodeList nodes = el.GetElementsByTagName("KeyWords"); + XmlNodeList nodes; if (el.Attributes["name"] != null) { Name = el.Attributes["name"].InnerText; @@ -126,13 +126,13 @@ namespace ICSharpCode.TextEditor.Document } for (int i = 0; i < Delimiters.Length; ++i) { - Delimiters[i] = false; + delimiters[i] = false; } if (el["Delimiters"] != null) { string delimiterString = el["Delimiters"].InnerText; foreach (char ch in delimiterString) { - Delimiters[(int)ch] = true; + delimiters[(int)ch] = true; } } @@ -142,6 +142,7 @@ namespace ICSharpCode.TextEditor.Document prevMarkers = new LookupTable(!IgnoreCase); nextMarkers = new LookupTable(!IgnoreCase); + nodes = el.GetElementsByTagName("KeyWords"); foreach (XmlElement el2 in nodes) { HighlightColor color = new HighlightColor(el2); @@ -171,5 +172,22 @@ namespace ICSharpCode.TextEditor.Document nextMarkers[next.What] = next; } } + + /// + /// Merges spans etc. from the other rule set into this rule set. + /// + public void MergeFrom(HighlightRuleSet ruleSet) + { + for (int i = 0; i < delimiters.Length; i++) { + delimiters[i] |= ruleSet.delimiters[i]; + } + // insert merged spans in front of old spans + ArrayList oldSpans = spans; + spans = (ArrayList)ruleSet.spans.Clone(); + spans.AddRange(oldSpans); + //keyWords.MergeFrom(ruleSet.keyWords); + //prevMarkers.MergeFrom(ruleSet.prevMarkers); + //nextMarkers.MergeFrom(ruleSet.nextMarkers); + } } } diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/HighlightingDefinitionParser.cs b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/HighlightingDefinitionParser.cs index d96c0ca91e..8d72f448d9 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/HighlightingDefinitionParser.cs +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/HighlightingDefinitionParser.cs @@ -11,6 +11,7 @@ using System.Xml; using System.Xml.Schema; using System.Text; using System.Collections; +using System.Collections.Generic; using System.Windows.Forms; using System.Reflection; @@ -24,8 +25,13 @@ namespace ICSharpCode.TextEditor.Document } static ArrayList errors = null; - + public static DefaultHighlightingStrategy Parse(SyntaxMode syntaxMode, XmlTextReader xmlTextReader) + { + return Parse(null, syntaxMode, xmlTextReader); + } + + public static DefaultHighlightingStrategy Parse(DefaultHighlightingStrategy highlighter, SyntaxMode syntaxMode, XmlTextReader xmlTextReader) { if (syntaxMode == null) throw new ArgumentNullException("syntaxMode"); @@ -48,10 +54,20 @@ namespace ICSharpCode.TextEditor.Document XmlDocument doc = new XmlDocument(); doc.Load(validatingReader); - DefaultHighlightingStrategy highlighter = new DefaultHighlightingStrategy(doc.DocumentElement.Attributes["name"].InnerText); + if (highlighter == null) + highlighter = new DefaultHighlightingStrategy(doc.DocumentElement.Attributes["name"].InnerText); - if (doc.DocumentElement.Attributes["extensions"]!= null) { - highlighter.Extensions = doc.DocumentElement.Attributes["extensions"].InnerText.Split(new char[] { ';', '|' }); + if (doc.DocumentElement.HasAttribute("extends")) { + KeyValuePair entry = HighlightingManager.Manager.FindHighlighterEntry(doc.DocumentElement.GetAttribute("extends")); + if (entry.Key == null) { + MessageBox.Show("Cannot find referenced highlighting source " + doc.DocumentElement.GetAttribute("extends")); + } else { + highlighter = Parse(highlighter, entry.Key, entry.Value.GetSyntaxModeFile(entry.Key)); + if (highlighter == null) return null; + } + } + if (doc.DocumentElement.HasAttribute("extensions")) { + highlighter.Extensions = doc.DocumentElement.GetAttribute("extensions").Split(new char[] { ';', '|' }); } XmlElement environment = doc.DocumentElement["Environment"]; @@ -90,7 +106,7 @@ namespace ICSharpCode.TextEditor.Document return highlighter; } } catch (Exception e) { - MessageBox.Show("Could not load mode definition file.\n" + e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); + MessageBox.Show("Could not load mode definition file '" + syntaxMode.FileName + "'.\n" + e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); return null; } } diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/HighlightingManager.cs b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/HighlightingManager.cs index 23440d6033..796fd6270e 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/HighlightingManager.cs +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/HighlightingManager.cs @@ -8,6 +8,7 @@ using System; using System.Collections; using System.Collections.Specialized; +using System.Collections.Generic; using System.Windows.Forms; using System.IO; using System.Reflection; @@ -84,19 +85,40 @@ namespace ICSharpCode.TextEditor.Document ISyntaxModeFileProvider syntaxModeFileProvider = (ISyntaxModeFileProvider)entry.Value; DefaultHighlightingStrategy highlightingStrategy = HighlightingDefinitionParser.Parse(syntaxMode, syntaxModeFileProvider.GetSyntaxModeFile(syntaxMode)); + if (highlightingStrategy == null) { + highlightingStrategy = DefaultHighlighting; + } highlightingDefs[syntaxMode.Name] = highlightingStrategy; highlightingStrategy.ResolveReferences(); return highlightingStrategy; } + public DefaultHighlightingStrategy DefaultHighlighting { + get { + return (DefaultHighlightingStrategy)highlightingDefs["Default"]; + } + } + + internal KeyValuePair FindHighlighterEntry(string name) + { + foreach (ISyntaxModeFileProvider provider in syntaxModeFileProviders) { + foreach (SyntaxMode mode in provider.SyntaxModes) { + if (mode.Name == name) { + return new KeyValuePair(mode, provider); + } + } + } + return new KeyValuePair(null, null); + } + public IHighlightingStrategy FindHighlighter(string name) { object def = highlightingDefs[name]; if (def is DictionaryEntry) { return LoadDefinition((DictionaryEntry)def); } - return (IHighlightingStrategy)(def == null ? highlightingDefs["Default"] : def); + return def == null ? DefaultHighlighting : (IHighlightingStrategy)def; } public IHighlightingStrategy FindHighlighterForFile(string fileName) @@ -107,9 +129,9 @@ namespace ICSharpCode.TextEditor.Document if (def is DictionaryEntry) { return LoadDefinition((DictionaryEntry)def); } - return (IHighlightingStrategy)(def == null ? highlightingDefs["Default"] : def); + return def == null ? DefaultHighlighting : (IHighlightingStrategy)def; } else { - return (IHighlightingStrategy)highlightingDefs["Default"]; + return DefaultHighlighting; } } diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/SyntaxModes/FileSyntaxModeProvider.cs b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/SyntaxModes/FileSyntaxModeProvider.cs index 257788cc3c..fe858e63fd 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/SyntaxModes/FileSyntaxModeProvider.cs +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/SyntaxModes/FileSyntaxModeProvider.cs @@ -7,7 +7,7 @@ using System; using System.IO; -using System.Collections; +using System.Collections.Generic; using System.Reflection; using System.Windows.Forms; using System.Xml; @@ -17,9 +17,9 @@ namespace ICSharpCode.TextEditor.Document public class FileSyntaxModeProvider : ISyntaxModeFileProvider { string directory; - ArrayList syntaxModes = null; + List syntaxModes = null; - public ArrayList SyntaxModes { + public ICollection SyntaxModes { get { return syntaxModes; } @@ -53,10 +53,10 @@ namespace ICSharpCode.TextEditor.Document return new XmlTextReader(File.OpenRead(syntaxModeFile)); } - ArrayList ScanDirectory(string directory) + List ScanDirectory(string directory) { string[] files = Directory.GetFiles(directory); - ArrayList modes = new ArrayList(); + List modes = new List(); foreach (string file in files) { if (Path.GetExtension(file).Equals(".XSHD", StringComparison.OrdinalIgnoreCase)) { XmlTextReader reader = new XmlTextReader(file); diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/SyntaxModes/ISyntaxModeFileProvider.cs b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/SyntaxModes/ISyntaxModeFileProvider.cs index 5aee29052d..1df1176d1c 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/SyntaxModes/ISyntaxModeFileProvider.cs +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/SyntaxModes/ISyntaxModeFileProvider.cs @@ -6,14 +6,14 @@ // using System; -using System.Collections; +using System.Collections.Generic; using System.Xml; namespace ICSharpCode.TextEditor.Document { public interface ISyntaxModeFileProvider { - ArrayList SyntaxModes { + ICollection SyntaxModes { get; } diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/SyntaxModes/ResourceSyntaxModeProvider.cs b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/SyntaxModes/ResourceSyntaxModeProvider.cs index 523021c529..80465ef0ab 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/SyntaxModes/ResourceSyntaxModeProvider.cs +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/SyntaxModes/ResourceSyntaxModeProvider.cs @@ -6,7 +6,7 @@ // using System; -using System.Collections; +using System.Collections.Generic; using System.Reflection; using System.Xml; using System.IO; @@ -15,9 +15,9 @@ namespace ICSharpCode.TextEditor.Document { public class ResourceSyntaxModeProvider : ISyntaxModeFileProvider { - ArrayList syntaxModes = null; + List syntaxModes = null; - public ArrayList SyntaxModes { + public ICollection SyntaxModes { get { return syntaxModes; } @@ -30,7 +30,7 @@ namespace ICSharpCode.TextEditor.Document if (syntaxModeStream != null) { syntaxModes = SyntaxMode.GetSyntaxModes(syntaxModeStream); } else { - syntaxModes = new ArrayList(); + syntaxModes = new List(); } } diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/SyntaxModes/SyntaxMode.cs b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/SyntaxModes/SyntaxMode.cs index c2d7cfca96..c47d086427 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/SyntaxModes/SyntaxMode.cs +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/SyntaxModes/SyntaxMode.cs @@ -7,7 +7,7 @@ using System; using System.IO; -using System.Collections; +using System.Collections.Generic; using System.Windows.Forms; using System.Xml; @@ -60,10 +60,10 @@ namespace ICSharpCode.TextEditor.Document this.extensions = extensions; } - public static ArrayList GetSyntaxModes(Stream xmlSyntaxModeStream) + public static List GetSyntaxModes(Stream xmlSyntaxModeStream) { XmlTextReader reader = new XmlTextReader(xmlSyntaxModeStream); - ArrayList syntaxModes = new ArrayList(); + List syntaxModes = new List(); while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/TextWord.cs b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/TextWord.cs index cdbcc2207a..6312789fda 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/TextWord.cs +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/TextWord.cs @@ -158,7 +158,7 @@ namespace ICSharpCode.TextEditor.Document return color; } set { - Debug.Assert(color != null); + Debug.Assert(value != null); color = value; } } diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/NewFileDialog.cs b/src/Main/Base/Project/Src/Gui/Dialogs/NewFileDialog.cs index e585b1a6b0..4c9298b237 100644 --- a/src/Main/Base/Project/Src/Gui/Dialogs/NewFileDialog.cs +++ b/src/Main/Base/Project/Src/Gui/Dialogs/NewFileDialog.cs @@ -374,6 +374,7 @@ namespace ICSharpCode.SharpDevelop.Gui if (parsedFileName.StartsWith("/") || parsedFileName.StartsWith("\\")) parsedFileName = parsedFileName.Substring(1); if (newfile.IsDependentFile && Path.IsPathRooted(parsedFileName)) { + Directory.CreateDirectory(Path.GetDirectoryName(parsedFileName)); File.WriteAllText(parsedFileName, parsedContent, ParserService.DefaultFileEncoding); ParserService.ParseFile(parsedFileName, parsedContent); } else { @@ -438,7 +439,11 @@ namespace ICSharpCode.SharpDevelop.Gui string[] subdirs = relPath.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); StringBuilder standardNameSpace = new StringBuilder(project.RootNamespace); foreach(string subdir in subdirs) { - if (subdir == "." || subdir == ".." || subdir == "" || subdir.Equals("src", StringComparison.OrdinalIgnoreCase)) + if (subdir == "." || subdir == ".." || subdir.Length == 0) + continue; + if (subdir.Equals("src", StringComparison.OrdinalIgnoreCase)) + continue; + if (subdir.Equals("source", StringComparison.OrdinalIgnoreCase)) continue; standardNameSpace.Append('.'); standardNameSpace.Append(GenerateValidClassName(subdir)); diff --git a/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/Commands/FolderNodeCommands.cs b/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/Commands/FolderNodeCommands.cs index 8692097e03..cd4f4ef9bc 100644 --- a/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/Commands/FolderNodeCommands.cs +++ b/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/Commands/FolderNodeCommands.cs @@ -276,6 +276,9 @@ namespace ICSharpCode.SharpDevelop.Project.Commands bool additionalProperties = false; foreach (KeyValuePair createdFile in nfd.CreatedFiles) { FileProjectItem item = CreateNewFile(node, createdFile.Key); + if (!FileUtility.IsEqualFileName(node.Directory, Path.GetDirectoryName(createdFile.Key))) { + additionalProperties = true; + } if (createdFile.Value.PropertyCount > 0) { additionalProperties = true; item.Properties.Merge(createdFile.Value); diff --git a/src/Main/Base/Project/Src/Internal/Templates/Project/ProjectCreateInformation.cs b/src/Main/Base/Project/Src/Internal/Templates/Project/ProjectCreateInformation.cs index 7fb86d9f42..64c82fb95d 100644 --- a/src/Main/Base/Project/Src/Internal/Templates/Project/ProjectCreateInformation.cs +++ b/src/Main/Base/Project/Src/Internal/Templates/Project/ProjectCreateInformation.cs @@ -30,6 +30,18 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates public List CreatedProjects = new List(); + public ProjectCreateInformation() + { + SetDefaultCreateProjectOptions(); + } + + internal bool CreateProjectWithDefaultOutputPath; + + internal void SetDefaultCreateProjectOptions() + { + CreateProjectWithDefaultOutputPath = true; + } + public string OutputProjectFileName { get { return outputProjectFileName; diff --git a/src/Main/Base/Project/Src/Internal/Templates/Project/ProjectDescriptor.cs b/src/Main/Base/Project/Src/Internal/Templates/Project/ProjectDescriptor.cs index e4aedfccb8..41070ce1bb 100644 --- a/src/Main/Base/Project/Src/Internal/Templates/Project/ProjectDescriptor.cs +++ b/src/Main/Base/Project/Src/Internal/Templates/Project/ProjectDescriptor.cs @@ -108,6 +108,12 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates string projectLocation = FileUtility.Combine(projectCreateInformation.ProjectBasePath, newProjectName + LanguageBindingService.GetProjectFileExtension(language)); projectCreateInformation.OutputProjectFileName = projectLocation; + projectCreateInformation.SetDefaultCreateProjectOptions(); + foreach (PropertyGroup pg in propertyGroups) { + if (pg.IsSet("OutputPath")) { + projectCreateInformation.CreateProjectWithDefaultOutputPath = false; + } + } IProject project = languageinfo.CreateProject(projectCreateInformation, projectOptions); StringBuilder standardNamespace = new StringBuilder(); diff --git a/src/Main/Base/Project/Src/Project/MSBuildProject.cs b/src/Main/Base/Project/Src/Project/MSBuildProject.cs index a079437884..085c604183 100644 --- a/src/Main/Base/Project/Src/Project/MSBuildProject.cs +++ b/src/Main/Base/Project/Src/Project/MSBuildProject.cs @@ -44,14 +44,18 @@ namespace ICSharpCode.SharpDevelop.Project BaseConfiguration.SetIsGuarded("Platform", true); configurations["Debug|*"] = new PropertyGroup(); - configurations["Debug|*"]["OutputPath"] = @"bin\Debug\"; + if (information.CreateProjectWithDefaultOutputPath) { + configurations["Debug|*"]["OutputPath"] = @"bin\Debug\"; + } configurations["Debug|*"]["Optimize"] = "False"; configurations["Debug|*"]["DefineConstants"] = "DEBUG" + BuildConstantSeparator + "TRACE"; configurations["Debug|*"]["DebugSymbols"] = "True"; configurations["Debug|*"]["DebugType"] = "Full"; configurations["Release|*"] = new PropertyGroup(); - configurations["Release|*"]["OutputPath"] = @"bin\Release\"; + if (information.CreateProjectWithDefaultOutputPath) { + configurations["Release|*"]["OutputPath"] = @"bin\Release\"; + } configurations["Release|*"]["Optimize"] = "True"; configurations["Release|*"]["DefineConstants"] = "TRACE"; configurations["Release|*"]["DebugSymbols"] = "False"; diff --git a/src/Main/Base/Project/Src/TextEditor/Codons/AddInTreeSyntaxModeProvider.cs b/src/Main/Base/Project/Src/TextEditor/Codons/AddInTreeSyntaxModeProvider.cs index c33c944d33..8d2d084b57 100644 --- a/src/Main/Base/Project/Src/TextEditor/Codons/AddInTreeSyntaxModeProvider.cs +++ b/src/Main/Base/Project/Src/TextEditor/Codons/AddInTreeSyntaxModeProvider.cs @@ -8,7 +8,7 @@ using System; using System.Diagnostics; using System.Xml; -using System.Collections; +using System.Collections.Generic; using ICSharpCode.Core; using ICSharpCode.TextEditor.Document; namespace ICSharpCode.SharpDevelop.DefaultEditor.Codons @@ -20,9 +20,9 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Codons { const string syntaxModePath = "/SharpDevelop/ViewContent/DefaultTextEditor/SyntaxModes"; - ArrayList syntaxModes; + List syntaxModes; - public ArrayList SyntaxModes { + public ICollection SyntaxModes { get { return syntaxModes; } @@ -30,11 +30,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Codons public AddInTreeSyntaxModeProvider() { - try { - syntaxModes = AddInTree.GetTreeNode(syntaxModePath).BuildChildItems(this); - } catch (TreePathNotFoundException) { - syntaxModes = new ArrayList(); - } + syntaxModes = AddInTree.BuildItems(syntaxModePath, this, false); } public XmlTextReader GetSyntaxModeFile(SyntaxMode syntaxMode)