diff --git a/src/AddIns/BackendBindings/Boo/Boo.Microsoft.Build.Tasks/Boo.Microsoft.Build.Tasks.booproj b/src/AddIns/BackendBindings/Boo/Boo.Microsoft.Build.Tasks/Boo.Microsoft.Build.Tasks.booproj new file mode 100644 index 0000000000..1d28ad9d29 --- /dev/null +++ b/src/AddIns/BackendBindings/Boo/Boo.Microsoft.Build.Tasks/Boo.Microsoft.Build.Tasks.booproj @@ -0,0 +1,41 @@ + + + Library + Boo.Microsoft.Build.Tasks + Boo.Microsoft.Build.Tasks + Debug + AnyCPU + {366B4AFE-C4E9-46DF-9CFF-57C62D414D4A} + + + bin\Debug\ + False + DEBUG;TRACE + True + Full + + + bin\Release\ + True + TRACE + False + None + + + + + + + + + + + + + + + Always + + + + \ No newline at end of file diff --git a/src/AddIns/BackendBindings/Boo/Boo.Microsoft.Build.Tasks/Boo.Microsoft.Build.targets b/src/AddIns/BackendBindings/Boo/Boo.Microsoft.Build.Tasks/Boo.Microsoft.Build.targets new file mode 100644 index 0000000000..39b45cb618 --- /dev/null +++ b/src/AddIns/BackendBindings/Boo/Boo.Microsoft.Build.Tasks/Boo.Microsoft.Build.targets @@ -0,0 +1,212 @@ + + + + + + + + + $(MSBuildAllProjects);$(BoocToolPath)\Boo.Microsoft.Build.targets + + + $(MSBuildAllProjects);$(MSBuildBinPath)\Boo.Microsoft.Build.targets + + .boo + Boo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + + + true + + + + + + + $(NoWarn); + $(NoWarn)1701;1702 + + + + + + false + + + + + + _ComputeNonExistentFileProperty + + + + + + + + + + + diff --git a/src/AddIns/BackendBindings/Boo/Boo.Microsoft.Build.Tasks/Booc.boo b/src/AddIns/BackendBindings/Boo/Boo.Microsoft.Build.Tasks/Booc.boo new file mode 100644 index 0000000000..0f9d65803f --- /dev/null +++ b/src/AddIns/BackendBindings/Boo/Boo.Microsoft.Build.Tasks/Booc.boo @@ -0,0 +1,354 @@ +#region license +// Copyright (c) 2003, 2004, 2005 Rodrigo B. de Oliveira (rbo@acm.org) +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// * Neither the name of Rodrigo B. de Oliveira nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +namespace Boo.Microsoft.Build.Tasks + +import Microsoft.Build.Framework +import Microsoft.Build.Tasks +import Microsoft.Build.Utilities +import System +import System.Diagnostics +import System.IO +import System.Globalization +import System.Text.RegularExpressions +import System.Threading + +class Booc(ManagedCompiler): +""" +Represents the Boo compiler MSBuild task. + +Authors: + Sorin Ionescu (sorin.ionescu@gmail.com) +""" + Pipelines: + """ + Gets/sets the aditional pipelines to add to the compiler process. + """ + get: + return Bag['Pipelines'] as (string) + set: + Bag['Pipelines'] = value + + Verbosity: + """ + Gets/sets the verbosity level. + """ + get: + return Bag['Verbosity'] as string + set: + Bag['Verbosity'] = value + + Culture: + """ + Gets/sets the culture. + """ + get: + return Bag['Culture'] as string + set: + Bag['Culture'] = value + + SourceDirectory: + """ + Gets/sets the source directory. + """ + get: + return Bag['Source Directory'] as string + set: + Bag['Source Directory'] = value + + ToolName: + """ + Gets the tool name. + """ + get: + return "Booc.exe" + + override def Execute(): + """ + Executes the task. + + Returns: + true if the task completed successfully; otherwise, false. + """ + boocCommandLine = CommandLineBuilderExtension() + AddResponseFileCommands(boocCommandLine) + + warningPattern = regex( + '^(?.*?)\\((?\\d+),(?\\d+)\\):' + + ' (?BCW\\d{4}): WARNING: (?.*)$', + RegexOptions.Compiled) + # Captures the file, line, column, code, and message from a BOO warning + # in the form of: Program.boo(1,1): BCW0000: WARNING: This is a warning. + + errorPattern = regex( + '^(((?.*?)\\((?\\d+),(?\\d+)\\): )?' + + '(?BCE\\d{4})|(?Fatal) error):' + + '( Boo.Lang.Compiler.CompilerError:)?' + + ' (?.*?)($| --->)', + RegexOptions.Compiled | + RegexOptions.ExplicitCapture | + RegexOptions.Multiline) + /* + * Captures the file, line, column, code, error type, and message from a + * BOO error of the form of: + * 1. Program.boo(1,1): BCE0000: This is an error. + * 2. Program.boo(1,1): BCE0000: Boo.Lang.Compiler.CompilerError: + * This is an error. ---> Program.boo:4:19: This is an error + * 3. BCE0000: This is an error. + * 4. Fatal error: This is an error. + * + * The second line of the following error format is not cought because + * .NET does not support if|then|else in regular expressions, + * and the regex will be horrible complicated. + * The second line is as worthless as the first line. + * Therefore, it is not worth implementing it. + * + * Fatal error: This is an error. + * Parameter name: format. + */ + + buildSuccess = true + outputLine = String.Empty + errorLine = String.Empty + readingDoneEvents = (ManualResetEvent(false), ManualResetEvent(false)) + + boocProcessStartInfo = ProcessStartInfo( + FileName: GenerateFullPathToTool(), + Arguments: boocCommandLine.ToString(), + ErrorDialog: false, + CreateNoWindow: true, + RedirectStandardError: true, + RedirectStandardInput: false, + RedirectStandardOutput: true, + UseShellExecute: false) + + boocProcess = Process(StartInfo: boocProcessStartInfo) + + parseOutput = def(line as string): + warningPatternMatch = warningPattern.Match(line) + errorPatternMatch = errorPattern.Match(line) + + if warningPatternMatch.Success: + Log.LogWarning( + null, + warningPatternMatch.Groups['code'].Value, + null, + warningPatternMatch.Groups['file'].Value, + int.Parse(warningPatternMatch.Groups['line'].Value), + int.Parse(warningPatternMatch.Groups['column'].Value), + 0, + 0, + warningPatternMatch.Groups['message'].Value) + + elif errorPatternMatch.Success: + code = errorPatternMatch.Groups['code'].Value + code = 'BCE0000' if string.IsNullOrEmpty(code) + file = errorPatternMatch.Groups['file'].Value + file = 'BOOC' if string.IsNullOrEmpty(file) + + try: + lineNumber = int.Parse( + errorPatternMatch.Groups['line'].Value, + NumberStyles.Integer) + + except FormatException: + lineNumber = 0 + + try: + columnNumber = int.Parse( + errorPatternMatch.Groups['column'].Value, + NumberStyles.Integer) + + except FormatException: + columnNumber = 0 + + Log.LogError( + errorPatternMatch.Groups['errorType'].Value.ToLower(), + code, + null, + file, + lineNumber, + columnNumber, + 0, + 0, + errorPatternMatch.Groups['message'].Value) + + buildSuccess = false + + else: + Log.LogMessage(MessageImportance.Low, line) + + readStandardOutput = def(): + while true: + outputLine = boocProcess.StandardOutput.ReadLine() + + if outputLine: + parseOutput(outputLine) + + else: + readingDoneEvents[0].Set() + break + + readStandardError = def(): + while true: + errorLine = boocProcess.StandardError.ReadLine() + + if errorLine: + parseOutput(errorLine) + + else: + readingDoneEvents[1].Set() + break + + standardOutputReadingThread = Thread(readStandardOutput as ThreadStart) + standardErrorReadingThread = Thread(readStandardError as ThreadStart) + # Two threads are required (MSDN); otherwise, a deadlock WILL occur. + + try: + boocProcess.Start() + + Log.LogMessage( + MessageImportance.High, + "${ToolName} ${boocProcess.StartInfo.Arguments}", + null) + + standardOutputReadingThread.Start() + standardErrorReadingThread.Start() + + WaitHandle.WaitAny((readingDoneEvents[0],)) + WaitHandle.WaitAny((readingDoneEvents[1],)) + # MSBuild runs on an STA thread, and WaitHandle.WaitAll() + # is not supported. + + except e as Exception: + Log.LogErrorFromException(e) + buildSuccess = false + + ensure: + boocProcess.Close() + + return buildSuccess + + protected override def AddCommandLineCommands( + commandLine as CommandLineBuilderExtension): + """ + Adds command line commands. + + Remarks: + It prevents from adding the standard commands. + """ + pass + + protected override def AddResponseFileCommands( + commandLine as CommandLineBuilderExtension): + """ + Generates the Boo compiler command line. + + Returns: + The Boo compiler command line. + """ + commandLine.AppendSwitchIfNotNull('-t:', TargetType) + commandLine.AppendSwitchIfNotNull('-o:', OutputAssembly) + commandLine.AppendSwitchIfNotNull('-c:', Culture) + commandLine.AppendSwitchIfNotNull('-srcdir:', SourceDirectory) + + if Pipelines: + for pipeline in Pipelines: + commandLine.AppendSwitchIfNotNull('-p:', pipeline) + + if References: + for reference in References: + commandLine.AppendSwitchIfNotNull('-r:', reference) + + if Resources: + for resource in Resources: + commandLine.AppendSwitchIfNotNull('-resource:', resource) + + if Verbosity: + if string.Compare( + Verbosity, + 'Normal', + StringComparison.InvariantCultureIgnoreCase) == 0: + pass + + elif string.Compare( + Verbosity, + 'Warning', + StringComparison.InvariantCultureIgnoreCase) == 0: + + commandLine.AppendSwitch('-v') + + elif string.Compare( + Verbosity, + 'Info', + StringComparison.InvariantCultureIgnoreCase) == 0: + + commandLine.AppendSwitch('-vv') + + elif string.Compare( + Verbosity, + 'Verbose', + StringComparison.InvariantCultureIgnoreCase) == 0: + + commandLine.AppendSwitch('-vvv') + + else: + Log.LogErrorWithCodeFromResources( + 'Vbc.EnumParameterHasInvalidValue', + 'Verbosity', + Verbosity, + 'Normal, Warning, Info, Verbose') + + commandLine.AppendFileNamesIfNotNull(Sources, ' ') + + protected override def GenerateFullPathToTool(): + """ + Generats the full path to booc.exe. + """ + toolPath as string = ToolPath + if toolPath is not null: + path = Path.Combine(toolPath, ToolName) + + if path is null or not File.Exists(path): + path = Path.Combine( + Path.GetDirectoryName(typeof(Booc).Assembly.Location), + ToolName) + + unless File.Exists(path): + path = ToolLocationHelper.GetPathToDotNetFrameworkFile( + ToolName, + TargetDotNetFrameworkVersion.Version20) + + unless File.Exists(path): + Log.LogErrorWithCodeFromResources( + "General.FrameworksFileNotFound", + ToolName, + ToolLocationHelper.GetDotNetFrameworkVersionFolderPrefix( + TargetDotNetFrameworkVersion.Version20)) + + return path diff --git a/src/AddIns/BackendBindings/Boo/Boo.Microsoft.Build.Tasks/CreateBooManifestResourceName.boo b/src/AddIns/BackendBindings/Boo/Boo.Microsoft.Build.Tasks/CreateBooManifestResourceName.boo new file mode 100644 index 0000000000..fa031e0e1f --- /dev/null +++ b/src/AddIns/BackendBindings/Boo/Boo.Microsoft.Build.Tasks/CreateBooManifestResourceName.boo @@ -0,0 +1,42 @@ +#region license +// Copyright (c) 2003, 2004, 2005 Rodrigo B. de Oliveira (rbo@acm.org) +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// * Neither the name of Rodrigo B. de Oliveira nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +namespace Boo.Microsoft.Build.Tasks + +import Microsoft.Build.Tasks + +class CreateBooManifestResourceName(CreateCSharpManifestResourceName): +""" +Creates the manifest resource name. + +Authors: + Sorin Ionescu (sorin.ionescu@gmail.com) +""" + def constructor(): + super() + diff --git a/src/AddIns/BackendBindings/Boo/Boo.Microsoft.Build.Tasks/Project.booproj b/src/AddIns/BackendBindings/Boo/Boo.Microsoft.Build.Tasks/Project.booproj new file mode 100644 index 0000000000..3c104eef8f --- /dev/null +++ b/src/AddIns/BackendBindings/Boo/Boo.Microsoft.Build.Tasks/Project.booproj @@ -0,0 +1,67 @@ + + + + Debug + AnyCPU + 2.0 + + + + Exe + + Company.Project + Company.Project + + + Normal + + + + + + + + + + + + + + bin\Debug\ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AddIns/BackendBindings/Boo/Boo.Microsoft.Build.Tasks/Properties/AssemblyInfo.boo b/src/AddIns/BackendBindings/Boo/Boo.Microsoft.Build.Tasks/Properties/AssemblyInfo.boo new file mode 100644 index 0000000000..0bf63768f6 --- /dev/null +++ b/src/AddIns/BackendBindings/Boo/Boo.Microsoft.Build.Tasks/Properties/AssemblyInfo.boo @@ -0,0 +1,70 @@ +#region license +// Copyright (c) 2003, 2004, 2005 Rodrigo B. de Oliveira (rbo@acm.org) +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// * Neither the name of Rodrigo B. de Oliveira nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +namespace Boo.Microsoft.Build.Tasks.Properties +""" +Author: + Sorin Ionescu (sorin.ionescu@gmail.com) +""" + +import System.Reflection +import System.Runtime.CompilerServices +import System.Runtime.InteropServices + +# General Information about an assembly is controlled through the following +# set of attributes. Change these attribute values to modify the information +# associated with an assembly. +[assembly: AssemblyTitle('Boo.Microsoft.Build.Tasks')] +[assembly: AssemblyDescription('Contains Microsoft Build tasks for BOO code.')] +[assembly: AssemblyConfiguration('')] +[assembly: AssemblyCompany('')] +[assembly: AssemblyProduct('Boo.Microsoft.Build.Tasks')] +[assembly: AssemblyCopyright('Copyright (C) 2005')] +[assembly: AssemblyTrademark('')] +[assembly: AssemblyCulture('')] + +# Setting ComVisible to false makes the types in this assembly not visible +# to COM componenets. If you need to access a type in this assembly from +# COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +# The following GUID is for the ID of the typelib if this project is exposed +# to COM. +# [assembly: Guid('')] + +# Version information for an assembly consists of the following four values: +# +# Major Version +# Minor Version +# Build Number +# Revision +# +# You can specify all the values or you can default the Revision and +# Build Numbers by using the '*' as shown below: +[assembly: AssemblyVersion('1.0.0.0')] +[assembly: AssemblyFileVersion('1.0.0.0')] diff --git a/src/AddIns/BackendBindings/Boo/BooBinding.sln b/src/AddIns/BackendBindings/Boo/BooBinding.sln index 9c69e7d9ea..9b634a7537 100644 --- a/src/AddIns/BackendBindings/Boo/BooBinding.sln +++ b/src/AddIns/BackendBindings/Boo/BooBinding.sln @@ -1,5 +1,5 @@ Microsoft Visual Studio Solution File, Format Version 9.00 -# SharpDevelop 2.0.0.608 +# SharpDevelop 2.0.0.618 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactoryToBooConverter", "NRefactoryToBooConverter\Project\NRefactoryToBooConverter.csproj", "{DBCF20A1-BA13-4582-BFA9-74DE4D987B73}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactoryToBooConverter.Tests", "NRefactoryToBooConverter\Test\NRefactoryToBooConverter.Tests.csproj", "{C9DE556D-325C-4544-B29F-16A9EB7C9830}" @@ -8,7 +8,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StandaloneConverter", "Stan EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BooBinding", "BooBinding\Project\BooBinding.csproj", "{4AC2D5F1-F671-480C-A075-6BF62B3721B2}" EndProject -Project("{A33008B1-5DAC-44D5-9060-242E3B6E38F2}") = "booish.gui", "booish.gui\booish.gui.booproj", "{928E34B2-5E46-4A4D-8E4D-2CA2CCDB905A}" +Project("{A33008B1-5DAC-44D5-9060-242E3B6E38F2}") = "Boo.Microsoft.Build.Tasks", "Boo.Microsoft.Build.Tasks\Boo.Microsoft.Build.Tasks.booproj", "{366B4AFE-C4E9-46DF-9CFF-57C62D414D4A}" +EndProject +Project("{A33008B1-5DAC-44D5-9060-242E3B6E38F2}") = "Boo.InterpreterAddIn", "Boo.InterpreterAddIn\Project\Boo.InterpreterAddIn.booproj", "{928E34B2-5E46-4A4D-8E4D-2CA2CCDB905A}" EndProject Global EndGlobal diff --git a/src/AddIns/BackendBindings/Boo/BooBinding/Project/PostBuildEvent.bat b/src/AddIns/BackendBindings/Boo/BooBinding/Project/PostBuildEvent.bat index b35b024d08..e791889134 100644 --- a/src/AddIns/BackendBindings/Boo/BooBinding/Project/PostBuildEvent.bat +++ b/src/AddIns/BackendBindings/Boo/BooBinding/Project/PostBuildEvent.bat @@ -8,6 +8,6 @@ booc Boo.Microsoft.Build.Tasks.boo -t:library -o:Boo.Microsoft.Build.Tasks.dll - popd :copyFiles copy "%1\..\..\RequiredLibraries\booc.*" . -copy "%1\..\..\RequiredLibraries\*.targets" . +copy "%1\..\..\Boo.Microsoft.Build.Tasks\*.targets" . copy "%1\..\..\RequiredLibraries\Boo.Microsoft.Build.Tasks.dll" . :BooPostBuildEventEnd diff --git a/src/AddIns/DisplayBindings/ResourceEditor/Project/ResourceEditor.addin b/src/AddIns/DisplayBindings/ResourceEditor/Project/ResourceEditor.addin index a28901e0de..cf0928ff96 100644 --- a/src/AddIns/DisplayBindings/ResourceEditor/Project/ResourceEditor.addin +++ b/src/AddIns/DisplayBindings/ResourceEditor/Project/ResourceEditor.addin @@ -17,7 +17,7 @@ languagePattern = "^ResourceFiles$"/> - + 0) { dependendFileDictionary[missingFile] = fileProjectItem.DependentUpon; } diff --git a/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/FileNode.cs b/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/FileNode.cs index 825e6943d5..e08b3fe38f 100644 --- a/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/FileNode.cs +++ b/src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/TreeNodes/FileNode.cs @@ -41,8 +41,11 @@ namespace ICSharpCode.SharpDevelop.Project return projectItem; } set { - projectItem = value; - Tag = projectItem; + if (projectItem != value) { + projectItem = value; + Tag = projectItem; + SetIcon(); + } } } @@ -70,7 +73,10 @@ namespace ICSharpCode.SharpDevelop.Project SetIcon("ProjectBrowser.GhostFile"); break; case FileNodeStatus.InProject: - SetIcon(IconService.GetImageForFile(FileName)); + if (projectItem is FileProjectItem && (projectItem as FileProjectItem).IsLink) + SetIcon("ProjectBrowser.CodeBehind"); + else + SetIcon(IconService.GetImageForFile(FileName)); break; case FileNodeStatus.Missing: SetIcon("ProjectBrowser.MissingFile"); @@ -98,7 +104,7 @@ namespace ICSharpCode.SharpDevelop.Project ToolbarAddinTreePath = "/SharpDevelop/Pads/ProjectBrowser/ToolBar/File"; this.fileNodeStatus = fileNodeStatus; this.FileName = fileName; - + autoClearNodes = false; SetIcon(); } @@ -138,7 +144,7 @@ namespace ICSharpCode.SharpDevelop.Project { return visitor.Visit(this, data); } - + #region Drag & Drop public override DataObject DragDropDataObject { get { @@ -163,7 +169,7 @@ namespace ICSharpCode.SharpDevelop.Project return true; } } - + public override void Delete() { if (FileNodeStatus == FileNodeStatus.Missing) { @@ -200,7 +206,7 @@ namespace ICSharpCode.SharpDevelop.Project ClipboardWrapper.SetDataObject(new DataObject(typeof(FileNode).ToString(), new FileOperationClipboardObject(FileName, true))); } - + public override bool EnablePaste { get { return ((ExtTreeNode)Parent).EnablePaste; diff --git a/src/Main/Base/Project/Src/Project/Items/FileProjectItem.cs b/src/Main/Base/Project/Src/Project/Items/FileProjectItem.cs index c4557f178c..dc937f5fef 100644 --- a/src/Main/Base/Project/Src/Project/Items/FileProjectItem.cs +++ b/src/Main/Base/Project/Src/Project/Items/FileProjectItem.cs @@ -91,6 +91,13 @@ namespace ICSharpCode.SharpDevelop.Project } } + [Browsable(false)] + public bool IsLink { + get { + return base.Properties.IsSet("Link"); + } + } + public FileProjectItem(IProject project, ItemType type) : base(project) { this.type = type; diff --git a/src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs b/src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs index 7a3dea1d16..975da06300 100644 --- a/src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs +++ b/src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs @@ -166,6 +166,7 @@ namespace ICSharpCode.SharpDevelop.Project /// /// Adds a project item to the project, raising the ProjectItemAdded event. + /// Make sure you call project.Save() after adding new items! /// public static void AddProjectItem(IProject project, ProjectItem item) { @@ -177,6 +178,7 @@ namespace ICSharpCode.SharpDevelop.Project /// /// Removes a project item from the project, raising the ProjectItemRemoved event. + /// Make sure you call project.Save() after removing items! /// public static void RemoveProjectItem(IProject project, ProjectItem item) { diff --git a/src/Main/Base/Project/Src/TextEditor/Commands/ClassBookmarkMenuBuilder.cs b/src/Main/Base/Project/Src/TextEditor/Commands/ClassBookmarkMenuBuilder.cs index 3a8846f153..1f69f0f278 100644 --- a/src/Main/Base/Project/Src/TextEditor/Commands/ClassBookmarkMenuBuilder.cs +++ b/src/Main/Base/Project/Src/TextEditor/Commands/ClassBookmarkMenuBuilder.cs @@ -84,8 +84,10 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands subItems.Add(new MenuCommand(interf.Name, eh)); } } - list.Add(new ICSharpCode.Core.Menu("${res:SharpDevelop.Refactoring.ImplementInterfaceImplicit}", subItems.ToArray())); - subItems = new List(); + if (subItems.Count > 0) { + list.Add(new ICSharpCode.Core.Menu("${res:SharpDevelop.Refactoring.ImplementInterfaceImplicit}", subItems.ToArray())); + subItems = new List(); + } foreach (IReturnType rt in c.BaseTypes) { IClass interf = rt.GetUnderlyingClass(); if (interf != null && interf.ClassType == ClassType.Interface) { @@ -97,7 +99,9 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands subItems.Add(new MenuCommand(interf.Name, eh)); } } - list.Add(new ICSharpCode.Core.Menu("${res:SharpDevelop.Refactoring.ImplementInterfaceExplicit}", subItems.ToArray())); + if (subItems.Count > 0) { + list.Add(new ICSharpCode.Core.Menu("${res:SharpDevelop.Refactoring.ImplementInterfaceExplicit}", subItems.ToArray())); + } } static IDocument GetDocument(IClass c) diff --git a/src/Main/StartUp/Project/Resources/StringResources.resources b/src/Main/StartUp/Project/Resources/StringResources.resources index 2e9ce609b8..8c54b8d576 100644 Binary files a/src/Main/StartUp/Project/Resources/StringResources.resources and b/src/Main/StartUp/Project/Resources/StringResources.resources differ