diff options
author | Lluis Sanchez <lluis@novell.com> | 2008-05-21 13:53:44 +0400 |
---|---|---|
committer | Lluis Sanchez <lluis@novell.com> | 2008-05-21 13:53:44 +0400 |
commit | 62810d6a1a4fce86c5a11d7e117eca1016ae27c7 (patch) | |
tree | b8eed82327cbc0119b3dd738a50ff3e3529fa9d1 | |
parent | e060377e505e523a829be000914fe617de0b5a22 (diff) |
New project model changes.
svn path=/trunk/monodevelop/; revision=103657
443 files changed, 8256 insertions, 10564 deletions
diff --git a/main/ChangeLog b/main/ChangeLog index 0c5f678745..a5e02dd55a 100644 --- a/main/ChangeLog +++ b/main/ChangeLog @@ -1,3 +1,11 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * monodevelop-core-addins.pc.in: Removed MSVisualStudio project from + .pc file since it is not extensible anymore. + * configure.in, MonoDevelop.mds: Added test infrastructure. + * src/core/Core.mds: New project model changes. + * contrib/contrib.mds: Updated. + 2008-05-19 Michael Hutchinson <mhutchinson@novell.com> * configure.in: Remove conditional build for ASP.NET support; there's diff --git a/main/MonoDevelop.mds b/main/MonoDevelop.mds index ab7bb5b735..a902afd561 100644 --- a/main/MonoDevelop.mds +++ b/main/MonoDevelop.mds @@ -6,6 +6,7 @@ <Entry build="True" name="contrib" configuration="Debug" /> <Entry build="True" name="po" configuration="Debug" /> <Entry build="True" name="Tools" configuration="Debug" /> + <Entry build="True" name="tests" configuration="" /> </Configuration> <Configuration name="Release" ctype="CombineConfiguration"> <Entry build="True" name="Core" configuration="Release" /> @@ -13,6 +14,7 @@ <Entry build="True" name="contrib" configuration="Release" /> <Entry build="True" name="po" configuration="Release" /> <Entry build="True" name="Tools" configuration="Release" /> + <Entry build="True" name="tests" configuration="" /> </Configuration> </Configurations> <StartMode startupentry="Core" single="True"> @@ -23,6 +25,7 @@ <Execute type="None" entry="contrib" /> <Execute type="None" entry="po" /> <Execute type="None" entry="Tools" /> + <Execute type="None" entry="tests" /> </StartMode> <DeployTargets /> <Entries> @@ -31,5 +34,6 @@ <Entry filename="contrib/contrib.mds" /> <Entry filename="po/po.mdse" /> <Entry filename="src/tools/Tools.mds" /> + <Entry filename="tests/tests.mds" /> </Entries> </Combine>
\ No newline at end of file diff --git a/main/configure.in b/main/configure.in index 4dc152d0fe..88ba8fc11e 100644 --- a/main/configure.in +++ b/main/configure.in @@ -125,6 +125,22 @@ AM_CONDITIONAL(HAVE_GCONF_SHARP, test x$gconf_sharp = xyes) gtksharp_prefix="`$PKG_CONFIG --variable=prefix gtk-sharp-2.0`" AC_SUBST(gtksharp_prefix) +## nunit tests + +AC_ARG_ENABLE(tests, + AC_HELP_STRING([--enable-tests], + [build unit tests [default=yes]]), + enable_tests=${enableval}, enable_tests=yes) + +AM_CONDITIONAL(ENABLE_TESTS, test x$enable_tests = xyes) + +if test "x$enable_tests" = "xyes"; then + PKG_CHECK_MODULES([MONO_NUNIT], [mono-nunit]) +fi + +AC_SUBST(MONO_NUNIT_LIBS) + + ## gtksourceview2-sharp AC_ARG_ENABLE(gtksourceview2, AC_HELP_STRING([--enable-gtksourceview2], @@ -375,6 +391,8 @@ src/addins/MonoDevelop.Moonlight/Makefile src/addins/MonoDevelop.XmlEditor/Makefile src/addins/MonoDevelop.CodeMetrics/Makefile src/addins/MonoDevelop.Debugger/Makefile +tests/Makefile +tests/UnitTests/Makefile Makefile monodevelop mdtool @@ -398,5 +416,6 @@ echo " * Web References: yes" echo " * C/C++ project support: $enable_c" echo " * GtkSourceView2 Editor: $enable_gtksourceview2" echo " * Platform bindings: $platform_bindings" +echo " * Unit tests: $enable_tests" echo " * Mozilla location: $MOZILLA_HOME" echo "" diff --git a/main/contrib/contrib.mds b/main/contrib/contrib.mds index c37c7ea803..a981f92e1e 100644 --- a/main/contrib/contrib.mds +++ b/main/contrib/contrib.mds @@ -1,11 +1,8 @@ <Combine name="contrib" fileversion="2.0"> <Configurations active="Debug"> <Configuration name="Debug" ctype="CombineConfiguration"> - <CustomCommands> - <Command type="Custom" name="Update mono-addins" command="make update-source" workingdir="${ProjectDir}/Mono.Addins" externalConsole="True" pauseExternalConsole="True" /> - </CustomCommands> <Entry build="True" name="Mono.Cecil" configuration="Debug" /> - <Entry build="True" name="Mono.Cecil.Mdp" configuration="Debug" /> + <Entry build="True" name="Mono.Cecil.Mdb" configuration="Debug" /> </Configuration> <Configuration name="Release" ctype="CombineConfiguration"> <Entry build="True" name="Mono.Cecil" configuration="Release" /> @@ -13,11 +10,7 @@ </Configuration> </Configurations> <StartMode startupentry="Mono.Cecil" single="True"> - <Execute type="None" entry="Firebird" /> - <Execute type="None" entry="Firebird" /> <Execute type="None" entry="Mono.Cecil" /> - <Execute type="None" entry="log4net" /> - <Execute type="None" entry="Mono.Addins.Gui" /> <Execute type="None" entry="Mono.Cecil.Mdb" /> </StartMode> <Entries> diff --git a/main/monodevelop-core-addins.pc.in b/main/monodevelop-core-addins.pc.in index 8a96c3c732..808cf510e6 100644 --- a/main/monodevelop-core-addins.pc.in +++ b/main/monodevelop-core-addins.pc.in @@ -5,4 +5,5 @@ libdir=${exec_prefix}/lib/monodevelop Name: MonoDevelop Core Add-ins Description: MonoDevelop Core Add-ins Version: @VERSION@ -Libs: -r:${libdir}/AddIns/VersionControl/MonoDevelop.VersionControl.dll -r:${libdir}/AddIns/NUnit/MonoDevelop.NUnit.dll -r:${libdir}/AddIns/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.dll -r:${libdir}/AddIns/MonoDevelop.AspNet/MonoDevelop.AspNet.dll -r:${libdir}/AddIns/MonoDevelop.Gettext/MonoDevelop.Gettext.dll -r:${libdir}/AddIns/MonoDevelop.Deployment/MonoDevelop.Deployment.dll -r:${libdir}/AddIns/MonoDevelop.Deployment/MonoDevelop.Deployment.Linux.dll -r:${libdir}/AddIns/MonoDevelop.GtkCore/MonoDevelop.GtkCore.dll -r:${libdir}/AddIns/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.dll -r:${libdir}/AddIns/BackendBindings/MonoDevelop.VBNetBinding.dll -r:${libdir}/AddIns/BackendBindings/MonoDevelop.CBinding.dll -r:${libdir}/AddIns/BackendBindings/MonoDevelop.CSharpBinding.dll -r:${libdir}/AddIns/MonoDevelop.Autotools/MonoDevelop.Autotools.dll -r:${libdir}/AddIns/MonoDevelop.MsVisualStudio/MonoDevelop.MsVisualStudio.dll +Libs: -r:${libdir}/AddIns/VersionControl/MonoDevelop.VersionControl.dll -r:${libdir}/AddIns/NUnit/MonoDevelop.NUnit.dll -r:${libdir}/AddIns/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.dll -r:${libdir}/AddIns/MonoDevelop.AspNet/MonoDevelop.AspNet.dll -r:${libdir}/AddIns/MonoDevelop.Gettext/MonoDevelop.Gettext.dll -r:${libdir}/AddIns/MonoDevelop.Deployment/MonoDevelop.Deployment.dll -r:${libdir}/AddIns/MonoDevelop.Deployment/MonoDevelop.Deployment.Linux.dll -r:${libdir}/AddIns/MonoDevelop.GtkCore/MonoDevelop.GtkCore.dll -r:${libdir}/AddIns/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.dll -r:${libdir}/AddIns/BackendBindings/MonoDevelop.VBNetBinding.dll -r:${libdir}/AddIns/BackendBindings/MonoDevelop.CBinding.dll -r:${libdir}/AddIns/BackendBindings/MonoDevelop.CSharpBinding.dll -r:${libdir}/AddIns/MonoDevelop.Autotools/MonoDevelop.Autotools.dll + diff --git a/main/src/addins/AspNetAddIn/AspNetAddIn.mdp b/main/src/addins/AspNetAddIn/AspNetAddIn.mdp index 414b1562c4..15ef38cf30 100644 --- a/main/src/addins/AspNetAddIn/AspNetAddIn.mdp +++ b/main/src/addins/AspNetAddIn/AspNetAddIn.mdp @@ -1,4 +1,4 @@ -<Project name="MonoDevelop.AspNet" fileversion="2.0" UseParentDirectoryAsNamespace="True" language="C#" clr-version="Net_2_0" ctype="DotNetProject"> +<Project name="MonoDevelop.AspNet" fileversion="2.0" language="C#" clr-version="Net_2_0" UseParentDirectoryAsNamespace="True" ctype="DotNetProject"> <Configurations active="Debug"> <Configuration name="Debug" ctype="DotNetProjectConfiguration"> <Output directory="../../../build/AddIns/MonoDevelop.AspNet" assembly="MonoDevelop.AspNet" /> @@ -88,7 +88,6 @@ <File name="gtk-gui/MonoDevelop.AspNet.Deployment.WebDeployLaunchDialog.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.AspNet.Deployment/WebDeployService.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.AspNet.Deployment/WebDeployCommands.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.AspNet/AspNetMSBuildProjectExtension.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.AspNet.Deployment/WebDeployResolver.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.AspNet/WebTypeManager.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.AspNet.Parser/DocumentReferenceManager.cs" subtype="Code" buildaction="Compile" /> @@ -139,10 +138,9 @@ <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.DesignerSupport" /> <ProjectReference type="Gac" localcopy="True" refto="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <ProjectReference type="Gac" localcopy="True" refto="System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> - <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.MsVisualStudio" /> <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.3.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Deployment" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Projects.Gui" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Projects.Gui" /> <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.XmlEditor" /> <ProjectReference type="Gac" localcopy="True" refto="glib-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> diff --git a/main/src/addins/AspNetAddIn/ChangeLog b/main/src/addins/AspNetAddIn/ChangeLog index 96d5c634fd..d223883ebb 100644 --- a/main/src/addins/AspNetAddIn/ChangeLog +++ b/main/src/addins/AspNetAddIn/ChangeLog @@ -1,3 +1,26 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * MonoDevelop.AspNet/AspNetAppProjectBinding.cs, + MonoDevelop.AspNet/AspNetAppProject.cs, + MonoDevelop.AspNet/CodeBehind.cs, + MonoDevelop.AspNet/VerifyCodeBehindBuildStep.cs, + MonoDevelop.AspNet/AspNetParserService.cs, + MonoDevelop.AspNet/AspNetToolboxNode.cs, + MonoDevelop.AspNet/WebTypeManager.cs, + MonoDevelop.AspNet/AspNetAppProjectConfiguration.cs, + MonoDevelop.AspNet.addin.xml, + MonoDevelop.AspNet.Deployment/WebDeployService.cs, + MonoDevelop.AspNet.Deployment/WebDeployOptionsPanel.cs, + MonoDevelop.AspNet.Gui/AspNetEditorExtension.cs, + MonoDevelop.AspNet.Gui/AspNetConfigurationPanel.cs, + MonoDevelop.AspNet.Gui/AspNetConfigurationPanelWidget.cs, + MonoDevelop.AspNet.Gui/XspOptionsPanel.cs, + MonoDevelop.AspNet.Gui/XspOptionsPanelWidget.cs, + gtk-gui/gui.stetic, AspNetAddIn.mdp, Makefile.am, + MonoDevelop.AspNet.Parser/WebFormReferenceManager.cs, + MonoDevelop.AspNet.Parser/SuggestedHandlerCompletionData.cs, + MonoDevelop.AspNet.Parser/Document.cs: New project model changes. + 2008-05-19 Michael Hutchinson <mhutchinson@novell.com> * Makefile.am: Remove conditional build for ASP.NET support; there's no diff --git a/main/src/addins/AspNetAddIn/Makefile.am b/main/src/addins/AspNetAddIn/Makefile.am index ac62cf5c44..c2b3a7dcf6 100644 --- a/main/src/addins/AspNetAddIn/Makefile.am +++ b/main/src/addins/AspNetAddIn/Makefile.am @@ -7,7 +7,6 @@ REFS = \ $(MONO_ADDINS_LIBS) \ -r:$(top_builddir)/build/AddIns/MonoDevelop.Deployment/MonoDevelop.Deployment.dll \ -r:$(top_builddir)/build/AddIns/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.dll \ - -r:$(top_builddir)/build/AddIns/MonoDevelop.MsVisualStudio/MonoDevelop.MsVisualStudio.dll \ -r:$(top_builddir)/build/AddIns/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.dll \ -r:$(top_builddir)/build/bin/MonoDevelop.Components.dll \ -r:$(top_builddir)/build/bin/MonoDevelop.Core.dll \ @@ -88,7 +87,6 @@ FILES = \ MonoDevelop.AspNet/AspNetCommands.cs \ MonoDevelop.AspNet/AspNetFileDescriptionTemplate.cs \ MonoDevelop.AspNet/AspNetLanguageBinding.cs \ - MonoDevelop.AspNet/AspNetMSBuildProjectExtension.cs \ MonoDevelop.AspNet/AspNetParserService.cs \ MonoDevelop.AspNet/AspNetToolboxLoader.cs \ MonoDevelop.AspNet/AspNetToolboxNode.cs \ diff --git a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Deployment/WebDeployOptionsPanel.cs b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Deployment/WebDeployOptionsPanel.cs index c52c2825a8..b9b3829b1d 100644 --- a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Deployment/WebDeployOptionsPanel.cs +++ b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Deployment/WebDeployOptionsPanel.cs @@ -27,30 +27,27 @@ using System; using Gtk; -using MonoDevelop.Core.Gui.Dialogs; +using MonoDevelop.Projects.Gui.Dialogs; using MonoDevelop.Core; using MonoDevelop.AspNet; namespace MonoDevelop.AspNet.Deployment { - public class WebDeployOptionsPanel : AbstractOptionPanel + public class WebDeployOptionsPanel : ItemOptionsPanel { - WebDeployOptionsPanelWidget panel; - public override void LoadPanelContents () + public override Widget CreatePanelWidget () { - AspNetAppProject project = ((Properties)CustomizationObject).Get<AspNetAppProject> ("Project"); - panel = new WebDeployOptionsPanelWidget (project); - this.Child = panel; + AspNetAppProject project = (AspNetAppProject) ConfiguredProject; + return panel = new WebDeployOptionsPanelWidget (project); } - public override bool StorePanelContents () + public override void ApplyChanges () { - AspNetAppProject project = ((Properties)CustomizationObject).Get<AspNetAppProject> ("Project"); + AspNetAppProject project = (AspNetAppProject) ConfiguredProject; panel.Store (project); - return true; } } } diff --git a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Deployment/WebDeployService.cs b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Deployment/WebDeployService.cs index 626b30988d..e4b53aa017 100644 --- a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Deployment/WebDeployService.cs +++ b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Deployment/WebDeployService.cs @@ -44,19 +44,19 @@ namespace MonoDevelop.AspNet.Deployment { } - static public void Deploy (AspNetAppProject project, WebDeployTarget target) + static public void Deploy (AspNetAppProject project, WebDeployTarget target, string configuration) { - Deploy (project, new WebDeployTarget[] { target }); + Deploy (project, new WebDeployTarget[] { target }, configuration); } - static public void Deploy (AspNetAppProject project, ICollection<WebDeployTarget> targets) + static public void Deploy (AspNetAppProject project, ICollection<WebDeployTarget> targets, string configuration) { //project needs to be built before it can be deployed MonoDevelop.Ide.Gui.IdeApp.ProjectOperations.Build (project); //set up and launch a copying thread DeployThreadParams threadParams = new DeployThreadParams (); - threadParams.Files = project.GetDeployFiles (); + threadParams.Files = project.GetDeployFiles (configuration); Dictionary<string, string> taskAliases = new Dictionary<string,string> (); foreach (WebDeployTarget target in targets) { threadParams.Targets.Add ((WebDeployTarget) target.Clone ()); @@ -122,7 +122,7 @@ namespace MonoDevelop.AspNet.Deployment dialog.Destroy (); if (targets != null && targets.Count > 0) - Deploy (project, targets); + Deploy (project, targets, MonoDevelop.Ide.Gui.IdeApp.Workspace.ActiveConfiguration); } class DeployThreadParams diff --git a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Gui/AspNetConfigurationPanel.cs b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Gui/AspNetConfigurationPanel.cs index 14aa3a0434..be36f9aca8 100644 --- a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Gui/AspNetConfigurationPanel.cs +++ b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Gui/AspNetConfigurationPanel.cs @@ -32,26 +32,29 @@ using System; using Gtk; -using MonoDevelop.Core.Gui.Dialogs; +using MonoDevelop.Projects.Gui.Dialogs; using MonoDevelop.Core; namespace MonoDevelop.AspNet.Gui { - public class AspNetConfigurationPanel : AbstractOptionPanel + public class AspNetConfigurationPanel : MultiConfigItemOptionsPanel { AspNetConfigurationPanelWidget panel; - public override void LoadPanelContents () + public override Widget CreatePanelWidget () { - panel = new AspNetConfigurationPanelWidget ((Properties) this.CustomizationObject); - this.Child = panel; + return panel = new AspNetConfigurationPanelWidget (); } - public override bool StorePanelContents () + public override void LoadConfigData () + { + panel.Load ((AspNetAppProjectConfiguration) CurrentConfiguration); + } + + public override void ApplyChanges () { panel.Store (); - return true; } } } diff --git a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Gui/AspNetConfigurationPanelWidget.cs b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Gui/AspNetConfigurationPanelWidget.cs index 40b9240c94..6772b1d0a2 100644 --- a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Gui/AspNetConfigurationPanelWidget.cs +++ b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Gui/AspNetConfigurationPanelWidget.cs @@ -16,10 +16,14 @@ namespace MonoDevelop.AspNet.Gui { AspNetAppProjectConfiguration configuration; - public AspNetConfigurationPanelWidget (Properties customizationObject) + public AspNetConfigurationPanelWidget () { this.Build(); - configuration = ((Properties)customizationObject).Get<AspNetAppProjectConfiguration> ("Config"); + } + + public void Load (AspNetAppProjectConfiguration configuration) + { + this.configuration = configuration; autoGenerateNonPartialCodeBehind.Active = configuration.GenerateNonPartialCodeBehindMembers; } diff --git a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Gui/AspNetEditorExtension.cs b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Gui/AspNetEditorExtension.cs index 006b4858e4..cc23ab6b64 100644 --- a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Gui/AspNetEditorExtension.cs +++ b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Gui/AspNetEditorExtension.cs @@ -72,7 +72,7 @@ namespace MonoDevelop.AspNet.Gui base.Initialize (); tracker = new DocumentStateTracker<Parser<AspNetFreeState>> (Editor); - MonoDevelop.Ide.Gui.IdeApp.ProjectOperations.ParserDatabase.ParseInformationChanged + MonoDevelop.Ide.Gui.IdeApp.Workspace.ParserDatabase.ParseInformationChanged += OnParseInformationChanged; //ensure that the schema service is initialised, or code completion may take a couple of seconds to trigger @@ -83,7 +83,7 @@ namespace MonoDevelop.AspNet.Gui { if (tracker != null) { tracker = null; - MonoDevelop.Ide.Gui.IdeApp.ProjectOperations.ParserDatabase.ParseInformationChanged + MonoDevelop.Ide.Gui.IdeApp.Workspace.ParserDatabase.ParseInformationChanged -= OnParseInformationChanged; base.Dispose (); } @@ -452,10 +452,10 @@ namespace MonoDevelop.AspNet.Gui //get a parser context MonoDevelop.Projects.Parser.IParserContext ctx = null; if (doc.Project != null) - ctx = MonoDevelop.Ide.Gui.IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (doc.Project); + ctx = MonoDevelop.Ide.Gui.IdeApp.Workspace.ParserDatabase.GetProjectParserContext (doc.Project); else //FIXME use correct runtime - ctx = MonoDevelop.Ide.Gui.IdeApp.ProjectOperations.ParserDatabase.GetAssemblyParserContext ("System.Web"); + ctx = MonoDevelop.Ide.Gui.IdeApp.Workspace.ParserDatabase.GetAssemblyParserContext ("System.Web"); if (ctx == null) { LoggingService.LogWarning ("Could not obtain parser context in AddAspAttributeCompletionData"); return; @@ -506,7 +506,7 @@ namespace MonoDevelop.AspNet.Gui if (controlClass == null) { //FIXME: respect runtime version MonoDevelop.Projects.Parser.IParserContext sysWebContext = - MonoDevelop.Ide.Gui.IdeApp.ProjectOperations.ParserDatabase.GetAssemblyParserContext ("System.Web"); + MonoDevelop.Ide.Gui.IdeApp.Workspace.ParserDatabase.GetAssemblyParserContext ("System.Web"); if (sysWebContext == null) return; @@ -520,7 +520,7 @@ namespace MonoDevelop.AspNet.Gui MonoDevelop.Projects.Parser.IParserContext projectContext = null; if (cu != null && cu.Document.Project != null) projectContext = - MonoDevelop.Ide.Gui.IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext ( + MonoDevelop.Ide.Gui.IdeApp.Workspace.ParserDatabase.GetProjectParserContext ( cu.Document.Project); if (projectContext != null && !string.IsNullOrEmpty (cu.PageInfo.InheritedClass)) codeBehindClass = projectContext.GetClass (cu.PageInfo.InheritedClass); @@ -563,7 +563,7 @@ namespace MonoDevelop.AspNet.Gui //FIXME: respect runtime version if (projectContext == null) projectContext = - MonoDevelop.Ide.Gui.IdeApp.ProjectOperations. + MonoDevelop.Ide.Gui.IdeApp.Workspace. ParserDatabase.GetAssemblyParserContext ("System.Web"); if (projectContext == null) return; diff --git a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Gui/XspOptionsPanel.cs b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Gui/XspOptionsPanel.cs index 992ae70dca..437fa6f9fc 100644 --- a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Gui/XspOptionsPanel.cs +++ b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Gui/XspOptionsPanel.cs @@ -31,26 +31,24 @@ using System; using Gtk; -using MonoDevelop.Core.Gui.Dialogs; +using MonoDevelop.Projects.Gui.Dialogs; using MonoDevelop.Core; namespace MonoDevelop.AspNet.Gui { - public class XspOptionsPanel : AbstractOptionPanel + public class XspOptionsPanel : ItemOptionsPanel { XspOptionsPanelWidget panel; - public override void LoadPanelContents () + public override Widget CreatePanelWidget () { - panel = new XspOptionsPanelWidget ((Properties) this.CustomizationObject); - this.Child = panel; + return panel = new XspOptionsPanelWidget ((AspNetAppProject) ConfiguredProject); } - public override bool StorePanelContents () + public override void ApplyChanges () { - panel.Store ((Properties) CustomizationObject); - return true; + panel.Store ((AspNetAppProject) ConfiguredProject); } } } diff --git a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Gui/XspOptionsPanelWidget.cs b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Gui/XspOptionsPanelWidget.cs index c86763fe66..cabb69c96f 100644 --- a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Gui/XspOptionsPanelWidget.cs +++ b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Gui/XspOptionsPanelWidget.cs @@ -36,11 +36,10 @@ namespace MonoDevelop.AspNet.Gui public partial class XspOptionsPanelWidget : Gtk.Bin { - public XspOptionsPanelWidget (Properties customizationObject) + public XspOptionsPanelWidget (AspNetAppProject project) { this.Build(); - AspNetAppProject project = ((Properties)customizationObject).Get<AspNetAppProject> ("Project"); XspParameters xPar = project.XspParameters; //index should be equivalent to XspSslMode enum @@ -83,9 +82,8 @@ namespace MonoDevelop.AspNet.Gui passwordEntry.Text = xPar.PrivateKeyPassword; } - public void Store (Properties customizationObject) + public void Store (AspNetAppProject project) { - AspNetAppProject project = ((Properties)customizationObject).Get<AspNetAppProject> ("Project"); XspParameters xPar = project.XspParameters; xPar.Address = ipAddress.Text; diff --git a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Parser/Document.cs b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Parser/Document.cs index f0f91bb02b..8ce3bb4f88 100644 --- a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Parser/Document.cs +++ b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Parser/Document.cs @@ -131,7 +131,7 @@ namespace MonoDevelop.AspNet.Parser public AspNetAppProject Project { get { if (project == null) - project = MonoDevelop.Ide.Gui.IdeApp.ProjectOperations.GetProjectContaining (filePath) + project = MonoDevelop.Ide.Gui.IdeApp.Workspace.GetProjectContainingFile (filePath) as AspNetAppProject; return project; } diff --git a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Parser/SuggestedHandlerCompletionData.cs b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Parser/SuggestedHandlerCompletionData.cs index 4433658525..abc98d6ed4 100644 --- a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Parser/SuggestedHandlerCompletionData.cs +++ b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Parser/SuggestedHandlerCompletionData.cs @@ -40,12 +40,12 @@ namespace MonoDevelop.AspNet.Parser public class SuggestedHandlerCompletionData : IActionCompletionData { - CombineEntry entry; + SolutionItem entry; CodeMemberMethod methodInfo; IClass codeBehindClass; IClass codeBehindClassPart; - public SuggestedHandlerCompletionData (CombineEntry entry, CodeMemberMethod methodInfo, IClass codeBehindClass, IClass codeBehindClassPart) + public SuggestedHandlerCompletionData (SolutionItem entry, CodeMemberMethod methodInfo, IClass codeBehindClass, IClass codeBehindClassPart) { this.entry = entry; this.methodInfo = methodInfo; diff --git a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Parser/WebFormReferenceManager.cs b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Parser/WebFormReferenceManager.cs index 2b3593e4d8..da663a2ec7 100644 --- a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Parser/WebFormReferenceManager.cs +++ b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.Parser/WebFormReferenceManager.cs @@ -126,7 +126,7 @@ namespace MonoDevelop.AspNet.Parser } } - doc.Project.ProjectReferences.Add ( + doc.Project.References.Add ( new ProjectReference (ReferenceType.Assembly, type.Assembly.ToString ()));
/* TODO: insert the reference into the document tree diff --git a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.addin.xml b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.addin.xml index 62d5eb29a1..9084cacae2 100644 --- a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.addin.xml +++ b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet.addin.xml @@ -22,10 +22,17 @@ <Addin id="Ide" version="0.19.0"/> <Addin id="DesignerSupport" version="0.19.0"/> <Addin id="Deployment" version="0.19.0"/> - <Addin id="Prj2Make" version="0.19.0" /> <Addin id="XmlEditor" version="0.19.0" /> </Dependencies> + <Extension path = "/MonoDevelop/ProjectModel/MSBuildItemTypes"> + <DotNetProjectSubtype + guid="{349c5851-65df-11da-9384-00065b846f21}" + type="MonoDevelop.AspNet.AspNetAppProject" + import="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v8.0\WebApplications\Microsoft.WebApplication.targets" + /> + </Extension> + <ExtensionPoint path = "/MonoDevelop/Html/DocTypes"> <ExtensionNode name = "DocType" type = "MonoDevelop.Html.DocTypeExtensionNode" /> </ExtensionPoint> @@ -105,38 +112,29 @@ <DataType class = "MonoDevelop.AspNet.AspNetToolboxNode" /> </Extension> - <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/GeneralOptions/Common"> + <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/Common"> <Condition id="activeproject" value="AspNetApp"> - <DialogPanel id = "XspOptions" + <Section id = "XspOptions" _label = "XSP Web Server" class = "MonoDevelop.AspNet.Gui.XspOptionsPanel"/> + <Section id = "AspNetConfiguration" + _label = "ASP.NET Options" + class = "MonoDevelop.AspNet.Gui.AspNetConfigurationPanel"/> </Condition> </Extension> - <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/GeneralOptions/Deployment"> + <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/Deployment"> <Condition id="activeproject" value="AspNetApp"> - <DialogPanel id = "MonoDevelop.AspNet.Deployment" + <Section id = "MonoDevelop.AspNet.Deployment" _label = "Web Deployment Targets" class = "MonoDevelop.AspNet.Deployment.WebDeployOptionsPanel"/> </Condition> </Extension> - <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/ConfigurationOptions"> - <Condition id="activeproject" value="AspNetApp"> - <DialogPanel id = "AspNetConfiguration" - _label = "ASP.NET Options" - class = "MonoDevelop.AspNet.Gui.AspNetConfigurationPanel"/> - </Condition> - </Extension> - <Extension path = "/MonoDevelop/ProjectModel/ProjectServiceExtensions"> <Class class = "MonoDevelop.AspNet.VerifyCodeBehindBuildStep" /> </Extension> - <Extension path = "/MonoDevelop/Prj2Make/MSBuildProjectExtension"> - <Class class="MonoDevelop.AspNet.AspNetMSBuildProjectExtension" /> - </Extension> - <Extension path = "/MonoDevelop/DesignerSupport/ToolboxLoaders"> <Class id="AspNetToolboxLoader" class="MonoDevelop.AspNet.AspNetToolboxLoader"/> </Extension> diff --git a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/AspNetAppProject.cs b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/AspNetAppProject.cs index a048a924c3..58f47a94f9 100644 --- a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/AspNetAppProject.cs +++ b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/AspNetAppProject.cs @@ -52,16 +52,16 @@ namespace MonoDevelop.AspNet [DataInclude (typeof(AspNetAppProjectConfiguration))] public class AspNetAppProject : DotNetProject, IDeployable { - [ItemProperty("XspParameters")] + [ItemProperty("XspParameters", IsExternal=true)] protected XspParameters xspParameters = new XspParameters (); - [ItemProperty ("VerifyCodeBehindFields")] + [ItemProperty ("VerifyCodeBehindFields", IsExternal=true)] protected bool verifyCodeBehindFields = true; - [ItemProperty ("VerifyCodeBehindEvents")] + [ItemProperty ("VerifyCodeBehindEvents", IsExternal=true)] protected bool verifyCodeBehindEvents = true; - [ItemProperty("WebDeployTargets")] + [ItemProperty("WebDeployTargets", IsExternal=true)] [ItemProperty ("Target", ValueType=typeof(WebDeployTarget), Scope=1)] protected WebDeployTargetCollection webDeployTargets = new WebDeployTargetCollection (); @@ -123,13 +123,15 @@ namespace MonoDevelop.AspNet conf.SourceDirectory = BaseDirectory; }; } - + + /* TODO msbuild protected override void Deserialize (ITypeSerializer handler, DataCollection data) { loading = true; base.Deserialize (handler, data); loading = false; } + */ //AspNetAppProjectConfiguration needs SourceDirectory set so it can append "bin" to determine the output path public override string FileName { @@ -143,7 +145,7 @@ namespace MonoDevelop.AspNet } } - public override IConfiguration CreateConfiguration (string name) + public override SolutionItemConfiguration CreateConfiguration (string name) { AspNetAppProjectConfiguration conf = new AspNetAppProjectConfiguration (); @@ -157,22 +159,22 @@ namespace MonoDevelop.AspNet #endregion //custom version of GetDeployFiles which puts libraries in the bin directory - public DeployFileCollection GetDeployFiles () + public DeployFileCollection GetDeployFiles (string configuration) { DeployFileCollection files = new DeployFileCollection (); //add files that are marked to 'deploy' //ASP.NET files etc all go relative to the application root - foreach (ProjectFile pf in ProjectFiles) + foreach (ProjectFile pf in Files) if (pf.BuildAction == BuildAction.FileCopy) files.Add (new DeployFile (this, pf.FilePath, pf.RelativePath, WebTargetDirectory.SiteRoot)); //add referenced libraries - foreach (string refFile in GetReferenceDeployFiles (false)) + foreach (string refFile in GetReferenceDeployFiles (false, configuration)) files.Add (new DeployFile (this, refFile, Path.GetFileName (refFile), WebTargetDirectory.AspNetBin)); //add the compiled output file - string outputFile = this.GetOutputFileName (); + string outputFile = this.GetOutputFileName (configuration); if (!string.IsNullOrEmpty (outputFile)) files.Add (new DeployFile (this, outputFile, Path.GetFileName (outputFile), WebTargetDirectory.AspNetBin)); @@ -182,12 +184,12 @@ namespace MonoDevelop.AspNet #region build/prebuild/execute - protected override ICompilerResult DoBuild (IProgressMonitor monitor) + protected override ICompilerResult DoBuild (IProgressMonitor monitor, string configuration) { //if no files are set to compile, then some compilers will error out //though this is valid with ASP.NET apps, so we just avoid calling the compiler in this case bool needsCompile = false; - foreach (ProjectFile pf in ProjectFiles) { + foreach (ProjectFile pf in Files) { if (pf.BuildAction == BuildAction.Compile) { needsCompile = true; break; @@ -196,7 +198,7 @@ namespace MonoDevelop.AspNet ICompilerResult ret; if (needsCompile) - ret = base.DoBuild (monitor); + ret = base.DoBuild (monitor, configuration); else ret = new DefaultCompilerResult (); @@ -204,7 +206,7 @@ namespace MonoDevelop.AspNet // it's not strictly necessary, as the Run/Deploy commands do it too.. // but some users expect it to happen during a compile, so it's easier all round this way //need to do this after the compile, as the compile phase removes copied references - CopyReferencesToOutputPath (false); + CopyReferencesToOutputPath (false, configuration); return ret; } @@ -219,21 +221,23 @@ namespace MonoDevelop.AspNet } } - protected override void DoExecute (IProgressMonitor monitor, ExecutionContext context) + protected override void DoExecute (IProgressMonitor monitor, ExecutionContext context, string config) { //check XSP is available - ClrVersion clrVersion = ((AspNetAppProjectConfiguration) ActiveConfiguration).ClrVersion; + + AspNetAppProjectConfiguration configuration = (AspNetAppProjectConfiguration) GetConfiguration (config); + + ClrVersion clrVersion = configuration.ClrVersion; string xspVersion = (clrVersion == ClrVersion.Net_1_1)? "xsp" : "xsp2"; if (!CheckXsp (xspVersion)) { monitor.ReportError (string.Format ("The \"{0}\" web server cannot be started. Please ensure that it is installed.",xspVersion), null); return; } - CopyReferencesToOutputPath (false); + CopyReferencesToOutputPath (false, config); IConsole console = null; AggregatedOperationMonitor operationMonitor = new AggregatedOperationMonitor (monitor); - AspNetAppProjectConfiguration configuration = (AspNetAppProjectConfiguration) ActiveConfiguration; try { IExecutionHandler handler = context.ExecutionHandlerFactory.CreateExecutionHandler ("Native"); @@ -367,7 +371,7 @@ namespace MonoDevelop.AspNet void UpdateWebConfigRefs () { List<string> refs = new List<string> (); - foreach (ProjectReference reference in ProjectReferences) { + foreach (ProjectReference reference in References) { //local copied assemblies are copied to the bin directory so ASP.NET references them automatically if (reference.LocalCopy && (reference.ReferenceType == ReferenceType.Project || reference.ReferenceType == ReferenceType.Assembly)) continue; @@ -533,7 +537,7 @@ namespace MonoDevelop.AspNet if (ClrVersion == MonoDevelop.Core.ClrVersion.Net_2_0) foreach (string dir in specialDirs20) - if (ProjectFiles.GetFile (Path.Combine (BaseDirectory, dir)) == null) + if (Files.GetFile (Path.Combine (BaseDirectory, dir)) == null) notPresent.Add (dir); return notPresent; diff --git a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/AspNetAppProjectBinding.cs b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/AspNetAppProjectBinding.cs index 295ca0b9f8..6fab4caae3 100644 --- a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/AspNetAppProjectBinding.cs +++ b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/AspNetAppProjectBinding.cs @@ -69,7 +69,7 @@ namespace MonoDevelop.AspNet info.ProjectName = Path.GetFileNameWithoutExtension (file); info.CombinePath = Path.GetDirectoryName (file); Project project = CreateProject (language, info, null); - project.ProjectFiles.Add (new ProjectFile (file)); + project.Files.Add (new ProjectFile (file)); return project; } diff --git a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/AspNetAppProjectConfiguration.cs b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/AspNetAppProjectConfiguration.cs index a32c8c0293..2770255d40 100644 --- a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/AspNetAppProjectConfiguration.cs +++ b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/AspNetAppProjectConfiguration.cs @@ -54,14 +54,6 @@ namespace MonoDevelop.AspNet #region //override behaviour of base class to make sure things compile to the right places - public override CompileTarget CompileTarget { - get { return CompileTarget.Library; } - set { - //if (value != CompileTarget.Library) - // throw new InvalidOperationException ("ASP.NET applications must compile to a library."); - } - } - string GetStandardOutputDirectory () { if (SourceDirectory != null) { diff --git a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/AspNetMSBuildProjectExtension.cs b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/AspNetMSBuildProjectExtension.cs deleted file mode 100644 index 0b27e1a457..0000000000 --- a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/AspNetMSBuildProjectExtension.cs +++ /dev/null @@ -1,125 +0,0 @@ -// -// AspNetMSBuildProjectExtension.cs -// -// Author: -// Ankit Jain <jankit@novell.com> -// -// Copyright (C) 2007 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Xml; - -using MonoDevelop.Prj2Make; -using MonoDevelop.Projects; - -namespace MonoDevelop.AspNet -{ - public class AspNetMSBuildProjectExtension : MSBuildProjectExtension - { - const string myguid = "{349C5851-65DF-11DA-9384-00065B846F21}"; - - public override string TypeGuid { - get { return myguid; } - } - - public override string Name { - get { return "AspNet";} - } - - public override bool Supports (string type_guid, string filename, string type_guids) - { - return (String.Compare (type_guid, myguid, true) == 0); - } - - public override DotNetProject CreateProject (string type_guid, string filename, string type_guids) - { - if (!Supports (type_guid, filename, type_guids)) - throw new InvalidOperationException (String.Format ("Project of type guid = {0} not supported by this extension.", type_guid)); - - string lang = Utils.GetLanguage (filename); - //if (lang == null) - return new AspNetAppProject (lang); - } - - public override void ReadFlavorProperties (MSBuildData data, DotNetProject project, XmlNode node, string guid) - { - if (String.Compare (guid, myguid, true) != 0) { - base.ReadFlavorProperties (data, project, node, guid); - return; - } - - AspNetAppProject asp_project = (AspNetAppProject) project; - - //FlavorProperties for web project - if (node == null) - return; - node = Utils.MoveToChild (node, "WebProjectProperties"); - if (node == null) - return; - - //Read - int port = -1; - if (!Utils.ReadAsInt (node, "DevelopmentServerPort", ref port) || port < 0) - return; - - asp_project.XspParameters.Port = port; - } - - //Writing methods - - public override void OnFinishWrite (MSBuildData data, DotNetProject project) - { - base.OnFinishWrite (data, project); - - if (!project.ExtendedProperties.Contains (typeof (MSBuildFileFormat))) { - //New project file, eg when converting from another project - XmlElement elem = data.Document.CreateElement ("Import", Utils.ns); - data.Document.DocumentElement.InsertAfter (elem, data.Document.DocumentElement.LastChild); - elem.SetAttribute ("Project", @"$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v8.0\WebApplications\Microsoft.WebApplication.targets"); - } - - // insert this at the end - XmlElement flavor_properties_element = MSBuildFileFormat.GetFlavorPropertiesElement (data, myguid, true); - XmlNode webproject_element = Utils.MoveToChild (flavor_properties_element, "WebProjectProperties"); - if (webproject_element == null) { - webproject_element = data.Document.CreateElement ("WebProjectProperties", Utils.ns); - flavor_properties_element.AppendChild (webproject_element); - } - - AspNetAppProject asp_project = (AspNetAppProject) project; - Utils.EnsureChildValue (webproject_element, "DevelopmentServerPort", asp_project.XspParameters.Port); - } - - public override string GetGuidChain (DotNetProject project) - { - if (project.GetType () != typeof (AspNetAppProject)) - return null; - - if (!MSBuildFileFormat.LanguageTypeGuids.ContainsKey (project.LanguageName)) - return null; - - return String.Format ("{0};{1}", myguid, MSBuildFileFormat.LanguageTypeGuids [project.LanguageName]); - } - } - -} diff --git a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/AspNetParserService.cs b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/AspNetParserService.cs index 7c842dcac5..783f34ce27 100644 --- a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/AspNetParserService.cs +++ b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/AspNetParserService.cs @@ -43,9 +43,9 @@ namespace MonoDevelop.AspNet { IParserContext ctx; if (project != null) { - ctx = IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (project); + ctx = IdeApp.Workspace.ParserDatabase.GetProjectParserContext (project); } else { - ctx = IdeApp.ProjectOperations.ParserDatabase.GetFileParserContext (filename); + ctx = IdeApp.Workspace.ParserDatabase.GetFileParserContext (filename); } if (ensureUpToDate) ctx.UpdateDatabase (); diff --git a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/AspNetToolboxNode.cs b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/AspNetToolboxNode.cs index d58367b456..76b1171af5 100644 --- a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/AspNetToolboxNode.cs +++ b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/AspNetToolboxNode.cs @@ -94,9 +94,10 @@ namespace MonoDevelop.AspNet void RegisterReference (MonoDevelop.Projects.Project project) { + MonoDevelop.Projects.DotNetProject dnp = (MonoDevelop.Projects.DotNetProject) project; MonoDevelop.Projects.ProjectReference pr = base.Type.GetProjectReference (); - if (!project.ProjectReferences.Contains (pr)) - project.ProjectReferences.Add (pr); + if (!dnp.References.Contains (pr)) + dnp.References.Add (pr); } public string GetTextForFile (string path, MonoDevelop.Projects.Project project) @@ -112,7 +113,7 @@ namespace MonoDevelop.AspNet //register the assembly and look up the class RegisterReference (project); MonoDevelop.Projects.Parser.IParserContext ctx = - MonoDevelop.Ide.Gui.IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (project); + MonoDevelop.Ide.Gui.IdeApp.Workspace.ParserDatabase.GetProjectParserContext (project); ctx.UpdateDatabase (); MonoDevelop.Projects.Parser.IClass cls = ctx.GetClass (base.Type.TypeName); if (cls == null) diff --git a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/CodeBehind.cs b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/CodeBehind.cs index aba7738187..c90e627e6d 100644 --- a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/CodeBehind.cs +++ b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/CodeBehind.cs @@ -54,7 +54,7 @@ namespace MonoDevelop.AspNet return null; IProjectParserContext ppc = - MonoDevelop.Ide.Gui.IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (file.Project); + MonoDevelop.Ide.Gui.IdeApp.Workspace.ParserDatabase.GetProjectParserContext (file.Project); IParseInformation pi = ppc.GetParseInformation (file.FilePath); AspNetCompilationUnit cu = pi.MostRecentCompilationUnit as AspNetCompilationUnit; diff --git a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/VerifyCodeBehindBuildStep.cs b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/VerifyCodeBehindBuildStep.cs index 99877d547f..c8747e23de 100644 --- a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/VerifyCodeBehindBuildStep.cs +++ b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/VerifyCodeBehindBuildStep.cs @@ -45,26 +45,26 @@ namespace MonoDevelop.AspNet public class VerifyCodeBehindBuildStep : ProjectServiceExtension { - public override ICompilerResult Build (IProgressMonitor monitor, CombineEntry project) + protected override ICompilerResult Build (IProgressMonitor monitor, SolutionEntityItem project, string configuration) { AspNetAppProject aspProject = project as AspNetAppProject; List<CodeBehindWarning> errors = new List<CodeBehindWarning> (); if (aspProject == null || aspProject.LanguageBinding == null || aspProject.LanguageBinding.Refactorer == null) - return base.Build (monitor, project); + return base.Build (monitor, project, configuration); RefactorOperations ops = aspProject.LanguageBinding.Refactorer.SupportedOperations; if ((ops & RefactorOperations.AddField) != RefactorOperations.AddField) - return base.Build (monitor, project); + return base.Build (monitor, project, configuration); //lists of members to be added List<System.CodeDom.CodeMemberField> membersToAdd = new List<System.CodeDom.CodeMemberField> (); List<IClass> classesForMembers = new List<IClass> (); - AspNetAppProjectConfiguration config = (AspNetAppProjectConfiguration) aspProject.ActiveConfiguration; + AspNetAppProjectConfiguration config = (AspNetAppProjectConfiguration) aspProject.GetConfiguration (configuration); //get an updated parser database - IParserContext ctx = MonoDevelop.Ide.Gui.IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (aspProject); + IParserContext ctx = MonoDevelop.Ide.Gui.IdeApp.Workspace.ParserDatabase.GetProjectParserContext (aspProject); ctx.UpdateDatabase (); monitor.Log.WriteLine (GettextCatalog.GetString ("Generating CodeBehind members...")); @@ -72,7 +72,7 @@ namespace MonoDevelop.AspNet monitor.Log.WriteLine (GettextCatalog.GetString ("Auto-generation of CodeBehind members is disabled for non-partial classes.")); //find the members that need to be added to CodeBehind classes - foreach (ProjectFile file in aspProject.ProjectFiles) { + foreach (ProjectFile file in aspProject.Files) { WebSubtype type = AspNetAppProject.DetermineWebSubtype (Path.GetExtension (file.FilePath)); if ((type != WebSubtype.WebForm) && (type != WebSubtype.WebControl) && (type != WebSubtype.MasterPage)) @@ -181,7 +181,7 @@ namespace MonoDevelop.AspNet monitor.Log.WriteLine (GettextCatalog.GetString ("No changes made to CodeBehind classes.")); } - ICompilerResult baseResult = base.Build (monitor, project); + ICompilerResult baseResult = base.Build (monitor, project, configuration); foreach (CodeBehindWarning cbw in errors) { if (cbw.FileName != null) baseResult.AddWarning (cbw.FileName, cbw.Line, cbw.Column, null, cbw.WarningText); diff --git a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/WebTypeManager.cs b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/WebTypeManager.cs index 09c96d621e..5b9df6ed6f 100644 --- a/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/WebTypeManager.cs +++ b/main/src/addins/AspNetAddIn/MonoDevelop.AspNet/WebTypeManager.cs @@ -227,7 +227,7 @@ namespace MonoDevelop.AspNet static IAssemblyParserContext GetSystemWebAssemblyContext (MonoDevelop.Core.ClrVersion clrVersion) { string assem = MonoDevelop.Core.Runtime.SystemAssemblyService.GetAssemblyNameForVersion ("System.Web", clrVersion); - return MonoDevelop.Ide.Gui.IdeApp.ProjectOperations.ParserDatabase.GetAssemblyParserContext (assem); + return MonoDevelop.Ide.Gui.IdeApp.Workspace.ParserDatabase.GetAssemblyParserContext (assem); } public static string AssemblyTypeNameLookup (string tagName, string namespac, string assem) @@ -238,7 +238,7 @@ namespace MonoDevelop.AspNet public static IClass AssemblyTypeLookup (string tagName, string namespac, string assem) { - IParserContext ctx = IdeApp.ProjectOperations.ParserDatabase.GetAssemblyParserContext (assem); + IParserContext ctx = IdeApp.Workspace.ParserDatabase.GetAssemblyParserContext (assem); if (ctx == null) return null; ctx.UpdateDatabase (); @@ -258,7 +258,7 @@ namespace MonoDevelop.AspNet public static IEnumerable<IClass> ListControlClasses (string assem) { - IParserContext ctx = IdeApp.ProjectOperations.ParserDatabase.GetAssemblyParserContext (assem); + IParserContext ctx = IdeApp.Workspace.ParserDatabase.GetAssemblyParserContext (assem); if (ctx == null) yield break; @@ -322,9 +322,9 @@ namespace MonoDevelop.AspNet IParserContext ctx = null; if (!string.IsNullOrEmpty (namespac)) { if (!string.IsNullOrEmpty (assem)) - ctx = IdeApp.ProjectOperations.ParserDatabase.GetAssemblyParserContext (assem); + ctx = IdeApp.Workspace.ParserDatabase.GetAssemblyParserContext (assem); else if (project != null) - ctx = IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (project); + ctx = IdeApp.Workspace.ParserDatabase.GetProjectParserContext (project); else ctx = GetSystemWebAssemblyContext (MonoDevelop.Core.ClrVersion.Default); ctx.UpdateDatabase (); diff --git a/main/src/addins/AspNetAddIn/gtk-gui/gui.stetic b/main/src/addins/AspNetAddIn/gtk-gui/gui.stetic index 360dc4f98d..519d3c29c1 100644 --- a/main/src/addins/AspNetAddIn/gtk-gui/gui.stetic +++ b/main/src/addins/AspNetAddIn/gtk-gui/gui.stetic @@ -11,7 +11,7 @@ <widget-library name="../../../../build/bin/MonoDevelop.Projects.Gui.dll" /> <widget-library name="../../../../build/AddIns/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.dll" /> </import> - <widget class="Gtk.Bin" id="MonoDevelop.AspNet.Gui.AspNetConfigurationPanelWidget" design-size="436 300"> + <widget class="Gtk.Bin" id="MonoDevelop.AspNet.Gui.AspNetConfigurationPanelWidget" design-size="449 300"> <property name="MemberName" /> <child> <widget class="Gtk.VBox" id="vbox1"> diff --git a/main/src/addins/CBinding/CBinding.addin.xml b/main/src/addins/CBinding/CBinding.addin.xml index e78b66b6f9..47b8f8b7ee 100644 --- a/main/src/addins/CBinding/CBinding.addin.xml +++ b/main/src/addins/CBinding/CBinding.addin.xml @@ -96,29 +96,24 @@ class = "CBinding.GeneralOptionsPanelBinding"/> </Extension> - <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/ConfigurationOptions"> + <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/Common"> <Condition id = "activelanguage" value = "C"> - <DialogPanel + <Section + id = "CompilerPanel" + _label = "Compiler" + insertafter = "Compile" + class = "CBinding.CompilerPanelBinding"/> + <Section id = "CodeGenerationPanel" _label = "Code Generation" class = "CBinding.CodeGenerationPanelBinding"/> - <DialogPanel + <Section id = "OutputOptionsPanel" _label = "Output" class = "CBinding.OutputOptionsPanelBinding"/> </Condition> </Extension> - <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/GeneralOptions/Common"> - <Condition id = "activelanguage" value = "C"> - <DialogPanel - id = "CompilerPanel" - _label = "Compiler" - insertafter = "Compile" - class = "CBinding.CompilerPanelBinding"/> - </Condition> - </Extension> - <ExtensionPoint path = "/CBinding/Views/ProjectBrowser/ContextMenu/PackagesFolderNode" name = "Packages folder context menu"> <Description>Context menu for packages folder in the solution pad.</Description> <ExtensionNodeSet id = "MonoDevelop.Components.Commands.ItemSet"/> @@ -210,6 +205,11 @@ <DataType class = "CBinding.GppCompiler"/> <DataType class = "CBinding.Package"/> </Extension> + + <Extension path = "/MonoDevelop/ProjectModel/MSBuildItemTypes"> + <SolutionItem type="CBinding.CProject" extension="cproj" guid="{2857B73E-F847-4B02-9238-064979017E93}"/> + </Extension> + <!-- Current Autotools AddIn is very .NET specific <Module> <Runtime> diff --git a/main/src/addins/CBinding/CBinding.mdp b/main/src/addins/CBinding/CBinding.mdp index 8148121c6b..d473917a40 100644 --- a/main/src/addins/CBinding/CBinding.mdp +++ b/main/src/addins/CBinding/CBinding.mdp @@ -139,14 +139,14 @@ <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Projects" /> <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Projects.Gui" /> <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Core" /> + <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.3.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Deployment" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Deployment.Linux" /> <ProjectReference type="Gac" localcopy="True" refto="glib-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="atk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.3.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> - <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Deployment" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Deployment.Linux" /> </References> <Deployment.LinuxDeployData scriptName="cbinding" /> <GtkDesignInfo gtkVersion="2.8.3"> diff --git a/main/src/addins/CBinding/ChangeLog b/main/src/addins/CBinding/ChangeLog index 8d1d5ae713..f2077fc425 100644 --- a/main/src/addins/CBinding/ChangeLog +++ b/main/src/addins/CBinding/ChangeLog @@ -1,3 +1,16 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * Gui/OutputOptionsPanel.cs, Gui/EditPackagesDialog.cs, + Gui/CodeGenerationPanel.cs, Gui/CompilerPanel.cs, + CBinding.addin.xml, ProjectPad/ProjectPackagesFolderNodeBuilder.cs, + ProjectPad/ProjectPackageNodeBuilder.cs, CBinding.mdp, + Parser/TagDatabaseManager.cs, + Navigation/ProjectNodeBuilderExtension.cs, + Project/CProjectConfiguration.cs, Project/CProjectBinding.cs, + Project/CProjectServiceExtension.cs, Project/CProject.cs, + gtk-gui/gui.stetic, Compiler/GNUCompiler.cs: New project model + changes. + 2008-05-08 Michael Hutchinson <mhutchinson@novell.com> * CBinding.addin.xml: Set "isText" attribute on the mimetype diff --git a/main/src/addins/CBinding/Compiler/GNUCompiler.cs b/main/src/addins/CBinding/Compiler/GNUCompiler.cs index 7b4d073fb9..1a489e221c 100644 --- a/main/src/addins/CBinding/Compiler/GNUCompiler.cs +++ b/main/src/addins/CBinding/Compiler/GNUCompiler.cs @@ -88,7 +88,7 @@ namespace CBinding // Precompile header files and place them in .prec/<config_name>/ if (configuration.PrecompileHeaders) { string precDir = Path.Combine (configuration.SourceDirectory, ".prec"); - string precConfigDir = Path.Combine (precDir, configuration.Name); + string precConfigDir = Path.Combine (precDir, configuration.Id); if (!Directory.Exists (precDir)) Directory.CreateDirectory (precDir); if (!Directory.Exists (precConfigDir)) @@ -186,7 +186,7 @@ namespace CBinding if (configuration.PrecompileHeaders) { string precdir = Path.Combine (configuration.SourceDirectory, ".prec"); - precdir = Path.Combine (precdir, configuration.Name); + precdir = Path.Combine (precdir, configuration.Id); args.Append ("-I\"" + precdir + "\""); } @@ -287,7 +287,7 @@ namespace CBinding foreach (ProjectFile file in projectFiles) { if (file.Subtype == Subtype.Code && CProject.IsHeaderFile (file.Name)) { string precomp = Path.Combine (configuration.SourceDirectory, ".prec"); - precomp = Path.Combine (precomp, configuration.Name); + precomp = Path.Combine (precomp, configuration.Id); precomp = Path.Combine (precomp, Path.GetFileName (file.Name) + ".ghc"); if (file.BuildAction == BuildAction.Compile) { if (!File.Exists (precomp) || configuration.UseCcache || File.GetLastWriteTime (file.Name) > File.GetLastWriteTime (precomp)) { diff --git a/main/src/addins/CBinding/Gui/CodeGenerationPanel.cs b/main/src/addins/CBinding/Gui/CodeGenerationPanel.cs index ae17c0587a..19a60b3dd3 100644 --- a/main/src/addins/CBinding/Gui/CodeGenerationPanel.cs +++ b/main/src/addins/CBinding/Gui/CodeGenerationPanel.cs @@ -36,7 +36,7 @@ using System.Collections; using Mono.Addins; using MonoDevelop.Core; -using MonoDevelop.Core.Gui.Dialogs; +using MonoDevelop.Projects.Gui.Dialogs; using MonoDevelop.Core.Gui.Components; namespace CBinding @@ -54,13 +54,10 @@ namespace CBinding {GettextCatalog.GetString ("_Root Solution Directory"), "${CombineDir}"}, }; - public CodeGenerationPanel (Properties customizationObject) + public CodeGenerationPanel () { this.Build (); - configuration = customizationObject.Get<CProjectConfiguration> ("Config"); - compilationParameters = (CCompilationParameters)configuration.CompilationParameters; - Gtk.CellRendererText textRenderer = new Gtk.CellRendererText (); libTreeView.Model = libStore; @@ -75,6 +72,15 @@ namespace CBinding includePathTreeView.HeadersVisible = false; includePathTreeView.AppendColumn ("Include", textRenderer, "text", 0); + new MenuButtonEntry (libPathEntry, quickInsertLibButton, quickPathInsertMenu); + new MenuButtonEntry (includePathEntry, quickInsertIncludeButton, quickPathInsertMenu); + } + + public void Load (CProjectConfiguration config) + { + configuration = config; + compilationParameters = (CCompilationParameters)configuration.CompilationParameters; + switch (compilationParameters.WarningLevel) { case WarningLevel.None: @@ -111,18 +117,17 @@ namespace CBinding defineSymbolsTextEntry.Text = compilationParameters.DefineSymbols; + libStore.Clear (); foreach (string lib in configuration.Libs) libStore.AppendValues (lib); + libPathStore.Clear (); foreach (string libPath in configuration.LibPaths) libPathStore.AppendValues (libPath); + libPathStore.Clear (); foreach (string includePath in configuration.Includes) includePathStore.AppendValues (includePath); - - - new MenuButtonEntry (libPathEntry, quickInsertLibButton, quickPathInsertMenu); - new MenuButtonEntry (includePathEntry, quickInsertIncludeButton, quickPathInsertMenu); } private void OnIncludePathAdded (object sender, EventArgs e) @@ -326,20 +331,23 @@ namespace CBinding } } - public class CodeGenerationPanelBinding : AbstractOptionPanel + public class CodeGenerationPanelBinding : MultiConfigItemOptionsPanel { private CodeGenerationPanel panel; - public override void LoadPanelContents () + public override Gtk.Widget CreatePanelWidget () { - panel = new CodeGenerationPanel ((Properties)CustomizationObject); - Add (panel); + return panel = new CodeGenerationPanel (); + } + + public override void LoadConfigData () + { + panel.Load ((CProjectConfiguration) CurrentConfiguration); } - - public override bool StorePanelContents () + public override void ApplyChanges () { - return panel.Store (); + panel.Store (); } } } diff --git a/main/src/addins/CBinding/Gui/CompilerPanel.cs b/main/src/addins/CBinding/Gui/CompilerPanel.cs index b3c0d10a69..19c0f06d55 100644 --- a/main/src/addins/CBinding/Gui/CompilerPanel.cs +++ b/main/src/addins/CBinding/Gui/CompilerPanel.cs @@ -36,7 +36,8 @@ using System.Collections; using Mono.Addins; using MonoDevelop.Core; -using MonoDevelop.Core.Gui.Dialogs; +using MonoDevelop.Projects.Gui.Dialogs; +using MonoDevelop.Ide.Gui; namespace CBinding { @@ -46,11 +47,11 @@ namespace CBinding private object[] compilers; private ICompiler active_compiler; - public CompilerPanel (Properties customizationObject) + public CompilerPanel (CProject project) { this.Build (); - project = customizationObject.Get<CProject> ("Project"); + this.project = project; compilers = AddinManager.GetExtensionObjects ("/CBinding/Compilers"); @@ -72,15 +73,15 @@ namespace CBinding compilerComboBox.Active = active; - useCcacheCheckBox.Active = ((CProjectConfiguration)project.ActiveConfiguration).UseCcache; + useCcacheCheckBox.Active = ((CProjectConfiguration)project.GetConfiguration (IdeApp.Workspace.ActiveConfiguration)).UseCcache; Update (); } - public bool Store () + public void Store () { if (project == null) - return false; + return; if (!active_compiler.Equals (project.Compiler)) { project.Compiler = active_compiler; @@ -90,8 +91,6 @@ namespace CBinding // Update use_ccache for all configurations foreach (CProjectConfiguration conf in project.Configurations) conf.UseCcache = useCcacheCheckBox.Active; - - return true; } protected virtual void OnCompilerComboBoxChanged (object sender, EventArgs e) @@ -115,20 +114,18 @@ namespace CBinding } } - public class CompilerPanelBinding : AbstractOptionPanel + public class CompilerPanelBinding : ItemOptionsPanel { CompilerPanel panel; - public override void LoadPanelContents () + public override Gtk.Widget CreatePanelWidget () { - panel = new CompilerPanel ((Properties)CustomizationObject); - Add (panel); + return panel = new CompilerPanel ((CProject)ConfiguredProject); } - - public override bool StorePanelContents () + public override void ApplyChanges () { - return panel.Store (); + panel.Store (); } } } diff --git a/main/src/addins/CBinding/Gui/EditPackagesDialog.cs b/main/src/addins/CBinding/Gui/EditPackagesDialog.cs index acba2a44cd..7c18273c19 100644 --- a/main/src/addins/CBinding/Gui/EditPackagesDialog.cs +++ b/main/src/addins/CBinding/Gui/EditPackagesDialog.cs @@ -36,6 +36,7 @@ using System.Collections.Generic; using Mono.Addins; using MonoDevelop.Projects; +using MonoDevelop.Ide.Gui; namespace CBinding { @@ -192,12 +193,12 @@ namespace CBinding List<Package> packages = new List<Package>(); Package package; - foreach (CombineEntry c in project.ParentCombine.Entries) { + foreach (SolutionItem c in project.ParentFolder.Items) { if (c is CProject) { CProject cproj = (CProject)c; - CProjectConfiguration conf = (CProjectConfiguration)cproj.ActiveConfiguration; + CProjectConfiguration conf = (CProjectConfiguration)cproj.GetConfiguration (IdeApp.Workspace.ActiveConfiguration); if (conf.CompileTarget != CBinding.CompileTarget.Bin) { - cproj.WriteMDPkgPackage (); + cproj.WriteMDPkgPackage (conf.Id); package = new Package (cproj); packages.Add (package); } diff --git a/main/src/addins/CBinding/Gui/OutputOptionsPanel.cs b/main/src/addins/CBinding/Gui/OutputOptionsPanel.cs index 8bf87ea3db..f711209739 100644 --- a/main/src/addins/CBinding/Gui/OutputOptionsPanel.cs +++ b/main/src/addins/CBinding/Gui/OutputOptionsPanel.cs @@ -34,7 +34,7 @@ using System; using Mono.Addins; using MonoDevelop.Core; -using MonoDevelop.Core.Gui.Dialogs; +using MonoDevelop.Projects.Gui.Dialogs; namespace CBinding { @@ -42,13 +42,15 @@ namespace CBinding { private CProjectConfiguration configuration; - public OutputOptionsPanel (Properties customizationObject) + public OutputOptionsPanel () { this.Build (); - table1.RowSpacing = 3; - - configuration = customizationObject.Get<CProjectConfiguration> ("Config"); + } + + public void Load (CProjectConfiguration configuration) + { + this.configuration = configuration; outputNameTextEntry.Text = configuration.Output; outputPathTextEntry.Text = configuration.OutputDirectory; @@ -68,10 +70,10 @@ namespace CBinding outputPathTextEntry.Text = dialog.SelectedPath; } - public bool Store () + public void Store () { if (configuration == null) - return false; + return; if (outputNameTextEntry != null && outputNameTextEntry.Text.Length > 0) configuration.Output = outputNameTextEntry.Text.Trim (); @@ -84,8 +86,6 @@ namespace CBinding configuration.ExternalConsole = externalConsoleCheckbox.Active; configuration.PauseConsoleOutput = pauseCheckbox.Active; - - return true; } protected virtual void OnExternalConsoleCheckboxClicked (object sender, System.EventArgs e) @@ -94,19 +94,23 @@ namespace CBinding } } - public class OutputOptionsPanelBinding : AbstractOptionPanel + public class OutputOptionsPanelBinding : MultiConfigItemOptionsPanel { private OutputOptionsPanel panel; - public override void LoadPanelContents () + public override Gtk.Widget CreatePanelWidget () + { + return panel = new OutputOptionsPanel (); + } + + public override void LoadConfigData () { - panel = new OutputOptionsPanel ((Properties)CustomizationObject); - Add (panel); + panel.Load ((CProjectConfiguration) CurrentConfiguration); } - public override bool StorePanelContents () + public override void ApplyChanges () { - return panel.Store (); + panel.Store (); } } } diff --git a/main/src/addins/CBinding/Navigation/ProjectNodeBuilderExtension.cs b/main/src/addins/CBinding/Navigation/ProjectNodeBuilderExtension.cs index 4595b70e45..c138bdafe8 100644 --- a/main/src/addins/CBinding/Navigation/ProjectNodeBuilderExtension.cs +++ b/main/src/addins/CBinding/Navigation/ProjectNodeBuilderExtension.cs @@ -79,7 +79,7 @@ namespace CBinding.Navigation if (o == null) return; try { - foreach (ProjectFile f in p.ProjectFiles) { + foreach (ProjectFile f in p.Files) { if (f.BuildAction == BuildAction.Compile) TagDatabaseManager.Instance.UpdateFileTags (p, f.Name); } @@ -186,7 +186,7 @@ namespace CBinding.Navigation if (p == null) return; - foreach (ProjectFile f in p.ProjectFiles) { + foreach (ProjectFile f in p.Files) { if (f.BuildAction == BuildAction.Compile) TagDatabaseManager.Instance.UpdateFileTags (p, f.Name); } diff --git a/main/src/addins/CBinding/Parser/TagDatabaseManager.cs b/main/src/addins/CBinding/Parser/TagDatabaseManager.cs index 70a4498754..0551eda0e6 100644 --- a/main/src/addins/CBinding/Parser/TagDatabaseManager.cs +++ b/main/src/addins/CBinding/Parser/TagDatabaseManager.cs @@ -162,7 +162,7 @@ namespace CBinding.Parser /// <see cref="System.String"/> /// </returns> private static string findFileInIncludes (Project project, string filename) { - CProjectConfiguration conf = project.ActiveConfiguration as CProjectConfiguration; + CProjectConfiguration conf = project.DefaultConfiguration as CProjectConfiguration; string fullpath = string.Empty; if (!Path.IsPathRooted (filename)) { diff --git a/main/src/addins/CBinding/Project/CProject.cs b/main/src/addins/CBinding/Project/CProject.cs index 2516f36182..db9e13cf22 100644 --- a/main/src/addins/CBinding/Project/CProject.cs +++ b/main/src/addins/CBinding/Project/CProject.cs @@ -74,6 +74,9 @@ namespace CBinding [ItemProperty] private Language language; + [ItemProperty("Target")] + CBinding.CompileTarget target = CBinding.CompileTarget.Bin; + private ProjectPackageCollection packages = new ProjectPackageCollection (); public event ProjectPackageEventHandler PackageAddedToProject; @@ -93,7 +96,7 @@ namespace CBinding { packages.Project = this; - IdeApp.ProjectOperations.EntryAddedToCombine += OnEntryAddedToCombine; + IdeApp.Workspace.ItemAddedToSolution += OnEntryAddedToCombine; } public CProject () @@ -140,7 +143,7 @@ namespace CBinding Configurations.Add (configuration); foreach (CProjectConfiguration c in Configurations) { - c.OutputDirectory = Path.Combine (binPath, c.Name); + c.OutputDirectory = Path.Combine (binPath, c.Id); c.SourceDirectory = BaseDirectory; c.Output = Name; CCompilationParameters parameters = c.CompilationParameters as CCompilationParameters; @@ -177,6 +180,11 @@ namespace CBinding get { return new string[] { "C", "CPP" }; } } + public CompileTarget CompileTarget { + get { return target; } + set { target = value; } + } + public override bool IsCompileable (string fileName) { string ext = Path.GetExtension (fileName.ToUpper ()); @@ -188,10 +196,9 @@ namespace CBinding } } - public List<CProject> DependedOnProjects () + public override IEnumerable<SolutionItem> GetReferencedItems (string configuration) { List<string> project_names = new List<string> (); - List<CProject> projects = new List<CProject> (); foreach (Package p in Packages) { if (p.IsProject && p.Name != Name) { @@ -199,13 +206,11 @@ namespace CBinding } } - foreach (CombineEntry e in ParentCombine.Entries) { + foreach (SolutionItem e in ParentFolder.Items) { if (e is CProject && project_names.Contains (e.Name)) { - projects.Add ((CProject)e); + yield return e; } } - - return projects; } public static bool IsHeaderFile (string filename) @@ -216,15 +221,15 @@ namespace CBinding /// <summary> /// Ths pkg-config package is for internal MonoDevelop use only, it is not deployed. /// </summary> - public void WriteMDPkgPackage () + public void WriteMDPkgPackage (string configuration) { string pkgfile = Path.Combine (BaseDirectory, Name + ".md.pc"); - CProjectConfiguration config = (CProjectConfiguration)ActiveConfiguration; + CProjectConfiguration config = (CProjectConfiguration)GetConfiguration (configuration); List<string> headerDirectories = new List<string> (); - foreach (ProjectFile f in ProjectFiles) { + foreach (ProjectFile f in Files) { if (IsHeaderFile (f.Name)) { string dir = Path.GetDirectoryName (f.FilePath); @@ -260,12 +265,12 @@ namespace CBinding /// This is the pkg-config package that gets deployed. /// <returns>The pkg-config package's filename</returns> /// </summary> - private string WriteDeployablePgkPackage () + private string WriteDeployablePgkPackage (string configuration) { // FIXME: This should probably be grabed from somewhere. string prefix = "/usr/local"; string pkgfile = Path.Combine (BaseDirectory, Name + ".pc"); - CProjectConfiguration config = (CProjectConfiguration)ActiveConfiguration; + CProjectConfiguration config = (CProjectConfiguration)GetConfiguration (configuration); using (StreamWriter writer = new StreamWriter (pkgfile)) { writer.WriteLine ("prefix={0}", prefix); @@ -288,21 +293,20 @@ namespace CBinding return pkgfile; } - protected override ICompilerResult DoBuild (IProgressMonitor monitor) + protected override ICompilerResult DoBuild (IProgressMonitor monitor, string configuration) { - CProjectConfiguration pc = (CProjectConfiguration)ActiveConfiguration; + CProjectConfiguration pc = (CProjectConfiguration) GetConfiguration (configuration); pc.SourceDirectory = BaseDirectory; return compiler_manager.Compile ( - ProjectFiles, packages, - (CProjectConfiguration)ActiveConfiguration, + Files, packages, + pc, monitor); } - protected override void DoExecute (IProgressMonitor monitor, - ExecutionContext context) + protected override void DoExecute (IProgressMonitor monitor, ExecutionContext context, string configuration) { - CProjectConfiguration conf = (CProjectConfiguration)ActiveConfiguration; + CProjectConfiguration conf = (CProjectConfiguration) GetConfiguration (configuration); string command = conf.Output; string args = conf.CommandLineParameters; string dir = Path.GetFullPath (conf.OutputDirectory); @@ -346,13 +350,13 @@ namespace CBinding } } - public override string GetOutputFileName () + public override string GetOutputFileName (string configuration) { - CProjectConfiguration conf = (CProjectConfiguration)ActiveConfiguration; + CProjectConfiguration conf = (CProjectConfiguration) GetConfiguration (configuration); return Path.Combine (conf.OutputDirectory, conf.CompiledOutputName); } - public override IConfiguration CreateConfiguration (string name) + public override SolutionItemConfiguration CreateConfiguration (string name) { CProjectConfiguration conf = new CProjectConfiguration (); @@ -420,14 +424,14 @@ namespace CBinding TagDatabaseManager.Instance.UpdateFileTags (this, e.ProjectFile.Name); } - private static void OnEntryAddedToCombine (object sender, CombineEntryEventArgs e) + private static void OnEntryAddedToCombine (object sender, SolutionItemEventArgs e) { - CProject p = e.CombineEntry as CProject; + CProject p = e.SolutionItem as CProject; if (p == null) return; - foreach (ProjectFile f in p.ProjectFiles) + foreach (ProjectFile f in p.Files) TagDatabaseManager.Instance.UpdateFileTags (p, f.Name); } @@ -441,14 +445,15 @@ namespace CBinding PackageAddedToProject (this, new ProjectPackageEventArgs (this, package)); } - public DeployFileCollection GetDeployFiles () + public DeployFileCollection GetDeployFiles (string configuration) { DeployFileCollection deployFiles = new DeployFileCollection (); - CompileTarget target = ((CProjectConfiguration)ActiveConfiguration).CompileTarget; + CProjectConfiguration conf = (CProjectConfiguration) GetConfiguration (configuration); + CompileTarget target = conf.CompileTarget; // Headers and resources - foreach (ProjectFile f in ProjectFiles) { + foreach (ProjectFile f in Files) { if (f.BuildAction == BuildAction.FileCopy) { string targetDirectory = (IsHeaderFile (f.Name) ? TargetDirectory.Include : TargetDirectory.ProgramFiles); @@ -458,7 +463,7 @@ namespace CBinding } // Output - string output = GetOutputFileName (); + string output = GetOutputFileName (configuration); if (!string.IsNullOrEmpty (output)) { string targetDirectory = string.Empty; @@ -479,7 +484,7 @@ namespace CBinding // PkgPackage if (target != CompileTarget.Bin) { - string pkgfile = WriteDeployablePgkPackage (); + string pkgfile = WriteDeployablePgkPackage (configuration); deployFiles.Add (new DeployFile (this, Path.Combine (BaseDirectory, pkgfile), pkgfile, LinuxTargetDirectory.PkgConfig)); } @@ -501,7 +506,7 @@ namespace CBinding string filenameStub = Path.GetFileNameWithoutExtension (sourceFile); bool wantHeader = !CProject.IsHeaderFile (sourceFile); - foreach (ProjectFile file in this.ProjectFiles) { + foreach (ProjectFile file in this.Files) { if (filenameStub == Path.GetFileNameWithoutExtension (file.Name) && (wantHeader == IsHeaderFile (file.Name))) { return file.Name; diff --git a/main/src/addins/CBinding/Project/CProjectBinding.cs b/main/src/addins/CBinding/Project/CProjectBinding.cs index 6976d87ca8..af34c69546 100644 --- a/main/src/addins/CBinding/Project/CProjectBinding.cs +++ b/main/src/addins/CBinding/Project/CProjectBinding.cs @@ -75,7 +75,7 @@ namespace CBinding if (language.Length > 0) { Project project = new CProject (info, null, language); - project.ProjectFiles.Add (new ProjectFile (sourceFile)); + project.Files.Add (new ProjectFile (sourceFile)); return project; } diff --git a/main/src/addins/CBinding/Project/CProjectConfiguration.cs b/main/src/addins/CBinding/Project/CProjectConfiguration.cs index e17f14c29c..af10dafb56 100644 --- a/main/src/addins/CBinding/Project/CProjectConfiguration.cs +++ b/main/src/addins/CBinding/Project/CProjectConfiguration.cs @@ -45,7 +45,7 @@ namespace CBinding SharedLibrary }; - public class CProjectConfiguration : AbstractProjectConfiguration + public class CProjectConfiguration : ProjectConfiguration { [ItemProperty("Output/output")] string output = string.Empty; @@ -150,7 +150,7 @@ namespace CBinding set { precompileHeaders = value; } } - public override void CopyFrom (IConfiguration configuration) + public override void CopyFrom (ItemConfiguration configuration) { base.CopyFrom (configuration); CProjectConfiguration conf = (CProjectConfiguration)configuration; diff --git a/main/src/addins/CBinding/Project/CProjectServiceExtension.cs b/main/src/addins/CBinding/Project/CProjectServiceExtension.cs index ec52771855..3b7db2c4ba 100644 --- a/main/src/addins/CBinding/Project/CProjectServiceExtension.cs +++ b/main/src/addins/CBinding/Project/CProjectServiceExtension.cs @@ -43,32 +43,30 @@ namespace CBinding { public class CProjectServiceExtension : ProjectServiceExtension { - public override ICompilerResult Build (IProgressMonitor monitor, CombineEntry entry) + protected override ICompilerResult Build (IProgressMonitor monitor, SolutionEntityItem entry, string configuration) { CProject project = entry as CProject; if (project == null) - return base.Build (monitor, entry); + return base.Build (monitor, entry, configuration); - foreach (CProject p in project.DependedOnProjects ()) { - p.Build (monitor, true); - } + CProjectConfiguration conf = (CProjectConfiguration) project.GetConfiguration (configuration); + if (conf.CompileTarget != CompileTarget.Bin) + project.WriteMDPkgPackage (configuration); - if (((CProjectConfiguration)project.ActiveConfiguration).CompileTarget != CompileTarget.Bin) - project.WriteMDPkgPackage (); - - return base.Build (monitor, entry); + return base.Build (monitor, entry, configuration); } - public override void Clean (IProgressMonitor monitor, CombineEntry entry) + protected override void Clean (IProgressMonitor monitor, SolutionEntityItem entry, string configuration) { - base.Clean (monitor, entry); + base.Clean (monitor, entry, configuration); CProject project = entry as CProject; if (project == null) return; - project.Compiler.Clean (project.ProjectFiles, (CProjectConfiguration) project.ActiveConfiguration, monitor); + CProjectConfiguration conf = (CProjectConfiguration) project.GetConfiguration (configuration); + project.Compiler.Clean (project.Files, conf, monitor); } } } diff --git a/main/src/addins/CBinding/ProjectPad/ProjectPackageNodeBuilder.cs b/main/src/addins/CBinding/ProjectPad/ProjectPackageNodeBuilder.cs index 694d3d1920..5ab7969a88 100644 --- a/main/src/addins/CBinding/ProjectPad/ProjectPackageNodeBuilder.cs +++ b/main/src/addins/CBinding/ProjectPad/ProjectPackageNodeBuilder.cs @@ -86,7 +86,7 @@ namespace CBinding.ProjectPad project.Packages.Remove (package); - IdeApp.ProjectOperations.SaveProject (project); + IdeApp.ProjectOperations.Save (project); } public override DragOperation CanDragNode () diff --git a/main/src/addins/CBinding/ProjectPad/ProjectPackagesFolderNodeBuilder.cs b/main/src/addins/CBinding/ProjectPad/ProjectPackagesFolderNodeBuilder.cs index daa47d8e70..0886d03384 100644 --- a/main/src/addins/CBinding/ProjectPad/ProjectPackagesFolderNodeBuilder.cs +++ b/main/src/addins/CBinding/ProjectPad/ProjectPackagesFolderNodeBuilder.cs @@ -138,7 +138,7 @@ namespace CBinding.ProjectPad EditPackagesDialog dialog = new EditPackagesDialog (project); dialog.Run (); - IdeApp.ProjectOperations.SaveProject (project); + IdeApp.ProjectOperations.Save (project); CurrentNode.Expanded = true; } @@ -154,7 +154,7 @@ namespace CBinding.ProjectPad if (((ProjectPackageCollection)CurrentNode.DataItem).Project.Equals (project)) return false; - CProjectConfiguration config = (CProjectConfiguration)project.ActiveConfiguration; + CProjectConfiguration config = (CProjectConfiguration)project.GetConfiguration (IdeApp.Workspace.ActiveConfiguration); if (config.CompileTarget != CBinding.CompileTarget.Bin) return true; @@ -179,23 +179,23 @@ namespace CBinding.ProjectPad CProject source = nav.GetParentDataItem (typeof(CProject), true) as CProject; dest.Packages.Add (package); - IdeApp.ProjectOperations.SaveProject (dest); + IdeApp.ProjectOperations.Save (dest); if (operation == DragOperation.Move) { source.Packages.Remove (package); - IdeApp.ProjectOperations.SaveProject (source); + IdeApp.ProjectOperations.Save (source); } } else if (dataObject is CProject) { CProject draggedProject = (CProject)dataObject; CProject destProject = (CurrentNode.DataItem as ProjectPackageCollection).Project; - draggedProject.WriteMDPkgPackage (); + draggedProject.WriteMDPkgPackage (IdeApp.Workspace.ActiveConfiguration); Package package = new Package (draggedProject); if (!destProject.Packages.Contains (package)) { destProject.Packages.Add (package); - IdeApp.ProjectOperations.SaveProject (destProject); + IdeApp.ProjectOperations.Save (destProject); } } } diff --git a/main/src/addins/CBinding/gtk-gui/gui.stetic b/main/src/addins/CBinding/gtk-gui/gui.stetic index dcdb0bdd51..6376ff741f 100644 --- a/main/src/addins/CBinding/gtk-gui/gui.stetic +++ b/main/src/addins/CBinding/gtk-gui/gui.stetic @@ -151,7 +151,6 @@ Shared Object</property> <property name="MemberName" /> <property name="CanFocus">True</property> <property name="Label" translatable="yes">no warnings</property> - <property name="Active">True</property> <property name="DrawIndicator">True</property> <property name="HasLabel">True</property> <property name="UseUnderline">True</property> diff --git a/main/src/addins/CSharpBinding/CSharpBinding.addin.xml b/main/src/addins/CSharpBinding/CSharpBinding.addin.xml index bd3d358211..c3387190bb 100644 --- a/main/src/addins/CSharpBinding/CSharpBinding.addin.xml +++ b/main/src/addins/CSharpBinding/CSharpBinding.addin.xml @@ -16,6 +16,16 @@ <Addin id="Ide" version="0.19.0"/> </Dependencies> + <Extension path = "/MonoDevelop/ProjectModel/MSBuildItemTypes"> + <DotNetProject + language="C#" + extension="csproj" + guid="{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" + import="$(MSBuildBinPath)\Microsoft.CSharp.targets" + resourceHandler="CSharpBinding.CSharpResourceIdBuilder" + /> + </Extension> + <Extension path = "/MonoDevelop/ProjectModel/Ambiences"> <Class id = "C#" class = "CSharpBinding.CSharpAmbience"/> @@ -60,26 +70,19 @@ extensions = "*.resources,*.resx"/> </Extension> - <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/ConfigurationOptions"> + <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/Build/General"> <Condition id="activelanguage" value="C#"> - <DialogPanel id = "CSharpCodeGenerationPanel" - _label = "Compiler Options" - class = "CSharpBinding.CodeGenerationPanel"/> - <DialogPanel id = "CSharpOutputOptionsPanel" - _label = "Output" - class = "MonoDevelop.Projects.Gui.Dialogs.OptionPanels.OutputOptionsPanel"/> + <Panel id = "CSharpCompilerOptionsPanel" + _label = "C#" + class = "CSharpBinding.CompilerOptionsPanel"/> </Condition> </Extension> - - - <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/GeneralOptions/Common"> + + <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/Build/Compiler"> <Condition id="activelanguage" value="C#"> - <DialogPanel id = "RuntimeOptionsPanel" - _label = "Runtime Options" - class = "MonoDevelop.Projects.Gui.Dialogs.OptionPanels.RuntimeOptionsPanel"/> - <DialogPanel id = "CSharpCompilerOptionsPanel" - _label = "Compiler Options" - class = "CSharpBinding.CompilerOptionsPanel"/> + <Panel id = "CSharpCodeGenerationPanel" + _label = "Compiler" + class = "CSharpBinding.CodeGenerationPanel"/> </Condition> </Extension> @@ -105,6 +108,10 @@ <Class class = "CSharpBinding.CSharpTextEditorExtension" /> </Extension> + <Extension path = "/MonoDevelop/ProjectModel/MD1SerializationMaps"> + <SerializationMap resource="md1format.xml" /> + </Extension> + <Extension path = "/MonoDevelop/Ide/DomParser"> <Class class = "MonoDevelop.CSharpBinding.DomParser" /> </Extension> diff --git a/main/src/addins/CSharpBinding/CSharpBinding.mdp b/main/src/addins/CSharpBinding/CSharpBinding.mdp index 7c643bbeca..4f1714185e 100644 --- a/main/src/addins/CSharpBinding/CSharpBinding.mdp +++ b/main/src/addins/CSharpBinding/CSharpBinding.mdp @@ -61,6 +61,7 @@ <File name="gtk-gui/objects.xml" subtype="Code" buildaction="EmbedAsResource" /> <File name="Gui/CompilerOptionsPanelWidget.cs" subtype="Code" buildaction="Compile" /> <File name="templates/AssemblyInfo.xft.xml" subtype="Code" buildaction="EmbedAsResource" /> + <File name="md1format.xml" subtype="Code" buildaction="EmbedAsResource" /> <File name="Parser/mcs/cs-parser.cs" subtype="Code" buildaction="Compile" /> <File name="Parser/mcs/cs-parser.jay" subtype="Code" buildaction="Nothing" /> <File name="Parser/mcs/generic-mcs.cs" subtype="Code" buildaction="Nothing" /> @@ -106,12 +107,11 @@ <File name="Parser/mcs/mcs/support.cs" subtype="Code" buildaction="Compile" /> <File name="Parser/mcs/mcs/symbolwriter.cs" subtype="Code" buildaction="Compile" /> <File name="Parser/mcs/mcs/typemanager.cs" subtype="Code" buildaction="Compile" /> + <File name="Project/CSharpResourceIdBuilder.cs" subtype="Code" buildaction="Compile" /> </Contents> <References> <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Core" /> <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Core.Gui" /> - <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Projects" /> - <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Ide" /> <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Components" /> <ProjectReference type="Gac" localcopy="False" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <ProjectReference type="Gac" localcopy="False" refto="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> @@ -119,12 +119,14 @@ <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Projects.Gui" /> <ProjectReference type="Gac" localcopy="False" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> <ProjectReference type="Project" localcopy="False" refto="NRefactory" /> - <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.3.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> <ProjectReference type="Gac" localcopy="True" refto="glib-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="atk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.3.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> + <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Projects" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Ide" /> </References> <GtkDesignInfo gtkVersion="2.8.3" /> <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="./Makefile.am" BuildTargetName="" CleanTargetName="" SyncReferences="True" IsAutotoolsProject="True" RelativeConfigureInPath="../../../"> diff --git a/main/src/addins/CSharpBinding/CSharpBindingCompilerManager.cs b/main/src/addins/CSharpBinding/CSharpBindingCompilerManager.cs index 4938414e7e..1903b606c2 100644 --- a/main/src/addins/CSharpBinding/CSharpBindingCompilerManager.cs +++ b/main/src/addins/CSharpBinding/CSharpBindingCompilerManager.cs @@ -62,7 +62,7 @@ namespace CSharpBinding if (references != null) { foreach (ProjectReference lib in references) { - foreach (string fileName in lib.GetReferencedFileNames ()) { + foreach (string fileName in lib.GetReferencedFileNames (configuration.Id)) { switch (lib.ReferenceType) { case ReferenceType.Gac: SystemPackage pkg = Runtime.SystemAssemblyService.GetPackageFromFullName (lib.Reference); @@ -148,6 +148,14 @@ namespace CSharpBinding writer.WriteLine("-unsafe"); } + if (compilerparameters.NoStdLib) { + writer.WriteLine("-nostdlib"); + } + + if (compilerparameters.TreatWarningsAsErrors) { + writer.WriteLine("-warnaserror"); + } + if (compilerparameters.DefineSymbols.Length > 0) { writer.WriteLine("/define:" + '"' + compilerparameters.DefineSymbols + '"'); } diff --git a/main/src/addins/CSharpBinding/ChangeLog b/main/src/addins/CSharpBinding/ChangeLog index 0afde9787e..9e92334a3f 100644 --- a/main/src/addins/CSharpBinding/ChangeLog +++ b/main/src/addins/CSharpBinding/ChangeLog @@ -1,3 +1,13 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * Gui/OverrideCompletionData.cs, Gui/CodeGenerationPanel.cs, + Gui/CompilerOptionsPanelWidget.cs, CSharpBinding.addin.xml, + md1format.xml, CSharpBinding.mdp, Parser/Parser.cs, + CSharpBindingCompilerManager.cs, + Project/CSharpResourceIdBuilder.cs, + Project/CSharpCompilerParameters.cs, gtk-gui/gui.stetic, + Makefile.am: New project model changes. + 2008-05-08 Michael Hutchinson <mhutchinson@novell.com> * CSharpBinding.addin.xml: Set "isText" attribute on the mimetype diff --git a/main/src/addins/CSharpBinding/Gui/CodeGenerationPanel.cs b/main/src/addins/CSharpBinding/Gui/CodeGenerationPanel.cs index 7e88a7619e..c864f3d8b7 100644 --- a/main/src/addins/CSharpBinding/Gui/CodeGenerationPanel.cs +++ b/main/src/addins/CSharpBinding/Gui/CodeGenerationPanel.cs @@ -24,7 +24,7 @@ using System.IO; using System.Drawing;
using MonoDevelop.Projects;
-using MonoDevelop.Core.Gui.Dialogs;
+using MonoDevelop.Projects.Gui.Dialogs;
using MonoDevelop.Core;
using Mono.Addins;
using MonoDevelop.Projects.Parser;
@@ -41,13 +41,14 @@ namespace CSharpBinding DotNetProjectConfiguration configuration;
CSharpCompilerParameters compilerParameters = null; - public - CodeGenerationPanelWidget (Properties CustomizationObject)
+ public CodeGenerationPanelWidget ()
{ Build (); -
- configuration = ((Properties)CustomizationObject).Get<DotNetProjectConfiguration> ("Config");
- //project = ((Properties)CustomizationObject).Get<Project> ("Project");
+ } + + public void Load (DotNetProjectConfiguration configuration)
+ { + this.configuration = configuration; compilerParameters = (CSharpCompilerParameters) configuration.CompilationParameters; symbolsEntry.Text = compilerParameters.DefineSymbols;
@@ -61,11 +62,10 @@ namespace CSharpBinding ignoreWarningsEntry.Text = compilerParameters.NoWarnings;
}
- public bool Store ()
+ public void Store ()
{ - if (compilerParameters == null) {
- return true;
- } + if (compilerParameters == null)
+ return;
compilerParameters.DefineSymbols = symbolsEntry.Text; configuration.DebugMode = generateDebugInformationCheckButton.Active; @@ -76,26 +76,27 @@ namespace CSharpBinding compilerParameters.WarningLevel = warningLevelSpinButton.ValueAsInt; compilerParameters.AdditionalArguments = additionalArgsEntry.Text; compilerParameters.NoWarnings = ignoreWarningsEntry.Text; -
- return true;
}
} - public class CodeGenerationPanel : AbstractOptionPanel
+ public class CodeGenerationPanel : MultiConfigItemOptionsPanel
{
CodeGenerationPanelWidget widget;
- public override void LoadPanelContents()
+ public override Widget CreatePanelWidget()
{
- Add (widget = new CodeGenerationPanelWidget ((Properties) CustomizationObject));
+ return (widget = new CodeGenerationPanelWidget ());
}
+ + public override void LoadConfigData () + { + widget.Load ((DotNetProjectConfiguration) CurrentConfiguration); + } - public override bool StorePanelContents()
+ public override void ApplyChanges ()
{
- bool result = true;
- result = widget.Store ();
- return result;
+ widget.Store ();
}
}
}
diff --git a/main/src/addins/CSharpBinding/Gui/CompilerOptionsPanelWidget.cs b/main/src/addins/CSharpBinding/Gui/CompilerOptionsPanelWidget.cs index bb0a6cc1af..4d0ed1c4f2 100644 --- a/main/src/addins/CSharpBinding/Gui/CompilerOptionsPanelWidget.cs +++ b/main/src/addins/CSharpBinding/Gui/CompilerOptionsPanelWidget.cs @@ -33,7 +33,7 @@ using MonoDevelop.Core.Gui; using MonoDevelop.Projects; using MonoDevelop.Projects.Parser; using MonoDevelop.Projects.Text;
-using MonoDevelop.Core.Gui.Dialogs; +using MonoDevelop.Projects.Gui.Dialogs; namespace CSharpBinding { @@ -44,11 +44,11 @@ namespace CSharpBinding ListStore classListStore;
bool classListFilled; - public CompilerOptionsPanelWidget (Properties CustomizationObject) + public CompilerOptionsPanelWidget (DotNetProject project) { this.Build(); - project = CustomizationObject.Get<DotNetProject> ("Project"); - DotNetProjectConfiguration configuration = (DotNetProjectConfiguration) project.ActiveConfiguration; + this.project = project; + DotNetProjectConfiguration configuration = (DotNetProjectConfiguration) project.GetActiveConfiguration (IdeApp.Workspace.ActiveConfiguration); CSharpCompilerParameters compilerParameters = (CSharpCompilerParameters) configuration.CompilationParameters; ListStore store = new ListStore (typeof (string));
@@ -96,7 +96,29 @@ namespace CSharpBinding langVerCombo.Active = (int) compilerParameters.LangVersion; } - public bool Store () + public bool ValidateChanges () + { + if (codepageEntry.Entry.Text.Length > 0) { + // Get the codepage. If the user specified an encoding name, find it. + int trialCodePage = -1; + foreach (TextEncoding e in TextEncoding.SupportedEncodings) { + if (e.Id == codepageEntry.Entry.Text) { + trialCodePage = e.CodePage; + break; + } + } + + if (trialCodePage == -1) { + if (!int.TryParse (codepageEntry.Entry.Text, out trialCodePage)) { + MessageService.ShowError (GettextCatalog.GetString ("Invalid code page number.")); + return false; + } + } + } + return true; + } + + public void Store () { int codePage; CompileTarget compileTarget = (CompileTarget) compileTargetCombo.Active; @@ -117,20 +139,18 @@ namespace CSharpBinding codePage = trialCodePage; else { if (!int.TryParse (codepageEntry.Entry.Text, out trialCodePage)) { - MessageService.ShowError (GettextCatalog.GetString ("Invalid code page number.")); - return false; + return; } codePage = trialCodePage; } } else codePage = 0; - + project.CompileTarget = compileTarget; foreach (DotNetProjectConfiguration configuration in project.Configurations) { CSharpCompilerParameters compilerParameters = (CSharpCompilerParameters) configuration.CompilationParameters; compilerParameters.CodePage = codePage; - configuration.CompileTarget = compileTarget; if (iconEntry.Sensitive) compilerParameters.Win32Icon = iconEntry.Path; @@ -141,8 +161,6 @@ namespace CSharpBinding compilerParameters.UnsafeCode = allowUnsafeCodeCheckButton.Active; compilerParameters.LangVersion = langVersion; } - - return true; } void OnTargetChanged (object s, EventArgs a)
@@ -166,7 +184,7 @@ namespace CSharpBinding void FillClasses ()
{
try { - IParserContext ctx = IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (project);
+ IParserContext ctx = IdeApp.Workspace.ParserDatabase.GetProjectParserContext (project);
foreach (IClass c in ctx.GetProjectContents ()) {
if (c.Methods != null) {
foreach (IMethod m in c.Methods) {
@@ -182,20 +200,23 @@ namespace CSharpBinding } } - public class CompilerOptionsPanel : AbstractOptionPanel + public class CompilerOptionsPanel : ItemOptionsPanel { CompilerOptionsPanelWidget widget;
- public override void LoadPanelContents ()
+ public override Widget CreatePanelWidget ()
{
- Add (widget = new CompilerOptionsPanelWidget ((Properties) CustomizationObject));
+ return (widget = new CompilerOptionsPanelWidget ((DotNetProject) ConfiguredProject));
}
- public override bool StorePanelContents ()
+ public override bool ValidateChanges () + { + return widget.ValidateChanges (); + } + + public override void ApplyChanges ()
{
- bool result = true;
- result = widget.Store ();
- return result;
+ widget.Store ();
} } } diff --git a/main/src/addins/CSharpBinding/Gui/OverrideCompletionData.cs b/main/src/addins/CSharpBinding/Gui/OverrideCompletionData.cs index e5fcf8039c..ab21ae814e 100644 --- a/main/src/addins/CSharpBinding/Gui/OverrideCompletionData.cs +++ b/main/src/addins/CSharpBinding/Gui/OverrideCompletionData.cs @@ -97,7 +97,6 @@ namespace CSharpBinding ConversionFlags.ShowParameters; StringBuilder textBuilder = new StringBuilder (); - Console.WriteLine ("ppres: " + resolver); textBuilder.Append (modifiers); textBuilder.Append (ambience.Convert (method, flags, resolver)); diff --git a/main/src/addins/CSharpBinding/Makefile.am b/main/src/addins/CSharpBinding/Makefile.am index 02aa359885..770ce13495 100644 --- a/main/src/addins/CSharpBinding/Makefile.am +++ b/main/src/addins/CSharpBinding/Makefile.am @@ -96,7 +96,8 @@ FILES = \ Parser/SharpDevelopTree/Method.cs \ Parser/SharpDevelopTree/ReturnType.cs \ Parser/TypeVisitor.cs \ - Project/CSharpCompilerParameters.cs + Project/CSharpCompilerParameters.cs \ + Project/CSharpResourceIdBuilder.cs RES = \ CSharpBinding.addin.xml \ @@ -104,6 +105,7 @@ RES = \ gtk-gui/objects.xml \ icons/C\#.FileIcon \ icons/csharp-icon-32.png \ + md1format.xml \ templates/AssemblyInfo.xft.xml \ templates/ConsoleProject.xpt.xml \ templates/EmptyCSharpFile.xft.xml \ diff --git a/main/src/addins/CSharpBinding/Parser/Parser.cs b/main/src/addins/CSharpBinding/Parser/Parser.cs index 2217ee4816..bf0a46c789 100644 --- a/main/src/addins/CSharpBinding/Parser/Parser.cs +++ b/main/src/addins/CSharpBinding/Parser/Parser.cs @@ -142,9 +142,9 @@ namespace CSharpBinding.Parser ICompilationUnit Parse (ICSharpCode.NRefactory.IParser p, string fileName) { // HACK: Better way would to pass the project to the Parse method, but works for now. (Refactoring should be done) - DotNetProject project = MonoDevelop.Ide.Gui.IdeApp.ProjectOperations.GetProjectContaining (fileName) as DotNetProject; + DotNetProject project = MonoDevelop.Ide.Gui.IdeApp.Workspace.GetProjectContainingFile (fileName) as DotNetProject; if (project != null) { - DotNetProjectConfiguration config = project.ActiveConfiguration as DotNetProjectConfiguration; + DotNetProjectConfiguration config = project.GetActiveConfiguration (MonoDevelop.Ide.Gui.IdeApp.Workspace.ActiveConfiguration) as DotNetProjectConfiguration; if (config != null) { CSharpCompilerParameters para = config.CompilationParameters as CSharpCompilerParameters; if (para != null && !String.IsNullOrEmpty (para.DefineSymbols)) { diff --git a/main/src/addins/CSharpBinding/Project/CSharpCompilerParameters.cs b/main/src/addins/CSharpBinding/Project/CSharpCompilerParameters.cs index 9deeee8733..4af7b197f9 100644 --- a/main/src/addins/CSharpBinding/Project/CSharpCompilerParameters.cs +++ b/main/src/addins/CSharpBinding/Project/CSharpCompilerParameters.cs @@ -28,11 +28,6 @@ using MonoDevelop.Projects.Serialization; namespace CSharpBinding { - public enum CsharpCompiler { - Csc, - Mcs - }; - public enum LangVersion { Default = 0, ISO_1 = 1, @@ -46,64 +41,56 @@ namespace CSharpBinding { // Configuration parameters - [ItemProperty ("compiler")] - CsharpCompiler csharpCompiler = CsharpCompiler.Mcs; - - [ItemProperty ("warninglevel")] + [ItemProperty ("WarningLevel")] int warninglevel = 4; - [ItemProperty ("nowarn", DefaultValue = "")] + [ItemProperty ("NoWarn", DefaultValue = "")] string noWarnings = String.Empty; - [ItemProperty ("optimize")] - bool optimize = true; + [ItemProperty ("Optimize")] + bool optimize; - [ItemProperty ("unsafecodeallowed")] + [ItemProperty ("AllowUnsafeBlocks", DefaultValue = false)] bool unsafecode = false; - [ItemProperty ("generateoverflowchecks")] - bool generateOverflowChecks = true; + [ItemProperty ("CheckForOverflowUnderflow", DefaultValue = false)] + bool generateOverflowChecks; - [ItemProperty ("mainclass")] + [ItemProperty ("StartupObject", DefaultValue = null)] string mainclass = null; - [ItemProperty ("definesymbols", DefaultValue = "")] + [ItemProperty ("DefineConstants", DefaultValue = "")] string definesymbols = String.Empty; - [ItemProperty ("generatexmldocumentation")] + [ItemProperty ("GenerateDocumentation", DefaultValue = false)] bool generateXmlDocumentation = false; - [ProjectPathItemProperty ("win32Icon", DefaultValue = "")] + [ProjectPathItemProperty ("ApplicationIcon", DefaultValue = "")] string win32Icon = String.Empty; - [ProjectPathItemProperty ("win32Resource", DefaultValue = "")] + [ProjectPathItemProperty ("Win32Resource", DefaultValue = "")] string win32Resource = String.Empty; - [ItemProperty ("codepage", DefaultValue = 0)] + [ItemProperty ("CodePage", DefaultValue = 0)] int codePage; [ItemProperty ("additionalargs", DefaultValue = "")] string additionalArgs = string.Empty; - [ItemProperty ("langversion", DefaultValue = LangVersion.Default)] + [ItemProperty ("LangVersion", DefaultValue = LangVersion.Default)] LangVersion langVersion = LangVersion.Default; + [ItemProperty ("NoStdLib", DefaultValue = false)] + bool noStdLib; + + [ItemProperty ("TreatWarningsAsErrors", DefaultValue = false)] + bool treatWarningsAsErrors; public object Clone () { return MemberwiseClone (); } - [Browsable(false)] - public CsharpCompiler CsharpCompiler { - get { - return csharpCompiler; - } - set { - csharpCompiler = value; - } - } - public int CodePage { get { return codePage; @@ -144,7 +131,6 @@ namespace CSharpBinding } #region Code Generation - [DefaultValue("")] public string MainClass { get { return mainclass; @@ -154,7 +140,6 @@ namespace CSharpBinding } } - [DefaultValue("")] public string DefineSymbols { get { return definesymbols; @@ -164,7 +149,6 @@ namespace CSharpBinding } } - [DefaultValue(true)] public bool Optimize { get { return optimize; @@ -174,7 +158,6 @@ namespace CSharpBinding } } - [DefaultValue(false)] public bool UnsafeCode { get { return unsafecode; @@ -184,7 +167,6 @@ namespace CSharpBinding } } - [DefaultValue(true)] public bool GenerateOverflowChecks { get { return generateOverflowChecks; @@ -194,7 +176,6 @@ namespace CSharpBinding } } - [DefaultValue(false)] public bool GenerateXmlDocumentation { get { return generateXmlDocumentation; @@ -207,7 +188,6 @@ namespace CSharpBinding #endregion #region Errors and Warnings - [DefaultValue(4)] public int WarningLevel { get { return warninglevel; @@ -217,7 +197,6 @@ namespace CSharpBinding } } - [DefaultValue("")] public string NoWarnings { get { return noWarnings; @@ -226,6 +205,24 @@ namespace CSharpBinding noWarnings = value; } } + + public bool NoStdLib { + get { + return noStdLib; + } + set { + noStdLib = value; + } + } + + public bool TreatWarningsAsErrors { + get { + return treatWarningsAsErrors; + } + set { + treatWarningsAsErrors = value; + } + } #endregion } } diff --git a/main/src/addins/prj2make-sharp-lib/CSharpResourceIdBuilder.cs b/main/src/addins/CSharpBinding/Project/CSharpResourceIdBuilder.cs index 6135a295e1..9465dd1c99 100644 --- a/main/src/addins/prj2make-sharp-lib/CSharpResourceIdBuilder.cs +++ b/main/src/addins/CSharpBinding/Project/CSharpResourceIdBuilder.cs @@ -33,15 +33,17 @@ using System.Collections.Generic; using System.Globalization; using System.IO; using System.Text; +using MonoDevelop.Projects.Extensions; +using MonoDevelop.Projects.Formats.MSBuild; -namespace MonoDevelop.Prj2Make +namespace CSharpBinding { - class CSharpResourceIdBuilder : IResourceIdBuilder + class CSharpResourceIdBuilder : IResourceHandler { - public string GetResourceId (ProjectFile pf) + public string GetDefaultResourceId (ProjectFile pf) { - if (String.IsNullOrEmpty (pf.DependsOn)) - return GetResourceIdForNoClass (pf); + if (String.IsNullOrEmpty (pf.DependsOn) || !File.Exists (pf.DependsOn)) + return MSBuildProjectService.GetDefaultResourceId (pf); string ns = null; string classname = null; @@ -78,10 +80,10 @@ namespace MonoDevelop.Prj2Make } if (classname == null) - return GetResourceIdForNoClass (pf); + return MSBuildProjectService.GetDefaultResourceId (pf); string culture, extn, only_filename; - if (Utils.TrySplitResourceName (pf.RelativePath, out only_filename, out culture, out extn)) + if (MSBuildProjectService.TrySplitResourceName (pf.RelativePath, out only_filename, out culture, out extn)) extn = "." + culture + ".resources"; else extn = ".resources"; @@ -93,33 +95,6 @@ namespace MonoDevelop.Prj2Make } } - static string GetResourceIdForNoClass (ProjectFile pf) - { - string fname = pf.RelativePath; - if (pf.IsExternalToProject) - fname = Path.GetFileName (fname); - else - fname = FileService.NormalizeRelativePath (fname); - - if (String.Compare (Path.GetExtension (fname), ".resx", true) == 0) { - fname = Path.ChangeExtension (fname, ".resources"); - } else { - string only_filename, culture, extn; - if (Utils.TrySplitResourceName (fname, out only_filename, out culture, out extn)) { - //remove the culture from fname - //foo.it.bmp -> foo.bmp - fname = only_filename + "." + extn; - } - } - - string rname = fname.Replace ('/', '.'); - - if (String.IsNullOrEmpty (pf.Project.DefaultNamespace)) - return rname; - else - return pf.Project.DefaultNamespace + "." + rname; - } - /* Special parser for C# files * Assumes that the file is compilable * skips comments, diff --git a/main/src/addins/CSharpBinding/gtk-gui/gui.stetic b/main/src/addins/CSharpBinding/gtk-gui/gui.stetic index 88aa72f172..cab9586c2f 100644 --- a/main/src/addins/CSharpBinding/gtk-gui/gui.stetic +++ b/main/src/addins/CSharpBinding/gtk-gui/gui.stetic @@ -508,7 +508,6 @@ <property name="MemberName" /> <property name="CanFocus">True</property> <property name="Label" translatable="yes">Place goto labels in leftmost column</property> - <property name="Active">True</property> <property name="DrawIndicator">True</property> <property name="HasLabel">True</property> <property name="UseUnderline">True</property> diff --git a/main/src/addins/CSharpBinding/md1format.xml b/main/src/addins/CSharpBinding/md1format.xml new file mode 100644 index 0000000000..ca3a39a106 --- /dev/null +++ b/main/src/addins/CSharpBinding/md1format.xml @@ -0,0 +1,18 @@ +<SerializationMap> + <DataItem class = "CSharpBinding.CSharpCompilerParameters"> + <LiteralProperty name="compiler" value="Mcs" /> + <ItemProperty member="warninglevel" name = "warninglevel"/> + <ItemProperty member="noWarnings" name="nowarn" defaultValue=""/> + <ItemProperty member="optimize" name="optimize"/> + <ItemProperty member="unsafecode" name="unsafecodeallowed"/> + <ItemProperty member="generateOverflowChecks" name="generateoverflowchecks"/> + <ItemProperty member="mainclass" name="mainclass"/> + <ItemProperty member="definesymbols" name="definesymbols" defaultValue="" /> + <ItemProperty member="generateXmlDocumentation" name="generatexmldocumentation"/> + <ItemProperty member="win32Icon" name="win32Icon" defaultValue="" /> + <ItemProperty member="win32Resource" name="win32Resource" defaultValue="" /> + <ItemProperty member="codePage" name="codepage" defaultValue="0"/> + <ItemProperty member="additionalArgs" name="additionalargs" defaultValue="" /> + <ItemProperty member="langVersion" name="langversion" defaultValue="Default"/> + </DataItem> +</SerializationMap>
\ No newline at end of file diff --git a/main/src/addins/ChangeLogAddIn/ChangeLog b/main/src/addins/ChangeLogAddIn/ChangeLog index 11568598ac..e08a61ea7e 100644 --- a/main/src/addins/ChangeLogAddIn/ChangeLog +++ b/main/src/addins/ChangeLogAddIn/ChangeLog @@ -1,3 +1,9 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * ProjectOptionPanel.cs, ChangeLogData.cs, ProjectOptionPanelWidget.cs, + ChangeLogAddIn.addin.xml, ChangeLogAddIn.mdp, gtk-gui/gui.stetic, + Makefile.am, ChangeLogService.cs: New project model changes. + 2008-03-07 Lluis Sanchez Gual <lluis@novell.com> * ChangeLogAddInOptionsPanel.cs, ChangeLogAddIn.addin.xml, diff --git a/main/src/addins/ChangeLogAddIn/ChangeLogAddIn.addin.xml b/main/src/addins/ChangeLogAddIn/ChangeLogAddIn.addin.xml index 28b5a0f0ce..db59ccf402 100644 --- a/main/src/addins/ChangeLogAddIn/ChangeLogAddIn.addin.xml +++ b/main/src/addins/ChangeLogAddIn/ChangeLogAddIn.addin.xml @@ -40,15 +40,17 @@ </Extension> <Extension path = "/MonoDevelop/ProjectModel/ExtendedProperties"> - <ItemProperty class = "MonoDevelop.Projects.CombineEntry" + <ItemProperty class = "MonoDevelop.Projects.SolutionItem" + name = "MonoDevelop.ChangeLogAddIn.ChangeLogInfo" type = "MonoDevelop.ChangeLogAddIn.ChangeLogData" /> + <ItemProperty class = "MonoDevelop.Projects.Solution" name = "MonoDevelop.ChangeLogAddIn.ChangeLogInfo" type = "MonoDevelop.ChangeLogAddIn.ChangeLogData" /> </Extension> - <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/GeneralOptions/Common"> - <DialogPanel id = "ChangeLogIntegration" _label = "ChangeLog Integration" class="MonoDevelop.ChangeLogAddIn.ProjectOptionPanel"/> + <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/Common"> + <Section id = "ChangeLogIntegration" _label = "ChangeLog Integration" class="MonoDevelop.ChangeLogAddIn.ProjectOptionPanel"/> </Extension> - <Extension path = "/MonoDevelop/ProjectModel/Gui/CombineOptions/GeneralOptions/Common"> - <DialogPanel id = "ChangeLogIntegration" _label = "ChangeLog Integration" class="MonoDevelop.ChangeLogAddIn.ProjectOptionPanel"/> + <Extension path = "/MonoDevelop/ProjectModel/Gui/SolutionOptions/Common"> + <Section id = "ChangeLogIntegration" _label = "ChangeLog Integration" class="MonoDevelop.ChangeLogAddIn.ProjectOptionPanel"/> </Extension> </Addin> diff --git a/main/src/addins/ChangeLogAddIn/ChangeLogAddIn.mdp b/main/src/addins/ChangeLogAddIn/ChangeLogAddIn.mdp index 2e2c7fddba..0f3534ddd9 100644 --- a/main/src/addins/ChangeLogAddIn/ChangeLogAddIn.mdp +++ b/main/src/addins/ChangeLogAddIn/ChangeLogAddIn.mdp @@ -41,11 +41,13 @@ <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Ide" /> <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.VersionControl" /> <ProjectReference type="Gac" localcopy="False" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> + <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.3.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> <ProjectReference type="Gac" localcopy="True" refto="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="atk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.3.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Projects.Gui" /> + <ProjectReference type="Gac" localcopy="True" refto="glib-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> </References> <GtkDesignInfo /> <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="./Makefile.am" BuildTargetName="" CleanTargetName="" SyncReferences="True" IsAutotoolsProject="True" RelativeConfigureInPath="../../../"> diff --git a/main/src/addins/ChangeLogAddIn/ChangeLogData.cs b/main/src/addins/ChangeLogAddIn/ChangeLogData.cs index 04ac6edd78..ed25aa4734 100644 --- a/main/src/addins/ChangeLogAddIn/ChangeLogData.cs +++ b/main/src/addins/ChangeLogAddIn/ChangeLogData.cs @@ -47,18 +47,18 @@ namespace MonoDevelop.ChangeLogAddIn [ItemProperty] ChangeLogPolicy policy = ChangeLogPolicy.UseParentPolicy; - CombineEntry entry; + SolutionItem entry; internal ChangeLogData () { } - internal ChangeLogData (CombineEntry entry) + internal ChangeLogData (SolutionItem entry) { this.entry = entry; } - internal void Bind (CombineEntry entry) + internal void Bind (SolutionItem entry) { this.entry = entry; } @@ -74,7 +74,7 @@ namespace MonoDevelop.ChangeLogAddIn public ChangeLogPolicy Policy { get { - if (policy == ChangeLogPolicy.UseParentPolicy && entry.ParentCombine == null) + if (policy == ChangeLogPolicy.UseParentPolicy && (entry is SolutionFolder) && ((SolutionFolder)entry).IsRoot) return ChangeLogPolicy.UpdateNearestChangeLog; else return policy; diff --git a/main/src/addins/ChangeLogAddIn/ChangeLogService.cs b/main/src/addins/ChangeLogAddIn/ChangeLogService.cs index 5824e72cae..3a70b7a991 100644 --- a/main/src/addins/ChangeLogAddIn/ChangeLogService.cs +++ b/main/src/addins/ChangeLogAddIn/ChangeLogService.cs @@ -35,7 +35,7 @@ namespace MonoDevelop.ChangeLogAddIn { public static class ChangeLogService { - public static ChangeLogData GetChangeLogData (CombineEntry entry) + public static ChangeLogData GetChangeLogData (SolutionItem entry) { ChangeLogData changeLogData = entry.ExtendedProperties ["MonoDevelop.ChangeLogAddIn.ChangeLogInfo"] as ChangeLogData; if (changeLogData == null) { @@ -54,17 +54,17 @@ namespace MonoDevelop.ChangeLogAddIn // Returns an empty string if changes don't have to be logged. public static string GetChangeLogForFile (string baseCommitPath, string file) { - if (IdeApp.ProjectOperations.CurrentOpenCombine == null) + if (!IdeApp.Workspace.IsOpen) return null; // Find the project that contains the file. If none is found // find a combine entry at the file location - CombineEntry entry = null; + SolutionItem entry = null; string bestPath = null; file = FileService.GetFullPath (file); - foreach (CombineEntry e in IdeApp.ProjectOperations.CurrentOpenCombine.GetAllEntries ()) { - if (e is Project && ((Project)e).ProjectFiles.GetFile (file) != null) { + foreach (SolutionItem e in IdeApp.Workspace.GetAllSolutionItems ()) { + if (e is Project && ((Project)e).Files.GetFile (file) != null) { entry = e; break; } @@ -79,15 +79,15 @@ namespace MonoDevelop.ChangeLogAddIn return null; if (baseCommitPath == null) - baseCommitPath = entry.RootCombine.BaseDirectory; + baseCommitPath = entry.ParentSolution.BaseDirectory; baseCommitPath = FileService.GetFullPath (baseCommitPath); ChangeLogData changeLogData = GetChangeLogData (entry); - CombineEntry parent = entry; + SolutionItem parent = entry; while (changeLogData.Policy == ChangeLogPolicy.UseParentPolicy) { - parent = parent.ParentCombine; + parent = parent.ParentFolder; changeLogData = GetChangeLogData (parent); } diff --git a/main/src/addins/ChangeLogAddIn/Makefile.am b/main/src/addins/ChangeLogAddIn/Makefile.am index dbc0dae440..0281aa4e1e 100644 --- a/main/src/addins/ChangeLogAddIn/Makefile.am +++ b/main/src/addins/ChangeLogAddIn/Makefile.am @@ -2,6 +2,7 @@ ADDIN_BUILD = $(top_builddir)/build/AddIns/ChangeLogAddIn ASSEMBLY = $(ADDIN_BUILD)/ChangeLogAddIn.dll REFS = \ + $(GLIB_SHARP_LIBS) \ $(GTK_SHARP_LIBS) \ $(MONO_ADDINS_LIBS) \ -r:$(top_builddir)/build/AddIns/VersionControl/MonoDevelop.VersionControl.dll \ @@ -10,6 +11,7 @@ REFS = \ -r:$(top_builddir)/build/bin/MonoDevelop.Core.Gui.dll \ -r:$(top_builddir)/build/bin/MonoDevelop.Ide.dll \ -r:$(top_builddir)/build/bin/MonoDevelop.Projects.dll \ + -r:$(top_builddir)/build/bin/MonoDevelop.Projects.Gui.dll \ -r:Mono.Posix FILES = \ diff --git a/main/src/addins/ChangeLogAddIn/ProjectOptionPanel.cs b/main/src/addins/ChangeLogAddIn/ProjectOptionPanel.cs index a44cfbbd46..3a4b4e0f4c 100644 --- a/main/src/addins/ChangeLogAddIn/ProjectOptionPanel.cs +++ b/main/src/addins/ChangeLogAddIn/ProjectOptionPanel.cs @@ -28,25 +28,29 @@ using System; using Gtk; using MonoDevelop.Projects; -using MonoDevelop.Core.Gui.Dialogs; +using MonoDevelop.Projects.Gui.Dialogs; using MonoDevelop.Core; namespace MonoDevelop.ChangeLogAddIn { - public class ProjectOptionPanel : AbstractOptionPanel + public class ProjectOptionPanel : ItemOptionsPanel { ProjectOptionPanelWidget widget; - public override void LoadPanelContents () - { - CombineEntry entry = ((Properties)CustomizationObject).Get<CombineEntry> ("CombineEntry"); - widget = new ProjectOptionPanelWidget(entry); - Add (widget); + public override Widget CreatePanelWidget () + { + SolutionItem it; + if (DataObject is Solution) + it = ((Solution)DataObject).RootFolder; + else + it = (SolutionItem) DataObject; + widget = new ProjectOptionPanelWidget (it); + return widget; } - public override bool StorePanelContents() + public override void ApplyChanges() { - return widget.Store (); + widget.Store (); } } } diff --git a/main/src/addins/ChangeLogAddIn/ProjectOptionPanelWidget.cs b/main/src/addins/ChangeLogAddIn/ProjectOptionPanelWidget.cs index 201e36b75f..217486a1a5 100644 --- a/main/src/addins/ChangeLogAddIn/ProjectOptionPanelWidget.cs +++ b/main/src/addins/ChangeLogAddIn/ProjectOptionPanelWidget.cs @@ -34,13 +34,13 @@ namespace MonoDevelop.ChangeLogAddIn { ChangeLogData changeLogData; - public ProjectOptionPanelWidget (CombineEntry entry) + public ProjectOptionPanelWidget (SolutionItem entry) { this.Build(); changeLogData = ChangeLogService.GetChangeLogData (entry); - if (entry.ParentCombine == null) + if (entry.ParentFolder == null) parentRadioButton.Sensitive = false; switch (changeLogData.Policy) @@ -63,7 +63,7 @@ namespace MonoDevelop.ChangeLogAddIn } } - public bool Store () + public void Store () { if (noneRadioButton.Active) changeLogData.Policy = ChangeLogPolicy.NoChangeLog; @@ -79,8 +79,6 @@ namespace MonoDevelop.ChangeLogAddIn if (oneChangeLogInEachDirectoryRadioButton.Active) changeLogData.Policy = ChangeLogPolicy.OneChangeLogInEachDirectory; - - return true; } } } diff --git a/main/src/addins/ChangeLogAddIn/gtk-gui/gui.stetic b/main/src/addins/ChangeLogAddIn/gtk-gui/gui.stetic index 8b6f67dfd2..a4526887e8 100644 --- a/main/src/addins/ChangeLogAddIn/gtk-gui/gui.stetic +++ b/main/src/addins/ChangeLogAddIn/gtk-gui/gui.stetic @@ -1,12 +1,13 @@ <?xml version="1.0" encoding="utf-8"?> <stetic-interface> <configuration> - <images-root-path>../</images-root-path> + <images-root-path>..</images-root-path> <target-gtk-version>2.8.3</target-gtk-version> </configuration> <import> - <widget-library name="../../../build/bin/MonoDevelop.Components.dll" /> - <widget-library name="../../../build/bin/MonoDevelop.Ide.dll" /> + <widget-library name="../../../../build/bin/MonoDevelop.Components.dll" /> + <widget-library name="../../../../build/bin/MonoDevelop.Ide.dll" /> + <widget-library name="../../../../build/bin/MonoDevelop.Projects.Gui.dll" /> </import> <widget class="Gtk.Dialog" id="MonoDevelop.ChangeLogAddIn.AddLogEntryDialog" design-size="573 510"> <property name="MemberName" /> @@ -54,8 +55,6 @@ <widget class="Gtk.ScrolledWindow" id="scrolledwindow2"> <property name="MemberName" /> <property name="CanFocus">True</property> - <property name="VscrollbarPolicy">Automatic</property> - <property name="HscrollbarPolicy">Automatic</property> <property name="ShadowType">In</property> <child> <widget class="Gtk.TreeView" id="fileList"> @@ -97,8 +96,6 @@ <widget class="Gtk.ScrolledWindow" id="scrolledwindow1"> <property name="MemberName" /> <property name="CanFocus">True</property> - <property name="VscrollbarPolicy">Automatic</property> - <property name="HscrollbarPolicy">Automatic</property> <property name="ShadowType">In</property> <child> <widget class="Gtk.TextView" id="textview"> @@ -451,7 +448,7 @@ </widget> </child> </widget> - <widget class="Gtk.Bin" id="MonoDevelop.ChangeLogAddIn.ProjectOptionPanelWidget" design-size="524 330"> + <widget class="Gtk.Bin" id="MonoDevelop.ChangeLogAddIn.ProjectOptionPanelWidget" design-size="524 338"> <property name="MemberName" /> <child> <widget class="Gtk.VBox" id="vbox2"> @@ -475,7 +472,6 @@ <property name="MemberName" /> <property name="CanFocus">True</property> <property name="Label" translatable="yes">radiobutton2</property> - <property name="Active">True</property> <property name="DrawIndicator">True</property> <property name="HasLabel">False</property> <property name="UseUnderline">True</property> diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/ChangeLog b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/ChangeLog index fa7e979767..aad921b9d3 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/ChangeLog +++ b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/ChangeLog @@ -1,3 +1,15 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * MonoDevelop.Deployment.Linux.addin.xml, + MonoDevelop.Deployment.Linux.mdp, + MonoDevelop.Deployment.Linux/BasicOptionPanelWidget.cs, + MonoDevelop.Deployment.Linux/LinuxDeploymentSetup.cs, + MonoDevelop.Deployment.Linux/LinuxDeployData.cs, + MonoDevelop.Deployment.Linux/LinuxIntegrationProjectFeature.cs, + MonoDevelop.Deployment.Linux/LinuxDeployExtension.cs, + MonoDevelop.Deployment.Linux/BasicOptionPanel.cs: New project model + changes. + 2008-02-23 Mike Krüger <mkrueger@novell.com> * MonoDevelop.Deployment.Linux.mdp, gtk-gui/gui.stetic, Makefile.am: Removed diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux.addin.xml b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux.addin.xml index cd98630843..3d875703f7 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux.addin.xml +++ b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux.addin.xml @@ -53,12 +53,8 @@ class = "MonoDevelop.Deployment.Linux.DotDesktopDisplayBinding"/> </Extension> - <Extension path = "/MonoDevelop/ProjectModel/Gui/CombineOptions/GeneralOptions/Deployment"> - <DialogPanel id = "LinuxDeployment" _label = "Linux Deployment Settings" class="MonoDevelop.Deployment.Linux.BasicOptionPanel"/> - </Extension> - - <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/GeneralOptions/Deployment"> - <DialogPanel id = "LinuxDeployment" _label = "Linux Deployment Settings" class="MonoDevelop.Deployment.Linux.BasicOptionPanel"/> + <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/Deployment"> + <Section id = "LinuxDeployment" _label = "Linux Deployment Settings" class="MonoDevelop.Deployment.Linux.BasicOptionPanel"/> </Extension> <Extension path = "/MonoDevelop/Deployment/DeployDirectoryResolvers"> @@ -66,7 +62,7 @@ </Extension> <Extension path = "/MonoDevelop/ProjectModel/ExtendedProperties"> - <ItemProperty class = "MonoDevelop.Projects.CombineEntry" + <ItemProperty class = "MonoDevelop.Projects.SolutionItem" name = "Deployment.LinuxDeployData" type = "MonoDevelop.Deployment.Linux.LinuxDeployData" /> </Extension> diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux.mdp b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux.mdp index 13b45c6ed9..432faff078 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux.mdp +++ b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux.mdp @@ -51,13 +51,13 @@ <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> <ProjectReference type="Gac" localcopy="True" refto="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> + <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.3.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Deployment" /> <ProjectReference type="Gac" localcopy="True" refto="glib-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="atk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.3.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> - <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Deployment" /> </References> <GtkDesignInfo> <ExportedWidgets> diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/BasicOptionPanel.cs b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/BasicOptionPanel.cs index cd06fc2015..f0a4f8cad3 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/BasicOptionPanel.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/BasicOptionPanel.cs @@ -9,25 +9,22 @@ using MonoDevelop.Ide.Gui; namespace MonoDevelop.Deployment.Linux { - public class BasicOptionPanel: AbstractOptionPanel + public class BasicOptionPanel: ItemOptionsPanel { BasicOptionPanelWidget widget; - CombineEntry entry; public BasicOptionPanel() { } - public override void LoadPanelContents () + public override Gtk.Widget CreatePanelWidget () { - Properties props = (Properties) CustomizationObject; - entry = props.Get<CombineEntry> ("CombineEntry"); - Add (widget = new BasicOptionPanelWidget (entry, false)); + return (widget = new BasicOptionPanelWidget (ConfiguredSolutionItem, false)); } - public override bool StorePanelContents () + public override void ApplyChanges () { - return widget.Store (); + widget.Store (); } } } diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/BasicOptionPanelWidget.cs b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/BasicOptionPanelWidget.cs index cbe4ee98e1..8df0ab2b65 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/BasicOptionPanelWidget.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/BasicOptionPanelWidget.cs @@ -8,9 +8,9 @@ namespace MonoDevelop.Deployment.Linux { public partial class BasicOptionPanelWidget : Gtk.Bin { - CombineEntry entry; + SolutionItem entry; - public BasicOptionPanelWidget (CombineEntry entry, bool creatingProject) + public BasicOptionPanelWidget (SolutionItem entry, bool creatingProject) { this.Build(); @@ -18,9 +18,9 @@ namespace MonoDevelop.Deployment.Linux this.entry = entry; if (entry is DotNetProject) { - DotNetProjectConfiguration conf = entry.ActiveConfiguration as DotNetProjectConfiguration; - boxExe.Visible = (conf.CompileTarget == CompileTarget.Exe || conf.CompileTarget == CompileTarget.WinExe); - boxLibrary.Visible = (conf.CompileTarget == CompileTarget.Library || conf.CompiledOutputName.EndsWith (".dll")); + DotNetProject project = (DotNetProject) entry; + boxExe.Visible = (project.CompileTarget == CompileTarget.Exe || project.CompileTarget == CompileTarget.WinExe); + boxLibrary.Visible = (project.CompileTarget == CompileTarget.Library || project.GetOutputFileName (ProjectService.DefaultConfiguration).EndsWith (".dll")); } else { boxExe.Visible = boxLibrary.Visible = false; } @@ -42,11 +42,11 @@ namespace MonoDevelop.Deployment.Linux return null; } - public bool Store () + public void Store () { DotNetProject project = entry as DotNetProject; if (project == null) - return true; + return; LinuxDeployData data = LinuxDeployData.GetLinuxDeployData (project); data.GenerateScript = checkScript.Active; @@ -66,8 +66,6 @@ namespace MonoDevelop.Deployment.Linux DeployProperties props = DeployService.GetDeployProperties (pfile); props.TargetDirectory = LinuxTargetDirectory.DesktopApplications; } - - return true; } protected virtual void OnCheckScriptClicked(object sender, System.EventArgs e) diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/LinuxDeployData.cs b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/LinuxDeployData.cs index a933bdeb19..659d966257 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/LinuxDeployData.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/LinuxDeployData.cs @@ -22,10 +22,10 @@ namespace MonoDevelop.Deployment.Linux [ItemProperty (DefaultValue=true)] bool generatePcFile = true; - CombineEntry entry; + SolutionItem entry; bool connected; - internal LinuxDeployData (CombineEntry entry) + internal LinuxDeployData (SolutionItem entry) { this.entry = entry; } @@ -34,7 +34,7 @@ namespace MonoDevelop.Deployment.Linux { } - public static LinuxDeployData GetLinuxDeployData (CombineEntry entry) + public static LinuxDeployData GetLinuxDeployData (SolutionItem entry) { LinuxDeployData data = (LinuxDeployData) entry.ExtendedProperties ["Deployment.LinuxDeployData"]; if (data != null) { @@ -55,12 +55,12 @@ namespace MonoDevelop.Deployment.Linux return data; } - internal static LinuxDeployData CreateDefault (CombineEntry entry) + internal static LinuxDeployData CreateDefault (SolutionItem entry) { return new LinuxDeployData (entry); } - void Bind (CombineEntry entry) + void Bind (SolutionItem entry) { this.entry = entry; } diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/LinuxDeployExtension.cs b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/LinuxDeployExtension.cs index 4f4f7f93d7..efac9ef637 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/LinuxDeployExtension.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/LinuxDeployExtension.cs @@ -9,16 +9,16 @@ namespace MonoDevelop.Deployment.Linux { internal class LinuxDeployExtension: DeployServiceExtension { - public override DeployFileCollection GetProjectDeployFiles (DeployContext ctx, Project project) + public override DeployFileCollection GetProjectDeployFiles (DeployContext ctx, Project project, string config) { - DeployFileCollection col = base.GetProjectDeployFiles (ctx, project); + DeployFileCollection col = base.GetProjectDeployFiles (ctx, project, config); LinuxDeployData data = LinuxDeployData.GetLinuxDeployData (project); if (ctx.Platform == "Linux") { DotNetProject netProject = project as DotNetProject; if (netProject != null) { - DotNetProjectConfiguration conf = netProject.ActiveConfiguration as DotNetProjectConfiguration; + DotNetProjectConfiguration conf = netProject.GetConfiguration (config) as DotNetProjectConfiguration; if (conf != null) { if (conf.CompileTarget == CompileTarget.Exe || conf.CompileTarget == CompileTarget.WinExe) { if (data.GenerateScript) { diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/LinuxDeploymentSetup.cs b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/LinuxDeploymentSetup.cs index bbb5fc95ce..7ef38b9654 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/LinuxDeploymentSetup.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/LinuxDeploymentSetup.cs @@ -10,7 +10,7 @@ namespace MonoDevelop.Deployment.Linux { protected override void Run () { - IdeApp.ProjectOperations.FileAddedToProject += OnFileAdded; + IdeApp.Workspace.FileAddedToProject += OnFileAdded; } void OnFileAdded (object o, ProjectFileEventArgs a) diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/LinuxIntegrationProjectFeature.cs b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/LinuxIntegrationProjectFeature.cs index 7735c25b18..2312b7e036 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/LinuxIntegrationProjectFeature.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/MonoDevelop.Deployment.Linux/LinuxIntegrationProjectFeature.cs @@ -7,7 +7,7 @@ using Gtk; namespace MonoDevelop.Deployment.Linux { - public class LinuxIntegrationProjectFeature: ICombineEntryFeature + public class LinuxIntegrationProjectFeature: ISolutionItemFeature { public string Title { get { return GettextCatalog.GetString ("Unix Integration"); } @@ -17,27 +17,27 @@ namespace MonoDevelop.Deployment.Linux get { return GettextCatalog.GetString ("Set options for generating files to better integrate the application or library in a Unix system."); } } - public bool SupportsCombineEntry (Combine parentCombine, CombineEntry entry) + public bool SupportsSolutionItem (SolutionFolder parentCombine, SolutionItem entry) { return entry is DotNetProject; } - public Widget CreateFeatureEditor (Combine parentCombine, CombineEntry entry) + public Widget CreateFeatureEditor (SolutionFolder parentCombine, SolutionItem entry) { return new BasicOptionPanelWidget ((DotNetProject) entry, true); } - public void ApplyFeature (Combine parentCombine, CombineEntry entry, Widget editor) + public void ApplyFeature (SolutionFolder parentCombine, SolutionItem entry, Widget editor) { ((BasicOptionPanelWidget)editor).Store (); } - public string Validate (Combine parentCombine, CombineEntry entry, Gtk.Widget editor) + public string Validate (SolutionFolder parentCombine, SolutionItem entry, Gtk.Widget editor) { return ((BasicOptionPanelWidget)editor).Validate (); } - public bool IsEnabled (Combine parentCombine, CombineEntry entry) + public bool IsEnabled (SolutionFolder parentCombine, SolutionItem entry) { return false; } diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/ChangeLog b/main/src/addins/Deployment/MonoDevelop.Deployment/ChangeLog index e8d2ad057a..d9ce865fc8 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/ChangeLog +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/ChangeLog @@ -1,3 +1,41 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * MonoDevelop.Deployment.addin.xml, + MonoDevelop.Deployment.NodeBuilders/PackageNodeBuilder.cs, + MonoDevelop.Deployment.NodeBuilders/PackagingProjectNodeBuilder.cs, + MonoDevelop.Deployment.mdp, + MonoDevelop.Deployment/MD1Serializer.cs, + MonoDevelop.Deployment/PackagingProject.cs, + MonoDevelop.Deployment/DeployService.cs, + MonoDevelop.Deployment/DefaultDeployServiceExtension.cs, + MonoDevelop.Deployment/UnknownPackageBuilder.cs, + MonoDevelop.Deployment/InstallResolver.cs, + MonoDevelop.Deployment/IDeployable.cs, + MonoDevelop.Deployment/DeployFile.cs, + MonoDevelop.Deployment/DeployProjectServiceExtension.cs, + MonoDevelop.Deployment/PackageBuilder.cs, + MonoDevelop.Deployment/DeployServiceExtension.cs, + MonoDevelop.Deployment.Commands/Commands.cs, + gtk-gui/MonoDevelop.Deployment.Gui.BinariesZipEditorWidget.cs, + gtk-gui/MonoDevelop.Deployment.DeployFileListWidget.cs, + gtk-gui/MonoDevelop.Deployment.Gui.DeployDialog.cs, + gtk-gui/MonoDevelop.Deployment.Gui.EditPackageDialog.cs, + gtk-gui/gui.stetic, MonoDevelop.Deployment.Gui/DeployDialog.cs, + MonoDevelop.Deployment.Gui/SourcesZipEditorWidget.cs, + MonoDevelop.Deployment.Gui/EditPackageDialog.cs, + MonoDevelop.Deployment.Gui/InstallDialog.cs, + MonoDevelop.Deployment.Gui/EntrySelectionTree.cs, + MonoDevelop.Deployment.Gui/BinariesZipEditorWidget.cs, + MonoDevelop.Deployment.Gui/DeployFileListWidget.cs, + MonoDevelop.Deployment.Gui/DeployOperations.cs, + MonoDevelop.Deployment.Gui/PackagingFeature.cs, + MonoDevelop.Deployment.Gui/PackagingFeatureWidget.cs, Makefile.am, + md1format.xml, + MonoDevelop.Deployment.Targets/CommandPackageBuilder.cs, + MonoDevelop.Deployment.Targets/BinariesZipPackageBuilder.cs, + MonoDevelop.Deployment.Targets/SourcesZipPackageBuilder.cs: New + project model changes. + 2008-05-15 Lluis Sanchez Gual <lluis@novell.com> * MonoDevelop.Deployment.addin.xml: Removed obsolete attributes. diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/Makefile.am b/main/src/addins/Deployment/MonoDevelop.Deployment/Makefile.am index db726f6c41..951749778b 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/Makefile.am +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/Makefile.am @@ -86,6 +86,7 @@ FILES = \ MonoDevelop.Deployment/IFileCopyHandler.cs \ MonoDevelop.Deployment/IFileReplacePolicy.cs \ MonoDevelop.Deployment/InstallResolver.cs \ + MonoDevelop.Deployment/MD1Serializer.cs \ MonoDevelop.Deployment/Package.cs \ MonoDevelop.Deployment/PackageBuilder.cs \ MonoDevelop.Deployment/PackageCollection.cs \ @@ -100,6 +101,7 @@ RES = \ icons/package-x-generic.png \ icons/packaging-16.png \ icons/packaging-32.png \ + md1format.xml \ MonoDevelop.Deployment.addin.xml \ templates/PackagingProject.xpt.xml diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Commands/Commands.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Commands/Commands.cs index 101d2ecdf1..c15b871063 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Commands/Commands.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Commands/Commands.cs @@ -20,7 +20,7 @@ namespace MonoDevelop.Deployment { protected override void Run () { - CombineEntry entry = IdeApp.ProjectOperations.CurrentSelectedCombineEntry; + SolutionItem entry = IdeApp.ProjectOperations.CurrentSelectedSolutionItem; DeployDialog dlg = new DeployDialog (entry, false); try { if (dlg.Run () == (int) Gtk.ResponseType.Ok) { @@ -34,12 +34,12 @@ namespace MonoDevelop.Deployment project.Name = dlg.NewProjectName; project.FileName = Path.Combine (dlg.NewProjectSolution.BaseDirectory, project.Name + ".mdse"); project.Packages.Add (p); - dlg.NewProjectSolution.Entries.Add (project); - IdeApp.ProjectOperations.SaveCombineEntry (dlg.NewProjectSolution); + dlg.NewProjectSolution.Items.Add (project); + IdeApp.ProjectOperations.Save (dlg.NewProjectSolution.ParentSolution); } else { dlg.ExistingPackagingProject.Packages.Add (p); - IdeApp.ProjectOperations.SaveCombineEntry (dlg.ExistingPackagingProject); + IdeApp.ProjectOperations.Save (dlg.ExistingPackagingProject); } } Package pkg = new Package (dlg.PackageBuilder); @@ -52,7 +52,7 @@ namespace MonoDevelop.Deployment protected override void Update (CommandInfo info) { - info.Enabled = IdeApp.ProjectOperations.CurrentSelectedCombineEntry != null; + info.Enabled = IdeApp.ProjectOperations.CurrentSelectedSolutionItem != null; } } @@ -60,12 +60,12 @@ namespace MonoDevelop.Deployment { protected override void Run () { - PackagingProject project = IdeApp.ProjectOperations.CurrentSelectedCombineEntry as PackagingProject; - DeployDialog dlg = new DeployDialog (project.ParentCombine, true); + PackagingProject project = IdeApp.ProjectOperations.CurrentSelectedSolutionItem as PackagingProject; + DeployDialog dlg = new DeployDialog (project.ParentFolder, true); try { if (dlg.Run () == (int) Gtk.ResponseType.Ok) { project.AddPackage (dlg.NewPackageName, dlg.PackageBuilder); - IdeApp.ProjectOperations.SaveCombineEntry (project); + IdeApp.ProjectOperations.Save (project); } } finally { dlg.Destroy (); @@ -74,7 +74,7 @@ namespace MonoDevelop.Deployment protected override void Update (CommandInfo info) { - info.Enabled = IdeApp.ProjectOperations.CurrentSelectedCombineEntry is PackagingProject; + info.Enabled = IdeApp.ProjectOperations.CurrentSelectedSolutionItem is PackagingProject; } } @@ -82,13 +82,13 @@ namespace MonoDevelop.Deployment { protected override void Run () { - CombineEntry entry = IdeApp.ProjectOperations.CurrentSelectedCombineEntry; - DeployOperations.Install (entry); + SolutionItem entry = IdeApp.ProjectOperations.CurrentSelectedSolutionItem; + DeployOperations.Install (entry, IdeApp.Workspace.ActiveConfiguration); } protected override void Update (CommandInfo info) { - info.Enabled = IdeApp.ProjectOperations.CurrentSelectedCombineEntry != null; + info.Enabled = IdeApp.ProjectOperations.CurrentSelectedSolutionItem != null; } } } diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/BinariesZipEditorWidget.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/BinariesZipEditorWidget.cs index d0d9824d0b..d28bfe6fbf 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/BinariesZipEditorWidget.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/BinariesZipEditorWidget.cs @@ -44,6 +44,16 @@ namespace MonoDevelop.Deployment.Gui entryZip.Text = System.IO.Path.GetFileName (builder.TargetFile.Substring (0, builder.TargetFile.Length - ext.Length)); comboZip.Active = zel; } + + // Fill configurations + zel = 0; + foreach (string conf in builder.RootSolutionItem.ParentSolution.GetConfigurations ()) { + comboConfiguration.AppendText (conf); + if (conf == builder.Configuration) + comboConfiguration.Active = zel; + zel++; + } + loading = false; } @@ -66,6 +76,8 @@ namespace MonoDevelop.Deployment.Gui return; builder.TargetFile = TargetZipFile; builder.Platform = platforms [comboPlatform.Active].Id; + if (comboConfiguration.Active != -1) + builder.Configuration = comboConfiguration.ActiveText; } protected virtual void OnFolderEntryPathChanged(object sender, System.EventArgs e) @@ -87,6 +99,11 @@ namespace MonoDevelop.Deployment.Gui { UpdateTarget (); } + + protected virtual void OnComboConfigurationChanged (object sender, System.EventArgs e) + { + UpdateTarget (); + } } class BinariesZipDeployEditor: IPackageBuilderEditor diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DeployDialog.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DeployDialog.cs index 9a606838b8..ee59859ce2 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DeployDialog.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DeployDialog.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using Gtk; using MonoDevelop.Projects; using MonoDevelop.Ide.Gui; @@ -14,11 +15,11 @@ namespace MonoDevelop.Deployment.Gui List<PackageBuilder> builders = new List<PackageBuilder> (); PackageBuilder currentBuilder; Gtk.Widget currentEditor; - CombineEntryCollection combineList; - CombineEntryCollection projectsList; - CombineEntry defaultEntry; + ReadOnlyCollection<SolutionFolder> combineList; + ReadOnlyCollection<PackagingProject> projectsList; + SolutionItem defaultEntry; - public DeployDialog (CombineEntry defaultEntry, bool createBuilderOnly) + public DeployDialog (SolutionItem defaultEntry, bool createBuilderOnly) { this.Build(); notebook.ShowTabs = false; @@ -65,8 +66,8 @@ namespace MonoDevelop.Deployment.Gui get { return radioCreateProject.Active; } } - public Combine NewProjectSolution { - get { return CreateNewProject ? combineList [comboCreateProject.Active] as Combine : null; } + public SolutionFolder NewProjectSolution { + get { return CreateNewProject ? combineList [comboCreateProject.Active] as SolutionFolder : null; } } public string NewProjectName { @@ -102,12 +103,12 @@ namespace MonoDevelop.Deployment.Gui { // Fill the combine list int n=0, sel=-1; - combineList = IdeApp.ProjectOperations.CurrentOpenCombine.GetAllEntries (typeof(Combine)); - foreach (Combine c in combineList) { + combineList = IdeApp.ProjectOperations.CurrentSelectedSolution.GetAllSolutionItems<SolutionFolder> (); + foreach (SolutionFolder c in combineList) { string name = c.Name; - Combine co = c; - while (!co.IsRoot) { - co = co.ParentCombine; + SolutionFolder co = c; + while (co.ParentFolder != null) { + co = co.ParentFolder; name = co.Name + " / " + name; } comboCreateProject.AppendText (name); @@ -119,17 +120,17 @@ namespace MonoDevelop.Deployment.Gui comboCreateProject.Active = 0; // Fill the packaging project list - projectsList = IdeApp.ProjectOperations.CurrentOpenCombine.GetAllEntries (typeof(PackagingProject)); + projectsList = IdeApp.ProjectOperations.CurrentSelectedSolution.GetAllSolutionItems<PackagingProject> (); if (projectsList.Count == 0) { radioAddProject.Sensitive = false; } else { foreach (PackagingProject p in projectsList) { string name = p.Name; - Combine c = p.ParentCombine; + SolutionFolder c = p.ParentFolder; while (c != null) { name = c.Name + " / " + name; - c = c.ParentCombine; + c = c.ParentFolder; } comboSelProject.AppendText (name); } @@ -195,7 +196,7 @@ namespace MonoDevelop.Deployment.Gui if (entryTree.GetSelectedEntry () == null) msg = GettextCatalog.GetString ("Please select a project or solution."); else { - currentBuilder.SetCombineEntry (entryTree.GetSelectedEntry (), entryTree.GetSelectedChildren ()); + currentBuilder.SetSolutionItem (entryTree.GetSelectedEntry (), entryTree.GetSelectedChildren ()); UpdateBuilderEditor (); } break; diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DeployFileListWidget.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DeployFileListWidget.cs index acbd83b21e..86440ad806 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DeployFileListWidget.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DeployFileListWidget.cs @@ -3,6 +3,7 @@ using System; using Gtk; using MonoDevelop.Projects; using MonoDevelop.Core; +using MonoDevelop.Ide.Gui; namespace MonoDevelop.Deployment { @@ -86,12 +87,43 @@ namespace MonoDevelop.Deployment this.builder = builder; this.context = builder.CreateDeployContext (); - files = builder.GetDeployFiles (context); + store.Clear (); + + string[] configs = builder.GetSupportedConfigurations (); + + string currentActive = comboConfigs.Active != -1 ? comboConfigs.ActiveText : null; + int i = Array.IndexOf (configs, currentActive); + if (i == -1) i = 0; + + ((Gtk.ListStore)comboConfigs.Model).Clear (); + foreach (string conf in configs) + comboConfigs.AppendText (conf); + if (configs.Length <= 1) { + labelFiles.Text = GettextCatalog.GetString ("The following files will be included in the package:"); + comboConfigs.Visible = false; + if (configs.Length == 0) + return; + } + else if (configs.Length > 0) { + comboConfigs.Visible = true; + labelFiles.Text = GettextCatalog.GetString ("The following files will be included in the package for the configuration:"); + } + + comboConfigs.Active = i; + } + + void FillFiles () + { store.Clear (); + if (comboConfigs.Active == -1) + return; + + files = builder.GetDeployFiles (context, comboConfigs.ActiveText); + foreach (DeployFile file in files) { string desc = GetDirectoryName (file.TargetDirectoryID); - store.AppendValues (file, file.DisplayName, desc, file.RelativeTargetPath, file.SourceCombineEntry.Name, builder.IsFileIncluded (file)); + store.AppendValues (file, file.DisplayName, desc, file.RelativeTargetPath, file.SourceSolutionItem.Name, builder.IsFileIncluded (file)); } } @@ -118,5 +150,10 @@ namespace MonoDevelop.Deployment builder.SetFileIncluded (file, inc); store.SetValue (iter, ColIncluded, inc); } + + protected virtual void OnComboConfigsChanged (object sender, System.EventArgs e) + { + FillFiles (); + } } } diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DeployOperations.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DeployOperations.cs index a31a99d445..152303ea9e 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DeployOperations.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/DeployOperations.cs @@ -9,13 +9,13 @@ namespace MonoDevelop.Deployment.Gui { public static class DeployOperations { - public static void Install (CombineEntry entry) + public static void Install (SolutionItem entry, string configuration) { using (IProgressMonitor mon = IdeApp.Workbench.ProgressMonitors.GetRunProgressMonitor ()) { InstallDialog dlg = new InstallDialog (entry); try { if (dlg.Run () == (int) Gtk.ResponseType.Ok) - DeployService.Install (mon, entry, dlg.Prefix, dlg.AppName); + DeployService.Install (mon, entry, dlg.Prefix, dlg.AppName, configuration); } finally { dlg.Destroy (); } @@ -61,7 +61,7 @@ namespace MonoDevelop.Deployment.Gui EditPackageDialog dlg = new EditPackageDialog (package); try { if (dlg.Run () == (int) Gtk.ResponseType.Ok) - IdeApp.ProjectOperations.SaveCombineEntry (package.ParentProject); + IdeApp.ProjectOperations.Save (package.ParentProject); } finally { dlg.Destroy (); } diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/EditPackageDialog.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/EditPackageDialog.cs index 43c84a8624..35d5b4351f 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/EditPackageDialog.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/EditPackageDialog.cs @@ -25,7 +25,7 @@ namespace MonoDevelop.Deployment.Gui targetBox.PackStart (new PackageBuilderEditor (target), true, true, 0); entrySelector.Fill (target, null); - entrySelector.SetSelection (target.RootCombineEntry, target.GetChildEntries ()); + entrySelector.SetSelection (target.RootSolutionItem, target.GetChildEntries ()); DeployContext ctx = target.CreateDeployContext (); if (ctx == null) @@ -53,9 +53,9 @@ namespace MonoDevelop.Deployment.Gui protected virtual void OnEntrySelectorSelectionChanged(object sender, System.EventArgs e) { - CombineEntry ce = entrySelector.GetSelectedEntry (); + SolutionItem ce = entrySelector.GetSelectedEntry (); if (ce != null) - target.SetCombineEntry (ce, entrySelector.GetSelectedChildren ()); + target.SetSolutionItem (ce, entrySelector.GetSelectedChildren ()); } protected virtual void OnNotebookSwitchPage(object o, Gtk.SwitchPageArgs args) diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/EntrySelectionTree.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/EntrySelectionTree.cs index 8f43d68963..6e4c083416 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/EntrySelectionTree.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/EntrySelectionTree.cs @@ -1,6 +1,8 @@ using System; using System.Collections; +using System.Collections.ObjectModel; +using System.Collections.Generic; using MonoDevelop.Ide.Gui; using MonoDevelop.Projects; using Gtk; @@ -10,8 +12,9 @@ namespace MonoDevelop.Deployment.Gui internal partial class EntrySelectionTree : Gtk.Bin { TreeStore store; - Hashtable selectedEntries = new Hashtable (); + Dictionary<SolutionItem,SolutionItem> selectedEntries = new Dictionary<SolutionItem,SolutionItem> (); PackageBuilder builder; + Solution solution; public event EventHandler SelectionChanged; @@ -38,13 +41,13 @@ namespace MonoDevelop.Deployment.Gui tree.AppendColumn (col); } - public void Fill (PackageBuilder builder, CombineEntry selection) + public void Fill (PackageBuilder builder, SolutionItem selection) { store.Clear (); this.builder = builder; - if (selection is Combine) { - foreach (CombineEntry e in ((Combine)selection).GetAllEntries ()) { + if (selection is SolutionFolder) { + foreach (SolutionItem e in ((SolutionFolder)selection).GetAllItems ()) { if (builder.CanBuild (e)) selectedEntries [e] = e; } @@ -53,23 +56,37 @@ namespace MonoDevelop.Deployment.Gui selectedEntries [selection] = selection; } - AddEntry (TreeIter.Zero, IdeApp.ProjectOperations.CurrentOpenCombine); + if (selection != null) + solution = selection.ParentSolution; + else { + solution = IdeApp.ProjectOperations.CurrentSelectedSolution; + if (solution == null) { + ReadOnlyCollection<Solution> items = IdeApp.ProjectOperations.CurrentSelectedWorkspaceItem.GetAllSolutions (); + if (items.Count > 0) + solution = items [0]; + else + return; + } + } + AddEntry (TreeIter.Zero, solution.RootFolder); } - void AddEntry (TreeIter iter, CombineEntry entry) + void AddEntry (TreeIter iter, SolutionItem entry) { string icon; - if (entry is Combine) + if (entry.ParentFolder == null) icon = MonoDevelop.Core.Gui.Stock.Solution; + else if (entry is SolutionFolder) + icon = MonoDevelop.Core.Gui.Stock.SolutionFolderClosed; else if (entry is Project) icon = IdeApp.Services.Icons.GetImageForProjectType (((Project)entry).ProjectType); else icon = MonoDevelop.Core.Gui.Stock.Project; bool visible = builder.CanBuild (entry); - bool selected = selectedEntries.Contains (entry); + bool selected = selectedEntries.ContainsKey (entry); - if (!(entry is Combine) && !visible) + if (!(entry is SolutionFolder) && !visible) return; if (!iter.Equals (TreeIter.Zero)) @@ -80,64 +97,64 @@ namespace MonoDevelop.Deployment.Gui if (selected) tree.ExpandToPath (store.GetPath (iter)); - if (entry is Combine) { - foreach (CombineEntry ce in ((Combine)entry).Entries) { + if (entry is SolutionFolder) { + foreach (SolutionItem ce in ((SolutionFolder)entry).Items) { AddEntry (iter, ce); } } } - public void SetSelection (CombineEntry rootEntry, CombineEntry[] childEntries) + public void SetSelection (SolutionItem rootEntry, SolutionItem[] childEntries) { selectedEntries.Clear (); selectedEntries [rootEntry] = rootEntry; - foreach (CombineEntry e in childEntries) + foreach (SolutionItem e in childEntries) selectedEntries [e] = e; UpdateSelectionChecks (TreeIter.Zero, true); } - public CombineEntry GetSelectedEntry () + public SolutionItem GetSelectedEntry () { - return GetCommonCombineEntry (); + return GetCommonSolutionItem (); } - public CombineEntry[] GetSelectedChildren () + public SolutionItem[] GetSelectedChildren () { // The first entry is the root entry - CombineEntry common = GetCommonCombineEntry (); + SolutionItem common = GetCommonSolutionItem (); if (common == null) return null; ArrayList list = new ArrayList (); - foreach (CombineEntry e in selectedEntries.Keys) + foreach (SolutionItem e in selectedEntries.Keys) if (e != common) list.Add (e); - return (CombineEntry[]) list.ToArray (typeof(CombineEntry)); + return (SolutionItem[]) list.ToArray (typeof(SolutionItem)); } void OnToggled (object sender, Gtk.ToggledArgs args) { TreeIter iter; store.GetIterFromString (out iter, args.Path); - object ob = store.GetValue (iter, 2); - if (selectedEntries.Contains (ob)) { + SolutionItem ob = (SolutionItem) store.GetValue (iter, 2); + if (selectedEntries.ContainsKey (ob)) { selectedEntries.Remove (ob); store.SetValue (iter, 3, false); - if (ob is Combine) { - foreach (CombineEntry e in ((Combine)ob).GetAllEntries ()) + if (ob is SolutionFolder) { + foreach (SolutionItem e in ((SolutionFolder)ob).GetAllItems ()) selectedEntries.Remove (e); UpdateSelectionChecks (TreeIter.Zero, false); } } else { selectedEntries [ob] = ob; store.SetValue (iter, 3, true); - if (ob is Combine) { - foreach (CombineEntry e in ((Combine)ob).GetAllEntries ()) { + if (ob is SolutionFolder) { + foreach (SolutionItem e in ((SolutionFolder)ob).GetAllItems ()) { if (builder.CanBuild (e)) selectedEntries [e] = e; } UpdateSelectionChecks (TreeIter.Zero, false); } - SelectCommonCombine ((CombineEntry)ob); + SelectCommonCombine ((SolutionItem)ob); } if (SelectionChanged != null) SelectionChanged (this, EventArgs.Empty); @@ -154,7 +171,7 @@ namespace MonoDevelop.Deployment.Gui return; } do { - bool sel = selectedEntries.Contains (store.GetValue (iter, 2)); + bool sel = selectedEntries.ContainsKey ((SolutionItem) store.GetValue (iter, 2)); store.SetValue (iter, 3, sel); if (sel) tree.ExpandToPath (store.GetPath (iter)); @@ -163,27 +180,27 @@ namespace MonoDevelop.Deployment.Gui while (store.IterNext (ref iter)); } - void SelectCommonCombine (CombineEntry e) + void SelectCommonCombine (SolutionItem e) { - CombineEntry common = GetCommonCombineEntry (); + SolutionItem common = GetCommonSolutionItem (); if (common == null) return; selectedEntries [common] = common; - CombineEntry[] entries = new CombineEntry [selectedEntries.Count]; + SolutionItem[] entries = new SolutionItem [selectedEntries.Count]; selectedEntries.Keys.CopyTo (entries, 0); - foreach (CombineEntry se in entries) { - CombineEntry ce = se; + foreach (SolutionItem se in entries) { + SolutionItem ce = se; while (ce != null && ce != common) { selectedEntries [ce] = ce; - ce = ce.ParentCombine; + ce = ce.ParentFolder; } } UpdateSelectionChecks (TreeIter.Zero, false); } - CombineEntry GetCommonCombineEntry () + SolutionItem GetCommonSolutionItem () { - return PackageBuilder.GetCommonCombineEntry (selectedEntries.Keys); + return PackageBuilder.GetCommonSolutionItem (selectedEntries.Keys); } } } diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/InstallDialog.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/InstallDialog.cs index 460484f177..921eab2bb2 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/InstallDialog.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/InstallDialog.cs @@ -6,7 +6,7 @@ namespace MonoDevelop.Deployment.Gui { internal partial class InstallDialog : Gtk.Dialog { - public InstallDialog (CombineEntry entry) + public InstallDialog (SolutionItem entry) { this.Build(); nameEntry.Text = entry.Name; diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/PackagingFeature.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/PackagingFeature.cs index 322adb496d..0ebf9a5c86 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/PackagingFeature.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/PackagingFeature.cs @@ -7,7 +7,7 @@ using Gtk; namespace MonoDevelop.Deployment.Gui { - internal class PackagingFeature: ICombineEntryFeature + internal class PackagingFeature: ISolutionItemFeature { public string Title { get { return GettextCatalog.GetString ("Packaging"); } @@ -17,27 +17,27 @@ namespace MonoDevelop.Deployment.Gui get { return GettextCatalog.GetString ("Add a Packaging Project to the solution for generating different kinds of packages for the new project."); } } - public bool SupportsCombineEntry (Combine parentCombine, CombineEntry entry) + public bool SupportsSolutionItem (SolutionFolder parentCombine, SolutionItem entry) { return ((entry is Project) || (entry is PackagingProject)) && parentCombine != null; } - public Widget CreateFeatureEditor (Combine parentCombine, CombineEntry entry) + public Widget CreateFeatureEditor (SolutionFolder parentCombine, SolutionItem entry) { return new PackagingFeatureWidget (parentCombine, entry); } - public void ApplyFeature (Combine parentCombine, CombineEntry entry, Widget editor) + public void ApplyFeature (SolutionFolder parentCombine, SolutionItem entry, Widget editor) { ((PackagingFeatureWidget)editor).ApplyFeature (); } - public string Validate (Combine parentCombine, CombineEntry entry, Gtk.Widget editor) + public string Validate (SolutionFolder parentCombine, SolutionItem entry, Gtk.Widget editor) { return null; } - public bool IsEnabled (Combine parentCombine, CombineEntry entry) + public bool IsEnabled (SolutionFolder parentCombine, SolutionItem entry) { return entry is PackagingProject; } diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/PackagingFeatureWidget.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/PackagingFeatureWidget.cs index ad3044346a..626442b7d8 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/PackagingFeatureWidget.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/PackagingFeatureWidget.cs @@ -1,6 +1,7 @@ using System; using System.Collections; +using System.Collections.ObjectModel; using MonoDevelop.Core; using MonoDevelop.Projects; @@ -8,22 +9,22 @@ namespace MonoDevelop.Deployment.Gui { internal partial class PackagingFeatureWidget : Gtk.Bin { - CombineEntry entry; - Combine parentCombine; + SolutionItem entry; + SolutionFolder parentFolder; ArrayList packages = new ArrayList (); PackagingProject newPackProject; bool creatingPackProject; - public PackagingFeatureWidget (Combine parentCombine, CombineEntry entry) + public PackagingFeatureWidget (SolutionFolder parentFolder, SolutionItem entry) { this.Build(); this.entry = entry; - this.parentCombine = parentCombine; + this.parentFolder = parentFolder; creatingPackProject = entry is PackagingProject; if (!creatingPackProject) { - CombineEntryCollection packProjects = parentCombine.RootCombine.GetAllEntries (typeof(PackagingProject)); + ReadOnlyCollection<PackagingProject> packProjects = parentFolder.ParentSolution.GetAllSolutionItems<PackagingProject> (); newPackProject = new PackagingProject (); string label = GettextCatalog.GetString ("Create packages for this project in a new Packaging Project"); @@ -40,12 +41,12 @@ namespace MonoDevelop.Deployment.Gui void AddProject (PackagingProject project) { string pname = project.Name; - Combine c = project.ParentCombine; + SolutionFolder c = project.ParentFolder; while (c != null) { pname = c.Name + " / " + pname; if (c.IsRoot) break; - c = c.ParentCombine; + c = c.ParentFolder; } // Get a list of packages that can contain the new project @@ -141,14 +142,14 @@ namespace MonoDevelop.Deployment.Gui foreach (PackageBuilder pb in builders) { if (creatingPackProject) { - pb.SetCombineEntry (parentCombine.RootCombine); + pb.SetSolutionItem (parentFolder.ParentSolution.RootFolder); // Add all compatible projects - foreach (CombineEntry e in parentCombine.RootCombine.GetAllEntries ()) { + foreach (SolutionItem e in parentFolder.ParentSolution.GetAllSolutionItems ()) { if (pb.CanBuild (e)) pb.AddEntry (e); } } else { - pb.SetCombineEntry (parentCombine, new CombineEntry [] { entry }); + pb.SetSolutionItem (parentFolder, new SolutionItem [] { entry }); } PackageBuilder[] defp = pb.CreateDefaultBuilders (); @@ -234,14 +235,14 @@ namespace MonoDevelop.Deployment.Gui if (pi.Package.ParentProject == null) pi.Project.Packages.Add (pi.Package); else { - pi.Package.PackageBuilder.AddEntry (parentCombine); + pi.Package.PackageBuilder.AddEntry (parentFolder); pi.Package.PackageBuilder.AddEntry (entry); } } if (newPackProject != null && newPackProject.Packages.Count > 0) { newPackProject.Name = "Packages"; - newPackProject.FileName = System.IO.Path.Combine (parentCombine.BaseDirectory, "Packages.mdse"); - parentCombine.Entries.Add (newPackProject); + newPackProject.FileName = System.IO.Path.Combine (parentFolder.BaseDirectory, "Packages.mdse"); + parentFolder.Items.Add (newPackProject); } } } diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/SourcesZipEditorWidget.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/SourcesZipEditorWidget.cs index 7437e88582..a14170a53e 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/SourcesZipEditorWidget.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Gui/SourcesZipEditorWidget.cs @@ -9,18 +9,20 @@ namespace MonoDevelop.Deployment.Gui { internal partial class SourcesZipEditorWidget : Gtk.Bin { - IFileFormat[] formats; + FileFormat[] formats; SourcesZipPackageBuilder target; bool loading; - public SourcesZipEditorWidget (PackageBuilder target, IFileFormat selectedFormat) + public SourcesZipEditorWidget (PackageBuilder target, FileFormat selectedFormat) { this.Build(); this.target = (SourcesZipPackageBuilder) target; loading = true; - CombineEntry entry = target.RootCombineEntry; - formats = Services.ProjectService.FileFormats.GetFileFormatsForObject (entry); + if (target.RootSolutionItem is SolutionFolder) + formats = Services.ProjectService.FileFormats.GetFileFormatsForObject (target.Solution); + else + formats = Services.ProjectService.FileFormats.GetFileFormatsForObject (target.RootSolutionItem); if (selectedFormat == null) selectedFormat = this.target.FileFormat; if (selectedFormat == null) @@ -73,7 +75,7 @@ namespace MonoDevelop.Deployment.Gui UpdateTarget (); } - public IFileFormat Format { + public FileFormat Format { get { return formats [comboFormat.Active]; } } diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.NodeBuilders/PackageNodeBuilder.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.NodeBuilders/PackageNodeBuilder.cs index 53d5f1b1c7..8e0e7fb6eb 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.NodeBuilders/PackageNodeBuilder.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.NodeBuilders/PackageNodeBuilder.cs @@ -127,7 +127,7 @@ namespace MonoDevelop.Deployment.NodeBuilders Package package = CurrentNode.DataItem as Package; if (MessageService.AskQuestion (GettextCatalog.GetString ("Are you sure you want to delete the package '{0}'?", package.Name), AlertButton.Cancel, AlertButton.Delete) == AlertButton.Delete) { package.ParentProject.Packages.Remove (package); - IdeApp.ProjectOperations.SaveCombineEntry (package.ParentProject); + IdeApp.ProjectOperations.Save (package.ParentProject); } } diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.NodeBuilders/PackagingProjectNodeBuilder.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.NodeBuilders/PackagingProjectNodeBuilder.cs index 467e64e240..620455ef3c 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.NodeBuilders/PackagingProjectNodeBuilder.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.NodeBuilders/PackagingProjectNodeBuilder.cs @@ -113,10 +113,10 @@ namespace MonoDevelop.Deployment.NodeBuilders { PackagingProject project = CurrentNode.DataItem as PackagingProject; if (MessageService.AskQuestion (GettextCatalog.GetString ("Are you sure you want to delete the project '{0}'?", project.Name), AlertButton.Cancel, AlertButton.Delete) == AlertButton.Delete) { - Combine c = project.ParentCombine; - c.RemoveEntry (project); + SolutionFolder c = project.ParentFolder; + c.Items.Remove (project); project.Dispose (); - IdeApp.ProjectOperations.SaveCombineEntry (c); + IdeApp.ProjectOperations.Save (c.ParentSolution); } } diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Targets/BinariesZipPackageBuilder.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Targets/BinariesZipPackageBuilder.cs index 86ebcb8c1b..2855f3404c 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Targets/BinariesZipPackageBuilder.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Targets/BinariesZipPackageBuilder.cs @@ -17,6 +17,9 @@ namespace MonoDevelop.Deployment.Targets [ItemProperty] string platform; + [ItemProperty] + string configuration; + public string TargetFile { get { return targetFile != null ? targetFile : string.Empty; } set { targetFile = value; } @@ -26,17 +29,29 @@ namespace MonoDevelop.Deployment.Targets get { return platform; } set { platform = value; } } + + public string Configuration { + get { return configuration; } + set { configuration = value; } + } public override string Description { get { return "Archive of Binaries"; } } - public override void InitializeSettings (CombineEntry entry) + public override void InitializeSettings (SolutionItem entry) { targetFile = Path.Combine (entry.BaseDirectory, entry.Name) + ".tar.gz"; + if (entry.ParentSolution != null) + configuration = entry.ParentSolution.DefaultConfigurationId; } - public override bool CanBuild (CombineEntry entry) + public override string[] GetSupportedConfigurations () + { + return configuration != null ? new string [] { configuration } : new string [0]; + } + + public override bool CanBuild (SolutionItem entry) { // Can build anything but PackagingProject return !(entry is PackagingProject); @@ -47,15 +62,15 @@ namespace MonoDevelop.Deployment.Targets return new DeployContext (this, platform, null); } - protected override void OnBuild (IProgressMonitor monitor, DeployContext ctx) + protected override bool OnBuild (IProgressMonitor monitor, DeployContext ctx) { string tmpFolder = null; try { - if (RootCombineEntry.NeedsBuilding) { - ICompilerResult res = RootCombineEntry.Build (monitor); + if (RootSolutionItem.NeedsBuilding (configuration)) { + ICompilerResult res = RootSolutionItem.Build (monitor, configuration); if (res.ErrorCount > 0) - return; + return false; } tmpFolder = FileService.CreateTempDirectory (); @@ -65,7 +80,7 @@ namespace MonoDevelop.Deployment.Targets string folder = FileService.GetFullPath (Path.Combine (tmpFolder, tf)); // Export the binary files - DeployFileCollection deployFiles = GetDeployFiles (ctx); + DeployFileCollection deployFiles = GetDeployFiles (ctx, configuration); foreach (DeployFile file in deployFiles) { string tfile = Path.Combine (folder, file.ResolvedTargetFile); string tdir = FileService.GetFullPath (Path.GetDirectoryName (tfile)); @@ -79,7 +94,11 @@ namespace MonoDevelop.Deployment.Targets if (!Directory.Exists (td)) Directory.CreateDirectory (td); DeployService.CreateArchive (monitor, tmpFolder, targetFile); - + } + catch (Exception ex) { + monitor.ReportError ("Package creation failed", ex); + LoggingService.LogError ("Package creation failed", ex); + return false; } finally { if (tmpFolder != null) @@ -87,6 +106,7 @@ namespace MonoDevelop.Deployment.Targets } if (monitor.AsyncOperation.Success) monitor.Log.WriteLine (GettextCatalog.GetString ("Created file: {0}", targetFile)); + return true; } protected override string OnResolveDirectory (DeployContext ctx, string folderId) @@ -100,6 +120,7 @@ namespace MonoDevelop.Deployment.Targets BinariesZipPackageBuilder builder = (BinariesZipPackageBuilder) other; targetFile = builder.targetFile; platform = builder.platform; + configuration = builder.configuration; } public override string DefaultName { diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Targets/CommandPackageBuilder.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Targets/CommandPackageBuilder.cs index 20f10b6324..0078f7c50c 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Targets/CommandPackageBuilder.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Targets/CommandPackageBuilder.cs @@ -88,7 +88,7 @@ namespace MonoDevelop.Deployment.Targets } } - protected override void OnBuild (IProgressMonitor monitor, DeployContext ctx) + protected override bool OnBuild (IProgressMonitor monitor, DeployContext ctx) { string consMsg; IConsole cons; @@ -111,6 +111,7 @@ namespace MonoDevelop.Deployment.Targets if (cons is MonitorConsole) { ((MonitorConsole)cons).Dispose (); } + return true; } } diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Targets/SourcesZipPackageBuilder.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Targets/SourcesZipPackageBuilder.cs index 827cc00ba5..52083c046d 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Targets/SourcesZipPackageBuilder.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.Targets/SourcesZipPackageBuilder.cs @@ -18,18 +18,24 @@ namespace MonoDevelop.Deployment.Targets [ItemProperty] string format; - IFileFormat fileFormat; + FileFormat fileFormat; public override string Description { get { return "Archive of Sources"; } } - public IFileFormat FileFormat { + public override bool CanBuild (SolutionItem entry) + { + return entry is SolutionFolder || entry is SolutionEntityItem; + } + + + public FileFormat FileFormat { get { if (fileFormat == null) { if (string.IsNullOrEmpty (format)) return null; - foreach (IFileFormat f in Services.ProjectService.FileFormats.GetAllFileFormats ()) { + foreach (FileFormat f in Services.ProjectService.FileFormats.GetAllFileFormats ()) { if (f.GetType ().FullName == format) { fileFormat = f; break; @@ -52,10 +58,14 @@ namespace MonoDevelop.Deployment.Targets set { targetFile = value; } } - protected override void OnBuild (IProgressMonitor monitor, DeployContext ctx) + protected override bool OnBuild (IProgressMonitor monitor, DeployContext ctx) { - CombineEntry entry = RootCombineEntry; - string sourceFile = entry.FileName; + string sourceFile; + SolutionItem entry = RootSolutionItem; + if (entry is SolutionFolder) + sourceFile = entry.ParentSolution.FileName; + else + sourceFile = ((SolutionEntityItem)entry).FileName; AggregatedProgressMonitor mon = new AggregatedProgressMonitor (); mon.AddSlaveMonitor (monitor, MonitorAction.WriteLog|MonitorAction.ReportError|MonitorAction.ReportWarning|MonitorAction.ReportSuccess); @@ -71,12 +81,14 @@ namespace MonoDevelop.Deployment.Targets // Export the project - CombineEntry[] ents = GetChildEntries (); + SolutionItem[] ents = GetChildEntries (); string[] epaths = new string [ents.Length]; for (int n=0; n<ents.Length; n++) - epaths [n] = ents [n].FileName; + epaths [n] = ents [n].ItemId; Services.ProjectService.Export (mon, sourceFile, epaths, folder, FileFormat); + if (!mon.AsyncOperation.Success) + return false; // Create the archive string td = Path.GetDirectoryName (targetFile); @@ -89,12 +101,14 @@ namespace MonoDevelop.Deployment.Targets } if (monitor.AsyncOperation.Success) monitor.Log.WriteLine (GettextCatalog.GetString ("Created file: {0}", targetFile)); + return true; } - public override void InitializeSettings (CombineEntry entry) + public override void InitializeSettings (SolutionItem entry) { targetFile = Path.Combine (entry.BaseDirectory, entry.Name) + ".tar.gz"; - fileFormat = entry.FileFormat; + if (entry.ParentSolution != null) + fileFormat = entry.ParentSolution.FileFormat; } @@ -134,13 +148,13 @@ namespace MonoDevelop.Deployment.Targets { List<PackageBuilder> list = new List<PackageBuilder> (); - foreach (IFileFormat format in Services.ProjectService.FileFormats.GetFileFormatsForObject (RootCombineEntry)) { + foreach (FileFormat format in Services.ProjectService.FileFormats.GetFileFormatsForObject (RootSolutionItem)) { SourcesZipPackageBuilder pb = (SourcesZipPackageBuilder) Clone (); pb.FileFormat = format; // The suffix for the archive will be the extension of the file format. // If there is no extension, use the whole file name. - string fname = format.GetValidFormatName (RootCombineEntry, RootCombineEntry.FileName); + string fname = format.GetValidFileName (RootSolutionItem, RootSolutionItem.ParentSolution.FileName); string suffix = Path.GetExtension (fname); if (suffix.Length > 0) suffix = suffix.Substring (1).ToLower (); // Remove the initial dot diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.addin.xml b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.addin.xml index 895e142835..7887a9447b 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.addin.xml +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.addin.xml @@ -81,7 +81,7 @@ <!-- Extensions --> - <Extension path = "/MonoDevelop/Ide/ContextMenu/ProjectPad/Combine/Tools"> + <Extension path = "/MonoDevelop/Ide/ContextMenu/ProjectPad/Solution/Tools"> <CommandItem id = "MonoDevelop.Deployment.Commands.CreatePackage" insertafter="MonoDevelop.Ide.Commands.ProjectCommands.ExportProject"/> <CommandItem id = "MonoDevelop.Deployment.Commands.Install" insertafter="ExportSeparator"/> </Extension> @@ -172,12 +172,12 @@ <StockIcon stockid = "md-packaging-project" icon = "md-project|res:packaging-16.png" size = "Menu" /> </Extension> - <Extension path = "/MonoDevelop/ProjectModel/Gui/CombineOptions/GeneralOptions"> - <DialogPanel id = "Deployment" _label = "Deployment" /> + <Extension path = "/MonoDevelop/ProjectModel/Gui/SolutionOptions"> + <Section id = "Deployment" _label = "Deployment" /> </Extension> - <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/GeneralOptions"> - <DialogPanel id = "Deployment" _label = "Deployment" /> + <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions"> + <Section id = "Deployment" _label = "Deployment" /> </Extension> <Extension path = "/MonoDevelop/ProjectModel/ProjectServiceExtensions"> @@ -201,4 +201,8 @@ <Extension path = "/MonoDevelop/Ide/ProjectFeatures"> <Class class = "MonoDevelop.Deployment.Gui.PackagingFeature" /> </Extension> + + <Extension path = "/MonoDevelop/ProjectModel/MD1SerializationMaps"> + <SerializationMap resource="md1format.xml" /> + </Extension> </Addin> diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.mdp b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.mdp index 15bc23f07a..328f535c30 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.mdp +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.mdp @@ -97,6 +97,8 @@ <File name="MonoDevelop.Deployment.Gui/SshFuseFileCopyConfigurationEditor.cs" subtype="Code" buildaction="Compile" /> <File name="icons/packaging-32.png" subtype="Code" buildaction="EmbedAsResource" /> <File name="icons/packaging-16.png" subtype="Code" buildaction="EmbedAsResource" /> + <File name="MonoDevelop.Deployment/MD1Serializer.cs" subtype="Code" buildaction="Compile" /> + <File name="md1format.xml" subtype="Code" buildaction="EmbedAsResource" /> </Contents> <References> <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DefaultDeployServiceExtension.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DefaultDeployServiceExtension.cs index b2066cebc0..ceacffd379 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DefaultDeployServiceExtension.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DefaultDeployServiceExtension.cs @@ -8,27 +8,27 @@ namespace MonoDevelop.Deployment { class DefaultDeployServiceExtension: DeployServiceExtension { - public override DeployFileCollection GetDeployFiles (DeployContext ctx, CombineEntry entry) + public override DeployFileCollection GetDeployFiles (DeployContext ctx, SolutionItem entry, string configuration) { if (entry is IDeployable) - return new DeployFileCollection (((IDeployable)entry).GetDeployFiles ()); + return new DeployFileCollection (((IDeployable)entry).GetDeployFiles (configuration)); - return base.GetDeployFiles (ctx, entry); + return base.GetDeployFiles (ctx, entry, configuration); } - public override DeployFileCollection GetProjectDeployFiles (DeployContext ctx, Project project) + public override DeployFileCollection GetProjectDeployFiles (DeployContext ctx, Project project, string configuration) { DeployFileCollection deployFiles = new DeployFileCollection (); // Add the compiled output file - string outputFile = project.GetOutputFileName (); + string outputFile = project.GetOutputFileName (configuration); if (!string.IsNullOrEmpty (outputFile)) deployFiles.Add (new DeployFile (project, outputFile, Path.GetFileName (outputFile), TargetDirectory.ProgramFiles)); // Collect deployable files - foreach (ProjectFile file in project.ProjectFiles) { + foreach (ProjectFile file in project.Files) { if (file.BuildAction == BuildAction.FileCopy) { DeployFile dp = new DeployFile (file); deployFiles.Add (dp); @@ -40,10 +40,17 @@ namespace MonoDevelop.Deployment } } - // Collect referenced assemblies - - foreach (string refFile in project.GetReferenceDeployFiles (false)) { - deployFiles.Add (new DeployFile (project, refFile, Path.GetFileName (refFile), TargetDirectory.ProgramFiles)); + DotNetProject netProject = project as DotNetProject; + if (netProject != null) { + DotNetProjectConfiguration conf = (DotNetProjectConfiguration) project.GetActiveConfiguration (configuration); + if (conf.DebugMode) { + string mdbFile = conf.CompiledOutputName + ".mdb"; + deployFiles.Add (new DeployFile (project, mdbFile, Path.GetFileName (mdbFile), TargetDirectory.ProgramFiles)); + } + // Collect referenced assemblies + foreach (string refFile in netProject.GetReferenceDeployFiles (false, configuration)) { + deployFiles.Add (new DeployFile (project, refFile, Path.GetFileName (refFile), TargetDirectory.ProgramFiles)); + } } return deployFiles; diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployFile.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployFile.cs index dc42102bb7..e1152b311a 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployFile.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployFile.cs @@ -44,7 +44,7 @@ namespace MonoDevelop.Deployment string targetDirectoryID; DeployContext deployContext; bool isTemplate; - CombineEntry sourceCombineEntry; + SolutionItem sourceSolutionItem; string displayName; DeployFileAttributes attributes; @@ -57,20 +57,20 @@ namespace MonoDevelop.Deployment this.attributes = props.FileAttributes; if (props.HasPathReferences) isTemplate = true; - sourceCombineEntry = pfile.Project; + sourceSolutionItem = pfile.Project; } - public DeployFile (CombineEntry sourceCombineEntry, string sourcePath, string relativeTargetPath) - : this (sourceCombineEntry, sourcePath, relativeTargetPath, TargetDirectory.ProgramFiles) + public DeployFile (SolutionItem sourceSolutionItem, string sourcePath, string relativeTargetPath) + : this (sourceSolutionItem, sourcePath, relativeTargetPath, TargetDirectory.ProgramFiles) { } - public DeployFile (CombineEntry sourceCombineEntry, string sourcePath, string relativeTargetPath, string targetDirectoryID) + public DeployFile (SolutionItem sourceSolutionItem, string sourcePath, string relativeTargetPath, string targetDirectoryID) { this.targetDirectoryID = targetDirectoryID; this.sourcePath = sourcePath; this.relativeTargetPath = relativeTargetPath; - this.sourceCombineEntry = sourceCombineEntry; + this.sourceSolutionItem = sourceSolutionItem; } internal void SetContext (DeployContext deployContext) @@ -78,8 +78,8 @@ namespace MonoDevelop.Deployment this.deployContext = deployContext; } - public CombineEntry SourceCombineEntry { - get { return sourceCombineEntry; } + public SolutionItem SourceSolutionItem { + get { return sourceSolutionItem; } } public string DisplayName { @@ -87,7 +87,7 @@ namespace MonoDevelop.Deployment if (displayName != null) return displayName; else { - return FileService.AbsoluteToRelativePath (sourceCombineEntry.BaseDirectory, SourcePath); + return FileService.AbsoluteToRelativePath (sourceSolutionItem.BaseDirectory, SourcePath); } } set { displayName = value; } diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployProjectServiceExtension.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployProjectServiceExtension.cs index e212e3b595..be17ca7589 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployProjectServiceExtension.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployProjectServiceExtension.cs @@ -8,14 +8,14 @@ namespace MonoDevelop.Deployment { class DeployProjectServiceExtension: ProjectServiceExtension, IDirectoryResolver { - public override ICompilerResult Build (IProgressMonitor monitor, CombineEntry entry) + protected override ICompilerResult Build (IProgressMonitor monitor, SolutionEntityItem item, string configuration) { - ICompilerResult res = base.Build (monitor, entry); - Project project = entry as Project; + ICompilerResult res = base.Build (monitor, item, configuration); + Project project = item as Project; if (project == null) return res; - string outfile = project.GetOutputFileName (); + string outfile = project.GetOutputFileName (configuration); if (string.IsNullOrEmpty (outfile)) return res; @@ -24,7 +24,7 @@ namespace MonoDevelop.Deployment // Copy deploy files with ProgramFiles as target directory using (DeployContext ctx = new DeployContext (this, DeployService.CurrentPlatform, Path.GetDirectoryName (outfile))) { - DeployFileCollection files = DeployService.GetDeployFiles (ctx, entry); + DeployFileCollection files = DeployService.GetDeployFiles (ctx, item, configuration); foreach (DeployFile file in files) { if (FileService.GetFullPath (file.SourcePath) == outfile) @@ -48,21 +48,21 @@ namespace MonoDevelop.Deployment return res; } - public override void Clean (IProgressMonitor monitor, CombineEntry entry) + protected override void Clean (IProgressMonitor monitor, SolutionEntityItem item, string configuration) { - base.Clean (monitor, entry); - Project project = entry as Project; + base.Clean (monitor, item, configuration); + Project project = item as Project; if (project == null) return; - string path = project.GetOutputFileName (); + string path = project.GetOutputFileName (configuration); if (string.IsNullOrEmpty (path)) return; path = Path.GetDirectoryName (path); using (DeployContext ctx = new DeployContext (this, DeployService.CurrentPlatform, path)) { - DeployFileCollection files = DeployService.GetDeployFiles (ctx, entry); + DeployFileCollection files = DeployService.GetDeployFiles (ctx, item, configuration); foreach (DeployFile file in files) { if (file.TargetDirectoryID == TargetDirectory.ProgramFiles) { string tfile = file.ResolvedTargetFile; diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployService.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployService.cs index b5283ac8d8..8c688abf59 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployService.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployService.cs @@ -75,7 +75,7 @@ namespace MonoDevelop.Deployment return props; } - public static PackageBuilder[] GetSupportedPackageBuilders (CombineEntry entry) + public static PackageBuilder[] GetSupportedPackageBuilders (SolutionItem entry) { object[] builders = AddinManager.GetExtensionObjects ("/MonoDevelop/DeployService/PackageBuilders", false); ArrayList list = new ArrayList (); @@ -95,10 +95,10 @@ namespace MonoDevelop.Deployment return (PackageBuilder[]) AddinManager.GetExtensionObjects ("/MonoDevelop/DeployService/PackageBuilders", typeof(PackageBuilder), false); } - public static void Install (IProgressMonitor monitor, CombineEntry entry, string prefix, string appName) + public static void Install (IProgressMonitor monitor, SolutionItem entry, string prefix, string appName, string configuration) { InstallResolver res = new InstallResolver (); - res.Install (monitor, entry, appName, prefix); + res.Install (monitor, entry, appName, prefix, configuration); } public static void CreateArchive (IProgressMonitor mon, string folder, string targetFile) @@ -151,31 +151,31 @@ namespace MonoDevelop.Deployment return null; } - public static void BuildPackage (IProgressMonitor mon, Package package) + public static bool BuildPackage (IProgressMonitor mon, Package package) { - BuildPackage (mon, package.PackageBuilder); + return BuildPackage (mon, package.PackageBuilder); } - internal static void BuildPackage (IProgressMonitor mon, PackageBuilder builder) + public static bool BuildPackage (IProgressMonitor mon, PackageBuilder builder) { DeployServiceExtension extensionChain = GetExtensionChain (); - extensionChain.BuildPackage (mon, builder); + return extensionChain.BuildPackage (mon, builder); } - public static DeployFileCollection GetDeployFiles (DeployContext ctx, CombineEntry[] entries) + public static DeployFileCollection GetDeployFiles (DeployContext ctx, SolutionItem[] entries, string configuration) { DeployFileCollection col = new DeployFileCollection (); - foreach (CombineEntry e in entries) { - col.AddRange (GetDeployFiles (ctx, e)); + foreach (SolutionItem e in entries) { + col.AddRange (GetDeployFiles (ctx, e, configuration)); } return col; } - public static DeployFileCollection GetDeployFiles (DeployContext ctx, CombineEntry entry) + public static DeployFileCollection GetDeployFiles (DeployContext ctx, SolutionItem entry, string configuration) { ArrayList todel = new ArrayList (); - DeployFileCollection col = GetExtensionChain ().GetDeployFiles (ctx, entry); + DeployFileCollection col = GetExtensionChain ().GetDeployFiles (ctx, entry, configuration); foreach (DeployFile df in col) { if (!ctx.IncludeFile (df)) { todel.Add (df); diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployServiceExtension.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployServiceExtension.cs index 3fbdd3fbbb..1033774c19 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployServiceExtension.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployServiceExtension.cs @@ -9,38 +9,38 @@ namespace MonoDevelop.Deployment { internal DeployServiceExtension Next; - public virtual void BuildPackage (IProgressMonitor monitor, PackageBuilder builder) + public virtual bool BuildPackage (IProgressMonitor monitor, PackageBuilder builder) { if (Next != null) - Next.BuildPackage (monitor, builder); + return Next.BuildPackage (monitor, builder); else - builder.Build (monitor); + return builder.Build (monitor); } - public virtual DeployFileCollection GetDeployFiles (DeployContext ctx, CombineEntry entry) + public virtual DeployFileCollection GetDeployFiles (DeployContext ctx, SolutionItem entry, string configuration) { - if (entry is Combine) - return GetCombineDeployFiles (ctx, (Combine) entry); + if (entry is SolutionFolder) + return GetCombineDeployFiles (ctx, (SolutionFolder) entry, configuration); else if (entry is Project) - return GetProjectDeployFiles (ctx, (Project) entry); + return GetProjectDeployFiles (ctx, (Project) entry, configuration); else if (Next != null) - return Next.GetDeployFiles (ctx, entry); + return Next.GetDeployFiles (ctx, entry, configuration); else return new DeployFileCollection (); } - public virtual DeployFileCollection GetCombineDeployFiles (DeployContext ctx, Combine combine) + public virtual DeployFileCollection GetCombineDeployFiles (DeployContext ctx, SolutionFolder combine, string configuration) { if (Next != null) - return Next.GetDeployFiles (ctx, combine); + return Next.GetDeployFiles (ctx, combine, configuration); else return new DeployFileCollection (); } - public virtual DeployFileCollection GetProjectDeployFiles (DeployContext ctx, Project project) + public virtual DeployFileCollection GetProjectDeployFiles (DeployContext ctx, Project project, string configuration) { if (Next != null) - return Next.GetDeployFiles (ctx, project); + return Next.GetDeployFiles (ctx, project, configuration); else return new DeployFileCollection (); } diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/IDeployable.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/IDeployable.cs index 256cf6a8f0..6d62e81459 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/IDeployable.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/IDeployable.cs @@ -5,6 +5,6 @@ namespace MonoDevelop.Deployment { public interface IDeployable { - DeployFileCollection GetDeployFiles (); + DeployFileCollection GetDeployFiles (string configuration); } } diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/InstallResolver.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/InstallResolver.cs index 97db49bbca..8308fb9ef2 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/InstallResolver.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/InstallResolver.cs @@ -40,18 +40,18 @@ namespace MonoDevelop.Deployment { string appName; - public void Install (IProgressMonitor monitor, CombineEntry entry, string appName, string prefix) + public void Install (IProgressMonitor monitor, SolutionItem entry, string appName, string prefix, string configuration) { this.appName = appName; using (DeployContext ctx = new DeployContext (this, "Linux", prefix)) { - InstallEntry (monitor, ctx, entry); + InstallEntry (monitor, ctx, entry, configuration); } } - void InstallEntry (IProgressMonitor monitor, DeployContext ctx, CombineEntry entry) + void InstallEntry (IProgressMonitor monitor, DeployContext ctx, SolutionItem entry, string configuration) { - foreach (DeployFile df in DeployService.GetDeployFiles (ctx, new CombineEntry[] { entry } )) { + foreach (DeployFile df in DeployService.GetDeployFiles (ctx, new SolutionItem[] { entry }, configuration)) { string targetPath = df.ResolvedTargetFile; if (targetPath == null) { monitor.ReportWarning ("Could not copy file '" + df.RelativeTargetPath + "': Unknown target directory."); @@ -61,11 +61,11 @@ namespace MonoDevelop.Deployment CopyFile (monitor, df.SourcePath, df.ResolvedTargetFile, df.FileAttributes); } - Combine c = entry as Combine; + SolutionFolder c = entry as SolutionFolder; if (c != null) { - monitor.BeginTask ("Installing solution '" + c.Name + "'", c.Entries.Count); - foreach (CombineEntry ce in c.Entries) { - InstallEntry (monitor, ctx, ce); + monitor.BeginTask ("Installing solution '" + c.Name + "'", c.Items.Count); + foreach (SolutionItem ce in c.Items) { + InstallEntry (monitor, ctx, ce, configuration); monitor.Step (1); } monitor.EndTask (); diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/MD1Serializer.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/MD1Serializer.cs new file mode 100644 index 0000000000..f3752ac9b3 --- /dev/null +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/MD1Serializer.cs @@ -0,0 +1,63 @@ +// MD1Serializer.cs +// +// Author: +// Lluis Sanchez Gual <lluis@novell.com> +// +// Copyright (c) 2008 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +// + +using System; +using System.Collections.Generic; +using MonoDevelop.Projects; +using MonoDevelop.Projects.Serialization; +using MonoDevelop.Projects.Formats.MD1; + +namespace MonoDevelop.Deployment +{ + public class MD1Serializer: ICustomDataItemHandler + { + public DataCollection Serialize (object obj, ITypeSerializer handler) + { + PackageBuilder pb = (PackageBuilder) obj; + List<string> items = new List<string> (); + foreach (SolutionItem sitem in pb.GetChildEntries ()) { + string file = MD1ProjectService.GetItemFileName (sitem); + if (file != null) + items.Add (file); + else if (handler.SerializationContext.ProgressMonitor != null) + handler.SerializationContext.ProgressMonitor.ReportWarning ("Can't save reference to item '" + sitem.Name + "'"); + } + string rootFile = MD1ProjectService.GetItemFileName (pb.RootSolutionItem); + if (rootFile == null && handler.SerializationContext.ProgressMonitor != null) + handler.SerializationContext.ProgressMonitor.ReportWarning ("Can't save reference to item '" + pb.RootSolutionItem.Name + "'"); + + pb.SetSolutionItemMd1 (rootFile, items.ToArray ()); + return handler.Serialize (obj); + } + + public void Deserialize (object obj, ITypeSerializer handler, DataCollection data) + { + handler.Deserialize (obj, data); + } + + } +} diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/PackageBuilder.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/PackageBuilder.cs index 4907c86a94..997b370e3e 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/PackageBuilder.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/PackageBuilder.cs @@ -42,18 +42,22 @@ namespace MonoDevelop.Deployment public class PackageBuilder: IDirectoryResolver { [ItemProperty ("ChildEntries")] - [ProjectPathItemProperty ("Entry", Scope=1)] - List<string> childEntries = new List<string> (); + List<SolutionItemReference> childEntries = new List<SolutionItemReference> (); [ItemProperty ("ExcludedFiles")] [ItemProperty ("File", Scope=1)] List<string> excludedFiles; - [ProjectPathItemProperty] - string rootEntry; + [ItemProperty ("RootEntry")] + SolutionItemReference rootEntry; - List<CombineEntry> childCombineEntries; - CombineEntry rootCombineEntry; + List<SolutionItem> childCombineEntries; + SolutionItem rootSolutionItem; + +#region MD 1.0 compatibility fields + string[] md1ChildEntries; + string md1RootEntry; +#endregion public PackageBuilder () { @@ -78,7 +82,7 @@ namespace MonoDevelop.Deployment return null; } - internal void Build (IProgressMonitor monitor) + internal bool Build (IProgressMonitor monitor) { monitor.BeginTask ("Package: " + Description, 1); DeployContext ctx = null; @@ -86,23 +90,29 @@ namespace MonoDevelop.Deployment ctx = CreateDeployContext (); if (ctx != null) ctx.FileFilter = this; - OnBuild (monitor, ctx); + if (!OnBuild (monitor, ctx)) { + monitor.AsyncOperation.Cancel (); + return false; + } } catch (Exception ex) { monitor.ReportError ("Package creation failed", ex); + LoggingService.LogError ("Package creation failed", ex); monitor.AsyncOperation.Cancel (); + return false; } finally { monitor.EndTask (); if (ctx != null) ctx.Dispose (); } + return true; } - public virtual bool CanBuild (CombineEntry entry) + public virtual bool CanBuild (SolutionItem entry) { return true; } - public virtual void InitializeSettings (CombineEntry entry) + public virtual void InitializeSettings (SolutionItem entry) { } @@ -115,17 +125,20 @@ namespace MonoDevelop.Deployment public virtual void CopyFrom (PackageBuilder other) { - childEntries = new List<string> (other.childEntries); + childEntries = new List<SolutionItemReference> (other.childEntries); rootEntry = other.rootEntry; + md1ChildEntries = other.md1ChildEntries; + md1RootEntry = other.md1RootEntry; + if (other.childCombineEntries != null) - childCombineEntries = new List<CombineEntry> (other.childCombineEntries); + childCombineEntries = new List<SolutionItem> (other.childCombineEntries); else childCombineEntries = null; if (other.excludedFiles != null) excludedFiles = new List<string> (other.excludedFiles); else excludedFiles = null; - rootCombineEntry = other.rootCombineEntry; + rootSolutionItem = other.rootSolutionItem; } public virtual PackageBuilder[] CreateDefaultBuilders () @@ -133,8 +146,9 @@ namespace MonoDevelop.Deployment return new PackageBuilder [0]; } - protected virtual void OnBuild (IProgressMonitor monitor, DeployContext ctx) + protected virtual bool OnBuild (IProgressMonitor monitor, DeployContext ctx) { + return true; } string IDirectoryResolver.GetDirectory (DeployContext ctx, string folderId) @@ -152,120 +166,149 @@ namespace MonoDevelop.Deployment return new DeployContext (this, "Linux", null); } - public void SetCombineEntry (CombineEntry entry) + public void SetSolutionItem (SolutionItem entry) { - SetCombineEntry (entry, null); + SetSolutionItem (entry, null); } - public void SetCombineEntry (CombineEntry rootCombineEntry, CombineEntry[] childEntries) + public void SetSolutionItem (SolutionItem rootSolutionItem, IEnumerable<SolutionItem> childEntries) { - this.rootCombineEntry = rootCombineEntry; - childCombineEntries = new List<CombineEntry> (); + this.rootSolutionItem = rootSolutionItem; + childCombineEntries = new List<SolutionItem> (); if (childEntries != null) childCombineEntries.AddRange (childEntries); UpdateEntryNames (); - InitializeSettings (rootCombineEntry); + InitializeSettings (rootSolutionItem); + } + + internal void SetSolutionItem (SolutionItemReference siRoot, SolutionItemReference[] children) + { + rootEntry = siRoot; + childEntries.Clear (); + foreach (SolutionItemReference e in children) + childEntries.Add (e); + } + + internal void SetSolutionItemMd1 (string siRoot, string[] children) + { + md1RootEntry = siRoot; + md1ChildEntries = children; } void UpdateEntryNames () { - this.rootEntry = rootCombineEntry.FileName; + this.rootEntry = new SolutionItemReference (rootSolutionItem); this.childEntries.Clear (); - foreach (CombineEntry e in childCombineEntries) - childEntries.Add (e.FileName); + foreach (SolutionItem e in childCombineEntries) + childEntries.Add (new SolutionItemReference (e)); } - public CombineEntry RootCombineEntry { + public SolutionItem RootSolutionItem { get { - if (rootCombineEntry == null && rootEntry != null) { - rootCombineEntry = GetEntry (rootEntry); + if (rootSolutionItem == null && (rootEntry != null || md1RootEntry != null)) { + if (md1RootEntry != null) { + rootSolutionItem = GetEntryMD1 (md1RootEntry); + md1RootEntry = null; + } else + rootSolutionItem = GetEntry (rootEntry); } - return rootCombineEntry; + return rootSolutionItem; } } - public void AddEntry (CombineEntry entry) + public Solution Solution { + get { + return RootSolutionItem != null ? RootSolutionItem.ParentSolution : null; + } + } + + public void AddEntry (SolutionItem entry) { - string fp = FileService.GetFullPath (entry.FileName); - foreach (string s in childEntries) - if (FileService.GetFullPath (s) == fp) + SolutionItemReference fp = new SolutionItemReference (entry); + foreach (SolutionItemReference s in childEntries) + if (s.Equals (fp)) return; - if (rootEntry != null && FileService.GetFullPath (rootEntry) == fp) + if (rootEntry == fp) return; - List<CombineEntry> list = new List<CombineEntry> (); - if (RootCombineEntry != null) - list.Add (RootCombineEntry); + List<SolutionItem> list = new List<SolutionItem> (); + if (RootSolutionItem != null) + list.Add (RootSolutionItem); list.AddRange (GetChildEntries()); list.Add (entry); - rootCombineEntry = GetCommonCombineEntry (list); - list.Remove (rootCombineEntry); + rootSolutionItem = GetCommonSolutionItem (list); + list.Remove (rootSolutionItem); - foreach (CombineEntry e in list.ToArray ()) { - CombineEntry ce = e.ParentCombine; - while (ce != rootCombineEntry) { + foreach (SolutionItem e in list.ToArray ()) { + SolutionItem ce = e.ParentFolder; + while (ce != rootSolutionItem) { if (!list.Contains (ce)) list.Add (ce); - ce = ce.ParentCombine; + ce = ce.ParentFolder; } } childCombineEntries = list; UpdateEntryNames (); } - public CombineEntry[] GetChildEntries () + public SolutionItem[] GetChildEntries () { if (childCombineEntries != null) return childCombineEntries.ToArray (); - childCombineEntries = new List<CombineEntry> (); - foreach (string en in childEntries) { - CombineEntry re = GetEntry (en); - if (re != null && !(re is UnknownCombineEntry)) + childCombineEntries = new List<SolutionItem> (); + + if (md1ChildEntries != null) { + foreach (string it in md1ChildEntries) { + SolutionItem re = GetEntryMD1 (it); + if (re != null && !(re is UnknownSolutionItem)) + childCombineEntries.Add (re); + } + md1ChildEntries = null; + return childCombineEntries.ToArray (); + } + + foreach (SolutionItemReference en in childEntries) { + SolutionItem re = GetEntry (en); + if (re != null && !(re is UnknownSolutionItem)) childCombineEntries.Add (re); } return childCombineEntries.ToArray (); } - public CombineEntry[] GetAllEntries () + public SolutionItem[] GetAllEntries () { - List<CombineEntry> list = new List<CombineEntry> (); - if (RootCombineEntry != null) - list.Add (RootCombineEntry); + List<SolutionItem> list = new List<SolutionItem> (); + if (RootSolutionItem != null) + list.Add (RootSolutionItem); list.AddRange (GetChildEntries ()); return list.ToArray (); } - CombineEntry GetEntry (string fileName) + SolutionItem GetEntry (SolutionItemReference reference) { - if (IdeApp.ProjectOperations.CurrentOpenCombine != null) { - CombineEntry fe = FindEntry (IdeApp.ProjectOperations.CurrentOpenCombine, FileService.GetFullPath (fileName)); - return fe; - } - return Services.ProjectService.ReadCombineEntry (fileName, new NullProgressMonitor ()); + return Services.ProjectService.ReadSolutionItem (new NullProgressMonitor (), reference, IdeApp.Workspace.Items.ToArray ()); } - CombineEntry FindEntry (CombineEntry e, string fileName) + public virtual DeployFileCollection GetDeployFiles (DeployContext ctx, string configuration) { - if (FileService.GetFullPath (e.FileName) == fileName) - return e; - if (e is Combine) { - foreach (CombineEntry ce in ((Combine)e).Entries) { - CombineEntry fe = FindEntry (ce, fileName); - if (fe != null) - return fe; - } - } - return null; + return DeployService.GetDeployFiles (ctx, GetAllEntries (), configuration); } - public virtual DeployFileCollection GetDeployFiles (DeployContext ctx) + public virtual string[] GetSupportedConfigurations () { - return DeployService.GetDeployFiles (ctx, GetAllEntries ()); + if (Solution != null) { + ICollection<string> col = Solution.GetConfigurations (); + string[] arr = new string [col.Count]; + col.CopyTo (arr, 0); + return arr; + } + else + return new string [0]; } public bool IsFileIncluded (DeployFile file) @@ -286,39 +329,56 @@ namespace MonoDevelop.Deployment string GetKey (DeployFile file) { - return file.SourceCombineEntry.Name + "," + file.TargetDirectoryID + "," + file.RelativeTargetPath; + return file.SourceSolutionItem.Name + "," + file.TargetDirectoryID + "," + file.RelativeTargetPath; + } + + + internal static SolutionItem GetCommonSolutionItem (IEnumerable<SolutionItem> entries) + { + SolutionItem common = null; + foreach (SolutionItem it in entries) { + if (common == null) + common = it; + else + return it.ParentSolution.RootFolder; + } + return common; } + SolutionItem GetEntryMD1 (string fileName) + { + foreach (WorkspaceItem it in IdeApp.Workspace.Items) { + SolutionItem fi = FindEntryMD1 (it, FileService.GetFullPath (fileName)); + if (fi != null) + return fi; + } + return Services.ProjectService.ReadSolutionItem (new NullProgressMonitor (), fileName); + } - internal static CombineEntry GetCommonCombineEntry (ICollection entries) + SolutionItem FindEntryMD1 (object item, string fileName) { - ArrayList combineList = new ArrayList (); - bool firstEntry = true; - foreach (CombineEntry e in entries) { - CombineEntry c = e; - do { - int i = combineList.IndexOf (c); - if (i != -1) { - // Found a common entry. - // Remove all previous entries in the list, since they are not common. - combineList.RemoveRange (0, i); - break; - } else if (firstEntry) { - combineList.Add (c); - } - if ((c is Combine) && ((Combine)c).IsRoot) - c = null; - else - c = c.ParentCombine; + if (item is SolutionItem) { + string file = MonoDevelop.Projects.Formats.MD1.MD1ProjectService.GetItemFileName ((SolutionItem)item); + if (file != null && FileService.GetFullPath (file) == fileName) + return (SolutionItem) item; + } + + if (item is Solution) { + return FindEntryMD1 (((Solution)item).RootFolder, fileName); + } + else if (item is SolutionFolder) { + foreach (SolutionItem ce in ((SolutionFolder)item).Items) { + SolutionItem fi = FindEntryMD1 (ce, fileName); + if (fi != null) return fi; } - while (c != null); - - firstEntry = false; } - if (combineList.Count == 0) - return null; - else - return (CombineEntry) combineList [0]; + else if (item is Workspace) { + foreach (WorkspaceItem wi in ((Workspace)item).Items) { + SolutionItem fi = FindEntryMD1 (wi, fileName); + if (fi != null) return fi; + } + } + return null; } } } diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/PackagingProject.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/PackagingProject.cs index 3b0fad1d00..b468f01a2b 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/PackagingProject.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/PackagingProject.cs @@ -8,7 +8,7 @@ using MonoDevelop.Projects.Serialization; namespace MonoDevelop.Deployment { - public class PackagingProject: CombineEntry + public class PackagingProject: SolutionEntityItem { PackageCollection packages; @@ -33,31 +33,31 @@ namespace MonoDevelop.Deployment get { return packages; } } - public override IConfiguration CreateConfiguration (string name) + public override SolutionItemConfiguration CreateConfiguration (string name) { PackagingProjectConfiguration conf = new PackagingProjectConfiguration (); conf.Name = name; return conf; } - protected override void OnClean (IProgressMonitor monitor) + protected override void OnClean (IProgressMonitor monitor, string configuration) { foreach (Package p in packages) p.Clean (monitor); } - protected override ICompilerResult OnBuild (IProgressMonitor monitor) + protected override ICompilerResult OnBuild (IProgressMonitor monitor, string configuration) { foreach (Package p in packages) p.Build (monitor); return null; } - protected override void OnExecute (IProgressMonitor monitor, ExecutionContext context) + protected override void OnExecute (IProgressMonitor monitor, ExecutionContext context, string configuration) { } - protected override bool OnGetNeedsBuilding () + protected override bool OnGetNeedsBuilding (string configuration) { foreach (Package p in packages) if (p.NeedsBuilding) @@ -65,7 +65,7 @@ namespace MonoDevelop.Deployment return false; } - protected override void OnSetNeedsBuilding (bool val) + protected override void OnSetNeedsBuilding (bool val, string configuration) { foreach (Package p in packages) p.NeedsBuilding = val; @@ -78,25 +78,7 @@ namespace MonoDevelop.Deployment } } - public class PackagingProjectConfiguration : IConfiguration + public class PackagingProjectConfiguration : SolutionItemConfiguration { - [ItemProperty("name")] - string name = null; - - public string Name { - get { return name; } - set { name = value; } - } - - public object Clone() - { - IConfiguration conf = (IConfiguration) MemberwiseClone (); - conf.CopyFrom (this); - return conf; - } - - public virtual void CopyFrom (IConfiguration configuration) - { - } } } diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/UnknownPackageBuilder.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/UnknownPackageBuilder.cs index 89853c583c..9b3b9e3bad 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/UnknownPackageBuilder.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/UnknownPackageBuilder.cs @@ -54,9 +54,10 @@ namespace MonoDevelop.Deployment } } - protected override void OnBuild (IProgressMonitor monitor, DeployContext ctx) + protected override bool OnBuild (IProgressMonitor monitor, DeployContext ctx) { monitor.ReportError ("Unknown package type. The package can't be generated.", null); + return false; } } diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/gtk-gui/MonoDevelop.Deployment.DeployFileListWidget.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/gtk-gui/MonoDevelop.Deployment.DeployFileListWidget.cs index 63b834aad1..09c2d1d0a1 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/gtk-gui/MonoDevelop.Deployment.DeployFileListWidget.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/gtk-gui/MonoDevelop.Deployment.DeployFileListWidget.cs @@ -15,7 +15,11 @@ namespace MonoDevelop.Deployment { private Gtk.VBox vbox2; - private Gtk.Label label1; + private Gtk.HBox hbox1; + + private Gtk.Label labelFiles; + + private Gtk.ComboBox comboConfigs; private Gtk.ScrolledWindow scrolledwindow1; @@ -33,15 +37,32 @@ namespace MonoDevelop.Deployment { this.vbox2.Name = "vbox2"; this.vbox2.Spacing = 6; // Container child vbox2.Gtk.Box+BoxChild - this.label1 = new Gtk.Label(); - this.label1.Name = "label1"; - this.label1.Xalign = 0F; - this.label1.LabelProp = Mono.Unix.Catalog.GetString("The following files will be included in the package:"); - this.vbox2.Add(this.label1); - Gtk.Box.BoxChild w1 = ((Gtk.Box.BoxChild)(this.vbox2[this.label1])); + this.hbox1 = new Gtk.HBox(); + this.hbox1.Name = "hbox1"; + this.hbox1.Spacing = 6; + // Container child hbox1.Gtk.Box+BoxChild + this.labelFiles = new Gtk.Label(); + this.labelFiles.Name = "labelFiles"; + this.labelFiles.Xalign = 0F; + this.labelFiles.LabelProp = Mono.Unix.Catalog.GetString("The following files will be included in the package:"); + this.hbox1.Add(this.labelFiles); + Gtk.Box.BoxChild w1 = ((Gtk.Box.BoxChild)(this.hbox1[this.labelFiles])); w1.Position = 0; w1.Expand = false; w1.Fill = false; + // Container child hbox1.Gtk.Box+BoxChild + this.comboConfigs = Gtk.ComboBox.NewText(); + this.comboConfigs.Name = "comboConfigs"; + this.hbox1.Add(this.comboConfigs); + Gtk.Box.BoxChild w2 = ((Gtk.Box.BoxChild)(this.hbox1[this.comboConfigs])); + w2.Position = 1; + w2.Expand = false; + w2.Fill = false; + this.vbox2.Add(this.hbox1); + Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.vbox2[this.hbox1])); + w3.Position = 0; + w3.Expand = false; + w3.Fill = false; // Container child vbox2.Gtk.Box+BoxChild this.scrolledwindow1 = new Gtk.ScrolledWindow(); this.scrolledwindow1.CanFocus = true; @@ -55,22 +76,23 @@ namespace MonoDevelop.Deployment { this.fileList.HeadersClickable = true; this.scrolledwindow1.Add(this.fileList); this.vbox2.Add(this.scrolledwindow1); - Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.vbox2[this.scrolledwindow1])); - w3.Position = 1; + Gtk.Box.BoxChild w5 = ((Gtk.Box.BoxChild)(this.vbox2[this.scrolledwindow1])); + w5.Position = 1; // Container child vbox2.Gtk.Box+BoxChild this.hbox2 = new Gtk.HBox(); this.hbox2.Name = "hbox2"; this.hbox2.Spacing = 6; this.vbox2.Add(this.hbox2); - Gtk.Box.BoxChild w4 = ((Gtk.Box.BoxChild)(this.vbox2[this.hbox2])); - w4.Position = 2; - w4.Expand = false; - w4.Fill = false; + Gtk.Box.BoxChild w6 = ((Gtk.Box.BoxChild)(this.vbox2[this.hbox2])); + w6.Position = 2; + w6.Expand = false; + w6.Fill = false; this.Add(this.vbox2); if ((this.Child != null)) { this.Child.ShowAll(); } this.Show(); + this.comboConfigs.Changed += new System.EventHandler(this.OnComboConfigsChanged); } } } diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/gtk-gui/MonoDevelop.Deployment.Gui.BinariesZipEditorWidget.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/gtk-gui/MonoDevelop.Deployment.Gui.BinariesZipEditorWidget.cs index ce1d6847ad..eaf24952f8 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/gtk-gui/MonoDevelop.Deployment.Gui.BinariesZipEditorWidget.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/gtk-gui/MonoDevelop.Deployment.Gui.BinariesZipEditorWidget.cs @@ -19,6 +19,8 @@ namespace MonoDevelop.Deployment.Gui { private Gtk.Table table1; + private Gtk.ComboBox comboConfiguration; + private Gtk.ComboBox comboPlatform; private MonoDevelop.Components.FolderEntry folderEntry; @@ -35,6 +37,8 @@ namespace MonoDevelop.Deployment.Gui { private Gtk.Label label3; + private Gtk.Label label5; + protected virtual void Build() { Stetic.Gui.Initialize(this); // Widget MonoDevelop.Deployment.Gui.BinariesZipEditorWidget @@ -56,30 +60,41 @@ namespace MonoDevelop.Deployment.Gui { w1.Expand = false; w1.Fill = false; // Container child vbox2.Gtk.Box+BoxChild - this.table1 = new Gtk.Table(((uint)(3)), ((uint)(2)), false); + this.table1 = new Gtk.Table(((uint)(4)), ((uint)(2)), false); this.table1.Name = "table1"; this.table1.RowSpacing = ((uint)(6)); this.table1.ColumnSpacing = ((uint)(6)); // Container child table1.Gtk.Table+TableChild - this.comboPlatform = Gtk.ComboBox.NewText(); - this.comboPlatform.Name = "comboPlatform"; - this.table1.Add(this.comboPlatform); - Gtk.Table.TableChild w2 = ((Gtk.Table.TableChild)(this.table1[this.comboPlatform])); + this.comboConfiguration = Gtk.ComboBox.NewText(); + this.comboConfiguration.Name = "comboConfiguration"; + this.table1.Add(this.comboConfiguration); + Gtk.Table.TableChild w2 = ((Gtk.Table.TableChild)(this.table1[this.comboConfiguration])); w2.LeftAttach = ((uint)(1)); w2.RightAttach = ((uint)(2)); w2.XOptions = ((Gtk.AttachOptions)(4)); w2.YOptions = ((Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild - this.folderEntry = new MonoDevelop.Components.FolderEntry(); - this.folderEntry.Name = "folderEntry"; - this.table1.Add(this.folderEntry); - Gtk.Table.TableChild w3 = ((Gtk.Table.TableChild)(this.table1[this.folderEntry])); + this.comboPlatform = Gtk.ComboBox.NewText(); + this.comboPlatform.Name = "comboPlatform"; + this.table1.Add(this.comboPlatform); + Gtk.Table.TableChild w3 = ((Gtk.Table.TableChild)(this.table1[this.comboPlatform])); w3.TopAttach = ((uint)(1)); w3.BottomAttach = ((uint)(2)); w3.LeftAttach = ((uint)(1)); w3.RightAttach = ((uint)(2)); + w3.XOptions = ((Gtk.AttachOptions)(4)); w3.YOptions = ((Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild + this.folderEntry = new MonoDevelop.Components.FolderEntry(); + this.folderEntry.Name = "folderEntry"; + this.table1.Add(this.folderEntry); + Gtk.Table.TableChild w4 = ((Gtk.Table.TableChild)(this.table1[this.folderEntry])); + w4.TopAttach = ((uint)(2)); + w4.BottomAttach = ((uint)(3)); + w4.LeftAttach = ((uint)(1)); + w4.RightAttach = ((uint)(2)); + w4.YOptions = ((Gtk.AttachOptions)(4)); + // Container child table1.Gtk.Table+TableChild this.hbox1 = new Gtk.HBox(); this.hbox1.Name = "hbox1"; this.hbox1.Spacing = 6; @@ -90,60 +105,71 @@ namespace MonoDevelop.Deployment.Gui { this.entryZip.IsEditable = true; this.entryZip.InvisibleChar = '●'; this.hbox1.Add(this.entryZip); - Gtk.Box.BoxChild w4 = ((Gtk.Box.BoxChild)(this.hbox1[this.entryZip])); - w4.Position = 0; + Gtk.Box.BoxChild w5 = ((Gtk.Box.BoxChild)(this.hbox1[this.entryZip])); + w5.Position = 0; // Container child hbox1.Gtk.Box+BoxChild this.comboZip = Gtk.ComboBox.NewText(); this.comboZip.Name = "comboZip"; this.comboZip.Active = 0; this.hbox1.Add(this.comboZip); - Gtk.Box.BoxChild w5 = ((Gtk.Box.BoxChild)(this.hbox1[this.comboZip])); - w5.Position = 1; - w5.Expand = false; - w5.Fill = false; + Gtk.Box.BoxChild w6 = ((Gtk.Box.BoxChild)(this.hbox1[this.comboZip])); + w6.Position = 1; + w6.Expand = false; + w6.Fill = false; this.table1.Add(this.hbox1); - Gtk.Table.TableChild w6 = ((Gtk.Table.TableChild)(this.table1[this.hbox1])); - w6.TopAttach = ((uint)(2)); - w6.BottomAttach = ((uint)(3)); - w6.LeftAttach = ((uint)(1)); - w6.RightAttach = ((uint)(2)); - w6.YOptions = ((Gtk.AttachOptions)(4)); + Gtk.Table.TableChild w7 = ((Gtk.Table.TableChild)(this.table1[this.hbox1])); + w7.TopAttach = ((uint)(3)); + w7.BottomAttach = ((uint)(4)); + w7.LeftAttach = ((uint)(1)); + w7.RightAttach = ((uint)(2)); + w7.YOptions = ((Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild this.label1 = new Gtk.Label(); this.label1.Name = "label1"; this.label1.Xalign = 0F; - this.label1.LabelProp = Mono.Unix.Catalog.GetString("Target platform:"); + this.label1.LabelProp = Mono.Unix.Catalog.GetString("Configuration:"); this.table1.Add(this.label1); - Gtk.Table.TableChild w7 = ((Gtk.Table.TableChild)(this.table1[this.label1])); - w7.XOptions = ((Gtk.AttachOptions)(4)); - w7.YOptions = ((Gtk.AttachOptions)(4)); + Gtk.Table.TableChild w8 = ((Gtk.Table.TableChild)(this.table1[this.label1])); + w8.XOptions = ((Gtk.AttachOptions)(4)); + w8.YOptions = ((Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild this.label2 = new Gtk.Label(); this.label2.Name = "label2"; this.label2.Xalign = 0F; this.label2.LabelProp = Mono.Unix.Catalog.GetString("Target folder:"); this.table1.Add(this.label2); - Gtk.Table.TableChild w8 = ((Gtk.Table.TableChild)(this.table1[this.label2])); - w8.TopAttach = ((uint)(1)); - w8.BottomAttach = ((uint)(2)); - w8.XOptions = ((Gtk.AttachOptions)(4)); - w8.YOptions = ((Gtk.AttachOptions)(4)); + Gtk.Table.TableChild w9 = ((Gtk.Table.TableChild)(this.table1[this.label2])); + w9.TopAttach = ((uint)(2)); + w9.BottomAttach = ((uint)(3)); + w9.XOptions = ((Gtk.AttachOptions)(4)); + w9.YOptions = ((Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild this.label3 = new Gtk.Label(); this.label3.Name = "label3"; this.label3.Xalign = 0F; this.label3.LabelProp = Mono.Unix.Catalog.GetString("File:"); this.table1.Add(this.label3); - Gtk.Table.TableChild w9 = ((Gtk.Table.TableChild)(this.table1[this.label3])); - w9.TopAttach = ((uint)(2)); - w9.BottomAttach = ((uint)(3)); - w9.XOptions = ((Gtk.AttachOptions)(4)); - w9.YOptions = ((Gtk.AttachOptions)(4)); + Gtk.Table.TableChild w10 = ((Gtk.Table.TableChild)(this.table1[this.label3])); + w10.TopAttach = ((uint)(3)); + w10.BottomAttach = ((uint)(4)); + w10.XOptions = ((Gtk.AttachOptions)(4)); + w10.YOptions = ((Gtk.AttachOptions)(4)); + // Container child table1.Gtk.Table+TableChild + this.label5 = new Gtk.Label(); + this.label5.Name = "label5"; + this.label5.Xalign = 0F; + this.label5.LabelProp = Mono.Unix.Catalog.GetString("Target platform:"); + this.table1.Add(this.label5); + Gtk.Table.TableChild w11 = ((Gtk.Table.TableChild)(this.table1[this.label5])); + w11.TopAttach = ((uint)(1)); + w11.BottomAttach = ((uint)(2)); + w11.XOptions = ((Gtk.AttachOptions)(4)); + w11.YOptions = ((Gtk.AttachOptions)(4)); this.vbox2.Add(this.table1); - Gtk.Box.BoxChild w10 = ((Gtk.Box.BoxChild)(this.vbox2[this.table1])); - w10.Position = 1; - w10.Expand = false; - w10.Fill = false; + Gtk.Box.BoxChild w12 = ((Gtk.Box.BoxChild)(this.vbox2[this.table1])); + w12.Position = 1; + w12.Expand = false; + w12.Fill = false; this.Add(this.vbox2); if ((this.Child != null)) { this.Child.ShowAll(); @@ -153,6 +179,7 @@ namespace MonoDevelop.Deployment.Gui { this.comboZip.Changed += new System.EventHandler(this.OnComboZipChanged); this.folderEntry.PathChanged += new System.EventHandler(this.OnFolderEntryPathChanged); this.comboPlatform.Changed += new System.EventHandler(this.OnComboPlatformChanged); + this.comboConfiguration.Changed += new System.EventHandler(this.OnComboConfigurationChanged); } } } diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/gtk-gui/MonoDevelop.Deployment.Gui.DeployDialog.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/gtk-gui/MonoDevelop.Deployment.Gui.DeployDialog.cs index e2baac1f08..63673e445e 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/gtk-gui/MonoDevelop.Deployment.Gui.DeployDialog.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/gtk-gui/MonoDevelop.Deployment.Gui.DeployDialog.cs @@ -158,7 +158,7 @@ namespace MonoDevelop.Deployment.Gui { this.notebook = new Gtk.Notebook(); this.notebook.CanFocus = true; this.notebook.Name = "notebook"; - this.notebook.CurrentPage = 0; + this.notebook.CurrentPage = 3; this.notebook.ShowBorder = false; this.notebook.BorderWidth = ((uint)(6)); // Container child notebook.Gtk.Notebook+NotebookChild @@ -579,7 +579,7 @@ namespace MonoDevelop.Deployment.Gui { // Internal child MonoDevelop.Deployment.Gui.DeployDialog.ActionArea Gtk.HButtonBox w48 = this.ActionArea; w48.Name = "MonoDevelop.Deployment.DeployDialog_ActionArea"; - w48.Spacing = 10; + w48.Spacing = 6; w48.BorderWidth = ((uint)(5)); w48.LayoutStyle = ((Gtk.ButtonBoxStyle)(4)); // Container child MonoDevelop.Deployment.DeployDialog_ActionArea.Gtk.ButtonBox+ButtonBoxChild @@ -624,7 +624,7 @@ namespace MonoDevelop.Deployment.Gui { this.Child.ShowAll(); } this.DefaultWidth = 573; - this.DefaultHeight = 432; + this.DefaultHeight = 433; this.Show(); this.notebook.SelectPage += new Gtk.SelectPageHandler(this.OnNotebookSelectPage); this.checkSave.Clicked += new System.EventHandler(this.OnCheckSaveClicked); diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/gtk-gui/MonoDevelop.Deployment.Gui.EditPackageDialog.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/gtk-gui/MonoDevelop.Deployment.Gui.EditPackageDialog.cs index 58a8060937..c1c48cbb34 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/gtk-gui/MonoDevelop.Deployment.Gui.EditPackageDialog.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/gtk-gui/MonoDevelop.Deployment.Gui.EditPackageDialog.cs @@ -178,7 +178,7 @@ namespace MonoDevelop.Deployment.Gui { // Internal child MonoDevelop.Deployment.Gui.EditPackageDialog.ActionArea Gtk.HButtonBox w14 = this.ActionArea; w14.Name = "dialog1_ActionArea"; - w14.Spacing = 10; + w14.Spacing = 6; w14.BorderWidth = ((uint)(5)); w14.LayoutStyle = ((Gtk.ButtonBoxStyle)(4)); // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/gtk-gui/gui.stetic b/main/src/addins/Deployment/MonoDevelop.Deployment/gtk-gui/gui.stetic index 966c1edccc..9dbb5ec8b5 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/gtk-gui/gui.stetic +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/gtk-gui/gui.stetic @@ -215,7 +215,7 @@ </widget> </child> </widget> - <widget class="Gtk.Dialog" id="MonoDevelop.Deployment.Gui.DeployDialog" design-size="573 432"> + <widget class="Gtk.Dialog" id="MonoDevelop.Deployment.Gui.DeployDialog" design-size="573 433"> <property name="MemberName" /> <property name="Events">ButtonPressMask</property> <property name="GeneratePublic">False</property> @@ -264,7 +264,7 @@ <widget class="Gtk.Notebook" id="notebook"> <property name="MemberName" /> <property name="CanFocus">True</property> - <property name="CurrentPage">0</property> + <property name="CurrentPage">3</property> <property name="ShowBorder">False</property> <property name="BorderWidth">6</property> <signal name="SelectPage" handler="OnNotebookSelectPage" /> @@ -616,6 +616,7 @@ <property name="MemberName" /> <property name="CanFocus">True</property> <property name="Label" translatable="yes">Save in a new Packaging Project</property> + <property name="Active">True</property> <property name="DrawIndicator">True</property> <property name="HasLabel">True</property> <property name="UseUnderline">True</property> @@ -865,7 +866,7 @@ <child internal-child="ActionArea"> <widget class="Gtk.HButtonBox" id="MonoDevelop.Deployment.DeployDialog_ActionArea"> <property name="MemberName" /> - <property name="Spacing">10</property> + <property name="Spacing">6</property> <property name="BorderWidth">5</property> <property name="Size">3</property> <property name="LayoutStyle">End</property> @@ -1447,7 +1448,7 @@ <child internal-child="ActionArea"> <widget class="Gtk.HButtonBox" id="dialog1_ActionArea"> <property name="MemberName" /> - <property name="Spacing">10</property> + <property name="Spacing">6</property> <property name="BorderWidth">5</property> <property name="Size">2</property> <property name="LayoutStyle">End</property> @@ -1488,7 +1489,7 @@ </widget> </child> </widget> - <widget class="Gtk.Bin" id="MonoDevelop.Deployment.Gui.BinariesZipEditorWidget" design-size="443 132"> + <widget class="Gtk.Bin" id="MonoDevelop.Deployment.Gui.BinariesZipEditorWidget" design-size="443 176"> <property name="MemberName" /> <property name="GeneratePublic">False</property> <child> @@ -1512,11 +1513,32 @@ <child> <widget class="Gtk.Table" id="table1"> <property name="MemberName" /> - <property name="NRows">3</property> + <property name="NRows">4</property> <property name="NColumns">2</property> <property name="RowSpacing">6</property> <property name="ColumnSpacing">6</property> <child> + <widget class="Gtk.ComboBox" id="comboConfiguration"> + <property name="MemberName" /> + <property name="IsTextCombo">True</property> + <property name="Items" translatable="yes" /> + <signal name="Changed" handler="OnComboConfigurationChanged" /> + </widget> + <packing> + <property name="LeftAttach">1</property> + <property name="RightAttach">2</property> + <property name="AutoSize">True</property> + <property name="XOptions">Fill</property> + <property name="YOptions">Fill</property> + <property name="XExpand">False</property> + <property name="XFill">True</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> + </packing> + </child> + <child> <widget class="Gtk.ComboBox" id="comboPlatform"> <property name="MemberName" /> <property name="IsTextCombo">True</property> @@ -1524,6 +1546,8 @@ <signal name="Changed" handler="OnComboPlatformChanged" /> </widget> <packing> + <property name="TopAttach">1</property> + <property name="BottomAttach">2</property> <property name="LeftAttach">1</property> <property name="RightAttach">2</property> <property name="AutoSize">True</property> @@ -1543,8 +1567,8 @@ <signal name="PathChanged" handler="OnFolderEntryPathChanged" /> </widget> <packing> - <property name="TopAttach">1</property> - <property name="BottomAttach">2</property> + <property name="TopAttach">2</property> + <property name="BottomAttach">3</property> <property name="LeftAttach">1</property> <property name="RightAttach">2</property> <property name="AutoSize">False</property> @@ -1591,8 +1615,8 @@ </child> </widget> <packing> - <property name="TopAttach">2</property> - <property name="BottomAttach">3</property> + <property name="TopAttach">3</property> + <property name="BottomAttach">4</property> <property name="LeftAttach">1</property> <property name="RightAttach">2</property> <property name="AutoSize">False</property> @@ -1609,7 +1633,7 @@ <widget class="Gtk.Label" id="label1"> <property name="MemberName" /> <property name="Xalign">0</property> - <property name="LabelProp" translatable="yes">Target platform:</property> + <property name="LabelProp" translatable="yes">Configuration:</property> </widget> <packing> <property name="AutoSize">True</property> @@ -1630,8 +1654,8 @@ <property name="LabelProp" translatable="yes">Target folder:</property> </widget> <packing> - <property name="TopAttach">1</property> - <property name="BottomAttach">2</property> + <property name="TopAttach">2</property> + <property name="BottomAttach">3</property> <property name="AutoSize">True</property> <property name="XOptions">Fill</property> <property name="YOptions">Fill</property> @@ -1650,8 +1674,8 @@ <property name="LabelProp" translatable="yes">File:</property> </widget> <packing> - <property name="TopAttach">2</property> - <property name="BottomAttach">3</property> + <property name="TopAttach">3</property> + <property name="BottomAttach">4</property> <property name="AutoSize">False</property> <property name="XOptions">Fill</property> <property name="YOptions">Fill</property> @@ -1663,6 +1687,26 @@ <property name="YShrink">False</property> </packing> </child> + <child> + <widget class="Gtk.Label" id="label5"> + <property name="MemberName" /> + <property name="Xalign">0</property> + <property name="LabelProp" translatable="yes">Target platform:</property> + </widget> + <packing> + <property name="TopAttach">1</property> + <property name="BottomAttach">2</property> + <property name="AutoSize">True</property> + <property name="XOptions">Fill</property> + <property name="YOptions">Fill</property> + <property name="XExpand">False</property> + <property name="XFill">True</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> + </packing> + </child> </widget> <packing> <property name="Position">1</property> @@ -1682,10 +1726,36 @@ <property name="MemberName" /> <property name="Spacing">6</property> <child> - <widget class="Gtk.Label" id="label1"> + <widget class="Gtk.HBox" id="hbox1"> <property name="MemberName" /> - <property name="Xalign">0</property> - <property name="LabelProp" translatable="yes">The following files will be included in the package:</property> + <property name="Spacing">6</property> + <child> + <widget class="Gtk.Label" id="labelFiles"> + <property name="MemberName" /> + <property name="Xalign">0</property> + <property name="LabelProp" translatable="yes">The following files will be included in the package:</property> + </widget> + <packing> + <property name="Position">0</property> + <property name="AutoSize">True</property> + <property name="Expand">False</property> + <property name="Fill">False</property> + </packing> + </child> + <child> + <widget class="Gtk.ComboBox" id="comboConfigs"> + <property name="MemberName" /> + <property name="IsTextCombo">True</property> + <property name="Items" translatable="yes" /> + <signal name="Changed" handler="OnComboConfigsChanged" /> + </widget> + <packing> + <property name="Position">1</property> + <property name="AutoSize">True</property> + <property name="Expand">False</property> + <property name="Fill">False</property> + </packing> + </child> </widget> <packing> <property name="Position">0</property> diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/md1format.xml b/main/src/addins/Deployment/MonoDevelop.Deployment/md1format.xml new file mode 100644 index 0000000000..95adcf38c4 --- /dev/null +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/md1format.xml @@ -0,0 +1,9 @@ +<SerializationMap> + <DataItem class = "MonoDevelop.Deployment.PackageBuilder" customDataItem="MonoDevelop.Deployment.MD1Serializer"> + <ItemProperty member="excludedFiles" name="ExcludedFiles"/> + <ItemProperty member="excludedFiles" scope="1" name="File"/> + <ItemProperty member="md1ChildEntries" name="ChildEntries"/> + <ItemProperty member="md1ChildEntries" scope="1" name="Entry" serializationDataType="MonoDevelop.Projects.PathDataType"/> + <ItemProperty member="md1RootEntry" name="rootEntry" serializationDataType="MonoDevelop.Projects.PathDataType"/> + </DataItem> +</SerializationMap>
\ No newline at end of file diff --git a/main/src/addins/GnomePlatform/ChangeLog b/main/src/addins/GnomePlatform/ChangeLog index cab2b5d602..d19b4388fc 100644 --- a/main/src/addins/GnomePlatform/ChangeLog +++ b/main/src/addins/GnomePlatform/ChangeLog @@ -1,3 +1,7 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * Makefile.am, GnomePlatform.mdp: New project model changes. + 2008-05-08 Michael Hutchinson <mhutchinson@novell.com> * GnomePlatform.cs: Moved the code here that uses the gedit file diff --git a/main/src/addins/GnomePlatform/GnomePlatform.mdp b/main/src/addins/GnomePlatform/GnomePlatform.mdp index 97e667dbe3..538c37832d 100644 --- a/main/src/addins/GnomePlatform/GnomePlatform.mdp +++ b/main/src/addins/GnomePlatform/GnomePlatform.mdp @@ -23,6 +23,9 @@ <ProjectReference type="Gac" localcopy="True" refto="gconf-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Core" /> <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Core.Gui" /> + <ProjectReference type="Gac" localcopy="True" refto="gnome-vfs-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> </References> <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="Makefile.am" BuildTargetName="" CleanTargetName="" SyncReferences="True" IsAutotoolsProject="True" RelativeConfigureInPath="../../.."> <BuildFilesVar Sync="True" Name="FILES" /> diff --git a/main/src/addins/GnomePlatform/Makefile.am b/main/src/addins/GnomePlatform/Makefile.am index f9c4416c1e..150020b38f 100644 --- a/main/src/addins/GnomePlatform/Makefile.am +++ b/main/src/addins/GnomePlatform/Makefile.am @@ -4,6 +4,8 @@ ASSEMBLY = $(ADDIN_BUILD)/GnomePlatform.dll REFS = \ $(GCONF_SHARP_LIBS) \ $(GNOME_SHARP_LIBS) \ + $(GNOME_VFS_SHARP_LIBS) \ + $(GTK_SHARP_LIBS) \ -r:../../../build/bin/MonoDevelop.Core.dll \ -r:../../../build/bin/MonoDevelop.Core.Gui.dll \ -r:System diff --git a/main/src/addins/ILAsmBinding/ChangeLog b/main/src/addins/ILAsmBinding/ChangeLog index 43e8917ab8..e0e3dae031 100644 --- a/main/src/addins/ILAsmBinding/ChangeLog +++ b/main/src/addins/ILAsmBinding/ChangeLog @@ -1,3 +1,9 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * ILAsmBinding.mdp, Gui/CompilerParametersPanel.cs, + ILAsmLanguageBinding.cs, Makefile.am, ILAsmBinding.addin.xml: New + project model changes. + 2008-02-04 Lluis Sanchez Gual <lluis@novell.com> * ILAsmCompilerManager.cs: Properly detect and report compiler errors. Fixes diff --git a/main/src/addins/ILAsmBinding/Gui/CompilerParametersPanel.cs b/main/src/addins/ILAsmBinding/Gui/CompilerParametersPanel.cs index 8ddf77e58a..3959f2def8 100644 --- a/main/src/addins/ILAsmBinding/Gui/CompilerParametersPanel.cs +++ b/main/src/addins/ILAsmBinding/Gui/CompilerParametersPanel.cs @@ -23,45 +23,49 @@ using System.IO; using Gtk; using MonoDevelop.Projects; -using MonoDevelop.Core.Gui.Dialogs; +using MonoDevelop.Projects.Gui.Dialogs; using MonoDevelop.Core; using Mono.Addins; namespace ILAsmBinding { - public class CompilerParametersPanel : AbstractOptionPanel + public class CompilerParametersPanel : MultiConfigItemOptionsPanel { //ILAsmCompilerParameters compilerParameters = null; DotNetProjectConfiguration configuration; + DotNetProject project; Entry outputPath = new Entry (); Entry assemblyName = new Entry (); RadioButton exeTarget = new RadioButton ("exe"); RadioButton dllTarget; CheckButton debug = new CheckButton (GettextCatalog.GetString ("Include debug information")); + Gtk.Widget mainBox; - public override void LoadPanelContents() + public override Widget CreatePanelWidget() { - configuration = ((Properties)CustomizationObject).Get<DotNetProjectConfiguration> ("Config"); - //compilerParameters = (ILAsmCompilerParameters) configuration.CompilationParameters; - dllTarget = new RadioButton (exeTarget, "dll"); SetupUI (); + mainBox.ShowAll (); + return mainBox; + } + + public override void LoadConfigData () + { + configuration = (DotNetProjectConfiguration) CurrentConfiguration; + project = ConfiguredProject as DotNetProject; RestoreValues (); - this.ShowAll (); } - public override bool StorePanelContents() + public override void ApplyChanges() { configuration.OutputAssembly = assemblyName.Text; configuration.OutputDirectory = outputPath.Text; configuration.DebugMode = debug.Active; if (exeTarget.Active) - configuration.CompileTarget = CompileTarget.Exe; + project.CompileTarget = CompileTarget.Exe; else - configuration.CompileTarget = CompileTarget.Library; - - return true; + project.CompileTarget = CompileTarget.Library; } void SetupUI () @@ -81,14 +85,14 @@ namespace ILAsmBinding vbox.PackStart (exeTarget, false, true, 0); vbox.PackStart (dllTarget, false, true, 0); vbox.PackStart (debug, false, true, 0); - this.Add (vbox); + mainBox = vbox; } void RestoreValues () { assemblyName.Text = configuration.OutputAssembly; outputPath.Text = configuration.OutputDirectory; - if (configuration.CompileTarget == CompileTarget.Exe) + if (project.CompileTarget == CompileTarget.Exe) exeTarget.Active = true; else dllTarget.Active = true; diff --git a/main/src/addins/ILAsmBinding/ILAsmBinding.addin.xml b/main/src/addins/ILAsmBinding/ILAsmBinding.addin.xml index 098e5b66dc..e57cd72c3b 100644 --- a/main/src/addins/ILAsmBinding/ILAsmBinding.addin.xml +++ b/main/src/addins/ILAsmBinding/ILAsmBinding.addin.xml @@ -31,9 +31,9 @@ extensions = "*.il"/> </Extension> - <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/ConfigurationOptions"> + <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions"> <Condition id="activelanguage" value = "ILAsm"> - <DialogPanel id = "ILAsmCompilerParametersPanel" + <Section id = "ILAsmCompilerParametersPanel" _label = "Compiler" class = "ILAsmBinding.CompilerParametersPanel"/> </Condition> diff --git a/main/src/addins/ILAsmBinding/ILAsmBinding.mdp b/main/src/addins/ILAsmBinding/ILAsmBinding.mdp index a4ef926f7f..9e4bf8f7dc 100644 --- a/main/src/addins/ILAsmBinding/ILAsmBinding.mdp +++ b/main/src/addins/ILAsmBinding/ILAsmBinding.mdp @@ -30,11 +30,12 @@ <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Ide" /> <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Core.Gui" /> <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Projects" /> + <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.3.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> <ProjectReference type="Gac" localcopy="True" refto="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="atk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.3.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Projects.Gui" /> </References> <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="./Makefile.am" BuildTargetName="" CleanTargetName="" SyncReferences="True" IsAutotoolsProject="True" RelativeConfigureInPath="../../../"> <BuildFilesVar Sync="True" Name="FILES" /> diff --git a/main/src/addins/ILAsmBinding/ILAsmLanguageBinding.cs b/main/src/addins/ILAsmBinding/ILAsmLanguageBinding.cs index 8011dbfb2d..6782e48d90 100644 --- a/main/src/addins/ILAsmBinding/ILAsmLanguageBinding.cs +++ b/main/src/addins/ILAsmBinding/ILAsmLanguageBinding.cs @@ -60,7 +60,7 @@ namespace ILAsmBinding return compilerManager.Compile (projectFiles, references, configuration, monitor); } - public void GenerateMakefile (Project project, Combine parentCombine) + public void GenerateMakefile (Project project, SolutionFolder parentCombine) { // Not supported } diff --git a/main/src/addins/ILAsmBinding/Makefile.am b/main/src/addins/ILAsmBinding/Makefile.am index b57171dd7c..a9d19d4cfb 100644 --- a/main/src/addins/ILAsmBinding/Makefile.am +++ b/main/src/addins/ILAsmBinding/Makefile.am @@ -9,6 +9,7 @@ REFS = \ -r:$(top_builddir)/build/bin/MonoDevelop.Core.Gui.dll \ -r:$(top_builddir)/build/bin/MonoDevelop.Ide.dll \ -r:$(top_builddir)/build/bin/MonoDevelop.Projects.dll \ + -r:$(top_builddir)/build/bin/MonoDevelop.Projects.Gui.dll \ -r:System \ -r:System.Xml diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/ChangeLog b/main/src/addins/MonoDevelop.AssemblyBrowser/ChangeLog index 33557f8645..a8ccb4fd44 100644 --- a/main/src/addins/MonoDevelop.AssemblyBrowser/ChangeLog +++ b/main/src/addins/MonoDevelop.AssemblyBrowser/ChangeLog @@ -1,3 +1,7 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * MonoDevelop.AssemblyBrowser.mdp: New project model changes. + 2008-04-08 Mike Krüger <mkrueger@novell.com> * MonoDevelop.AssemblyBrowser.addin.xml: Updated assembly browser for diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser.mdp b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser.mdp index 04ea3be1ed..2d11187460 100644 --- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser.mdp +++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser.mdp @@ -63,13 +63,13 @@ <ProjectReference type="Gac" localcopy="True" refto="atk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Core" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Ide" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Components" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Projects.Gui" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Core.Gui" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Core" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Ide" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Components" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Projects.Gui" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Core.Gui" /> <ProjectReference type="Project" localcopy="True" refto="Mono.Cecil" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Projects" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Projects" /> <ProjectReference type="Gac" localcopy="True" refto="glib-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> </References> <GtkDesignInfo isWidgetLibrary="True" gtkVersion="2.10.2"> diff --git a/main/src/addins/MonoDevelop.Autotools/AutotoolsContext.cs b/main/src/addins/MonoDevelop.Autotools/AutotoolsContext.cs index 09c68d94d3..e0e28e3e7f 100644 --- a/main/src/addins/MonoDevelop.Autotools/AutotoolsContext.cs +++ b/main/src/addins/MonoDevelop.Autotools/AutotoolsContext.cs @@ -44,7 +44,7 @@ namespace MonoDevelop.Autotools Set<SystemPackage> commonPackages; Set<string> globalFilesReferences = new Set<string>(); Set<string> compilers = new Set<string> (); - Set<string> builtProjects = new Set<string> (); + Set<SolutionItem> builtProjects = new Set<SolutionItem> (); // Useful for cleaning up in case of a problem in generation List<string> generatedFiles = new List<string> (); @@ -85,10 +85,10 @@ namespace MonoDevelop.Autotools } } - Combine targetCombine; - public Combine TargetCombine { - get { return targetCombine; } - set { targetCombine = value; } + Solution targetSolution; + public Solution TargetSolution { + get { return targetSolution; } + set { targetSolution = value; } } public string EscapeAndUpperConfigName (string configName) @@ -177,12 +177,12 @@ namespace MonoDevelop.Autotools globalFilesReferences.Add (filePath); } - public void RegisterBuiltProject (string name) + public void RegisterBuiltProject (SolutionItem item) { - builtProjects.Add (name); + builtProjects.Add (item); } - public IEnumerable<string> GetBuiltProjects () + public IEnumerable<SolutionItem> GetBuiltProjects () { return builtProjects; } @@ -279,7 +279,7 @@ namespace MonoDevelop.Autotools // TODO: add an extension point with which addins can implement // autotools functionality. - public static IMakefileHandler GetMakefileHandler ( CombineEntry entry, MakefileType mt) + public static IMakefileHandler GetMakefileHandler (SolutionItem entry, MakefileType mt) { foreach (IMakefileHandler mh in AddinManager.GetExtensionObjects ("/MonoDevelop/Autotools/MakefileHandlers", typeof(IMakefileHandler), true)) { if (mh.CanDeploy (entry, mt)) diff --git a/main/src/addins/MonoDevelop.Autotools/ChangeLog b/main/src/addins/MonoDevelop.Autotools/ChangeLog index b93be1b989..c16e1f164c 100644 --- a/main/src/addins/MonoDevelop.Autotools/ChangeLog +++ b/main/src/addins/MonoDevelop.Autotools/ChangeLog @@ -1,3 +1,18 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * MakefileGeneratorTool.cs, IMakefileHandler.cs, + MonoDevelop.Autotools.addin.xml, ImportMakefileDialog.cs, + MakefileOptionPanelWidget.cs, MakefileReaderExtension.cs, + MakefileProject.cs, SolutionMakefileHandler.cs, + SimpleProjectMakefileHandler.cs, Handler.cs, SolutionDeployer.cs, + MakefileProjectServiceExtension.cs, MakefileOptionPanel.cs, + FileNodeBuilderExtension.cs, templates/autogen.sh.template, + templates/rules.make, GenerateMakefilesDialog.cs, + MakefileIntegrationFeature.cs, AutotoolsContext.cs, Commands.cs, + gtk-gui/MonoDevelop.Autotools.GenerateMakefilesDialog.cs, + gtk-gui/gui.stetic, TarballBuilderEditorWidget.cs, MakefileData.cs, + CustomMakefile.cs: New project model changes. + 2008-04-11 Lluis Sanchez Gual <lluis@novell.com> * gtk-gui/MonoDevelop.Autotools.TarballBuilderEditorWidget.cs: Updated. diff --git a/main/src/addins/MonoDevelop.Autotools/Commands.cs b/main/src/addins/MonoDevelop.Autotools/Commands.cs index bbef34bae6..6b9791f7e8 100644 --- a/main/src/addins/MonoDevelop.Autotools/Commands.cs +++ b/main/src/addins/MonoDevelop.Autotools/Commands.cs @@ -48,7 +48,7 @@ namespace MonoDevelop.Autotools { public override bool CanBuildNode (Type dataType) { - return typeof (CombineEntry).IsAssignableFrom (dataType); + return typeof (Solution).IsAssignableFrom (dataType) || typeof (SolutionItem).IsAssignableFrom (dataType); } public override Type CommandHandlerType { @@ -61,14 +61,14 @@ namespace MonoDevelop.Autotools [CommandHandler (Commands.GenerateFiles)] protected void OnGenerate() { - CombineEntry entry = (CombineEntry) CurrentNode.DataItem; - Combine combine = entry as Combine; - if (combine == null) { + SolutionItem entry = CurrentNode.DataItem as SolutionItem; + Solution solution = CurrentNode.DataItem as Solution; + if (solution == null) { AlertButton generateMakefilesButton = new AlertButton (GettextCatalog.GetString ("_Generate Makefiles")); - if (MessageService.AskQuestion (GettextCatalog.GetString ("Generating Makefiles is not supported for single projects. Do you want to generate them for the full solution - '{0}' ?", entry.RootCombine.Name), + if (MessageService.AskQuestion (GettextCatalog.GetString ("Generating Makefiles is not supported for single projects. Do you want to generate them for the full solution - '{0}' ?", entry.ParentSolution.Name), AlertButton.Cancel, generateMakefilesButton) == generateMakefilesButton) - combine = entry.RootCombine; + solution = ((SolutionItem)entry).ParentSolution; else return; } @@ -76,13 +76,13 @@ namespace MonoDevelop.Autotools DeployContext ctx = null; IProgressMonitor monitor = null; - GenerateMakefilesDialog dialog = new GenerateMakefilesDialog (combine); + GenerateMakefilesDialog dialog = new GenerateMakefilesDialog (solution); try { if (dialog.Run () != (int) Gtk.ResponseType.Ok) return; SolutionDeployer deployer = new SolutionDeployer (dialog.GenerateAutotools); - if ( deployer.HasGeneratedFiles ( combine ) ) + if ( deployer.HasGeneratedFiles ( solution ) ) { string msg = GettextCatalog.GetString ( "{0} already exist for this solution. Would you like to overwrite them?", dialog.GenerateAutotools ? "Autotools files" : "Makefiles" ); if (MonoDevelop.Core.Gui.MessageService.AskQuestion (msg, AlertButton.Cancel, AlertButton.OverwriteFile) != AlertButton.OverwriteFile) @@ -91,7 +91,7 @@ namespace MonoDevelop.Autotools ctx = new DeployContext (new TarballDeployTarget (dialog.GenerateAutotools), "Linux", null); monitor = IdeApp.Workbench.ProgressMonitors.GetOutputProgressMonitor ( GettextCatalog.GetString("Makefiles Output"), "md-package", true, true); - deployer.GenerateFiles (ctx, combine, dialog.DefaultConfiguration, monitor); + deployer.GenerateFiles (ctx, solution, dialog.DefaultConfiguration, monitor); } finally { dialog.Destroy (); if (ctx != null) diff --git a/main/src/addins/MonoDevelop.Autotools/CustomMakefile.cs b/main/src/addins/MonoDevelop.Autotools/CustomMakefile.cs index 320f244e9a..ea26afd967 100644 --- a/main/src/addins/MonoDevelop.Autotools/CustomMakefile.cs +++ b/main/src/addins/MonoDevelop.Autotools/CustomMakefile.cs @@ -246,6 +246,8 @@ namespace MonoDevelop.Autotools using (StreamWriter sw = new StreamWriter (fileName)) sw.Write (content); + + FileService.NotifyFileChanged (fileName); } void ThrowMakefileVarNotFound (string var) diff --git a/main/src/addins/MonoDevelop.Autotools/FileNodeBuilderExtension.cs b/main/src/addins/MonoDevelop.Autotools/FileNodeBuilderExtension.cs index e290c1db05..f4aed34257 100644 --- a/main/src/addins/MonoDevelop.Autotools/FileNodeBuilderExtension.cs +++ b/main/src/addins/MonoDevelop.Autotools/FileNodeBuilderExtension.cs @@ -30,7 +30,7 @@ namespace MonoDevelop.Autotools MakefileData data = project.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] as MakefileData; if (data != null && data.IntegrationEnabled) { data.SetFileExcluded (file.FilePath, !data.IsFileExcluded (file.FilePath)); - IdeApp.ProjectOperations.SaveProject (project); + IdeApp.ProjectOperations.Save (project); } } } diff --git a/main/src/addins/MonoDevelop.Autotools/GenerateMakefilesDialog.cs b/main/src/addins/MonoDevelop.Autotools/GenerateMakefilesDialog.cs index da515185dd..b4dc4124f8 100644 --- a/main/src/addins/MonoDevelop.Autotools/GenerateMakefilesDialog.cs +++ b/main/src/addins/MonoDevelop.Autotools/GenerateMakefilesDialog.cs @@ -2,6 +2,7 @@ using System; using MonoDevelop.Projects; +using MonoDevelop.Ide.Gui; namespace MonoDevelop.Autotools { @@ -10,14 +11,14 @@ namespace MonoDevelop.Autotools public partial class GenerateMakefilesDialog : Gtk.Dialog { - public GenerateMakefilesDialog (Combine combine) + public GenerateMakefilesDialog (Solution solution) { this.Build(); - for (int i = 0; i < combine.Configurations.Count; i ++) { - CombineConfiguration cc = (CombineConfiguration) combine.Configurations [i]; - comboConfigs.AppendText (cc.Name); - if (cc.Name == combine.ActiveConfiguration.Name) + for (int i = 0; i < solution.Configurations.Count; i ++) { + SolutionConfiguration cc = (SolutionConfiguration) solution.Configurations [i]; + comboConfigs.AppendText (cc.Id); + if (cc.Id == IdeApp.Workspace.ActiveConfiguration) comboConfigs.Active = i; } } diff --git a/main/src/addins/MonoDevelop.Autotools/Handler.cs b/main/src/addins/MonoDevelop.Autotools/Handler.cs index 6e44ffe186..5aa716e23b 100644 --- a/main/src/addins/MonoDevelop.Autotools/Handler.cs +++ b/main/src/addins/MonoDevelop.Autotools/Handler.cs @@ -2,6 +2,7 @@ using System; using System.Text; using System.Collections; +using System.Collections.Generic; using System.IO; using MonoDevelop.Core; @@ -70,19 +71,19 @@ namespace MonoDevelop.Autotools set { defaultConfig = value; } } - public override bool CanBuild (CombineEntry entry) + public override bool CanBuild (SolutionItem entry) { SolutionDeployer deployer = new SolutionDeployer (generateAutotools); return deployer.CanDeploy ( entry ); } - public override void InitializeSettings (CombineEntry entry) + public override void InitializeSettings (SolutionItem entry) { if (string.IsNullOrEmpty (targetDir)) targetDir = entry.BaseDirectory; if (string.IsNullOrEmpty (defaultConfig)) { - if (entry.ActiveConfiguration != null) - defaultConfig = entry.ActiveConfiguration.Name; + SolutionEntityItem se = entry as SolutionEntityItem; + defaultConfig = se != null ? se.GetConfigurations () [0] : null; } if (File.Exists (Path.Combine (entry.BaseDirectory, "autogen.sh")) || File.Exists (Path.Combine (entry.BaseDirectory, "configure"))) { @@ -93,58 +94,58 @@ namespace MonoDevelop.Autotools } - protected override void OnBuild (IProgressMonitor monitor, DeployContext ctx) + protected override bool OnBuild (IProgressMonitor monitor, DeployContext ctx) { string tmpFolder = FileService.CreateTempDirectory (); - Combine combine = null; - CombineEntry entry = RootCombineEntry; + Solution solution = null; + SolutionItem entry = RootSolutionItem; try { if (generateFiles) { - string[] childEntries; - if (entry is Combine) { - CombineEntry[] ents = GetChildEntries (); - childEntries = new string [ents.Length]; - for (int n=0; n<ents.Length; n++) - childEntries [n] = ents [n].FileName; + List<string> childEntries = new List<string> (); + if (entry is SolutionFolder) { + SolutionItem[] ents = GetChildEntries (); + foreach (SolutionItem it in ents) + childEntries.Add (it.ItemId); } else { // If the entry is not a combine, use the parent combine as base combine - childEntries = new string [] { entry.FileName }; - entry = entry.ParentCombine; + childEntries.Add (entry.ItemId); + entry = entry.ParentFolder; } + + string sourceFile; + if (entry is SolutionFolder) + sourceFile = entry.ParentSolution.FileName; + else + sourceFile = ((SolutionEntityItem)entry).FileName; - string efile = Services.ProjectService.Export (new FilteredProgressMonitor (monitor), entry.FileName, childEntries, tmpFolder, null); + string efile = Services.ProjectService.Export (new FilteredProgressMonitor (monitor), sourceFile, childEntries.ToArray (), tmpFolder, null); if (efile == null) { monitor.ReportError (GettextCatalog.GetString ("The project could not be exported."), null); - return; + return false; } - combine = Services.ProjectService.ReadCombineEntry (efile, new NullProgressMonitor ()) as Combine; + solution = Services.ProjectService.ReadWorkspaceItem (new NullProgressMonitor (), efile) as Solution; } else { - if (entry is Combine) - combine = (Combine) entry; - else - combine = entry.ParentCombine; + solution = entry.ParentSolution; } - combine.Build (monitor); + solution.Build (monitor, defaultConfig); if (monitor.IsCancelRequested || !monitor.AsyncOperation.Success) - return; + return false; SolutionDeployer deployer = new SolutionDeployer (generateAutotools); - - if (DefaultConfiguration == null || DefaultConfiguration == "") - deployer.Deploy ( ctx, combine, TargetDir, generateFiles, monitor ); - else - deployer.Deploy ( ctx, combine, DefaultConfiguration, TargetDir, generateFiles, monitor ); + if (!deployer.Deploy ( ctx, solution, DefaultConfiguration, TargetDir, generateFiles, monitor )) + return false; } finally { - if (combine != null) - combine.Dispose (); + if (solution != null) + solution.Dispose (); Directory.Delete (tmpFolder, true); } + return true; } protected override string OnResolveDirectory (DeployContext ctx, string folderId) diff --git a/main/src/addins/MonoDevelop.Autotools/IMakefileHandler.cs b/main/src/addins/MonoDevelop.Autotools/IMakefileHandler.cs index 34295cd355..ac4a8ed108 100644 --- a/main/src/addins/MonoDevelop.Autotools/IMakefileHandler.cs +++ b/main/src/addins/MonoDevelop.Autotools/IMakefileHandler.cs @@ -29,9 +29,9 @@ namespace MonoDevelop.Autotools { public interface IMakefileHandler { - bool CanDeploy (CombineEntry entry, MakefileType type); + bool CanDeploy (SolutionItem entry, MakefileType type); - Makefile Deploy (AutotoolsContext ctx, CombineEntry entry, IProgressMonitor monitor); + Makefile Deploy (AutotoolsContext ctx, SolutionItem entry, IProgressMonitor monitor); } public enum MakefileType diff --git a/main/src/addins/MonoDevelop.Autotools/ImportMakefileDialog.cs b/main/src/addins/MonoDevelop.Autotools/ImportMakefileDialog.cs index 447be67c28..9fc6c50744 100644 --- a/main/src/addins/MonoDevelop.Autotools/ImportMakefileDialog.cs +++ b/main/src/addins/MonoDevelop.Autotools/ImportMakefileDialog.cs @@ -63,7 +63,10 @@ namespace MonoDevelop.Autotools return false; } project.Name = nameEntry.Text; - return optionsWidget.Store (project); + if (!optionsWidget.ValidateChanges (project)) + return false; + optionsWidget.Store (project); + return true; } } } diff --git a/main/src/addins/MonoDevelop.Autotools/MakefileData.cs b/main/src/addins/MonoDevelop.Autotools/MakefileData.cs index 87dcfb66c0..dba79d2249 100644 --- a/main/src/addins/MonoDevelop.Autotools/MakefileData.cs +++ b/main/src/addins/MonoDevelop.Autotools/MakefileData.cs @@ -704,15 +704,23 @@ namespace MonoDevelop.Autotools ProjectRefVar.Extra.Clear (); existingGacRefs = new Dictionary<string, ProjectReference> (); + requiredPackageVersions = new Dictionary<string,string> (); newGacRefs = new Dictionary<string, ProjectReference> (); List<ProjectReference> toRemove = new List<ProjectReference> (); - foreach (ProjectReference pref in OwnerProject.ProjectReferences) { + foreach (ProjectReference pref in dotnetProject.References) { if (pref.ReferenceType == ReferenceType.Gac) { - string [] files = pref.GetReferencedFileNames (); + string [] files = pref.GetReferencedFileNames (ProjectService.DefaultConfiguration); if (files == null) continue; + if (pref.ReferenceType == ReferenceType.Gac) { + // Store the package version required by this reference. We'll use + // the same version when trying to match references coming from the makefile + SystemPackage pkg = Runtime.SystemAssemblyService.GetPackageFromFullName (pref.StoredReference); + if (pkg != null) + requiredPackageVersions [pkg.Name] = pkg.Version; + } // this should help normalize paths like /foo//bar/../ string fullpath = Path.GetFullPath (files [0]); if (existingGacRefs.ContainsKey (fullpath)) @@ -724,7 +732,7 @@ namespace MonoDevelop.Autotools // Remove the repeats foreach (ProjectReference pref in toRemove) - OwnerProject.ProjectReferences.Remove (pref); + dotnetProject.References.Remove (pref); ReadReferences (GacRefVar, ReferenceType.Gac, "Gac References", dotnetProject); @@ -737,11 +745,11 @@ namespace MonoDevelop.Autotools //Resolve References //Required when UpdateProject gets called by ui - if (ownerProject.RootCombine != null) - ResolveProjectReferences (ownerProject.RootCombine, monitor); + if (ownerProject.ParentSolution != null) + ResolveProjectReferences (ownerProject.ParentSolution.RootFolder, monitor); foreach (ProjectReference pr in existingGacRefs.Values) - ownerProject.ProjectReferences.Remove (pr); + dotnetProject.References.Remove (pr); existingGacRefs.Clear (); newGacRefs.Clear (); @@ -798,7 +806,7 @@ namespace MonoDevelop.Autotools len = fileVar.Prefix.Length; Dictionary<string, ProjectFile> existingFiles = new Dictionary<string, ProjectFile> (); - foreach (ProjectFile pf in ownerProject.ProjectFiles) { + foreach (ProjectFile pf in ownerProject.Files) { if (pf.BuildAction == buildAction) existingFiles [ownerProject.GetAbsoluteChildPath (pf.FilePath)] = pf; } @@ -875,13 +883,14 @@ namespace MonoDevelop.Autotools if (existingFiles.Count > 0) { foreach (ProjectFile file in existingFiles.Values) { if (!IsFileExcluded (file.FilePath)) - ownerProject.ProjectFiles.Remove (file); + ownerProject.Files.Remove (file); } } } Dictionary<string, ProjectReference> existingGacRefs = null; Dictionary<string, ProjectReference> newGacRefs = null; + Dictionary<string, string> requiredPackageVersions = null; void ReadReferences (MakefileVar refVar, ReferenceType refType, string id, DotNetProject project) { @@ -1045,7 +1054,13 @@ namespace MonoDevelop.Autotools bool LoadPackageReference (string pkgName, DotNetProject project, string prefix) { - SystemPackage pkg = Runtime.SystemAssemblyService.GetPackage (pkgName); + SystemPackage pkg = null; + string packageVersion; + if (requiredPackageVersions.TryGetValue (pkgName, out packageVersion)) + pkg = Runtime.SystemAssemblyService.GetPackage (pkgName, packageVersion); + if (pkg == null) + pkg = Runtime.SystemAssemblyService.GetPackage (pkgName); + if (pkg == null) { LoggingService.LogWarning ("No package named '{0}' found. Ignoring.", pkgName); return false; @@ -1136,26 +1151,27 @@ namespace MonoDevelop.Autotools return null; } - ProjectReference AddNewGacReference (Project project, string fullname, string fullpath) + ProjectReference AddNewGacReference (DotNetProject project, string fullname, string fullpath) { ProjectReference pref = new ProjectReference (ReferenceType.Gac, fullname); - project.ProjectReferences.Add (pref); + project.References.Add (pref); newGacRefs [fullpath] = pref; return pref; } - public static void ResolveProjectReferences (Combine c, IProgressMonitor monitor) + public static void ResolveProjectReferences (SolutionFolder folder, IProgressMonitor monitor) { - Dictionary<string, Project> projects = new Dictionary<string, Project> (); - foreach (Project p in c.GetAllProjects ()) { - string filename = p.GetOutputFileName (); + Dictionary<string, DotNetProject> projects = new Dictionary<string, DotNetProject> (); + string defConfig = ProjectService.DefaultConfiguration; + foreach (DotNetProject p in folder.GetAllItems<DotNetProject> ()) { + string filename = p.GetOutputFileName (defConfig); // Can be null for Generic projects if (!String.IsNullOrEmpty (filename)) projects [filename] = p; } - foreach (Project sproj in projects.Values) { + foreach (DotNetProject sproj in projects.Values) { MakefileData mdata = sproj.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] as MakefileData; if (mdata == null) continue; @@ -1165,12 +1181,12 @@ namespace MonoDevelop.Autotools Dictionary<string, ProjectReference> asmProjectRefs = new Dictionary<string, ProjectReference> (); - foreach (ProjectReference pr in sproj.ProjectReferences) { + foreach (ProjectReference pr in sproj.References) { if (pr.ReferenceType != ReferenceType.Assembly && pr.ReferenceType != ReferenceType.Project) continue; - string [] files = pr.GetReferencedFileNames (); + string [] files = pr.GetReferencedFileNames (defConfig); if (files.Length > 0) asmProjectRefs [files [0]] = pr; } @@ -1184,7 +1200,7 @@ namespace MonoDevelop.Autotools } else { // Try as a project ref if (projects.ContainsKey (refstr)) { - sproj.ProjectReferences.Add (new ProjectReference (projects [refstr])); + sproj.References.Add (new ProjectReference (projects [refstr])); toRemove.Add (refstr); } } @@ -1195,11 +1211,11 @@ namespace MonoDevelop.Autotools // Add all remaining unresolved refs as Assembly refs foreach (string s in mdata.UnresolvedReferences.Keys) - sproj.ProjectReferences.Add (new ProjectReference (ReferenceType.Assembly, s)); + sproj.References.Add (new ProjectReference (ReferenceType.Assembly, s)); // Remove asm/project refs not found in UnresolvedReferences foreach (ProjectReference pr in asmProjectRefs.Values) - sproj.ProjectReferences.Remove (pr); + sproj.References.Remove (pr); mdata.UnresolvedReferences.Clear (); } @@ -1362,7 +1378,7 @@ namespace MonoDevelop.Autotools } List<string> files = new List<string> (); - foreach (ProjectFile pf in OwnerProject.ProjectFiles) { + foreach (ProjectFile pf in OwnerProject.Files) { if (pf.Subtype != Subtype.Code) continue; if (IsFileExcluded (pf.FilePath)) @@ -1426,7 +1442,7 @@ namespace MonoDevelop.Autotools // key -> pkgname, emit as -pkg:$key Dictionary<string, bool> hasAcSubstPackages = new Dictionary<string, bool> (); - foreach (ProjectReference pr in OwnerProject.ProjectReferences) { + foreach (ProjectReference pr in ((DotNetProject)OwnerProject).References) { if (pr.ReferenceType != refType) continue; @@ -1493,7 +1509,7 @@ namespace MonoDevelop.Autotools } if (pkg == null) - return AsmRefToString (pr.GetReferencedFileNames () [0], refVar, false); + return AsmRefToString (pr.GetReferencedFileNames (ProjectService.DefaultConfiguration) [0], refVar, false); // Reference is from a package @@ -1555,7 +1571,7 @@ namespace MonoDevelop.Autotools string ProjectRefToString (ProjectReference pr, MakefileVar refVar) { - string [] tmp = pr.GetReferencedFileNames (); + string [] tmp = pr.GetReferencedFileNames (ProjectService.DefaultConfiguration); if (tmp == null || tmp.Length == 0) //Reference not found, ignoring return null; diff --git a/main/src/addins/MonoDevelop.Autotools/MakefileGeneratorTool.cs b/main/src/addins/MonoDevelop.Autotools/MakefileGeneratorTool.cs index 0c5febd3c3..8c483aff93 100644 --- a/main/src/addins/MonoDevelop.Autotools/MakefileGeneratorTool.cs +++ b/main/src/addins/MonoDevelop.Autotools/MakefileGeneratorTool.cs @@ -49,21 +49,21 @@ namespace MonoDevelop.Autotools Console.WriteLine (GettextCatalog.GetString ("Loading solution file {0}", filename)); ConsoleProgressMonitor monitor = new ConsoleProgressMonitor (); - CombineEntry centry = Services.ProjectService.ReadCombineEntry (filename, monitor); - Combine combine = centry as Combine; - if (combine == null) { + + Solution solution = Services.ProjectService.ReadWorkspaceItem (monitor, filename) as Solution; + if (solution == null) { Console.WriteLine (GettextCatalog.GetString ("Error: Makefile generation supported only for solutions.\n")); return 1; } - if (defaultConfig == null || !CheckValidConfig (combine, defaultConfig)) { + if (defaultConfig == null || !CheckValidConfig (solution, defaultConfig)) { Console.WriteLine (GettextCatalog.GetString ("\nInvalid configuration {0}. Valid configurations : ", defaultConfig)); - for (int i = 0; i < combine.Configurations.Count; i ++) { - CombineConfiguration cc = (CombineConfiguration) combine.Configurations [i]; - Console.WriteLine ("\t{0}. {1}", i + 1, cc.Name); + for (int i = 0; i < solution.Configurations.Count; i ++) { + SolutionConfiguration cc = (SolutionConfiguration) solution.Configurations [i]; + Console.WriteLine ("\t{0}. {1}", i + 1, cc.Id); } - int configCount = combine.Configurations.Count; + int configCount = solution.Configurations.Count; int op = 0; do { Console.Write (GettextCatalog.GetString ("Select configuration : ")); @@ -76,12 +76,12 @@ namespace MonoDevelop.Autotools } } while (true); - defaultConfig = combine.Configurations [op - 1].Name; + defaultConfig = solution.Configurations [op - 1].Id; } SolutionDeployer deployer = new SolutionDeployer (generateAutotools); - if (deployer.HasGeneratedFiles (combine)) { + if (deployer.HasGeneratedFiles (solution)) { string msg = GettextCatalog.GetString ( "{0} already exist for this solution. Would you like to overwrite them? (Y/N)", generateAutotools ? "Autotools files" : "Makefiles" ); bool op = false; @@ -114,7 +114,7 @@ namespace MonoDevelop.Autotools DeployContext ctx = new DeployContext (new TarballDeployTarget (), "Linux", null); try { - deployer.GenerateFiles (ctx, combine, defaultConfig, monitor); + deployer.GenerateFiles (ctx, solution, defaultConfig, monitor); } finally { ctx.Dispose (); @@ -135,10 +135,10 @@ namespace MonoDevelop.Autotools Console.WriteLine (); } - bool CheckValidConfig (Combine combine, string config) + bool CheckValidConfig (Solution sol, string config) { - foreach (IConfiguration iconf in combine.Configurations) - if (String.Compare (iconf.Name, config, true) == 0) + foreach (SolutionConfiguration iconf in sol.Configurations) + if (String.Compare (iconf.Id, config, true) == 0) return true; return false; diff --git a/main/src/addins/MonoDevelop.Autotools/MakefileIntegrationFeature.cs b/main/src/addins/MonoDevelop.Autotools/MakefileIntegrationFeature.cs index 1c3cfd8c07..c52319e850 100644 --- a/main/src/addins/MonoDevelop.Autotools/MakefileIntegrationFeature.cs +++ b/main/src/addins/MonoDevelop.Autotools/MakefileIntegrationFeature.cs @@ -7,7 +7,7 @@ using Gtk; namespace MonoDevelop.Autotools { - class MakefileIntegrationFeature: ICombineEntryFeature + class MakefileIntegrationFeature: ISolutionItemFeature { public string Title { get { return GettextCatalog.GetString ("Makefile Integration"); } @@ -17,27 +17,27 @@ namespace MonoDevelop.Autotools get { return string.Empty; } } - public bool SupportsCombineEntry (Combine parentCombine, CombineEntry entry) + public bool SupportsSolutionItem (SolutionFolder parentCombine, SolutionItem entry) { return entry is Project; } - public Widget CreateFeatureEditor (Combine parentCombine, CombineEntry entry) + public Widget CreateFeatureEditor (SolutionFolder parentCombine, SolutionItem entry) { return new MakefileIntegrationFeatureWidget ((Project)entry); } - public void ApplyFeature (Combine parentCombine, CombineEntry entry, Widget editor) + public void ApplyFeature (SolutionFolder parentCombine, SolutionItem entry, Widget editor) { ((MakefileIntegrationFeatureWidget)editor).Store (); } - public string Validate (Combine parentCombine, CombineEntry entry, Gtk.Widget editor) + public string Validate (SolutionFolder parentCombine, SolutionItem entry, Gtk.Widget editor) { return null; } - public bool IsEnabled (Combine parentCombine, CombineEntry entry) + public bool IsEnabled (SolutionFolder parentCombine, SolutionItem entry) { return false; } diff --git a/main/src/addins/MonoDevelop.Autotools/MakefileOptionPanel.cs b/main/src/addins/MonoDevelop.Autotools/MakefileOptionPanel.cs index 1502925ebb..ec98ce7b2a 100644 --- a/main/src/addins/MonoDevelop.Autotools/MakefileOptionPanel.cs +++ b/main/src/addins/MonoDevelop.Autotools/MakefileOptionPanel.cs @@ -2,7 +2,7 @@ using System; using System.IO; using MonoDevelop.Core; -using MonoDevelop.Core.Gui.Dialogs; +using MonoDevelop.Projects.Gui.Dialogs; using MonoDevelop.Ide.Gui; using MonoDevelop.Projects; @@ -10,7 +10,7 @@ using Gtk; namespace MonoDevelop.Autotools { - public class MakefileOptionPanel : AbstractOptionPanel + public class MakefileOptionPanel : ItemOptionsPanel { MakefileOptionPanelWidget widget; @@ -18,26 +18,26 @@ namespace MonoDevelop.Autotools { } - public override void LoadPanelContents() + public override Widget CreatePanelWidget() { - try { - Project project = ((Properties) CustomizationObject).Get<Project> ("Project"); - MakefileData data = project.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] as MakefileData; + Project project = ConfiguredProject; + MakefileData data = project.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] as MakefileData; - MakefileData tmpData = null; - if (data != null) { - tmpData = (MakefileData) data.Clone (); - } - Add (widget = new MakefileOptionPanelWidget (project, tmpData)); - } catch (Exception ex) { - Console.WriteLine (ex); + MakefileData tmpData = null; + if (data != null) { + tmpData = (MakefileData) data.Clone (); } + return (widget = new MakefileOptionPanelWidget (project, tmpData)); } - public override bool StorePanelContents() + public override bool ValidateChanges () { - Project project = ((Properties) CustomizationObject).Get<Project> ("Project"); - return widget.Store (project); + return widget.ValidateChanges (ConfiguredProject); + } + + public override void ApplyChanges () + { + widget.Store (ConfiguredProject); } } } diff --git a/main/src/addins/MonoDevelop.Autotools/MakefileOptionPanelWidget.cs b/main/src/addins/MonoDevelop.Autotools/MakefileOptionPanelWidget.cs index 649224b198..31475fb35b 100644 --- a/main/src/addins/MonoDevelop.Autotools/MakefileOptionPanelWidget.cs +++ b/main/src/addins/MonoDevelop.Autotools/MakefileOptionPanelWidget.cs @@ -92,7 +92,7 @@ namespace MonoDevelop.Autotools this.fileEntryConfigureInPath.Path = data.AbsoluteConfigureInPath; if (String.IsNullOrEmpty (data.AbsoluteConfigureInPath)) - this.fileEntryConfigureInPath.DefaultPath = project.RootCombine.BaseDirectory; + this.fileEntryConfigureInPath.DefaultPath = project.ParentSolution.BaseDirectory; else this.fileEntryConfigureInPath.DefaultPath = data.AbsoluteConfigureInPath; @@ -133,7 +133,7 @@ namespace MonoDevelop.Autotools //comboAssemblyName, comboOutputDir}; } - public bool Store (Project project) + public bool ValidateChanges (Project project) { data.IntegrationEnabled = this.cbEnableMakefileIntegration.Active; data.RelativeMakefileName = this.fileEntryMakefilePath.Path; @@ -269,6 +269,11 @@ namespace MonoDevelop.Autotools return true; } + public void Store (Project project) + { + // FIXME: Storing currently done in ValidateChanges. It should be done here. + } + bool CheckNonEmptyFileVar (MakefileVar var, string id) { if (var.Sync && String.IsNullOrEmpty (var.Name.Trim ())) { diff --git a/main/src/addins/MonoDevelop.Autotools/MakefileProject.cs b/main/src/addins/MonoDevelop.Autotools/MakefileProject.cs index 42d908a4d7..54e81e2bf3 100644 --- a/main/src/addins/MonoDevelop.Autotools/MakefileProject.cs +++ b/main/src/addins/MonoDevelop.Autotools/MakefileProject.cs @@ -10,7 +10,7 @@ namespace MonoDevelop.Autotools { } - public override IConfiguration CreateConfiguration (string name) + public override SolutionItemConfiguration CreateConfiguration (string name) { MakefileProjectConfiguration conf = new MakefileProjectConfiguration (); conf.Name = name; @@ -24,7 +24,7 @@ namespace MonoDevelop.Autotools } - public class MakefileProjectConfiguration: AbstractProjectConfiguration + public class MakefileProjectConfiguration: ProjectConfiguration { } } diff --git a/main/src/addins/MonoDevelop.Autotools/MakefileProjectServiceExtension.cs b/main/src/addins/MonoDevelop.Autotools/MakefileProjectServiceExtension.cs index 64a0ed3fec..12c61519d6 100644 --- a/main/src/addins/MonoDevelop.Autotools/MakefileProjectServiceExtension.cs +++ b/main/src/addins/MonoDevelop.Autotools/MakefileProjectServiceExtension.cs @@ -34,7 +34,6 @@ using MonoDevelop.Projects; using System; using System.CodeDom.Compiler; -using System.Collections.Specialized; using System.Collections.Generic; using System.IO; using System.Text; @@ -44,33 +43,33 @@ namespace MonoDevelop.Autotools { public class MakefileProjectServiceExtension : ProjectServiceExtension { - bool hasParentCombine = false; - - public override CombineEntry Load (IProgressMonitor monitor, string fileName) + public override WorkspaceItem LoadWorkspaceItem (IProgressMonitor monitor, string fileName) { - bool oldHasParentCombine = hasParentCombine; - hasParentCombine = true; - CombineEntry entry = base.Load (monitor, fileName); - if (entry == null) - return null; + WorkspaceItem item = base.LoadWorkspaceItem (monitor, fileName); - Combine c = entry as Combine; - if (c != null && !oldHasParentCombine) { - hasParentCombine = false; - + Solution sol = item as Solution; + if (sol != null) { //Resolve project references try { - MakefileData.ResolveProjectReferences (c, monitor); + MakefileData.ResolveProjectReferences (sol.RootFolder, monitor); } catch (Exception e) { LoggingService.LogError (GettextCatalog.GetString ( - "Error resolving Makefile based project references for solution {0}", c.Name), e); + "Error resolving Makefile based project references for solution {0}", sol.Name), e); monitor.ReportError (GettextCatalog.GetString ( - "Error resolving Makefile based project references for solution {0}", c.Name), e); + "Error resolving Makefile based project references for solution {0}", sol.Name), e); } - - return entry; } + + return item; + } + + protected override SolutionEntityItem LoadSolutionItem (IProgressMonitor monitor, string fileName) + { + SolutionEntityItem entry = base.LoadSolutionItem (monitor, fileName); + if (entry == null) + return null; + Project project = entry as Project; if (project == null) return entry; @@ -93,11 +92,11 @@ namespace MonoDevelop.Autotools monitor.EndTask (); } - entry.NeedsBuilding = false; + entry.SetNeedsBuilding (false); return entry; } - public override void Save (IProgressMonitor monitor, CombineEntry entry) + public override void Save (IProgressMonitor monitor, SolutionEntityItem entry) { base.Save (monitor, entry); @@ -119,9 +118,9 @@ namespace MonoDevelop.Autotools } } - public override StringCollection GetExportFiles (CombineEntry entry) + public override List<string> GetItemFiles (SolutionEntityItem entry, bool includeReferencedFiles) { - StringCollection col = base.GetExportFiles (entry); + List<string> col = base.GetItemFiles (entry, includeReferencedFiles); MakefileData data = entry.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] as MakefileData; if (data == null || !data.IntegrationEnabled || string.IsNullOrEmpty (data.AbsoluteMakefileName)) @@ -133,21 +132,21 @@ namespace MonoDevelop.Autotools //TODO - public override bool GetNeedsBuilding (CombineEntry entry) + protected override bool GetNeedsBuilding (SolutionEntityItem entry, string configuration) { - return base.GetNeedsBuilding (entry); + return base.GetNeedsBuilding (entry, configuration); } //FIXME: Check whether autogen.sh is required or not - public override ICompilerResult Build (IProgressMonitor monitor, CombineEntry entry) + protected override ICompilerResult Build (IProgressMonitor monitor, SolutionEntityItem entry, string configuration) { Project project = entry as Project; if (project == null) - return base.Build (monitor, entry); + return base.Build (monitor, entry, configuration); MakefileData data = project.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] as MakefileData; if (data == null || !data.IntegrationEnabled || String.IsNullOrEmpty (data.BuildTargetName)) - return base.Build (monitor, entry); + return base.Build (monitor, entry, configuration); //FIXME: Gen autofoo ? autoreconf? @@ -195,7 +194,7 @@ namespace MonoDevelop.Autotools if (exitCode != 0 && cr.FailedBuildCount == 0) cr.AddError (GettextCatalog.GetString ("Build failed. See Build Output panel.")); else - entry.NeedsBuilding = false; + entry.SetNeedsBuilding (false, configuration); return cr; } @@ -323,17 +322,17 @@ namespace MonoDevelop.Autotools return null; } - public override void Clean (IProgressMonitor monitor, CombineEntry entry) + protected override void Clean (IProgressMonitor monitor, SolutionEntityItem entry, string configuration) { Project proj = entry as Project; if (proj == null) { - base.Clean (monitor, entry); + base.Clean (monitor, entry, configuration); return; } MakefileData data = proj.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] as MakefileData; if (data == null || !data.IntegrationEnabled || String.IsNullOrEmpty (data.CleanTargetName)) { - base.Clean (monitor, entry); + base.Clean (monitor, entry, configuration); return; } @@ -367,17 +366,17 @@ namespace MonoDevelop.Autotools monitor.ReportSuccess ( GettextCatalog.GetString ( "Project successfully cleaned")); } - public override void Execute (IProgressMonitor monitor, CombineEntry entry, ExecutionContext context) + protected override void Execute (IProgressMonitor monitor, SolutionEntityItem entry, ExecutionContext context, string configuration) { Project project = entry as Project; if (project == null) { - base.Execute (monitor, entry, context); + base.Execute (monitor, entry, context, configuration); return; } MakefileData data = project.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] as MakefileData; if (data == null || !data.IntegrationEnabled || String.IsNullOrEmpty (data.ExecuteTargetName)) { - base.Execute (monitor, entry, context); + base.Execute (monitor, entry, context, configuration); return; } diff --git a/main/src/addins/MonoDevelop.Autotools/MakefileReaderExtension.cs b/main/src/addins/MonoDevelop.Autotools/MakefileReaderExtension.cs index cddbe524ae..da9b88f173 100644 --- a/main/src/addins/MonoDevelop.Autotools/MakefileReaderExtension.cs +++ b/main/src/addins/MonoDevelop.Autotools/MakefileReaderExtension.cs @@ -11,18 +11,18 @@ namespace MonoDevelop.Autotools { public class MakefileReaderExtension: ProjectServiceExtension { - public override bool IsCombineEntryFile (string fileName) + public override bool IsSolutionItemFile (string fileName) { if (Path.GetFileNameWithoutExtension (fileName) == "Makefile") return true; else - return base.IsCombineEntryFile (fileName); + return base.IsSolutionItemFile (fileName); } - public override CombineEntry Load (IProgressMonitor monitor, string fileName) + protected override SolutionEntityItem LoadSolutionItem (IProgressMonitor monitor, string fileName) { if (Path.GetFileNameWithoutExtension (fileName) != "Makefile") - return base.Load (monitor, fileName); + return base.LoadSolutionItem (monitor, fileName); // Use Makefile.am instead of Makefile if it exists if (Path.GetFileName (fileName) == "Makefile") { @@ -33,7 +33,7 @@ namespace MonoDevelop.Autotools string projectFile = fileName + ".mdp"; if (File.Exists (projectFile)) - return base.Load (monitor, projectFile); + return base.LoadSolutionItem (monitor, projectFile); MakefileProject project = new MakefileProject (); @@ -51,7 +51,7 @@ namespace MonoDevelop.Autotools return null; project.Save (projectFile, monitor); - return base.Load (monitor, projectFile); + return base.LoadSolutionItem (monitor, projectFile); } void ImportProject (Project project, IProgressMonitor monitor, string fileName) diff --git a/main/src/addins/MonoDevelop.Autotools/MonoDevelop.Autotools.addin.xml b/main/src/addins/MonoDevelop.Autotools/MonoDevelop.Autotools.addin.xml index 7b5dec45f2..9cbd7da7ec 100644 --- a/main/src/addins/MonoDevelop.Autotools/MonoDevelop.Autotools.addin.xml +++ b/main/src/addins/MonoDevelop.Autotools/MonoDevelop.Autotools.addin.xml @@ -57,7 +57,7 @@ </Category> </Extension> - <Extension path = "/MonoDevelop/Ide/ContextMenu/ProjectPad/Combine/Tools"> + <Extension path = "/MonoDevelop/Ide/ContextMenu/ProjectPad/Solution/Tools"> <CommandItem id = "MonoDevelop.Autotools.Commands.GenerateFiles" insertafter="ExportListSeparator"/> </Extension> @@ -89,8 +89,8 @@ <DataType class = "MonoDevelop.Autotools.TarballDeployTarget" /> </Extension> - <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/GeneralOptions/Common"> - <DialogPanel id= "Makefile" _label = "Makefile Integration" + <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/Common"> + <Section id= "Makefile" _label = "Makefile Integration" class = "MonoDevelop.Autotools.MakefileOptionPanel" /> </Extension> diff --git a/main/src/addins/MonoDevelop.Autotools/SimpleProjectMakefileHandler.cs b/main/src/addins/MonoDevelop.Autotools/SimpleProjectMakefileHandler.cs index 59abc2c9be..2ab1e186fe 100644 --- a/main/src/addins/MonoDevelop.Autotools/SimpleProjectMakefileHandler.cs +++ b/main/src/addins/MonoDevelop.Autotools/SimpleProjectMakefileHandler.cs @@ -40,7 +40,7 @@ namespace MonoDevelop.Autotools // Handle files to be deployed Dictionary<string, StringBuilder> deployDirs; Dictionary<string, string> deployFileVars; - Dictionary<string, DeployFile> allDeployVars; + Dictionary<string, DeployFileData> allDeployVars; List<string> builtFiles; StringBuilder deployFileCopyVars; @@ -69,7 +69,7 @@ namespace MonoDevelop.Autotools // store all refs for easy access Set<SystemPackage> pkgs; - public bool CanDeploy (CombineEntry entry, MakefileType type) + public bool CanDeploy (SolutionItem entry, MakefileType type) { Project project = entry as Project; if ( project == null ) return false; @@ -77,7 +77,7 @@ namespace MonoDevelop.Autotools return true; } - ISimpleAutotoolsSetup FindSetupForProject ( Project project ) + ISimpleAutotoolsSetup FindSetupForProject (Project project) { object[] items = AddinManager.GetExtensionObjects ("/MonoDevelop/Autotools/SimpleSetups", typeof(ISimpleAutotoolsSetup)); foreach ( ISimpleAutotoolsSetup setup in items) @@ -87,7 +87,7 @@ namespace MonoDevelop.Autotools return null; } - public Makefile Deploy ( AutotoolsContext ctx, CombineEntry entry, IProgressMonitor monitor ) + public Makefile Deploy (AutotoolsContext ctx, SolutionItem entry, IProgressMonitor monitor) { generateAutotools = ctx.MakefileType == MakefileType.AutotoolsMakefile; @@ -130,7 +130,8 @@ namespace MonoDevelop.Autotools string includes = String.Empty; string references, dllReferences; - ProcessProjectReferences (project, out references, out dllReferences, ctx); + DotNetProject netProject = project as DotNetProject; + ProcessProjectReferences (netProject, out references, out dllReferences, ctx); templateEngine.Variables["REFERENCES"] = references; templateEngine.Variables["DLL_REFERENCES"] = dllReferences; @@ -141,7 +142,7 @@ namespace MonoDevelop.Autotools templateEngine.Variables ["RESGEN"] = (dotnetProject.ClrVersion == ClrVersion.Net_2_0) ? "resgen2" : "resgen"; string pfpath = null; - foreach (ProjectFile projectFile in project.ProjectFiles) + foreach (ProjectFile projectFile in project.Files) { pfpath = (PlatformID.Unix == Environment.OSVersion.Platform) ? projectFile.RelativePath : projectFile.RelativePath.Replace("\\","/"); pfpath = FileService.NormalizeRelativePath (pfpath); @@ -211,13 +212,13 @@ namespace MonoDevelop.Autotools conf_vars.AppendFormat ("srcdir=.\n"); conf_vars.AppendFormat ("top_srcdir={0}\n\n", - FileService.AbsoluteToRelativePath (project.BaseDirectory, ctx.TargetCombine.BaseDirectory)); + FileService.AbsoluteToRelativePath (project.BaseDirectory, ctx.TargetSolution.BaseDirectory)); conf_vars.AppendFormat ("include $(top_srcdir)/config.make\n\n"); // Don't emit for top level project makefile(eg. pdn.make), as it would be // included by top level solution makefile - if (ctx.TargetCombine.BaseDirectory != project.BaseDirectory){ + if (ctx.TargetSolution.BaseDirectory != project.BaseDirectory){ string customhooks = Path.Combine (project.BaseDirectory, "custom-hooks.make"); bool include = File.Exists (customhooks); @@ -230,29 +231,27 @@ namespace MonoDevelop.Autotools bool buildEnabled; List<ConfigSection> configSections = new List<ConfigSection> (); - allDeployVars = new Dictionary<string, DeployFile> (); + allDeployVars = new Dictionary<string, DeployFileData> (); - IConfiguration saveConfiguration = ctx.TargetCombine.ActiveConfiguration; - foreach (CombineConfiguration combineConfig in ctx.TargetCombine.Configurations) + foreach (SolutionConfiguration combineConfig in ctx.TargetSolution.Configurations) { - ctx.TargetCombine.ActiveConfiguration = combineConfig; - DotNetProjectConfiguration config = GetProjectConfig (combineConfig.Name, project, out buildEnabled) as DotNetProjectConfiguration; + DotNetProjectConfiguration config = GetProjectConfig (combineConfig.Id, project, out buildEnabled) as DotNetProjectConfiguration; if (config == null) continue; - ConfigSection configSection = new ConfigSection (combineConfig.Name); + ConfigSection configSection = new ConfigSection (combineConfig.Id); string assembly = (PlatformID.Unix == Environment.OSVersion.Platform) ? project.GetRelativeChildPath ( config.CompiledOutputName ) : project.GetRelativeChildPath ( config.CompiledOutputName ).Replace("\\","/"); configSection.BuildVariablesBuilder.AppendFormat ("ASSEMBLY_COMPILER_COMMAND = {0}\n", - setup.GetCompilerCommand ( project, config.Name ) ); + setup.GetCompilerCommand ( project, config.Id ) ); configSection.BuildVariablesBuilder.AppendFormat ("ASSEMBLY_COMPILER_FLAGS = {0}\n", - setup.GetCompilerFlags ( project, config.Name ) ); + setup.GetCompilerFlags ( project, config.Id ) ); // add check for compiler command in configure.ac - ctx.AddCommandCheck ( setup.GetCompilerCommand ( project, config.Name ) ); + ctx.AddCommandCheck ( setup.GetCompilerCommand ( project, config.Id ) ); configSection.BuildVariablesBuilder.AppendFormat ("ASSEMBLY = {0}\n", AutotoolsContext.EscapeStringForAutomake (assembly)); @@ -282,13 +281,13 @@ namespace MonoDevelop.Autotools // for project references, we need a ref to the dll for the current configuration StringWriter projectReferences = new StringWriter(); string pref = null; - foreach (ProjectReference reference in project.ProjectReferences) + foreach (ProjectReference reference in netProject.References) { if (reference.ReferenceType != ReferenceType.Project) continue; - Project refp = GetProjectFromName (reference.Reference, ctx.TargetCombine); + Project refp = GetProjectFromName (reference.Reference, ctx.TargetSolution); - DotNetProjectConfiguration dnpc = GetProjectConfig (combineConfig.Name, refp, out buildEnabled) as DotNetProjectConfiguration; + DotNetProjectConfiguration dnpc = GetProjectConfig (combineConfig.Id, refp, out buildEnabled) as DotNetProjectConfiguration; if ( dnpc == null ) throw new Exception ( GettextCatalog.GetString ("Could not add reference to project '{0}'", refp.Name) ); @@ -303,10 +302,10 @@ namespace MonoDevelop.Autotools } configSection.BuildVariablesBuilder.AppendFormat ( "PROJECT_REFERENCES = {0}\n", projectReferences.ToString() ); - pref = (PlatformID.Unix == Environment.OSVersion.Platform) ? + string buildDir = (PlatformID.Unix == Environment.OSVersion.Platform) ? project.GetRelativeChildPath (config.OutputDirectory) : project.GetRelativeChildPath (config.OutputDirectory).Replace ("\\","/"); - configSection.BuildVariablesBuilder.AppendFormat ("BUILD_DIR = {0}\n", pref); + configSection.BuildVariablesBuilder.AppendFormat ("BUILD_DIR = {0}\n", buildDir); // Register files built by this configuration. // Built files won't be distributed. @@ -314,13 +313,13 @@ namespace MonoDevelop.Autotools ctx.AddBuiltFile (Path.Combine (config.OutputDirectory, bfile)); DeployFileCollection deployFiles = DeployService.GetDeployFiles ( - ctx.DeployContext, new CombineEntry[] { project }); + ctx.DeployContext, new SolutionItem[] { project }, config.Id); - ProcessDeployFilesForConfig (deployFiles, project, configSection, ctx); + ProcessDeployFilesForConfig (deployFiles, project, configSection, ctx, config); configSections.Add (configSection); if (!generateAutotools) { - EmitCustomCommandTargets (config.CustomCommands, project, customCommands, combineConfig.Name, + EmitCustomCommandTargets (config.CustomCommands, project, customCommands, combineConfig.Id, new CustomCommandType [] { CustomCommandType.BeforeBuild, CustomCommandType.AfterBuild, @@ -331,15 +330,19 @@ namespace MonoDevelop.Autotools monitor.ReportWarning (GettextCatalog.GetString ("Custom commands are not supported for autotools based makefiles. Ignoring.")); } + // Register files generated by the compiler + ctx.AddBuiltFile (project.GetOutputFileName (config.Id)); + if (config.DebugMode) + ctx.AddBuiltFile (project.GetOutputFileName (config.Id) + ".mdb"); + if (buildEnabled && pkgs.Count > 0) - ctx.AddRequiredPackages (combineConfig.Name, pkgs); + ctx.AddRequiredPackages (combineConfig.Id, pkgs); } - ctx.TargetCombine.ActiveConfiguration = saveConfiguration; - Dictionary<string, DeployFile> commonDeployVars = new Dictionary<string, DeployFile> (allDeployVars); + Dictionary<string, DeployFileData> commonDeployVars = new Dictionary<string, DeployFileData> (allDeployVars); foreach (ConfigSection configSection in configSections) { List<string> toRemove = new List<string> (); - foreach (KeyValuePair<string, DeployFile> pair in commonDeployVars) { + foreach (KeyValuePair<string, DeployFileData> pair in commonDeployVars) { if (!configSection.DeployFileVars.ContainsKey (pair.Key)) toRemove.Add (pair.Key); } @@ -355,9 +358,9 @@ namespace MonoDevelop.Autotools conf_vars.Append (configSection.BuildVariablesBuilder.ToString ()); conf_vars.Append ("\n"); - foreach (KeyValuePair<string, DeployFile> pair in allDeployVars) { + foreach (KeyValuePair<string, DeployFileData> pair in allDeployVars) { string targetDeployVar = pair.Key; - if (pair.Value.ContainsPathReferences) + if (pair.Value.File.ContainsPathReferences) //Template files are not handled per-config continue; @@ -390,7 +393,7 @@ namespace MonoDevelop.Autotools conf_vars.AppendFormat ("AL={0}\n", (dotnetProject.ClrVersion == ClrVersion.Net_2_0) ? "al2" : "al"); conf_vars.AppendFormat ("SATELLITE_ASSEMBLY_NAME={0}.resources.dll\n", dotnetProject.DefaultNamespace); - foreach (KeyValuePair<string, DeployFile> pair in allDeployVars) { + foreach (KeyValuePair<string, DeployFileData> pair in allDeployVars) { HandleDeployFile (pair.Value, pair.Key, project, ctx); if (commonDeployVars.ContainsKey (pair.Key)) { @@ -398,14 +401,9 @@ namespace MonoDevelop.Autotools deployFileCopyVars.AppendFormat ("{0} = $(BUILD_DIR){1}{2}\n", pair.Key, Path.DirectorySeparatorChar, - EscapeSpace (pair.Value.RelativeTargetPath)); + EscapeSpace (pair.Value.File.RelativeTargetPath)); } } - - // Register files generated by the compiler - ctx.AddBuiltFile (project.GetOutputFileName ()); - //FIXME: mdb is not generated for non-DEBUG profiles - ctx.AddBuiltFile (project.GetOutputFileName () + ".mdb"); conf_vars.Append ('\n'); @@ -432,7 +430,7 @@ namespace MonoDevelop.Autotools templateEngine.Variables["DEPLOY_FILE_VARS"] = vars.ToString (); templateEngine.Variables["COPY_DEPLOY_FILES_VARS"] = deployFileCopyVars.ToString(); templateEngine.Variables["COPY_DEPLOY_FILES_TARGETS"] = deployFileCopyTargets.ToString(); - templateEngine.Variables["ALL_TARGET"] = (ctx.TargetCombine.BaseDirectory == project.BaseDirectory) ? "all-local" : "all"; + templateEngine.Variables["ALL_TARGET"] = (ctx.TargetSolution.BaseDirectory == project.BaseDirectory) ? "all-local" : "all"; templateEngine.Variables["INCLUDES"] = includes; templateEngine.Variables["FILES"] = files.ToString(); @@ -463,14 +461,14 @@ namespace MonoDevelop.Autotools return makefile; } - void ProcessProjectReferences (Project project, out string references, out string dllReferences, AutotoolsContext ctx) + void ProcessProjectReferences (DotNetProject project, out string references, out string dllReferences, AutotoolsContext ctx) { StringWriter refWriter = new StringWriter(); StringWriter dllRefWriter = new StringWriter(); pkgs = new Set<SystemPackage> (); // grab pkg-config references - foreach (ProjectReference reference in project.ProjectReferences) + foreach (ProjectReference reference in project.References) { if (reference.ReferenceType == ReferenceType.Gac) { @@ -524,12 +522,12 @@ namespace MonoDevelop.Autotools } // Populates configSection.DeployFileVars with unique DeployFiles for a particular config - void ProcessDeployFilesForConfig (DeployFileCollection deployFiles, Project project, ConfigSection configSection, AutotoolsContext ctx) + void ProcessDeployFilesForConfig (DeployFileCollection deployFiles, Project project, ConfigSection configSection, AutotoolsContext ctx, DotNetProjectConfiguration config) { //@deployFiles can have duplicates Dictionary<string, DeployFile> uniqueDeployFiles = new Dictionary<string, DeployFile> (); foreach (DeployFile dfile in deployFiles) { - if (dfile.SourcePath == project.GetOutputFileName ()) + if (dfile.SourcePath == project.GetOutputFileName (config.Id)) continue; // DeployFileCollection can have duplicates, ignore them @@ -542,14 +540,18 @@ namespace MonoDevelop.Autotools string targetDeployVar = GetDeployVar (deployFileVars, Path.GetFileName (dfile.RelativeTargetPath)); configSection.DeployFileVars [targetDeployVar] = dfile; - allDeployVars [targetDeployVar] = dfile; + DeployFileData data = new DeployFileData (); + data.File = dfile; + data.Configuration = config; + allDeployVars [targetDeployVar] = data; } } // Handle unique deploy files, emits non-perconfig stuff, like targets for deploy files, // un/install commands - void HandleDeployFile (DeployFile dfile, string targetDeployVar, Project project, AutotoolsContext ctx) + void HandleDeployFile (DeployFileData data, string targetDeployVar, Project project, AutotoolsContext ctx) { + DeployFile dfile = data.File; string dependencyDeployFile = null; //Dependency for the deployfile target if (dfile.ContainsPathReferences) { // Template file, copy to .in file @@ -568,7 +570,7 @@ namespace MonoDevelop.Autotools //Path relative to TargetCombine fname = FileService.NormalizeRelativePath ( - FileService.AbsoluteToRelativePath (ctx.TargetCombine.BaseDirectory, full_fname)); + FileService.AbsoluteToRelativePath (ctx.TargetSolution.BaseDirectory, full_fname)); infname = fname + ".in"; ctx.AddAutoconfFile (EscapeSpace (fname)); ctx.AddGeneratedFile (full_fname + ".in"); @@ -592,8 +594,12 @@ namespace MonoDevelop.Autotools targetDeployVar, EscapeSpace (dependencyDeployFile), (dfile.FileAttributes & DeployFileAttributes.Executable) != 0 ? ",x" : String.Empty); - else - deployFileCopyTargets.AppendFormat ("$(eval $(call emit-deploy-target,{0}))\n", targetDeployVar); + else { + // The emit-deploy-target macro copies the deployable file to the output directory. + // This is not needed if the file is already there (e.g. for an .mdb file) + if (Path.GetFullPath (dfile.SourcePath) != Path.GetFullPath (Path.Combine (data.Configuration.OutputDirectory, dfile.RelativeTargetPath))) + deployFileCopyTargets.AppendFormat ("$(eval $(call emit-deploy-target,{0}))\n", targetDeployVar); + } switch (dfile.TargetDirectoryID) { case TargetDirectory.Gac: @@ -702,17 +708,17 @@ namespace MonoDevelop.Autotools } // Get the Project config corresponding to its @parentConfig - internal static IConfiguration GetProjectConfig (string parentConfig, CombineEntry entry, out bool enabled) + internal static SolutionItemConfiguration GetProjectConfig (string parentConfig, SolutionEntityItem entry, out bool enabled) { enabled = false; - CombineConfiguration combineConfig = entry.ParentCombine.Configurations [parentConfig] as CombineConfiguration; - if (combineConfig == null) + SolutionConfiguration solutionConfig = entry.ParentSolution.Configurations [parentConfig] as SolutionConfiguration; + if (solutionConfig == null) return null; - foreach (CombineConfigurationEntry cce in combineConfig.Entries) { - if (cce.Entry == entry) { + foreach (SolutionConfigurationEntry cce in solutionConfig.Configurations) { + if (cce.Item == entry) { enabled = cce.Build; - return entry.Configurations [cce.ConfigurationName]; + return entry.Configurations [cce.ItemConfiguration]; } } @@ -730,10 +736,10 @@ namespace MonoDevelop.Autotools return name; } - Project GetProjectFromName ( string name, Combine targetCombine) + Project GetProjectFromName (string name, Solution targetSolution) { Project refp = null; - if (targetCombine != null) refp = targetCombine.FindProject (name); + if (targetSolution != null) refp = targetSolution.FindProjectByName (name); if (refp == null) throw new Exception ( GettextCatalog.GetString ("Couldn't find referenced project '{0}'", @@ -748,5 +754,11 @@ namespace MonoDevelop.Autotools } } + + class DeployFileData + { + public DeployFile File; + public DotNetProjectConfiguration Configuration; + } } diff --git a/main/src/addins/MonoDevelop.Autotools/SolutionDeployer.cs b/main/src/addins/MonoDevelop.Autotools/SolutionDeployer.cs index ca4700ad16..c85296152d 100644 --- a/main/src/addins/MonoDevelop.Autotools/SolutionDeployer.cs +++ b/main/src/addins/MonoDevelop.Autotools/SolutionDeployer.cs @@ -50,9 +50,9 @@ namespace MonoDevelop.Autotools this.generateAutotools = generateAutotools; } - public bool HasGeneratedFiles ( Combine combine ) + public bool HasGeneratedFiles (Solution solution) { - string dir = Path.GetDirectoryName(combine.FileName); + string dir = Path.GetDirectoryName (solution.FileName); if (generateAutotools) { return File.Exists (Path.Combine (dir, "configure.ac")) && File.Exists (Path.Combine (dir, "autogen.sh")); @@ -63,47 +63,49 @@ namespace MonoDevelop.Autotools } } - public bool CanDeploy (CombineEntry entry) + public bool CanDeploy (SolutionItem entry) { MakefileType mt = generateAutotools ? MakefileType.AutotoolsMakefile : MakefileType.SimpleMakefile; IMakefileHandler handler = AutotoolsContext.GetMakefileHandler (entry, mt); return handler != null; } - public bool GenerateFiles (DeployContext ctx, Combine combine, string defaultConf, IProgressMonitor monitor ) + public bool GenerateFiles (DeployContext ctx, Solution solution, string defaultConf, IProgressMonitor monitor ) { string filesString = generateAutotools ? "Autotools files" : "Makefiles"; - monitor.BeginTask ( GettextCatalog.GetString ("Generating {0} for Solution {1}", filesString, combine.Name), 1 ); + monitor.BeginTask ( GettextCatalog.GetString ("Generating {0} for Solution {1}", filesString, solution.Name), 1 ); try { - solution_dir = Path.GetDirectoryName(combine.FileName); + solution_dir = Path.GetDirectoryName(solution.FileName); - string[] configs = new string [ combine.Configurations.Count ]; + string[] configs = new string [ solution.Configurations.Count ]; for (int ii=0; ii < configs.Length; ii++ ) - configs [ii] = combine.Configurations[ii].Name; + configs [ii] = solution.Configurations[ii].Id; MakefileType mt = generateAutotools ? MakefileType.AutotoolsMakefile : MakefileType.SimpleMakefile; context = new AutotoolsContext ( ctx, solution_dir, configs, mt ); - context.TargetCombine = combine; + context.TargetSolution = solution; - IMakefileHandler handler = AutotoolsContext.GetMakefileHandler (combine, mt); + IMakefileHandler handler = AutotoolsContext.GetMakefileHandler (solution.RootFolder, mt); if (handler == null) throw new Exception ( GettextCatalog.GetString ("MonoDevelop does not currently support generating {0} for one (or more) child projects.", filesString) ); - solution_name = combine.Name; - solution_version = AutotoolsContext.EscapeStringForAutoconf (combine.Version, true); + solution_name = solution.Name; + solution_version = AutotoolsContext.EscapeStringForAutoconf (solution.Version, true); + if (string.IsNullOrEmpty (solution_version)) + solution_version = "0.1"; - Makefile makefile = handler.Deploy ( context, combine, monitor ); + Makefile makefile = handler.Deploy ( context, solution.RootFolder, monitor ); string path = Path.Combine (solution_dir, "Makefile"); if (generateAutotools) { context.AddAutoconfFile (path); CreateAutoGenDotSH (context, monitor); - CreateConfigureDotAC (combine, defaultConf, monitor, context); + CreateConfigureDotAC (solution, defaultConf, monitor, context); CreateMacros (); } else { - CreateConfigureScript (combine, defaultConf, context, monitor); + CreateConfigureScript (solution, defaultConf, context, monitor); monitor.Log.WriteLine ( GettextCatalog.GetString ("Creating rules.make")); string rules_make_path = Path.Combine (solution_dir, "rules.make"); @@ -139,22 +141,17 @@ namespace MonoDevelop.Autotools return true; } - public void Deploy ( DeployContext ctx, Combine combine, string targetDir, bool generateFiles, IProgressMonitor monitor ) - { - Deploy ( ctx, combine, combine.ActiveConfiguration.Name, targetDir, generateFiles, monitor ); - } - - public void Deploy ( DeployContext ctx, Combine combine, string defaultConf, string targetDir, bool generateFiles, IProgressMonitor monitor ) + public bool Deploy ( DeployContext ctx, Solution solution, string defaultConf, string targetDir, bool generateFiles, IProgressMonitor monitor ) { if (generateFiles) { - if ( !GenerateFiles ( ctx, combine, defaultConf, monitor ) ) - return; + if ( !GenerateFiles ( ctx, solution, defaultConf, monitor ) ) + return false; } monitor.BeginTask ( GettextCatalog.GetString( "Deploying Solution to Tarball" ) , 3 ); try { - string baseDir = Path.GetDirectoryName ( combine.FileName); + string baseDir = Path.GetDirectoryName ( solution.FileName); ProcessWrapper ag_process = Runtime.ProcessService.StartProcess ( "sh", generateAutotools ? "autogen.sh" : "configure", @@ -200,13 +197,14 @@ namespace MonoDevelop.Autotools catch ( Exception e ) { monitor.ReportError ( GettextCatalog.GetString ("Solution could not be deployed: "), e ); - return; + return false; } finally { monitor.EndTask (); } monitor.ReportSuccess ( GettextCatalog.GetString ( "Solution was succesfully deployed" ) ); + return true; } void DeleteGeneratedFiles ( AutotoolsContext context ) @@ -262,7 +260,7 @@ namespace MonoDevelop.Autotools Syscall.chmod ( fileName , FilePermissions.S_IXOTH | FilePermissions.S_IROTH | FilePermissions.S_IRWXU | FilePermissions.S_IRWXG ); } - void CreateConfigureDotAC ( Combine combine, string defaultConf, IProgressMonitor monitor, AutotoolsContext context ) + void CreateConfigureDotAC (Solution solution, string defaultConf, IProgressMonitor monitor, AutotoolsContext context) { monitor.Log.WriteLine ( GettextCatalog.GetString ("Creating configure.ac") ); TemplateEngine templateEngine = new TemplateEngine(); @@ -270,16 +268,16 @@ namespace MonoDevelop.Autotools // add solution configuration options StringBuilder config_options = new StringBuilder (); - foreach ( IConfiguration config in combine.Configurations ) + foreach ( SolutionConfiguration config in solution.Configurations ) { - string name = context.EscapeAndUpperConfigName (config.Name).ToLower(); - string def = config.Name == defaultConf ? "YES" : "NO"; + string name = context.EscapeAndUpperConfigName (config.Id).ToLower(); + string def = config.Id == defaultConf ? "YES" : "NO"; string ac_var = "enable_" + name; // test to see if a configuration was enabled config_options.AppendFormat ( "AC_ARG_ENABLE({0},\n", name ); config_options.AppendFormat (" AC_HELP_STRING([--enable-{0}],\n", name ); - config_options.AppendFormat (" [Use '{0}' Configuration [default={1}]]),\n", context.EscapeAndUpperConfigName (config.Name), def ); + config_options.AppendFormat (" [Use '{0}' Configuration [default={1}]]),\n", context.EscapeAndUpperConfigName (config.Id), def ); config_options.AppendFormat ( " {0}=yes, {0}=no)\n", ac_var ); config_options.AppendFormat ( "AM_CONDITIONAL({0}, test x${1} = xyes)\n", ac_var.ToUpper(), ac_var ); @@ -334,13 +332,13 @@ namespace MonoDevelop.Autotools packageChecks.WriteLine("PKG_CHECK_MODULES([{0}], [{1}])", AutotoolsContext.GetPkgConfigVariable (pkg.Name), pkg.Name); packageChecks.WriteLine ("\ndnl package checks, per config"); - foreach (IConfiguration config in combine.Configurations) { - Set<SystemPackage> pkgs = context.GetRequiredPackages (config.Name, true); + foreach (SolutionConfiguration config in solution.Configurations) { + Set<SystemPackage> pkgs = context.GetRequiredPackages (config.Id, true); if (pkgs == null || pkgs.Count == 0) continue; packageChecks.WriteLine (@"if test ""x$enable_{0}"" = ""xyes""; then", - context.EscapeAndUpperConfigName (config.Name).ToLower()); + context.EscapeAndUpperConfigName (config.Id).ToLower()); foreach (SystemPackage pkg in pkgs) packageChecks.WriteLine("\tPKG_CHECK_MODULES([{0}], [{1}])", AutotoolsContext.GetPkgConfigVariable (pkg.Name), pkg.Name); @@ -363,7 +361,7 @@ namespace MonoDevelop.Autotools context.AddGeneratedFile (configureFileName); } - void CreateConfigureScript (Combine combine, string defaultConf, AutotoolsContext ctx, IProgressMonitor monitor) + void CreateConfigureScript (Solution solution, string defaultConf, AutotoolsContext ctx, IProgressMonitor monitor) { monitor.Log.WriteLine ( GettextCatalog.GetString ("Creating configure script") ); @@ -381,20 +379,20 @@ namespace MonoDevelop.Autotools // Build list of packages required per config StringBuilder requiredPackages = new StringBuilder (); - foreach (IConfiguration config in combine.Configurations) { - Set<SystemPackage> pkgs = context.GetRequiredPackages (config.Name, true); + foreach (SolutionConfiguration config in solution.Configurations) { + Set<SystemPackage> pkgs = context.GetRequiredPackages (config.Id, true); if (pkgs == null || pkgs.Count == 0) continue; if (requiredPackages.Length > 0) requiredPackages.Append ("\n"); requiredPackages.AppendFormat ("required_packages_{0}=\"{1}\"", - context.EscapeAndUpperConfigName (config.Name), + context.EscapeAndUpperConfigName (config.Id), GetPackageListFromSet (pkgs)); } templateEngine.Variables ["VERSION"] = solution_version; - templateEngine.Variables ["PACKAGE"] = AutotoolsContext.EscapeStringForAutoconf (combine.Name).ToLower (); + templateEngine.Variables ["PACKAGE"] = solution.Name.ToLower (); templateEngine.Variables ["DEFAULT_CONFIG"] = ctx.EscapeAndUpperConfigName (defaultConf); templateEngine.Variables ["CONFIGURATIONS"] = sbConfig.ToString (); templateEngine.Variables ["COMMON_PACKAGES"] = commonPackages.ToString (); diff --git a/main/src/addins/MonoDevelop.Autotools/SolutionMakefileHandler.cs b/main/src/addins/MonoDevelop.Autotools/SolutionMakefileHandler.cs index 201dd04643..6ebf71ca5a 100644 --- a/main/src/addins/MonoDevelop.Autotools/SolutionMakefileHandler.cs +++ b/main/src/addins/MonoDevelop.Autotools/SolutionMakefileHandler.cs @@ -33,12 +33,12 @@ namespace MonoDevelop.Autotools bool generateAutotools = true; // Recurses into children and tests if they are deployable. - public bool CanDeploy (CombineEntry entry, MakefileType type) + public bool CanDeploy (SolutionItem entry, MakefileType type) { - return entry is Combine; + return entry is SolutionFolder; } - public Makefile Deploy ( AutotoolsContext ctx, CombineEntry entry, IProgressMonitor monitor ) + public Makefile Deploy (AutotoolsContext ctx, SolutionItem entry, IProgressMonitor monitor) { generateAutotools = ctx.MakefileType == MakefileType.AutotoolsMakefile; @@ -51,14 +51,15 @@ namespace MonoDevelop.Autotools try { - Combine combine = entry as Combine; + SolutionFolder solutionFolder = (SolutionFolder) entry; + string targetDirectory = solutionFolder.BaseDirectory; StringBuilder subdirs = new StringBuilder(); subdirs.Append ("#Warning: This is an automatically generated file, do not edit!\n"); if (!generateAutotools) { solutionTop.AppendFormat ("top_srcdir={0}\n", FileService.AbsoluteToRelativePath ( - entry.BaseDirectory, ctx.TargetCombine.BaseDirectory)); + entry.BaseDirectory, ctx.TargetSolution.BaseDirectory)); solutionTop.Append ("include $(top_srcdir)/config.make\n"); solutionTop.Append ("include $(top_srcdir)/Makefile.include\n"); solutionTop.Append ("include $(top_srcdir)/rules.make\n\n"); @@ -66,28 +67,39 @@ namespace MonoDevelop.Autotools } ArrayList children = new ArrayList (); - foreach ( CombineConfiguration config in combine.Configurations ) + foreach ( SolutionConfiguration config in solutionFolder.ParentSolution.Configurations ) { - if ( !ctx.IsSupportedConfiguration ( config.Name ) ) continue; + if ( !ctx.IsSupportedConfiguration ( config.Id ) ) continue; if (generateAutotools) - subdirs.AppendFormat ( "if {0}\n", "ENABLE_" + ctx.EscapeAndUpperConfigName (config.Name)); + subdirs.AppendFormat ( "if {0}\n", "ENABLE_" + ctx.EscapeAndUpperConfigName (config.Id)); else - subdirs.AppendFormat ( "ifeq ($(CONFIG),{0})\n", ctx.EscapeAndUpperConfigName (config.Name)); + subdirs.AppendFormat ( "ifeq ($(CONFIG),{0})\n", ctx.EscapeAndUpperConfigName (config.Id)); subdirs.Append (" SUBDIRS = "); - foreach (CombineEntry ce in CalculateSubDirOrder (ctx, config)) + foreach (SolutionItem ce in CalculateSubDirOrder (ctx, solutionFolder, config)) { - if (combine.BaseDirectory == ce.BaseDirectory) { + string baseDirectory; + if (!(ce is SolutionEntityItem) && !(ce is SolutionFolder)) + continue; + + // Ignore projects which can't be deployed + IMakefileHandler handler = AutotoolsContext.GetMakefileHandler (ce, ctx.MakefileType); + if (handler == null) + continue; + + baseDirectory = ce.BaseDirectory; + + if (solutionFolder.BaseDirectory == baseDirectory) { subdirs.Append (" . "); } else { - if ( !ce.BaseDirectory.StartsWith (combine.BaseDirectory) ) + if (!baseDirectory.StartsWith (solutionFolder.BaseDirectory) ) throw new Exception ( GettextCatalog.GetString ( - "Child projects / solutions must be in sub-directories of their parent") ); + "Child projects must be in sub-directories of their parent") ); // add the subdirectory to the list - string path = Path.GetDirectoryName (ce.RelativeFileName); + string path = FileService.AbsoluteToRelativePath (targetDirectory, baseDirectory); if (path.StartsWith ("." + Path.DirectorySeparatorChar) ) path = path.Substring (2); subdirs.Append (" "); @@ -104,17 +116,18 @@ namespace MonoDevelop.Autotools string includedProject = null; // deploy recursively - foreach ( CombineEntry ce in children ) + foreach (SolutionItem ce in children) { IMakefileHandler handler = AutotoolsContext.GetMakefileHandler ( ce, ctx.MakefileType ); Makefile makefile; string outpath; if ( handler != null && handler.CanDeploy ( ce, ctx.MakefileType ) ) { - if (ce is Project) - ctx.RegisterBuiltProject (ce.Name); + ctx.RegisterBuiltProject (ce); makefile = handler.Deploy ( ctx, ce, monitor ); - if (combine.BaseDirectory == ce.BaseDirectory) { + + if (targetDirectory == ce.BaseDirectory) + { if (includedProject != null) throw new Exception ( GettextCatalog.GetString ( "More than 1 project in the same directory as the top-level solution is not supported.")); @@ -122,20 +135,20 @@ namespace MonoDevelop.Autotools // project is in the solution directory string projectMakefileName = ce.Name + ".make"; includedProject = String.Format ("include {0}", projectMakefileName); - outpath = Path.Combine (Path.GetDirectoryName(ce.FileName), projectMakefileName); + outpath = Path.Combine (targetDirectory, projectMakefileName); ctx.AddGeneratedFile (outpath); if (!generateAutotools) solutionMakefile.SetVariable ("EXTRA_DIST", projectMakefileName); } else { makefile.AppendToVariable ("EXTRA_DIST", generateAutotools ? String.Empty : "Makefile"); - outpath = Path.Combine (Path.GetDirectoryName(ce.FileName), "Makefile"); + outpath = Path.Combine (ce.BaseDirectory, "Makefile"); if (generateAutotools) { ctx.AddAutoconfFile (outpath); outpath = outpath + ".am"; } else { makefile.Append ("install: install-local\nuninstall: uninstall-local\nclean: clean-local\n"); - if (ce is Combine) + if (ce is SolutionFolder) //non TargetCombine makefile.Append ("dist-local: dist-local-recursive\n"); else @@ -173,7 +186,7 @@ namespace MonoDevelop.Autotools solutionMakefile.Append (sw.ToString ()); - if (entry == ctx.TargetCombine) { + if (solutionFolder.IsRoot) { // Emit dist and distcheck targets only for TargetCombine reader = new StreamReader (Path.Combine (ctx.TemplateDir, "make-dist.targets")); solutionMakefile.Append (reader.ReadToEnd ()); @@ -191,11 +204,11 @@ namespace MonoDevelop.Autotools } // utility function for finding the correct order to process directories - List<CombineEntry> CalculateSubDirOrder (AutotoolsContext ctx, CombineConfiguration config) + List<SolutionItem> CalculateSubDirOrder (AutotoolsContext ctx, SolutionFolder folder, SolutionConfiguration config) { - List<CombineEntry> resultOrder = new List<CombineEntry>(); - Set<string> dependenciesMet = new Set<string>(); - Set<CombineEntry> inResult = new Set<CombineEntry>(); + List<SolutionItem> resultOrder = new List<SolutionItem>(); + Set<SolutionItem> dependenciesMet = new Set<SolutionItem>(); + Set<SolutionItem> inResult = new Set<SolutionItem>(); // We don't have to worry about projects built in parent combines dependenciesMet.Union (ctx.GetBuiltProjects ()); @@ -206,44 +219,45 @@ namespace MonoDevelop.Autotools { added = false; notMet = null; + + List<SolutionItem> items = new List<SolutionItem> (); + GetSubItems (items, folder); - foreach (CombineConfigurationEntry centry in config.Entries) + foreach (SolutionItem item in items) { - if ( !centry.Build ) continue; + Set<SolutionItem> references, provides; - CombineEntry entry = centry.Entry; + if (inResult.Contains (item)) + continue; - if ( inResult.Contains (entry) ) continue; - - Set<string> references, provides; - if (entry is Project) - { - Project project = entry as Project; - - references = GetReferencedProjects (project); - provides = new Set<string>(); - provides.Add(project.Name); - } - else if (entry is Combine) + if (item is SolutionEntityItem) { - CombineConfiguration cc = (entry as Combine).Configurations[config.Name] as CombineConfiguration; - if ( cc == null ) continue; - GetAllProjects ( cc, out provides, out references); + SolutionEntityItem entry = (SolutionEntityItem) item; + if (!config.BuildEnabledForItem (entry)) + continue; + + string mappedConf = config.GetMappedConfiguration (entry); + if (mappedConf == null) + continue; + references = new Set<SolutionItem> (); + provides = new Set<SolutionItem>(); + references.Union (entry.GetReferencedItems (mappedConf)); + provides.Add (entry); } - else { - if (!resultOrder.Contains (entry)) - resultOrder.Add (entry); - continue; + else if (item is SolutionFolder) { + GetAllProjects ((SolutionFolder) item, config, out provides, out references); } - + else + continue; + if (dependenciesMet.ContainsSet (references) ) { - resultOrder.Add (entry); + resultOrder.Add (item); dependenciesMet.Union(provides); - inResult.Add(entry); + inResult.Add(item); added = true; } - else notMet = entry.Name; + else notMet = item.Name; } } while (added); @@ -252,28 +266,22 @@ namespace MonoDevelop.Autotools return resultOrder; } - - // cache references - Hashtable projectReferences = new Hashtable(); - /** - * returns a set of all monodevelop projects that a give - * projects references - */ - Set<string> GetReferencedProjects (Project project) + + void GetSubItems (List<SolutionItem> list, SolutionFolder folder) { - Set<string> set = (Set<string>) projectReferences [project]; - if (set != null) return set; - - set = new Set<string>(); - - foreach (ProjectReference reference in project.ProjectReferences) - { - if (reference.ReferenceType == ReferenceType.Project) - set.Add (reference.Reference); + // This method returns the subitems of a folder. + // If a folder does not match a phisical folder, it will be ignored. + + foreach (SolutionItem item in folder.Items) { + if (item is SolutionFolder) { + if (item.BaseDirectory != folder.BaseDirectory) + list.Add (item); + else + GetSubItems (list, (SolutionFolder) item); + } + else + list.Add (item); } - - projectReferences[project] = set; - return set; } // cache references @@ -283,46 +291,46 @@ namespace MonoDevelop.Autotools * returns a set of projects that a combine contains and a set of projects * that are referenced from combine projects but not part of the combine */ - void GetAllProjects (CombineConfiguration config, out Set<string> projects, out Set<string> references) + void GetAllProjects (SolutionFolder folder, SolutionConfiguration config, out Set<SolutionItem> projects, out Set<SolutionItem> references) { - projects = (Set<string>) combineProjects [config]; - if(projects != null) - { - references = (Set<string>) combineReferences [config]; + List<SolutionItem> subitems = new List<SolutionItem> (); + GetSubItems (subitems, folder); + + projects = (Set<SolutionItem>) combineProjects [folder]; + if (projects != null) { + references = (Set<SolutionItem>) combineReferences [folder]; return; } - projects = new Set<string>(); - references = new Set<string>(); + projects = new Set<SolutionItem>(); + references = new Set<SolutionItem>(); - foreach (CombineConfigurationEntry centry in config.Entries) + foreach (SolutionItem item in subitems) { - if ( !centry.Build ) continue; - - CombineEntry entry = centry.Entry; - if (entry is Project) + if (item is SolutionEntityItem) { - Project project = entry as Project; - projects.Add (project.Name); - references.Union ( GetReferencedProjects (project) ); - } - else if (entry is Combine) + SolutionEntityItem entry = (SolutionEntityItem) item; + if (!config.BuildEnabledForItem (entry)) + continue; + string mappedConf = config.GetMappedConfiguration (entry); + if (mappedConf == null) + continue; + projects.Add (entry); + references.Union (entry.GetReferencedItems (mappedConf)); + } + else if (item is SolutionFolder) { - Set<string> subProjects; - Set<string> subReferences; - - CombineConfiguration cc = (entry as Combine).Configurations[config.Name] as CombineConfiguration; - if ( cc == null ) continue; - GetAllProjects ( cc, out subProjects, out subReferences); - + Set<SolutionItem> subProjects; + Set<SolutionItem> subReferences; + GetAllProjects ((SolutionFolder)item, config, out subProjects, out subReferences); projects.Union (subProjects); references.Union (subReferences); } } references.Without (projects); - combineProjects [config] = projects; - combineReferences [config] = references; + combineProjects [folder] = projects; + combineReferences [folder] = references; } } } diff --git a/main/src/addins/MonoDevelop.Autotools/TarballBuilderEditorWidget.cs b/main/src/addins/MonoDevelop.Autotools/TarballBuilderEditorWidget.cs index 74df4b0518..1ee0488597 100644 --- a/main/src/addins/MonoDevelop.Autotools/TarballBuilderEditorWidget.cs +++ b/main/src/addins/MonoDevelop.Autotools/TarballBuilderEditorWidget.cs @@ -15,15 +15,16 @@ namespace MonoDevelop.Autotools this.Build(); this.target = target; - CombineEntry targetCombine = target.RootCombineEntry; + SolutionItem targetCombine = target.RootSolutionItem; folderEntry.Path = target.TargetDir; - if ((target.DefaultConfiguration == null || target.DefaultConfiguration == "") && targetCombine.ActiveConfiguration != null) - target.DefaultConfiguration = targetCombine.ActiveConfiguration.Name; + if (string.IsNullOrEmpty (target.DefaultConfiguration)) { + target.DefaultConfiguration = targetCombine.ParentSolution.GetConfigurations () [0]; + } - for (int ii=0; ii < targetCombine.Configurations.Count; ii++) + for (int ii=0; ii < targetCombine.ParentSolution.Configurations.Count; ii++) { - string cc = targetCombine.Configurations [ii].Name; + string cc = targetCombine.ParentSolution.Configurations [ii].Id; comboConfigs.AppendText ( cc ); if ( cc == target.DefaultConfiguration ) comboConfigs.Active = ii; } diff --git a/main/src/addins/MonoDevelop.Autotools/gtk-gui/MonoDevelop.Autotools.GenerateMakefilesDialog.cs b/main/src/addins/MonoDevelop.Autotools/gtk-gui/MonoDevelop.Autotools.GenerateMakefilesDialog.cs index 861a89281f..b5e893227c 100644 --- a/main/src/addins/MonoDevelop.Autotools/gtk-gui/MonoDevelop.Autotools.GenerateMakefilesDialog.cs +++ b/main/src/addins/MonoDevelop.Autotools/gtk-gui/MonoDevelop.Autotools.GenerateMakefilesDialog.cs @@ -174,7 +174,7 @@ namespace MonoDevelop.Autotools { // Internal child MonoDevelop.Autotools.GenerateMakefilesDialog.ActionArea Gtk.HButtonBox w14 = this.ActionArea; w14.Name = "dialog1_ActionArea"; - w14.Spacing = 10; + w14.Spacing = 6; w14.BorderWidth = ((uint)(5)); w14.LayoutStyle = ((Gtk.ButtonBoxStyle)(4)); // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild @@ -206,7 +206,7 @@ namespace MonoDevelop.Autotools { this.Child.ShowAll(); } this.DefaultWidth = 614; - this.DefaultHeight = 337; + this.DefaultHeight = 359; this.Show(); } } diff --git a/main/src/addins/MonoDevelop.Autotools/gtk-gui/gui.stetic b/main/src/addins/MonoDevelop.Autotools/gtk-gui/gui.stetic index 8e660306c9..89e85c0534 100644 --- a/main/src/addins/MonoDevelop.Autotools/gtk-gui/gui.stetic +++ b/main/src/addins/MonoDevelop.Autotools/gtk-gui/gui.stetic @@ -1663,7 +1663,6 @@ <property name="MemberName" /> <property name="CanFocus">True</property> <property name="Label" translatable="yes">Autotools based</property> - <property name="Active">True</property> <property name="DrawIndicator">True</property> <property name="HasLabel">False</property> <property name="UseUnderline">True</property> @@ -1767,7 +1766,7 @@ Generates set of Makefiles with the most common targets, and a configuration scr <placeholder /> </child> </widget> - <widget class="Gtk.Dialog" id="MonoDevelop.Autotools.GenerateMakefilesDialog" design-size="614 337"> + <widget class="Gtk.Dialog" id="MonoDevelop.Autotools.GenerateMakefilesDialog" design-size="614 359"> <property name="MemberName" /> <property name="Title" translatable="yes">Generate Makefiles</property> <property name="WindowPosition">CenterOnParent</property> @@ -1943,7 +1942,7 @@ Generates a Makefile structure based on Autotools, with the standard targets and <child internal-child="ActionArea"> <widget class="Gtk.HButtonBox" id="dialog1_ActionArea"> <property name="MemberName" /> - <property name="Spacing">10</property> + <property name="Spacing">6</property> <property name="BorderWidth">5</property> <property name="Size">2</property> <property name="LayoutStyle">End</property> diff --git a/main/src/addins/MonoDevelop.Autotools/templates/autogen.sh.template b/main/src/addins/MonoDevelop.Autotools/templates/autogen.sh.template index 58309e9e29..d59068dbf4 100644 --- a/main/src/addins/MonoDevelop.Autotools/templates/autogen.sh.template +++ b/main/src/addins/MonoDevelop.Autotools/templates/autogen.sh.template @@ -1,7 +1,7 @@ #! /bin/sh PROJECT=%%NAME%% -FILE=%%TESTFILE%% +FILE= CONFIGURE=configure.ac : ${AUTOCONF=autoconf} diff --git a/main/src/addins/MonoDevelop.Autotools/templates/rules.make b/main/src/addins/MonoDevelop.Autotools/templates/rules.make index b15d5d21b0..a4f37a1fd1 100644 --- a/main/src/addins/MonoDevelop.Autotools/templates/rules.make +++ b/main/src/addins/MonoDevelop.Autotools/templates/rules.make @@ -26,7 +26,7 @@ dist-local-recursive: mkdir -p "$(distdir)/$$dir" || true; \ case "$$dir" in \ .) make dist-local "distdir=$(distdir)" || exit 1;; \ - *) (cd "$$dir"; make dist-local "distdir=$(distdir)/$$dir)" || exit 1; \ + *) (cd "$$dir"; make dist-local "distdir=$(distdir)/$$dir") || exit 1; \ esac \ done diff --git a/main/src/addins/MonoDevelop.CodeMetrics/ChangeLog b/main/src/addins/MonoDevelop.CodeMetrics/ChangeLog index 0ba8234f1b..a7a021750a 100644 --- a/main/src/addins/MonoDevelop.CodeMetrics/ChangeLog +++ b/main/src/addins/MonoDevelop.CodeMetrics/ChangeLog @@ -1,3 +1,12 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * MonoDevelop.CodeMetrics.addin.xml, MonoDevelop.CodeMetrics.mdp, + MonoDevelop.CodeMetrics/CodeMetricsView.cs, + MonoDevelop.CodeMetrics/Commands.cs, + MonoDevelop.CodeMetrics/CodeMetricsNodeExtension.cs, + MonoDevelop.CodeMetrics/CodeMetricsWidget.cs: New project model + changes. + 2008-03-14 Marcos David Marín Amador <MarcosMarin@gmail.com> * MonoDevelop.CodeMetrics/CodeMetricsWidget.cs: Workaround bug in mono 1.2.4 diff --git a/main/src/addins/MonoDevelop.CodeMetrics/MonoDevelop.CodeMetrics.addin.xml b/main/src/addins/MonoDevelop.CodeMetrics/MonoDevelop.CodeMetrics.addin.xml index 8ee9efd9cd..51a71af954 100644 --- a/main/src/addins/MonoDevelop.CodeMetrics/MonoDevelop.CodeMetrics.addin.xml +++ b/main/src/addins/MonoDevelop.CodeMetrics/MonoDevelop.CodeMetrics.addin.xml @@ -49,7 +49,7 @@ <CommandItem id = "MonoDevelop.CodeMetrics.Commands.ShowMetrics" insertafter="FindInFilesSeparator" insertbefore="CombineOptionsSeparator"/>
</Extension> - <Extension path = "/MonoDevelop/Ide/ContextMenu/ProjectPad/Combine/Tools">
+ <Extension path = "/MonoDevelop/Ide/ContextMenu/ProjectPad/Solution/Tools">
<CommandItem id = "MonoDevelop.CodeMetrics.Commands.ShowMetrics" insertafter="FindInFilesSeparator" insertbefore="CombineOptionsSeparator"/>
</Extension>
</Addin> diff --git a/main/src/addins/MonoDevelop.CodeMetrics/MonoDevelop.CodeMetrics.mdp b/main/src/addins/MonoDevelop.CodeMetrics/MonoDevelop.CodeMetrics.mdp index a961378125..30dd58b39c 100644 --- a/main/src/addins/MonoDevelop.CodeMetrics/MonoDevelop.CodeMetrics.mdp +++ b/main/src/addins/MonoDevelop.CodeMetrics/MonoDevelop.CodeMetrics.mdp @@ -33,27 +33,27 @@ <ProjectReference type="Gac" localcopy="True" refto="pango-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Ide" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Projects" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Core" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Core.Gui" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Components" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Ide" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Projects" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Core" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Core.Gui" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Components" /> <ProjectReference type="Gac" localcopy="True" refto="atk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.3.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> <ProjectReference type="Gac" localcopy="True" refto="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <ProjectReference type="Gac" localcopy="True" refto="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <ProjectReference type="Gac" localcopy="True" refto="System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <ProjectReference type="Gac" localcopy="True" refto="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.DesignerSupport" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Projects.Gui" /> - <ProjectReference type="Project" localcopy="True" refto="Mono.TextEditor" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.DesignerSupport" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Projects.Gui" /> + <ProjectReference type="Project" localcopy="False" refto="Mono.TextEditor" /> </References> <GtkDesignInfo isWidgetLibrary="True" gtkVersion="2.10.2"> <ExportedWidgets> <Widget>MonoDevelop.CodeMetrics.CodeMetricsWidget</Widget> </ExportedWidgets> </GtkDesignInfo> - <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="Makefile.am" SyncReferences="True" IsAutotoolsProject="True" RelativeConfigureInPath="../../.."> + <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="Makefile.am" BuildTargetName="" CleanTargetName="" SyncReferences="True" IsAutotoolsProject="True" RelativeConfigureInPath="../../.."> <BuildFilesVar Sync="True" Name="FILES" /> <DeployFilesVar /> <ResourcesVar Sync="True" Name="RES" /> @@ -62,5 +62,5 @@ <AsmRefVar Sync="True" Name="REFS" Prefix="-r:" /> <ProjectRefVar Sync="True" Name="REFS" Prefix="-r:" /> </MonoDevelop.Autotools.MakefileInfo> - <MonoDevelop.ChangeLogAddIn.ChangeLogInfo policy="OneChangeLogInProjectRootDirectory" /> + <MonoDevelop.ChangeLogAddIn.ChangeLogInfo policy="UseParentPolicy" /> </Project>
\ No newline at end of file diff --git a/main/src/addins/MonoDevelop.CodeMetrics/MonoDevelop.CodeMetrics/CodeMetricsNodeExtension.cs b/main/src/addins/MonoDevelop.CodeMetrics/MonoDevelop.CodeMetrics/CodeMetricsNodeExtension.cs index c8e28b0c67..cf817ee438 100644 --- a/main/src/addins/MonoDevelop.CodeMetrics/MonoDevelop.CodeMetrics/CodeMetricsNodeExtension.cs +++ b/main/src/addins/MonoDevelop.CodeMetrics/MonoDevelop.CodeMetrics/CodeMetricsNodeExtension.cs @@ -49,7 +49,8 @@ namespace MonoDevelop.CodeMetrics {
return typeof(ProjectFile).IsAssignableFrom (dataType)
|| typeof(ProjectFolder).IsAssignableFrom (dataType)
- || typeof(CombineEntry).IsAssignableFrom (dataType);
+ || typeof(SolutionItem).IsAssignableFrom (dataType)
+ || typeof(Solution).IsAssignableFrom (dataType);
} public CodeMetricsNodeExtension() @@ -75,10 +76,14 @@ namespace MonoDevelop.CodeMetrics } } - Combine combine = CurrentNode.DataItem as Combine; + SolutionFolder combine = CurrentNode.DataItem as SolutionFolder; if (combine != null) view.Add (combine); + Solution solution = CurrentNode.DataItem as Solution; + if (combine != null) + view.Add (solution); + Project project = CurrentNode.DataItem as Project; if (project != null) view.Add (project); diff --git a/main/src/addins/MonoDevelop.CodeMetrics/MonoDevelop.CodeMetrics/CodeMetricsView.cs b/main/src/addins/MonoDevelop.CodeMetrics/MonoDevelop.CodeMetrics/CodeMetricsView.cs index e4b21d23e2..191cc52ce5 100644 --- a/main/src/addins/MonoDevelop.CodeMetrics/MonoDevelop.CodeMetrics/CodeMetricsView.cs +++ b/main/src/addins/MonoDevelop.CodeMetrics/MonoDevelop.CodeMetrics/CodeMetricsView.cs @@ -72,11 +72,16 @@ namespace MonoDevelop.CodeMetrics widget.Add (project); } - public void Add (Combine combine) + public void Add (SolutionFolder combine) { widget.Add (combine); } + public void Add (WorkspaceItem item) + { + widget.Add (item); + } + public void Run () { widget.Run (); diff --git a/main/src/addins/MonoDevelop.CodeMetrics/MonoDevelop.CodeMetrics/CodeMetricsWidget.cs b/main/src/addins/MonoDevelop.CodeMetrics/MonoDevelop.CodeMetrics/CodeMetricsWidget.cs index 588c5834cb..f6de2197e2 100644 --- a/main/src/addins/MonoDevelop.CodeMetrics/MonoDevelop.CodeMetrics/CodeMetricsWidget.cs +++ b/main/src/addins/MonoDevelop.CodeMetrics/MonoDevelop.CodeMetrics/CodeMetricsWidget.cs @@ -89,7 +89,7 @@ namespace MonoDevelop.CodeMetrics public MetricsWorkerThread (CodeMetricsWidget widget) { this.widget = widget; - foreach (KeyValuePair<string, string> header in StandardHeaderService.Templates) { + foreach (KeyValuePair<string, string> header in StandardHeaderService.HeaderTemplates) { Mono.TextEditor.Document newDoc = new Mono.TextEditor.Document (); newDoc.Text = header.Value; headers[header.Key] = newDoc; @@ -162,7 +162,7 @@ namespace MonoDevelop.CodeMetrics //string possibleHeader = document.GetTextAt (0, Math.Min (this.longestHeader, document.Length)); if (!String.IsNullOrEmpty (last)) { - foreach (KeyValuePair<string, string> header in StandardHeaderService.Templates) { + foreach (KeyValuePair<string, string> header in StandardHeaderService.HeaderTemplates) { if (header.Key == last) { int match = FakeLongestCommonSubstring (document, header.Value);//;LongestCommonSubstring (header.Value, possibleHeader); if (match > header.Value.Length / 2) @@ -172,7 +172,7 @@ namespace MonoDevelop.CodeMetrics } } - foreach (KeyValuePair<string, string> header in StandardHeaderService.Templates) { + foreach (KeyValuePair<string, string> header in StandardHeaderService.HeaderTemplates) { if (header.Key == last) continue; int match = FakeLongestCommonSubstring (document, header.Value); @@ -282,16 +282,23 @@ namespace MonoDevelop.CodeMetrics public void Add (Project project) { - foreach (ProjectFile projectFile in project.ProjectFiles) { + foreach (ProjectFile projectFile in project.Files) { Add (projectFile); } } - public void Add (Combine combine) + public void Add (SolutionFolder combine) { foreach (Project project in combine.GetAllProjects ()) { Add (project); } } + + public void Add (WorkspaceItem item) + { + foreach (Project project in item.GetAllProjects ()) { + Add (project); + } + } } }
\ No newline at end of file diff --git a/main/src/addins/MonoDevelop.CodeMetrics/MonoDevelop.CodeMetrics/Commands.cs b/main/src/addins/MonoDevelop.CodeMetrics/MonoDevelop.CodeMetrics/Commands.cs index d531ead206..d1dee9dd53 100644 --- a/main/src/addins/MonoDevelop.CodeMetrics/MonoDevelop.CodeMetrics/Commands.cs +++ b/main/src/addins/MonoDevelop.CodeMetrics/MonoDevelop.CodeMetrics/Commands.cs @@ -31,6 +31,7 @@ using MonoDevelop.Ide.Gui; using MonoDevelop.Core; using MonoDevelop.Core.Gui; using MonoDevelop.Components.Commands; +using MonoDevelop.Projects; namespace MonoDevelop.CodeMetrics { @@ -43,13 +44,14 @@ namespace MonoDevelop.CodeMetrics protected override void Update (CommandInfo info) { - info.Enabled = IdeApp.ProjectOperations.CurrentOpenCombine != null; + info.Enabled = IdeApp.Workspace.IsOpen; } protected override void Run () { CodeMetricsView view = new CodeMetricsView (); - view.Add (IdeApp.ProjectOperations.CurrentOpenCombine); + foreach (WorkspaceItem it in IdeApp.Workspace.Items) + view.Add (it); IdeApp.Workbench.OpenDocument (view, true);
view.Run (); } diff --git a/main/src/addins/MonoDevelop.DesignerSupport/ChangeLog b/main/src/addins/MonoDevelop.DesignerSupport/ChangeLog index ad06bc9b44..bbd0ddf649 100644 --- a/main/src/addins/MonoDevelop.DesignerSupport/ChangeLog +++ b/main/src/addins/MonoDevelop.DesignerSupport/ChangeLog @@ -1,3 +1,15 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * MonoDevelop.DesignerSupport.addin.xml, + MonoDevelop.DesignerSupport/BindingService.cs, + MonoDevelop.DesignerSupport/CodeBehindService.cs, + MonoDevelop.DesignerSupport.Projects/CombineEntryDescriptor.cs, + MonoDevelop.DesignerSupport.Projects/CombineEntryPropertyProvider.cs, + MonoDevelop.DesignerSupport.Projects/ComponentNodeBuilder.cs, + MonoDevelop.DesignerSupport.Projects/PropertyPadTextEditorExtension.cs, + MonoDevelop.DesignerSupport.Projects/ProjectReferenceDescriptor.cs: + New project model changes. + 2008-05-20 Mike Krüger <mkrueger@novell.com> * MonoDevelop.DesignerSupport.Toolbox/Toolbox.cs: fixed 'Bug 389065 - diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/CombineEntryDescriptor.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/CombineEntryDescriptor.cs index fbecbb3fbc..ec96fee3cc 100644 --- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/CombineEntryDescriptor.cs +++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/CombineEntryDescriptor.cs @@ -1,4 +1,4 @@ -// CombineEntryDescriptor.cs +// SolutionItemDescriptor.cs // //Author: // Lluis Sanchez Gual @@ -31,11 +31,11 @@ using MonoDevelop.Projects; namespace MonoDevelop.DesignerSupport { - class CombineEntryDescriptor: CustomDescriptor + class SolutionItemDescriptor: CustomDescriptor { - CombineEntry entry; + SolutionItem entry; - public CombineEntryDescriptor (CombineEntry entry) + public SolutionItemDescriptor (SolutionItem entry) { this.entry = entry; } @@ -50,7 +50,12 @@ namespace MonoDevelop.DesignerSupport [DisplayName ("File Path")] [Description ("File path of the solution item.")] public string FilePath { - get { return entry.FileName; } + get { + if (entry is SolutionEntityItem) + return ((SolutionEntityItem) entry).FileName; + else + return ""; + } } } } diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/CombineEntryPropertyProvider.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/CombineEntryPropertyProvider.cs index 8efec87dd2..636e832af1 100644 --- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/CombineEntryPropertyProvider.cs +++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/CombineEntryPropertyProvider.cs @@ -1,4 +1,4 @@ -// CombineEntryPropertyProvider.cs +// SolutionItemPropertyProvider.cs // //Author: // Lluis Sanchez Gual @@ -31,16 +31,16 @@ using MonoDevelop.Projects; namespace MonoDevelop.DesignerSupport.Projects { - class CombineEntryPropertyProvider: IPropertyProvider + class SolutionItemPropertyProvider: IPropertyProvider { public object CreateProvider (object obj) { - return new CombineEntryDescriptor ((CombineEntry)obj); + return new SolutionItemDescriptor ((SolutionItem)obj); } public bool SupportsObject (object obj) { - return obj is CombineEntry; + return obj is SolutionItem; } } } diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/ComponentNodeBuilder.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/ComponentNodeBuilder.cs index 27152b2d45..37f3911847 100644 --- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/ComponentNodeBuilder.cs +++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/ComponentNodeBuilder.cs @@ -41,7 +41,7 @@ namespace MonoDevelop.DesignerSupport.Projects // Don't use the CurrentNode property here since it may not be properly initialized when the event is fired. ITreeNavigator nav = Tree.GetNodeAtObject (obj); if (nav != null) { - CombineEntry ce = (CombineEntry) nav.GetParentDataItem (typeof(CombineEntry), true); + SolutionItem ce = (SolutionItem) nav.GetParentDataItem (typeof(SolutionItem), true); if (ce != null) { using (IProgressMonitor mon = IdeApp.Workbench.ProgressMonitors.GetSaveProgressMonitor (false)) { ce.Save (mon); diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/ProjectReferenceDescriptor.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/ProjectReferenceDescriptor.cs index 1ab217457b..de7ec122a6 100644 --- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/ProjectReferenceDescriptor.cs +++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/ProjectReferenceDescriptor.cs @@ -31,6 +31,7 @@ using System.ComponentModel; using MonoDevelop.Projects; using MonoDevelop.Core; using System.Reflection; +using MonoDevelop.Ide.Gui; namespace MonoDevelop.DesignerSupport.Projects { @@ -109,7 +110,7 @@ namespace MonoDevelop.DesignerSupport.Projects [Description ("Path to the assembly.")] public string Path { get { - string[] files = pref.GetReferencedFileNames (); + string[] files = pref.GetReferencedFileNames (IdeApp.Workspace.ActiveConfiguration); if (files.Length > 0) return files [0]; else diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/PropertyPadTextEditorExtension.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/PropertyPadTextEditorExtension.cs index 4753876dda..f4bec75eb4 100644 --- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/PropertyPadTextEditorExtension.cs +++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/PropertyPadTextEditorExtension.cs @@ -45,7 +45,7 @@ namespace MonoDevelop.DesignerSupport.Projects if (Document.HasProject) { string file = Document.FileName; - return Document.Project.ProjectFiles.GetFile (file); + return Document.Project.Files.GetFile (file); } else return null; @@ -63,7 +63,7 @@ namespace MonoDevelop.DesignerSupport.Projects public void OnChanged (object obj) { if (Document.HasProject) - IdeApp.ProjectOperations.SaveProject (Document.Project); + IdeApp.ProjectOperations.Save (Document.Project); } } } diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.addin.xml b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.addin.xml index c78c4dff86..a173a30625 100644 --- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.addin.xml +++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.addin.xml @@ -52,7 +52,7 @@ <Extension path = "/MonoDevelop/DesignerSupport/PropertyProviders" extension-nodes="Class"> <Class class = "MonoDevelop.DesignerSupport.Projects.ProjectItemPropertyProvider"/> - <Class class = "MonoDevelop.DesignerSupport.Projects.CombineEntryPropertyProvider"/> + <Class class = "MonoDevelop.DesignerSupport.Projects.SolutionItemPropertyProvider"/> </Extension> <!-- <Extension path = "/MonoDevelop/Ide/DisplayBindings"> diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/BindingService.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/BindingService.cs index cd4dba19cc..70dd098e28 100644 --- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/BindingService.cs +++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/BindingService.cs @@ -55,7 +55,7 @@ namespace MonoDevelop.DesignerSupport public static IMember GetCompatibleMemberInClass (IClass cls, CodeTypeMember member) { - IParserContext ctx = IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext ((MonoDevelop.Projects.Project) cls.SourceProject); + IParserContext ctx = IdeApp.Workspace.ParserDatabase.GetProjectParserContext ((MonoDevelop.Projects.Project) cls.SourceProject); return GetCompatibleMemberInClass (ctx, cls, member); } @@ -146,12 +146,12 @@ namespace MonoDevelop.DesignerSupport return false; } - public static IMember AddMemberToClass (CombineEntry entry, IClass cls, CodeTypeMember member, bool throwIfExists) + public static IMember AddMemberToClass (SolutionItem entry, IClass cls, CodeTypeMember member, bool throwIfExists) { return AddMemberToClass (entry, cls, cls.Parts[0], member, throwIfExists); } - public static IMember AddMemberToClass (CombineEntry entry, IClass cls, IClass specificPartToAffect, CodeTypeMember member, bool throwIfExists) + public static IMember AddMemberToClass (SolutionItem entry, IClass cls, IClass specificPartToAffect, CodeTypeMember member, bool throwIfExists) { bool isChildClass = false; foreach (IClass c in cls.Parts) @@ -171,9 +171,9 @@ namespace MonoDevelop.DesignerSupport return existingMember; } - public static CodeRefactorer GetCodeGenerator (CombineEntry entry) + public static CodeRefactorer GetCodeGenerator (SolutionItem entry) { - CodeRefactorer cr = new CodeRefactorer (entry.RootCombine, IdeApp.ProjectOperations.ParserDatabase); + CodeRefactorer cr = new CodeRefactorer (entry.ParentSolution, IdeApp.Workspace.ParserDatabase); cr.TextFileProvider = OpenDocumentFileProvider.Instance; return cr; } @@ -254,7 +254,7 @@ namespace MonoDevelop.DesignerSupport //opens the code view with the desired method, creating it if it doesn't already exist - public static void CreateAndShowMember (CombineEntry project, IClass cls, CodeTypeMember member) + public static void CreateAndShowMember (SolutionItem project, IClass cls, CodeTypeMember member) { //only adds the method if it doesn't already exist IMember mem = AddMemberToClass (project, cls, member, false); diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/CodeBehindService.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/CodeBehindService.cs index 288a2b08c6..3450bf3644 100644 --- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/CodeBehindService.cs +++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/CodeBehindService.cs @@ -55,11 +55,11 @@ namespace MonoDevelop.DesignerSupport internal void Initialise () { - IdeApp.ProjectOperations.FileRemovedFromProject += onFileEvent; - IdeApp.ProjectOperations.CombineClosed += onCombineClosed; + IdeApp.Workspace.FileRemovedFromProject += onFileEvent; + IdeApp.Workspace.SolutionUnloaded += onCombineClosed; - IdeApp.ProjectOperations.ParserDatabase.ParseInformationChanged += onParseInformationChanged; - IdeApp.ProjectOperations.ParserDatabase.ClassInformationChanged += onClassInformationChanged; + IdeApp.Workspace.ParserDatabase.ClassInformationChanged += onClassInformationChanged; + IdeApp.Workspace.ParserDatabase.ParseInformationChanged += onParseInformationChanged; } public void Dispose () @@ -68,11 +68,11 @@ namespace MonoDevelop.DesignerSupport if (codeBehindBindings != null) { codeBehindBindings = null; - IdeApp.ProjectOperations.FileRemovedFromProject -= onFileEvent; - IdeApp.ProjectOperations.CombineClosed -= onCombineClosed; + IdeApp.Workspace.FileRemovedFromProject -= onFileEvent; + IdeApp.Workspace.SolutionUnloaded -= onCombineClosed; - IdeApp.ProjectOperations.ParserDatabase.ParseInformationChanged -= onParseInformationChanged; - IdeApp.ProjectOperations.ParserDatabase.ClassInformationChanged -= onClassInformationChanged; + IdeApp.Workspace.ParserDatabase.ParseInformationChanged -= onParseInformationChanged; + IdeApp.Workspace.ParserDatabase.ClassInformationChanged -= onClassInformationChanged; } } @@ -147,10 +147,10 @@ namespace MonoDevelop.DesignerSupport if (parent == null) return; - Project prj = IdeApp.ProjectOperations.GetProjectContaining (args.FileName); + Project prj = IdeApp.Workspace.GetProjectContainingFile (args.FileName); if (prj != null) { - ProjectFile file = prj.ProjectFiles.GetFile (args.FileName); - IParserContext ctx = IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (file.Project); + ProjectFile file = prj.Files.GetFile (args.FileName); + IParserContext ctx = IdeApp.Workspace.ParserDatabase.GetProjectParserContext (file.Project); updateCodeBehind (file, parent.CodeBehindClassName, ctx); } } @@ -158,7 +158,7 @@ namespace MonoDevelop.DesignerSupport void AddAffectedFilesFromClass (Project project, IClass cls, List<ProjectFile> list) { foreach (IClass part in cls.Parts) { - ProjectFile pf = project.ProjectFiles.GetFile (part.Region.FileName); + ProjectFile pf = project.Files.GetFile (part.Region.FileName); if (pf != null && !list.Contains (pf)) { list.Add (pf); #if DEBUGCODEBEHINDGROUPING @@ -168,15 +168,24 @@ namespace MonoDevelop.DesignerSupport } } - void onCombineClosed (object sender, CombineEventArgs e) + void onCombineClosed (object sender, SolutionEventArgs e) { //loop through all project files in all combines and remove their Projectfiles from our list - foreach (CombineEntry entry in e.Combine.Entries) { - Project proj = entry as Project; - if (proj != null) - foreach (ProjectFile pf in proj.ProjectFiles) - if (codeBehindBindings.ContainsKey (pf)) - codeBehindBindings.Remove (pf); + foreach (Project proj in e.Solution.GetAllProjects ()) { + foreach (ProjectFile pf in proj.Files) + if (codeBehindBindings.ContainsKey (pf)) + codeBehindBindings.Remove (pf); + } + } + + void RefreshFileList () + { + codeBehindBindings.Clear (); + + //loop through all project files in all combines and check for CodeBehind + foreach (Project proj in IdeApp.Workspace.GetAllProjects ()) { + foreach (ProjectFile pf in proj.Files) + updateCodeBehind (pf); } } @@ -188,7 +197,7 @@ namespace MonoDevelop.DesignerSupport return; string newCodeBehind = null; - IParserContext ctx = IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (file.Project); + IParserContext ctx = IdeApp.Workspace.ParserDatabase.GetProjectParserContext (file.Project); IParseInformation pi = ctx.GetParseInformation (file.FilePath); if (pi != null) { ICodeBehindParent parent = pi.BestCompilationUnit as ICodeBehindParent; @@ -255,7 +264,7 @@ namespace MonoDevelop.DesignerSupport string clsName = null; codeBehindBindings.TryGetValue (file, out clsName); if (clsName != null) { - IParserContext ctx = IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (file.Project); + IParserContext ctx = IdeApp.Workspace.ParserDatabase.GetProjectParserContext (file.Project); cls = ctx.GetClass (clsName); if (cls != null) { return new CodeBehindClass (cls); @@ -286,7 +295,7 @@ namespace MonoDevelop.DesignerSupport part.FullyQualifiedName); continue; } - ProjectFile partFile = proj.ProjectFiles.GetFile (part.Region.FileName); + ProjectFile partFile = proj.Files.GetFile (part.Region.FileName); if (partFile == parent) continue; if (partFile != null) @@ -301,7 +310,7 @@ namespace MonoDevelop.DesignerSupport //determines whether a file contains only codebehind classes public bool ContainsCodeBehind (ProjectFile file) { - IParserContext ctx = IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (file.Project); + IParserContext ctx = IdeApp.Workspace.ParserDatabase.GetProjectParserContext (file.Project); if (ctx == null) return false; diff --git a/main/src/addins/MonoDevelop.Gettext/ChangeLog b/main/src/addins/MonoDevelop.Gettext/ChangeLog index f9c2816940..ba2955a9d7 100644 --- a/main/src/addins/MonoDevelop.Gettext/ChangeLog +++ b/main/src/addins/MonoDevelop.Gettext/ChangeLog @@ -1,3 +1,23 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * MonoDevelop.Gettext.NodeBuilders/TranslationNodeBuilder.cs, + MonoDevelop.Gettext.NodeBuilders/TranslationProjectNodeBuilder.cs, + MonoDevelop.Gettext.mdp, + MonoDevelop.Gettext.Editor/POEditorWidget.cs, + gtk-gui/MonoDevelop.Gettext.Translator.LanguageChooserDialog.cs, + gtk-gui/MonoDevelop.Gettext.TranslationProjectOptionsDialog.cs, + gtk-gui/gui.stetic, Makefile.am, + MonoDevelop.Gettext/MakefileHandler.cs, + MonoDevelop.Gettext/TranslationService.cs, + MonoDevelop.Gettext/TranslationProjectOptionsDialog.cs, + MonoDevelop.Gettext/GettextTool.cs, + MonoDevelop.Gettext/TranslationProject.cs, + MonoDevelop.Gettext/Translation.cs, + MonoDevelop.Gettext/GettextFeature.cs, + MonoDevelop.Gettext/GettextFeatureWidget.cs, + MonoDevelop.Gettext/TranslationCollection.cs: New project model + changes. + 2008-05-08 Michael Hutchinson <mhutchinson@novell.com> * MonoDevelop.Gettext.addin.xml: Set "isText" attribute on the mimetype diff --git a/main/src/addins/MonoDevelop.Gettext/Makefile.am b/main/src/addins/MonoDevelop.Gettext/Makefile.am index 39aea6f576..a32fd60219 100644 --- a/main/src/addins/MonoDevelop.Gettext/Makefile.am +++ b/main/src/addins/MonoDevelop.Gettext/Makefile.am @@ -57,6 +57,7 @@ FILES = \ MonoDevelop.Gettext/RegexFileScanner.cs \ MonoDevelop.Gettext/StringEscaping.cs \ MonoDevelop.Gettext/Translation.cs \ + MonoDevelop.Gettext/TranslationCollection.cs \ MonoDevelop.Gettext/TranslationProject.cs \ MonoDevelop.Gettext/TranslationProjectOptionsDialog.cs \ MonoDevelop.Gettext/TranslationService.cs diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs index 735daeb85d..b7a2cd1704 100644 --- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs +++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.Editor/POEditorWidget.cs @@ -480,7 +480,7 @@ namespace MonoDevelop.Gettext AlertButton.Cancel, AlertButton.Remove) == AlertButton.Remove; if (yes) { - TranslationProject project = IdeApp.ProjectOperations.CurrentSelectedCombineEntry as TranslationProject; + TranslationProject project = IdeApp.ProjectOperations.CurrentSelectedSolutionItem as TranslationProject; if (project != null) { foreach (POEditorWidget widget in widgets) widget.RemoveEntryByString (entry.String); diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.NodeBuilders/TranslationNodeBuilder.cs b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.NodeBuilders/TranslationNodeBuilder.cs index 6a4b651de9..94f2600927 100644 --- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.NodeBuilders/TranslationNodeBuilder.cs +++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.NodeBuilders/TranslationNodeBuilder.cs @@ -111,7 +111,7 @@ namespace MonoDevelop.Gettext.NodeBuilders return; bool yes = MonoDevelop.Core.Gui.MessageService.AskQuestion (GettextCatalog.GetString ( - "Do you really want to remove the translation {0} from solution {1}?", translation.IsoCode, project.ParentCombine.Name), AlertButton.Cancel, AlertButton.Remove) == AlertButton.Remove; + "Do you really want to remove the translation {0} from solution {1}?", translation.IsoCode, project.ParentFolder.Name), AlertButton.Cancel, AlertButton.Remove) == AlertButton.Remove; if (yes) { string fileName = Path.Combine (project.BaseDirectory, translation.FileName); @@ -120,7 +120,7 @@ namespace MonoDevelop.Gettext.NodeBuilders } project.RemoveTranslation (translation.IsoCode); - IdeApp.ProjectOperations.SaveCombineEntry (project); + IdeApp.ProjectOperations.Save (project); } } diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.NodeBuilders/TranslationProjectNodeBuilder.cs b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.NodeBuilders/TranslationProjectNodeBuilder.cs index ee682bb202..cf888a251f 100644 --- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.NodeBuilders/TranslationProjectNodeBuilder.cs +++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.NodeBuilders/TranslationProjectNodeBuilder.cs @@ -123,12 +123,13 @@ namespace MonoDevelop.Gettext.NodeBuilders return; bool yes = MonoDevelop.Core.Gui.MessageService.AskQuestion (GettextCatalog.GetString ( - "Do you really want to remove the translations from solution {0}?", project.ParentCombine.Name), AlertButton.Cancel, AlertButton.Remove) == AlertButton.Remove; + "Do you really want to remove the translations from solution {0}?", project.ParentFolder.Name), AlertButton.Cancel, AlertButton.Remove) == AlertButton.Remove; if (yes) { - project.ParentCombine.RemoveEntry (project); + Solution sol = project.ParentSolution; + project.ParentFolder.Items.Remove (project); project.Dispose (); - IdeApp.ProjectOperations.SaveCombine (); + IdeApp.ProjectOperations.Save (sol); } } @@ -140,7 +141,7 @@ namespace MonoDevelop.Gettext.NodeBuilders return; TranslationProjectOptionsDialog options = new TranslationProjectOptionsDialog (project); options.Run (); - IdeApp.ProjectOperations.SaveCombine (); + IdeApp.Workspace.Save (); } [CommandUpdateHandler (Commands.AddTranslation)] diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.mdp b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.mdp index ec8fb7499a..871c6e2ce6 100644 --- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.mdp +++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.mdp @@ -67,6 +67,7 @@ <File name="MonoDevelop.Gettext.ExtensionNodes/TransformExtensionNode.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Gettext/StringEscaping.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Gettext/PluralForms.cs" subtype="Code" buildaction="Compile" /> + <File name="MonoDevelop.Gettext/TranslationCollection.cs" subtype="Code" buildaction="Compile" /> </Contents> <References> <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/GettextFeature.cs b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/GettextFeature.cs index 2f4a1c55a1..4fa3bbc925 100644 --- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/GettextFeature.cs +++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/GettextFeature.cs @@ -36,7 +36,7 @@ using MonoDevelop.Core; namespace MonoDevelop.Gettext { - public class GettextFeature : ICombineEntryFeature + public class GettextFeature : ISolutionItemFeature { public string Title { get { return GettextCatalog.GetString ("Translation"); } @@ -46,27 +46,27 @@ namespace MonoDevelop.Gettext get { return GettextCatalog.GetString ("Add a Translation Project to the solution that will use gettext to generate a set of PO files for the new project."); } } - public bool SupportsCombineEntry (Combine parentCombine, CombineEntry entry) + public bool SupportsSolutionItem (SolutionFolder parentCombine, SolutionItem entry) { return ((entry is Project) || (entry is TranslationProject)) && parentCombine != null; } - public Widget CreateFeatureEditor (Combine parentCombine, CombineEntry entry) + public Widget CreateFeatureEditor (SolutionFolder parentCombine, SolutionItem entry) { return new GettextFeatureWidget (); } - public void ApplyFeature (Combine parentCombine, CombineEntry entry, Widget editor) + public void ApplyFeature (SolutionFolder parentCombine, SolutionItem entry, Widget editor) { ((GettextFeatureWidget)editor).ApplyFeature (parentCombine, entry); } - public string Validate (Combine parentCombine, CombineEntry entry, Gtk.Widget editor) + public string Validate (SolutionFolder parentCombine, SolutionItem entry, Gtk.Widget editor) { return null; } - public bool IsEnabled (Combine parentCombine, CombineEntry entry) + public bool IsEnabled (SolutionFolder parentCombine, SolutionItem entry) { return entry is TranslationProject; } diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/GettextFeatureWidget.cs b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/GettextFeatureWidget.cs index 6388dfc1e6..eb17096c58 100644 --- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/GettextFeatureWidget.cs +++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/GettextFeatureWidget.cs @@ -81,7 +81,7 @@ namespace MonoDevelop.Gettext }; } - public void ApplyFeature (Combine parentCombine, CombineEntry entry) + public void ApplyFeature (SolutionFolder parentCombine, SolutionItem entry) { TranslationProject newProject; if (entry is TranslationProject) @@ -93,7 +93,7 @@ namespace MonoDevelop.Gettext if (!System.IO.Directory.Exists (path)) System.IO.Directory.CreateDirectory (path); newProject.FileName = System.IO.Path.Combine (path, newProject.Name + ".mdse"); - parentCombine.Entries.Add (newProject); + parentCombine.Items.Add (newProject); } TreeIter iter; diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/GettextTool.cs b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/GettextTool.cs index c2e64827c1..3aff1a8d55 100644 --- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/GettextTool.cs +++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/GettextTool.cs @@ -66,31 +66,31 @@ namespace MonoDevelop.Gettext ConsoleProgressMonitor monitor = new ConsoleProgressMonitor (); monitor.IgnoreLogMessages = true; - CombineEntry centry = Services.ProjectService.ReadCombineEntry (file, monitor); + WorkspaceItem centry = Services.ProjectService.ReadWorkspaceItem (monitor, file); monitor.IgnoreLogMessages = false; - Combine combine = centry as Combine; - if (combine == null) { + Solution solution = centry as Solution; + if (solution == null) { Console.WriteLine ("File is not a solution: " + file); return 1; } if (project != null) { - centry = combine.FindProject (project); + SolutionEntityItem item = solution.FindProjectByName (project); - if (centry == null) { + if (item == null) { Console.WriteLine ("The project '" + project + "' could not be found in " + file); return 1; } - TranslationProject tp = centry as TranslationProject; + TranslationProject tp = item as TranslationProject; if (tp == null) { - Console.WriteLine ("The project '" + centry.FileName + "' is not a translation project"); + Console.WriteLine ("The project '" + item.FileName + "' is not a translation project"); return 1; } tp.UpdateTranslations (monitor); } else { - foreach (TranslationProject p in combine.GetAllEntries (typeof(TranslationProject))) + foreach (TranslationProject p in solution.GetAllSolutionItems <TranslationProject>()) p.UpdateTranslations (monitor); } diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/MakefileHandler.cs b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/MakefileHandler.cs index a4ca98f7cd..eaea2ec93d 100644 --- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/MakefileHandler.cs +++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/MakefileHandler.cs @@ -39,12 +39,12 @@ namespace MonoDevelop.Gettext { public class MakefileHandler: IMakefileHandler { - public bool CanDeploy (CombineEntry entry, MakefileType type) + public bool CanDeploy (SolutionItem entry, MakefileType type) { return entry is TranslationProject; } - public Makefile Deploy (AutotoolsContext ctx, CombineEntry entry, IProgressMonitor monitor) + public Makefile Deploy (AutotoolsContext ctx, SolutionItem entry, IProgressMonitor monitor) { Makefile mkfile = new Makefile (); TranslationProject project = (TranslationProject) entry; @@ -64,11 +64,11 @@ namespace MonoDevelop.Gettext dir = dir.Replace ("@PACKAGE@", "$(PACKAGE)"); TemplateEngine templateEngine = new TemplateEngine (); - templateEngine.Variables ["TOP_SRCDIR"] = FileService.AbsoluteToRelativePath (project.BaseDirectory, ctx.TargetCombine.BaseDirectory); + templateEngine.Variables ["TOP_SRCDIR"] = FileService.AbsoluteToRelativePath (project.BaseDirectory, ctx.TargetSolution.BaseDirectory); templateEngine.Variables ["FILES"] = files.ToString (); templateEngine.Variables ["BUILD_DIR"] = "."; templateEngine.Variables ["INSTALL_DIR"] = "$(DESTDIR)" + dir; - templateEngine.Variables ["ALL_TARGET"] = (ctx.TargetCombine.BaseDirectory == project.BaseDirectory) ? "all-local" : "all"; + templateEngine.Variables ["ALL_TARGET"] = (ctx.TargetSolution.BaseDirectory == project.BaseDirectory) ? "all-local" : "all"; StringWriter sw = new StringWriter (); diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/Translation.cs b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/Translation.cs index ffd6b82c69..d55ba461a3 100644 --- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/Translation.cs +++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/Translation.cs @@ -76,11 +76,10 @@ namespace MonoDevelop.Gettext } } - public string OutFile { - get { - string moDirectory = Path.Combine (Path.Combine (parentProject.OutputDirectory, isoCode), "LC_MESSAGES"); - return Path.Combine (moDirectory, parentProject.PackageName + ".mo"); - } + public string GetOutFile (string configuration) + { + string moDirectory = Path.Combine (Path.Combine (parentProject.GetOutputDirectory (configuration), isoCode), "LC_MESSAGES"); + return Path.Combine (moDirectory, parentProject.PackageName + ".mo"); } } diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationCollection.cs b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationCollection.cs new file mode 100644 index 0000000000..ab45284625 --- /dev/null +++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationCollection.cs @@ -0,0 +1,96 @@ +// TranslationCollection.cs +// +// Author: +// Lluis Sanchez Gual <lluis@novell.com> +// +// Copyright (c) 2008 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +// + +using System; +using System.Collections.ObjectModel; +using System.Collections.Generic; + +namespace MonoDevelop.Gettext +{ + public class TranslationCollection: Collection<Translation> + { + TranslationProject project; + + public TranslationCollection () + { + } + + public Translation[] ToArray () + { + Translation[] array = new Translation [Count]; + CopyTo (array, 0); + return array; + } + + internal TranslationCollection (TranslationProject project) + { + this.project = project; + } + + protected override void InsertItem (int index, Translation item) + { + base.InsertItem (index, item); + if (project != null) { + item.ParentProject = project; + project.NotifyTranslationAdded (item); + } + } + + protected override void SetItem (int index, Translation item) + { + Translation old = this[index]; + if (project != null) + old.ParentProject = null; + base.SetItem (index, item); + if (project != null) { + item.ParentProject = project; + project.NotifyTranslationRemoved (old); + project.NotifyTranslationAdded (item); + } + } + + protected override void RemoveItem (int index) + { + Translation old = this[index]; + base.RemoveItem (index); + if (project != null) { + old.ParentProject = null; + project.NotifyTranslationRemoved (old); + } + } + + protected override void ClearItems () + { + List<Translation> copy = new List<Translation> (this); + base.ClearItems (); + foreach (Translation t in copy) { + t.ParentProject = null; + project.NotifyTranslationRemoved (t); + } + } + } +} diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationProject.cs b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationProject.cs index 81c9b3ec4c..81ff7d1f9f 100644 --- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationProject.cs +++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationProject.cs @@ -46,7 +46,7 @@ using MonoDevelop.Deployment; namespace MonoDevelop.Gettext { - public class TranslationProject : CombineEntry, IDeployable + public class TranslationProject : SolutionEntityItem, IDeployable { [ItemProperty("packageName")] string packageName = null; @@ -72,14 +72,14 @@ namespace MonoDevelop.Gettext set { outputType = value; } } - [ItemProperty] - List<Translation> translations = new List<Translation> (); + TranslationCollection translations; [ItemProperty] List<TranslationProjectInformation> projectInformations = new List<TranslationProjectInformation> (); - public ReadOnlyCollection<Translation> Translations { - get { return translations.AsReadOnly (); } + [ItemProperty ("translations")] + public TranslationCollection Translations { + get { return translations; } } public ReadOnlyCollection<TranslationProjectInformation> TranslationProjectInformations { @@ -88,19 +88,22 @@ namespace MonoDevelop.Gettext public TranslationProject () { - this.NeedsBuilding = true; + translations = new TranslationCollection (this); + SetNeedsBuilding (true); isDirty = true; } - protected override StringCollection OnGetExportFiles () + protected override List<string> OnGetItemFiles (bool includeReferencedFiles) { - StringCollection col = base.OnGetExportFiles (); - foreach (Translation tr in translations) - col.Add (tr.PoFile); + List<string> col = base.OnGetItemFiles (includeReferencedFiles); + if (includeReferencedFiles) { + foreach (Translation tr in translations) + col.Add (tr.PoFile); + } return col; } - public TranslationProjectInformation GetProjectInformation (CombineEntry entry, bool force) + public TranslationProjectInformation GetProjectInformation (SolutionItem entry, bool force) { foreach (TranslationProjectInformation info in this.projectInformations) { if (info.ProjectName == entry.Name) @@ -114,7 +117,7 @@ namespace MonoDevelop.Gettext return null; } - public bool IsIncluded (CombineEntry entry) + public bool IsIncluded (SolutionItem entry) { TranslationProjectInformation info = GetProjectInformation (entry, false); if (info != null) @@ -178,9 +181,7 @@ namespace MonoDevelop.Gettext monitor.ReportSuccess (String.Format (GettextCatalog.GetString ("Language '{0}' successfully added."), isoCode)); monitor.Step (1); - isDirty = true; this.Save (monitor); - OnTranslationAdded (EventArgs.Empty); return tr; } catch (Exception e) { monitor.ReportError (String.Format ( GettextCatalog.GetString ("Language '{0}' could not be added: "), isoCode), e); @@ -202,27 +203,35 @@ namespace MonoDevelop.Gettext public void RemoveTranslation (string isoCode) { Translation translation = GetTranslation (isoCode); - if (translation != null) { + if (translation != null) this.translations.Remove (translation); - OnTranslationRemoved (EventArgs.Empty); - isDirty = true; - } } - public override IConfiguration CreateConfiguration (string name) + internal void NotifyTranslationAdded (Translation tr) + { + isDirty = true; + OnTranslationAdded (EventArgs.Empty); + } + + internal void NotifyTranslationRemoved (Translation tr) + { + isDirty = true; + OnTranslationRemoved (EventArgs.Empty); + } + + public override SolutionItemConfiguration CreateConfiguration (string name) { return new TranslationProjectConfiguration (name); } - internal string OutputDirectory { - get { - if (this.ParentCombine.StartupEntry == null) - return BaseDirectory; - if (this.ParentCombine.StartupEntry is DotNetProject) { - return Path.Combine (Path.GetDirectoryName (((DotNetProject)RootCombine.StartupEntry).GetOutputFileName ()), RelPath); - } - return Path.Combine (this.RootCombine.StartupEntry.BaseDirectory, RelPath); + internal string GetOutputDirectory (string configuration) + { + if (this.ParentSolution.StartupEntry == null) + return BaseDirectory; + if (this.ParentSolution.StartupEntry is DotNetProject) { + return Path.Combine (Path.GetDirectoryName (((DotNetProject)ParentSolution.StartupEntry).GetOutputFileName (configuration)), RelPath); } + return Path.Combine (this.ParentSolution.StartupEntry.BaseDirectory, RelPath); } void CreateDefaultCatalog (IProgressMonitor monitor) @@ -231,13 +240,13 @@ namespace MonoDevelop.Gettext Catalog catalog = new Catalog (); List<Project> projects = new List<Project> (); - foreach (Project p in RootCombine.GetAllProjects ()) { + foreach (Project p in ParentSolution.GetAllProjects ()) { if (IsIncluded (p)) projects.Add (p); } foreach (Project p in projects) { monitor.Log.WriteLine (GettextCatalog.GetString ("Scanning project {0}...", p.Name)); - foreach (ProjectFile file in p.ProjectFiles) { + foreach (ProjectFile file in p.Files) { if (!File.Exists (file.FilePath)) continue; if (file.Subtype == Subtype.Code) { @@ -257,7 +266,7 @@ namespace MonoDevelop.Gettext public void UpdateTranslations (IProgressMonitor monitor) { - UpdateTranslations (monitor, this.translations.ToArray ()); + UpdateTranslations (monitor, translations.ToArray ()); } public void UpdateTranslations (IProgressMonitor monitor, params Translation[] translations) @@ -266,7 +275,7 @@ namespace MonoDevelop.Gettext try { List<Project> projects = new List<Project> (); - foreach (Project p in RootCombine.GetAllProjects ()) { + foreach (Project p in ParentSolution.GetAllProjects ()) { if (IsIncluded (p)) projects.Add (p); } @@ -324,18 +333,10 @@ namespace MonoDevelop.Gettext } } - protected override void Deserialize (ITypeSerializer handler, DataCollection data) - { - base.Deserialize (handler, data); - foreach (Translation translation in this.Translations) - translation.ParentProject = this; - } - - - protected override ICompilerResult OnBuild (IProgressMonitor monitor) + protected override ICompilerResult OnBuild (IProgressMonitor monitor, string configuration) { CompilerResults results = new CompilerResults (null); - string outputDirectory = OutputDirectory; + string outputDirectory = GetOutputDirectory (configuration); if (!string.IsNullOrEmpty (outputDirectory)) { foreach (Translation translation in this.Translations) { string poFileName = translation.PoFile; @@ -362,17 +363,17 @@ namespace MonoDevelop.Gettext } } isDirty = false; - this.NeedsBuilding = false; + SetNeedsBuilding (false); } return new DefaultCompilerResult (results, ""); } - protected override void OnClean (IProgressMonitor monitor) + protected override void OnClean (IProgressMonitor monitor, string configuration) { isDirty = true; - this.NeedsBuilding = true; + SetNeedsBuilding (true); monitor.Log.WriteLine (GettextCatalog.GetString ("Removing all .mo files.")); - string outputDirectory = OutputDirectory; + string outputDirectory = GetOutputDirectory (configuration); if (string.IsNullOrEmpty (outputDirectory)) return; foreach (Translation translation in this.Translations) { @@ -383,12 +384,12 @@ namespace MonoDevelop.Gettext } } - protected override void OnExecute (IProgressMonitor monitor, MonoDevelop.Projects.ExecutionContext context) + protected override void OnExecute (IProgressMonitor monitor, MonoDevelop.Projects.ExecutionContext context, string configuration) { } #region Deployment - public DeployFileCollection GetDeployFiles () + public DeployFileCollection GetDeployFiles (string configuration) { DeployFileCollection result = new DeployFileCollection (); foreach (Translation translation in this.Translations) { @@ -396,12 +397,12 @@ namespace MonoDevelop.Gettext string moDirectory = Path.Combine ("locale", translation.IsoCode); moDirectory = Path.Combine (moDirectory, "LC_MESSAGES"); string moFileName = Path.Combine (moDirectory, PackageName + ".mo"); - result.Add (new DeployFile (this, translation.OutFile, moFileName, TargetDirectory.CommonApplicationDataRoot)); + result.Add (new DeployFile (this, translation.GetOutFile (configuration), moFileName, TargetDirectory.CommonApplicationDataRoot)); } else { string moDirectory = Path.Combine (RelPath, translation.IsoCode); moDirectory = Path.Combine (moDirectory, "LC_MESSAGES"); string moFileName = Path.Combine (moDirectory, PackageName + ".mo"); - result.Add (new DeployFile (this, translation.OutFile, moFileName, TargetDirectory.ProgramFiles)); + result.Add (new DeployFile (this, translation.GetOutFile (configuration), moFileName, TargetDirectory.ProgramFiles)); } } return result; @@ -409,12 +410,12 @@ namespace MonoDevelop.Gettext #endregion bool isDirty = true; - protected override bool OnGetNeedsBuilding () + protected override bool OnGetNeedsBuilding (string configuration) { return this.isDirty; } - protected override void OnSetNeedsBuilding (bool val) + protected override void OnSetNeedsBuilding (bool val, string configuration) { isDirty = val; } @@ -441,34 +442,13 @@ namespace MonoDevelop.Gettext SystemPath } - public class TranslationProjectConfiguration : IConfiguration + public class TranslationProjectConfiguration : SolutionItemConfiguration { - [ItemProperty] - string name; - - public string Name { - get { - return name; - } - } - public TranslationProjectConfiguration () { } - public TranslationProjectConfiguration (string name) - { - this.name = name; - } - - public object Clone () - { - IConfiguration conf = (IConfiguration) MemberwiseClone (); - conf.CopyFrom (this); - return conf; - } - - public virtual void CopyFrom (IConfiguration configuration) + public TranslationProjectConfiguration (string name): base (name) { } } diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationProjectOptionsDialog.cs b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationProjectOptionsDialog.cs index 4fdded4021..365e8cb514 100644 --- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationProjectOptionsDialog.cs +++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationProjectOptionsDialog.cs @@ -66,7 +66,7 @@ namespace MonoDevelop.Gettext this.Destroy (); }; - store = new TreeStore (typeof(string), typeof(bool), typeof(string), typeof(CombineEntry), typeof(bool)); + store = new TreeStore (typeof(string), typeof(bool), typeof(string), typeof(SolutionItem), typeof(bool)); treeviewProjectList.Model = store; treeviewProjectList.HeadersVisible = false; @@ -89,7 +89,7 @@ namespace MonoDevelop.Gettext treeviewProjectList.AppendColumn (col); - FillTree (TreeIter.Zero, project.ParentCombine); + FillTree (TreeIter.Zero, project.ParentFolder); } void ActiveToggled (object sender, ToggledArgs e) @@ -97,7 +97,7 @@ namespace MonoDevelop.Gettext TreeIter iter; if (store.GetIterFromString (out iter, e.Path)) { bool isTogglod = (bool)store.GetValue (iter, 1); - CombineEntry entry = (CombineEntry)store.GetValue (iter, 3); + SolutionItem entry = (SolutionItem)store.GetValue (iter, 3); if (entry is Project) { TranslationProjectInformation info = project.GetProjectInformation (entry, true); info.IsIncluded = !isTogglod; @@ -107,9 +107,9 @@ namespace MonoDevelop.Gettext } TreeStore store; - string GetIcon (CombineEntry entry) + string GetIcon (SolutionItem entry) { - if (entry is Combine) + if (entry is SolutionFolder) return MonoDevelop.Core.Gui.Stock.Solution; if (entry is Project) @@ -118,10 +118,10 @@ namespace MonoDevelop.Gettext return MonoDevelop.Core.Gui.Stock.Project; } - bool IsIncluded (CombineEntry entry) + bool IsIncluded (SolutionItem entry) { - if (entry is Combine) { - foreach (CombineEntry childEntry in ((Combine)entry).Entries) + if (entry is SolutionFolder) { + foreach (SolutionItem childEntry in ((SolutionFolder)entry).Items) if (!IsIncluded (childEntry)) return false; return true; @@ -133,20 +133,20 @@ namespace MonoDevelop.Gettext return true; } - void FillTree (TreeIter iter, CombineEntry entry) + void FillTree (TreeIter iter, SolutionItem entry) { TreeIter curIter; if (!iter.Equals (TreeIter.Zero)) { - curIter = store.AppendValues (iter, GetIcon (entry), entry is Combine ? false : IsIncluded (entry), entry.Name, entry, !(entry is Combine)); + curIter = store.AppendValues (iter, GetIcon (entry), entry is SolutionFolder ? false : IsIncluded (entry), entry.Name, entry, !(entry is SolutionFolder)); } else { - curIter = store.AppendValues (GetIcon (entry), entry is Combine ? false : IsIncluded (entry), entry.Name, entry, !(entry is Combine)); + curIter = store.AppendValues (GetIcon (entry), entry is SolutionFolder ? false : IsIncluded (entry), entry.Name, entry, !(entry is SolutionFolder)); } - if (entry is Combine) { + if (entry is SolutionFolder) { // Add solutions first, then projects - foreach (CombineEntry childEntry in ((Combine)entry).Entries) - if (childEntry is Combine) + foreach (SolutionItem childEntry in ((SolutionFolder)entry).Items) + if (childEntry is SolutionFolder) FillTree (curIter, childEntry); - foreach (CombineEntry childEntry in ((Combine)entry).Entries) + foreach (SolutionItem childEntry in ((SolutionFolder)entry).Items) if (!(childEntry is TranslationProject) && (childEntry is Project)) FillTree (curIter, childEntry); } diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationService.cs b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationService.cs index 9aff8f71ca..de9566914f 100644 --- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationService.cs +++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext/TranslationService.cs @@ -42,16 +42,6 @@ namespace MonoDevelop.Gettext { public class TranslationService { - static bool isTranslationEnabled = false; - - public static bool IsTranslationEnabled { - get { - return isTranslationEnabled; - } - set { - isTranslationEnabled = value; - } - } static bool isInitialized = false; internal static void InitializeTranslationService () { @@ -59,29 +49,12 @@ namespace MonoDevelop.Gettext if (isInitialized) return; isInitialized = true; - IdeApp.ProjectOperations.CombineOpened += new CombineEventHandler (CombineOpened); - IdeApp.ProjectOperations.CombineClosed += delegate { - isTranslationEnabled = false; - }; } public static IFileScanner[] GetFileScanners () { return (IFileScanner[]) AddinManager.GetExtensionObjects ("/MonoDevelop/Gettext/FileScanners", typeof(IFileScanner), true); } - - static void CombineOpened (object sender, CombineEventArgs e) - { - foreach (CombineEntry entry in e.Combine.Entries) { - if (entry is TranslationProject) { - isTranslationEnabled = true; - return; - } - } - isTranslationEnabled = false; - } - - } public class TranslationServiceStartupCommand : CommandHandler diff --git a/main/src/addins/MonoDevelop.Gettext/gtk-gui/MonoDevelop.Gettext.TranslationProjectOptionsDialog.cs b/main/src/addins/MonoDevelop.Gettext/gtk-gui/MonoDevelop.Gettext.TranslationProjectOptionsDialog.cs index ab85eb2238..da9ab39fd2 100644 --- a/main/src/addins/MonoDevelop.Gettext/gtk-gui/MonoDevelop.Gettext.TranslationProjectOptionsDialog.cs +++ b/main/src/addins/MonoDevelop.Gettext/gtk-gui/MonoDevelop.Gettext.TranslationProjectOptionsDialog.cs @@ -288,7 +288,7 @@ namespace MonoDevelop.Gettext { // Internal child MonoDevelop.Gettext.TranslationProjectOptionsDialog.ActionArea Gtk.HButtonBox w24 = this.ActionArea; w24.Name = "dialog1_ActionArea"; - w24.Spacing = 10; + w24.Spacing = 6; w24.BorderWidth = ((uint)(5)); w24.LayoutStyle = ((Gtk.ButtonBoxStyle)(4)); // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild diff --git a/main/src/addins/MonoDevelop.Gettext/gtk-gui/MonoDevelop.Gettext.Translator.LanguageChooserDialog.cs b/main/src/addins/MonoDevelop.Gettext/gtk-gui/MonoDevelop.Gettext.Translator.LanguageChooserDialog.cs index 56b859f4a0..29eca0f3e2 100644 --- a/main/src/addins/MonoDevelop.Gettext/gtk-gui/MonoDevelop.Gettext.Translator.LanguageChooserDialog.cs +++ b/main/src/addins/MonoDevelop.Gettext/gtk-gui/MonoDevelop.Gettext.Translator.LanguageChooserDialog.cs @@ -263,7 +263,7 @@ namespace MonoDevelop.Gettext.Translator { this.buttonOK.UseStock = true; this.buttonOK.UseUnderline = true; this.buttonOK.Label = "gtk-add"; - this.AddActionWidget(this.buttonOK, 0); + this.AddActionWidget(this.buttonOK, -5); Gtk.ButtonBox.ButtonBoxChild w22 = ((Gtk.ButtonBox.ButtonBoxChild)(w20[this.buttonOK])); w22.Position = 1; w22.Expand = false; @@ -272,7 +272,7 @@ namespace MonoDevelop.Gettext.Translator { this.Child.ShowAll(); } this.DefaultWidth = 466; - this.DefaultHeight = 401; + this.DefaultHeight = 415; this.label3.MnemonicWidget = this.languageTreeView; this.label2.MnemonicWidget = this.entryLocale; this.Show(); diff --git a/main/src/addins/MonoDevelop.Gettext/gtk-gui/gui.stetic b/main/src/addins/MonoDevelop.Gettext/gtk-gui/gui.stetic index bb3c207108..6cd1213ffb 100644 --- a/main/src/addins/MonoDevelop.Gettext/gtk-gui/gui.stetic +++ b/main/src/addins/MonoDevelop.Gettext/gtk-gui/gui.stetic @@ -2,7 +2,7 @@ <stetic-interface> <configuration> <images-root-path>..</images-root-path> - <target-gtk-version>2.10.2</target-gtk-version> + <target-gtk-version>2.10.3</target-gtk-version> </configuration> <import> <widget-library name="../../../../build/bin/MonoDevelop.Projects.Gui.dll" /> @@ -616,7 +616,7 @@ </widget> </child> </widget> - <widget class="Gtk.Dialog" id="MonoDevelop.Gettext.Translator.LanguageChooserDialog" design-size="466 401"> + <widget class="Gtk.Dialog" id="MonoDevelop.Gettext.Translator.LanguageChooserDialog" design-size="466 415"> <property name="MemberName" /> <property name="Events">ButtonPressMask</property> <property name="Title" translatable="yes">Create New Localization</property> @@ -894,7 +894,7 @@ <property name="UseStock">True</property> <property name="Type">StockItem</property> <property name="StockId">gtk-add</property> - <property name="ResponseId">0</property> + <property name="ResponseId">-5</property> <property name="label">gtk-add</property> </widget> <packing> @@ -1229,7 +1229,7 @@ <child internal-child="ActionArea"> <widget class="Gtk.HButtonBox" id="dialog1_ActionArea"> <property name="MemberName" /> - <property name="Spacing">10</property> + <property name="Spacing">6</property> <property name="BorderWidth">5</property> <property name="Size">2</property> <property name="LayoutStyle">End</property> diff --git a/main/src/addins/MonoDevelop.GtkCore/ChangeLog b/main/src/addins/MonoDevelop.GtkCore/ChangeLog index 94b35134e2..2d67af2475 100644 --- a/main/src/addins/MonoDevelop.GtkCore/ChangeLog +++ b/main/src/addins/MonoDevelop.GtkCore/ChangeLog @@ -1,3 +1,29 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * MonoDevelop.GtkCore/GtkDesignInfo.cs, + MonoDevelop.GtkCore/GtkCoreService.cs, + MonoDevelop.GtkCore/WidgetFileDescriptionTemplate.cs, + MonoDevelop.GtkCore/ProjectResourceProvider.cs, + MonoDevelop.GtkCore.addin.xml, + MonoDevelop.GtkCore.NodeBuilders/ProjectFolderNodeBuilderExtension.cs, + MonoDevelop.GtkCore.NodeBuilders/WidgetNodeBuilder.cs, + MonoDevelop.GtkCore.NodeBuilders/ActionGroupNodeBuilder.cs, + MonoDevelop.GtkCore.mdp, + MonoDevelop.GtkCore.Dialogs/WidgetBuilderOptionPanel.cs, + MonoDevelop.GtkCore.Dialogs/GtkFeatureWidget.cs, + MonoDevelop.GtkCore.mds, lib/libsteticui.mdp, lib/libstetic.mdp, + Makefile.am, + MonoDevelop.GtkCore.GuiBuilder/ActionGroupDisplayBinding.cs, + MonoDevelop.GtkCore.GuiBuilder/GuiBuilderDisplayBinding.cs, + MonoDevelop.GtkCore.GuiBuilder/GuiBuilderService.cs, + MonoDevelop.GtkCore.GuiBuilder/GuiBuilderProject.cs, + MonoDevelop.GtkCore.GuiBuilder/GuiBuilderWindow.cs, + MonoDevelop.GtkCore.GuiBuilder/GuiBuilderView.cs, + MonoDevelop.GtkCore.GuiBuilder/GtkProjectServiceExtension.cs, + MonoDevelop.GtkCore.GuiBuilder/CodeBinder.cs, + MonoDevelop.GtkCore.GuiBuilder/ToolboxProvider.cs: New project + model changes. + 2008-05-20 Mike Kestner <mkestner@novell.com> * templates/Widget.xft.xml: diff --git a/main/src/addins/MonoDevelop.GtkCore/Makefile.am b/main/src/addins/MonoDevelop.GtkCore/Makefile.am index 7ed82f11c9..a1b86751fc 100644 --- a/main/src/addins/MonoDevelop.GtkCore/Makefile.am +++ b/main/src/addins/MonoDevelop.GtkCore/Makefile.am @@ -22,6 +22,7 @@ REFS = \ -r:$(top_builddir)/build/bin/MonoDevelop.Core.Gui.dll \ -r:$(top_builddir)/build/bin/MonoDevelop.Ide.dll \ -r:$(top_builddir)/build/bin/MonoDevelop.Projects.dll \ + -r:$(top_builddir)/build/bin/MonoDevelop.Projects.Gui.dll \ -r:Mono.Posix \ -r:System \ -r:System.Xml diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.Dialogs/GtkFeatureWidget.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.Dialogs/GtkFeatureWidget.cs index f5efbbad28..bdd2a851ed 100644 --- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.Dialogs/GtkFeatureWidget.cs +++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.Dialogs/GtkFeatureWidget.cs @@ -29,8 +29,7 @@ namespace MonoDevelop.GtkCore.Dialogs box.PackStart (new Label (GettextCatalog.GetString ("(or upper)")), false, false, 0); PackStart (box, false, false, 0); - DotNetProjectConfiguration conf = project.ActiveConfiguration as DotNetProjectConfiguration; - if (conf != null && conf.CompileTarget == CompileTarget.Library || conf.CompiledOutputName.EndsWith (".dll")) { + if (project.CompileTarget == CompileTarget.Library) { GtkDesignInfo info = GtkCoreService.GetGtkInfo (project); libCheck = new CheckButton (GettextCatalog.GetString ("This assembly is a widget library")); libCheck.Active = info != null && info.IsWidgetLibrary; @@ -49,7 +48,7 @@ namespace MonoDevelop.GtkCore.Dialogs } } - class GtkProjectFeature: ICombineEntryFeature + class GtkProjectFeature: ISolutionItemFeature { public string Title { get { return GettextCatalog.GetString ("Gtk# Support"); } @@ -59,17 +58,17 @@ namespace MonoDevelop.GtkCore.Dialogs get { return GettextCatalog.GetString ("Enables support for GTK# in the project. Allows the visual design of GTK# windows, and the creation of a GTK# widget library."); } } - public bool SupportsCombineEntry (Combine parentCombine, CombineEntry entry) + public bool SupportsSolutionItem (SolutionFolder parentCombine, SolutionItem entry) { return entry is DotNetProject; } - public Widget CreateFeatureEditor (Combine parentCombine, CombineEntry entry) + public Widget CreateFeatureEditor (SolutionFolder parentCombine, SolutionItem entry) { return new GtkFeatureWidget ((DotNetProject) entry); } - public void ApplyFeature (Combine parentCombine, CombineEntry entry, Widget editor) + public void ApplyFeature (SolutionFolder parentCombine, SolutionItem entry, Widget editor) { GtkDesignInfo info = GtkCoreService.EnableGtkSupport ((DotNetProject) entry); GtkFeatureWidget fw = (GtkFeatureWidget) editor; @@ -78,12 +77,12 @@ namespace MonoDevelop.GtkCore.Dialogs info.UpdateGtkFolder (); } - public string Validate (Combine parentCombine, CombineEntry entry, Gtk.Widget editor) + public string Validate (SolutionFolder parentCombine, SolutionItem entry, Gtk.Widget editor) { return null; } - public bool IsEnabled (Combine parentCombine, CombineEntry entry) + public bool IsEnabled (SolutionFolder parentCombine, SolutionItem entry) { return GtkCoreService.GetGtkInfo ((Project)entry) != null; } diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.Dialogs/WidgetBuilderOptionPanel.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.Dialogs/WidgetBuilderOptionPanel.cs index f0735974bf..f2f0ac9e60 100644 --- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.Dialogs/WidgetBuilderOptionPanel.cs +++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.Dialogs/WidgetBuilderOptionPanel.cs @@ -41,12 +41,12 @@ using MonoDevelop.Ide.Gui; using MonoDevelop.Core.Gui; using MonoDevelop.Core.Gui.Components; using MonoDevelop.Components; -using MonoDevelop.Core.Gui.Dialogs; +using MonoDevelop.Projects.Gui.Dialogs; namespace MonoDevelop.GtkCore.Dialogs { - class WidgetBuilderOptionPanel: AbstractOptionPanel + class WidgetBuilderOptionPanel: ItemOptionsPanel { class WidgetBuilderOptionPanelWidget : GladeWidgetExtract { @@ -65,11 +65,12 @@ namespace MonoDevelop.GtkCore.Dialogs ArrayList selection; GtkDesignInfo designInfo; - public WidgetBuilderOptionPanelWidget (Properties customizationObject) : base ("gui.glade", "WidgetBuilderOptions") + public WidgetBuilderOptionPanelWidget (Project project) : base ("gui.glade", "WidgetBuilderOptions") { store = new ListStore (typeof(bool), typeof(Pixbuf), typeof(string), typeof(object)); tree.Model = store; tree.HeadersVisible = false; + this.project = project; column = new TreeViewColumn (); @@ -89,7 +90,6 @@ namespace MonoDevelop.GtkCore.Dialogs tree.AppendColumn (column); - this.project = ((Properties)customizationObject).Get<Project> ("Project"); if (!GtkCoreService.SupportsGtkDesigner (project)) { notebook.RemovePage (1); } @@ -153,7 +153,7 @@ namespace MonoDevelop.GtkCore.Dialogs } } - public void Store (Properties customizationObject) + public void Store () { if (checkGtkEnabled.Active) { if (designInfo == null) @@ -184,19 +184,14 @@ namespace MonoDevelop.GtkCore.Dialogs WidgetBuilderOptionPanelWidget widget; - public override void LoadPanelContents() + public override Widget CreatePanelWidget() { - try { - Add (widget = new WidgetBuilderOptionPanelWidget ((Properties) CustomizationObject)); - } catch (Exception ex) { - Console.WriteLine (ex); - } + return (widget = new WidgetBuilderOptionPanelWidget (ConfiguredProject)); } - public override bool StorePanelContents() + public override void ApplyChanges () { - widget.Store ((Properties) CustomizationObject); - return true; + widget.Store (); } } diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ActionGroupDisplayBinding.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ActionGroupDisplayBinding.cs index b1cc6caf5e..b8586299b9 100644 --- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ActionGroupDisplayBinding.cs +++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ActionGroupDisplayBinding.cs @@ -54,7 +54,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder { if (excludeThis) return false; - if (IdeApp.ProjectOperations.CurrentOpenCombine == null) + if (!IdeApp.Workspace.IsOpen) return false; if (GetActionGroup (fileName) == null) @@ -76,7 +76,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder excludeThis = true; IDisplayBinding db = IdeApp.Workbench.DisplayBindings.GetBindingPerFileName (fileName); - Project project = IdeApp.ProjectOperations.CurrentOpenCombine.GetProjectContainingFile (fileName); + Project project = IdeApp.Workspace.GetProjectContainingFile (fileName); GtkDesignInfo info = GtkCoreService.EnableGtkSupport (project); ActionGroupView view = new ActionGroupView (db.CreateContentForFile (fileName), GetActionGroup (fileName), info.GuiBuilderProject); @@ -91,7 +91,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder Stetic.ActionGroupInfo GetActionGroup (string file) { - Project project = IdeApp.ProjectOperations.CurrentOpenCombine.GetProjectContainingFile (file); + Project project = IdeApp.Workspace.GetProjectContainingFile (file); if (project == null) return null; @@ -136,7 +136,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder { string fullName = namspace.Length > 0 ? namspace + "." + name : name; - CodeRefactorer gen = new CodeRefactorer (project.RootCombine, IdeApp.ProjectOperations.ParserDatabase); + CodeRefactorer gen = new CodeRefactorer (project.ParentSolution, IdeApp.Workspace.ParserDatabase); CodeTypeDeclaration type = new CodeTypeDeclaration (); type.Name = name; @@ -183,10 +183,10 @@ namespace MonoDevelop.GtkCore.GuiBuilder throw new UserException ("Could not create class " + fullName); project.AddFile (cls.Region.FileName, BuildAction.Compile); - IdeApp.ProjectOperations.SaveProject (project); + IdeApp.ProjectOperations.Save (project); // Make sure the database is up-to-date - IdeApp.ProjectOperations.ParserDatabase.UpdateFile (project, cls.Region.FileName, null); + IdeApp.Workspace.ParserDatabase.UpdateFile (project, cls.Region.FileName, null); return cls; } diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/CodeBinder.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/CodeBinder.cs index 589b3dd1ff..00a8fe72c1 100644 --- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/CodeBinder.cs +++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/CodeBinder.cs @@ -90,7 +90,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder { if (targetObject == null) return; - IParseInformation pi = IdeApp.ProjectOperations.ParserDatabase.UpdateFile (project, fileName, null); + IParseInformation pi = IdeApp.Workspace.ParserDatabase.UpdateFile (project, fileName, null); classFile = fileName; if (pi != null && !pi.MostRecentCompilationUnit.ErrorsDuringCompile) { @@ -246,7 +246,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder CodeRefactorer GetCodeGenerator () { - CodeRefactorer cr = new CodeRefactorer (project.RootCombine, IdeApp.ProjectOperations.ParserDatabase); + CodeRefactorer cr = new CodeRefactorer (project.ParentSolution, IdeApp.Workspace.ParserDatabase); cr.TextFileProvider = textFileProvider; return cr; } diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GtkProjectServiceExtension.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GtkProjectServiceExtension.cs index 88a44c8738..f9bd7e6091 100644 --- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GtkProjectServiceExtension.cs +++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GtkProjectServiceExtension.cs @@ -11,7 +11,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder { internal static bool GenerateSteticCode; - public override ICompilerResult Build (IProgressMonitor monitor, CombineEntry entry) + protected override ICompilerResult Build (IProgressMonitor monitor, SolutionEntityItem entry, string configuration) { if (GenerateSteticCode) { DotNetProject project = entry as DotNetProject; @@ -22,12 +22,12 @@ namespace MonoDevelop.GtkCore.GuiBuilder // access to Gtk classes Generator gen = new Generator (); lock (gen) { - Gtk.Application.Invoke (delegate { gen.Run (monitor, project); }); + Gtk.Application.Invoke (delegate { gen.Run (monitor, project, configuration); }); Monitor.Wait (gen); } // Build the project - ICompilerResult res = base.Build (monitor, entry); + ICompilerResult res = base.Build (monitor, entry, configuration); if (gen.Messages != null) { foreach (string s in gen.Messages) @@ -43,17 +43,17 @@ namespace MonoDevelop.GtkCore.GuiBuilder } } - return base.Build (monitor, entry); + return base.Build (monitor, entry, configuration); } } class Generator { - public void Run (IProgressMonitor monitor, DotNetProject project) + public void Run (IProgressMonitor monitor, DotNetProject project, string configuration) { lock (this) { try { - Stetic.CodeGenerationResult res = GuiBuilderService.GenerateSteticCode (monitor, project); + Stetic.CodeGenerationResult res = GuiBuilderService.GenerateSteticCode (monitor, project, configuration); if (res != null) Messages = res.Warnings; } catch (Exception ex) { diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderDisplayBinding.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderDisplayBinding.cs index 1cc63bf450..46c9267773 100644 --- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderDisplayBinding.cs +++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderDisplayBinding.cs @@ -77,11 +77,11 @@ namespace MonoDevelop.GtkCore.GuiBuilder GuiBuilderWindow GetWindow (string file) { - if (IdeApp.ProjectOperations.CurrentOpenCombine == null) + if (!IdeApp.Workspace.IsOpen) return null; Project project = null; - foreach (Project p in IdeApp.ProjectOperations.CurrentOpenCombine.GetAllProjects ()) { + foreach (Project p in IdeApp.Workspace.GetAllProjects ()) { if (p.IsFileInProject (file)) { project = p; break; diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderProject.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderProject.cs index 64776bff8b..b01b6f08b9 100644 --- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderProject.cs +++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderProject.cs @@ -48,7 +48,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder { ArrayList formInfos; Stetic.Project gproject; - Project project; + DotNetProject project; string fileName; bool hasError; bool needsUpdate = true; @@ -65,7 +65,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder public event EventHandler Unloaded; public event EventHandler Changed; - public GuiBuilderProject (Project project, string fileName) + public GuiBuilderProject (DotNetProject project, string fileName) { this.fileName = fileName; this.project = project; @@ -195,7 +195,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder GtkDesignInfo info = GtkCoreService.GetGtkInfo (project); if (info.UpdateGtkFolder () && saveMdProject) - IdeApp.ProjectOperations.SaveProject (project); + IdeApp.ProjectOperations.Save (project); GuiBuilderService.StoreConfiguration (); } @@ -217,7 +217,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder } } - public Project Project { + public DotNetProject Project { get { return project; } } @@ -353,11 +353,11 @@ namespace MonoDevelop.GtkCore.GuiBuilder string path = null; if (pref.ReferenceType == ReferenceType.Project) { - DotNetProject p = project.RootCombine.FindProject (pref.Reference) as DotNetProject; + DotNetProject p = project.ParentSolution.FindProjectByName (pref.Reference) as DotNetProject; if (p != null) { GtkDesignInfo info = GtkCoreService.GetGtkInfo (p); if (info != null && info.IsWidgetLibrary) - path = p.GetOutputFileName (); + path = p.GetOutputFileName (IdeApp.Workspace.ActiveConfiguration); } } else if (pref.ReferenceType == ReferenceType.Assembly) { // Assume everything is a widget library. Stetic will discard it if it is not. @@ -480,7 +480,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder public IParserContext GetParserContext () { - IParserContext ctx = IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (Project); + IParserContext ctx = IdeApp.Workspace.ParserDatabase.GetProjectParserContext (Project); if (ctx != null && needsUpdate) { needsUpdate = false; ctx.UpdateDatabase (); @@ -501,7 +501,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder ArrayList libs = new ArrayList (); string[] internalLibs; - foreach (ProjectReference pref in project.ProjectReferences) { + foreach (ProjectReference pref in project.References) { string wref = GetReferenceLibraryPath (pref); if (wref != null) libs.Add (wref); @@ -517,7 +517,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder } if (info != null && info.IsWidgetLibrary) - internalLibs = new string [] { project.GetOutputFileName () }; + internalLibs = new string [] { project.GetOutputFileName (IdeApp.Workspace.ActiveConfiguration) }; else internalLibs = new string [0]; diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderService.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderService.cs index 79c55a5864..fc90c82a39 100644 --- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderService.cs +++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderService.cs @@ -77,7 +77,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder IdeApp.Workbench.ActiveDocumentChanged += new EventHandler (OnActiveDocumentChanged); IdeApp.ProjectOperations.StartBuild += OnBeforeCompile; IdeApp.ProjectOperations.EndBuild += OnProjectCompiled; - IdeApp.ProjectOperations.ParserDatabase.AssemblyInformationChanged += (AssemblyInformationEventHandler) DispatchService.GuiDispatch (new AssemblyInformationEventHandler (OnAssemblyInfoChanged)); + IdeApp.Workspace.ParserDatabase.AssemblyInformationChanged += (AssemblyInformationEventHandler) DispatchService.GuiDispatch (new AssemblyInformationEventHandler (OnAssemblyInfoChanged)); IdeApp.Exited += delegate { if (steticApp != null) { @@ -186,7 +186,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder static void OnBeforeCompile (object s, BuildEventArgs args) { - if (IdeApp.ProjectOperations.CurrentOpenCombine == null) + if (!IdeApp.Workspace.IsOpen) return; // Generate stetic files for all modified projects @@ -198,8 +198,8 @@ namespace MonoDevelop.GtkCore.GuiBuilder if (args.Success) { // Unload stetic projects which are not currently // being used by the IDE. This will avoid unnecessary updates. - if (IdeApp.ProjectOperations.CurrentOpenCombine != null) { - foreach (Project prj in IdeApp.ProjectOperations.CurrentOpenCombine.GetAllProjects ()) { + if (IdeApp.Workspace.IsOpen) { + foreach (Project prj in IdeApp.Workspace.GetAllProjects ()) { GtkDesignInfo info = GtkCoreService.GetGtkInfo (prj); if (info != null && !HasOpenDesigners (prj, false)) { info.ReloadGuiBuilderProject (); @@ -345,12 +345,12 @@ namespace MonoDevelop.GtkCore.GuiBuilder fileStream.Close (); } - if (IdeApp.ProjectOperations.ParserDatabase.IsLoaded (project)) { + if (IdeApp.Workspace.ParserDatabase.IsLoaded (project)) { // Only update the parser database if the project is actually loaded in the IDE. if (saveToFile) - IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (project).UpdateDatabase (); + IdeApp.Workspace.ParserDatabase.GetProjectParserContext (project).UpdateDatabase (); else - IdeApp.ProjectOperations.ParserDatabase.UpdateFile (project, fileName, ((StringWriter)fileStream).ToString ()); + IdeApp.Workspace.ParserDatabase.UpdateFile (project, fileName, ((StringWriter)fileStream).ToString ()); } FileService.NotifyFileChanged (fileName); @@ -358,7 +358,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder } - public static Stetic.CodeGenerationResult GenerateSteticCode (IProgressMonitor monitor, Project prj) + public static Stetic.CodeGenerationResult GenerateSteticCode (IProgressMonitor monitor, DotNetProject prj, string configuration) { if (generating) return null; @@ -390,7 +390,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder // Make sure the referenced assemblies are up to date. It is necessary to do // it now since they may contain widget libraries. - prj.CopyReferencesToOutputPath (false); + prj.CopyReferencesToOutputPath (false, configuration); info.GuiBuilderProject.UpdateLibraries (); @@ -477,7 +477,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder // Make sure the generated files are added to the project if (info.UpdateGtkFolder ()) { Gtk.Application.Invoke (delegate { - IdeApp.ProjectOperations.SaveProject (project); + IdeApp.ProjectOperations.Save (project); }); } @@ -486,14 +486,14 @@ namespace MonoDevelop.GtkCore.GuiBuilder internal static string ImportFile (Project prj, string file) { - ProjectFile pfile = prj.ProjectFiles.GetFile (file); + ProjectFile pfile = prj.Files.GetFile (file); if (pfile == null) { string[] files = IdeApp.ProjectOperations.AddFilesToProject (prj, new string[] { file }, prj.BaseDirectory); if (files.Length == 0) return null; if (files [0] == null) return null; - pfile = prj.ProjectFiles.GetFile (files[0]); + pfile = prj.Files.GetFile (files[0]); } if (pfile.BuildAction == BuildAction.EmbedAsResource) { AlertButton embedButton = new AlertButton (GettextCatalog.GetString ("_Use as Source")); diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderView.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderView.cs index 61bf41ef08..dd20e8c65f 100644 --- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderView.cs +++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderView.cs @@ -322,7 +322,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder info.AddExportedWidget (codeBinder.TargetObject.Name); info.UpdateGtkFolder (); GtkCoreService.UpdateObjectsFile (gproject.Project); - IdeApp.ProjectOperations.SaveProject (gproject.Project); + IdeApp.ProjectOperations.Save (gproject.Project); } } } @@ -447,11 +447,11 @@ namespace MonoDevelop.GtkCore.GuiBuilder else pref = new ProjectReference (node.ReferenceType, node.Reference); - foreach (ProjectReference pr in gproject.Project.ProjectReferences) { + foreach (ProjectReference pr in gproject.Project.References) { if (pr.Reference == pref.Reference) return; } - gproject.Project.ProjectReferences.Add (pref); + gproject.Project.References.Add (pref); } Widget MonoDevelop.DesignerSupport.IOutlinedDocument.GetOutlineWidget () diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderWindow.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderWindow.cs index 9e7400821f..f6093c8c4e 100644 --- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderWindow.cs +++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderWindow.cs @@ -142,7 +142,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder { string fullName = namspace.Length > 0 ? namspace + "." + name : name; - CodeRefactorer gen = new CodeRefactorer (fproject.Project.RootCombine, IdeApp.ProjectOperations.ParserDatabase); + CodeRefactorer gen = new CodeRefactorer (fproject.Project.ParentSolution, IdeApp.Workspace.ParserDatabase); GtkDesignInfo info = GtkCoreService.GetGtkInfo (fproject.Project); Stetic.WidgetComponent component = (Stetic.WidgetComponent) rootWidget.Component; @@ -204,10 +204,10 @@ namespace MonoDevelop.GtkCore.GuiBuilder throw new UserException ("Could not create class " + fullName); Project.Project.AddFile (cls.Region.FileName, BuildAction.Compile); - IdeApp.ProjectOperations.SaveProject (Project.Project); + IdeApp.ProjectOperations.Save (Project.Project); // Make sure the database is up-to-date - IdeApp.ProjectOperations.ParserDatabase.UpdateFile (Project.Project, cls.Region.FileName, null); + IdeApp.Workspace.ParserDatabase.UpdateFile (Project.Project, cls.Region.FileName, null); } void AddSignalsRec (CodeTypeDeclaration type, Stetic.Component comp) diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ToolboxProvider.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ToolboxProvider.cs index 16ff55e697..549a19b8c1 100644 --- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ToolboxProvider.cs +++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/ToolboxProvider.cs @@ -8,6 +8,7 @@ using MonoDevelop.Projects; using MonoDevelop.Projects.Serialization; using Stetic; using MonoDevelop.Core; +using MonoDevelop.Ide.Gui; namespace MonoDevelop.GtkCore.GuiBuilder { @@ -31,10 +32,10 @@ namespace MonoDevelop.GtkCore.GuiBuilder return null; Hashtable refs = new Hashtable (); - string of = FileService.GetFullPath (view.Project.GetOutputFileName ()); + string of = FileService.GetFullPath (view.Project.GetOutputFileName (IdeApp.Workspace.ActiveConfiguration)); refs [of] = of; - foreach (ProjectReference pr in view.Project.ProjectReferences) - foreach (string f in pr.GetReferencedFileNames ()) { + foreach (ProjectReference pr in ((DotNetProject)view.Project).References) + foreach (string f in pr.GetReferencedFileNames (IdeApp.Workspace.ActiveConfiguration)) { refs[FileService.GetFullPath (f)] = f; } diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.NodeBuilders/ActionGroupNodeBuilder.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.NodeBuilders/ActionGroupNodeBuilder.cs index e5dc4d926d..8502e8aec0 100644 --- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.NodeBuilders/ActionGroupNodeBuilder.cs +++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.NodeBuilders/ActionGroupNodeBuilder.cs @@ -132,11 +132,11 @@ namespace MonoDevelop.GtkCore.NodeBuilders if (dialog.DeleteFile) { ProjectFile file = project.GetProjectFile (sfile); if (file != null) - project.ProjectFiles.Remove (file); + project.Files.Remove (file); } gproject.RemoveActionGroup (group); gproject.Save (false); - IdeApp.ProjectOperations.SaveProject (project); + IdeApp.ProjectOperations.Save (project); } } } diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.NodeBuilders/ProjectFolderNodeBuilderExtension.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.NodeBuilders/ProjectFolderNodeBuilderExtension.cs index 6df89664a5..3ed4049b9d 100644 --- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.NodeBuilders/ProjectFolderNodeBuilderExtension.cs +++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.NodeBuilders/ProjectFolderNodeBuilderExtension.cs @@ -187,7 +187,7 @@ namespace MonoDevelop.GtkCore.NodeBuilders IdeApp.ProjectOperations.CreateProjectFile (project, path, id); - IdeApp.ProjectOperations.SaveProject (project); + IdeApp.ProjectOperations.Save (project); ITreeNavigator nav = Tree.GetNodeAtObject (dataItem); if (nav != null) diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.NodeBuilders/WidgetNodeBuilder.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.NodeBuilders/WidgetNodeBuilder.cs index ca867260e2..988e2a3b1d 100644 --- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.NodeBuilders/WidgetNodeBuilder.cs +++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.NodeBuilders/WidgetNodeBuilder.cs @@ -141,11 +141,11 @@ namespace MonoDevelop.GtkCore.NodeBuilders if (dialog.DeleteFile) { ProjectFile file = w.Project.Project.GetProjectFile (w.SourceCodeFile); if (file != null) - w.Project.Project.ProjectFiles.Remove (file); + w.Project.Project.Files.Remove (file); } w.Project.Remove (w); w.Project.Save (false); - IdeApp.ProjectOperations.SaveProject (w.Project.Project); + IdeApp.ProjectOperations.Save (w.Project.Project); } } } diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.addin.xml b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.addin.xml index 34714543db..ee4afa31d2 100644 --- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.addin.xml +++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.addin.xml @@ -150,10 +150,11 @@ <Class class="MonoDevelop.GtkCore.GtkCoreStartupCommand" /> </Extension> - <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/GeneralOptions/Common"> + <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/Common"> <Condition id="activeproject" value ="DotNet"> - <DialogPanel id = "SteticOptionsPanel" + <Section id = "SteticOptionsPanel" _label = "GTK# Settings" + fill="true" class = "MonoDevelop.GtkCore.Dialogs.WidgetBuilderOptionPanel"/> </Condition> </Extension> diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.mdp b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.mdp index ce65d042cb..face92f8f8 100644 --- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.mdp +++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.mdp @@ -88,6 +88,7 @@ <ProjectReference type="Gac" localcopy="True" refto="atk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Projects.Gui" /> </References> <GtkDesignInfo gtkVersion="2.8.3" /> <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="./Makefile.am" BuildTargetName="" CleanTargetName="" SyncReferences="True" IsAutotoolsProject="True" RelativeConfigureInPath="../../../"> diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.mds b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.mds index c2f16fdb21..dab91162c8 100644 --- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.mds +++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.mds @@ -1,9 +1,6 @@ <Combine name="MonoDevelop.GtkCore" fileversion="2.0"> <Configurations active="Debug"> <Configuration name="Debug" ctype="CombineConfiguration"> - <CustomCommands> - <Command type="Custom" name="Update Stetic" command="make update-stetic" workingdir="${ProjectDir}" externalConsole="True" pauseExternalConsole="True" /> - </CustomCommands> <Entry build="True" name="MonoDevelop.GtkCore" configuration="Debug" /> <Entry build="True" name="libstetic" configuration="Debug" /> <Entry build="True" name="libsteticui" configuration="Debug" /> diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore/GtkCoreService.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore/GtkCoreService.cs index 397acc44b8..9113d5408e 100644 --- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore/GtkCoreService.cs +++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore/GtkCoreService.cs @@ -80,7 +80,8 @@ namespace MonoDevelop.GtkCore return false; RefactorOperations ops = RefactorOperations.AddField | RefactorOperations.AddMethod | RefactorOperations.RenameField; - return IdeApp.ProjectOperations.CodeRefactorer.LanguageSupportsOperation (dp.LanguageBinding.Language, ops); + CodeRefactorer cref = IdeApp.Workspace.GetCodeRefactorer (project.ParentSolution); + return cref.LanguageSupportsOperation (dp.LanguageBinding.Language, ops); } static void FindSupportedGtkVersions () @@ -153,10 +154,10 @@ namespace MonoDevelop.GtkCore static void OnFileChanged (object s, FileEventArgs args) { - if (IdeApp.ProjectOperations.CurrentOpenCombine == null) + if (!IdeApp.Workspace.IsOpen) return; - foreach (Project project in IdeApp.ProjectOperations.CurrentOpenCombine.GetAllProjects ()) { + foreach (Project project in IdeApp.Workspace.GetAllProjects ()) { if (!project.IsFileInProject (args.FileName)) continue; @@ -164,7 +165,7 @@ namespace MonoDevelop.GtkCore if (info == null) continue; - IdeApp.ProjectOperations.ParserDatabase.UpdateFile (project, args.FileName, null); + IdeApp.Workspace.ParserDatabase.UpdateFile (project, args.FileName, null); foreach (IClass cls in info.GetExportedClasses ()) { if (cls.Region.FileName == args.FileName) UpdateObjectsFile (project, cls, null); @@ -247,7 +248,7 @@ namespace MonoDevelop.GtkCore static void UpdateClass (Project project, XmlDocument doc, IClass widgetClass, IClass wrapperClass) { - IParserContext ctx = IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (project); + IParserContext ctx = IdeApp.Workspace.ParserDatabase.GetProjectParserContext (project); string typeName = widgetClass.FullyQualifiedName; XmlElement objectElem = (XmlElement) doc.SelectSingleNode ("objects/object[@type='" + typeName + "']"); @@ -283,7 +284,7 @@ namespace MonoDevelop.GtkCore foreach (string t in types) typesHash [t] = t; - IParserContext pctx = IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (project); + IParserContext pctx = IdeApp.Workspace.ParserDatabase.GetProjectParserContext (project); string ret = GetBaseType (widgetClass, pctx, typesHash); return ret ?? "Gtk.Widget"; } @@ -478,7 +479,7 @@ namespace MonoDevelop.GtkCore static public IClass[] GetExportableClasses (Project project) { - IParserContext pctx = IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (project); + IParserContext pctx = IdeApp.Workspace.ParserDatabase.GetProjectParserContext (project); ArrayList list = new ArrayList (); foreach (IClass cls in pctx.GetProjectContents ()) if (IsWidget (cls, pctx)) list.Add (cls); diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore/GtkDesignInfo.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore/GtkDesignInfo.cs index d176c3574e..9efd56925d 100644 --- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore/GtkDesignInfo.cs +++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore/GtkDesignInfo.cs @@ -216,7 +216,7 @@ namespace MonoDevelop.GtkCore if (builderProject != null) pctx = builderProject.GetParserContext (); else - pctx = IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (project); + pctx = IdeApp.Workspace.ParserDatabase.GetProjectParserContext (project); ArrayList list = new ArrayList (); foreach (string cls in exportedWidgets) { @@ -316,9 +316,9 @@ namespace MonoDevelop.GtkCore } // Remove all project files which are not in the generated list - foreach (ProjectFile pf in project.ProjectFiles.GetFilesInPath (GtkGuiFolder)) { + foreach (ProjectFile pf in project.Files.GetFilesInPath (GtkGuiFolder)) { if (pf.FilePath != SteticGeneratedFile && pf.FilePath != ObjectsFile && pf.FilePath != SteticFile && !partialFiles.Contains (pf.FilePath)) { - project.ProjectFiles.Remove (pf); + project.Files.Remove (pf); FileService.DeleteFile (pf.FilePath); projectModified = true; } @@ -365,7 +365,7 @@ namespace MonoDevelop.GtkCore if (!SupportsDesigner) // No need to check posix in this case posix = true; - foreach (ProjectReference r in new List<ProjectReference> (project.ProjectReferences)) { + foreach (ProjectReference r in new List<ProjectReference> (project.References)) { if (r.ReferenceType != ReferenceType.Gac) continue; int i = r.StoredReference.IndexOf (','); @@ -386,20 +386,20 @@ namespace MonoDevelop.GtkCore // Check and correct the assembly version only if a version is set if (!string.IsNullOrEmpty (gtkAsmVersion) && r.StoredReference.Substring (i+1).Trim() != gtkAsmVersion) { - project.ProjectReferences.Remove (r); - project.ProjectReferences.Add (new ProjectReference (ReferenceType.Gac, aname + ", " + gtkAsmVersion)); + project.References.Remove (r); + project.References.Add (new ProjectReference (ReferenceType.Gac, aname + ", " + gtkAsmVersion)); } } if (!gtk) - project.ProjectReferences.Add (new ProjectReference (ReferenceType.Gac, typeof(Gtk.Widget).Assembly.FullName)); + project.References.Add (new ProjectReference (ReferenceType.Gac, typeof(Gtk.Widget).Assembly.FullName)); if (!gdk) - project.ProjectReferences.Add (new ProjectReference (ReferenceType.Gac, typeof(Gdk.Window).Assembly.FullName)); + project.References.Add (new ProjectReference (ReferenceType.Gac, typeof(Gdk.Window).Assembly.FullName)); if (!posix && GenerateGettext && GettextClass == "Mono.Unix.Catalog") { // Add a reference to Mono.Posix. Use the version for the selected project's runtime version. string aname = Runtime.SystemAssemblyService.FindInstalledAssembly ("Mono.Posix, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"); aname = Runtime.SystemAssemblyService.GetAssemblyNameForVersion (aname, project.ClrVersion); - project.ProjectReferences.Add (new ProjectReference (ReferenceType.Gac, aname)); + project.References.Add (new ProjectReference (ReferenceType.Gac, aname)); } return projectModified || !gtk || !gdk || !posix; @@ -414,7 +414,7 @@ namespace MonoDevelop.GtkCore return provider; } - void OnProjectRenamed (object s, CombineEntryRenamedEventArgs a) + void OnProjectRenamed (object s, SolutionItemRenamedEventArgs a) { GtkCoreService.UpdateProjectName (project, a.OldName, a.NewName); } diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore/ProjectResourceProvider.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore/ProjectResourceProvider.cs index 11cd1fae06..de9ab89418 100644 --- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore/ProjectResourceProvider.cs +++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore/ProjectResourceProvider.cs @@ -45,7 +45,7 @@ namespace MonoDevelop.GtkCore public Stetic.ResourceInfo[] GetResources () { ArrayList list = new ArrayList (); - foreach (ProjectFile file in project.ProjectFiles) { + foreach (ProjectFile file in project.Files) { if (file.BuildAction == BuildAction.EmbedAsResource) list.Add (new Stetic.ResourceInfo (Path.GetFileName (file.Name), file.Name)); } @@ -54,7 +54,7 @@ namespace MonoDevelop.GtkCore public Stream GetResourceStream (string resourceName) { - foreach (ProjectFile file in project.ProjectFiles) { + foreach (ProjectFile file in project.Files) { if (resourceName == Path.GetFileName (file.Name)) return File.OpenRead (file.Name); } @@ -70,9 +70,9 @@ namespace MonoDevelop.GtkCore public void RemoveResource (string resourceName) { - foreach (ProjectFile file in project.ProjectFiles) { + foreach (ProjectFile file in project.Files) { if (resourceName == Path.GetFileName (file.Name)) { - project.ProjectFiles.Remove (file); + project.Files.Remove (file); project.Save (new MonoDevelop.Core.ProgressMonitoring.NullProgressMonitor()); return; } diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore/WidgetFileDescriptionTemplate.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore/WidgetFileDescriptionTemplate.cs index 9c204d8ced..3ce3356d1b 100644 --- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore/WidgetFileDescriptionTemplate.cs +++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore/WidgetFileDescriptionTemplate.cs @@ -87,7 +87,7 @@ namespace MonoDevelop.GtkCore string fileName = fileTemplate.GetFileName (project, language, directory, name); fileTemplate.AddToProject (project, language, directory, name); - IdeApp.ProjectOperations.ParserDatabase.UpdateFile (project, fileName, null); + IdeApp.Workspace.ParserDatabase.UpdateFile (project, fileName, null); DotNetProject netProject = project as DotNetProject; string ns = netProject != null ? netProject.GetDefaultNamespace (fileName) : ""; diff --git a/main/src/addins/MonoDevelop.GtkCore/lib/libstetic.mdp b/main/src/addins/MonoDevelop.GtkCore/lib/libstetic.mdp index 797d6889c5..a12c0fa287 100644 --- a/main/src/addins/MonoDevelop.GtkCore/lib/libstetic.mdp +++ b/main/src/addins/MonoDevelop.GtkCore/lib/libstetic.mdp @@ -2,10 +2,10 @@ <Configurations active="Debug"> <Configuration name="Debug" ctype="DotNetProjectConfiguration"> <CustomCommands> - <Command type="Build" command="make libstetic" workingdir="${ProjectDir}" /> + <Command type="Build" command="make libstetic" workingdir="${ItemDir}" /> </CustomCommands> <Output directory="../../../../build/AddIns/MonoDevelop.GtkCore" assemblyKeyFile="." assembly="libstetic" /> - <Build debugmode="True" target="Library" /> + <Build debugmode="False" target="Library" /> <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_1_1" /> <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> </Configuration> @@ -264,7 +264,7 @@ <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> </References> - <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="./stetic/libstetic/Makefile.am" BuildTargetName="" CleanTargetName="" SyncReferences="True"> + <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="stetic/libstetic/Makefile.am" BuildTargetName="" CleanTargetName="" SyncReferences="True"> <BuildFilesVar Sync="True" Name="libstetic_dll_sources" /> <DeployFilesVar Sync="True" Name="libstetic_dll_datafiles" /> <ResourcesVar Sync="True" Name="libstetic_dll_resources" /> diff --git a/main/src/addins/MonoDevelop.GtkCore/lib/libsteticui.mdp b/main/src/addins/MonoDevelop.GtkCore/lib/libsteticui.mdp index 493a9fd073..6eeea1c166 100644 --- a/main/src/addins/MonoDevelop.GtkCore/lib/libsteticui.mdp +++ b/main/src/addins/MonoDevelop.GtkCore/lib/libsteticui.mdp @@ -2,7 +2,7 @@ <Configurations active="Debug"> <Configuration name="Debug" ctype="DotNetProjectConfiguration"> <CustomCommands> - <Command type="Build" command="make libsteticui" workingdir="${ProjectDir}" /> + <Command type="Build" command="make libsteticui" workingdir="${ItemDir}" /> </CustomCommands> <Output directory="../../../../build/AddIns/MonoDevelop.GtkCore" assembly="libsteticui" /> <Build debugmode="True" target="Library" /> diff --git a/main/src/addins/MonoDevelop.GtkCore/lib/stetic/ChangeLog b/main/src/addins/MonoDevelop.GtkCore/lib/stetic/ChangeLog index 0f5283e131..a91611e326 100644 --- a/main/src/addins/MonoDevelop.GtkCore/lib/stetic/ChangeLog +++ b/main/src/addins/MonoDevelop.GtkCore/lib/stetic/ChangeLog @@ -1,3 +1,7 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * libstetic/libstetic.mdp: New project model changes. + 2008-05-20 Mike Kestner <mkestner@novell.com> * libsteticui/LibraryCache.cs: do a recursive delete when revising diff --git a/main/src/addins/MonoDevelop.GtkCore/lib/stetic/libstetic/libstetic.mdp b/main/src/addins/MonoDevelop.GtkCore/lib/stetic/libstetic/libstetic.mdp index 5df97ddd42..1265b0d2d9 100644 --- a/main/src/addins/MonoDevelop.GtkCore/lib/stetic/libstetic/libstetic.mdp +++ b/main/src/addins/MonoDevelop.GtkCore/lib/stetic/libstetic/libstetic.mdp @@ -2,7 +2,7 @@ <Configurations active="Debug"> <Configuration name="Debug" ctype="DotNetProjectConfiguration"> <Output directory="../bin" assembly="libstetic" /> - <Build debugmode="True" target="Library" /> + <Build debugmode="False" target="Library" /> <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_1_1" /> <CodeGeneration compiler="Csc" warninglevel="4" optimize="True" unsafecodeallowed="True" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> </Configuration> @@ -273,4 +273,4 @@ <DeploymentInformation strategy="File"> <excludeFiles /> </DeploymentInformation> -</Project>
\ No newline at end of file +</Project> diff --git a/main/src/addins/MonoDevelop.Moonlight/ChangeLog b/main/src/addins/MonoDevelop.Moonlight/ChangeLog index 78f6e224ae..13a0a4b59d 100644 --- a/main/src/addins/MonoDevelop.Moonlight/ChangeLog +++ b/main/src/addins/MonoDevelop.Moonlight/ChangeLog @@ -1,3 +1,7 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * MonoDevelop.Moonlight/MoonlightProject.cs: New project model changes. + 2008-05-08 Michael Hutchinson <mhutchinson@novell.com> * MonoDevelop.Moonlight.addin.xml: Set "isText" attribute on the diff --git a/main/src/addins/MonoDevelop.Moonlight/MonoDevelop.Moonlight/MoonlightProject.cs b/main/src/addins/MonoDevelop.Moonlight/MonoDevelop.Moonlight/MoonlightProject.cs index b6d62c5b8b..b9db87c015 100644 --- a/main/src/addins/MonoDevelop.Moonlight/MonoDevelop.Moonlight/MoonlightProject.cs +++ b/main/src/addins/MonoDevelop.Moonlight/MonoDevelop.Moonlight/MoonlightProject.cs @@ -52,9 +52,9 @@ namespace MonoDevelop.Moonlight { //set parameters to ones required for Moonlight build ClrVersion = MonoDevelop.Core.ClrVersion.Clr_2_1; + CompileTarget = CompileTarget.Library; foreach (DotNetProjectConfiguration parameter in Configurations) { parameter.OutputDirectory = Path.Combine (".", "ClientBin"); - parameter.CompileTarget = CompileTarget.Library; } } @@ -62,7 +62,7 @@ namespace MonoDevelop.Moonlight get { return "Moonlight"; } } - protected override void DoExecute (IProgressMonitor monitor, ExecutionContext context) + protected override void DoExecute (IProgressMonitor monitor, ExecutionContext context, string configuration) { string[] pages = { (Name??"TestPage") + ".html", "TestPage.html", "Default.html", "default.html", "Index.html", "index.html" }; string testPage = null; diff --git a/main/src/addins/MonoDevelop.SourceEditor/ChangeLog b/main/src/addins/MonoDevelop.SourceEditor/ChangeLog index 5163ae9438..dc6beb5937 100644 --- a/main/src/addins/MonoDevelop.SourceEditor/ChangeLog +++ b/main/src/addins/MonoDevelop.SourceEditor/ChangeLog @@ -1,3 +1,9 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * MonoDevelop.SourceEditor.Gui/SourceEditorView.cs, + MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: New + project model changes. + 2008-05-15 Michael Hutchinson <mhutchinson@novell.com> * MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs: Track API diff --git a/main/src/addins/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs b/main/src/addins/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs index a0f8162434..9c6e81ddb3 100644 --- a/main/src/addins/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs +++ b/main/src/addins/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorDisplayBinding.cs @@ -262,7 +262,7 @@ namespace MonoDevelop.SourceEditor.Gui Services.DebuggingService.ExecutionLocationChanged += executionChangedHandler; } */ - IdeApp.ProjectOperations.ParserDatabase.ParseInformationChanged += new ParseInformationEventHandler(UpdateClassBrowser); + IdeApp.Workspace.ParserDatabase.ParseInformationChanged += new ParseInformationEventHandler(UpdateClassBrowser); mainBox.ShowAll (); @@ -345,7 +345,7 @@ namespace MonoDevelop.SourceEditor.Gui membersCombo.Model = null; classCombo.Model = null; - IdeApp.ProjectOperations.ParserDatabase.ParseInformationChanged -= new ParseInformationEventHandler(UpdateClassBrowser); + IdeApp.Workspace.ParserDatabase.ParseInformationChanged -= new ParseInformationEventHandler(UpdateClassBrowser); mainBox.Destroy (); fsw.Dispose (); se = null; @@ -429,7 +429,7 @@ namespace MonoDevelop.SourceEditor.Gui UpdateExecutionLocation (); } */ - IFileParserContext context = IdeApp.ProjectOperations.ParserDatabase.GetFileParserContext(fileName); + IFileParserContext context = IdeApp.Workspace.ParserDatabase.GetFileParserContext(fileName); memberParseInfo = context.ParseFile(fileName); BindClassCombo(); } diff --git a/main/src/addins/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorView.cs b/main/src/addins/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorView.cs index 943f067a00..cd5e394918 100644 --- a/main/src/addins/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorView.cs +++ b/main/src/addins/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui/SourceEditorView.cs @@ -54,7 +54,7 @@ namespace MonoDevelop.SourceEditor.Gui int langTipX, langTipY; uint tipTimeoutId; - IParserDatabase db = IdeApp.ProjectOperations.ParserDatabase; + IParserDatabase db = IdeApp.Workspace.ParserDatabase; TextTag synErrorTag = new TextTag ("synError"); bool resetTimerStarted = false; uint resetTimerId; @@ -528,7 +528,7 @@ namespace MonoDevelop.SourceEditor.Gui { string file = ParentEditor.DisplayBinding.IsUntitled ? ParentEditor.DisplayBinding.UntitledName : ParentEditor.DisplayBinding.ContentName; Project project = ParentEditor.DisplayBinding.Project; - IParserDatabase pdb = IdeApp.ProjectOperations.ParserDatabase; + IParserDatabase pdb = IdeApp.Workspace.ParserDatabase; if (project != null) return pdb.GetProjectParserContext (project); diff --git a/main/src/addins/MonoDevelop.SourceEditor2/ChangeLog b/main/src/addins/MonoDevelop.SourceEditor2/ChangeLog index 7affaa8c4a..1cccbd032b 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/ChangeLog +++ b/main/src/addins/MonoDevelop.SourceEditor2/ChangeLog @@ -1,3 +1,11 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * MonoDevelop.SourceEditor.mdp, + MonoDevelop.SourceEditor/SourceEditorWidget.cs, + MonoDevelop.SourceEditor/HighlightPropertiesSemanticRule.cs, + MonoDevelop.SourceEditor/SourceEditorView.cs: New project model + changes. + 2008-05-20 Michael Hutchinson <mhutchinson@novell.com> * MonoDevelop.SourceEditor/SourceEditorView.cs: Name the editor's diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.mdp b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.mdp index 487fc7b804..caaf1d2ecf 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.mdp +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.mdp @@ -1,13 +1,13 @@ <Project name="MonoDevelop.SourceEditor2" fileversion="2.0" language="C#" clr-version="Net_2_0" ctype="DotNetProject"> <Configurations active="Debug"> <Configuration name="Debug" ctype="DotNetProjectConfiguration"> + <CustomCommands> + <Command type="Execute" command="mono --debug ../../../build/bin/MonoDevelop.exe" workingdir="" /> + </CustomCommands> <Output directory="../../../build/AddIns" assemblyKeyFile="." assembly="MonoDevelop.SourceEditor2" /> <Build debugmode="True" target="Library" /> <Execution runwithwarnings="True" consolepause="False" runtime="MsNet" clr-version="Net_2_0" /> <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> - <CustomCommands> - <Command type="Execute" command="mono --debug ../../../build/bin/MonoDevelop.exe" workingdir="" /> - </CustomCommands> </Configuration> <Configuration name="Release" ctype="DotNetProjectConfiguration"> <Output directory="../../../build/AddIns" assemblyKeyFile="." assembly="MonoDevelop.SourceEditor" /> @@ -55,13 +55,13 @@ <ProjectReference type="Gac" localcopy="True" refto="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.3.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Core" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Ide" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Components" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Projects.Gui" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Core.Gui" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Projects" /> - <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.DesignerSupport" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Core" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Ide" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Components" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Projects.Gui" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Core.Gui" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Projects" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.DesignerSupport" /> <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="glib-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/HighlightPropertiesSemanticRule.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/HighlightPropertiesSemanticRule.cs index 1cfcbab7e9..24a906eb54 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/HighlightPropertiesSemanticRule.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/HighlightPropertiesSemanticRule.cs @@ -42,7 +42,7 @@ namespace MonoDevelop.SourceEditor { IParserContext GetParserContext (Mono.TextEditor.Document document) { - IParserDatabase pdb = IdeApp.ProjectOperations.ParserDatabase; + IParserDatabase pdb = IdeApp.Workspace.ParserDatabase; Project project = IdeApp.ProjectOperations.CurrentSelectedProject; if (project != null) return pdb.GetProjectParserContext (project); diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs index 35c42978b8..1e6cdea0e3 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs @@ -253,7 +253,7 @@ namespace MonoDevelop.SourceEditor public IParserContext GetParserContext () { - IParserDatabase pdb = IdeApp.ProjectOperations.ParserDatabase; + IParserDatabase pdb = IdeApp.Workspace.ParserDatabase; Project project = Project; if (project != null) diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs index a2a93d013f..c2b6e44889 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs @@ -177,14 +177,14 @@ namespace MonoDevelop.SourceEditor ResetFocusChain (); - IdeApp.ProjectOperations.ParserDatabase.ParseInformationChanged += UpdateClassBrowser; + IdeApp.Workspace.ParserDatabase.ParseInformationChanged += UpdateClassBrowser; UpdateLineCol (); this.Focused += delegate { UpdateLineCol (); }; - IdeApp.ProjectOperations.ParserDatabase.ParseInformationChanged += OnParseInformationChanged; + IdeApp.Workspace.ParserDatabase.ParseInformationChanged += OnParseInformationChanged; // this.IsClassBrowserVisible = SourceEditorOptions.Options.EnableQuickFinder; // this.d += delegate { @@ -468,8 +468,8 @@ namespace MonoDevelop.SourceEditor this.lastActiveEditor = null; this.splittedTextEditor = null; RemoveSearchWidget (); - IdeApp.ProjectOperations.ParserDatabase.ParseInformationChanged -= UpdateClassBrowser; - IdeApp.ProjectOperations.ParserDatabase.ParseInformationChanged -= OnParseInformationChanged; + IdeApp.Workspace.ParserDatabase.ParseInformationChanged -= UpdateClassBrowser; + IdeApp.Workspace.ParserDatabase.ParseInformationChanged -= OnParseInformationChanged; System.GC.Collect (); } @@ -1051,7 +1051,7 @@ namespace MonoDevelop.SourceEditor public void LoadClassCombo () { - IFileParserContext context = IdeApp.ProjectOperations.ParserDatabase.GetFileParserContext (view.ContentName); + IFileParserContext context = IdeApp.Workspace.ParserDatabase.GetFileParserContext (view.ContentName); this.memberParseInfo = context.ParseFile (view.ContentName); BindClassCombo(); } diff --git a/main/src/addins/MonoDevelop.WebReferences/ChangeLog b/main/src/addins/MonoDevelop.WebReferences/ChangeLog index d4b8602080..1c86b19d94 100644 --- a/main/src/addins/MonoDevelop.WebReferences/ChangeLog +++ b/main/src/addins/MonoDevelop.WebReferences/ChangeLog @@ -1,3 +1,13 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * MonoDevelop.WebReferences.NodeBuilders/WebReferenceFolderNodeBuilder.cs, + MonoDevelop.WebReferences/WebReferenceItem.cs, + MonoDevelop.WebReferences/Library.cs, + MonoDevelop.WebReferences/WebReferenceItemCollection.cs, + MonoDevelop.WebReferences.Commands/WebReferenceCommandHandler.cs, + gtk-gui/MonoDevelop.WebReferences.Dialogs.WebReferenceDialog.cs: + New project model changes. + 2008-03-04 Mike Krüger <mkrueger@novell.com> * MonoDevelop.WebReferences.Commands/WebReferenceCommandHandler.cs, diff --git a/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.Commands/WebReferenceCommandHandler.cs b/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.Commands/WebReferenceCommandHandler.cs index 09101725e1..ae03594cc3 100644 --- a/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.Commands/WebReferenceCommandHandler.cs +++ b/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.Commands/WebReferenceCommandHandler.cs @@ -21,11 +21,10 @@ namespace MonoDevelop.WebReferences.Commands public void NewWebReference() { // Get the project and project folder - Project project = CurrentNode.GetParentDataItem (typeof(Project), true) as Project; - DotNetProject dotProject = (DotNetProject) project; + DotNetProject project = CurrentNode.GetParentDataItem (typeof(DotNetProject), true) as DotNetProject; // Check and switch the runtime environment for the current project - if (dotProject.ClrVersion == ClrVersion.Net_1_1) + if (project.ClrVersion == ClrVersion.Net_1_1) { string question = "The current runtime environment for your project is set to version 1.0."; question += "Web Service is not supported in this version."; @@ -33,7 +32,7 @@ namespace MonoDevelop.WebReferences.Commands AlertButton switchButton = new AlertButton ("_Switch to .NET2"); if (MessageService.AskQuestion(question, AlertButton.Cancel, switchButton) == switchButton) - dotProject.ClrVersion = ClrVersion.Net_2_0; + project.ClrVersion = ClrVersion.Net_2_0; else return; } @@ -59,22 +58,22 @@ namespace MonoDevelop.WebReferences.Commands ProjectFile mapFile = new ProjectFile(mapSpec); mapFile.BuildAction = BuildAction.Nothing; mapFile.Subtype = Subtype.Code; - project.ProjectFiles.Add(mapFile); + project.Files.Add(mapFile); // Generate the proxy class string proxySpec = gen.CreateProxyFile(basePath, dialog.Namespace + "." + dialog.ReferenceName, "Reference"); ProjectFile proxyFile = new ProjectFile(proxySpec); proxyFile.BuildAction = BuildAction.Compile; proxyFile.Subtype = Subtype.Code; - project.ProjectFiles.Add(proxyFile); + project.Files.Add(proxyFile); // Add a reference System.Web.Services to the project if it does not exists string refName = "System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; ProjectReference gacRef = new ProjectReference(ReferenceType.Gac, refName); - if (!project.ProjectReferences.Contains(gacRef)) - project.ProjectReferences.Add(gacRef); + if (!project.References.Contains(gacRef)) + project.References.Add(gacRef); - IdeApp.ProjectOperations.SaveProject(project); + IdeApp.ProjectOperations.Save(project); } catch(Exception exception) { @@ -113,7 +112,7 @@ namespace MonoDevelop.WebReferences.Commands WebReferenceItem item = (WebReferenceItem) CurrentNode.DataItem; Project project = item.ProxyFile.Project; item.Delete(); - IdeApp.ProjectOperations.SaveProject(project); + IdeApp.ProjectOperations.Save(project); IdeApp.Workbench.StatusBar.ShowMessage("Deleted Web Reference " + item.Name); } @@ -128,7 +127,7 @@ namespace MonoDevelop.WebReferences.Commands items[items.AllKeys[index]].Delete(); IdeApp.Workbench.StatusBar.ShowMessage("Deleted Web Reference " + items.AllKeys[index]); } - IdeApp.ProjectOperations.SaveProject(project); + IdeApp.ProjectOperations.Save(project); IdeApp.Workbench.StatusBar.ShowMessage("Deleted all Web References"); } } diff --git a/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.NodeBuilders/WebReferenceFolderNodeBuilder.cs b/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.NodeBuilders/WebReferenceFolderNodeBuilder.cs index ae977d5d21..d80aa85890 100644 --- a/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.NodeBuilders/WebReferenceFolderNodeBuilder.cs +++ b/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.NodeBuilders/WebReferenceFolderNodeBuilder.cs @@ -44,7 +44,7 @@ namespace MonoDevelop.WebReferences.NodeBuilders protected override void Initialize() { base.Initialize(); - IdeApp.ProjectOperations.FileRemovedFromProject += (ProjectFileEventHandler) DispatchService.GuiDispatch (new ProjectFileEventHandler (OnRemoveFile)); + IdeApp.Workspace.FileRemovedFromProject += (ProjectFileEventHandler) DispatchService.GuiDispatch (new ProjectFileEventHandler (OnRemoveFile)); } /// <summary>Gets the node name for the current node.</summary> diff --git a/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences/Library.cs b/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences/Library.cs index b269371377..533ebe213b 100644 --- a/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences/Library.cs +++ b/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences/Library.cs @@ -172,7 +172,7 @@ namespace MonoDevelop.WebReferences public static bool ProjectContainsWebReference(Project project) { string webRefPath = Library.GetWebReferencePath(project); - foreach (ProjectFile file in project.ProjectFiles) + foreach (ProjectFile file in project.Files) { if (file.FilePath.StartsWith(webRefPath)) return true; diff --git a/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences/WebReferenceItem.cs b/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences/WebReferenceItem.cs index 6114b45772..1b80e620e7 100644 --- a/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences/WebReferenceItem.cs +++ b/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences/WebReferenceItem.cs @@ -90,8 +90,8 @@ namespace MonoDevelop.WebReferences public void Delete() { Project project = proxyFile.Project; - project.ProjectFiles.Remove(proxyFile); - project.ProjectFiles.Remove(mapFile); + project.Files.Remove(proxyFile); + project.Files.Remove(mapFile); Directory.Delete(Path.Combine(Library.GetWebReferencePath(project), Name), true); } } diff --git a/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences/WebReferenceItemCollection.cs b/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences/WebReferenceItemCollection.cs index 6d21f7f001..fed0e53075 100644 --- a/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences/WebReferenceItemCollection.cs +++ b/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences/WebReferenceItemCollection.cs @@ -42,7 +42,7 @@ namespace MonoDevelop.WebReferences public WebReferenceItemCollection(Project project)
{ string webRefPath = Library.GetWebReferencePath(project); - foreach (ProjectFile file in project.ProjectFiles) + foreach (ProjectFile file in project.Files) { if (file.FilePath.StartsWith(webRefPath)) { diff --git a/main/src/addins/MonoDevelop.WebReferences/gtk-gui/MonoDevelop.WebReferences.Dialogs.WebReferenceDialog.cs b/main/src/addins/MonoDevelop.WebReferences/gtk-gui/MonoDevelop.WebReferences.Dialogs.WebReferenceDialog.cs index 263282e3f1..907b662b7c 100644 --- a/main/src/addins/MonoDevelop.WebReferences/gtk-gui/MonoDevelop.WebReferences.Dialogs.WebReferenceDialog.cs +++ b/main/src/addins/MonoDevelop.WebReferences/gtk-gui/MonoDevelop.WebReferences.Dialogs.WebReferenceDialog.cs @@ -119,7 +119,6 @@ namespace Stetic.SteticGenerated { bindings["frmBrowser"] = w20; w20.Name = "frmBrowser"; w20.ShadowType = ((Gtk.ShadowType)(0)); - w20.LabelXalign = 0F; w20.LabelYalign = 0F; w9.Add(w20); Gtk.Box.BoxChild w21 = ((Gtk.Box.BoxChild)(w9[w20])); diff --git a/main/src/addins/MonoDevelop.XmlEditor/ChangeLog b/main/src/addins/MonoDevelop.XmlEditor/ChangeLog index e4722bdfcd..d630e9d79f 100644 --- a/main/src/addins/MonoDevelop.XmlEditor/ChangeLog +++ b/main/src/addins/MonoDevelop.XmlEditor/ChangeLog @@ -1,3 +1,7 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * MonoDevelop.XmlEditor.mdp: New project model changes. + 2008-05-07 Michael Hutchinson <mhutchinson@novell.com> * MonoDevelop.Xml.StateEngine/XmlSpecialTagState.cs: Fix opening of diff --git a/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.mdp b/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.mdp index 1c6798f0c1..a95bf09aa3 100644 --- a/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.mdp +++ b/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.mdp @@ -101,11 +101,11 @@ <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.DesignerSupport" /> <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.SourceEditor2" /> <ProjectReference type="Project" localcopy="False" refto="Mono.TextEditor" /> - <ProjectReference type="Gac" localcopy="True" refto="glade-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Gac" localcopy="True" refto="pango-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Gac" localcopy="True" refto="atk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <ProjectReference type="Gac" localcopy="True" refto="glade-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <ProjectReference type="Gac" localcopy="True" refto="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <ProjectReference type="Gac" localcopy="True" refto="atk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> </References> <GtkDesignInfo isWidgetLibrary="True" gtkVersion="2.8.3"> <ExportedWidgets> diff --git a/main/src/addins/MonoDeveloperExtensions/ChangeLog b/main/src/addins/MonoDeveloperExtensions/ChangeLog index 15e38f7179..b812c2e137 100644 --- a/main/src/addins/MonoDeveloperExtensions/ChangeLog +++ b/main/src/addins/MonoDeveloperExtensions/ChangeLog @@ -1,3 +1,10 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * MonoDeveloperExtensions.mds, MonoMakefileFormat.cs, Commands.cs, + MonoSolutionItemHandler.cs, Makefile.am, + MonoDeveloperExtensions.addin.xml, NUnit/MonoTestProvider.cs, + MonoDeveloperExtensions.mdp: New project model changes. + 2008-03-07 Lluis Sanchez Gual <lluis@novell.com> * MonoDeveloperExtensions.mdp: Removed unneeded dependencies. diff --git a/main/src/addins/MonoDeveloperExtensions/Commands.cs b/main/src/addins/MonoDeveloperExtensions/Commands.cs index acf18bd840..dd4e56e80b 100644 --- a/main/src/addins/MonoDeveloperExtensions/Commands.cs +++ b/main/src/addins/MonoDeveloperExtensions/Commands.cs @@ -48,21 +48,21 @@ namespace MonoDeveloper { protected override void Run () { - MonoProject p = IdeApp.ProjectOperations.CurrentSelectedProject as MonoProject; + DotNetProject p = IdeApp.ProjectOperations.CurrentSelectedProject as DotNetProject; if (p != null) DispatchService.BackgroundDispatch (new StatefulMessageHandler (Install), p); } protected override void Update (CommandInfo info) { - info.Visible = IdeApp.ProjectOperations.CurrentSelectedProject is MonoProject; + info.Visible = MonoMakefileFormat.IsMonoProject (IdeApp.ProjectOperations.CurrentSelectedProject); } void Install (object prj) { - MonoProject p = prj as MonoProject; + DotNetProject p = prj as DotNetProject; using (IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetBuildProgressMonitor ()) { - p.Install (monitor); + p.RunTarget (monitor, "install", IdeApp.Workspace.ActiveConfiguration); } } diff --git a/main/src/addins/MonoDeveloperExtensions/Makefile.am b/main/src/addins/MonoDeveloperExtensions/Makefile.am index 97fb8aa26d..36993e9490 100644 --- a/main/src/addins/MonoDeveloperExtensions/Makefile.am +++ b/main/src/addins/MonoDeveloperExtensions/Makefile.am @@ -3,11 +3,9 @@ SUBDIRS = . NUnit FILES = \ AssemblyInfo.cs \ Commands.cs \ - MonoCombine.cs \ MonoMakefile.cs \ MonoMakefileFormat.cs \ - MonoProject.cs \ - MonoProjectConfiguration.cs + MonoSolutionItemHandler.cs REFS = \ $(GCONF_SHARP_LIBS) \ diff --git a/main/src/addins/MonoDeveloperExtensions/MonoCombine.cs b/main/src/addins/MonoDeveloperExtensions/MonoCombine.cs deleted file mode 100644 index f5aed3b2ab..0000000000 --- a/main/src/addins/MonoDeveloperExtensions/MonoCombine.cs +++ /dev/null @@ -1,37 +0,0 @@ -// -// MonoCombine.cs -// -// Author: -// Lluis Sanchez Gual -// -// Copyright (C) 2005 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using MonoDevelop.Projects; - -namespace MonoDeveloper -{ - class MonoCombine: Combine - { - } -} diff --git a/main/src/addins/MonoDeveloperExtensions/MonoDeveloperExtensions.addin.xml b/main/src/addins/MonoDeveloperExtensions/MonoDeveloperExtensions.addin.xml index 3ace09a07d..30889660b9 100644 --- a/main/src/addins/MonoDeveloperExtensions/MonoDeveloperExtensions.addin.xml +++ b/main/src/addins/MonoDeveloperExtensions/MonoDeveloperExtensions.addin.xml @@ -20,14 +20,14 @@ <Addin id="Ide" version="0.19.0"/> </Dependencies> - <Extension path = "/MonoDevelop/ProjectModel/ProjectFileFormats"> - <FileFormat id = "MonoMakefile" + <Extension path = "/MonoDevelop/ProjectModel/FileFormats"> + <FileFormat id = "MonoMakefile" name="Mono Makefile" class = "MonoDeveloper.MonoMakefileFormat" /> </Extension> - <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/ConfigurationOptions"> + <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions"> <Condition id="activeproject" value = "MonoMakefile"> - <DialogPanel id = "MonoMakefileOptionsPanel" + <Section id = "MonoMakefileOptionsPanel" _label = "Output" class = "MonoDevelop.Projects.Gui.Dialogs.OutputOptionsPanel"/> </Condition> diff --git a/main/src/addins/MonoDeveloperExtensions/MonoDeveloperExtensions.mdp b/main/src/addins/MonoDeveloperExtensions/MonoDeveloperExtensions.mdp index b7e6ac794f..7b268bbf70 100644 --- a/main/src/addins/MonoDeveloperExtensions/MonoDeveloperExtensions.mdp +++ b/main/src/addins/MonoDeveloperExtensions/MonoDeveloperExtensions.mdp @@ -15,13 +15,11 @@ </Configurations> <Contents> <File name="AssemblyInfo.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoCombine.cs" subtype="Code" buildaction="Compile" /> <File name="MonoMakefile.cs" subtype="Code" buildaction="Compile" /> <File name="MonoMakefileFormat.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoProject.cs" subtype="Code" buildaction="Compile" /> <File name="Commands.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoProjectConfiguration.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDeveloperExtensions.addin.xml" subtype="Code" buildaction="EmbedAsResource" /> + <File name="MonoSolutionItemHandler.cs" subtype="Code" buildaction="Compile" /> </Contents> <References> <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Core" /> diff --git a/main/src/addins/MonoDeveloperExtensions/MonoDeveloperExtensions.mds b/main/src/addins/MonoDeveloperExtensions/MonoDeveloperExtensions.mds index 9c5711f824..0dc68099dd 100644 --- a/main/src/addins/MonoDeveloperExtensions/MonoDeveloperExtensions.mds +++ b/main/src/addins/MonoDeveloperExtensions/MonoDeveloperExtensions.mds @@ -5,8 +5,8 @@ <Entry build="True" name="MonoDeveloperExtensions_nunit" configuration="Debug" /> </Configuration> <Configuration name="Release" ctype="CombineConfiguration"> - <Entry build="True" name="MonoDeveloperExtensions" configuration="Debug" /> - <Entry build="True" name="MonoDeveloperExtensions_nunit" configuration="Debug" /> + <Entry build="True" name="MonoDeveloperExtensions" configuration="Release" /> + <Entry build="True" name="MonoDeveloperExtensions_nunit" configuration="Release" /> </Configuration> </Configurations> <StartMode startupentry="MonoDeveloperExtensions" single="True"> diff --git a/main/src/addins/MonoDeveloperExtensions/MonoMakefileFormat.cs b/main/src/addins/MonoDeveloperExtensions/MonoMakefileFormat.cs index ccb5926974..48d8966e1a 100644 --- a/main/src/addins/MonoDeveloperExtensions/MonoMakefileFormat.cs +++ b/main/src/addins/MonoDeveloperExtensions/MonoMakefileFormat.cs @@ -28,17 +28,22 @@ using System; using System.Collections; -using System.Collections.Specialized; +using System.Collections.Generic; using System.IO; using System.Text; using MonoDevelop.Core; using System.Text.RegularExpressions; using MonoDevelop.Projects; +using MonoDevelop.Projects.Extensions; namespace MonoDeveloper { public class MonoMakefileFormat: IFileFormat { + public static readonly string[] Configurations = new string [] { + "default", "net_2_0" + }; + public string Name { get { return "Mono Makefile"; } } @@ -48,45 +53,50 @@ namespace MonoDeveloper return Path.Combine (Path.GetDirectoryName (fileName), "Makefile"); } - public bool CanReadFile (string file) + public bool CanReadFile (string file, Type expectedType) { if (Path.GetFileName (file) != "Makefile") return false; MonoMakefile mkfile = new MonoMakefile (file); if (mkfile.Content.IndexOf ("build/rules.make") == -1) return false; - if (mkfile.GetVariable ("LIBRARY") != null) return true; - if (mkfile.GetVariable ("PROGRAM") != null) return true; + if (mkfile.GetVariable ("LIBRARY") != null) return expectedType.IsAssignableFrom (typeof(DotNetProject)); + if (mkfile.GetVariable ("PROGRAM") != null) return expectedType.IsAssignableFrom (typeof(DotNetProject)); string subdirs = mkfile.GetVariable ("SUBDIRS"); if (subdirs != null && subdirs.Trim (' ','\t') != "") - return true; + return expectedType.IsAssignableFrom (typeof(Solution)) || expectedType.IsAssignableFrom (typeof(SolutionFolder)); return false; } public bool CanWriteFile (object obj) { - return (obj is MonoProject) || (obj is MonoCombine); + return (obj is SolutionFolder) || IsMonoProject (obj); } public void WriteFile (string file, object node, IProgressMonitor monitor) { } - public StringCollection GetExportFiles (object obj) + public List<string> GetItemFiles (object obj) { - MonoProject mp = obj as MonoProject; + List<string> col = new List<string> (); + DotNetProject mp = obj as DotNetProject; if (mp != null) { - if (File.Exists (mp.SourcesFile)) { - StringCollection col = new StringCollection (); + MonoSolutionItemHandler handler = ProjectExtensionUtil.GetItemHandler (mp) as MonoSolutionItemHandler; + if (handler != null && File.Exists (handler.SourcesFile)) { col.Add (mp.FileName); - col.Add (mp.SourcesFile); - return col; + col.Add (handler.SourcesFile); } } - return null; + return col; } - public object ReadFile (string fileName, IProgressMonitor monitor) + public object ReadFile (string fileName, Type expectedType, IProgressMonitor monitor) + { + return ReadFile (fileName, false, monitor); + } + + public object ReadFile (string fileName, bool hasParentSolution, IProgressMonitor monitor) { string basePath = Path.GetDirectoryName (fileName); MonoMakefile mkfile = new MonoMakefile (fileName); @@ -96,7 +106,11 @@ namespace MonoDeveloper if (aname != null) { // It is a project monitor.BeginTask ("Loading '" + fileName + "'", 0); - MonoProject project = new MonoProject (mkfile); + DotNetProject project = new DotNetProject ("C#"); + MonoSolutionItemHandler handler = new MonoSolutionItemHandler (project); + ProjectExtensionUtil.InstallHandler (handler, project); + project.Name = Path.GetFileName (basePath); + handler.Read (mkfile); monitor.EndTask (); return project; } else { @@ -113,9 +127,25 @@ namespace MonoDeveloper subdirs = subdirsBuilder.ToString (); if (subdirs != null && (subdirs = subdirs.Trim (' ','\t')) != "") { - Combine combine = new MonoCombine (); - combine.FileName = fileName; - combine.Name = Path.GetFileName (basePath); + object retObject; + SolutionFolder folder; + if (!hasParentSolution) { + Solution sol = new Solution (); + sol.FileFormat = Services.ProjectService.FileFormats.GetFileFormat ("MonoMakefile"); + sol.FileName = fileName; + folder = sol.RootFolder; + retObject = sol; + + foreach (string conf in MonoMakefileFormat.Configurations) { + SolutionConfiguration sc = new SolutionConfiguration (conf); + sol.Configurations.Add (sc); + } + } else { + folder = new SolutionFolder (); + folder.Name = Path.GetFileName (Path.GetDirectoryName (fileName)); + retObject = folder; + } + subdirs = subdirs.Replace ('\t',' '); string[] dirs = subdirs.Split (' '); @@ -129,14 +159,30 @@ namespace MonoDeveloper string tdir = dir.Trim (); if (tdir == "") continue; string mfile = Path.Combine (Path.Combine (basePath, tdir), "Makefile"); - if (File.Exists (mfile) && CanReadFile (mfile)) - combine.AddEntry (mfile, monitor); + if (File.Exists (mfile) && CanReadFile (mfile, typeof(SolutionItem))) { + SolutionItem it = (SolutionItem) ReadFile (mfile, true, monitor); + folder.Items.Add (it); + } } monitor.EndTask (); - return combine; + return retObject; } } return null; } + + public static bool IsMonoProject (object obj) + { + DotNetProject p = obj as DotNetProject; + return p != null && (ProjectExtensionUtil.GetItemHandler (p) is MonoSolutionItemHandler); + } + + public void ConvertToFormat (object obj) + { + if (obj is DotNetProject) { + MonoSolutionItemHandler handler = new MonoSolutionItemHandler ((DotNetProject) obj); + ProjectExtensionUtil.InstallHandler (handler, (DotNetProject) obj); + } + } } } diff --git a/main/src/addins/MonoDeveloperExtensions/MonoProjectConfiguration.cs b/main/src/addins/MonoDeveloperExtensions/MonoProjectConfiguration.cs deleted file mode 100644 index 09ef677dcc..0000000000 --- a/main/src/addins/MonoDeveloperExtensions/MonoProjectConfiguration.cs +++ /dev/null @@ -1,63 +0,0 @@ -// -// MonoProjectConfiguration.cs -// -// Author: -// Lluis Sanchez Gual -// -// Copyright (C) 2005 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.IO; -using MonoDevelop.Core; -using System.Text.RegularExpressions; -using MonoDevelop.Projects; - -namespace MonoDeveloper -{ - class MonoProjectConfiguration: DotNetProjectConfiguration - { - string profile; - string assemblyPath; - - public MonoProjectConfiguration (string name, string profile) - { - Name = name; - this.profile = profile; - } - - public string Profile { - get { return profile; } - } - - public string AssemblyPathTemplate { - get { return assemblyPath; } - set { assemblyPath = value; } - } - - public string GetAssemblyPath () - { - return assemblyPath.Replace ("$(PROFILE)", profile); - } - } -} diff --git a/main/src/addins/MonoDeveloperExtensions/MonoProject.cs b/main/src/addins/MonoDeveloperExtensions/MonoSolutionItemHandler.cs index 5e8d207aba..941dbb8de5 100644 --- a/main/src/addins/MonoDeveloperExtensions/MonoProject.cs +++ b/main/src/addins/MonoDeveloperExtensions/MonoSolutionItemHandler.cs @@ -1,29 +1,28 @@ -// -// MonoProject.cs +// MonoSolutionItemHandler.cs // // Author: -// Lluis Sanchez Gual +// Lluis Sanchez Gual <lluis@novell.com> +// +// Copyright (c) 2008 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: // -// Copyright (C) 2005 Novell, Inc (http://www.novell.com) +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. // -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; @@ -36,37 +35,49 @@ using MonoDevelop.Projects; using System.CodeDom.Compiler; using MonoDevelop.Ide.Gui; using MonoDevelop.Core.ProgressMonitoring; +using MonoDevelop.Projects.Extensions; namespace MonoDeveloper { - public class MonoProject: DotNetProject + public class MonoSolutionItemHandler: ISolutionItemHandler { + DotNetProject project; string outFile; ArrayList refNames = new ArrayList (); bool loading; string testFileBase; object unitTest; - public override string ProjectType { - get { return "MonoMakefile"; } + public MonoSolutionItemHandler (DotNetProject project) + { + this.project = project; + project.FileAddedToProject += OnFileAddedToProject; + project.FileRemovedFromProject += OnFileRemovedFromProject; + project.FileRenamedInProject += OnFileRenamedInProject; } - internal MonoProject (MonoMakefile mkfile): base ("C#") - { - Read (mkfile); + public string SourcesFile { + get { return outFile + ".sources"; } } - public override string [] SupportedLanguages { + public bool SyncFileName { + get { return false; } + } + + public string ItemId { get { - return new string [] { "C#", "" }; + if (project.ParentSolution != null) + return project.ParentSolution.GetRelativeChildPath (project.FileName); + else + return project.Name; } } - - public string SourcesFile { - get { return outFile + ".sources"; } + + public void Save (MonoDevelop.Core.IProgressMonitor monitor) + { } - void Read (MonoMakefile mkfile) + internal void Read (MonoMakefile mkfile) { loading = true; @@ -86,9 +97,8 @@ namespace MonoDeveloper targetAssembly = "$(topdir)/class/lib/$(PROFILE)/" + targetAssembly; } - Name = Path.GetFileNameWithoutExtension (aname); outFile = Path.Combine (basePath, aname); - FileName = mkfile.FileName; + project.FileName = mkfile.FileName; ArrayList checkedFolders = new ArrayList (); @@ -100,14 +110,14 @@ namespace MonoDeveloper line = line.Trim (' ','\t'); if (line != "") { string fname = Path.Combine (basePath, line); - ProjectFiles.Add (new ProjectFile (fname)); + project.Files.Add (new ProjectFile (fname)); string dir = Path.GetDirectoryName (fname); if (!checkedFolders.Contains (dir)) { checkedFolders.Add (dir); fname = Path.Combine (dir, "ChangeLog"); if (File.Exists (fname)) - ProjectFiles.Add (new ProjectFile (fname, BuildAction.Exclude)); + project.Files.Add (new ProjectFile (fname, BuildAction.Exclude)); } } } @@ -136,36 +146,46 @@ namespace MonoDeveloper testFileBase = Path.Combine (basePath, tname); } - MonoProjectConfiguration conf = new MonoProjectConfiguration ("default", "default"); - conf.CompilationParameters = LanguageBinding.CreateCompilationParameters (null); - conf.OutputDirectory = basePath; - conf.AssemblyPathTemplate = targetAssembly; - Configurations.Add (conf); - - conf = new MonoProjectConfiguration ("net_2_0", "net_2_0"); - conf.CompilationParameters = LanguageBinding.CreateCompilationParameters (null); - conf.OutputDirectory = basePath; - conf.AssemblyPathTemplate = targetAssembly; - Configurations.Add (conf); + foreach (string sconf in MonoMakefileFormat.Configurations) { + DotNetProjectConfiguration conf = new DotNetProjectConfiguration (sconf); + conf.CompilationParameters = project.LanguageBinding.CreateCompilationParameters (null); + conf.OutputDirectory = basePath; + conf.OutputAssembly = Path.GetFileName (targetAssembly); + project.Configurations.Add (conf); + } - Console.WriteLine ("{0} {1}", aname, GetOutputFileName ()); loading = false; - IdeApp.ProjectOperations.CombineOpened += new CombineEventHandler (CombineOpened); + IdeApp.Workspace.SolutionLoaded += CombineOpened; + } + + public void CombineOpened (object sender, SolutionEventArgs args) + { + if (args.Solution == project.ParentSolution) { + foreach (string pref in refNames) { + Project p = project.ParentSolution.FindProjectByName (pref); + if (p != null) project.References.Add (new ProjectReference (p)); + } + } } static Regex regexError = new Regex (@"^(\s*(?<file>.*)\((?<line>\d*)(,(?<column>\d*[\+]*))?\)(:|)\s+)*(?<level>\w+)\s*(?<number>.*):\s(?<message>.*)", RegexOptions.Compiled | RegexOptions.ExplicitCapture); - protected override ICompilerResult DoBuild (IProgressMonitor monitor) + public ICompilerResult RunTarget (MonoDevelop.Core.IProgressMonitor monitor, string target, string configuration) { - MonoProjectConfiguration conf = (MonoProjectConfiguration) ActiveConfiguration; + if (target == ProjectService.BuildTarget) + target = "all"; + else if (target == ProjectService.CleanTarget) + target = "clean"; + + DotNetProjectConfiguration conf = (DotNetProjectConfiguration) project.GetConfiguration (configuration); StringWriter output = new StringWriter (); LogTextWriter tw = new LogTextWriter (); tw.ChainWriter (output); tw.ChainWriter (monitor.Log); - ProcessWrapper proc = Runtime.ProcessService.StartProcess ("make", "PROFILE=" + conf.Profile, conf.OutputDirectory, monitor.Log, tw, null); + ProcessWrapper proc = Runtime.ProcessService.StartProcess ("make", "PROFILE=" + conf.Id + " " + target, conf.OutputDirectory, monitor.Log, tw, null); proc.WaitForOutput (); CompilerResults cr = new CompilerResults (null); @@ -193,7 +213,7 @@ namespace MonoDeveloper Match match=regexError.Match(error_string); if (!match.Success) return null; if (String.Empty != match.Result("${file}")) - error.FileName = Path.Combine (BaseDirectory, match.Result("${file}")); + error.FileName = Path.Combine (project.BaseDirectory, match.Result("${file}")); if (String.Empty != match.Result("${line}")) error.Line=Int32.Parse(match.Result("${line}")); if (String.Empty != match.Result("${column}")) @@ -205,46 +225,8 @@ namespace MonoDeveloper return error; } - protected override void OnClean (IProgressMonitor monitor) - { - MonoProjectConfiguration conf = (MonoProjectConfiguration) ActiveConfiguration; - ProcessWrapper proc = Runtime.ProcessService.StartProcess ("make", "PROFILE=" + conf.Profile + " clean", conf.OutputDirectory, monitor.Log, monitor.Log, null); - proc.WaitForOutput (); - } - - public void Install (IProgressMonitor monitor) - { - MonoProjectConfiguration conf = (MonoProjectConfiguration) ActiveConfiguration; - monitor.BeginTask ("Installing: " + Name + " - " + conf.Name, 1); - ProcessWrapper proc = Runtime.ProcessService.StartProcess ("make", "install PROFILE=" + conf.Profile, conf.OutputDirectory, monitor.Log, monitor.Log, null); - proc.WaitForOutput (); - monitor.EndTask (); - } - - public override string GetOutputFileName () - { - MonoProjectConfiguration conf = (MonoProjectConfiguration) ActiveConfiguration; - return conf.GetAssemblyPath (); - } - - public override IConfiguration CreateConfiguration (string name) - { - MonoProjectConfiguration conf = new MonoProjectConfiguration (name, name); - conf.CompilationParameters = LanguageBinding.CreateCompilationParameters (null); - return conf; - } - - public void CombineOpened (object sender, CombineEventArgs args) + void OnFileAddedToProject (object s, ProjectFileEventArgs e) { - foreach (string pref in refNames) { - Project p = RootCombine.FindProject (pref); - if (p != null) ProjectReferences.Add (new ProjectReference (p)); - } - } - - protected override void OnFileAddedToProject (ProjectFileEventArgs e) - { - base.OnFileAddedToProject (e); if (loading) return; if (e.ProjectFile.BuildAction != BuildAction.Compile) @@ -253,9 +235,8 @@ namespace MonoDeveloper AddSourceFile (e.ProjectFile.Name); } - protected override void OnFileRemovedFromProject (ProjectFileEventArgs e) + void OnFileRemovedFromProject (object s, ProjectFileEventArgs e) { - base.OnFileRemovedFromProject (e); if (loading) return; if (e.ProjectFile.BuildAction != BuildAction.Compile) @@ -264,11 +245,10 @@ namespace MonoDeveloper RemoveSourceFile (e.ProjectFile.Name); } - protected override void OnFileRenamedInProject (ProjectFileRenamedEventArgs e) + void OnFileRenamedInProject (object s, ProjectFileRenamedEventArgs e) { - base.OnFileRenamedInProject (e); - if (loading) return; + if (e.ProjectFile.BuildAction != BuildAction.Compile) return; @@ -285,7 +265,7 @@ namespace MonoDeveloper sr = new StreamReader (outFile + ".sources"); sw = new StreamWriter (outFile + ".sources.new"); - string newFile = GetRelativeChildPath (sourceFile); + string newFile = project.GetRelativeChildPath (sourceFile); if (newFile.StartsWith ("./")) newFile = newFile.Substring (2); string line; @@ -317,7 +297,7 @@ namespace MonoDeveloper sr = new StreamReader (outFile + ".sources"); sw = new StreamWriter (outFile + ".sources.new"); - string oldFile = GetRelativeChildPath (sourceFile); + string oldFile = project.GetRelativeChildPath (sourceFile); if (oldFile.StartsWith ("./")) oldFile = oldFile.Substring (2); string line; @@ -339,10 +319,12 @@ namespace MonoDeveloper return found; } - public override void Dispose () + public void Dispose () { - base.Dispose (); - IdeApp.ProjectOperations.CombineOpened -= new CombineEventHandler (CombineOpened); + project.FileAddedToProject -= OnFileAddedToProject; + project.FileRemovedFromProject -= OnFileRemovedFromProject; + project.FileRenamedInProject -= OnFileRenamedInProject; + IdeApp.Workspace.SolutionLoaded -= CombineOpened; } public string GetTestFileBase () @@ -354,5 +336,7 @@ namespace MonoDeveloper get { return unitTest; } set { unitTest = value; } } + + public event EventHandler ItemFileChanged; } } diff --git a/main/src/addins/MonoDeveloperExtensions/NUnit/MonoTestProvider.cs b/main/src/addins/MonoDeveloperExtensions/NUnit/MonoTestProvider.cs index f513cbbfe7..026631b786 100644 --- a/main/src/addins/MonoDeveloperExtensions/NUnit/MonoTestProvider.cs +++ b/main/src/addins/MonoDeveloperExtensions/NUnit/MonoTestProvider.cs @@ -29,25 +29,28 @@ using System; using System.IO; using MonoDevelop.Projects; +using MonoDevelop.Projects.Extensions; using MonoDevelop.NUnit; namespace MonoDeveloper { class MonoTestProvider: ITestProvider { - public UnitTest CreateUnitTest (CombineEntry entry) + public UnitTest CreateUnitTest (IWorkspaceObject entry) { - if (entry is MonoProject) { - MonoProject project = (MonoProject) entry; - if (project.UnitTest != null) - return (UnitTest) project.UnitTest; - - string testFileBase = project.GetTestFileBase (); - UnitTest testSuite = new MonoTestSuite (project, project.Name, testFileBase); - project.UnitTest = testSuite; - return testSuite; - } else - return null; + if (entry is DotNetProject) { + DotNetProject project = (DotNetProject) entry; + MonoSolutionItemHandler handler = ProjectExtensionUtil.GetItemHandler (project) as MonoSolutionItemHandler; + if (handler != null) { + if (handler.UnitTest != null) + return (UnitTest) handler.UnitTest; + string testFileBase = handler.GetTestFileBase (); + UnitTest testSuite = new MonoTestSuite (project, project.Name, testFileBase); + handler.UnitTest = testSuite; + return testSuite; + } + } + return null; } public Type[] GetOptionTypes () diff --git a/main/src/addins/NUnit/ChangeLog b/main/src/addins/NUnit/ChangeLog index af418ae165..dc15fdc7b3 100644 --- a/main/src/addins/NUnit/ChangeLog +++ b/main/src/addins/NUnit/ChangeLog @@ -1,3 +1,17 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * MonoDevelopNUnit.addin.xml, MonoDevelop.NUnit.mdp, + Services/WorkspaceTestGroup.cs, Services/NUnitService.cs, + Services/UnitTest.cs, Services/SolutionFolderTestGroup.cs, + Services/UnitTestGroup.cs, Services/NUnitProjectTestSuite.cs, + Services/SystemTestProvider.cs, Services/ITestProvider.cs, + Services/NUnitAssemblyTestSuite.cs, + Gui/NUnitAssemblyGroupConfigurationNodeBuilder.cs, + Gui/TestResultsPad.cs, Gui/NUnitAssemblyGroupNodeBuilder.cs, + Gui/TestPad.cs, Project/NUnitAssemblyGroupProject.cs, + Project/NUnitAssemblyGroupFileFormat.cs, Makefile.am: New project + model changes. + 2008-02-27 Mike Krüger <mkrueger@novell.com> * Services/TestProgressMonitor.cs: Refactored status bar. diff --git a/main/src/addins/NUnit/Gui/NUnitAssemblyGroupConfigurationNodeBuilder.cs b/main/src/addins/NUnit/Gui/NUnitAssemblyGroupConfigurationNodeBuilder.cs index d2a31d9524..7c01a99e0b 100644 --- a/main/src/addins/NUnit/Gui/NUnitAssemblyGroupConfigurationNodeBuilder.cs +++ b/main/src/addins/NUnit/Gui/NUnitAssemblyGroupConfigurationNodeBuilder.cs @@ -64,13 +64,13 @@ namespace MonoDevelop.NUnit public override string GetNodeName (ITreeNavigator thisNode, object dataObject) { - return ((IConfiguration)dataObject).Name; + return ((SolutionItemConfiguration)dataObject).Id; } public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) { - IConfiguration conf = dataObject as IConfiguration; - label = conf.Name; + SolutionItemConfiguration conf = dataObject as SolutionItemConfiguration; + label = conf.Id; icon = Context.GetIcon (Stock.ClosedFolder); } @@ -126,7 +126,7 @@ namespace MonoDevelop.NUnit foreach (string file in fdiag.Filenames) config.Assemblies.Add (new TestAssembly (file)); - IdeApp.ProjectOperations.SaveCombine(); + IdeApp.Workspace.Save(); } finally { fdiag.Destroy (); diff --git a/main/src/addins/NUnit/Gui/NUnitAssemblyGroupNodeBuilder.cs b/main/src/addins/NUnit/Gui/NUnitAssemblyGroupNodeBuilder.cs index 9abaea2d8f..f12c591a79 100644 --- a/main/src/addins/NUnit/Gui/NUnitAssemblyGroupNodeBuilder.cs +++ b/main/src/addins/NUnit/Gui/NUnitAssemblyGroupNodeBuilder.cs @@ -119,9 +119,9 @@ namespace MonoDevelop.NUnit public override void DeleteItem () { NUnitAssemblyGroupProject project = CurrentNode.DataItem as NUnitAssemblyGroupProject; - project.ParentCombine.RemoveEntry (project); + project.ParentFolder.Items.Remove (project); project.Dispose (); - IdeApp.ProjectOperations.SaveCombine (); + IdeApp.Workspace.Save (); } } } diff --git a/main/src/addins/NUnit/Gui/TestPad.cs b/main/src/addins/NUnit/Gui/TestPad.cs index 6c0e71bf5b..eb91d0d7e8 100644 --- a/main/src/addins/NUnit/Gui/TestPad.cs +++ b/main/src/addins/NUnit/Gui/TestPad.cs @@ -352,14 +352,17 @@ namespace MonoDevelop.NUnit regressionTree.RowActivated += new Gtk.RowActivatedHandler (OnRegressionTestActivated); failedTree.RowActivated += new Gtk.RowActivatedHandler (OnFailedTestActivated); - if (testService.RootTest != null) - TreeView.LoadTree (testService.RootTest); + foreach (UnitTest t in testService.RootTests) + TreeView.AddChild (t); } void OnTestSuiteChanged (object sender, EventArgs e) { - if (testService.RootTest != null) - TreeView.LoadTree (testService.RootTest); + if (testService.RootTests.Length > 0) { + TreeView.Clear (); + foreach (UnitTest t in testService.RootTests) + TreeView.AddChild (t); + } else { TreeView.Clear (); ClearDetails (); @@ -429,6 +432,16 @@ namespace MonoDevelop.NUnit } + public UnitTest SearchTest (string fullName) + { + foreach (UnitTest t in testService.RootTests) { + UnitTest r = SearchTest (t, fullName); + if (r != null) + return r; + } + return null; + } + public static UnitTest SearchTest (UnitTest test, string fullName) { if (test == null) @@ -456,17 +469,17 @@ namespace MonoDevelop.NUnit if (test == null) return; string fullName = test.FullName; - TestSession.ResetResult (this.testService.RootTest); + TestSession.ResetResult (test.RootTest); IdeApp.Workbench.GetPad<TestPad> ().BringToFront (); - if (IdeApp.ProjectOperations.CurrentOpenCombine != null) { + if (IdeApp.Workspace.IsOpen) { if (!IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted) { MonoDevelop.Ide.Commands.StopHandler.StopBuildOperations (); IdeApp.ProjectOperations.CurrentRunOperation.WaitForCompleted (); } - IAsyncOperation op = IdeApp.ProjectOperations.Build (IdeApp.ProjectOperations.CurrentOpenCombine); + IAsyncOperation op = IdeApp.ProjectOperations.Build (IdeApp.Workspace); op.Completed += delegate { GLib.Timeout.Add (50, delegate { - test = SearchTest (this.testService.RootTest, fullName); + test = SearchTest (fullName); if (test == null) return false; runningTestOperation = testService.RunTest (test); diff --git a/main/src/addins/NUnit/Gui/TestResultsPad.cs b/main/src/addins/NUnit/Gui/TestResultsPad.cs index 2d36b6b866..b910c650c5 100644 --- a/main/src/addins/NUnit/Gui/TestResultsPad.cs +++ b/main/src/addins/NUnit/Gui/TestResultsPad.cs @@ -310,7 +310,7 @@ namespace MonoDevelop.NUnit cancel = false; Running = true; - configuration = rootTest.ActiveConfiguration; + configuration = IdeApp.Workspace.ActiveConfiguration; AddStartMessage (); } diff --git a/main/src/addins/NUnit/Makefile.am b/main/src/addins/NUnit/Makefile.am index 99826850ec..54db0a60d8 100644 --- a/main/src/addins/NUnit/Makefile.am +++ b/main/src/addins/NUnit/Makefile.am @@ -33,7 +33,6 @@ FILES = \ Project/NUnitAssemblyGroupProject.cs \ Project/TestAssembly.cs \ Project/TestAssemblyCollection.cs \ - Services/CombineTestGroup.cs \ Services/ExternalTestRunner.cs \ Services/GeneralTestOptions.cs \ Services/IResultsStore.cs \ @@ -45,15 +44,16 @@ FILES = \ Services/NUnitService.cs \ Services/NUnitTestCase.cs \ Services/NUnitTestSuite.cs \ + Services/SolutionFolderTestGroup.cs \ Services/SystemTestProvider.cs \ Services/TestContext.cs \ - Services/TestProgressMonitor.cs \ Services/UnitTest.cs \ Services/UnitTestCollection.cs \ Services/UnitTestGroup.cs \ Services/UnitTestResult.cs \ Services/UnitTestResultsStore.cs \ Services/UnitTestStatus.cs \ + Services/WorkspaceTestGroup.cs \ Services/XmlResultsStore.cs RES = \ @@ -66,6 +66,7 @@ RES = \ Gui/NUnit.Success.png \ Gui/NUnit.SuccessAndFailed.png \ Gui/nunit-overlay-32.png \ + md1format.xml \ MonoDevelopNUnit.addin.xml \ nunit.glade \ templates/NUnitAssemblyGroup.xpt.xml \ diff --git a/main/src/addins/NUnit/MonoDevelop.NUnit.mdp b/main/src/addins/NUnit/MonoDevelop.NUnit.mdp index 1e480e3c15..43e2d556c5 100644 --- a/main/src/addins/NUnit/MonoDevelop.NUnit.mdp +++ b/main/src/addins/NUnit/MonoDevelop.NUnit.mdp @@ -39,7 +39,7 @@ <File name="Project/NUnitAssemblyGroupProject.cs" subtype="Code" buildaction="Compile" /> <File name="Project/TestAssembly.cs" subtype="Code" buildaction="Compile" /> <File name="Project/TestAssemblyCollection.cs" subtype="Code" buildaction="Compile" /> - <File name="Services/CombineTestGroup.cs" subtype="Code" buildaction="Compile" /> + <File name="Services/SolutionFolderTestGroup.cs" subtype="Code" buildaction="Compile" /> <File name="Services/ITestProvider.cs" subtype="Code" buildaction="Compile" /> <File name="Services/NUnitService.cs" subtype="Code" buildaction="Compile" /> <File name="Services/SystemTestProvider.cs" subtype="Code" buildaction="Compile" /> @@ -67,7 +67,8 @@ <File name="templates/NUnitProject.xpt.xml" subtype="Code" buildaction="EmbedAsResource" /> <File name="Gui/nunit.png" subtype="Code" buildaction="EmbedAsResource" /> <File name="Gui/nunit-overlay-32.png" subtype="Code" buildaction="EmbedAsResource" /> - <File name="Services/TestProgressMonitor.cs" subtype="Code" buildaction="Compile" /> + <File name="md1format.xml" subtype="Code" buildaction="EmbedAsResource" /> + <File name="Services/WorkspaceTestGroup.cs" subtype="Code" buildaction="Compile" /> </Contents> <References> <ProjectReference type="Assembly" localcopy="True" refto="lib/nunit.core.dll" /> diff --git a/main/src/addins/NUnit/MonoDevelopNUnit.addin.xml b/main/src/addins/NUnit/MonoDevelopNUnit.addin.xml index 2a45f16c9e..538705b67c 100644 --- a/main/src/addins/NUnit/MonoDevelopNUnit.addin.xml +++ b/main/src/addins/NUnit/MonoDevelopNUnit.addin.xml @@ -170,7 +170,7 @@ <FileTemplate id = "NUnitTestClass" resource = "NUnitTestClass.xft.xml"/> </Extension> - <Extension path = "/MonoDevelop/ProjectModel/ProjectFileFormats"> + <Extension path = "/MonoDevelop/ProjectModel/FileFormats"> <FileFormat id="NUnitAssemblyGroupFileFormat" class="MonoDevelop.NUnit.NUnitAssemblyGroupFileFormat, MonoDevelop.NUnit"/> </Extension> diff --git a/main/src/addins/NUnit/Project/NUnitAssemblyGroupFileFormat.cs b/main/src/addins/NUnit/Project/NUnitAssemblyGroupFileFormat.cs index a37e7ff59b..9ca31ee6b0 100644 --- a/main/src/addins/NUnit/Project/NUnitAssemblyGroupFileFormat.cs +++ b/main/src/addins/NUnit/Project/NUnitAssemblyGroupFileFormat.cs @@ -30,9 +30,12 @@ using System; using System.IO; using System.Xml; +using System.Collections.Generic; using MonoDevelop.Projects; using MonoDevelop.Projects.Serialization; using MonoDevelop.Core; +using MonoDevelop.Projects.Extensions; +using MonoDevelop.Projects.Formats.MD1; namespace MonoDevelop.NUnit { @@ -47,14 +50,14 @@ namespace MonoDevelop.NUnit return Path.ChangeExtension (fileName, ".md-nunit"); } - public bool CanReadFile (string file) + public bool CanReadFile (string file, Type expectedType) { - return Path.GetExtension (file) == ".md-nunit"; + return expectedType.IsAssignableFrom (typeof(NUnitAssemblyGroupProject)) && Path.GetExtension (file) == ".md-nunit"; } public bool CanWriteFile (object obj) { - return obj is NUnitAssemblyGroupProject; + return false; } public void WriteFile (string file, object obj, IProgressMonitor monitor) @@ -67,32 +70,16 @@ namespace MonoDevelop.NUnit WriteFile (((NUnitAssemblyGroupProject)obj).FileName, file, obj, monitor); } - public System.Collections.Specialized.StringCollection GetExportFiles (object obj) + public List<string> GetItemFiles (object obj) { - return null; + return new List<string> (); } void WriteFile (string file, string outFile, object obj, IProgressMonitor monitor) { - NUnitAssemblyGroupProject project = obj as NUnitAssemblyGroupProject; - if (project == null) - throw new InvalidOperationException ("The provided object is not a valid Project"); - - StreamWriter sw = new StreamWriter (outFile); - try { - monitor.BeginTask (string.Format (GettextCatalog.GetString("Saving project: {0}"), file), 1); - XmlDataSerializer ser = new XmlDataSerializer (Services.ProjectService.DataContext); - ser.SerializationContext.BaseFile = file; - ser.Serialize (sw, project, typeof(NUnitAssemblyGroupProject)); - } catch (Exception ex) { - monitor.ReportError (string.Format (GettextCatalog.GetString ("Could not save project: {0}"), file), ex); - } finally { - monitor.EndTask (); - sw.Close (); - } } - public object ReadFile (string file, IProgressMonitor monitor) + public object ReadFile (string file, Type expectedType, IProgressMonitor monitor) { XmlTextReader reader = new XmlTextReader (new StreamReader (file)); try { @@ -100,10 +87,10 @@ namespace MonoDevelop.NUnit reader.MoveToContent (); - XmlDataSerializer ser = new XmlDataSerializer (Services.ProjectService.DataContext); + XmlDataSerializer ser = new XmlDataSerializer (MD1ProjectService.DataContext); ser.SerializationContext.BaseFile = file; - CombineEntry entry = (CombineEntry) ser.Deserialize (reader, typeof(NUnitAssemblyGroupProject)); + SolutionEntityItem entry = (SolutionEntityItem) ser.Deserialize (reader, typeof(NUnitAssemblyGroupProject)); entry.FileName = file; return entry; } @@ -116,6 +103,10 @@ namespace MonoDevelop.NUnit reader.Close (); } } + + public void ConvertToFormat (object obj) + { + } } } diff --git a/main/src/addins/NUnit/Project/NUnitAssemblyGroupProject.cs b/main/src/addins/NUnit/Project/NUnitAssemblyGroupProject.cs index b7230e3f4c..1da25d9862 100644 --- a/main/src/addins/NUnit/Project/NUnitAssemblyGroupProject.cs +++ b/main/src/addins/NUnit/Project/NUnitAssemblyGroupProject.cs @@ -37,7 +37,7 @@ using MonoDevelop.Projects.Serialization; namespace MonoDevelop.NUnit { [DataInclude (typeof(NUnitAssemblyGroupProjectConfiguration))] - public class NUnitAssemblyGroupProject: CombineEntry + public class NUnitAssemblyGroupProject: SolutionEntityItem { RootTest rootTest; @@ -59,37 +59,37 @@ namespace MonoDevelop.NUnit } } - public override IConfiguration CreateConfiguration (string name) + public override SolutionItemConfiguration CreateConfiguration (string name) { NUnitAssemblyGroupProjectConfiguration conf = new NUnitAssemblyGroupProjectConfiguration (); conf.Name = name; return conf; } - protected override void OnClean (IProgressMonitor monitor) + protected override void OnClean (IProgressMonitor monitor, string configuration) { } - protected override ICompilerResult OnBuild (IProgressMonitor monitor) + protected override ICompilerResult OnBuild (IProgressMonitor monitor, string configuration) { return null; } - protected override void OnExecute (IProgressMonitor monitor, ExecutionContext context) + protected override void OnExecute (IProgressMonitor monitor, ExecutionContext context, string configuration) { } - protected override bool OnGetNeedsBuilding () + protected override bool OnGetNeedsBuilding (string configuration) { return false; } - protected override void OnSetNeedsBuilding (bool value) + protected override void OnSetNeedsBuilding (bool value, string configuration) { } } - public class NUnitAssemblyGroupProjectConfiguration: AbstractConfiguration + public class NUnitAssemblyGroupProjectConfiguration: SolutionItemConfiguration { TestAssemblyCollection assemblies; @@ -98,7 +98,7 @@ namespace MonoDevelop.NUnit assemblies = new TestAssemblyCollection (this); } - public override void CopyFrom (IConfiguration other) + public override void CopyFrom (ItemConfiguration other) { base.CopyFrom (other); @@ -139,7 +139,7 @@ namespace MonoDevelop.NUnit resultsPath = Path.Combine (project.BaseDirectory, "test-results"); ResultsStore = new XmlResultsStore (resultsPath, Path.GetFileName (project.FileName)); - lastConfig = (NUnitAssemblyGroupProjectConfiguration) project.ActiveConfiguration; + lastConfig = (NUnitAssemblyGroupProjectConfiguration) project.DefaultConfiguration; if (lastConfig != null) lastConfig.AssembliesChanged += new EventHandler (OnAssembliesChanged); } @@ -164,7 +164,7 @@ namespace MonoDevelop.NUnit if (lastConfig != null) lastConfig.AssembliesChanged -= new EventHandler (OnAssembliesChanged); - lastConfig = (NUnitAssemblyGroupProjectConfiguration) project.ActiveConfiguration; + lastConfig = (NUnitAssemblyGroupProjectConfiguration) project.DefaultConfiguration; if (lastConfig != null) lastConfig.AssembliesChanged += new EventHandler (OnAssembliesChanged); diff --git a/main/src/addins/NUnit/Services/ITestProvider.cs b/main/src/addins/NUnit/Services/ITestProvider.cs index adf68ee6f1..b9cd72530d 100644 --- a/main/src/addins/NUnit/Services/ITestProvider.cs +++ b/main/src/addins/NUnit/Services/ITestProvider.cs @@ -35,7 +35,7 @@ namespace MonoDevelop.NUnit { public interface ITestProvider { - UnitTest CreateUnitTest (CombineEntry entry); + UnitTest CreateUnitTest (IWorkspaceObject entry); Type[] GetOptionTypes (); } } diff --git a/main/src/addins/NUnit/Services/NUnitAssemblyTestSuite.cs b/main/src/addins/NUnit/Services/NUnitAssemblyTestSuite.cs index 90fff300b0..89c20228af 100644 --- a/main/src/addins/NUnit/Services/NUnitAssemblyTestSuite.cs +++ b/main/src/addins/NUnit/Services/NUnitAssemblyTestSuite.cs @@ -54,7 +54,7 @@ namespace MonoDevelop.NUnit { } - public NUnitAssemblyTestSuite (string name, CombineEntry ownerCombineEntry): base (name, ownerCombineEntry) + public NUnitAssemblyTestSuite (string name, SolutionItem ownerSolutionItem): base (name, ownerSolutionItem) { } diff --git a/main/src/addins/NUnit/Services/NUnitProjectTestSuite.cs b/main/src/addins/NUnit/Services/NUnitProjectTestSuite.cs index 42a8fac5cc..bf2785e67b 100644 --- a/main/src/addins/NUnit/Services/NUnitProjectTestSuite.cs +++ b/main/src/addins/NUnit/Services/NUnitProjectTestSuite.cs @@ -43,25 +43,25 @@ namespace MonoDevelop.NUnit { public class NUnitProjectTestSuite: NUnitAssemblyTestSuite { - Project project; + DotNetProject project; DateTime lastAssemblyTime; string resultsPath; string storeId; - public NUnitProjectTestSuite (Project project): base (project.Name, project) + public NUnitProjectTestSuite (DotNetProject project): base (project.Name, project) { storeId = Path.GetFileName (project.FileName); resultsPath = Path.Combine (project.BaseDirectory, "test-results"); ResultsStore = new XmlResultsStore (resultsPath, storeId); this.project = project; lastAssemblyTime = GetAssemblyTime (); - project.NameChanged += new CombineEntryRenamedEventHandler (OnProjectRenamed); + project.NameChanged += new SolutionItemRenamedEventHandler (OnProjectRenamed); IdeApp.ProjectOperations.EndBuild += new BuildEventHandler (OnProjectBuilt); } - public static NUnitProjectTestSuite CreateTest (Project project) + public static NUnitProjectTestSuite CreateTest (DotNetProject project) { - foreach (ProjectReference p in project.ProjectReferences) + foreach (ProjectReference p in project.References) if (p.Reference.IndexOf ("nunit.framework") != -1) return new NUnitProjectTestSuite (project); return null; @@ -69,7 +69,7 @@ namespace MonoDevelop.NUnit protected override SourceCodeLocation GetSourceCodeLocation (string fullClassName, string methodName) { - IParserContext ctx = IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (project); + IParserContext ctx = IdeApp.Workspace.ParserDatabase.GetProjectParserContext (project); IClass cls = ctx.GetClass (fullClassName); if (cls == null) return null; @@ -83,12 +83,12 @@ namespace MonoDevelop.NUnit public override void Dispose () { - project.NameChanged -= new CombineEntryRenamedEventHandler (OnProjectRenamed); + project.NameChanged -= new SolutionItemRenamedEventHandler (OnProjectRenamed); IdeApp.ProjectOperations.EndBuild -= new BuildEventHandler (OnProjectBuilt); base.Dispose (); } - void OnProjectRenamed (object sender, CombineEntryRenamedEventArgs e) + void OnProjectRenamed (object sender, SolutionItemRenamedEventArgs e) { UnitTestGroup parent = Parent as UnitTestGroup; if (parent != null) @@ -113,7 +113,7 @@ namespace MonoDevelop.NUnit } protected override string AssemblyPath { - get { return project.GetOutputFileName (); } + get { return project.GetOutputFileName (IdeApp.Workspace.ActiveConfiguration); } } protected override string TestInfoCachePath { diff --git a/main/src/addins/NUnit/Services/NUnitService.cs b/main/src/addins/NUnit/Services/NUnitService.cs index 7ddb5bff59..93cec931ec 100644 --- a/main/src/addins/NUnit/Services/NUnitService.cs +++ b/main/src/addins/NUnit/Services/NUnitService.cs @@ -29,6 +29,7 @@ using System; using System.IO; using System.Collections; +using System.Collections.Generic; using System.Threading; using MonoDevelop.Core; @@ -45,31 +46,28 @@ namespace MonoDevelop.NUnit public class NUnitService : AbstractService { ArrayList providers = new ArrayList (); - UnitTest rootTest; + UnitTest[] rootTests; public override void InitializeService () { - IdeApp.ProjectOperations.CombineOpened += (CombineEventHandler) DispatchService.GuiDispatch (new CombineEventHandler (OnOpenCombine)); - IdeApp.ProjectOperations.CombineClosed += (CombineEventHandler) DispatchService.GuiDispatch (new CombineEventHandler (OnCloseCombine)); - IdeApp.ProjectOperations.ReferenceAddedToProject += new ProjectReferenceEventHandler (OnReferenceAddedToProject); - IdeApp.ProjectOperations.ReferenceRemovedFromProject += new ProjectReferenceEventHandler (OnReferenceRemovedFromProject); + IdeApp.Workspace.ReferenceAddedToProject += OnWorkspaceChanged; + IdeApp.Workspace.ReferenceRemovedFromProject += OnWorkspaceChanged; + IdeApp.Workspace.WorkspaceItemOpened += OnWorkspaceChanged; + IdeApp.Workspace.WorkspaceItemClosed += OnWorkspaceChanged; - IProjectService ps = MonoDevelop.Projects.Services.ProjectService; + ProjectService ps = MonoDevelop.Projects.Services.ProjectService; ps.DataContext.IncludeType (typeof(UnitTestOptionsSet)); - ps.DataContext.RegisterProperty (typeof(AbstractConfiguration), "UnitTestInformation", typeof(UnitTestOptionsSet)); + ps.DataContext.RegisterProperty (typeof(SolutionItemConfiguration), "UnitTestInformation", typeof(UnitTestOptionsSet)); Mono.Addins.AddinManager.AddExtensionNodeHandler ("/MonoDevelop/NUnit/TestProviders", OnExtensionChange); - if (IdeApp.ProjectOperations.CurrentOpenCombine != null) { - rootTest = BuildTest (IdeApp.ProjectOperations.CurrentOpenCombine); - NotifyTestSuiteChanged (); - } + RebuildTests (); } void OnExtensionChange (object s, ExtensionNodeEventArgs args) { if (args.Change == ExtensionChange.Add) { - IProjectService ps = MonoDevelop.Projects.Services.ProjectService; + ProjectService ps = MonoDevelop.Projects.Services.ProjectService; ITestProvider provider = args.ExtensionObject as ITestProvider; providers.Add (provider); @@ -107,43 +105,30 @@ namespace MonoDevelop.NUnit return session; } - - protected virtual void OnOpenCombine (object sender, CombineEventArgs e) - { - rootTest = BuildTest (e.Combine); - NotifyTestSuiteChanged (); - } - - protected virtual void OnCloseCombine (object sender, CombineEventArgs e) - { - if (rootTest != null) { - ((IDisposable)rootTest).Dispose (); - rootTest = null; - } - NotifyTestSuiteChanged (); - } - - void OnReferenceAddedToProject (object sender, ProjectReferenceEventArgs e) - { - RebuildTests (); - } - - void OnReferenceRemovedFromProject (object sender, ProjectReferenceEventArgs e) + void OnWorkspaceChanged (object sender, EventArgs e) { RebuildTests (); } void RebuildTests () { - if (rootTest != null) - ((IDisposable)rootTest).Dispose (); - - rootTest = BuildTest (IdeApp.ProjectOperations.CurrentOpenCombine); + if (rootTests != null) { + foreach (IDisposable t in rootTests) + t.Dispose (); + } + + List<UnitTest> list = new List<UnitTest> (); + foreach (WorkspaceItem it in IdeApp.Workspace.Items) { + UnitTest t = BuildTest (it); + if (t != null) + list.Add (t); + } + rootTests = list.ToArray (); NotifyTestSuiteChanged (); } - public UnitTest BuildTest (CombineEntry entry) + public UnitTest BuildTest (IWorkspaceObject entry) { foreach (ITestProvider p in providers) { UnitTest t = p.CreateUnitTest (entry); @@ -152,8 +137,8 @@ namespace MonoDevelop.NUnit return null; } - public UnitTest RootTest { - get { return rootTest; } + public UnitTest[] RootTests { + get { return rootTests; } } public static void ShowOptionsDialog (UnitTest test) diff --git a/main/src/addins/NUnit/Services/CombineTestGroup.cs b/main/src/addins/NUnit/Services/SolutionFolderTestGroup.cs index 3af0088504..02974f694a 100644 --- a/main/src/addins/NUnit/Services/CombineTestGroup.cs +++ b/main/src/addins/NUnit/Services/SolutionFolderTestGroup.cs @@ -36,41 +36,41 @@ using NUnit.Core; namespace MonoDevelop.NUnit { - public class CombineTestGroup: UnitTestGroup + public class SolutionFolderTestGroup: UnitTestGroup { - Combine combine; + SolutionFolder combine; - public CombineTestGroup (Combine c): base (c.Name, c) + public SolutionFolderTestGroup (SolutionFolder c): base (c.Name, c) { - string storeId = Path.GetFileName (c.FileName); + string storeId = c.ItemId; string resultsPath = Path.Combine (c.BaseDirectory, "test-results"); ResultsStore = new XmlResultsStore (resultsPath, storeId); combine = c; - combine.EntryAdded += OnEntryChanged; - combine.EntryRemoved += OnEntryChanged; + combine.ItemAdded += OnEntryChanged; + combine.ItemRemoved += OnEntryChanged; combine.NameChanged += OnCombineRenamed; } - public static CombineTestGroup CreateTest (Combine c) + public static SolutionFolderTestGroup CreateTest (SolutionFolder c) { - return new CombineTestGroup (c); + return new SolutionFolderTestGroup (c); } public override void Dispose () { - combine.EntryAdded -= OnEntryChanged; - combine.EntryRemoved -= OnEntryChanged; + combine.ItemAdded -= OnEntryChanged; + combine.ItemRemoved -= OnEntryChanged; combine.NameChanged -= OnCombineRenamed; base.Dispose (); } - void OnEntryChanged (object sender, CombineEntryEventArgs e) + void OnEntryChanged (object sender, SolutionItemEventArgs e) { UpdateTests (); } - void OnCombineRenamed (object sender, CombineEntryRenamedEventArgs e) + void OnCombineRenamed (object sender, SolutionItemRenamedEventArgs e) { UnitTestGroup parent = Parent as UnitTestGroup; if (parent != null) @@ -80,7 +80,7 @@ namespace MonoDevelop.NUnit protected override void OnCreateTests () { NUnitService testService = (NUnitService) ServiceManager.GetService (typeof(NUnitService)); - foreach (CombineEntry e in combine.Entries) { + foreach (SolutionItem e in combine.Items) { UnitTest t = testService.BuildTest (e); if (t != null) Tests.Add (t); diff --git a/main/src/addins/NUnit/Services/SystemTestProvider.cs b/main/src/addins/NUnit/Services/SystemTestProvider.cs index 46903297c4..4d096ea48b 100644 --- a/main/src/addins/NUnit/Services/SystemTestProvider.cs +++ b/main/src/addins/NUnit/Services/SystemTestProvider.cs @@ -34,12 +34,17 @@ namespace MonoDevelop.NUnit { public class SystemTestProvider: ITestProvider { - public UnitTest CreateUnitTest (CombineEntry entry) + public UnitTest CreateUnitTest (IWorkspaceObject entry) { - if (entry is Combine) - return CombineTestGroup.CreateTest ((Combine)entry); + // TODO msbuild + if (entry is SolutionFolder) + return SolutionFolderTestGroup.CreateTest ((SolutionFolder)entry); + if (entry is Solution) + return SolutionFolderTestGroup.CreateTest (((Solution)entry).RootFolder); + if (entry is Workspace) + return WorkspaceTestGroup.CreateTest ((Workspace)entry); if (entry is DotNetProject) - return NUnitProjectTestSuite.CreateTest ((Project)entry); + return NUnitProjectTestSuite.CreateTest ((DotNetProject)entry); if (entry is NUnitAssemblyGroupProject) return ((NUnitAssemblyGroupProject)entry).RootTest; return null; diff --git a/main/src/addins/NUnit/Services/TestProgressMonitor.cs b/main/src/addins/NUnit/Services/TestProgressMonitor.cs deleted file mode 100644 index 89917886a5..0000000000 --- a/main/src/addins/NUnit/Services/TestProgressMonitor.cs +++ /dev/null @@ -1,182 +0,0 @@ -// -// TestProgressMonitor.cs -// -// Author: -// Mike Krüger <mkrueger@novell.com> -// -// Copyright (C) 2008 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Diagnostics; -using System.Text.RegularExpressions; -using MonoDevelop.Core; -using MonoDevelop.Core.Gui; -using MonoDevelop.Core.Gui.Dialogs; -using Mono.Addins; -using MonoDevelop.Projects; -using NUnit.Core; -using MonoDevelop.Ide.Gui; -using MonoDevelop.Ide.Tasks; -using MonoDevelop.Ide.Gui.Pads; - -namespace MonoDevelop.NUnit -{ - public class TestProgressMonitor : ITestProgressMonitor - { - IProgressMonitor monitor; - int failures, success, ignored; - int totalWork, currentWork; - DateTime startTime; - public TestProgressMonitor () - { - } - - public void InitializeTestRun (UnitTest test) - { - failures = success = ignored = currentWork = 0; - monitor = IdeApp.Workbench.ProgressMonitors.GetOutputProgressMonitor (GettextCatalog.GetString ("Test Output"), null, true, true); - monitor.CancelRequested += CanelRequestedRequest; - IdeApp.Services.TaskService.Clear (); - totalWork = test.CountTestCases (); - IdeApp.Workbench.StatusBar.BeginProgress (GettextCatalog.GetString ("Running tests")); - startTime = DateTime.Now; - } - - public void FinishTestRun () - { - if (monitor != null) { - IdeApp.Workbench.StatusBar.EndProgress (); - IdeApp.Workbench.StatusBar.ShowMessage (GettextCatalog.GetString ("<b>Successful</b>: {0} <b>Failed</b>: {1} <b>Ignored</b>: {2}", this.success, this.failures, this.ignored)); - monitor.Log.WriteLine (""); - monitor.Log.WriteLine (GettextCatalog.GetString ("Test run finished")); - monitor.Log.WriteLine (GettextCatalog.GetString ("Total seconds: {0:0.0}", (DateTime.Now - this.startTime).TotalSeconds)); - monitor.Log.Write (String.Format (GettextCatalog.GetPluralString ("{0} was successfull, ", "{0} tests were successful,", this.success), this.success)); - monitor.Log.Write (String.Format (GettextCatalog.GetPluralString (" {0} failed,", " {0} failed,", this.failures), this.failures)); - monitor.Log.Write (String.Format (GettextCatalog.GetPluralString (" {0} ignored", " {0} ignored", this.ignored), this.ignored)); - monitor.Dispose (); - monitor = null; - if (failures > 0) { - Pad errorList = IdeApp.Workbench.GetPad <ErrorListPad> (); - if (errorList != null) - errorList.BringToFront (); - } - } - } - - public void Cancel () - { - CanelRequestedRequest (monitor); - FinishTestRun (); - } - - public void BeginTest (UnitTest test) - { - if (test is UnitTestGroup) { - monitor.BeginTask (GettextCatalog.GetString ("Run tests in suite {0}", test.Name), 1); - return; - } - monitor.BeginTask (GettextCatalog.GetString ("Run test {0}", test.Name), 1); - currentWork++; - IdeApp.Workbench.StatusBar.SetProgressFraction ((double)currentWork / (double)totalWork); - } - - public void EndTest (UnitTest test, UnitTestResult result) - { - if (test is UnitTestGroup) { - monitor.EndTask (); - return; - } - - if (!String.IsNullOrEmpty (result.ConsoleError)) - monitor.Log.WriteLine (result.ConsoleError); - if (!String.IsNullOrEmpty (result.ConsoleOutput)) - monitor.Log.WriteLine (result.ConsoleOutput); - - if (result.IsFailure) { - - failures++; - string msg = !String.IsNullOrEmpty (result.Message) ? result.Message.Trim ().Replace (Environment.NewLine, " ") : ""; - monitor.Log.WriteLine (msg); - if (!String.IsNullOrEmpty (result.StackTrace)) - monitor.Log.WriteLine (result.StackTrace.Trim ()); - SourceCodeLocation location = GetSourceCodeLocation (test, result.StackTrace); - if (location != null) { - Task t = new Task (location.FileName, - msg, - location.Column, - location.Line, - TaskType.Error); - IdeApp.Services.TaskService.Add (t); - } - monitor.Log.WriteLine (GettextCatalog.GetString ("Test failed")); - } else if (result.IsIgnored) { - ignored++; - monitor.Log.WriteLine (GettextCatalog.GetString ("Test ignored")); - } else if (result.IsSuccess) { - success++; - monitor.Log.WriteLine (GettextCatalog.GetString ("Test success")); - } else { - monitor.ReportWarning ("test status unknown: " + result.Message); - } - monitor.EndTask (); - } - - static SourceCodeLocation GetSourceCodeLocation (UnitTest test, string stackTrace) - { - Debug.Assert (test != null); - if (!String.IsNullOrEmpty (stackTrace)) { - System.Console.WriteLine(stackTrace); - Match match = Regex.Match (stackTrace, @"\sin\s(.*?):(\d+)", RegexOptions.Multiline); - while (match.Success) { - try { - int line = Int32.Parse (match.Groups[2].Value); - return new SourceCodeLocation (match.Groups[1].Value, line, 1); - } catch (Exception) { - } - match = match.NextMatch (); - } - } - return test.SourceCodeLocation; - } - - - public void ReportRuntimeError (string message, Exception exception) - { - monitor.ReportError (message, exception); - } - - public bool IsCancelRequested { - get { - return monitor.IsCancelRequested; - } - } - - void CanelRequestedRequest (IProgressMonitor monitor) - { - if (CancelRequested != null) - CancelRequested (); - } - - public event TestHandler CancelRequested; - } -} diff --git a/main/src/addins/NUnit/Services/UnitTest.cs b/main/src/addins/NUnit/Services/UnitTest.cs index 951219a969..3d4c62e36f 100644 --- a/main/src/addins/NUnit/Services/UnitTest.cs +++ b/main/src/addins/NUnit/Services/UnitTest.cs @@ -44,7 +44,8 @@ namespace MonoDevelop.NUnit UnitTest parent; TestStatus status; Hashtable options; - CombineEntry ownerCombineEntry; + IWorkspaceObject ownerSolutionItem; + SolutionEntityItem ownerSolutionEntityItem; UnitTestResultsStore results; protected UnitTest (string name) @@ -52,17 +53,19 @@ namespace MonoDevelop.NUnit this.name = name; } - protected UnitTest (string name, CombineEntry ownerCombineEntry) + protected UnitTest (string name, IWorkspaceObject ownerSolutionItem) { this.name = name; - this.ownerCombineEntry = ownerCombineEntry; - ownerCombineEntry.ActiveConfigurationChanged += new ConfigurationEventHandler (OnConfugurationChanged); + this.ownerSolutionItem = ownerSolutionItem; + ownerSolutionEntityItem = ownerSolutionItem as SolutionEntityItem; + if (ownerSolutionEntityItem != null) + ownerSolutionEntityItem.DefaultConfigurationChanged += OnConfugurationChanged; } public virtual void Dispose () { - if (ownerCombineEntry != null) - ownerCombineEntry.ActiveConfigurationChanged -= new ConfigurationEventHandler (OnConfugurationChanged); + if (ownerSolutionEntityItem != null) + ownerSolutionEntityItem.DefaultConfigurationChanged -= OnConfugurationChanged; } internal void SetParent (UnitTest t) @@ -72,10 +75,10 @@ namespace MonoDevelop.NUnit public virtual string ActiveConfiguration { get { - if (ownerCombineEntry != null) { - if (ownerCombineEntry.ActiveConfiguration == null) + if (ownerSolutionEntityItem != null) { + if (ownerSolutionEntityItem.DefaultConfiguration == null) return ""; - return ownerCombineEntry.ActiveConfiguration.Name; + return ownerSolutionEntityItem.DefaultConfiguration.Id; } else if (Parent != null) { return Parent.ActiveConfiguration; } else { @@ -86,10 +89,10 @@ namespace MonoDevelop.NUnit public virtual string[] GetConfigurations () { - if (ownerCombineEntry != null) { - string[] res = new string [ownerCombineEntry.Configurations.Count]; - for (int n=0; n<ownerCombineEntry.Configurations.Count; n++) - res [n] = ownerCombineEntry.Configurations [n].Name; + if (ownerSolutionEntityItem != null) { + string[] res = new string [ownerSolutionEntityItem.Configurations.Count]; + for (int n=0; n<ownerSolutionEntityItem.Configurations.Count; n++) + res [n] = ownerSolutionEntityItem.Configurations [n].Id; return res; } else if (Parent != null) { return Parent.GetConfigurations (); @@ -263,6 +266,15 @@ namespace MonoDevelop.NUnit get { return parent; } } + public UnitTest RootTest { + get { + if (parent != null) + return parent.RootTest; + else + return this; + } + } + public virtual string Name { get { return name; } } @@ -285,8 +297,8 @@ namespace MonoDevelop.NUnit } } - protected CombineEntry OwnerCombineEntry { - get { return ownerCombineEntry; } + protected IWorkspaceObject OwnerSolutionItem { + get { return ownerSolutionItem; } } internal string StoreRelativeName { @@ -370,16 +382,16 @@ namespace MonoDevelop.NUnit protected virtual void OnSaveOptions (OptionsData[] data) { - CombineEntry ce; + IConfigurationTarget ce; string path; - GetOwnerCombineEntry (this, out ce, out path); + GetOwnerSolutionItem (this, out ce, out path); if (ce == null) throw new InvalidOperationException ("Options can't be saved."); foreach (OptionsData d in data) { - IExtendedDataItem edi = (IExtendedDataItem) ce.GetConfiguration (d.Configuration); + IExtendedDataItem edi = (IExtendedDataItem) ce.Configurations [d.Configuration]; if (edi == null) continue; UnitTestOptionsSet oset = (UnitTestOptionsSet) edi.ExtendedProperties ["UnitTestInformation"]; @@ -408,15 +420,15 @@ namespace MonoDevelop.NUnit protected virtual ICollection OnLoadOptions (string configuration) { - CombineEntry ce; + IConfigurationTarget ce; string path; - GetOwnerCombineEntry (this, out ce, out path); + GetOwnerSolutionItem (this, out ce, out path); if (ce == null) return null; - IExtendedDataItem edi = (IExtendedDataItem) ce.GetConfiguration (configuration); + IExtendedDataItem edi = (IExtendedDataItem) ce.Configurations [configuration]; if (edi == null) return null; @@ -431,13 +443,13 @@ namespace MonoDevelop.NUnit return null; } - void GetOwnerCombineEntry (UnitTest t, out CombineEntry c, out string path) + void GetOwnerSolutionItem (UnitTest t, out IConfigurationTarget c, out string path) { - if (OwnerCombineEntry != null) { - c = OwnerCombineEntry; + if (OwnerSolutionItem is SolutionEntityItem) { + c = OwnerSolutionItem as SolutionEntityItem; path = ""; } else if (parent != null) { - parent.GetOwnerCombineEntry (t, out c, out path); + parent.GetOwnerSolutionItem (t, out c, out path); if (c == null) return; if (path.Length > 0) path += "/" + t.Name; diff --git a/main/src/addins/NUnit/Services/UnitTestGroup.cs b/main/src/addins/NUnit/Services/UnitTestGroup.cs index 07ac3a427b..800f54604c 100644 --- a/main/src/addins/NUnit/Services/UnitTestGroup.cs +++ b/main/src/addins/NUnit/Services/UnitTestGroup.cs @@ -41,7 +41,7 @@ namespace MonoDevelop.NUnit { } - protected UnitTestGroup (string name, CombineEntry ownerCombineEntry): base (name, ownerCombineEntry) + protected UnitTestGroup (string name, IWorkspaceObject ownerSolutionItem): base (name, ownerSolutionItem) { } diff --git a/main/src/addins/NUnit/Services/WorkspaceTestGroup.cs b/main/src/addins/NUnit/Services/WorkspaceTestGroup.cs new file mode 100644 index 0000000000..b729f36e16 --- /dev/null +++ b/main/src/addins/NUnit/Services/WorkspaceTestGroup.cs @@ -0,0 +1,91 @@ +// +// WorkspaceTestGroup.cs +// +// Author: +// Lluis Sanchez Gual +// +// Copyright (C) 2008 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.IO; +using System.Collections; +using MonoDevelop.Core; +using MonoDevelop.Projects; + +using NUnit.Core; + +namespace MonoDevelop.NUnit +{ + public class WorkspaceTestGroup: UnitTestGroup + { + Workspace workspace; + + public WorkspaceTestGroup (Workspace ws): base (ws.Name, ws) + { + string storeId = ws.Name; + string resultsPath = Path.Combine (ws.BaseDirectory, "test-results"); + ResultsStore = new XmlResultsStore (resultsPath, storeId); + + workspace = ws; + workspace.ItemAdded += OnEntryChanged; + workspace.ItemRemoved += OnEntryChanged; + workspace.NameChanged += OnCombineRenamed; + } + + public static WorkspaceTestGroup CreateTest (Workspace ws) + { + return new WorkspaceTestGroup (ws); + } + + public override void Dispose () + { + workspace.ItemAdded -= OnEntryChanged; + workspace.ItemRemoved -= OnEntryChanged; + workspace.NameChanged -= OnCombineRenamed; + base.Dispose (); + } + + void OnEntryChanged (object sender, WorkspaceItemEventArgs e) + { + UpdateTests (); + } + + void OnCombineRenamed (object sender, WorkspaceItemRenamedEventArgs e) + { + UnitTestGroup parent = Parent as UnitTestGroup; + if (parent != null) + parent.UpdateTests (); + } + + protected override void OnCreateTests () + { + NUnitService testService = (NUnitService) ServiceManager.GetService (typeof(NUnitService)); + foreach (WorkspaceItem e in workspace.Items) { + UnitTest t = testService.BuildTest (e); + if (t != null) + Tests.Add (t); + } + } + } +} + diff --git a/main/src/addins/VBNetBinding/ChangeLog b/main/src/addins/VBNetBinding/ChangeLog index 145ce57c8a..550c67ca9b 100644 --- a/main/src/addins/VBNetBinding/ChangeLog +++ b/main/src/addins/VBNetBinding/ChangeLog @@ -1,3 +1,11 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * Gui/CodeGenerationPanel.cs, Gui/CodeGenerationPanelWidget.cs, + VBNetBinding.addin.xml, VBNetBinding.mdp, VBNetBinding.mds, + VBBindingCompilerServices.cs, Project/VBCompilerParameters.cs, + Project/VBNetResourceIdBuilder.cs, gtk-gui/objects.xml, + gtk-gui/gui.stetic, Makefile.am: New project model changes. + 2008-05-08 Michael Hutchinson <mhutchinson@novell.com> * VBNetBinding.addin.xml: Set "isText" attribute on the mimetype diff --git a/main/src/addins/VBNetBinding/Gui/CodeGenerationPanel.cs b/main/src/addins/VBNetBinding/Gui/CodeGenerationPanel.cs index 0d389ce37a..076f38533e 100644 --- a/main/src/addins/VBNetBinding/Gui/CodeGenerationPanel.cs +++ b/main/src/addins/VBNetBinding/Gui/CodeGenerationPanel.cs @@ -29,7 +29,7 @@ using System; using MonoDevelop.Projects; -using MonoDevelop.Core.Gui.Dialogs; +using MonoDevelop.Projects.Gui.Dialogs; using MonoDevelop.Core; using Mono.Addins; using MonoDevelop.Components; @@ -37,7 +37,7 @@ using VBBinding; namespace MonoDevelop.VBNetBinding { - public class CodeGenerationPanel : AbstractOptionPanel + public class CodeGenerationPanel : MultiConfigItemOptionsPanel { CodeGenerationPanelWidget widget; @@ -45,14 +45,19 @@ namespace MonoDevelop.VBNetBinding { } - public override void LoadPanelContents () + public override Gtk.Widget CreatePanelWidget () { - Add (widget = new CodeGenerationPanelWidget ((Properties) CustomizationObject)); + return (widget = new CodeGenerationPanelWidget (ConfiguredProject)); } - public override bool StorePanelContents () + public override void LoadConfigData () { - return widget.StorePanelContents (); + widget.Load ((DotNetProjectConfiguration) CurrentConfiguration); + } + + public override void ApplyChanges () + { + widget.StorePanelContents (); } } } diff --git a/main/src/addins/VBNetBinding/Gui/CodeGenerationPanelWidget.cs b/main/src/addins/VBNetBinding/Gui/CodeGenerationPanelWidget.cs index 43598e154e..1c3d0fc99b 100644 --- a/main/src/addins/VBNetBinding/Gui/CodeGenerationPanelWidget.cs +++ b/main/src/addins/VBNetBinding/Gui/CodeGenerationPanelWidget.cs @@ -42,11 +42,10 @@ namespace MonoDevelop.VBNetBinding { public partial class CodeGenerationPanelWidget : Gtk.Bin { - DotNetProject project; DotNetProjectConfiguration config; VBCompilerParameters parameters; - public CodeGenerationPanelWidget (Properties customizationObject) + public CodeGenerationPanelWidget (Project project) { this.Build(); @@ -59,30 +58,22 @@ namespace MonoDevelop.VBNetBinding compileTargetCombo.Model = store; classListStore = new Gtk.ListStore (typeof(string));
mainClassEntry.Model = classListStore; - mainClassEntry.TextColumn = 0;
-
- project = customizationObject.Get<DotNetProject> ("Project"); - if (project == null) { - MessageService.ShowError ("project == null. In CodeGenerationPanelWidget constructor (VB.NET binding)."); - return; - } - this.config = customizationObject.Get<DotNetProjectConfiguration> ("Config"); - if (config == null) { - MessageService.ShowError ("config == null. In CodeGenerationPanelWidget constructor (VB.NET binding)."); - return; - } - this.parameters = (VBCompilerParameters)config.CompilationParameters; - if (parameters == null) { - MessageService.ShowError ("parameters == null. In CodeGenerationPanelWidget constructor (VB.NET binding)."); - return; - } - FillClasses ();
+ mainClassEntry.TextColumn = 0; Gtk.CellRendererText cr = new Gtk.CellRendererText (); compileTargetCombo.PackStart (cr, true); compileTargetCombo.AddAttribute (cr, "text", 0); - compileTargetCombo.Active = (int)config.CompileTarget; compileTargetCombo.Changed += new EventHandler (OnTargetChanged); +
+ FillClasses (project);
+ } + + public void Load (DotNetProjectConfiguration config) + { + this.config = config; + this.parameters = (VBCompilerParameters) config.CompilationParameters; + + compileTargetCombo.Active = (int)config.CompileTarget; symbolsEntry.Text = parameters.DefineSymbols; mainClassEntry.Entry.Text = parameters.MainClass; @@ -96,7 +87,7 @@ namespace MonoDevelop.VBNetBinding additionalArgsEntry.Text = parameters.AdditionalParameters; } - public bool StorePanelContents () + public void StorePanelContents () { parameters.DefineSymbols = symbolsEntry.Text; parameters.MainClass = mainClassEntry.Entry.Text; @@ -108,7 +99,6 @@ namespace MonoDevelop.VBNetBinding config.RunWithWarnings = !warningsAsErrorsCheckButton.Active; parameters.WarningLevel = (int)warningLevelSpinButton.Value; parameters.AdditionalParameters = additionalArgsEntry.Text; - return true; } void OnTargetChanged (object s, EventArgs a)
@@ -116,16 +106,17 @@ namespace MonoDevelop.VBNetBinding mainClassEntry.Sensitive = (CompileTarget) compileTargetCombo.Active == CompileTarget.Library;
} - Gtk.ListStore classListStore;
- void FillClasses ()
+ Gtk.ListStore classListStore; +
+ void FillClasses (Project project)
{
try { - IParserContext ctx = MonoDevelop.Ide.Gui.IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (project);
+ classListStore.Clear (); + IParserContext ctx = MonoDevelop.Ide.Gui.IdeApp.Workspace.ParserDatabase.GetProjectParserContext (project);
foreach (IClass c in ctx.GetProjectContents ()) {
if (c.Methods == null) continue; foreach (IMethod m in c.Methods) { - System.Console.WriteLine (m);
if (m.IsStatic && m.Name.ToUpper () == "MAIN")
classListStore.AppendValues (c.FullyQualifiedName);
}
diff --git a/main/src/addins/VBNetBinding/Makefile.am b/main/src/addins/VBNetBinding/Makefile.am index 46d8a0da70..42cb95f3da 100644 --- a/main/src/addins/VBNetBinding/Makefile.am +++ b/main/src/addins/VBNetBinding/Makefile.am @@ -10,6 +10,7 @@ REFS = \ -r:$(top_builddir)/build/bin/MonoDevelop.Core.Gui.dll \ -r:$(top_builddir)/build/bin/MonoDevelop.Ide.dll \ -r:$(top_builddir)/build/bin/MonoDevelop.Projects.dll \ + -r:$(top_builddir)/build/bin/MonoDevelop.Projects.Gui.dll \ -r:$(top_builddir)/build/bin/NRefactory.dll \ -r:Mono.Posix \ -r:System \ @@ -32,6 +33,7 @@ FILES = \ Parser/TypeVisitor.cs \ Parser/VBNetVisitor.cs \ Project/VBCompilerParameters.cs \ + Project/VBNetResourceIdBuilder.cs \ VBAmbience.cs \ VBBindingCompilerServices.cs \ VBCodeGenerator.cs \ diff --git a/main/src/addins/VBNetBinding/Project/VBCompilerParameters.cs b/main/src/addins/VBNetBinding/Project/VBCompilerParameters.cs index 341068f8d9..e27f4c1dce 100644 --- a/main/src/addins/VBNetBinding/Project/VBCompilerParameters.cs +++ b/main/src/addins/VBNetBinding/Project/VBCompilerParameters.cs @@ -38,49 +38,45 @@ namespace VBBinding { /// </summary>
public class VBCompilerParameters: ICloneable
{
- [ItemProperty("compilerversion")]
+ [ItemProperty("Compilerversion")]
string vbCompilerVersion = String.Empty; - [ItemProperty("compiler")] VBCompiler vbCompiler = VBCompiler.Mbas; - [ItemProperty("warninglevel")] - int warninglevel = 4; + [ItemProperty("WarningLevel", DefaultValue=4)] + int warninglevel = 4; - [ItemProperty("nowarn")] - string noWarnings = String.Empty;
+ [ItemProperty("NoWarn")] + string noWarnings = String.Empty;
- [ItemProperty("optimize")]
- bool optimize = true; + [ItemProperty("Optimize", DefaultValue=false)]
+ bool optimize = false; - [ItemProperty("unsafecodeallowed")] - bool unsafecode = false;
+ [ItemProperty("AllowUnsafeBlocks", DefaultValue=false)] + bool unsafecode = false;
- [ItemProperty("generateoverflowchecks")]
- bool generateOverflowChecks = true;
+ [ItemProperty("RemoveIntegerChecks", DefaultValue=false)]
+ bool generateOverflowChecks = false;
- [ItemProperty("rootnamespace")]
- string rootnamespace = String.Empty;
-
- [ItemProperty("mainclass")]
+ [ItemProperty("StartupObject")]
string mainclass = null;
- [ItemProperty("definesymbols")]
+ [ItemProperty("DefineConstants", DefaultValue="")]
string definesymbols = String.Empty; [ItemProperty("generatexmldocumentation")] bool generateXmlDocumentation = false;
- [ItemProperty("optionexplicit")]
+ [ItemProperty("OptionExplicit", DefaultValue=true)]
bool optionExplicit = true;
- [ItemProperty("optionstrict")]
+ [ItemProperty("OptionStrict", DefaultValue=false)]
bool optionStrict = false;
- [ProjectPathItemProperty("win32Icon")]
+ [ProjectPathItemProperty("ApplicationIcon")]
string win32Icon = String.Empty;
- [ProjectPathItemProperty("win32Resource")]
+ [ProjectPathItemProperty("Win32Resource")]
string win32Resource = String.Empty;
[ItemProperty("imports")]
@@ -103,7 +99,6 @@ namespace VBBinding { return MemberwiseClone ();
}
- [Browsable(false)]
public string VBCompilerVersion
{
get {
@@ -114,7 +109,6 @@ namespace VBBinding { }
} - [Browsable(false)] public VBCompiler VBCompiler { get { return vbCompiler; @@ -134,7 +128,6 @@ namespace VBBinding { }
} - [DefaultValue(false)] public bool UnsafeCode { get { return unsafecode; @@ -144,7 +137,6 @@ namespace VBBinding { } } - [DefaultValue(false)] public bool GenerateXmlDocumentation { get { return generateXmlDocumentation; @@ -155,7 +147,6 @@ namespace VBBinding { } - [DefaultValue(4)] public int WarningLevel { get { return warninglevel; @@ -195,16 +186,6 @@ namespace VBBinding { }
}
- public string RootNamespace
- {
- get {
- return rootnamespace;
- }
- set {
- rootnamespace = value;
- }
- }
-
public string DefineSymbols
{
get {
diff --git a/main/src/addins/prj2make-sharp-lib/VBNetResourceIdBuilder.cs b/main/src/addins/VBNetBinding/Project/VBNetResourceIdBuilder.cs index c111d5c7b9..375150b44b 100644 --- a/main/src/addins/prj2make-sharp-lib/VBNetResourceIdBuilder.cs +++ b/main/src/addins/VBNetBinding/Project/VBNetResourceIdBuilder.cs @@ -30,15 +30,17 @@ using MonoDevelop.Projects; using System; using System.IO; using System.Text; +using MonoDevelop.Projects.Extensions; +using MonoDevelop.Projects.Formats.MSBuild; -namespace MonoDevelop.Prj2Make +namespace VBBinding { - class VBNetResourceIdBuilder : IResourceIdBuilder + class VBNetResourceIdBuilder : IResourceHandler { - public string GetResourceId (ProjectFile pf) + public string GetDefaultResourceId (ProjectFile pf) { if (String.IsNullOrEmpty (pf.DependsOn)) - return GetResourceIdForNoClass (pf); + return MSBuildProjectService.GetDefaultResourceId (pf); string ns = null; string classname = null; @@ -68,10 +70,10 @@ namespace MonoDevelop.Prj2Make } if (classname == null) - return GetResourceIdForNoClass (pf); + return MSBuildProjectService.GetDefaultResourceId (pf); string culture, extn, only_filename; - if (Utils.TrySplitResourceName (pf.RelativePath, out only_filename, out culture, out extn)) + if (MSBuildProjectService.TrySplitResourceName (pf.RelativePath, out only_filename, out culture, out extn)) extn = "." + culture + ".resources"; else extn = ".resources"; @@ -82,35 +84,15 @@ namespace MonoDevelop.Prj2Make else rname = ns + '.' + classname + extn; - if (String.IsNullOrEmpty (pf.Project.DefaultNamespace)) + DotNetProject dp = pf.Project as DotNetProject; + if (dp == null || String.IsNullOrEmpty (dp.DefaultNamespace)) return rname; else - return pf.Project.DefaultNamespace + "." + rname; + return dp.DefaultNamespace + "." + rname; } } - static string GetResourceIdForNoClass (ProjectFile pf) - { - string fname = pf.Name; - - if (String.Compare (Path.GetExtension (fname), ".resx", true) == 0) { - fname = Path.ChangeExtension (fname, ".resources"); - } else { - string only_filename, culture, extn; - if (Utils.TrySplitResourceName (fname, out only_filename, out culture, out extn)) { - //remove the culture from fname - //foo.it.bmp -> foo.bmp - fname = only_filename + "." + extn; - } - } - string rname = Path.GetFileName (fname); - - if (String.IsNullOrEmpty (pf.Project.DefaultNamespace)) - return rname; - else - return pf.Project.DefaultNamespace + "." + rname; - } /* Special parser for VB.NET files * Assumes that the file is compilable diff --git a/main/src/addins/VBNetBinding/VBBindingCompilerServices.cs b/main/src/addins/VBNetBinding/VBBindingCompilerServices.cs index 2d161b7fea..5740106e58 100644 --- a/main/src/addins/VBNetBinding/VBBindingCompilerServices.cs +++ b/main/src/addins/VBNetBinding/VBBindingCompilerServices.cs @@ -100,9 +100,10 @@ namespace VBBinding { else sb.Append("-win32icon:");sb.Append('"');sb.Append(compilerparameters.Win32Icon);sb.Append('"');sb.Append(Environment.NewLine);
}
-
- if (compilerparameters.RootNamespace!= null && compilerparameters.RootNamespace.Length > 0) {
- sb.Append("-rootnamespace:");sb.Append('"');sb.Append(compilerparameters.RootNamespace);sb.Append('"');sb.Append(Environment.NewLine);
+ + DotNetProject dp = configuration.ParentItem as DotNetProject; + if (dp != null && !string.IsNullOrEmpty (dp.DefaultNamespace)) {
+ sb.Append("-rootnamespace:").Append('"').Append(dp.DefaultNamespace).Append('"').Append(Environment.NewLine);
}
if (compilerparameters.DefineSymbols.Length > 0) {
@@ -158,7 +159,7 @@ namespace VBBinding { writer.WriteLine(GenerateOptions (configuration, compilerparameters, exe));
foreach (ProjectReference lib in references) {
- foreach (string fileName in lib.GetReferencedFileNames()) + foreach (string fileName in lib.GetReferencedFileNames(configuration.Id)) writer.WriteLine(String.Concat("-r:", fileName));
}
diff --git a/main/src/addins/VBNetBinding/VBDOCCommand.cs b/main/src/addins/VBNetBinding/VBDOCCommand.cs deleted file mode 100644 index 519a649735..0000000000 --- a/main/src/addins/VBNetBinding/VBDOCCommand.cs +++ /dev/null @@ -1,116 +0,0 @@ -// VBDOCCommand.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Markus Palme <MarkusPalme@gmx.de> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.IO; -using System.Collections; -using System.Collections.Specialized; -using System.Windows.Forms; -using System.Reflection; - -using ICSharpCode.Core.Properties; -using ICSharpCode.Core.Services; - -using ICSharpCode.Core.AddIns; -using ICSharpCode.Core.AddIns.Codons; - -using ICSharpCode.SharpDevelop.Internal.Project; -using ICSharpCode.SharpDevelop.Services; - -namespace VBBinding -{ - ////<summary> - /// Provides functions to run VB.DOC and to read the configuration of VB.DOC. - /// </summary> - public class VBDOCCommand : AbstractMenuCommand - { - ///<summary> - /// Runs VB.DOC for the given project - /// </summary> - public override void Run() - { - IProjectService projectService = (IProjectService)ICSharpCode.Core.Services.ServiceManager.Services.GetService(typeof(IProjectService)); - VBProject project = (VBProject)projectService.CurrentSelectedProject; - VBCompilerParameters compilerParameters = (VBCompilerParameters)project.ActiveConfiguration; - - Options options = new Options(); - string extension = compilerParameters.CompileTarget == CompileTarget.Exe ? ".dll" : ".exe"; - options.AssemblyFile = Path.Combine(compilerParameters.OutputDirectory, compilerParameters.OutputAssembly) + extension; - - ArrayList files = new ArrayList(); - foreach(ProjectFile file in project.ProjectFiles) { - if(VBDOCConfigurationPanel.IsFileIncluded(file.Name, project)) { - files.Add(file.Name); - } - } - - options.Files = (string[])files.ToArray(typeof(string)); - options.GlobalImports = compilerParameters.Imports.Split(','); - options.OutputXML = compilerParameters.VBDOCOutputFile; - options.Prefix = compilerParameters.VBDOCCommentPrefix; - options.RootNamespace = compilerParameters.RootNamespace; - - ArrayList referenceDirs = new ArrayList(); - string mainDirectory = Path.GetDirectoryName(options.AssemblyFile); - - foreach(ProjectReference projectFile in project.ProjectReferences) { - if(projectFile.ReferenceType == ReferenceType.Assembly) { - string referenceDir = Path.GetDirectoryName(projectFile.Reference); - if(referenceDir.ToLower() != mainDirectory.ToLower() && referenceDirs.Contains(referenceDir) == false) { - referenceDirs.Add(referenceDir); - } - } - } - - StringCollection errors = options.Validate(); - - if(errors.Count > 0) { - string message = ""; - foreach(string description in errors) { - message += description + "\n"; - } - MessageBox.Show(message, "Invalid VB.DOC options", MessageBoxButtons.OK, MessageBoxIcon.Warning); - return; - } - - VBDOCRunner runner = new VBDOCRunner(); - AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(resolve); - GuiMessageRecipient messageRecipient = new GuiMessageRecipient(); - - try { - runner.RunVBDOC(options, messageRecipient); - } catch(Exception ex) { - MessageBox.Show("Documentation generation failed:\n" + ex.Message); - } finally { - messageRecipient.Finished(); - AppDomain.CurrentDomain.AssemblyResolve -= new ResolveEventHandler(resolve); - } - - } - - Assembly resolve(object sender, ResolveEventArgs e) - { - if(e.Name.StartsWith("CommentExtractor")) { - return Assembly.GetAssembly(typeof(VBDOCRunner)); - } - return null; - } - } -} diff --git a/main/src/addins/VBNetBinding/VBNetBinding.addin.xml b/main/src/addins/VBNetBinding/VBNetBinding.addin.xml index 478b4fcdd9..62950d566e 100644 --- a/main/src/addins/VBNetBinding/VBNetBinding.addin.xml +++ b/main/src/addins/VBNetBinding/VBNetBinding.addin.xml @@ -16,6 +16,19 @@ <Addin id="Ide" version="0.19.0"/> </Dependencies> + <Extension path = "/MonoDevelop/ProjectModel/MSBuildItemTypes"> + <DotNetProject + language="VBNet" + extension="vbproj" + guid="{F184B08F-C81C-45F6-A57F-5ABD9991F28F}" + import="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" + resourceHandler="VBBinding.VBNetResourceIdBuilder"/> + </Extension> + + <Extension path = "/MonoDevelop/ProjectModel/MD1SerializationMaps"> + <SerializationMap resource="md1format.xml" /> + </Extension> + <Extension path = "/MonoDevelop/Ide/FileFilters"> <FileFilter id = "VBNet" insertbefore = "AllFiles" @@ -34,38 +47,20 @@ <ProjectTemplate id = "VBGtkSharp2Project" resource = "VBGtkSharp2Project.xpt.xml"/> </Extension> - <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/ConfigurationOptions"> - <Condition id="activelanguage" value = "VBNet"> - <DialogPanel id = "VBNetCodeGenerationPanel" - _label = "Code Generation" - class = "MonoDevelop.VBNetBinding.CodeGenerationPanel"/> - </Condition> - </Extension> - - <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/ConfigurationOptions"> - <Condition id="activelanguage" value = "VBNet"> - <DialogPanel id = "VBNetOutputOptionsPanel" - _label = "Output Options" - class = "MonoDevelop.Projects.Gui.Dialogs.OptionPanels.OutputOptionsPanel"/> - </Condition> - </Extension> - <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/GeneralOptions/Common"> + <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/Common"> <Condition id="activelanguage" value="VBNet"> - <DialogPanel id = "RuntimeOptionsPanel" + <Section id = "RuntimeOptionsPanel" _label = "Runtime Options" class = "MonoDevelop.Projects.Gui.Dialogs.OptionPanels.RuntimeOptionsPanel"/> + <Section id = "VBNetCodeGenerationPanel" + _label = "Code Generation" + class = "MonoDevelop.VBNetBinding.CodeGenerationPanel"/> + <Section id = "VBNetOutputOptionsPanel" + _label = "Output Options" + class = "MonoDevelop.Projects.Gui.Dialogs.OptionPanels.OutputOptionsPanel"/> </Condition> </Extension> - <!-- <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/ConfigurationOptions"> - <Condition id="activelanguage" value = "VBNet"> - <DialogPanel id = "VBNetChooseRuntimePanel" - _label = "Choose Runtime" - class = "VBBinding.ChooseRuntimePanel"/> - </Condition> - </Extension> --> - - <Extension path = "/MonoDevelop/ProjectModel/Gui/Icons"> <Icon language = "VBNet" icon = "res:VB.ProjectIcon"/> </Extension> diff --git a/main/src/addins/VBNetBinding/VBNetBinding.mdp b/main/src/addins/VBNetBinding/VBNetBinding.mdp index 6833d5ad29..fa1a5bb948 100644 --- a/main/src/addins/VBNetBinding/VBNetBinding.mdp +++ b/main/src/addins/VBNetBinding/VBNetBinding.mdp @@ -43,6 +43,7 @@ <File name="Gui/CodeGenerationPanelWidget.cs" subtype="Code" buildaction="Compile" /> <File name="gtk-gui/MonoDevelop.VBNetBinding.CodeGenerationPanelWidget.cs" subtype="Code" buildaction="Compile" /> <File name="Gui/CodeGenerationPanel.cs" subtype="Code" buildaction="Compile" /> + <File name="Project/VBNetResourceIdBuilder.cs" subtype="Code" buildaction="Compile" /> </Contents> <References> <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Core" /> @@ -60,6 +61,7 @@ <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> + <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Projects.Gui" /> </References> <GtkDesignInfo gtkVersion="2.10.2"> <ExportedWidgets> diff --git a/main/src/addins/VBNetBinding/VBNetBinding.mds b/main/src/addins/VBNetBinding/VBNetBinding.mds index 585bc865e4..90a2128b4d 100644 --- a/main/src/addins/VBNetBinding/VBNetBinding.mds +++ b/main/src/addins/VBNetBinding/VBNetBinding.mds @@ -4,7 +4,7 @@ <Entry build="True" name="MonoDevelop.VBNetBinding" configuration="Debug" /> </Configuration> <Configuration name="Release" ctype="CombineConfiguration"> - <Entry build="True" name="MonoDevelop.VBNetBinding" configuration="Debug" /> + <Entry build="True" name="MonoDevelop.VBNetBinding" configuration="Release" /> </Configuration> </Configurations> <StartMode startupentry="MonoDevelop.VBNetBinding" single="True"> diff --git a/main/src/addins/VBNetBinding/gtk-gui/gui.stetic b/main/src/addins/VBNetBinding/gtk-gui/gui.stetic index 2efcb64586..26c80a7ea7 100644 --- a/main/src/addins/VBNetBinding/gtk-gui/gui.stetic +++ b/main/src/addins/VBNetBinding/gtk-gui/gui.stetic @@ -8,6 +8,7 @@ <widget-library name="../../../../build/bin/MonoDevelop.Ide.dll" /> <widget-library name="../../../../build/bin/MonoDevelop.Components.dll" /> <widget-library name="../../../../build/AddIns/BackendBindings/MonoDevelop.VBNetBinding.dll" internal="true" /> + <widget-library name="../../../../build/bin/MonoDevelop.Projects.Gui.dll" /> </import> <widget class="Gtk.Bin" id="MonoDevelop.VBNetBinding.CodeGenerationPanelWidget" design-size="342 426"> <property name="MemberName" /> diff --git a/main/src/addins/VBNetBinding/gtk-gui/objects.xml b/main/src/addins/VBNetBinding/gtk-gui/objects.xml index c245b4e314..ba4f1cbce6 100644 --- a/main/src/addins/VBNetBinding/gtk-gui/objects.xml +++ b/main/src/addins/VBNetBinding/gtk-gui/objects.xml @@ -5,15 +5,11 @@ </object> <object type="MonoDevelop.VBNetBinding.CodeGenerationPanel" palette-category="MonoDevelop.VBNetBinding" allow-children="false" base-type="Gtk.Dialog"> <itemgroups> - <itemgroup label="AbstractOptionPanel Properties"> - <property name="EnableFinish" /> + <itemgroup label="MultiConfigItemOptionsPanel Properties"> + <property name="AllowMixedConfigurations" /> </itemgroup> </itemgroups> <signals> - <itemgroup label="AbstractOptionPanel Signals"> - <signal name="CustomizationObjectChanged" /> - <signal name="EnableFinishChanged" /> - </itemgroup> </signals> </object> </objects>
\ No newline at end of file diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/ChangeLog b/main/src/addins/VersionControl/MonoDevelop.VersionControl/ChangeLog index 383631d291..ba128e5f64 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/ChangeLog +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/ChangeLog @@ -1,3 +1,14 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * MonoDevelop.VersionControl.mdp, VersionControl.addin.xml, + Makefile.am, + MonoDevelop.VersionControl/VersionControlFileSystemExtension.cs, + MonoDevelop.VersionControl/VersionControlNodeExtension.cs, + MonoDevelop.VersionControl/Checkout.cs, + MonoDevelop.VersionControl/Publish.cs, + MonoDevelop.VersionControl/VersionControlService.cs: New project + model changes. + 2008-05-15 Lluis Sanchez Gual <lluis@novell.com> * gtk-gui/gui.stetic: Set correct target version. diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/Makefile.am b/main/src/addins/VersionControl/MonoDevelop.VersionControl/Makefile.am index 30dd27b75e..568b06f3ab 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/Makefile.am +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/Makefile.am @@ -40,6 +40,7 @@ FILES = \ REFS = \ $(GCONF_SHARP_LIBS) \ + $(GLIB_SHARP_LIBS) \ $(GTK_SHARP_LIBS) \ $(MONO_ADDINS_LIBS) \ -r:$(top_builddir)/build/AddIns/VersionControl/Diff.dll \ diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.mdp b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.mdp index 3448a4d7be..c7a560bbc8 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.mdp +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.mdp @@ -93,6 +93,7 @@ <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Core.Gui" /> <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Components" /> <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.3.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> + <ProjectReference type="Gac" localcopy="True" refto="glib-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> </References> <GtkDesignInfo /> <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="./Makefile.am" BuildTargetName="" CleanTargetName="" SyncReferences="True" IsAutotoolsProject="True" RelativeConfigureInPath="../../../.."> diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Checkout.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Checkout.cs index b15206834c..6e988b164a 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Checkout.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Checkout.cs @@ -65,7 +65,7 @@ namespace MonoDevelop.VersionControl } if ( projectFn == null ) { foreach (string str in list ) { - if (MonoDevelop.Projects.Services.ProjectService.IsCombineEntryFile (str)) { + if (MonoDevelop.Projects.Services.ProjectService.IsWorkspaceItemFile (str)) { projectFn = str; break; } @@ -73,7 +73,7 @@ namespace MonoDevelop.VersionControl } if (projectFn != null) - IdeApp.ProjectOperations.OpenCombine (projectFn); + IdeApp.Workspace.OpenWorkspaceItem (projectFn); } } } diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Publish.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Publish.cs index db82834e0a..f2c02709e6 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Publish.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Publish.cs @@ -12,7 +12,7 @@ namespace MonoDevelop.VersionControl { internal class PublishCommand { - public static bool Publish (CombineEntry entry, string localPath, bool test) + public static bool Publish (IWorkspaceObject entry, string localPath, bool test) { if (test) return true; @@ -27,7 +27,7 @@ namespace MonoDevelop.VersionControl if (localPath == entry.BaseDirectory) { GetFiles (files, entry); } else if (entry is Project) { - foreach (ProjectFile file in ((Project)entry).ProjectFiles.GetFilesInPath (localPath)) + foreach (ProjectFile file in ((Project)entry).Files.GetFilesInPath (localPath)) if (file.Subtype != Subtype.Directory) files.Add (file.FilePath); } else @@ -54,16 +54,19 @@ namespace MonoDevelop.VersionControl return true; } - static void GetFiles (ArrayList files, CombineEntry entry) + static void GetFiles (ArrayList files, IWorkspaceObject entry) { - files.Add (entry.FileName); + if (entry is SolutionEntityItem) + files.Add (((SolutionEntityItem)entry).FileName); if (entry is Project) { - foreach (ProjectFile file in ((Project)entry).ProjectFiles) + foreach (ProjectFile file in ((Project)entry).Files) if (file.Subtype != Subtype.Directory) files.Add (file.FilePath); - } else if (entry is Combine) { - foreach (CombineEntry e in ((Combine)entry).Entries) + } else if (entry is SolutionFolder) { + foreach (SolutionItem e in ((SolutionFolder)entry).Items) GetFiles (files, e); + } else if (entry is Solution) { + GetFiles (files, ((Solution)entry).RootFolder); } } diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlFileSystemExtension.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlFileSystemExtension.cs index c13b4a1800..219a2f8aa2 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlFileSystemExtension.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlFileSystemExtension.cs @@ -13,7 +13,7 @@ namespace MonoDevelop.VersionControl public override bool CanHandlePath (string path, bool isDirectory) { // FIXME: don't load this extension if the ide is not loaded. - if (IdeApp.ProjectOperations == null || IdeApp.ProjectOperations.CurrentOpenCombine == null) + if (IdeApp.ProjectOperations == null || !IdeApp.Workspace.IsOpen) return false; else return GetRepository (path) != null; @@ -22,7 +22,7 @@ namespace MonoDevelop.VersionControl Repository GetRepository (string path) { // FIXME: Optimize - foreach (Project prj in IdeApp.ProjectOperations.CurrentOpenCombine.GetAllProjects ()) { + foreach (Project prj in IdeApp.Workspace.GetAllProjects ()) { if (path.StartsWith (prj.BaseDirectory)) { return VersionControlService.GetRepository (prj); } diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlNodeExtension.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlNodeExtension.cs index 9ad89a3043..727b9971b2 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlNodeExtension.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlNodeExtension.cs @@ -27,7 +27,7 @@ namespace MonoDevelop.VersionControl return typeof(ProjectFile).IsAssignableFrom (dataType)
|| typeof(SystemFile).IsAssignableFrom (dataType)
|| typeof(ProjectFolder).IsAssignableFrom (dataType)
- || typeof(CombineEntry).IsAssignableFrom (dataType);
+ || typeof(IWorkspaceObject).IsAssignableFrom (dataType);
} public VersionControlNodeExtension () @@ -42,8 +42,8 @@ namespace MonoDevelop.VersionControl // Add status overlays
- if (dataObject is CombineEntry) { - CombineEntry ce = (CombineEntry) dataObject; + if (dataObject is IWorkspaceObject) { + IWorkspaceObject ce = (IWorkspaceObject) dataObject; Repository rep = VersionControlService.GetRepository (ce); if (rep != null) AddFolderOverlay (rep, ce.BaseDirectory, ref icon, ref closedIcon); @@ -163,8 +163,8 @@ namespace MonoDevelop.VersionControl return ((ProjectFile) dataObject).FilePath; } else if (dataObject is SystemFile) { return ((SystemFile) dataObject).Path; - } else if (dataObject is CombineEntry) {
- return ((CombineEntry)dataObject).BaseDirectory;
+ } else if (dataObject is IWorkspaceObject) {
+ return ((IWorkspaceObject)dataObject).BaseDirectory;
} else if (dataObject is ProjectFolder) {
return ((ProjectFolder)dataObject).Path;
} @@ -284,7 +284,7 @@ namespace MonoDevelop.VersionControl {
string path;
bool isDir; - CombineEntry pentry;
+ IWorkspaceObject pentry;
if (CurrentNode.DataItem is ProjectFile) {
ProjectFile file = (ProjectFile)CurrentNode.DataItem;
@@ -301,8 +301,8 @@ namespace MonoDevelop.VersionControl path = f.Path;
isDir = true;
pentry = f.Project;
- } else if (CurrentNode.DataItem is CombineEntry) {
- pentry = ((CombineEntry)CurrentNode.DataItem);
+ } else if (CurrentNode.DataItem is IWorkspaceObject) {
+ pentry = ((IWorkspaceObject)CurrentNode.DataItem);
path = pentry.BaseDirectory;
isDir = true;
} else {
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs index e9b9242b43..c1f5a04258 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs @@ -63,12 +63,12 @@ namespace MonoDevelop.VersionControl icon_added = MonoDevelop.Core.Gui.Services.Resources.GetIcon (Gtk.Stock.Add, Gtk.IconSize.Menu);
icon_controled = Gdk.Pixbuf.LoadFromResource("overlay_controled.png"); - IdeApp.ProjectOperations.FileAddedToProject += OnFileAdded; - //IdeApp.ProjectOperations.FileChangedInProject += OnFileChanged; - //IdeApp.ProjectOperations.FileRemovedFromProject += OnFileRemoved; - //IdeApp.ProjectOperations.FileRenamedInProject += OnFileRenamed; + IdeApp.Workspace.FileAddedToProject += OnFileAdded; + //IdeApp.Workspace.FileChangedInProject += OnFileChanged; + //IdeApp.Workspace.FileRemovedFromProject += OnFileRemoved; + //IdeApp.Workspace.FileRenamedInProject += OnFileRenamed; - IdeApp.ProjectOperations.EntryAddedToCombine += OnEntryAdded; + IdeApp.Workspace.ItemAddedToSolution += OnEntryAdded; IdeApp.Exiting += delegate { DelayedSaveComments (null); }; @@ -154,7 +154,7 @@ namespace MonoDevelop.VersionControl return GettextCatalog.GetString ("Unversioned");
} - public static Repository GetRepository (CombineEntry entry) + public static Repository GetRepository (IWorkspaceObject entry) { Repository repo = (Repository) entry.ExtendedProperties [typeof(Repository)]; if (repo != null) @@ -385,25 +385,30 @@ namespace MonoDevelop.VersionControl } } */ - static void CombineEntryAddFiles (CombineEntry entry, ArrayList files) + static void SolutionItemAddFiles (SolutionItem entry, ArrayList files) { - files.Add (entry.FileName); + if (entry is SolutionEntityItem) { + string file = ((SolutionEntityItem)entry).FileName; + if (!File.Exists (file)) + return; + files.Add (file); + } if (entry is Project) { - foreach (ProjectFile file in ((Project) entry).ProjectFiles) { + foreach (ProjectFile file in ((Project) entry).Files) { if (file.Subtype != Subtype.Directory) files.Add (file.FilePath); } - } else if (entry is Combine) { - foreach (CombineEntry ent in ((Combine) entry).Entries) - CombineEntryAddFiles (ent, files); + } else if (entry is SolutionFolder) { + foreach (SolutionItem ent in ((SolutionFolder) entry).Items) + SolutionItemAddFiles (ent, files); } } - static void OnEntryAdded (object o, CombineEntryEventArgs args) + static void OnEntryAdded (object o, SolutionItemEventArgs args) { // handles addition of solutions and projects - CombineEntry parent = (CombineEntry) args.CombineEntry.ParentCombine; + SolutionItem parent = (SolutionItem) args.SolutionItem.ParentFolder; if (parent == null) return; @@ -413,7 +418,7 @@ namespace MonoDevelop.VersionControl if (repo == null) return; - CombineEntry entry = args.CombineEntry; + SolutionItem entry = args.SolutionItem; string path = entry.BaseDirectory; if (!repo.CanAdd (path)) @@ -426,7 +431,7 @@ namespace MonoDevelop.VersionControl ArrayList files = new ArrayList (); files.Add (path); - CombineEntryAddFiles (entry, files); + SolutionItemAddFiles (entry, files); using (IProgressMonitor monitor = GetStatusMonitor ()) { string[] paths = (string[]) files.ToArray (typeof (string)); diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/VersionControl.addin.xml b/main/src/addins/VersionControl/MonoDevelop.VersionControl/VersionControl.addin.xml index 15a14ddc39..60e8b5cc87 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/VersionControl.addin.xml +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/VersionControl.addin.xml @@ -158,7 +158,7 @@ </ItemSet>
<SeparatorItem />
</Extension>
- <Extension path = "/MonoDevelop/Ide/ContextMenu/ProjectPad/Combine">
+ <Extension path = "/MonoDevelop/Ide/ContextMenu/ProjectPad/Solution">
<ItemSet id = "VersionControl" _label = "_Version Control" insertafter = "AddSeparator"> <CommandItem id = "MonoDevelop.VersionControl.Commands.Publish"/>
<SeparatorItem id = "CommandSeparator1" /> @@ -171,5 +171,16 @@ </ItemSet>
<SeparatorItem />
</Extension>
+ <Extension path = "/MonoDevelop/Ide/ContextMenu/ProjectPad/SolutionFolder">
+ <ItemSet id = "VersionControl" _label = "_Version Control" insertafter = "AddSeparator"> + <CommandItem id = "MonoDevelop.VersionControl.Commands.Revert"/>
+ <SeparatorItem id = "CommandSeparator2" /> + <CommandItem id = "MonoDevelop.VersionControl.Commands.Update"/>
+ <CommandItem id = "MonoDevelop.VersionControl.Commands.Status"/>
+ <CommandItem id = "MonoDevelop.VersionControl.Commands.Commit"/>
+ <CommandItem id = "MonoDevelop.VersionControl.Commands.Log"/>
+ </ItemSet>
+ <SeparatorItem />
+ </Extension>
</Addin>
diff --git a/main/src/addins/WelcomePage/ChangeLog b/main/src/addins/WelcomePage/ChangeLog index 60fb4fd5ce..495b42ce2a 100644 --- a/main/src/addins/WelcomePage/ChangeLog +++ b/main/src/addins/WelcomePage/ChangeLog @@ -1,3 +1,9 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * WelcomePageFallbackWidget.cs, WelcomePageView.cs, + WelcomePageBrowser.cs, gtk-gui/objects.xml: New project model + changes. + 2008-03-07 Lluis Sanchez Gual <lluis@novell.com> * WelcomePage.addin.xml, WelcomePageOptionPanel.cs: Use new options diff --git a/main/src/addins/WelcomePage/WelcomePageBrowser.cs b/main/src/addins/WelcomePage/WelcomePageBrowser.cs index 4a1eb2cd86..eda00d0365 100644 --- a/main/src/addins/WelcomePage/WelcomePageBrowser.cs +++ b/main/src/addins/WelcomePage/WelcomePageBrowser.cs @@ -43,6 +43,7 @@ using MonoDevelop.Core.Gui; using MonoDevelop.Core.Gui.WebBrowser; using MonoDevelop.Ide.Gui; using MonoDevelop.Ide.Commands; +using MonoDevelop.Projects; namespace MonoDevelop.Core { diff --git a/main/src/addins/WelcomePage/WelcomePageFallbackWidget.cs b/main/src/addins/WelcomePage/WelcomePageFallbackWidget.cs index c9bd1395f3..4d0f55b722 100644 --- a/main/src/addins/WelcomePage/WelcomePageFallbackWidget.cs +++ b/main/src/addins/WelcomePage/WelcomePageFallbackWidget.cs @@ -35,6 +35,8 @@ using System.Xml; using System.Reflection; using MonoDevelop.Core; using MonoDevelop.Core.Gui; +using MonoDevelop.Ide.Gui; +using MonoDevelop.Projects; using Gtk; using Gdk; @@ -312,6 +314,11 @@ namespace MonoDevelop.WelcomePage button.HoverMessage = ri.LocalPath; button.LinkUrl = "project://" + ri.LocalPath; label.Markup = string.Format (textFormat, WelcomePageView.TimeSinceEdited (ri.Timestamp)); + if (IdeApp.Services.ProjectService.FileFormats.GetFileFormats (ri.LocalPath, typeof(Solution)).Length > 0) + button.Icon = "md-solution"; + else + button.Icon = "md-workspace"; + i++; button.InnerLabel.MaxWidthChars = 22; @@ -328,8 +335,10 @@ namespace MonoDevelop.WelcomePage { string hoverMessage = null; Label label; + Gtk.Image image; string text; string desc; + string icon; static Tooltips tooltips; static int tipcount; @@ -347,7 +356,12 @@ namespace MonoDevelop.WelcomePage label.Xalign = 0; label.Xpad = 0; label.Ypad = 0; - Add (label); + image = new Gtk.Image (); + + HBox box = new HBox (false, 6); + box.PackStart (image, false, false, 0); + box.PackStart (label, true, true, 0); + Add (box); Relief = ReliefStyle.None; tipcount ++; } @@ -370,8 +384,19 @@ namespace MonoDevelop.WelcomePage set { desc = value; UpdateLabel (); } } + public string Icon { + get { return icon; } + set { icon = value; UpdateLabel (); } + } + void UpdateLabel () { + if (icon != null) { + image.Pixbuf = IdeApp.Services.Resources.GetBitmap (icon, Gtk.IconSize.Menu); + image.Visible = true; + } else { + image.Visible = false; + } string markup = string.Format ("<span underline=\"single\" foreground=\"#5a7ac7\">{0}</span>", text); if (!string.IsNullOrEmpty (desc)) markup += "\n<span size=\"small\">" + desc + "</span>"; diff --git a/main/src/addins/WelcomePage/WelcomePageView.cs b/main/src/addins/WelcomePage/WelcomePageView.cs index 7b2a81f6ae..451dfe151e 100644 --- a/main/src/addins/WelcomePage/WelcomePageView.cs +++ b/main/src/addins/WelcomePage/WelcomePageView.cs @@ -171,7 +171,9 @@ namespace MonoDevelop.WelcomePage Uri fileuri = new Uri (projectUri); try { loadingProject = true; - IAsyncOperation oper = IdeApp.ProjectOperations.OpenCombine (fileuri.LocalPath); + Gdk.ModifierType mtype; + bool inWorkspace = Gtk.Global.GetCurrentEventState (out mtype) && (mtype & Gdk.ModifierType.ControlMask) != 0; + IAsyncOperation oper = IdeApp.Workspace.OpenWorkspaceItem (fileuri.LocalPath, !inWorkspace); oper.WaitForCompleted (); } finally { loadingProject = false; @@ -214,7 +216,10 @@ namespace MonoDevelop.WelcomePage string message = link; if (link.IndexOf ("project://") != -1) message = message.Substring (10); - IdeApp.Workbench.StatusBar.ShowMessage (message); + string msg = GettextCatalog.GetString ("Open solution {0}", message); + if (IdeApp.Workspace.IsOpen) + msg += " - " + GettextCatalog.GetString ("Hold Control key to open in current workspace."); + IdeApp.Workbench.StatusBar.ShowMessage (msg); } } diff --git a/main/src/addins/WelcomePage/gtk-gui/objects.xml b/main/src/addins/WelcomePage/gtk-gui/objects.xml index 88eb448ddf..22f268d03a 100644 --- a/main/src/addins/WelcomePage/gtk-gui/objects.xml +++ b/main/src/addins/WelcomePage/gtk-gui/objects.xml @@ -10,6 +10,7 @@ <property name="Label" /> <property name="LinkUrl" /> <property name="Description" /> + <property name="Icon" /> </itemgroup> </itemgroups> <signals /> diff --git a/main/src/addins/prj2make-sharp-lib/CSharpMSBuildProjectExtension.cs b/main/src/addins/prj2make-sharp-lib/CSharpMSBuildProjectExtension.cs deleted file mode 100644 index eb0680d8c6..0000000000 --- a/main/src/addins/prj2make-sharp-lib/CSharpMSBuildProjectExtension.cs +++ /dev/null @@ -1,169 +0,0 @@ -// -// CSharpMSBuildProjectExtension.cs -// -// Author: -// Ankit Jain <jankit@novell.com> -// -// Copyright (C) 2007 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using MonoDevelop.Projects; -using MonoDevelop.Core; - -using CSharpBinding; - -using System; -using System.IO; -using System.Xml; -using System.Xml.XPath; - -namespace MonoDevelop.Prj2Make -{ - public class CSharpMSBuildProjectExtension : MSBuildProjectExtension - { - const string myguid = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"; - - public override string TypeGuid { - get { return myguid; } - } - - public override string Name { - get { return "C#";} - } - - public override bool IsLanguage { - get { return true; } - } - - public override string LanguageId { - get { return "C#"; } - } - - public override bool Supports (string type_guid, string filename, string type_guids) - { - if (String.IsNullOrEmpty (type_guid)) { - if (Path.GetExtension (filename) == ".csproj") - return true; - } else { - if (String.Compare (type_guid, myguid, true) == 0) - return true; - } - - return false; - //FIXME: else look at the type_guids string, like "asp_guid;c#_guid" - } - - public override DotNetProject CreateProject (string type_guid, string filename, string type_guids) - { - if (!Supports (type_guid, filename, type_guids)) - throw new InvalidOperationException (String.Format ("Project of type guid = {0} not supported by this extension.", type_guid)); - return new DotNetProject ("C#"); - } - - public override void ReadConfig (DotNetProject project, DotNetProjectConfiguration config, XPathNavigator nav, string basePath, IProgressMonitor monitor) - { - base.ReadConfig (project, config, nav, basePath, monitor); - - CSharpCompilerParameters csparams = (CSharpCompilerParameters) config.CompilationParameters; - - bool bool_tmp = false; - string str_tmp = String.Empty; - int int_tmp = 0; - - if (Utils.ReadAsBool (nav, "AllowUnsafeBlocks", ref bool_tmp)) - csparams.UnsafeCode = bool_tmp; - - if (Utils.ReadAsBool (nav, "Optimize", ref bool_tmp)) - csparams.Optimize = bool_tmp; - - if (Utils.ReadAsBool (nav, "CheckForOverflowUnderflow", ref bool_tmp)) - csparams.GenerateOverflowChecks = bool_tmp; - - if (Utils.ReadAsString (nav, "DefineConstants", ref str_tmp, true)) - csparams.DefineSymbols = str_tmp; - - if (Utils.ReadAsInt (nav, "WarningLevel", ref int_tmp)) - csparams.WarningLevel = int_tmp; - - if (Utils.ReadAsString (nav, "ApplicationIcon", ref str_tmp, false)) { - string resolvedPath = Utils.MapAndResolvePath (basePath, str_tmp); - if (resolvedPath != null) - csparams.Win32Icon = Utils.Unescape (resolvedPath); - } - - if (Utils.ReadAsString (nav, "Win32Resource", ref str_tmp, false)) { - string resolvedPath = Utils.MapAndResolvePath (basePath, str_tmp); - if (resolvedPath != null) - csparams.Win32Resource = Utils.Unescape (resolvedPath); - } - } - - public override void WriteConfig (DotNetProject project, DotNetProjectConfiguration config, XmlElement configElement, IProgressMonitor monitor) - { - base.WriteConfig (project, config, configElement, monitor); - - if (project.LanguageName != "C#") - // FIXME: extension list must be wrong, error! - return; - - CSharpCompilerParameters csparams = - (CSharpCompilerParameters) config.CompilationParameters; - - Utils.EnsureChildValue (configElement, "RootNamespace", project.DefaultNamespace); - Utils.EnsureChildValue (configElement, "AllowUnsafeBlocks", csparams.UnsafeCode); - Utils.EnsureChildValue (configElement, "Optimize", csparams.Optimize); - Utils.EnsureChildValue (configElement, "CheckForOverflowUnderflow", csparams.GenerateOverflowChecks); - Utils.EnsureChildValue (configElement, "DefineConstants", csparams.DefineSymbols); - Utils.EnsureChildValue (configElement, "WarningLevel", csparams.WarningLevel); - if (csparams.Win32Icon != null && csparams.Win32Icon.Length > 0) - Utils.EnsureChildValue (configElement, "ApplicationIcon", - Utils.CanonicalizePath (FileService.AbsoluteToRelativePath ( - project.BaseDirectory, csparams.Win32Icon))); - - if (csparams.Win32Resource != null && csparams.Win32Resource.Length > 0) - Utils.EnsureChildValue (configElement, "Win32Resource", - Utils.CanonicalizePath (FileService.AbsoluteToRelativePath ( - project.BaseDirectory, csparams.Win32Resource))); - } - - public override void OnFinishWrite (MSBuildData data, DotNetProject project) - { - base.OnFinishWrite (data, project); - if (Utils.GetMSBuildData (project) != null) - // existing project file - return; - - XmlElement elem = data.Document.CreateElement ("Import", Utils.ns); - data.Document.DocumentElement.InsertAfter (elem, data.Document.DocumentElement.LastChild); - elem.SetAttribute ("Project", @"$(MSBuildBinPath)\Microsoft.CSharp.Targets"); - } - - public override string GetGuidChain (DotNetProject project) - { - if (project.GetType () != typeof (DotNetProject) || project.LanguageName != "C#") - return null; - - return myguid; - } - - } -} diff --git a/main/src/addins/prj2make-sharp-lib/ChangeLog b/main/src/addins/prj2make-sharp-lib/ChangeLog index 8efcbe72f0..d26fc9abd6 100644 --- a/main/src/addins/prj2make-sharp-lib/ChangeLog +++ b/main/src/addins/prj2make-sharp-lib/ChangeLog @@ -1,3 +1,9 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * PrjHelper.cs, MsPrjHelper.cs, VS2003ProjectFileFormat.cs, + MSBuildProjectServiceExtension.cs, Makefile.am, + prj2make-sharp-lib.mdp: New project model changes. + 2008-03-04 Mike Krüger <mkrueger@novell.com> * VS2003SlnFileFormat.cs, VS2003ProjectFileFormat.cs, SlnFileFormat.cs: diff --git a/main/src/addins/prj2make-sharp-lib/DefaultMSBuildProjectExtension.cs b/main/src/addins/prj2make-sharp-lib/DefaultMSBuildProjectExtension.cs deleted file mode 100644 index 860603fbe2..0000000000 --- a/main/src/addins/prj2make-sharp-lib/DefaultMSBuildProjectExtension.cs +++ /dev/null @@ -1,491 +0,0 @@ -// -// DefaultMSBuildProjectExtension.cs -// -// Author: -// Ankit Jain <jankit@novell.com> -// -// Copyright (C) 2007 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using MonoDevelop.Core; -using MonoDevelop.Deployment; -using MonoDevelop.Projects; - -using System; -using System.IO; -using System.Reflection; -using System.Xml; -using System.Xml.XPath; - -namespace MonoDevelop.Prj2Make -{ - public class DefaultMSBuildProjectExtension : MSBuildProjectExtension - { - public override string TypeGuid { - get { return null; } - } - - public override string Name { - get { return "DefaultMSBuildProjectExtension"; } - } - - public override bool IsLanguage { - get { return false; } - } - - public override string LanguageId { - get { return null; } - } - - public override bool Supports (string type_guid, string filename, string type_guids) - { - //Should've been handled by now! - return false; - } - - public override DotNetProject CreateProject (string type_guid, string filename, string type_guids) - { - //Should've been handled by now! - return null; - } - - public override void ReadConfig (DotNetProject project, DotNetProjectConfiguration config, XPathNavigator nav, string basePath, IProgressMonitor monitor) - { - if (nav.MoveToChild ("OutputType",Utils.ns)) { - try { - config.CompileTarget = (CompileTarget) Enum.Parse (typeof (CompileTarget), nav.Value, true); - } catch (ArgumentException) { - //Ignore - } - nav.MoveToParent (); - } - - if (nav.MoveToChild ("Configuration",Utils.ns)) { - //if (CheckNullCondition (nav.UnderlyingObject as XmlElement, "Configuration")) - // default_config = nav.Value; - - nav.MoveToParent (); - } - - if (nav.MoveToChild ("Platform",Utils.ns)) { - //if (CheckNullCondition (nav.UnderlyingObject as XmlElement, "Platform")) - // default_platform = nav.Value; - - nav.MoveToParent (); - } - - string str_tmp = String.Empty; - bool bool_tmp = false; - - if (Utils.ReadAsString (nav, "AssemblyName", ref str_tmp, false)) - config.OutputAssembly = Utils.Unescape (str_tmp); - - if (Utils.ReadAsString (nav, "OutputPath", ref str_tmp, false)) - config.OutputDirectory = Utils.MapAndResolvePath (basePath, Utils.Unescape (str_tmp)); - - if (Utils.ReadAsBool (nav, "DebugSymbols", ref bool_tmp)) - //FIXME: <DebugType>? - config.DebugMode = bool_tmp; - } - - public override void ReadItemGroups (MSBuildData data, DotNetProject project, DotNetProjectConfiguration globalConfig, string basePath, IProgressMonitor monitor) - { - //FIXME: This can also be Config/Platform specific - XmlNodeList itemList = data.Document.SelectNodes ("/tns:Project/tns:ItemGroup", MSBuildFileFormat.NamespaceManager); - - foreach (XmlNode itemGroup in itemList) { - foreach (XmlNode node in itemGroup.ChildNodes) { - if (node.NodeType != XmlNodeType.Element) - continue; - - if (node.Attributes ["Include"] == null) { - LoggingService.LogWarning (GettextCatalog.GetString ("Expected 'Include' attribute not found for ItemGroup '{0}'", - node.LocalName)); - continue; - } - - string include = node.Attributes ["Include"].Value; - if (include.Length == 0) - //FIXME: Ignore, error?? - return; - - include = Utils.Unescape (include); - data.ExtensionChain.ReadItemGroup (data, project, globalConfig, include, basePath, node, monitor); - } - } - } - - public override void ReadItemGroup (MSBuildData data, DotNetProject project, DotNetProjectConfiguration globalConfig, string include, string basePath, XmlNode node, IProgressMonitor monitor) - { - string path = null; - ProjectFile pf = null; - ProjectReference pr = null; - - string str_tmp = String.Empty; - switch (node.LocalName) { - case "Reference": - string hintPath = String.Empty; - string fullname = Runtime.SystemAssemblyService.GetAssemblyFullName (include); - if (fullname == null) { - // Check if the case of the assembly name might be incorrect - // Eg. System.XML - int commaPos = include.IndexOf (','); - string asmname = include; - string rest = String.Empty; - - if (commaPos >= 0) { - asmname = include.Substring (0, commaPos).Trim (); - rest = include.Substring (commaPos); - } - - if (MSBuildFileFormat.AssemblyNamesTable.ContainsKey (asmname) && asmname != MSBuildFileFormat.AssemblyNamesTable [asmname]) { - // assembly name is in the table and case is different - fullname = Runtime.SystemAssemblyService.GetAssemblyFullName ( - MSBuildFileFormat.AssemblyNamesTable [asmname] + rest); - } - } - if ((fullname != null && - Runtime.SystemAssemblyService.FindInstalledAssembly (fullname) != null) || - !Utils.ReadAsString (node, "HintPath", ref hintPath, false)) { - - //If the assembly is from a package file - //Or has _no_ HintPath, then add it as a Gac entry - pr = new ProjectReference (ReferenceType.Gac, fullname ?? include); - project.ProjectReferences.Add (pr); - } else { - //Not in the Gac, has HintPath - hintPath = Utils.Unescape (hintPath); - path = Utils.MapAndResolvePath (basePath, hintPath); - if (path == null) { - LoggingService.LogWarning (GettextCatalog.GetString ( - "HintPath ({0}) for Reference '{1}' is invalid. Ignoring.", - hintPath, include)); - monitor.ReportWarning (GettextCatalog.GetString ( - "HintPath ({0}) for Reference '{1}' is invalid. Ignoring.", - hintPath, include)); - - return; - } - - pr = project.AddReference (path); - } - data.ProjectReferenceElements [pr] = (XmlElement) node; - - break; - case "ProjectReference": - //Not using @Include currently, instead using the Name - string projGuid = null; - string projName = null; - - if (node ["Project"] != null) - projGuid = node ["Project"].InnerText; - if (node ["Name"] != null) - projName = Utils.Unescape (node ["Name"].InnerText); - - if (String.IsNullOrEmpty (projName)) { - //FIXME: Add support to load the project file from here - LoggingService.LogError (GettextCatalog.GetString ("Expected element <Name> for ProjectReference '{0}'", include)); - return; - } - - pr = new ProjectReference (ReferenceType.Project, projName); - project.ProjectReferences.Add (pr); - data.ProjectReferenceElements [pr] = (XmlElement) node; - - break; - case "Compile": - path = Utils.GetValidPath (monitor, basePath, include); - if (path == null) - return; - pf = project.AddFile (path, BuildAction.Compile); - data.ProjectFileElements [pf] = (XmlElement) node; - break; - case "None": - case "Content": - //FIXME: We don't support "CopyToOutputDirectory" for - //other BuildActions - path = Utils.GetValidPath (monitor, basePath, include); - if (path == null) - return; - if (Utils.ReadAsString (node, "CopyToOutputDirectory", ref str_tmp, false)) { - pf = project.AddFile (path, BuildAction.FileCopy); - DeployProperties dp = DeployService.GetDeployProperties (pf); - dp.UseProjectRelativePath = true; - } else { - pf = project.AddFile (path, BuildAction.Nothing); - } - data.ProjectFileElements [pf] = (XmlElement) node; - break; - case "EmbeddedResource": - path = Utils.GetValidPath (monitor, basePath, include); - if (path == null) - return; - - /* IResourceBuilder, in this case will use just the - * filename to build the resource id. Ignoring <Link> here - * - * if (!path.StartsWith (project.BaseDirectory)) { - monitor.ReportWarning (GettextCatalog.GetString ( - "The specified path '{0}' for the EmbeddedResource is outside the project directory. Ignoring.", include)); - Console.WriteLine ("The specified path '{0}' for the EmbeddedResource is outside the project directory. Ignoring.", include); - continue; - }*/ - - pf = project.AddFile (path, BuildAction.EmbedAsResource); - if (Utils.ReadAsString (node, "LogicalName", ref str_tmp, false)) - pf.ResourceId = Utils.Unescape (str_tmp); - data.ProjectFileElements [pf] = (XmlElement) node; - break; - default: - LoggingService.LogWarning (GettextCatalog.GetString ( - "Unrecognised ItemGroup element '{0}', Include = '{1}' in project '{2}'. Ignoring.", node.LocalName, include, project.Name)); - break; - } - - if (pf != null) { - if (Utils.ReadAsString (node, "DependentUpon", ref str_tmp, false)) { - //DependentUpon is relative to the basedir of the 'pf' (resource file) - string resolvedPath = Utils.MapAndResolvePath (Path.GetDirectoryName (pf.Name), str_tmp); - if (resolvedPath != null) - pf.DependsOn = Utils.Unescape (resolvedPath); - } - - if (String.Compare (node.LocalName, "Content", true) != 0 && - String.Compare (node.LocalName, "None", true) != 0 && - Utils.ReadAsString (node, "CopyToOutputDirectory", ref str_tmp, false)) - LoggingService.LogDebug (GettextCatalog.GetString ( - "CopyToOutputDirectory not supported for BuildAction '{0}', Include = '{1}'", node.LocalName, include)); - } - } - - public override void ReadFlavorProperties (MSBuildData data, DotNetProject project, XmlNode node, string guid) - { - } - - public override void OnFinishRead (MSBuildData data, DotNetProject project) - { - } - - //Writing methods - - public override void WriteConfig (DotNetProject project, DotNetProjectConfiguration config, XmlElement configElement, IProgressMonitor monitor) - { - Utils.EnsureChildValue (configElement, "OutputType", config.CompileTarget); - Utils.EnsureChildValue (configElement, "AssemblyName", Utils.CanonicalizePath (config.OutputAssembly)); - // VS2005 emits trailing \\ for folders - Utils.EnsureChildValue (configElement, "OutputPath", - Utils.CanonicalizePath (FileService.AbsoluteToRelativePath ( - project.BaseDirectory, config.OutputDirectory)) + "\\"); - Utils.EnsureChildValue (configElement, "DebugSymbols", config.DebugMode); - } - - public override XmlElement FileToXmlElement (MSBuildData data, Project project, ProjectFile projectFile) - { - if (projectFile.BuildAction == BuildAction.Compile && projectFile.Subtype != Subtype.Code) - return null; - - string name = MSBuildFileFormat.BuildActionToString (projectFile.BuildAction); - if (name == null) { - LoggingService.LogWarning (GettextCatalog.GetString ("BuildAction.{0} not supported!", projectFile.BuildAction)); - return null; - } - - //FIXME: Subtype - - bool newElement = false; - XmlDocument doc = data.Document; - XmlElement elem; - if (!data.ProjectFileElements.TryGetValue (projectFile, out elem)) { - newElement = true; - elem = doc.CreateElement (name, Utils.ns); - XmlNode n = doc.SelectSingleNode (String.Format ( - "/tns:Project/tns:ItemGroup/tns:{0}", name), MSBuildFileFormat.NamespaceManager); - - if (n == null) { - n = doc.CreateElement ("ItemGroup", Utils.ns); - doc.DocumentElement.AppendChild (n); - n.AppendChild (elem); - } else { - n.ParentNode.AppendChild (elem); - } - - bool notMSBuild = (Utils.GetMSBuildData (project) == null); - if (projectFile.BuildAction == BuildAction.EmbedAsResource && - (notMSBuild || Services.ProjectService.GetDefaultResourceId (projectFile) != projectFile.ResourceId)) { - //Emit LogicalName if we are writing elements for a Non-MSBuidProject, - // (eg. when converting a gtk-sharp project, it might depend on non-vs - // style resource naming ) - //Or when the resourceId is different from the default one - Utils.EnsureChildValue (elem, "LogicalName", Utils.Escape (projectFile.ResourceId)); - - if (notMSBuild) - // explicitly set the resourceId, as once when it becomes a - // msbuild project, .ResourceId will give resourceId by msbuild - // rules, but we want to retain this value - projectFile.ResourceId = projectFile.ResourceId; - } - - if (projectFile.BuildAction == BuildAction.FileCopy) - Utils.EnsureChildValue (elem, "CopyToOutputDirectory", "Always"); - - if (projectFile.IsExternalToProject) - Utils.EnsureChildValue (elem, "Link", Path.GetFileName (projectFile.Name)); - } - - elem.SetAttribute ("Include", Utils.CanonicalizePath (projectFile.RelativePath)); - - if (projectFile.BuildAction == BuildAction.EmbedAsResource) { - string projectResourceId = projectFile.ResourceId; - - if (!newElement) { - if (Services.ProjectService.GetDefaultResourceId (projectFile) == projectResourceId) - Utils.RemoveChild (elem, "LogicalName"); - else - Utils.EnsureChildValue (elem, "LogicalName", Utils.Escape (projectResourceId)); - } - - //DependentUpon is relative to the basedir of the 'pf' (resource file) - if (String.IsNullOrEmpty (projectFile.DependsOn)) { - if (!newElement) - Utils.RemoveChild (elem, "DependentUpon"); - } else { - Utils.EnsureChildValue (elem, "DependentUpon", - Utils.CanonicalizePath (FileService.AbsoluteToRelativePath ( - Path.GetDirectoryName (projectFile.Name), projectFile.DependsOn))); - } - } - - if (projectFile.BuildAction == BuildAction.FileCopy) { - DeployProperties dp = DeployService.GetDeployProperties (projectFile); - dp.UseProjectRelativePath = true; - } - - return elem; - } - - public override XmlElement ReferenceToXmlElement (MSBuildData data, Project project, ProjectReference projectRef) - { - ReferenceType refType = projectRef.ReferenceType; - - bool newElement = false; - XmlDocument doc = data.Document; - XmlElement elem; - if (!data.ProjectReferenceElements.TryGetValue (projectRef, out elem)) { - string elemName; - if (refType == ReferenceType.Project) - elemName = "ProjectReference"; - else - elemName = "Reference"; - - elem = doc.CreateElement (elemName, Utils.ns); - newElement = true; - - //Add the element to the document - XmlNode node = doc.SelectSingleNode (String.Format ("/tns:Project/tns:ItemGroup/tns:{0}", elemName), MSBuildFileFormat.NamespaceManager); - if (node == null) { - node = doc.CreateElement ("ItemGroup", Utils.ns); - doc.DocumentElement.AppendChild (node); - node.AppendChild (elem); - } else { - node.ParentNode.AppendChild (elem); - } - } - - string reference = projectRef.Reference; - switch (refType) { - case ReferenceType.Gac: - SystemPackage pkg = Runtime.SystemAssemblyService.GetPackageFromFullName (projectRef.Reference); - if (pkg != null && pkg.IsCorePackage && pkg.TargetVersion == ClrVersion.Net_2_0) - // For core references like System.Data, emit only "System.Data" instead - // of full names - reference = reference.Substring (0, reference.IndexOf (',')); - break; - case ReferenceType.Assembly: - string asmname = null; - try { - asmname = AssemblyName.GetAssemblyName (reference).ToString (); - reference = asmname; - } catch (FileNotFoundException) { - } catch (BadImageFormatException) { - } catch (ArgumentException) { - } - - if (asmname == null) { - //Couldn't get assembly name - if (!newElement && elem.Attributes ["Include"] != null) - reference = elem.Attributes ["Include"].Value; - else - reference = Path.GetFileNameWithoutExtension (reference); - } - - Utils.EnsureChildValue (elem, "HintPath", - Utils.CanonicalizePath (FileService.AbsoluteToRelativePath (project.BaseDirectory, projectRef.Reference))); - Utils.EnsureChildValue (elem, "SpecificVersion", "False"); - break; - case ReferenceType.Project: - Combine c = project.RootCombine; - if (c != null) { - Project p = c.FindProject (projectRef.Reference); - if (p == null) { - LoggingService.LogWarning (GettextCatalog.GetString ( - "The project '{0}' referenced from '{1}' could not be found.", - projectRef.Reference, project.Name)); - - return elem; - } - - reference = Utils.CanonicalizePath (FileService.AbsoluteToRelativePath ( - project.BaseDirectory, p.FileName)); - - if (p.ExtendedProperties.Contains (typeof (MSBuildFileFormat))) { - MSBuildData d = (MSBuildData) p.ExtendedProperties [typeof (MSBuildFileFormat)]; - if (d.Guid != null & d.Guid.Length != 0) - Utils.EnsureChildValue (elem, "Project", d.Guid); - } - - if (newElement) - //Set Name only for newly created elements, this could be - //different from referenced project's Name - Utils.EnsureChildValue (elem, "Name", Utils.Escape (p.Name)); - } - break; - case ReferenceType.Custom: - break; - } - - elem.SetAttribute ("Include", Utils.Escape (reference)); - - return elem; - } - - public override void OnFinishWrite (MSBuildData data, DotNetProject project) - { - } - - public override string GetGuidChain (DotNetProject project) - { - //Shouldn't get here! - return null; - } - - } -} diff --git a/main/src/addins/prj2make-sharp-lib/IResourceIdBuilder.cs b/main/src/addins/prj2make-sharp-lib/IResourceIdBuilder.cs deleted file mode 100644 index f1858f7bc2..0000000000 --- a/main/src/addins/prj2make-sharp-lib/IResourceIdBuilder.cs +++ /dev/null @@ -1,38 +0,0 @@ -// -// IResourceIdBuilder.cs -// -// Author: -// Ankit Jain <jankit@novell.com> -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using MonoDevelop.Projects; -using System.IO; - -namespace MonoDevelop.Prj2Make -{ - interface IResourceIdBuilder - { - string GetResourceId (ProjectFile pf); - } -} diff --git a/main/src/addins/prj2make-sharp-lib/MSBuildData.cs b/main/src/addins/prj2make-sharp-lib/MSBuildData.cs deleted file mode 100644 index ca1867334f..0000000000 --- a/main/src/addins/prj2make-sharp-lib/MSBuildData.cs +++ /dev/null @@ -1,120 +0,0 @@ -// -// MSBuildData.cs -// -// Author: -// Ankit Jain <jankit@novell.com> -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using MonoDevelop.Projects; - -using System.Xml; -using System.Collections.Generic; - -namespace MonoDevelop.Prj2Make -{ - public class MSBuildData - { - XmlDocument doc; - XmlElement globalConfigElement; - string guid; - List<string> extra; - string type_guids; - - Dictionary<DotNetProjectConfiguration, XmlElement> configElements; - - Dictionary<ProjectFile, XmlElement> projectFileElements; - Dictionary<ProjectReference, XmlElement> projectReferenceElements; - MSBuildProjectExtension extensionChain; - XmlElement flavorPropertiesParent; - - public MSBuildData () - { - } - - public XmlDocument Document { - get { return doc; } - set { doc = value; } - } - - public XmlElement GlobalConfigElement { - get { return globalConfigElement; } - set { globalConfigElement = value; } - } - - /* Guid with the enclosing {} */ - public string Guid { - get { return guid; } - set { guid = value; } - } - - public Dictionary<DotNetProjectConfiguration, XmlElement> ConfigElements { - get { - if (configElements == null) - configElements = new Dictionary<DotNetProjectConfiguration, XmlElement> (); - return configElements; - } - } - - public Dictionary<ProjectFile, XmlElement> ProjectFileElements { - get { - if (projectFileElements == null) - projectFileElements = new Dictionary<ProjectFile, XmlElement> (); - return projectFileElements; - } - } - - public Dictionary<ProjectReference, XmlElement> ProjectReferenceElements { - get { - if (projectReferenceElements == null) - projectReferenceElements = new Dictionary<ProjectReference, XmlElement> (); - return projectReferenceElements; - } - } - - public MSBuildProjectExtension ExtensionChain { - get { return extensionChain; } - set { extensionChain = value; } - } - - public XmlElement FlavorPropertiesParent { - get { - if (flavorPropertiesParent == null) - flavorPropertiesParent = Utils.GetXmlElement (Document, Document, "/Project/ProjectExtensions/VisualStudio", false); - return flavorPropertiesParent; - } - set { flavorPropertiesParent = value; } - } - - public string TypeGuids { - get { return type_guids; } - set { type_guids = value; } - } - - public List<string> Extra { - get { return extra; } - set { extra = value;} - } - - } -} diff --git a/main/src/addins/prj2make-sharp-lib/MSBuildFileFormat.cs b/main/src/addins/prj2make-sharp-lib/MSBuildFileFormat.cs deleted file mode 100644 index 2a97ab2ec7..0000000000 --- a/main/src/addins/prj2make-sharp-lib/MSBuildFileFormat.cs +++ /dev/null @@ -1,948 +0,0 @@ -// -// MSBuildFileFormat.cs -// -// Author: -// Ankit Jain <jankit@novell.com> -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using MonoDevelop.Core; -using MonoDevelop.Projects; - -using Mono.Addins; - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.IO; -using System.Reflection; -using System.Text; -using System.Text.RegularExpressions; -using System.Xml; -using System.Xml.XPath; - -namespace MonoDevelop.Prj2Make -{ - public class MSBuildFileFormat : IFileFormat - { - static XmlNamespaceManager manager; - SlnFileFormat solutionFormat = new SlnFileFormat (); - - static List<MSBuildProjectExtension> extensions; - - public MSBuildFileFormat () - { - } - - public string Name { - get { return "Visual Studio .NET 2005"; } - } - - public string GetValidFormatName (object obj, string fileName) - { - if (solutionFormat.CanWriteFile (obj)) - return solutionFormat.GetValidFormatName (obj, fileName); - - if (obj is DotNetProject) { - string lang = ((DotNetProject)obj).LanguageName; - if (lang == null || lang == "C#") - //default - return Path.ChangeExtension (fileName, ".csproj"); - if (lang == "VBNet") - return Path.ChangeExtension (fileName, ".vbproj"); - } - return fileName; - } - - public bool CanReadFile (string file) - { - if (solutionFormat.CanReadFile (file)) - return true; - - if (Utils.GetLanguage (file) == null) - return false; - - //FIXME: Need a better way to check the rootelement - XmlReader xr = null; - try { - xr = XmlReader.Create (file); - xr.MoveToContent (); - - if (xr.NodeType == XmlNodeType.Element && String.Compare (xr.LocalName, "Project") == 0 && - String.Compare (xr.NamespaceURI, Utils.ns) == 0) - return true; - - } catch (FileNotFoundException) { - LoggingService.LogError (GettextCatalog.GetString ("File not found {0} : ", file)); - return false; - } catch (XmlException xe) { - LoggingService.LogError (GettextCatalog.GetString ("Error reading file {0} : ", xe.ToString ())); - return false; - } finally { - if (xr != null) - ((IDisposable)xr).Dispose (); - } - - return false; - } - - public bool CanWriteFile (object obj) - { - return (obj is DotNetProject) || solutionFormat.CanWriteFile (obj); - } - - public System.Collections.Specialized.StringCollection GetExportFiles (object obj) - { - if (obj is Combine) - return solutionFormat.GetExportFiles (obj); - return null; - } - - public static XmlNamespaceManager NamespaceManager { - get { - if (manager == null) { - manager = new XmlNamespaceManager (new NameTable ()); - manager.AddNamespace ("tns", Utils.ns); - } - - return manager; - } - } - - public void WriteFile (string file, object node, IProgressMonitor monitor) - { - if (solutionFormat.CanWriteFile (node)) { - solutionFormat.WriteFile (file, node, monitor); - return; - } - - if (node == null) - return; - - DotNetProject project = node as DotNetProject; - if (project == null) - throw new InvalidOperationException ("The provided object is not a DotNetProject"); - - string tmpfilename = String.Empty; - try { - monitor.BeginTask (GettextCatalog.GetString ("Saving project: {0}", file), 1); - try { - if (File.Exists (file)) - tmpfilename = Path.GetTempFileName (); - } catch (IOException) { - } - - if (tmpfilename == String.Empty) { - WriteFileInternal (file, project, monitor); - } else { - WriteFileInternal (tmpfilename, project, monitor); - File.Delete (file); - File.Move (tmpfilename, file); - } - } catch (Exception ex) { - monitor.ReportError (GettextCatalog.GetString ("Could not save project: {0}", file), ex); - LoggingService.LogError (GettextCatalog.GetString ("Could not save project: {0}, {1}", file), ex); - - if (!String.IsNullOrEmpty (tmpfilename)) - File.Delete (tmpfilename); - throw; - } finally { - monitor.EndTask (); - } - } - - void WriteFileInternal (string file, DotNetProject project, IProgressMonitor monitor) - { - bool newdoc = false; - XmlDocument doc = null; - - MSBuildData data = Utils.GetMSBuildData (project); - if (data == null) { - //Create a new XmlDocument - doc = new XmlDocument (); - data = new MSBuildData (); - data.Document = doc; - newdoc = true; - - string type_guid; - string type_guids = String.Empty; - string longest_guid = String.Empty; - foreach (MSBuildProjectExtension extn in Extensions) { - string g = extn.GetGuidChain (project); - if (g == null) - continue; - //HACK HACK - if (g.Length > longest_guid.Length) - longest_guid = g; - } - type_guids = longest_guid; - MSBuildProjectExtension chain = GetExtensionChainFromTypeGuid (ref type_guids, out type_guid, project.LanguageName, file); - data.ExtensionChain = chain; - data.TypeGuids = type_guids; - - XmlElement e = doc.CreateElement ("Project", Utils.ns); - doc.AppendChild (e); - e.SetAttribute ("DefaultTargets", "Build"); - } else { - doc = data.Document; - } - - //Write out the Configurations - //FIXME: Not touching global config right now, - //instead just writing out everything in the individual configs - XmlElement globalConfigElement = data.GlobalConfigElement; - if (globalConfigElement == null) { - globalConfigElement = doc.CreateElement ("PropertyGroup", Utils.ns); - doc.DocumentElement.AppendChild (globalConfigElement); - - data.GlobalConfigElement = globalConfigElement; - data.Guid = String.Format ("{{{0}}}", Guid.NewGuid ().ToString ().ToUpper ()); - - if (newdoc) - Utils.EnsureChildValue (globalConfigElement, "ProjectTypeGuids", data.TypeGuids); - - //FIXME: EnsureChildValue for AssemblyName <-> OutputAssembly - // Get this from where? different configs could have different ones.. - } - - Utils.EnsureChildValue (globalConfigElement, "ProjectGuid", data.Guid); - Utils.EnsureChildValue (globalConfigElement, "RootNamespace", project.DefaultNamespace); - - //Default Config and platform - //Note: Ignoring this, not relevant for MD, but might be useful for prj2make - //For new projects, adding these elements in SaveProject - // - //string [] defaultActivePlatform = GetConfigPlatform (project.ActiveConfiguration.Name); - //SetForNullCondition (doc, globalConfigElement, "Configuration", defaultActivePlatform [0]); - //SetForNullCondition (doc, globalConfigElement, "Platform", defaultActivePlatform [1]); - - foreach (DotNetProjectConfiguration config in project.Configurations) { - XmlElement configElement = null; - - if (data.ConfigElements.ContainsKey (config)) { - configElement = data.ConfigElements [config]; - } else { - //Create node for new configuration - configElement = doc.CreateElement ("PropertyGroup", Utils.ns); - doc.DocumentElement.AppendChild (configElement); - - //string configname = config.Name; - string [] t = GetConfigPlatform (config.Name); - //if (configname != config.Name) - // config.Name = configname; - configElement.SetAttribute ("Condition", - String.Format (" '$(Configuration)|$(Platform)' == '{0}|{1}' ", t [0], t [1])); - data.ConfigElements [config] = configElement; - } - - data.ExtensionChain.WriteConfig (project, config, configElement, monitor); - } - - // Always update the project references - foreach (ProjectReference pref in project.ProjectReferences) - data.ProjectReferenceElements [pref] = data.ExtensionChain.ReferenceToXmlElement (data, project, pref); - - foreach (ProjectFile pfile in project.ProjectFiles) { - XmlElement xe = data.ExtensionChain.FileToXmlElement (data, project, pfile); - if (xe != null) - data.ProjectFileElements [pfile] = xe; - } - - //FIXME: Set ActiveConfiguration - CleanUpEmptyItemGroups (doc); - - if (newdoc) { - XmlElement elem = doc.CreateElement ("Configuration", Utils.ns); - data.GlobalConfigElement.AppendChild (elem); - elem.InnerText = "Debug"; - elem.SetAttribute ("Condition", " '$(Configuration)' == '' "); - - elem = doc.CreateElement ("Platform", Utils.ns); - data.GlobalConfigElement.AppendChild (elem); - elem.InnerText = "AnyCPU"; - elem.SetAttribute ("Condition", " '$(Platform)' == '' "); - - } - - data.ExtensionChain.OnFinishWrite (data, project); - - if (newdoc) { - // Do this at the end, so that it can be detected that this is - // a non-msbuild project being converted - project.ExtendedProperties [typeof (MSBuildFileFormat)] = data; - } - - XmlWriterSettings settings = new XmlWriterSettings (); - settings.OmitXmlDeclaration = true; - settings.NewLineChars = "\r\n"; - settings.NewLineHandling = NewLineHandling.Replace; - settings.Encoding = Encoding.UTF8; - settings.Indent = true; - - using (XmlWriter xw = XmlWriter.Create (file, settings)) { - doc.Save (xw); - xw.Close (); - } - - return; - } - - /* Finds an element named @elementName, with a attribute Condition, which has "$(@elementName) = ''" - * and sets @value for that. Creates the element if its not found. */ - void SetForNullCondition (XmlDocument doc, XmlElement configElement, string elementName, string value) - { - XmlNodeList list = doc.SelectNodes (String.Format ( - "/tns:Project/tns:PropertyGroup/tns:{0}[@Condition]", elementName), - NamespaceManager); - foreach (XmlNode node in list) { - if (CheckNullCondition (node as XmlElement, elementName)) { - node.InnerText = value; - return; - } - } - - //Add new xml element for active config - XmlElement elem = doc.CreateElement (elementName, Utils.ns); - configElement.AppendChild (elem); - elem.InnerText = value; - - elem.SetAttribute ("Condition", " '$(" + elementName + ")' == '' "); - } - - bool CheckNullCondition (XmlElement elem, string varName) - { - if (elem == null) - return false; - - //FIXME: This will get instantiated repeatedly, save this - StringDictionary dic = ParseCondition (elem.Attributes ["Condition"].Value); - - string varUpper = varName.ToUpper (); - if (dic.Keys.Count == 1 && - dic.ContainsKey (varUpper) && String.IsNullOrEmpty (dic [varUpper])) { - // Eg. '$(Configuration)' == '' - return true; - } - - return false; - } - - void CleanUpEmptyItemGroups (XmlDocument doc) - { - XmlNodeList list = doc.SelectNodes ("/tns:Project/tns:ItemGroup[count(child)=0]", NamespaceManager); - List<XmlNode> del = new List<XmlNode> (); - foreach (XmlNode n in list) { - if (!n.HasChildNodes) - del.Add (n); - } - - foreach (XmlNode n in del) - n.ParentNode.RemoveChild (n); - } - - public void SaveProject (DotNetProject project, IProgressMonitor monitor) - { - WriteFile (project.FileName, project, monitor); - SetupHandlers (project); - } - - //Reader - public object ReadFile (string fileName, IProgressMonitor monitor) - { - // If it is a solution, use the solution reader - if (solutionFormat.CanReadFile (fileName)) { - return solutionFormat.ReadFile (fileName, monitor); - } - - Project project = null; - if (monitor == null || fileName == null) - //FIXME: Use NullProgressMonitor for monitor? - return null; - - try { - monitor.BeginTask (GettextCatalog.GetString ("Loading project: {0}", fileName), 1); - project = LoadProject (fileName, monitor); - } catch (Exception ex) { - monitor.ReportError (GettextCatalog.GetString ("Could not load project: {0}", fileName), ex); - throw; - } finally { - monitor.EndTask (); - } - - return project; - } - - //FIXME: Use monitor to report warnings/errors - DotNetProject LoadProject (string fname, IProgressMonitor monitor) - { - XmlDocument doc = new XmlDocument (); - doc.Load (fname); - - XPathNavigator nav = doc.CreateNavigator (); - nav.MoveToFirstChild (); - - while (! (nav.UnderlyingObject is XmlElement)) - nav.MoveToNext (); - - if (nav.NamespaceURI != Utils.ns) - throw new UnknownProjectVersionException (fname, nav.NamespaceURI); - - //Resolve ../'s - fname = Path.GetFullPath (fname); - string lang = Utils.GetLanguage (fname); - string basePath = Path.GetDirectoryName (fname); - - monitor.BeginTask (GettextCatalog.GetString ("Loading project: {0}", fname), 1); - - //try to get type guid - string type_guid; - string type_guids = String.Empty; - XmlNode node = doc.SelectSingleNode ("/tns:Project/tns:PropertyGroup/tns:ProjectTypeGuids", NamespaceManager); - if (node != null) { - if (node.NodeType == XmlNodeType.Element) - type_guids = ((XmlElement) node).InnerText; - } - - MSBuildProjectExtension extensionChain = GetExtensionChainFromTypeGuid (ref type_guids, out type_guid, lang, fname); - - //Create the project - DotNetProject project = extensionChain.CreateProject (type_guid, fname, type_guids); - project.FileName = fname; - project.Version = "0.1"; //FIXME: - //Default project name - project.Name = Path.GetFileNameWithoutExtension (fname); - project.FileFormat = new MSBuildFileFormat (); - project.ClrVersion = ClrVersion.Net_2_0; - - MSBuildData data = new MSBuildData (); - data.Document = doc; - data.ExtensionChain = extensionChain; - project.ExtendedProperties [typeof (MSBuildFileFormat)] = data; - - //Read the global config - XPathNodeIterator iter = nav.Select ("/tns:Project/tns:PropertyGroup[not(@Condition)]", NamespaceManager); - - DotNetProjectConfiguration globalConfig = (DotNetProjectConfiguration) project.CreateConfiguration ("Temp"); - globalConfig.ClrVersion = ClrVersion.Net_2_0; - - string str_tmp = String.Empty; - string guid = null; - string rootNamespace = String.Empty; - while (iter.MoveNext ()) { - if (guid == null && - Utils.ReadAsString (iter.Current, "ProjectGuid", ref str_tmp, false)) - guid = str_tmp; - - //FIXME: Add basePath to list of params - extensionChain.ReadConfig (project, globalConfig, iter.Current, basePath, monitor); - - //FIXME: Handle case when >1 global PropertyGroups exist, - data.GlobalConfigElement = (XmlElement) iter.Current.UnderlyingObject; - - //FIXME: RootNamespace can be specified per-config, but we are - //taking the first occurrence - if (String.IsNullOrEmpty (rootNamespace) && - Utils.ReadAsString (iter.Current, "RootNamespace", ref str_tmp, false)) { - rootNamespace = str_tmp; - } - } - project.DefaultNamespace = rootNamespace; - - if (guid != null) - data.Guid = guid; - - //ReadItemGroups : References, Source files etc - extensionChain.ReadItemGroups (data, project, globalConfig, basePath, monitor); - - //Load configurations - iter = nav.Select ("/tns:Project/tns:PropertyGroup[@Condition]", NamespaceManager); - while (iter.MoveNext ()) { - StringDictionary dic = ParseCondition ( - iter.Current.GetAttribute ("Condition", NamespaceManager.DefaultNamespace)); - - string configname = GetConfigName (dic); - if (configname == null) - continue; - - DotNetProjectConfiguration config = - (DotNetProjectConfiguration) project.GetConfiguration (configname); - - if (config == null) { - config = (DotNetProjectConfiguration) globalConfig.Clone (); - config.Name = configname; - - project.Configurations.Add (config); - } - - extensionChain.ReadConfig (project, config, iter.Current, basePath, monitor); - data.ConfigElements [config] = (XmlElement) iter.Current.UnderlyingObject; - } - - //Read project-type specific FlavorProperties - if (data.FlavorPropertiesParent != null) { - foreach (XmlNode n in data.FlavorPropertiesParent.ChildNodes) { - if (!n.HasChildNodes || n.Attributes ["GUID"] == null) - //nothing to read - continue; - string tguid = n.Attributes ["GUID"].Value; - if (String.IsNullOrEmpty (tguid)) - continue; - extensionChain.ReadFlavorProperties (data, project, n, tguid); - } - } - - /* Note: Ignoring this, not required for MD, but might be useful in prj2make - string confname = default_config + "|" + default_platform; - if (project.Configurations [confname] != null) - project.ActiveConfiguration = project.Configurations [confname]; */ - - extensionChain.OnFinishRead (data, project); - SetupHandlers (project); - - monitor.EndTask (); - return project; - } - - // Tries to get an extension chain for a @type_guids chain. - // If @type_guids is null, then tries to determine type_guid from - // the language - MSBuildProjectExtension GetExtensionChainFromTypeGuid (ref string type_guids, out string type_guid, string lang, string fname) - { - if (String.IsNullOrEmpty (type_guids)) { - if (!MSBuildFileFormat.LanguageTypeGuids.ContainsKey (lang)) - throw new Exception (String.Format ("Unknown project type : {0}", fname)); - type_guids = type_guid = MSBuildFileFormat.LanguageTypeGuids [lang]; - } - type_guid = type_guids.Split (';') [0]; - - string [] type_guid_list = type_guids.Split (new char [] {';'}, StringSplitOptions.RemoveEmptyEntries); - MSBuildProjectExtension [] extensions = new MSBuildProjectExtension [type_guid_list.Length + 1]; - for (int i = 0; i < type_guid_list.Length; i ++) { - foreach (MSBuildProjectExtension extn in Extensions) { - if (extn.Supports (type_guid_list [i], fname, type_guids)) { - extensions [i] = extn; - break; - } - } - if (extensions [i] == null) - throw new Exception (String.Format ("Unsupported Project type, guid : {0}", type_guid_list [i])); - } - extensions [type_guid_list.Length] = new DefaultMSBuildProjectExtension (); - - for (int i = 0; i < extensions.Length - 1; i ++) - extensions [i].Next = extensions [i + 1]; - - return extensions [0]; - } - - static void SetupHandlers (DotNetProject project) - { - //References - project.ReferenceRemovedFromProject += new ProjectReferenceEventHandler (HandleReferenceRemoved); - project.ReferenceAddedToProject += new ProjectReferenceEventHandler (HandleReferenceAdded); - - //Files - project.FileRemovedFromProject += new ProjectFileEventHandler (HandleFileRemoved); - project.FileAddedToProject += new ProjectFileEventHandler (HandleFileAdded); - project.FilePropertyChangedInProject += new ProjectFileEventHandler (HandleFilePropertyChanged); - project.FileRenamedInProject += new ProjectFileRenamedEventHandler (HandleFileRenamed); - - //Configurations - project.ConfigurationRemoved += new ConfigurationEventHandler (HandleConfigurationRemoved); - - project.NameChanged += new CombineEntryRenamedEventHandler (HandleRename); - } - - static void HandleRename (object sender, CombineEntryRenamedEventArgs e) - { - try { - if (e.CombineEntry.ParentCombine == null) - //Ignore if the project is not yet a part of a Combine - return; - - string oldfname = e.CombineEntry.FileName; - string extn = Path.GetExtension (oldfname); - string dir = Path.GetDirectoryName (oldfname); - string newfname = Path.Combine (dir, e.NewName + extn); - - FileService.MoveFile (oldfname, newfname); - e.CombineEntry.FileName = newfname; - } catch (Exception ex) { - LoggingService.LogError (ex.ToString ()); - throw; - } - } - - //Event handlers - static void HandleConfigurationRemoved (object sender, ConfigurationEventArgs e) - { - try { - DotNetProject project = (DotNetProject) sender; - MSBuildData d = Utils.GetMSBuildData (project); - if (d == null || !d.ConfigElements.ContainsKey ((DotNetProjectConfiguration) e.Configuration)) - return; - - XmlElement elem = d.ConfigElements [(DotNetProjectConfiguration)e.Configuration]; - elem.ParentNode.RemoveChild (elem); - d.ConfigElements.Remove ((DotNetProjectConfiguration)e.Configuration); - } catch (Exception ex) { - LoggingService.LogError (ex.ToString ()); - throw; - } - } - - //References - - static void HandleReferenceRemoved (object sender, ProjectReferenceEventArgs e) - { - try { - MSBuildData d = Utils.GetMSBuildData (e.Project); - if (d == null || !d.ProjectReferenceElements.ContainsKey (e.ProjectReference)) - return; - - XmlElement elem = d.ProjectReferenceElements [e.ProjectReference]; - elem.ParentNode.RemoveChild (elem); - d.ProjectReferenceElements.Remove (e.ProjectReference); - } catch (Exception ex) { - LoggingService.LogError (ex.ToString ()); - throw; - } - } - - static void HandleReferenceAdded (object sender, ProjectReferenceEventArgs e) - { - try { - MSBuildData d = Utils.GetMSBuildData (e.Project); - if (d == null) - return; - - d.ProjectReferenceElements [e.ProjectReference] = - d.ExtensionChain.ReferenceToXmlElement (d, e.Project, e.ProjectReference); - } catch (Exception ex) { - LoggingService.LogError (ex.ToString ()); - throw; - } - } - - //ProjectFile-s - - static void HandleFileRemoved (object sender, ProjectFileEventArgs e) - { - try { - MSBuildData d = Utils.GetMSBuildData (e.Project); - if (d == null || !d.ProjectFileElements.ContainsKey (e.ProjectFile)) - return; - - XmlElement elem = d.ProjectFileElements [e.ProjectFile]; - elem.ParentNode.RemoveChild (elem); - d.ProjectFileElements.Remove (e.ProjectFile); - } catch (Exception ex) { - LoggingService.LogError (ex.ToString ()); - throw; - } - } - - static void HandleFileAdded (object sender, ProjectFileEventArgs e) - { - try { - MSBuildData d = Utils.GetMSBuildData (e.Project); - if (d == null) - return; - - XmlElement xe = d.ExtensionChain.FileToXmlElement (d, e.Project, e.ProjectFile); - if (xe != null) - d.ProjectFileElements [e.ProjectFile] = xe; - } catch (Exception ex) { - LoggingService.LogError (ex.ToString ()); - throw; - } - } - - static void HandleFileRenamed (object sender, ProjectFileRenamedEventArgs e) - { - try { - MSBuildData d = Utils.GetMSBuildData (e.Project); - if (d == null || !d.ProjectFileElements.ContainsKey (e.ProjectFile)) - return; - - //FIXME: Check whether this file is a ApplicationIcon and accordingly update that? - XmlElement elem = d.ExtensionChain.FileToXmlElement (d, e.Project, e.ProjectFile); - if (elem != null) - d.ProjectFileElements [e.ProjectFile] = elem; - } catch (Exception ex) { - LoggingService.LogError (ex.ToString ()); - throw; - } - } - - static void HandleFilePropertyChanged (object sender, ProjectFileEventArgs e) - { - try { - //Subtype, BuildAction, DependsOn, Data - - MSBuildData d = Utils.GetMSBuildData (e.Project); - if (d == null || !d.ProjectFileElements.ContainsKey (e.ProjectFile)) - return; - - XmlElement elem = d.ProjectFileElements [e.ProjectFile]; - - //BuildAction - string buildAction = BuildActionToString (e.ProjectFile.BuildAction); - if (buildAction == null) { - LoggingService.LogWarning ("BuildAction.{0} not supported!", e.ProjectFile.BuildAction); - return; - } - - if (elem.LocalName != buildAction) { - XmlElement newElem = d.Document.CreateElement (buildAction, Utils.ns); - XmlNode parent = elem.ParentNode; - - List<XmlNode> list = new List<XmlNode> (); - foreach (XmlNode n in elem.ChildNodes) - list.Add (n); - foreach (XmlNode n in list) - newElem.AppendChild (elem.RemoveChild (n)); - - list.Clear (); - foreach (XmlAttribute a in elem.Attributes) - list.Add (a); - - foreach (XmlAttribute a in list) - newElem.Attributes.Append (elem.Attributes.Remove (a)); - - parent.RemoveChild (elem); - parent.AppendChild (newElem); - - d.ProjectFileElements [e.ProjectFile] = newElem; - - if (e.ProjectFile.BuildAction == BuildAction.FileCopy) - Utils.EnsureChildValue (newElem, "CopyToOutputDirectory", "Always"); - } - - //DependentUpon is relative to the basedir of the 'pf' (resource file) - if (!String.IsNullOrEmpty (e.ProjectFile.DependsOn)) - Utils.EnsureChildValue (d.ProjectFileElements [e.ProjectFile], "DependentUpon", - Utils.CanonicalizePath (FileService.AbsoluteToRelativePath ( - Path.GetDirectoryName (e.ProjectFile.Name), e.ProjectFile.DependsOn))); - //FIXME: Subtype, Data - } catch (Exception ex) { - LoggingService.LogError (ex.ToString ()); - throw; - } - } - - internal static string BuildActionToString (BuildAction ba) - { - switch (ba) { - case BuildAction.Nothing: - return "None"; - case BuildAction.Compile: - return "Compile"; - case BuildAction.EmbedAsResource: - return "EmbeddedResource"; - case BuildAction.FileCopy: - return "Content"; - case BuildAction.Exclude: - //FIXME: - break; - } - - return null; - } - - //Reading - - StringDictionary ParseCondition (string condition) - { - StringDictionary dic = new StringDictionary (); - - if (condition == null || condition.Length == 0) - return dic; - - Match m = ConditionRegex.Match (condition); - if (!m.Success) - return dic; - - string left = m.Groups [1].Value; - string right = m.Groups [2].Value; - - string [] left_parts = left.Split ('|'); - string [] right_parts = right.Split ('|'); - - for (int i = 0; i < left_parts.Length; i ++) { - if (left_parts [i].StartsWith ("$(") && - left_parts [i].EndsWith (")")) { - //FIXME: Yuck! - string key = left_parts [i].Substring (2, left_parts [i].Length - 3); - if (i < right_parts.Length) - dic [key.ToUpper ()] = right_parts [i].Trim (); - else - dic [key.ToUpper ()] = String.Empty; - } - - } - - return dic; - } - - //Utility methods - - static string GetConfigName (StringDictionary dic) - { - if (!dic.ContainsKey ("CONFIGURATION") || - String.IsNullOrEmpty (dic ["CONFIGURATION"])) - return null; - - string configname = dic ["CONFIGURATION"]; - if (dic.ContainsKey ("PLATFORM") && !String.IsNullOrEmpty (dic ["PLATFORM"])) { - if (String.Compare (dic ["PLATFORM"], "AnyCPU", true) == 0) - configname = configname + "|Any CPU"; - else - configname = configname + "|" + dic ["PLATFORM"]; - } - - return configname; - } - - /* Returns [0] : Config name, [1] : Platform */ - static string [] GetConfigPlatform (string name) - { - //FIXME: Handle Abc|Foo|x64 ? VS2005 doesn't allow a config - //name with | - string [] tmp = name.Split (new char [] {'|'}, 2); - string [] ret = new string [2]; - ret [0] = tmp [0]; - if (tmp.Length < 2) { - ret [1] = "AnyCPU"; - //name = String.Format ("{0}|{1}", ret [0], ret [1]); - } else { - ret [1] = tmp [1]; - } - - return ret; - } - - public static XmlElement GetFlavorPropertiesElement (MSBuildData data, string guid, bool create) - { - XmlElement parent = data.FlavorPropertiesParent; - if (parent == null) { - if (!create) - return null; - - parent = Utils.GetXmlElement (data.Document, data.Document, "/Project/ProjectExtensions/VisualStudio", create); - } - - foreach (XmlNode node in parent.ChildNodes) { - if (node.NodeType != XmlNodeType.Element || node.LocalName != "FlavorProperties") - continue; - if (node.Attributes ["GUID"] != null && String.Compare (node.Attributes ["GUID"].Value, guid, true) == 0) - return (XmlElement) node; - } - - //FlavorProperties not found - if (!create) - return null; - - XmlElement flavor_properties_element = data.Document.CreateElement ("FlavorProperties", Utils.ns); - flavor_properties_element.SetAttribute ("GUID", guid); - data.FlavorPropertiesParent.AppendChild (flavor_properties_element); - return flavor_properties_element; - } - - internal static List<MSBuildProjectExtension> Extensions { - get { - if (extensions == null) - InitExtensions (); - return extensions; - } - } - - static void InitExtensions () - { - if (extensions != null) - return; - - extensions = new List<MSBuildProjectExtension> (); - languageTypeGuids = new Dictionary<string,string> (); - - // AddinManager.AddExtensionNodeHandler calls the handler for all the existing extensions - AddinManager.AddExtensionNodeHandler ("/MonoDevelop/Prj2Make/MSBuildProjectExtension", OnProjectExtensionsChanged); - extensions.Add (new DefaultMSBuildProjectExtension ()); - } - - static void OnProjectExtensionsChanged (object s, ExtensionNodeEventArgs args) - { - if (args.Change == ExtensionChange.Add) { - MSBuildProjectExtension extn = (MSBuildProjectExtension) args.ExtensionObject; - if (!extensions.Contains (extn)) - AddExtension (extn); - } - //FIXME: ExtensionChange.Remove - } - - static void AddExtension (MSBuildProjectExtension extn) - { - extensions.Add (extn); - if (extn.IsLanguage) - LanguageTypeGuids [extn.LanguageId] = extn.TypeGuid; - } - - static Regex conditionRegex = null; - static Regex ConditionRegex { - get { - if (conditionRegex == null) - conditionRegex = new Regex (@"'([^']*)'\s*==\s*'([^']*)'"); - return conditionRegex; - } - } - - // Contains only assembly name like "System.Xml" - // used to get the correct case of assembly names, - // like System.XML - static Dictionary<string, string> assemblyNamesTable = null; - internal static Dictionary<string, string> AssemblyNamesTable { - get { - if (assemblyNamesTable == null) { - assemblyNamesTable = new Dictionary<string, string> (StringComparer.InvariantCultureIgnoreCase); - foreach (string fullname in Runtime.SystemAssemblyService.GetAssemblyFullNames ()) { - string name = fullname; - if (name.IndexOf (',') >= 0) - name = name.Substring (0, name.IndexOf (',')).Trim (); - assemblyNamesTable [name] = name; - } - } - - return assemblyNamesTable; - } - } - - static Dictionary<string, string> languageTypeGuids = null; - public static Dictionary<string, string> LanguageTypeGuids { - get { - InitExtensions (); - return languageTypeGuids; - } - } - } -} diff --git a/main/src/addins/prj2make-sharp-lib/MSBuildProjectExtension.cs b/main/src/addins/prj2make-sharp-lib/MSBuildProjectExtension.cs deleted file mode 100644 index 3bdb1b032b..0000000000 --- a/main/src/addins/prj2make-sharp-lib/MSBuildProjectExtension.cs +++ /dev/null @@ -1,126 +0,0 @@ -// -// MSBuildProjectExtension.cs -// -// Author: -// Ankit Jain <jankit@novell.com> -// -// Copyright (C) 2007 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using MonoDevelop.Core; -using MonoDevelop.Projects; - -using System; -using System.Xml; -using System.Xml.XPath; - -namespace MonoDevelop.Prj2Make -{ - public abstract class MSBuildProjectExtension - { - internal MSBuildProjectExtension Next = null; - - public abstract string TypeGuid { - get; - } - - public virtual string Name { - get { return "MSBuildProjectExtension"; } - } - - public virtual bool IsLanguage { - get { return false; } - } - - // Must match the Id used by MonoDevelop for the language - public virtual string LanguageId { - get { return null; } - } - - public virtual bool Supports (string guid, string filename, string type_guids) - { - return Next.Supports (guid, filename, type_guids); - } - - public virtual DotNetProject CreateProject (string type_guid, string filename, string type_guids) - { - return Next.CreateProject (type_guid, filename, type_guids); - } - - public virtual void ReadConfig (DotNetProject project, DotNetProjectConfiguration config, XPathNavigator nav, string basePath, IProgressMonitor monitor) - { - Next.ReadConfig (project, config, nav, basePath, monitor); - } - - public virtual void ReadItemGroups (MSBuildData data, DotNetProject project, DotNetProjectConfiguration globalConfig, string basePath, IProgressMonitor monitor) - { - Next.ReadItemGroups (data, project, globalConfig, basePath, monitor); - } - - public virtual void ReadItemGroup (MSBuildData data, DotNetProject project, DotNetProjectConfiguration globalConfig, string include, string basePath, XmlNode node, IProgressMonitor monitor) - { - Next.ReadItemGroup (data, project, globalConfig, include, basePath, node, monitor); - } - - public virtual void ReadFlavorProperties (MSBuildData data, DotNetProject project, XmlNode node, string guid) - { - Next.ReadFlavorProperties (data, project, node, guid); - } - - public virtual void OnFinishRead (MSBuildData data, DotNetProject project) - { - Next.OnFinishRead (data, project); - } - - //Writing methods - - public virtual void WriteConfig (DotNetProject project, DotNetProjectConfiguration config, XmlElement configElement, IProgressMonitor monitor) - { - Next.WriteConfig (project, config, configElement, monitor); - } - - public virtual XmlElement FileToXmlElement (MSBuildData data, Project project, ProjectFile projectFile) - { - return Next.FileToXmlElement (data, project, projectFile); - } - - public virtual XmlElement ReferenceToXmlElement (MSBuildData data, Project project, ProjectReference projectRef) - { - return Next.ReferenceToXmlElement (data, project, projectRef); - } - - public virtual void OnFinishWrite (MSBuildData data, DotNetProject project) - { - Next.OnFinishWrite (data, project); - } - - public virtual string GetGuidChain (DotNetProject project) - { - return null; - } - - public override string ToString () - { - return Name + (Next != null ? " -> " + Next.ToString () : String.Empty); - } - } -} diff --git a/main/src/addins/prj2make-sharp-lib/MSBuildProjectServiceExtension.cs b/main/src/addins/prj2make-sharp-lib/MSBuildProjectServiceExtension.cs index 0c010a8b8e..53cc67241e 100644 --- a/main/src/addins/prj2make-sharp-lib/MSBuildProjectServiceExtension.cs +++ b/main/src/addins/prj2make-sharp-lib/MSBuildProjectServiceExtension.cs @@ -42,14 +42,14 @@ namespace MonoDevelop.Prj2Make public class MSBuildProjectServiceExtension : ProjectServiceExtension { - public override ICompilerResult Build (IProgressMonitor monitor, CombineEntry entry) + protected override ICompilerResult Build (IProgressMonitor monitor, IBuildTarget entry, string configuration) { //xamlg any SilverLightPages DotNetProject project = entry as DotNetProject; if (project == null) - return base.Build (monitor, entry); + return base.Build (monitor, entry, configuration); - foreach (ProjectFile pf in project.ProjectFiles) { + foreach (ProjectFile pf in project.Files) { if (pf.BuildAction != BuildAction.EmbedAsResource) continue; @@ -71,7 +71,7 @@ namespace MonoDevelop.Prj2Make } } - return base.Build (monitor, entry); + return base.Build (monitor, entry, configuration); } CompilerError GenerateXamlPartialClass (string fname, out string generated_file_name, IProgressMonitor monitor) @@ -144,31 +144,6 @@ namespace MonoDevelop.Prj2Make return null; } - public override string GetDefaultResourceId (ProjectFile pf) - { - if (Utils.GetMSBuildData (pf.Project) == null) - return base.GetDefaultResourceId (pf); - - return GetDefaultResourceIdInternal (pf); - } - - internal static string GetDefaultResourceIdInternal (ProjectFile pf) - { - IResourceIdBuilder rb; - DotNetProject project = (DotNetProject) pf.Project; - - if (project.LanguageName == "C#") { - rb = new CSharpResourceIdBuilder (); - } else if (project.LanguageName == "VBNet") { - rb = new VBNetResourceIdBuilder (); - } else { - LoggingService.LogError (GettextCatalog.GetString ("Language '{0}' not supported for building resource ids.", project.LanguageName)); - return null; - } - - return rb.GetResourceId (pf); - } - // Used for parsing "Line 123, position 5" errors from tools // like resgen, xamlg static Regex regexErrorLinePos; diff --git a/main/src/addins/prj2make-sharp-lib/Makefile.am b/main/src/addins/prj2make-sharp-lib/Makefile.am index 8761ba0459..7edaec71a9 100644 --- a/main/src/addins/prj2make-sharp-lib/Makefile.am +++ b/main/src/addins/prj2make-sharp-lib/Makefile.am @@ -16,16 +16,9 @@ REFS = \ -r:System.Xml FILES = \ - CSharpMSBuildProjectExtension.cs \ - CSharpResourceIdBuilder.cs \ csproj_ver2003.cs \ CsprojInfo.cs \ - DefaultMSBuildProjectExtension.cs \ - IResourceIdBuilder.cs \ MdPrjHelper.cs \ - MSBuildData.cs \ - MSBuildFileFormat.cs \ - MSBuildProjectExtension.cs \ MSBuildProjectServiceExtension.cs \ MsPrjHelper.cs \ pkgconfiginvoker.cs \ @@ -33,14 +26,7 @@ FILES = \ PrjxInfo.cs \ sharp_d_cmbx.cs \ sharp_d_prjx.cs \ - SilverlightMSBuildProjectExtension.cs \ - SlnData.cs \ - SlnFileFormat.cs \ - Utils.cs \ - VBNetMSBuildProjectExtension.cs \ - VBNetResourceIdBuilder.cs \ - VS2003ProjectFileFormat.cs \ - VS2003SlnFileFormat.cs + VS2003ProjectFileFormat.cs RES = prj2make-sharp-lib.addin.xml diff --git a/main/src/addins/prj2make-sharp-lib/MsPrjHelper.cs b/main/src/addins/prj2make-sharp-lib/MsPrjHelper.cs index 4d22646573..610a035f16 100644 --- a/main/src/addins/prj2make-sharp-lib/MsPrjHelper.cs +++ b/main/src/addins/prj2make-sharp-lib/MsPrjHelper.cs @@ -95,7 +95,7 @@ namespace MonoDevelop.Prj2Make StreamReader reader = new StreamReader(fis); strInput = reader.ReadLine(); - match = SlnFileFormat.SlnVersionRegex.Match(strInput); + match = SlnVersionRegex.Match(strInput); if (match.Success) { strVersion = match.Groups[1].Value; @@ -143,7 +143,7 @@ namespace MonoDevelop.Prj2Make string s = reader.ReadLine(); Match match; - match = SlnFileFormat.ProjectRegex.Match(s); + match = ProjectRegex.Match(s); if (match.Success) { string projectName = match.Groups[2].Value; @@ -484,10 +484,10 @@ namespace MonoDevelop.Prj2Make prjxObj.NewFileSearch = NewFileSearch.None; prjxObj.DefaultNamespace = csprojObj.CSHARP.Build.Settings.RootNamespace; - GetContents (prjxObj, csprojObj.CSHARP.Files.Include, prjxObj.ProjectFiles, monitor); + GetContents (prjxObj, csprojObj.CSHARP.Files.Include, prjxObj.Files, monitor); monitor.Step (1); - GetReferences (csprojObj.CSHARP.Build.References, prjxObj.ProjectReferences, monitor); + GetReferences (csprojObj.CSHARP.Build.References, prjxObj.References, monitor); monitor.Step (1); prjxObj.Configurations.Clear (); @@ -517,13 +517,13 @@ namespace MonoDevelop.Prj2Make public string MsSlnToCmbxHelper (string slnFileName, IProgressMonitor monitor) { - Combine c = MsSlnToCmbxHelper (slnFileName, monitor, true); + Solution c = MsSlnToCmbxHelper (slnFileName, monitor, true); return c.FileName; } - public Combine MsSlnToCmbxHelper (string slnFileName, IProgressMonitor monitor, bool save) + public Solution MsSlnToCmbxHelper (string slnFileName, IProgressMonitor monitor, bool save) { - Combine cmbxObj = new Combine(); + Solution solution = new Solution(); cmbxFileName = String.Format ("{0}.mds", Path.Combine(Path.GetDirectoryName(slnFileName), Path.GetFileNameWithoutExtension(slnFileName)) @@ -554,11 +554,11 @@ namespace MonoDevelop.Prj2Make if (save) { string prjName = prj.FileName; if (prjName != null) - cmbxObj.AddEntry (prjName, monitor); + solution.RootFolder.AddItem (prjName, monitor); else return null; } else { - cmbxObj.Entries.Add (prj); + solution.RootFolder.Items.Add (prj); } monitor.Step (1); } @@ -566,12 +566,12 @@ namespace MonoDevelop.Prj2Make monitor.EndTask (); monitor.Step (1); - cmbxObj.FileName = cmbxFileName; + solution.FileName = cmbxFileName; if (save) - cmbxObj.Save (cmbxFileName, monitor); + solution.Save (cmbxFileName, monitor); monitor.Step (1); - return cmbxObj; + return solution; } catch (Exception e) { @@ -745,7 +745,6 @@ namespace MonoDevelop.Prj2Make break; case MonoDevelop.Prj2Make.Schema.Csproj.FileBuildAction.EmbeddedResource: flOut.BuildAction = BuildAction.EmbedAsResource; - flOut.ResourceId = MSBuildProjectServiceExtension.GetDefaultResourceIdInternal (flOut); break; case MonoDevelop.Prj2Make.Schema.Csproj.FileBuildAction.None: flOut.BuildAction = BuildAction.Nothing; @@ -757,14 +756,13 @@ namespace MonoDevelop.Prj2Make } } - protected IConfiguration CreateConfigurationBlock (MonoDevelop.Projects.Project project, Config ConfigBlock, string AssemblyName, string OuputType, IProgressMonitor monitor) + protected SolutionItemConfiguration CreateConfigurationBlock (MonoDevelop.Projects.DotNetProject project, Config ConfigBlock, string AssemblyName, string OuputType, IProgressMonitor monitor) { DotNetProjectConfiguration confObj = project.CreateConfiguration (ConfigBlock.Name) as DotNetProjectConfiguration; confObj.RunWithWarnings = false; - confObj.NetRuntime = NetRuntime.MsNet; confObj.DebugMode = ConfigBlock.DebugSymbols; - confObj.CompileTarget = (CompileTarget) Enum.Parse (typeof(CompileTarget), OuputType, true); + project.CompileTarget = (CompileTarget) Enum.Parse (typeof(CompileTarget), OuputType, true); string dir = MapPath (project.BaseDirectory, ConfigBlock.OutputPath); if (dir == null) { @@ -775,7 +773,6 @@ namespace MonoDevelop.Prj2Make confObj.OutputAssembly = AssemblyName; CSharpCompilerParameters compilerParams = new CSharpCompilerParameters (); - compilerParams.CsharpCompiler = CsharpCompiler.Mcs; compilerParams.WarningLevel = ConfigBlock.WarningLevel; compilerParams.NoWarnings = ""; compilerParams.Optimize = ConfigBlock.Optimize; @@ -846,5 +843,24 @@ namespace MonoDevelop.Prj2Make return Path.GetFullPath (path); } } + + // static regexes + static Regex projectRegex = null; + internal static Regex ProjectRegex { + get { + if (projectRegex == null) + projectRegex = new Regex(@"Project\(""(\{[^}]*\})""\) = ""(.*)"", ""(.*)"", ""(\{[^{]*\})"""); + return projectRegex; + } + } + + static Regex slnVersionRegex = null; + internal static Regex SlnVersionRegex { + get { + if (slnVersionRegex == null) + slnVersionRegex = new Regex (@"Microsoft Visual Studio Solution File, Format Version (\d?\d.\d\d)"); + return slnVersionRegex; + } + } } } diff --git a/main/src/addins/prj2make-sharp-lib/PrjHelper.cs b/main/src/addins/prj2make-sharp-lib/PrjHelper.cs index e4b6f78152..2260a01f0b 100644 --- a/main/src/addins/prj2make-sharp-lib/PrjHelper.cs +++ b/main/src/addins/prj2make-sharp-lib/PrjHelper.cs @@ -44,16 +44,6 @@ namespace MonoDevelop.Prj2Make return TypeOfFile.unknown; } - public bool CreateCombineFromSln(string slnFileName, IProgressMonitor monitor) - { - SlnMaker slnMkObj = new SlnMaker(); - - // Load the sln and parse it - slnMkObj.MsSlnToCmbxHelper (slnFileName, monitor); - - return false; - } - public bool CreatePrjxFromCsproj(string csprojFileName, IProgressMonitor monitor) { SlnMaker slnMkObj = new SlnMaker(); diff --git a/main/src/addins/prj2make-sharp-lib/SlnData.cs b/main/src/addins/prj2make-sharp-lib/SlnData.cs deleted file mode 100644 index 8d4b5bc65f..0000000000 --- a/main/src/addins/prj2make-sharp-lib/SlnData.cs +++ /dev/null @@ -1,125 +0,0 @@ -// -// SlnData.cs -// -// Author: -// Ankit Jain <jankit@novell.com> -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using MonoDevelop.Projects; - -using System; -using System.Collections.Generic; - -namespace MonoDevelop.Prj2Make -{ - class SlnData - { - string guid; - string headerComment; - string versionString; - Dictionary<CombineConfiguration, string> configStrings; - List<string> globalExtra; // unused GlobalSections - Dictionary<string, List<string>> sectionExtras; - List<string> extra; //used by solution folders.. - List<string> unknownProjects; - Dictionary<string, DotNetProject> projectsByGuidTable; - - public SlnData () - : this (String.Format ("{{{0}}}", System.Guid.NewGuid ().ToString ().ToUpper ())) - { - } - - public SlnData (string guid) - { - this.guid = guid; - // default, vs2005 - versionString = "9.00"; - headerComment = "# Visual Studio 2005"; - } - - /* Guid with enclosing {} */ - public string Guid { - get { return guid; } - set { guid = value; } - } - - // Eg. "# Visual C# Express 2008" - public string HeaderComment { - get { return headerComment; } - set { headerComment = value; } - } - - // Eg. 9.00 or 10.00 - public string VersionString { - get { return versionString; } - set { versionString = value; } - } - - public Dictionary<CombineConfiguration, string> ConfigStrings { - get { - if (configStrings == null) - configStrings = new Dictionary<CombineConfiguration, string> (); - return configStrings; - } - } - - public List<string> GlobalExtra { - get { return globalExtra; } - set { globalExtra = value; } - } - - public List<string> Extra { - get { return extra; } - set { extra = value; } - } - - public List<string> UnknownProjects { - get { - if (unknownProjects == null) - unknownProjects = new List<string> (); - return unknownProjects; - } - } - - //Extra lines per section which need to be preserved - //eg. lines in ProjectConfigurationPlatforms for projects - //that we couldn't load - public Dictionary<string, List<string>> SectionExtras { - get { - if (sectionExtras == null) - sectionExtras = new Dictionary<string, List<string>> (); - return sectionExtras; - } - } - - public Dictionary<string, DotNetProject> ProjectsByGuid { - get { - if (projectsByGuidTable == null) - projectsByGuidTable = new Dictionary<string, DotNetProject> (); - return projectsByGuidTable; - } - } - - } -} diff --git a/main/src/addins/prj2make-sharp-lib/SlnFileFormat.cs b/main/src/addins/prj2make-sharp-lib/SlnFileFormat.cs deleted file mode 100644 index d4c44d42e1..0000000000 --- a/main/src/addins/prj2make-sharp-lib/SlnFileFormat.cs +++ /dev/null @@ -1,1110 +0,0 @@ -// -// SlnFileFormat.cs -// -// Author: -// Ankit Jain <jankit@novell.com> -// -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.Globalization; -using System.IO; -using System.Text; -using System.Text.RegularExpressions; -using System.Xml; - -using MonoDevelop.Projects; -using MonoDevelop.Projects.Serialization; -using MonoDevelop.Core; -using MonoDevelop.Core.ProgressMonitoring; -using MonoDevelop.Ide.Gui; - -namespace MonoDevelop.Prj2Make -{ - internal class SlnFileFormat - { - static string folderTypeGuid = "{2150E333-8FDC-42A3-9474-1A3956D46DE8}"; - - static SlnFileFormat () - { - IdeApp.Initialized += delegate (object sender, EventArgs args) { - IdeApp.ProjectOperations.AddingEntryToCombine += new AddEntryEventHandler (HandleAddEntry); - }; - } - - public string GetValidFormatName (object obj, string fileName) - { - return Path.ChangeExtension (fileName, ".sln"); - } - - public bool CanReadFile (string file) - { - if (String.Compare (Path.GetExtension (file), ".sln", true) != 0) - return false; - string tmp; - string version = GetSlnFileVersion (file, out tmp); - return version == "9.00" || version == "10.00"; - } - - public bool CanWriteFile (object obj) - { - return obj is Combine; - } - - public System.Collections.Specialized.StringCollection GetExportFiles (object obj) - { - Combine c = obj as Combine; - if (c != null && !c.IsRoot && c.ParentCombine.FileFormat is MSBuildFileFormat) - // Solution folder - return new System.Collections.Specialized.StringCollection (); - - return null; - } - - public void WriteFile (string file, object obj, IProgressMonitor monitor) - { - Combine c = obj as Combine; - if (c == null) - return; - - if (!c.IsRoot && c.ParentCombine.FileFormat is MSBuildFileFormat) - // Ignore a non-root combine if its parent is a msbuild solution - // Eg. if parent is a mds, then this should get emitted as the - // top level solution - return; - - string tmpfilename = String.Empty; - try { - monitor.BeginTask (GettextCatalog.GetString ("Saving solution: {0}", file), 1); - try { - if (File.Exists (file)) - tmpfilename = Path.GetTempFileName (); - } catch (IOException) { - } - - if (tmpfilename == String.Empty) { - WriteFileInternal (file, c, monitor); - } else { - WriteFileInternal (tmpfilename, c, monitor); - File.Delete (file); - File.Move (tmpfilename, file); - } - } catch (Exception ex) { - monitor.ReportError (GettextCatalog.GetString ("Could not save solution: {0}", file), ex); - LoggingService.LogError (GettextCatalog.GetString ("Could not save solution: {0}", file), ex); - - if (!String.IsNullOrEmpty (tmpfilename)) - File.Delete (tmpfilename); - throw; - } finally { - monitor.EndTask (); - } - } - - void WriteFileInternal (string file, Combine c, IProgressMonitor monitor) - { - using (StreamWriter sw = new StreamWriter (file, false, Encoding.UTF8)) { - sw.NewLine = "\r\n"; - - SlnData slnData = GetSlnData (c); - if (slnData == null) { - // If a non-msbuild project is being converted by just - // changing the fileformat, then create the SlnData for it - slnData = new SlnData (); - c.ExtendedProperties [typeof (SlnFileFormat)] = slnData; - } - - sw.WriteLine (); - //Write Header - sw.WriteLine ("Microsoft Visual Studio Solution File, Format Version " + slnData.VersionString); - sw.WriteLine (slnData.HeaderComment); - - //Write the projects - monitor.BeginTask (GettextCatalog.GetString ("Saving projects"), 1); - WriteProjects (c, c.BaseDirectory, sw, monitor); - monitor.EndTask (); - - //Write the lines for unknownProjects - foreach (string l in slnData.UnknownProjects) - sw.WriteLine (l); - - //Write the Globals - sw.WriteLine ("Global"); - - //Write SolutionConfigurationPlatforms - //FIXME: SolutionConfigurations? - sw.WriteLine ("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution"); - - foreach (CombineConfiguration config in c.Configurations) - sw.WriteLine ("\t\t{0} = {0}", config.Name); - - sw.WriteLine ("\tEndGlobalSection"); - - //Write ProjectConfigurationPlatforms - sw.WriteLine ("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution"); - - List<string> list = new List<string> (); - WriteProjectConfigurations (c, list, 0, null); - - list.Sort (StringComparer.Create (CultureInfo.InvariantCulture, true)); - foreach (string s in list) - sw.WriteLine (s); - - //Write lines for projects we couldn't load - if (slnData.SectionExtras.ContainsKey ("ProjectConfigurationPlatforms")) { - foreach (string s in slnData.SectionExtras ["ProjectConfigurationPlatforms"]) - sw.WriteLine ("\t\t{0}", s); - } - - sw.WriteLine ("\tEndGlobalSection"); - - //Write Nested Projects - sw.WriteLine ("\tGlobalSection(NestedProjects) = preSolution"); - WriteNestedProjects (c, c, sw); - sw.WriteLine ("\tEndGlobalSection"); - - //Write 'others' - if (slnData.GlobalExtra != null) { - foreach (string s in slnData.GlobalExtra) - sw.WriteLine (s); - } - - sw.WriteLine ("EndGlobal"); - } - } - - void WriteProjects (Combine combine, string baseDirectory, StreamWriter writer, IProgressMonitor monitor) - { - monitor.BeginStepTask (GettextCatalog.GetString ("Saving projects"), combine.Entries.Count, 1); - foreach (CombineEntry ce in combine.Entries) { - Combine c = ce as Combine; - - List<string> l = null; - if (c == null) { - //Project - DotNetProject project = ce as DotNetProject; - if (project == null) { - monitor.ReportWarning (GettextCatalog.GetString ( - "Error saving project ({0}) : Only DotNetProjects can be part of a MSBuild solution. Ignoring.", ce.Name)); - monitor.Step (1); - continue; - } - - if (!MSBuildFileFormat.LanguageTypeGuids.ContainsKey (project.LanguageName)) { - // FIXME: Should not happen, temp - monitor.ReportWarning (GettextCatalog.GetString ("Saving for project {0} not supported. Ignoring.", - ce.FileName)); - monitor.Step (1); - continue; - } - - IFileFormat ff = project.FileFormat; - if (! (ff is MSBuildFileFormat)) { - // Convert to a msbuild file format - project.FileFormat = new MSBuildFileFormat (); - project.FileName = project.FileFormat.GetValidFormatName (project, project.FileName); - } - - project.Save (monitor); - - MSBuildData msbData = Utils.GetMSBuildData (project); - if (msbData == null) - //This should not happen as project.Save would've added this - throw new Exception (String.Format ( - "INTERNAL ERROR: Project named '{0}', filename = {1}, does not have a 'data' object.", - project.Name, project.FileName)); - - l = msbData.Extra; - - writer.WriteLine (@"Project(""{0}"") = ""{1}"", ""{2}"", ""{3}""", - MSBuildFileFormat.LanguageTypeGuids [project.LanguageName], - project.Name, - FileService.NormalizeRelativePath (FileService.AbsoluteToRelativePath ( - baseDirectory, project.FileName)).Replace ('/', '\\'), - msbData.Guid); - } else { - //Solution - SlnData slnData = GetSlnData (c); - if (slnData == null) { - // Solution folder - slnData = new SlnData (); - c.ExtendedProperties [typeof (SlnFileFormat)] = slnData; - SlnData data = GetSlnData (combine); - if (data != null) { - slnData.VersionString = data.VersionString; - slnData.HeaderComment = data.HeaderComment; - } - } - - l = slnData.Extra; - - writer.WriteLine (@"Project(""{0}"") = ""{1}"", ""{2}"", ""{3}""", - folderTypeGuid, - ce.Name, - ce.Name, - slnData.Guid); - } - - if (l != null) { - foreach (string s in l) - writer.WriteLine (s); - } - - writer.WriteLine ("EndProject"); - if (c != null) - WriteProjects (c, baseDirectory, writer, monitor); - monitor.Step (1); - } - monitor.EndTask (); - } - - void WriteProjectConfigurations (Combine c, List<string> list, int ind, string config) - { - foreach (CombineConfiguration cc in c.Configurations) { - string rootConfigName = config ?? cc.Name; - if (cc.Name != rootConfigName) - continue; - - foreach (CombineConfigurationEntry cce in cc.Entries) { - DotNetProject p = cce.Entry as DotNetProject; - if (p == null) { - Combine combine = cce.Entry as Combine; - if (combine == null) - continue; - - //FIXME: Bug in md :/ Workaround, setting the config name explicitly - //Solution folder's cce.ConfigurationName doesn't get set - if (String.IsNullOrEmpty (cce.ConfigurationName)) { - if (combine.GetConfiguration (rootConfigName) != null) - cce.ConfigurationName = rootConfigName; - } - - if (cce.ConfigurationName != rootConfigName) { - //Sln folder's config must match the root, - //so that its the same throughout the tree - //this ensures that _all_ the projects are - //relative to rootconfigname - //FIXME: Could be either: - // 1. Invalid setting - // 2. New imported project, which doesn't yet have - // a config named rootConfigName - LoggingService.LogDebug ("Known Problem: Invalid setting. Ignoring."); - continue; - } - - WriteProjectConfigurations (combine, list, ind + 1, cc.Name); - - continue; - } - - /* Project */ - - MSBuildData data = Utils.GetMSBuildData (p); - list.Add (String.Format ( - "\t\t{0}.{1}.ActiveCfg = {2}", data.Guid, cc.Name, cce.ConfigurationName)); - - if (cce.Build) - list.Add (String.Format ( - "\t\t{0}.{1}.Build.0 = {2}", data.Guid, cc.Name, cce.ConfigurationName)); - } - } - } - - void WriteNestedProjects (Combine combine, Combine root, StreamWriter writer) - { - foreach (CombineEntry ce in combine.Entries) { - Combine c = ce as Combine; - if (c == null || c.ParentCombine == null) - continue; - - WriteNestedProjects (c, root, writer); - } - - SlnData data = GetSlnData (combine); - if (data == null) - throw new Exception (String.Format ( - "INTERNAL ERROR: Solution named '{0}', filename = {1}, does not have a 'data' object.", - combine.Name, combine.FileName)); - - string containerGuid = data.Guid; - foreach (CombineEntry ce in combine.Entries) { - if (ce.ParentCombine == root) - continue; - - string containeeGuid = null; - if (ce is Combine) { - SlnData slnData = GetSlnData (ce); - containeeGuid = slnData.Guid; - } else { - MSBuildData msbData = Utils.GetMSBuildData (ce); - containeeGuid = msbData.Guid; - } - - writer.WriteLine (@"{0}{1} = {2}", "\t\t", containeeGuid, containerGuid); - } - } - - //Reader - public object ReadFile (string fileName, IProgressMonitor monitor) - { - Combine combine = null; - if (fileName == null || monitor == null) - return null; - - try { - monitor.BeginTask (string.Format (GettextCatalog.GetString ("Loading solution: {0}"), fileName), 1); - combine = LoadSolution (fileName, monitor); - SetHandlers (combine, true); - } catch (Exception ex) { - monitor.ReportError (GettextCatalog.GetString ("Could not load solution: {0}", fileName), ex); - throw; - } finally { - monitor.EndTask (); - } - - return combine; - } - - //ExtendedProperties - // Per config - // Platform : Eg. Any CPU - // SolutionConfigurationPlatforms - // - Combine LoadSolution (string fileName, IProgressMonitor monitor) - { - string headerComment; - string version = GetSlnFileVersion (fileName, out headerComment); - if (version != "9.00" && version != "10.00") - throw new UnknownProjectVersionException (fileName, version); - - ListDictionary globals = null; - Combine combine = null; - SlnData data = null; - List<Section> projectSections = null; - List<string> lines = null; - - monitor.BeginTask (GettextCatalog.GetString ("Loading solution: {0}", fileName), 1); - //Parse the .sln file - using (StreamReader reader = new StreamReader(fileName)) { - combine = new Combine (); - combine.Name = Path.GetFileNameWithoutExtension (fileName); - combine.FileName = fileName; - combine.Version = "0.1"; //FIXME: - combine.FileFormat = new MSBuildFileFormat (); - data = new SlnData (); - combine.ExtendedProperties [typeof (SlnFileFormat)] = data; - data.VersionString = version; - data.HeaderComment = headerComment; - - string s = null; - projectSections = new List<Section> (); - lines = new List<string> (); - globals = new ListDictionary (); - //Parse - while (reader.Peek () >= 0) { - s = GetNextLine (reader, lines).Trim (); - - if (String.Compare (s, "Global", true) == 0) { - ParseGlobal (reader, lines, globals); - continue; - } - - if (s.StartsWith ("Project")) { - Section sec = new Section (); - projectSections.Add (sec); - - sec.Start = lines.Count - 1; - - int e = ReadUntil ("EndProject", reader, lines); - sec.Count = (e < 0) ? 1 : (e - sec.Start + 1); - - continue; - } - } - } - - monitor.BeginTask("Loading projects ..", projectSections.Count + 1); - Dictionary<string, CombineEntry> entries = new Dictionary<string, CombineEntry> (); - foreach (Section sec in projectSections) { - monitor.Step (1); - Match match = ProjectRegex.Match (lines [sec.Start]); - if (!match.Success) { - LoggingService.LogDebug (GettextCatalog.GetString ( - "Invalid Project definition on line number #{0} in file '{1}'. Ignoring.", - sec.Start + 1, - fileName)); - - continue; - } - - try { - // Valid guid? - new Guid (match.Groups [1].Value); - } catch (FormatException) { - //Use default guid as projectGuid - LoggingService.LogDebug (GettextCatalog.GetString ( - "Invalid Project type guid '{0}' on line #{1}. Ignoring.", - match.Groups [1].Value, - sec.Start + 1)); - continue; - } - - string projTypeGuid = match.Groups [1].Value.ToUpper (); - string projectName = match.Groups [2].Value; - string projectPath = match.Groups [3].Value; - string projectGuid = match.Groups [4].Value; - - if (projTypeGuid == folderTypeGuid) { - //Solution folder - SolutionFolder folder = new SolutionFolder (); - folder.Name = projectName; - folder.FileName = projectPath; - folder.Version = "0.1"; //FIXME: - folder.FileFormat = new MSBuildFileFormat (); - - SlnData slnData = new SlnData (projectGuid); - folder.ExtendedProperties [typeof (SlnFileFormat)] = slnData; - slnData.VersionString = data.VersionString; - slnData.HeaderComment = data.HeaderComment; - - slnData.Extra = lines.GetRange (sec.Start + 1, sec.Count - 2); - - entries [projectGuid] = folder; - - continue; - } - - if (!MSBuildFileFormat.LanguageTypeGuids.ContainsValue (projTypeGuid)) { - LoggingService.LogWarning (GettextCatalog.GetString ( - "Unknown project type guid '{0}' on line #{1}. Ignoring.", - projTypeGuid, - sec.Start + 1)); - monitor.ReportWarning (GettextCatalog.GetString ( - "{0}({1}): Unsupported or unrecognized project : '{2}'. See logs.", - fileName, sec.Start + 1, projectPath)); - continue; - } - - if (projectPath.StartsWith("http://")) { - monitor.ReportWarning (GettextCatalog.GetString ( - "{0}({1}): Projects with non-local source (http://...) not supported. '{2}'.", - fileName, sec.Start + 1, projectPath)); - data.UnknownProjects.AddRange (lines.GetRange (sec.Start, sec.Count)); - continue; - } - - DotNetProject project = null; - string path = SlnMaker.MapPath (Path.GetDirectoryName (fileName), projectPath); - if (String.IsNullOrEmpty (path)) { - monitor.ReportWarning (GettextCatalog.GetString ( - "Invalid project path found in {0} : {1}", fileName, projectPath)); - LoggingService.LogWarning (GettextCatalog.GetString ( - "Invalid project path found in {0} : {1}", fileName, projectPath)); - - continue; - } - - projectPath = Path.GetFullPath (path); - try { - project = Services.ProjectService.ReadCombineEntry (projectPath, monitor) as DotNetProject; - if (project == null) { - LoggingService.LogError ("Internal Error: Didn't get the expected DotNetProject for {0} project.", - projectPath); - continue; - } - - MSBuildData msdata = Utils.GetMSBuildData (project); - entries [projectGuid] = project; - data.ProjectsByGuid [msdata.Guid] = project; - - msdata.Extra = lines.GetRange (sec.Start + 1, sec.Count - 2); - } catch (Exception e) { - LoggingService.LogError (GettextCatalog.GetString ( - "Error while trying to load the project {0}. Exception : {1}", - projectPath, e.ToString ())); - monitor.ReportWarning (GettextCatalog.GetString ( - "Error while trying to load the project {0}. Exception : {1}", projectPath, e.Message)); - - if (project == null) - data.UnknownProjects.AddRange (lines.GetRange (sec.Start, sec.Count)); - } - } - monitor.EndTask (); - - if (globals != null && globals.Contains ("NestedProjects")) { - LoadNestedProjects (globals ["NestedProjects"] as Section, lines, entries, monitor); - globals.Remove ("NestedProjects"); - } - - //Add top level folders and projects to the main combine - foreach (CombineEntry ce in entries.Values) { - if (ce.ParentCombine == null) - combine.Entries.Add (ce); - } - - //Resolve project references - List<ProjectReference> toRemove = new List<ProjectReference> (); - List<ProjectReference> toAdd = new List<ProjectReference> (); - foreach (Project p in combine.GetAllProjects ()) { - toRemove.Clear (); - toAdd.Clear (); - MSBuildData msbuildData = Utils.GetMSBuildData (p); - if (msbuildData == null) - continue; - - foreach (ProjectReference pref in p.ProjectReferences) { - if (pref.ReferenceType != ReferenceType.Project) - continue; - - Project rp = combine.FindProject (pref.Reference); - if (rp != null) - continue; - - //Unresolved - XmlElement elem = msbuildData.ProjectReferenceElements [pref]; - if (elem == null) - //Should not happen - continue; - - if (elem ["Project"] == null) - continue; - - string guid = elem ["Project"].InnerText.Trim (); - if (!data.ProjectsByGuid.ContainsKey (guid)) - continue; - - toRemove.Add (pref); - rp = data.ProjectsByGuid [guid]; - ProjectReference newRef = new ProjectReference (ReferenceType.Project, rp.Name); - toAdd.Add (newRef); - - XmlElement clonedElement = (XmlElement) elem.Clone (); - elem.ParentNode.InsertAfter (clonedElement, elem); - msbuildData.ProjectReferenceElements [newRef] = clonedElement; - } - - foreach (ProjectReference pref in toRemove) { - p.ProjectReferences.Remove (pref); - msbuildData.ProjectReferenceElements.Remove (pref); - } - - foreach (ProjectReference pref in toAdd) - p.ProjectReferences.Add (pref); - } - - //FIXME: This can be just SolutionConfiguration also! - if (globals != null) { - if (globals.Contains ("SolutionConfigurationPlatforms")) { - LoadSolutionConfigurations (globals ["SolutionConfigurationPlatforms"] as Section, lines, - combine, monitor); - globals.Remove ("SolutionConfigurationPlatforms"); - } - - if (globals.Contains ("ProjectConfigurationPlatforms")) { - LoadProjectConfigurationMappings (globals ["ProjectConfigurationPlatforms"] as Section, lines, - combine, monitor); - globals.Remove ("ProjectConfigurationPlatforms"); - } - } - - //Save the global sections that we dont use - List<string> globalLines = new List<string> (); - foreach (Section sec in globals.Values) - globalLines.InsertRange (globalLines.Count, lines.GetRange (sec.Start, sec.Count)); - - data.GlobalExtra = globalLines; - monitor.EndTask (); - return combine; - } - - void ParseGlobal (StreamReader reader, List<string> lines, ListDictionary dict) - { - //Process GlobalSection-s - while (reader.Peek () >= 0) { - string s = GetNextLine (reader, lines).Trim (); - if (s.Length == 0) - //Skip blank lines - continue; - - Match m = GlobalSectionRegex.Match (s); - if (!m.Success) { - if (String.Compare (s, "EndGlobal", true) == 0) - return; - - continue; - } - - Section sec = new Section (m.Groups [1].Value, m.Groups [2].Value, lines.Count - 1, 1); - dict [sec.Key] = sec; - - sec.Count = ReadUntil ("EndGlobalSection", reader, lines) - sec.Start + 1; - //FIXME: sec.Count == -1 : No EndGlobalSection found, ignore entry? - } - } - - void LoadProjectConfigurationMappings (Section sec, List<string> lines, Combine sln, IProgressMonitor monitor) - { - if (sec == null || String.Compare (sec.Val, "postSolution", true) != 0) - return; - - List<CombineConfigurationEntry> noBuildList = new List<CombineConfigurationEntry> (); - Dictionary<string, CombineConfigurationEntry> cache = new Dictionary<string, CombineConfigurationEntry> (); - Dictionary<string, string> ignoredProjects = new Dictionary<string, string> (); - SlnData slnData = GetSlnData (sln); - - List<string> extras = new List<string> (); - - for (int i = 0; i < sec.Count - 2; i ++) { - int lineNum = i + sec.Start + 1; - string s = lines [lineNum].Trim (); - extras.Add (s); - - //Format: - // {projectGuid}.SolutionConfigName|SolutionPlatform.ActiveCfg = ProjConfigName|ProjPlatform - // {projectGuid}.SolutionConfigName|SolutionPlatform.Build.0 = ProjConfigName|ProjPlatform - - string [] parts = s.Split (new char [] {'='}, 2); - if (parts.Length < 2) { - LoggingService.LogDebug ("{0} ({1}) : Invalid format. Ignoring", sln.FileName, lineNum + 1); - continue; - } - - string action; - string projConfig = parts [1].Trim (); - - string left = parts [0].Trim (); - if (left.EndsWith (".ActiveCfg")) { - action = "ActiveCfg"; - left = left.Substring (0, left.Length - 10); - } else if (left.EndsWith (".Build.0")) { - action = "Build.0"; - left = left.Substring (0, left.Length - 8); - } else { - LoggingService.LogWarning (GettextCatalog.GetString ("{0} ({1}) : Unknown action. Only ActiveCfg & Build.0 supported.", - sln.FileName, lineNum + 1)); - continue; - } - - string [] t = left.Split (new char [] {'.'}, 2); - if (t.Length < 2) { - LoggingService.LogDebug ("{0} ({1}) : Invalid format of the left side. Ignoring", - sln.FileName, lineNum + 1); - continue; - } - - string projGuid = t [0]; - string slnConfig = t [1]; - - if (!slnData.ProjectsByGuid.ContainsKey (projGuid)) { - if (ignoredProjects.ContainsKey (projGuid)) - // already warned - continue; - - LoggingService.LogWarning (GettextCatalog.GetString ("{0} ({1}) : Project with guid = '{2}' not found or not loaded. Ignoring", - sln.FileName, lineNum + 1, projGuid)); - ignoredProjects [projGuid] = projGuid; - continue; - } - - DotNetProject project = slnData.ProjectsByGuid [projGuid]; - - string key = projGuid + "." + slnConfig; - CombineConfigurationEntry combineConfigEntry = null; - if (cache.ContainsKey (key)) { - combineConfigEntry = cache [key]; - } else { - combineConfigEntry = GetConfigEntryForProject (sln, slnConfig, project); - cache [key] = combineConfigEntry; - } - - /* If both ActiveCfg & Build.0 entries are missing - * for a project, then default values : - * ActiveCfg : same as the solution config - * Build : true - * - * ELSE - * if Build (true/false) for the project will - * will depend on presence/absence of Build.0 entry - */ - if (String.Compare (action, "ActiveCfg", false) == 0) { - combineConfigEntry.ConfigurationName = projConfig; - noBuildList.Add (combineConfigEntry); - } else if (String.Compare (action, "Build.0", false) == 0) { - noBuildList.Remove (combineConfigEntry); - } - - extras.RemoveAt (extras.Count - 1); - } - - slnData.SectionExtras ["ProjectConfigurationPlatforms"] = extras; - - foreach (CombineConfigurationEntry e in noBuildList) { - //Mark (build=false) of all projects for which - //ActiveCfg was found but no Build.0 - e.Build = false; - } - } - - /* Finds a CombineConfigurationEntry corresponding to the @configName for a project (@projectName) - * in @combine */ - CombineConfigurationEntry GetConfigEntryForProject (Combine combine, string configName, Project project) - { - if (project.ParentCombine == null) - throw new Exception (String.Format ( - "INTERNAL ERROR: project {0} is not part of any combine", project.Name)); - - CombineConfigurationEntry ret = GetConfigEntry (project, configName); - - //Ensure the corresponding entries exist all the way - //upto the RootCombine - Combine parent = project.ParentCombine; - while (!parent.IsRoot && parent.ParentCombine != null) { - CombineConfigurationEntry p = GetConfigEntry (parent, configName); - if (p.ConfigurationName != configName) - p.ConfigurationName = configName; - parent = parent.ParentCombine; - } - - return ret; - } - - /* Gets the CombineConfigurationEntry corresponding to the @entry in its parentCombine's - * CombineConfiguration. Creates the required bits if not present */ - CombineConfigurationEntry GetConfigEntry (CombineEntry entry, string configName) - { - Combine parent = entry.ParentCombine; - CombineConfiguration combineConfig = parent.GetConfiguration (configName) as CombineConfiguration; - if (combineConfig == null) { - combineConfig = (CombineConfiguration) parent.CreateConfiguration (configName); - parent.Configurations.Add (combineConfig); - } - - foreach (CombineConfigurationEntry cce in combineConfig.Entries) { - if (cce.Entry == entry) - return cce; - } - - return combineConfig.AddEntry (entry); - } - - void LoadSolutionConfigurations (Section sec, List<string> lines, Combine combine, IProgressMonitor monitor) - { - if (sec == null || String.Compare (sec.Val, "preSolution", true) != 0) - return; - - for (int i = 0; i < sec.Count - 2; i ++) { - //FIXME: expects both key and val to be on the same line - int lineNum = i + sec.Start + 1; - string s = lines [lineNum].Trim (); - if (s.Length == 0) - //Skip blank lines - continue; - - KeyValuePair<string, string> pair = SplitKeyValue (s); - - if (pair.Key.IndexOf ('|') < 0) { - //Config must of the form ConfigName|Platform - LoggingService.LogError (GettextCatalog.GetString ("{0} ({1}) : Invalid config name '{2}'", combine.FileName, lineNum + 1, pair.Key)); - continue; - } - - CombineConfiguration config = (CombineConfiguration) - combine.GetConfiguration (pair.Key); - - if (config == null) { - config = (CombineConfiguration) - combine.CreateConfiguration (pair.Key); - combine.Configurations.Add (config); - } - } - } - - void LoadNestedProjects (Section sec, List<string> lines, - Dictionary<string, CombineEntry> entries, IProgressMonitor monitor) - { - if (sec == null || String.Compare (sec.Val, "preSolution", true) != 0) - return; - - for (int i = 0; i < sec.Count - 2; i ++) { - KeyValuePair<string, string> pair = SplitKeyValue (lines [i + sec.Start + 1].Trim ()); - - if (!entries.ContainsKey (pair.Value)) { - //Container not found - LoggingService.LogWarning (GettextCatalog.GetString ("Project with guid '{0}' not found.", pair.Value)); - continue; - } - - if (!entries.ContainsKey (pair.Key)) { - //Containee not found - LoggingService.LogWarning (GettextCatalog.GetString ("Project with guid '{0}' not found.", pair.Key)); - continue; - } - - Combine folder = entries [pair.Value] as Combine; - if (folder == null) - continue; - - folder.Entries.Add (entries [pair.Key]); - } - } - - string GetNextLine (StreamReader reader, List<string> list) - { - if (reader.Peek () < 0) - return null; - - string ret = reader.ReadLine (); - list.Add (ret); - return ret; - } - - int ReadUntil (string end, StreamReader reader, List<string> lines) - { - int ret = -1; - while (reader.Peek () >= 0) { - string s = GetNextLine (reader, lines); - - if (String.Compare (s.Trim (), end, true) == 0) - return (lines.Count - 1); - } - - return ret; - } - - - KeyValuePair<string, string> SplitKeyValue (string s) - { - string [] pair = s.Split (new char [] {'='}, 2); - string key = pair [0].Trim (); - string val = String.Empty; - if (pair.Length == 2) - val = pair [1].Trim (); - - return new KeyValuePair<string, string> (key, val); - } - - // Utility function to determine the sln file version - string GetSlnFileVersion(string strInSlnFile, out string headerComment) - { - string strVersion = null; - string strInput = null; - headerComment = null; - Match match; - StreamReader reader = new StreamReader(strInSlnFile); - - strInput = reader.ReadLine(); - if (strInput == null) - return null; - - match = SlnVersionRegex.Match(strInput); - if (!match.Success) { - strInput = reader.ReadLine(); - if (strInput == null) - return null; - match = SlnVersionRegex.Match (strInput); - } - - if (match.Success) - { - strVersion = match.Groups[1].Value; - headerComment = reader.ReadLine (); - } - - // Close the stream - reader.Close(); - - return strVersion; - } - - static SlnData GetSlnData (CombineEntry entry) - { - if (entry.ExtendedProperties.Contains (typeof (SlnFileFormat))) - return entry.ExtendedProperties [typeof (SlnFileFormat)] as SlnData; - return null; - } - - // Event handlers - public static void HandleAddEntry (object s, AddEntryEventArgs args) - { - if (GetSlnData (args.Combine) == null) - return; - - IFileFormat msformat = new MSBuildFileFormat (); - - if (!msformat.CanReadFile (args.FileName)) { - MonoDevelop.Core.Gui.AlertButton convertButton = new MonoDevelop.Core.Gui.AlertButton ("C_onvert"); - if (MonoDevelop.Core.Gui.MessageService.AskQuestion (GettextCatalog.GetString ("The project file {0} must be converted to msbuild format to be added to a msbuild solution", args.FileName), MonoDevelop.Core.Gui.AlertButton.Cancel, convertButton) != convertButton) { - args.Cancel = true; - return; - } - } else { - // vs2005 solution/project - return; - } - - IProgressMonitor monitor = new NullProgressMonitor (); - IFileFormat slnff = new VS2003SlnFileFormat (); - IFileFormat prjff = new VS2003ProjectFileFormat (); - - if (slnff.CanReadFile (args.FileName)) { - // VS2003 solution - Combine c = VS2003SlnFileFormat.ImportSlnAsMSBuild (args.FileName); - c.Save (monitor); - - args.FileName = c.FileName; - } else if (prjff.CanReadFile (args.FileName)) { - // VS2003 project - - DotNetProject proj = VS2003ProjectFileFormat.ImportCsprojAsMSBuild (args.FileName); - args.FileName = proj.FileName; - } else { - CombineEntry ce = Services.ProjectService.ReadCombineEntry (args.FileName, monitor); - ConvertToMSBuild (ce); - args.FileName = ce.FileName; - ce.Save (monitor); - } - } - - internal static void SetHandlers (Combine combine, bool setEntries) - { - if (setEntries) { - foreach (CombineEntry ce in combine.Entries) { - Combine c = ce as Combine; - if (c == null) - continue; - - SetHandlers (c, setEntries); - } - } - - combine.EntryAdded += HandleCombineEntryAdded; - } - - static void HandleCombineEntryAdded (object sender, CombineEntryEventArgs e) - { - try { - // ReadFile for Sln/MSBuildFileFormat set the handlers - ConvertToMSBuild (e.CombineEntry); - - Combine rootSln = e.CombineEntry.RootCombine; - SlnData rootSlnData = GetSlnData (rootSln); - SlnData slnData = GetSlnData (e.CombineEntry); - if (slnData != null) { - foreach (KeyValuePair<string, DotNetProject> pair in slnData.ProjectsByGuid) - rootSlnData.ProjectsByGuid [pair.Key] = pair.Value; - } else { - //Add guid for the new project - MSBuildData msdata = Utils.GetMSBuildData (e.CombineEntry); - DotNetProject project = e.CombineEntry as DotNetProject; - if (project != null && msdata != null) - //msbuild project - rootSlnData.ProjectsByGuid [msdata.Guid] = project; - } - - //FIXME: Can't call this now as we don't extend Combine :/ - //rootSln.NotifyModified (); - //Need some other solution, for now, hack - - rootSln.FileName = rootSln.FileName; - } catch (Exception ex) { - LoggingService.LogDebug ("HandleCombineEntryAdded : {0}", ex); - } - } - - internal static void ConvertToMSBuild (CombineEntry ce) - { - MSBuildFileFormat msformat = new MSBuildFileFormat (); - if (!msformat.CanReadFile (ce.FileName)) { - // Convert - ce.FileFormat = msformat; - ce.FileName = msformat.GetValidFormatName (ce, ce.FileName); - - // Save will create the required SlnData, MSBuildData - // objects, create the new guids for the projects _and_ the - // solution folders - ce.Save (new NullProgressMonitor ()); - // Writing out again might be required to fix - // project references which have changed (filenames - // changed due to the conversion) - } - } - - // static regexes - static Regex projectRegex = null; - internal static Regex ProjectRegex { - get { - if (projectRegex == null) - projectRegex = new Regex(@"Project\(""(\{[^}]*\})""\) = ""(.*)"", ""(.*)"", ""(\{[^{]*\})"""); - return projectRegex; - } - } - - static Regex globalSectionRegex = null; - static Regex GlobalSectionRegex { - get { - if (globalSectionRegex == null) - globalSectionRegex = new Regex (@"GlobalSection\s*\(([^)]*)\)\s*=\s*(\w*)"); - return globalSectionRegex; - } - } - - static Regex slnVersionRegex = null; - internal static Regex SlnVersionRegex { - get { - if (slnVersionRegex == null) - slnVersionRegex = new Regex (@"Microsoft Visual Studio Solution File, Format Version (\d?\d.\d\d)"); - return slnVersionRegex; - } - } - - } - - class Section { - public string Key; - public string Val; - - public int Start = -1; //Line number - public int Count = 0; - - public Section () - { - } - - public Section (string Key, string Val, int Start, int Count) - { - this.Key = Key; - this.Val = Val; - this.Start = Start; - this.Count = Count; - } - } - - class SolutionFolder : Combine { - public override bool NeedsReload { - get { return false; } - } - } - -} diff --git a/main/src/addins/prj2make-sharp-lib/Utils.cs b/main/src/addins/prj2make-sharp-lib/Utils.cs deleted file mode 100644 index 9411ee1c72..0000000000 --- a/main/src/addins/prj2make-sharp-lib/Utils.cs +++ /dev/null @@ -1,360 +0,0 @@ -// -// Utils.cs -// -// Author: -// Ankit Jain <jankit@novell.com> -// -// Copyright (C) 2007 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using MonoDevelop.Core; -using MonoDevelop.Projects; - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Text; -using System.Xml; -using System.Xml.XPath; - -namespace MonoDevelop.Prj2Make -{ - public static class Utils - { - public const string ns = "http://schemas.microsoft.com/developer/msbuild/2003"; - - public static string GetValidPath (IProgressMonitor monitor, string basePath, string relPath) - { - string path = MapAndResolvePath (basePath, relPath); - if (path != null) - return path; - - LoggingService.LogWarning (GettextCatalog.GetString ("File name '{0}' is invalid. Ignoring.", relPath)); - monitor.ReportWarning (GettextCatalog.GetString ("File name '{0}' is invalid. Ignoring.", relPath)); - return null; - } - - public static XmlNode MoveToChild (XmlNode node, string localName) - { - if (!node.HasChildNodes) - return null; - - foreach (XmlNode n in node.ChildNodes) - if (n.LocalName == localName) - return n; - - return null; - } - - public static void RemoveChild (XmlNode parent, string localName) - { - XmlNode child = MoveToChild (parent, localName); - if (child != null) - parent.RemoveChild (child); - } - - public static void EnsureChildValue (XmlNode node, string localName, bool val) - { - EnsureChildValue (node, localName, val.ToString ().ToLower ()); - } - - public static void EnsureChildValue (XmlNode node, string localName, object val) - { - XmlNode n = MoveToChild (node, localName); - if (n == null) { - //Child not found, create it - XmlElement e = node.OwnerDocument.CreateElement (localName, ns); - e.InnerText = val.ToString (); - - node.AppendChild (e); - } else { - n.InnerText = val.ToString (); - } - } - - public static bool ReadAsString (XmlNode node, string localName, ref string val, bool allowEmpty) - { - //Assumption: Number of child nodes is small enough - //that xpath query would be more expensive than - //linear traversal - if (node == null || !node.HasChildNodes) - return false; - - foreach (XmlNode n in node.ChildNodes) { - //Case sensitive compare - if (n.LocalName != localName) - continue; - - //FIXME: Use XmlChar.WhitespaceChars ? - string s= n.InnerText.Trim (); - if (s.Length == 0 && !allowEmpty) - return false; - - val = s; - return true; - } - - return false; - } - - public static bool ReadAsString (XPathNavigator nav, string localName, ref string val, bool allowEmpty) - { - if (!nav.MoveToChild (localName, ns)) - return false; - - //FIXME: Use XmlChar.WhitespaceChars ? - string s = nav.Value.Trim (); - nav.MoveToParent (); - - if (s.Length == 0 && !allowEmpty) - return false; - - val = s; - return true; - } - - public static bool ReadAsBool (XPathNavigator nav, string localName, ref bool val) - { - string str = String.Empty; - if (!ReadAsString (nav, localName, ref str, false)) - return false; - - switch (str.ToUpper ()) { - case "TRUE": - val = true; - break; - case "FALSE": - val = false; - break; - default: - return false; - } - - return true; - } - - public static bool ReadOffOnAsBool (XPathNavigator nav, string localName, ref bool val) - { - string str = String.Empty; - if (!ReadAsString (nav, localName, ref str, false)) - return false; - - switch (str.ToUpper ()) { - case "ON": - val = true; - break; - case "OFF": - val = false; - break; - default: - return false; - } - - return true; - } - - public static bool ReadAsInt (XPathNavigator nav, string localName, ref int val) - { - if (!nav.MoveToChild (localName, ns)) - return false; - - try { - val = nav.ValueAsInt; - } catch { - return false; - } finally { - nav.MoveToParent (); - } - - return true; - } - - public static bool ReadAsInt (XmlNode node, string localName, ref int val) - { - string str_tmp = null; - if (!ReadAsString (node, localName, ref str_tmp, false)) - return false; - - try { - val = Int32.Parse (str_tmp); - } catch (FormatException) { - return false; - } catch (OverflowException) { - return false; - } - - return true; - } - - //Creates a <localName>Value</localName> - public static XmlElement AppendChild (XmlElement e, string localName, string value) - { - XmlElement elem = e.OwnerDocument.CreateElement (localName, ns); - elem.InnerText = value; - e.AppendChild (elem); - - return elem; - } - - public static XmlElement GetXmlElement (XmlDocument doc, XmlNode node, string path, bool create) - { - XmlNode parent = node; - foreach (string name in path.Split (new char [] {'/'}, StringSplitOptions.RemoveEmptyEntries)) { - XmlNode n = MoveToChild (parent, name); - if (n == null) { - if (!create) - return null; - n = parent.AppendChild (doc.CreateElement (name, ns)); - } - parent = n; - } - - return (XmlElement) parent; - } - - public static string MapAndResolvePath (string basePath, string relPath) - { - return SlnMaker.MapPath (basePath, relPath); - } - - public static string CanonicalizePath (string path) - { - if (String.IsNullOrEmpty (path)) - return path; - - string ret = FileService.NormalizeRelativePath (path); - if (ret.Length == 0) - return "."; - - return Escape (ret).Replace ('/', '\\'); - } - - static char [] charToEscapeArray = {'$', '%', '\'', '(', ')', '*', ';', '?', '@'}; - static string charsToEscapeString = "$%'()*;?@"; - - // Escape and Unescape taken from : class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Utilities.cs - public static string Escape (string unescapedExpression) - { - if (unescapedExpression.IndexOfAny (charToEscapeArray) < 0) - return unescapedExpression; - - StringBuilder sb = new StringBuilder (); - - foreach (char c in unescapedExpression) { - if (charsToEscapeString.IndexOf (c) < 0) - sb.Append (c); - else - sb.AppendFormat ("%{0:x2}", (int) c); - } - - return sb.ToString (); - } - - public static string Unescape (string escapedExpression) - { - if (escapedExpression.IndexOf ('%') < 0) - return escapedExpression; - - StringBuilder sb = new StringBuilder (); - - int i = 0; - while (i < escapedExpression.Length) { - sb.Append (Uri.HexUnescape (escapedExpression, ref i)); - } - - return sb.ToString (); - } - - public static MSBuildData GetMSBuildData (CombineEntry entry) - { - if (entry.ExtendedProperties.Contains (typeof (MSBuildFileFormat))) - return entry.ExtendedProperties [typeof (MSBuildFileFormat)] as MSBuildData; - return null; - } - - public static string GetLanguage (string fileName) - { - foreach (MSBuildProjectExtension extn in MSBuildFileFormat.Extensions) { - if (extn.IsLanguage && extn.Supports (null, fileName, null)) - return extn.LanguageId; - } - - return null; - } - - //Given a filename like foo.it.resx, splits it into - foo, it, resx - //Returns true only if a valid culture is found - //Note: hand-written as this can get called lotsa times - //Note: code duplicated in DotNetProject.GetCulture - public static bool TrySplitResourceName (string fname, out string only_filename, out string culture, out string extn) - { - only_filename = culture = extn = null; - - int last_dot = -1; - int culture_dot = -1; - int i = fname.Length - 1; - while (i >= 0) { - if (fname [i] == '.') { - last_dot = i; - break; - } - i --; - } - if (i < 0) - return false; - - i--; - while (i >= 0) { - if (fname [i] == '.') { - culture_dot = i; - break; - } - i --; - } - if (culture_dot < 0) - return false; - - culture = fname.Substring (culture_dot + 1, last_dot - culture_dot - 1); - if (!CultureNamesTable.ContainsKey (culture)) - return false; - - only_filename = fname.Substring (0, culture_dot); - extn = fname.Substring (last_dot + 1); - return true; - } - - static Dictionary<string, string> cultureNamesTable; - static Dictionary<string, string> CultureNamesTable { - get { - if (cultureNamesTable == null) { - cultureNamesTable = new Dictionary<string, string> (); - foreach (CultureInfo ci in CultureInfo.GetCultures (CultureTypes.AllCultures)) - cultureNamesTable [ci.Name] = ci.Name; - } - - return cultureNamesTable; - } - } - - } -} diff --git a/main/src/addins/prj2make-sharp-lib/VBNetMSBuildProjectExtension.cs b/main/src/addins/prj2make-sharp-lib/VBNetMSBuildProjectExtension.cs deleted file mode 100644 index ff6b4b0deb..0000000000 --- a/main/src/addins/prj2make-sharp-lib/VBNetMSBuildProjectExtension.cs +++ /dev/null @@ -1,207 +0,0 @@ -// -// VBNetMSBuildProjectExtension.cs -// -// Author: -// Ankit Jain <jankit@novell.com> -// -// Copyright (C) 2007 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using MonoDevelop.Core; -using MonoDevelop.Projects; -using VBBinding; - -using System; -using System.IO; -using System.Text; -using System.Xml; -using System.Xml.XPath; - -namespace MonoDevelop.Prj2Make -{ - - public class VBNetMSBuildProjectExtension : MSBuildProjectExtension - { - const string myguid = "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}"; - - public override string TypeGuid { - get { return myguid; } - } - - public override string Name { - get { return "VBNet";} - } - - public override bool IsLanguage { - get { return true; } - } - - public override string LanguageId { - get { return "VBNet"; } - } - - public override bool Supports (string type_guid, string filename, string type_guids) - { - if (String.IsNullOrEmpty (type_guid)) { - if (Path.GetExtension (filename) == ".vbproj") - return true; - } else { - if (String.Compare (type_guid, myguid, true) == 0) - return true; - } - return false; - //FIXME: else look at the type_guids string, like "asp_guid;c#_guid" - } - - public override DotNetProject CreateProject (string type_guid, string filename, string type_guids) - { - if (!Supports (type_guid, filename, type_guids)) - throw new InvalidOperationException (String.Format ("Project of type guid = {0} not supported by this extension.", type_guid)); - - return new DotNetProject ("VBNet"); - } - - public override void ReadConfig (DotNetProject project, DotNetProjectConfiguration config, XPathNavigator nav, string basePath, IProgressMonitor monitor) - { - base.ReadConfig (project, config, nav, basePath, monitor); - - if (project.LanguageName != "VBNet") - // FIXME: extension list must be wrong, error! - return; - - VBCompilerParameters vbparams = (VBCompilerParameters) config.CompilationParameters; - - bool bool_tmp = false; - string str_tmp = String.Empty; - int int_tmp = 0; - - if (Utils.ReadAsString (nav, "RootNamespace", ref str_tmp, false)) - vbparams.RootNamespace = str_tmp; - - if (Utils.ReadAsBool (nav, "AllowUnsafeBlocks", ref bool_tmp)) - vbparams.UnsafeCode = bool_tmp; - - if (Utils.ReadAsBool (nav, "Optimize", ref bool_tmp)) - vbparams.Optimize = bool_tmp; - - if (Utils.ReadAsBool (nav, "CheckForOverflowUnderflow", ref bool_tmp)) - vbparams.GenerateOverflowChecks = bool_tmp; - - if (Utils.ReadAsString (nav, "DefineConstants", ref str_tmp, true)) - vbparams.DefineSymbols = str_tmp; - - if (Utils.ReadAsInt (nav, "WarningLevel", ref int_tmp)) - vbparams.WarningLevel = int_tmp; - - if (Utils.ReadOffOnAsBool (nav, "OptionExplicit", ref bool_tmp)) - vbparams.OptionExplicit = bool_tmp; - - if (Utils.ReadOffOnAsBool (nav, "OptionStrict", ref bool_tmp)) - vbparams.OptionStrict = bool_tmp; - - if (Utils.ReadAsString (nav, "ApplicationIcon", ref str_tmp, false)) { - string resolvedPath = Utils.MapAndResolvePath (basePath, str_tmp); - if (resolvedPath != null) - vbparams.Win32Icon = Utils.Unescape (resolvedPath); - } - - if (Utils.ReadAsString (nav, "Win32Resource", ref str_tmp, false)) { - string resolvedPath = Utils.MapAndResolvePath (basePath, str_tmp); - if (resolvedPath != null) - vbparams.Win32Resource = Utils.Unescape (resolvedPath); - } - //FIXME: OptionCompare, add support to VBnet binding, params etc - } - - StringBuilder importsBuilder = null; - public override void ReadItemGroups (MSBuildData data, DotNetProject project, DotNetProjectConfiguration globalConfig, string basePath, IProgressMonitor monitor) - { - importsBuilder = new StringBuilder (); - base.ReadItemGroups (data, project, globalConfig, basePath, monitor); - - if (importsBuilder.Length > 0) { - importsBuilder.Length --; - VBCompilerParameters vbparams = (VBCompilerParameters) globalConfig.CompilationParameters; - vbparams.Imports = importsBuilder.ToString (); - } - importsBuilder = null; - } - - public override void ReadItemGroup (MSBuildData data, DotNetProject project, DotNetProjectConfiguration globalConfig, string include, string basePath, XmlNode node, IProgressMonitor monitor) - { - if (node.LocalName == "Import") { - importsBuilder.AppendFormat ("{0},", include); - } else { - base.ReadItemGroup (data, project, globalConfig, include, basePath, node, monitor); - } - } - - public override void WriteConfig (DotNetProject project, DotNetProjectConfiguration config, XmlElement configElement, IProgressMonitor monitor) - { - base.WriteConfig (project, config, configElement, monitor); - - VBCompilerParameters vbparams = - (VBCompilerParameters) config.CompilationParameters; - - Utils.EnsureChildValue (configElement, "RootNamespace", vbparams.RootNamespace); - Utils.EnsureChildValue (configElement, "AllowUnsafeBlocks", vbparams.UnsafeCode); - Utils.EnsureChildValue (configElement, "Optimize", vbparams.Optimize); - Utils.EnsureChildValue (configElement, "CheckForOverflowUnderflow", vbparams.GenerateOverflowChecks); - Utils.EnsureChildValue (configElement, "DefineConstants", vbparams.DefineSymbols); - Utils.EnsureChildValue (configElement, "WarningLevel", vbparams.WarningLevel); - Utils.EnsureChildValue (configElement, "OptionExplicit", vbparams.OptionExplicit ? "On" : "Off"); - Utils.EnsureChildValue (configElement, "OptionStrict", vbparams.OptionStrict ? "On" : "Off"); - if (vbparams.Win32Icon != null && vbparams.Win32Icon.Length > 0) - Utils.EnsureChildValue (configElement, "ApplicationIcon", - Utils.CanonicalizePath (FileService.AbsoluteToRelativePath ( - project.BaseDirectory, vbparams.Win32Icon))); - - if (vbparams.Win32Resource != null && vbparams.Win32Resource.Length > 0) - Utils.EnsureChildValue (configElement, "Win32Resource", - Utils.CanonicalizePath (FileService.AbsoluteToRelativePath ( - project.BaseDirectory, vbparams.Win32Resource))); - - //FIXME: VB.net Imports - } - - public override void OnFinishWrite (MSBuildData data, DotNetProject project) - { - base.OnFinishWrite (data, project); - if (Utils.GetMSBuildData (project) != null) - // existing project file - return; - - XmlElement elem = data.Document.CreateElement ("Import", Utils.ns); - data.Document.DocumentElement.InsertAfter (elem, data.Document.DocumentElement.LastChild); - elem.SetAttribute ("Project", @"$(MSBuildBinPath)\Microsoft.VisualBasic.targets"); - } - - public override string GetGuidChain (DotNetProject project) - { - if (project.GetType () != typeof (DotNetProject) || project.LanguageName != "VBNet") - return null; - - return myguid; - } - - } -} diff --git a/main/src/addins/prj2make-sharp-lib/VS2003ProjectFileFormat.cs b/main/src/addins/prj2make-sharp-lib/VS2003ProjectFileFormat.cs index fbf0537ff3..b7c76dd06f 100644 --- a/main/src/addins/prj2make-sharp-lib/VS2003ProjectFileFormat.cs +++ b/main/src/addins/prj2make-sharp-lib/VS2003ProjectFileFormat.cs @@ -27,14 +27,17 @@ // using MonoDevelop.Core; +using MonoDevelop.Core.ProgressMonitoring; using MonoDevelop.Core.Gui; using MonoDevelop.Ide.Gui; using MonoDevelop.Projects; using System; +using System.Collections.Generic; using System.IO; using System.Text.RegularExpressions; using System.Xml; +using MonoDevelop.Projects.Extensions; namespace MonoDevelop.Prj2Make { @@ -45,7 +48,7 @@ namespace MonoDevelop.Prj2Make } public string Name { - get { return "VS2003 project"; } + get { return "Visual Studio 2003"; } } public string GetValidFormatName (object obj, string fileName) @@ -53,13 +56,21 @@ namespace MonoDevelop.Prj2Make return fileName; } - public bool CanReadFile (string file) + public bool CanReadFile (string file, Type expectedObjectType) { + if (expectedObjectType.IsAssignableFrom (typeof(Solution)) && String.Compare (Path.GetExtension (file), ".sln", true) == 0) { + string ver = GetSlnFileVersion (file); + if (ver == "7.00" || ver == "8.00") + return true; + } + + if (!expectedObjectType.IsAssignableFrom (typeof(DotNetProject))) + return false; + if (String.Compare (Path.GetExtension (file), ".csproj", true) != 0 && String.Compare (Path.GetExtension (file), ".vbproj", true) != 0) return false; - //FIXME: Need a better way to check the rootelement try { using (XmlReader xr = XmlReader.Create (file)) { xr.MoveToContent (); @@ -82,13 +93,15 @@ namespace MonoDevelop.Prj2Make { } - public System.Collections.Specialized.StringCollection GetExportFiles (object obj) + public object ReadFile (string file, Type expectedType, IProgressMonitor monitor) { - return null; + if (expectedType.IsAssignableFrom (typeof(DotNetProject))) + return ReadProjectFile (file, monitor); + else + return ReadSolutionFile (file, monitor); } - - //Reader - public object ReadFile (string fileName, IProgressMonitor monitor) + + public object ReadProjectFile (string fileName, IProgressMonitor monitor) { //if (!CanReadFile (fileName)) @@ -107,7 +120,7 @@ namespace MonoDevelop.Prj2Make // Convert to VS2005 project project = ImportCsprojAsMSBuild (fileName); // Re-read to get a MSBuildProject object - project = IdeApp.Services.ProjectService.ReadCombineEntry (project.FileName, monitor) as DotNetProject; + project = IdeApp.Services.ProjectService.ReadSolutionItem (monitor, project.FileName) as DotNetProject; } else { throw new InvalidOperationException ("VS2003 projects are not supported natively."); } @@ -115,6 +128,41 @@ namespace MonoDevelop.Prj2Make return project; } + public object ReadSolutionFile (string fileName, IProgressMonitor monitor) + { + //if (!CanReadFile (fileName)) + + AlertButton choice; + AlertButton monodevelop = new AlertButton ("MonoDevelop"); + AlertButton vs2005 = new AlertButton ("VS2005"); + if (IdeApp.Services == null) { + // HACK, for mdtool + choice = null; + } else { + choice = MessageService.AskQuestion (GettextCatalog.GetString ("The solution file {0} is a VS2003 solution. It must be converted to either a MonoDevelop or a VS2005 solution", fileName), + GettextCatalog.GetString ("Converting to VS2005 format will overwrite existing files."), + AlertButton.Cancel, vs2005, monodevelop); + } + + + Solution solution = null; + if (choice == monodevelop) { + // Convert to MD solution + solution = ImportSln (fileName, true); + } else if (choice == vs2005) { + // Convert to vs2005 solution + solution = ImportSlnAsMSBuild (fileName); + solution.Save (monitor); + + // Re-read to get a MSBuildSolution object + solution = MonoDevelop.Projects.Services.ProjectService.ReadWorkspaceItem (monitor, solution.FileName) as Solution; + } else { + throw new InvalidOperationException ("VS2003 solutions are not supported natively."); + } + + return solution; + } + internal static DotNetProject ImportCsproj (string fileName, bool save) { DotNetProject project = null; @@ -137,8 +185,79 @@ namespace MonoDevelop.Prj2Make DotNetProject project = ImportCsproj (fileName, false); // ConvertToMSBuild saves the project for mdp - SlnFileFormat.ConvertToMSBuild (project); +// SlnFileFormat.ConvertToMSBuild (project); return project as DotNetProject; } + + public void ConvertToFormat (object obj) + { + throw new NotSupportedException (); + } + + public List<string> GetItemFiles (object obj) + { + return new List<string> (); + } + + // Converts a vs2003 solution to a Combine object + internal static Solution ImportSln (string fileName, bool save) + { + SlnMaker slnmaker = new SlnMaker (); + Solution solution = null; + IProgressMonitor m; + if (IdeApp.Services == null) + m = new ConsoleProgressMonitor (); + else + m = new MonoDevelop.Core.Gui.ProgressMonitoring.MessageDialogProgressMonitor ( + true, false, true, false); + + try { + solution = slnmaker.MsSlnToCmbxHelper (fileName, m, save); + } catch (Exception e) { + LoggingService.LogError ("exception while converting : " + e.ToString ()); + throw; + } finally { + if (m != null) + m.Dispose (); + } + + return solution; + } + + // Does not save the final combine, useful when this converted + // combine will be used as a solution folder (saves an extra .sln from being created) + internal static Solution ImportSlnAsMSBuild (string fileName) + { + Solution solution = ImportSln (fileName, false); +// SlnFileFormat.ConvertToMSBuild (solution); + solution.Save (new NullProgressMonitor ()); + + return solution; + } + + // Utility function to determine the sln file version + string GetSlnFileVersion(string strInSlnFile) + { + string strVersion = null; + string strInput = null; + Match match; + StreamReader reader = new StreamReader(strInSlnFile); + strInput = reader.ReadLine(); + + match = SlnMaker.SlnVersionRegex.Match(strInput); + if (!match.Success) { + match = SlnMaker.SlnVersionRegex.Match (reader.ReadLine ()); + } + + if (match.Success) + { + strVersion = match.Groups[1].Value; + } + + // Close the stream + reader.Close(); + + return strVersion; + } } } diff --git a/main/src/addins/prj2make-sharp-lib/VS2003SlnFileFormat.cs b/main/src/addins/prj2make-sharp-lib/VS2003SlnFileFormat.cs deleted file mode 100644 index 2c0a8ea510..0000000000 --- a/main/src/addins/prj2make-sharp-lib/VS2003SlnFileFormat.cs +++ /dev/null @@ -1,179 +0,0 @@ -// -// VS2003SlnFileFormat.cs -// -// Author: -// Ankit Jain <jankit@novell.com> -// -// Copyright (C) 2007 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using MonoDevelop.Core; -using MonoDevelop.Core.Gui; -using MonoDevelop.Core.ProgressMonitoring; -using MonoDevelop.Ide.Gui; -using MonoDevelop.Projects; - -using System; -using System.IO; -using System.Text.RegularExpressions; - -namespace MonoDevelop.Prj2Make -{ - public class VS2003SlnFileFormat : IFileFormat - { - public VS2003SlnFileFormat () - { - } - - public string Name { - get { return "VS2003 solution"; } - } - - public string GetValidFormatName (object obj, string fileName) - { - return fileName; - } - - public bool CanReadFile (string file) - { - if (String.Compare (Path.GetExtension (file), ".sln", true) == 0) { - string ver = GetSlnFileVersion (file); - if (ver == "7.00" || ver == "8.00") - return true; - } - - return false; - } - - public bool CanWriteFile (object obj) - { - return false; - } - - public void WriteFile (string file, object node, IProgressMonitor monitor) - { - } - - public System.Collections.Specialized.StringCollection GetExportFiles (object obj) - { - return null; - } - - //Reader - public object ReadFile (string fileName, IProgressMonitor monitor) - { - //if (!CanReadFile (fileName)) - - AlertButton choice; - AlertButton monodevelop = new AlertButton ("MonoDevelop"); - AlertButton vs2005 = new AlertButton ("VS2005"); - if (IdeApp.Services == null) { - // HACK, for mdtool - choice = null; - } else { - choice = MessageService.AskQuestion (GettextCatalog.GetString ("The solution file {0} is a VS2003 solution. It must be converted to either a MonoDevelop or a VS2005 solution", fileName), - GettextCatalog.GetString ("Converting to VS2005 format will overwrite existing files."), - AlertButton.Cancel, vs2005, monodevelop); - } - - - Combine combine = null; - if (choice == monodevelop) { - // Convert to MD solution - combine = ImportSln (fileName, true); - } else if (choice == vs2005) { - // Convert to vs2005 solution - combine = ImportSlnAsMSBuild (fileName); - combine.Save (monitor); - - // Re-read to get a MSBuildSolution object - combine = MonoDevelop.Projects.Services.ProjectService.ReadCombineEntry (combine.FileName, monitor) as Combine; - } else { - throw new InvalidOperationException ("VS2003 solutions are not supported natively."); - } - - return combine; - } - - // Converts a vs2003 solution to a Combine object - internal static Combine ImportSln (string fileName, bool save) - { - SlnMaker slnmaker = new SlnMaker (); - Combine combine = null; - IProgressMonitor m; - if (IdeApp.Services == null) - m = new ConsoleProgressMonitor (); - else - m = new MonoDevelop.Core.Gui.ProgressMonitoring.MessageDialogProgressMonitor ( - true, false, true, false); - - try { - combine = slnmaker.MsSlnToCmbxHelper (fileName, m, save); - } catch (Exception e) { - LoggingService.LogError ("exception while converting : " + e.ToString ()); - throw; - } finally { - if (m != null) - m.Dispose (); - } - - return combine; - } - - // Does not save the final combine, useful when this converted - // combine will be used as a solution folder (saves an extra .sln from being created) - internal static Combine ImportSlnAsMSBuild (string fileName) - { - Combine combine = ImportSln (fileName, false); - SlnFileFormat.ConvertToMSBuild (combine); - combine.Save (new NullProgressMonitor ()); - - return combine; - } - - // Utility function to determine the sln file version - string GetSlnFileVersion(string strInSlnFile) - { - string strVersion = null; - string strInput = null; - Match match; - StreamReader reader = new StreamReader(strInSlnFile); - strInput = reader.ReadLine(); - - match = SlnFileFormat.SlnVersionRegex.Match(strInput); - if (!match.Success) { - match = SlnFileFormat.SlnVersionRegex.Match (reader.ReadLine ()); - } - - if (match.Success) - { - strVersion = match.Groups[1].Value; - } - - // Close the stream - reader.Close(); - - return strVersion; - } - - } -} diff --git a/main/src/addins/prj2make-sharp-lib/prj2make-sharp-lib.mdp b/main/src/addins/prj2make-sharp-lib/prj2make-sharp-lib.mdp index 1b473f472e..67f8aa0c0d 100644 --- a/main/src/addins/prj2make-sharp-lib/prj2make-sharp-lib.mdp +++ b/main/src/addins/prj2make-sharp-lib/prj2make-sharp-lib.mdp @@ -24,40 +24,27 @@ <File name="sharp_d_prjx.cs" subtype="Code" buildaction="Compile" /> <File name="csproj_ver2003.cs" subtype="Code" buildaction="Compile" /> <File name="prj2make-sharp-lib.addin.xml" subtype="Code" buildaction="EmbedAsResource" /> - <File name="MSBuildFileFormat.cs" subtype="Code" buildaction="Compile" /> <File name="MSBuildProjectServiceExtension.cs" subtype="Code" buildaction="Compile" /> - <File name="MSBuildData.cs" subtype="Code" buildaction="Compile" /> <File name="Makefile.am" subtype="Code" buildaction="Nothing" /> - <File name="SlnData.cs" subtype="Code" buildaction="Compile" /> - <File name="SlnFileFormat.cs" subtype="Code" buildaction="Compile" /> - <File name="VBNetResourceIdBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="CSharpResourceIdBuilder.cs" subtype="Code" buildaction="Compile" /> - <File name="IResourceIdBuilder.cs" subtype="Code" buildaction="Compile" /> <File name="ChangeLog" subtype="Code" buildaction="Nothing" /> - <File name="VS2003SlnFileFormat.cs" subtype="Code" buildaction="Compile" /> <File name="VS2003ProjectFileFormat.cs" subtype="Code" buildaction="Compile" /> - <File name="SilverlightMSBuildProjectExtension.cs" subtype="Code" buildaction="Compile" /> - <File name="VBNetMSBuildProjectExtension.cs" subtype="Code" buildaction="Compile" /> - <File name="CSharpMSBuildProjectExtension.cs" subtype="Code" buildaction="Compile" /> - <File name="DefaultMSBuildProjectExtension.cs" subtype="Code" buildaction="Compile" /> - <File name="MSBuildProjectExtension.cs" subtype="Code" buildaction="Compile" /> - <File name="Utils.cs" subtype="Code" buildaction="Compile" /> + <File name="SilverlightMSBuildProjectExtension.cs" subtype="Code" buildaction="Nothing" /> </Contents> <References> <ProjectReference type="Gac" localcopy="False" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <ProjectReference type="Gac" localcopy="False" refto="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> - <ProjectReference type="Gac" localcopy="True" refto="pango-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Gac" localcopy="True" refto="atk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> - <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.VBNetBinding" /> <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Core" /> <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Core.Gui" /> <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Ide" /> <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Projects" /> - <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.CSharpBinding" /> - <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.3.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> + <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> <ProjectReference type="Project" localcopy="False" refto="MonoDevelop.Deployment" /> + <ProjectReference type="Gac" localcopy="True" refto="pango-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <ProjectReference type="Gac" localcopy="True" refto="atk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.CSharpBinding" /> + <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.VBNetBinding" /> </References> <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="./Makefile.am" BuildTargetName="" CleanTargetName="" SyncReferences="True" IsAutotoolsProject="True" RelativeConfigureInPath="../../../"> <BuildFilesVar Sync="True" Name="FILES" /> diff --git a/main/src/core/Core.mds b/main/src/core/Core.mds index a46a3b1b3a..0b79dffe38 100644 --- a/main/src/core/Core.mds +++ b/main/src/core/Core.mds @@ -18,11 +18,11 @@ <Entry build="True" name="MonoDevelop.Core.Gui" configuration="Debug" /> <Entry build="True" name="MonoDevelop.Components" configuration="Debug" /> <Entry build="True" name="MonoDevelop.Dock" configuration="Debug" /> - <Entry build="True" name="MonoDevelop.Documentation" configuration="Debug" /> + <Entry build="True" name="MonoDevelop.Documentation" configuration="Release" /> <Entry build="True" name="MonoDevelop.Ide" configuration="Debug" /> <Entry build="True" name="MonoDevelop.Projects" configuration="Debug" /> - <Entry build="True" name="MonoDevelop.Projects.Gui" configuration="Debug" /> - <Entry build="True" name="MonoDevelop.Startup" configuration="Debug" /> + <Entry build="True" name="MonoDevelop.Projects.Gui" configuration="Release" /> + <Entry build="True" name="MonoDevelop.Startup" configuration="Release" /> <Entry build="True" name="NRefactory" configuration="Release" /> <Entry build="True" name="Mono.Debugging" configuration="Release" /> </Configuration> diff --git a/main/src/core/MonoDevelop.Components/ChangeLog b/main/src/core/MonoDevelop.Components/ChangeLog index 9dffefa60f..428ce249e5 100644 --- a/main/src/core/MonoDevelop.Components/ChangeLog +++ b/main/src/core/MonoDevelop.Components/ChangeLog @@ -1,3 +1,7 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * MonoDevelop.Components/BaseFileEntry.cs: New project model changes. + 2008-05-15 Lluis Sanchez Gual <lluis@novell.com> * MonoDevelop.Components.Commands/CommandArrayInfo.cs: Added new diff --git a/main/src/core/MonoDevelop.Components/MonoDevelop.Components/BaseFileEntry.cs b/main/src/core/MonoDevelop.Components/MonoDevelop.Components/BaseFileEntry.cs index 7f112a7e9e..9e5a95bb4c 100644 --- a/main/src/core/MonoDevelop.Components/MonoDevelop.Components/BaseFileEntry.cs +++ b/main/src/core/MonoDevelop.Components/MonoDevelop.Components/BaseFileEntry.cs @@ -71,7 +71,9 @@ namespace MonoDevelop.Components { } public new string Path { - get { return default_path != null ? System.IO.Path.Combine (default_path, text.Text) : text.Text; } + get { + return default_path != null && text.Text.Length > 0 ? System.IO.Path.Combine (default_path, text.Text) : text.Text; + } set { loading = true; text.Text = value; diff --git a/main/src/core/MonoDevelop.Core.Gui/ChangeLog b/main/src/core/MonoDevelop.Core.Gui/ChangeLog index 55481362d3..deb77980f7 100644 --- a/main/src/core/MonoDevelop.Core.Gui/ChangeLog +++ b/main/src/core/MonoDevelop.Core.Gui/ChangeLog @@ -1,3 +1,15 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * MonoDevelop.Core.Gui.mdp, + MonoDevelop.Core.Gui.Dialogs/OptionsDialog.cs, + MonoDevelop.Core.Gui.Components/MenuButtonEntry.cs, + MonoDevelop.Core.Gui.Codons/OptionsPanelNode.cs, + MonoDevelop.Core.Gui/StockIcons.cs, + MonoDevelop.Core.Gui/DispatchService.cs, Makefile.am, + icons/solution-folder-open-16.png, + icons/solution-folder-closed-16.png, + MonoDevelop.Core.Gui.addin.xml: New project model changes. + 2008-05-08 Michael Hutchinson <mhutchinson@novell.com> * MonoDevelop.Core.Gui/PlatformService.cs: Add a method for determining diff --git a/main/src/core/MonoDevelop.Core.Gui/Makefile.am b/main/src/core/MonoDevelop.Core.Gui/Makefile.am index f1d0e70b9f..95dcdbe029 100644 --- a/main/src/core/MonoDevelop.Core.Gui/Makefile.am +++ b/main/src/core/MonoDevelop.Core.Gui/Makefile.am @@ -165,6 +165,8 @@ RES = \ icons/project-library-32.png \ icons/solution-16.png \ icons/solution-32.png \ + icons/solution-folder-closed-16.png \ + icons/solution-folder-open-16.png \ icons/system-software-update.png \ icons/system-software-update_22.png \ icons/uncomment.png \ diff --git a/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui.Codons/OptionsPanelNode.cs b/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui.Codons/OptionsPanelNode.cs index 0b24a36786..6773b0ea99 100644 --- a/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui.Codons/OptionsPanelNode.cs +++ b/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui.Codons/OptionsPanelNode.cs @@ -84,7 +84,10 @@ namespace MonoDevelop.Core.Gui.Codons public virtual IOptionsPanel CreatePanel () { - return (IOptionsPanel) Addin.CreateInstance (typeName, true); + IOptionsPanel p = Addin.CreateInstance (typeName, true) as IOptionsPanel; + if (p == null) + throw new System.InvalidOperationException ("Type '" + typeName + "' does not implement IOptionsPanel"); + return p; } } diff --git a/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui.Components/MenuButtonEntry.cs b/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui.Components/MenuButtonEntry.cs index 72820e6425..533083f1d8 100644 --- a/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui.Components/MenuButtonEntry.cs +++ b/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui.Components/MenuButtonEntry.cs @@ -64,8 +64,10 @@ namespace MonoDevelop.Core.Gui.Components manager = new CommandManager (); manager.RegisterGlobalHandler (this); - PackStart (entry, true, true, 0); - PackStart (button, false, false, 6); + if (entry.Parent == null) + PackStart (entry, true, true, 0); + if (entry.Parent == null) + PackStart (button, false, false, 6); ActionCommand cmd = new ActionCommand ("InsertOption", "InsertOption", null); cmd.CommandArray = true; diff --git a/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui.Dialogs/OptionsDialog.cs b/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui.Dialogs/OptionsDialog.cs index dd9851da3c..6bf5e79257 100644 --- a/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui.Dialogs/OptionsDialog.cs +++ b/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui.Dialogs/OptionsDialog.cs @@ -173,27 +173,39 @@ namespace MonoDevelop.Core.Gui.Dialogs if (resp == ResponseType.Ok) { // Validate changes before saving - foreach (SectionPage sp in pages.Values) { - if (sp.Widget == null) - continue; - foreach (PanelInstance pi in sp.Panels) { - if (!pi.Panel.ValidateChanges ()) - return; // Not valid - } - } + if (!ValidateChanges ()) + return; // Now save - foreach (SectionPage sp in pages.Values) { - if (sp.Widget == null) - continue; - foreach (PanelInstance pi in sp.Panels) - pi.Panel.ApplyChanges (); - } + ApplyChanges (); } base.OnResponse (resp); DetachWidgets (); } + protected virtual bool ValidateChanges () + { + foreach (SectionPage sp in pages.Values) { + if (sp.Widget == null) + continue; + foreach (PanelInstance pi in sp.Panels) { + if (!pi.Panel.ValidateChanges ()) + return false; // Not valid + } + } + return true; + } + + protected virtual void ApplyChanges () + { + foreach (SectionPage sp in pages.Values) { + if (sp.Widget == null) + continue; + foreach (PanelInstance pi in sp.Panels) + pi.Panel.ApplyChanges (); + } + } + void OnSelectionChanged (object s, EventArgs a) { @@ -220,6 +232,11 @@ namespace MonoDevelop.Core.Gui.Dialogs } foreach (Gtk.Widget w in pageFrame.Children) { + Container cc = w as Gtk.Container; + if (cc != null) { + foreach (Gtk.Widget cw in cc) + cw.Hide (); + } pageFrame.Remove (w); } @@ -232,6 +249,13 @@ namespace MonoDevelop.Core.Gui.Dialogs else image.Stock = "gtk-preferences"; pageFrame.PackStart (page.Widget, true, true, 0); + + // Ensures that the Shown event is fired for each panel + Container c = page.Widget as Gtk.Container; + if (c != null) { + foreach (Gtk.Widget cw in c) + cw.Show (); + } } SectionPage CreatePage (OptionsDialogSection section, object dataObject) @@ -336,8 +360,8 @@ namespace MonoDevelop.Core.Gui.Dialogs box.PackStart (sep, false, false, 0); } PanelInstance pi = boxPanels [n]; - pi.Widget.Show (); box.PackStart (pi.Widget, pi.Node.Fill, pi.Node.Fill, 0); + pi.Widget.Show (); } if (tabPanels.Count > 0) { @@ -350,12 +374,12 @@ namespace MonoDevelop.Core.Gui.Dialogs foreach (PanelInstance pi in tabPanels) { Gtk.Label lab = new Gtk.Label (GettextCatalog.GetString (pi.Node.Label)); lab.Show (); - pi.Widget.Show (); Gtk.Alignment a = new Alignment (0, 0, 1, 1); a.BorderWidth = 9; a.Show (); a.Add (pi.Widget); nb.InsertPage (a, lab, -1); + pi.Widget.Show (); } page.Widget = nb; } else { diff --git a/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui.addin.xml b/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui.addin.xml index d1a42fd612..a0c0954712 100644 --- a/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui.addin.xml +++ b/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui.addin.xml @@ -181,6 +181,8 @@ <StockIcon stockid = "md-addin" resource = "plugin-32.png" size = "LargeToolbar"/> <StockIcon stockid = "md-workspace" resource = "workspace-16.png" size="Menu"/> <StockIcon stockid = "md-workspace" resource = "workspace-32.png" size="Dnd" /> + <StockIcon stockid = "md-solution-folder-open" resource = "solution-folder-open-16.png" size="Menu"/> + <StockIcon stockid = "md-solution-folder-closed" resource = "solution-folder-closed-16.png" size="Menu"/> <StockIcon stockid = "md-regular-file" resource = "gnome-fs-regular.png" /> </Extension> diff --git a/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui.mdp b/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui.mdp index 3bf57700f1..43393e17bf 100644 --- a/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui.mdp +++ b/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui.mdp @@ -171,6 +171,8 @@ <File name="gtk-gui/MonoDevelop.Core.Gui.Dialogs.OptionsDialog.cs" subtype="Code" buildaction="Compile" /> <File name="icons/pad-task-list-24.png" subtype="Code" buildaction="EmbedAsResource" /> <File name="MonoDevelop.Core.Gui/GLibLogging.cs" subtype="Code" buildaction="Compile" /> + <File name="icons/solution-folder-closed-16.png" subtype="Code" buildaction="EmbedAsResource" /> + <File name="icons/solution-folder-open-16.png" subtype="Code" buildaction="EmbedAsResource" /> <File name="MonoDevelop.Core.Gui.Codons/MimeTypeNode.cs" subtype="Code" buildaction="Compile" /> <File name="icons/file-xml-16.png" subtype="Code" buildaction="EmbedAsResource" /> <File name="icons/file-addin-16.png" subtype="Code" buildaction="EmbedAsResource" /> diff --git a/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui/DispatchService.cs b/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui/DispatchService.cs index 8b68d413ca..e915d6bb28 100644 --- a/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui/DispatchService.cs +++ b/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui/DispatchService.cs @@ -139,6 +139,12 @@ namespace MonoDevelop.Core.Gui return guiContext.CreateSynchronizedDelegate (del); } + public static T GuiDispatch<T> (T theDelegate) + { + Delegate del = (Delegate)(object)theDelegate; + return (T)(object)guiContext.CreateSynchronizedDelegate (del); + } + public static void BackgroundDispatch (MessageHandler cb) { arrBackgroundQueue.Add (new GenericMessageContainer (cb, false)); @@ -150,6 +156,14 @@ namespace MonoDevelop.Core.Gui //thrBackground.Resume (); } + public static void ThreadDispatch (MessageHandler cb) + { + GenericMessageContainer smc = new GenericMessageContainer (cb, false); + Thread t = new Thread (new ThreadStart (smc.Run)); + t.IsBackground = true; + t.Start (); + } + public static void ThreadDispatch (StatefulMessageHandler cb, object state) { StatefulMessageContainer smc = new StatefulMessageContainer (cb, state, false); diff --git a/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui/StockIcons.cs b/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui/StockIcons.cs index 79724bf49c..cf7482422a 100644 --- a/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui/StockIcons.cs +++ b/main/src/core/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui/StockIcons.cs @@ -137,6 +137,8 @@ namespace MonoDevelop.Core.Gui public static readonly string WebSearchIcon = "md-web-search-icon"; public static readonly string XmlFileIcon = "md-xml-file-icon"; public static readonly string Addin = "md-addin"; + public static readonly string SolutionFolderOpen = "md-solution-folder-open"; + public static readonly string SolutionFolderClosed = "md-solution-folder-closed"; } } diff --git a/main/src/core/MonoDevelop.Core.Gui/icons/solution-folder-closed-16.png b/main/src/core/MonoDevelop.Core.Gui/icons/solution-folder-closed-16.png Binary files differnew file mode 100644 index 0000000000..7e6411d5d2 --- /dev/null +++ b/main/src/core/MonoDevelop.Core.Gui/icons/solution-folder-closed-16.png diff --git a/main/src/core/MonoDevelop.Core.Gui/icons/solution-folder-open-16.png b/main/src/core/MonoDevelop.Core.Gui/icons/solution-folder-open-16.png Binary files differnew file mode 100644 index 0000000000..78c85e43d0 --- /dev/null +++ b/main/src/core/MonoDevelop.Core.Gui/icons/solution-folder-open-16.png diff --git a/main/src/core/MonoDevelop.Core/ChangeLog b/main/src/core/MonoDevelop.Core/ChangeLog index bb6359a3f6..db33b53e19 100644 --- a/main/src/core/MonoDevelop.Core/ChangeLog +++ b/main/src/core/MonoDevelop.Core/ChangeLog @@ -1,3 +1,9 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * MonoDevelop.Core/Properties.cs, MonoDevelop.Core/PropertyService.cs, + MonoDevelop.Core/SystemAssemblyService.cs: New project model + changes. + 2008-04-29 Aaron Bockover <abock@gnome.org> * MonoDevelop.Core.Execution/ProcessService.cs: Use the new diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Properties.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Properties.cs index 22dca659aa..eb94f70235 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Properties.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Properties.cs @@ -45,6 +45,7 @@ namespace MonoDevelop.Core Dictionary<string, object> properties = new Dictionary<string, object> (); Dictionary<string, object> defaultValues = new Dictionary<string, object> (); Dictionary<Type, TypeConverter> cachedConverters = new Dictionary<Type, TypeConverter> (); + Dictionary<string,EventHandler<PropertyChangedEventArgs>> propertyListeners; public ICollection<string> Keys { get { @@ -317,10 +318,41 @@ namespace MonoDevelop.Core return result; } + public void AddPropertyHandler (string propertyName, EventHandler<PropertyChangedEventArgs> handler) + { + if (propertyListeners == null) + propertyListeners = new Dictionary<string,EventHandler<PropertyChangedEventArgs>> (); + + EventHandler<PropertyChangedEventArgs> handlers = null; + propertyListeners.TryGetValue (propertyName, out handlers); + propertyListeners [propertyName] = handlers + handler; + } + + public void RemovePropertyHandler (string propertyName, EventHandler<PropertyChangedEventArgs> handler) + { + if (propertyListeners == null) + return; + + EventHandler<PropertyChangedEventArgs> handlers = null; + propertyListeners.TryGetValue (propertyName, out handlers); + handlers -= handler; + if (handlers != null) + propertyListeners [propertyName] = handlers; + else + propertyListeners.Remove (propertyName); + } + protected virtual void OnPropertyChanged (PropertyChangedEventArgs args) { if (PropertyChanged != null) PropertyChanged (this, args); + + if (propertyListeners != null) { + EventHandler<PropertyChangedEventArgs> handlers = null; + propertyListeners.TryGetValue (args.Key, out handlers); + if (handlers != null) + handlers (this, args); + } } public event EventHandler<PropertyChangedEventArgs> PropertyChanged; diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/PropertyService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/PropertyService.cs index 988bfd279a..2035710acc 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/PropertyService.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/PropertyService.cs @@ -27,6 +27,7 @@ // using System; +using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; @@ -38,6 +39,10 @@ namespace MonoDevelop.Core readonly static string FileName = "MonoDevelopProperties.xml"; static Properties properties; + public static Properties GlobalInstance { + get { return properties; } + } + public static string EntryAssemblyPath { get { if (Assembly.GetEntryAssembly () != null) @@ -106,6 +111,16 @@ namespace MonoDevelop.Core properties.Set (key, val); } + public static void AddPropertyHandler (string propertyName, EventHandler<PropertyChangedEventArgs> handler) + { + properties.AddPropertyHandler (propertyName, handler); + } + + public static void RemovePropertyHandler (string propertyName, EventHandler<PropertyChangedEventArgs> handler) + { + properties.RemovePropertyHandler (propertyName, handler); + } + public static event EventHandler<PropertyChangedEventArgs> PropertyChanged; } } diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/SystemAssemblyService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/SystemAssemblyService.cs index 307916d3b7..c6bd51f304 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/SystemAssemblyService.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/SystemAssemblyService.cs @@ -55,6 +55,12 @@ namespace MonoDevelop.Core ClrVersion currentVersion; ClrVersion[] supportedVersions = new ClrVersion [] {}; + public ClrVersion CurrentClrVersion { + get { + return currentVersion; + } + } + public event EventHandler PackagesChanged; public override void InitializeService () diff --git a/main/src/core/MonoDevelop.Ide/ChangeLog b/main/src/core/MonoDevelop.Ide/ChangeLog index 76b9b77953..8c53fb80aa 100644 --- a/main/src/core/MonoDevelop.Ide/ChangeLog +++ b/main/src/core/MonoDevelop.Ide/ChangeLog @@ -1,3 +1,90 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * MonoDevelop.Ide.Templates/CombineDescriptor.cs, + MonoDevelop.Ide.Templates/ISolutionItemFeature.cs, + MonoDevelop.Ide.Templates/ParentProjectFileTemplateCondition.cs, + MonoDevelop.Ide.Templates/SolutionItemDescriptor.cs, + MonoDevelop.Ide.Templates/ProjectTemplate.cs, + MonoDevelop.Ide.Templates/ISolutionItemDescriptor.cs, + MonoDevelop.Ide.Templates/ProjectDescriptor.cs, + MonoDevelop.Ide.Commands/RefactoryCommands.cs, + MonoDevelop.Ide.Commands/FileCommands.cs, + MonoDevelop.Ide.Commands/EditCommands.cs, + MonoDevelop.Ide.Commands/SearchCommands.cs, + MonoDevelop.Ide.Commands/CustomStringTagProvider.cs, + MonoDevelop.Ide.Commands/ProjectCommands.cs, + MonoDevelop.Ide/Services.cs, + MonoDevelop.Ide.ExternalTools/ExternalToolPanel.cs, + MonoDevelop.Ide.Gui.Pads/DefaultMonitorPad.cs, + MonoDevelop.Ide.Gui.Pads/FileScout.cs, + MonoDevelop.Ide.Gui.Pads/SolutionPad.cs, + MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs, + MonoDevelop.Ide.Gui.Pads.ClassBrowser/ClassBrowserPadWidget.cs, + MonoDevelop.Ide.Gui.Pads.ClassBrowser/ProjectNodeBuilder.cs, + MonoDevelop.Ide.Gui.Pads.ClassBrowser/SolutionNodeBuilder.cs, + MonoDevelop.Ide.Gui.Content/TextEditorExtension.cs, + MonoDevelop.Ide.Gui.OptionPanels/LoadSavePanel.cs, + MonoDevelop.Ide.Gui.Pads.ClassPad/ProjectNodeBuilder.cs, + MonoDevelop.Ide.Gui.Pads.ClassPad/CombineNodeBuilder.cs, + MonoDevelop.Ide.Gui.Pads.ClassPad/NamespaceNodeBuilder.cs, + MonoDevelop.Ide.Gui.Pads.ClassPad/SolutionNodeBuilder.cs, + MonoDevelop.Ide.Gui.Pads.ProjectPad/WorkspaceNodeBuilder.cs, + MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs, + MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs, + MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectNodeBuilder.cs, + MonoDevelop.Ide.Gui.Pads.ProjectPad/FolderNodeBuilder.cs, + MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectSolutionPad.cs, + MonoDevelop.Ide.Gui.Pads.ProjectPad/CombineNodeBuilder.cs, + MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionNodeBuilder.cs, + MonoDevelop.Ide.Gui.Pads.ProjectPad/UnknownEntryNodeBuilder.cs, + MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectReferenceFolderNodeBuilder.cs, + MonoDevelop.Ide.Gui.Pads.ProjectPad/ResourceFolderNodeBuilder.cs, + MonoDevelop.Ide.Gui.Pads.ProjectPad/ShowAllFilesBuilderExtension.cs, + MonoDevelop.Ide.Gui.Pads.ProjectPad/SystemFileNodeBuilder.cs, + MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectReferenceNodeBuilder.cs, + MonoDevelop.Ide.Gui.Pads.ProjectPad/LinkedFilesFolderNodeBuilder.cs, + MonoDevelop.Ide.Gui.Dialogs/CombineEntryFeatureSelector.cs, + MonoDevelop.Ide.Gui.Dialogs/FeatureSelectorDialog.cs, + MonoDevelop.Ide.Gui.Dialogs/SelectReferenceDialog.cs, + MonoDevelop.Ide.Gui.Dialogs/IncludeFilesDialog.cs, + MonoDevelop.Ide.Gui.Dialogs/GoToDialog.cs, + MonoDevelop.Ide.Gui.Dialogs/EncapsulateFieldDialog.cs, + MonoDevelop.Ide.Gui.Dialogs/ExportProjectDialog.cs, + MonoDevelop.Ide.Gui.Dialogs/DirtyFilesDialog.cs, + MonoDevelop.Ide.Gui.Dialogs/NewProjectDialog.cs, + MonoDevelop.Ide.Gui.Dialogs/FileSelectorDialog.cs, + MonoDevelop.Ide.Gui.Dialogs/ProjectReferencePanel.cs, + MonoDevelop.Ide.Gui.Dialogs/RenameItemDialog.cs, + MonoDevelop.Ide.Gui.Dialogs/NewFileDialog.cs, + MonoDevelop.Ide.StandardHeader/StandardHeaderService.cs, + MonoDevelop.Ide.Dom.Parser/ProjectParserService.cs, + MonoDevelop.Ide.addin.xml, + MonoDevelop.Ide.Dom.Output/NetAmbience.cs, MonoDevelop.Ide.mdp, + gtk-gui/MonoDevelop.Ide.Gui.Dialogs.ExportProjectDialog.cs, + gtk-gui/gui.stetic, gtk-gui/objects.xml, + gtk-gui/MonoDevelop.Ide.Gui.OptionPanels.LoadSavePanelWidget.cs, + Makefile.am, MonoDevelop.Ide.Gui/Document.cs, + MonoDevelop.Ide.Gui/IdePreferences.cs, + MonoDevelop.Ide.Gui/ConfigurationComboBox.cs, + MonoDevelop.Ide.Gui/RootWorkspace.cs, + MonoDevelop.Ide.Gui/ProjectOperations.cs, + MonoDevelop.Ide.Gui/NavigationService.cs, + MonoDevelop.Ide.Gui/Workbench.cs, + MonoDevelop.Ide.Gui/IdeStartup.cs, + MonoDevelop.Ide.Gui/DefaultWorkbench.cs, + MonoDevelop.Ide.Gui/Ide.cs, + MonoDevelop.Ide.Gui/MonoDevelopTreeView.cs, + MonoDevelop.Ide.Gui/WorkbenchMemento.cs, + MonoDevelop.Ide.Gui/AddEntryEventHandler.cs, + MonoDevelop.Ide.Codons/ProjectOpenCondition.cs, + MonoDevelop.Ide.Codons/CombineOpenCondition.cs, + MonoDevelop.Ide.Tasks/UserTasksView.cs, + MonoDevelop.Ide.Tasks/UserTask.cs, MonoDevelop.Ide.Tasks/Task.cs, + MonoDevelop.Ide.Tasks/CommentTasksView.cs, + MonoDevelop.Ide.Tasks/TaskService.cs, + MonoDevelop.Ide.Gui.Search/WholeProjectDocumentIterator.cs: New + project model changes. + 2008-05-20 Michael Hutchinson <mhutchinson@novell.com> * MonoDevelop.Ide.Gui.Dialogs/NewProjectDialog.cs: More descriptive diff --git a/main/src/core/MonoDevelop.Ide/Makefile.am b/main/src/core/MonoDevelop.Ide/Makefile.am index 47c09804d6..8e2399c67d 100644 --- a/main/src/core/MonoDevelop.Ide/Makefile.am +++ b/main/src/core/MonoDevelop.Ide/Makefile.am @@ -218,6 +218,7 @@ FILES = \ MonoDevelop.Ide.Gui.Pads.ClassPad/NamespaceNodeBuilder.cs \ MonoDevelop.Ide.Gui.Pads.ClassPad/ProjectNodeBuilder.cs \ MonoDevelop.Ide.Gui.Pads.ClassPad/PropertyNodeBuilder.cs \ + MonoDevelop.Ide.Gui.Pads.ClassPad/SolutionNodeBuilder.cs \ MonoDevelop.Ide.Gui.Pads.ProjectPad/CombineNodeBuilder.cs \ MonoDevelop.Ide.Gui.Pads.ProjectPad/FolderNodeBuilder.cs \ MonoDevelop.Ide.Gui.Pads.ProjectPad/LinkedFilesFolder.cs \ @@ -232,9 +233,11 @@ FILES = \ MonoDevelop.Ide.Gui.Pads.ProjectPad/ResourceFolder.cs \ MonoDevelop.Ide.Gui.Pads.ProjectPad/ResourceFolderNodeBuilder.cs \ MonoDevelop.Ide.Gui.Pads.ProjectPad/ShowAllFilesBuilderExtension.cs \ + MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionNodeBuilder.cs \ MonoDevelop.Ide.Gui.Pads.ProjectPad/SystemFile.cs \ MonoDevelop.Ide.Gui.Pads.ProjectPad/SystemFileNodeBuilder.cs \ MonoDevelop.Ide.Gui.Pads.ProjectPad/UnknownEntryNodeBuilder.cs \ + MonoDevelop.Ide.Gui.Pads.ProjectPad/WorkspaceNodeBuilder.cs \ MonoDevelop.Ide.Gui.Pads/DefaultMonitorPad.cs \ MonoDevelop.Ide.Gui.Pads/DragOperation.cs \ MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs \ @@ -308,6 +311,7 @@ FILES = \ MonoDevelop.Ide.Gui/HelpViewer.cs \ MonoDevelop.Ide.Gui/IBaseViewContent.cs \ MonoDevelop.Ide.Gui/Ide.cs \ + MonoDevelop.Ide.Gui/IdePreferences.cs \ MonoDevelop.Ide.Gui/IdeStartup.cs \ MonoDevelop.Ide.Gui/INavigationPoint.cs \ MonoDevelop.Ide.Gui/InternalLog.cs \ @@ -327,6 +331,7 @@ FILES = \ MonoDevelop.Ide.Gui/Pad.cs \ MonoDevelop.Ide.Gui/ProgressMonitors.cs \ MonoDevelop.Ide.Gui/ProjectOperations.cs \ + MonoDevelop.Ide.Gui/RootWorkspace.cs \ MonoDevelop.Ide.Gui/SdiWorkspaceLayout.cs \ MonoDevelop.Ide.Gui/SdiWorkspaceWindow.cs \ MonoDevelop.Ide.Gui/StartupInfo.cs \ @@ -353,22 +358,21 @@ FILES = \ MonoDevelop.Ide.Templates/CodeDomFileDescriptionTemplate.cs \ MonoDevelop.Ide.Templates/CodeTranslationFileDescriptionTemplate.cs \ MonoDevelop.Ide.Templates/CombineDescriptor.cs \ - MonoDevelop.Ide.Templates/CombineEntryDescriptor.cs \ MonoDevelop.Ide.Templates/FileDescriptionTemplate.cs \ MonoDevelop.Ide.Templates/FileTemplate.cs \ MonoDevelop.Ide.Templates/FileTemplateCondition.cs \ MonoDevelop.Ide.Templates/FileTemplateReference.cs \ - MonoDevelop.Ide.Templates/ICombineEntryDescriptor.cs \ - MonoDevelop.Ide.Templates/ICombineEntryFeature.cs \ MonoDevelop.Ide.Templates/INewFileCreator.cs \ + MonoDevelop.Ide.Templates/ISolutionItemDescriptor.cs \ + MonoDevelop.Ide.Templates/ISolutionItemFeature.cs \ MonoDevelop.Ide.Templates/ParentProjectFileTemplateCondition.cs \ MonoDevelop.Ide.Templates/PartialTypeFileTemplateCondition.cs \ MonoDevelop.Ide.Templates/ProjectDescriptor.cs \ MonoDevelop.Ide.Templates/ProjectTemplate.cs \ MonoDevelop.Ide.Templates/ResourceFileDescriptionTemplate.cs \ MonoDevelop.Ide.Templates/SingleFileDescriptionTemplate.cs \ + MonoDevelop.Ide.Templates/SolutionItemDescriptor.cs \ MonoDevelop.Ide.Templates/TextFileDescriptionTemplate.cs \ - MonoDevelop.Ide.Templates/TextTemplate.cs \ MonoDevelop.Ide/Services.cs RES = \ diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/CombineOpenCondition.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/CombineOpenCondition.cs index 39adabe73d..8a1976cf16 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/CombineOpenCondition.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/CombineOpenCondition.cs @@ -40,13 +40,13 @@ namespace MonoDevelop.Ide.Codons { public CombineOpenCondition () { - IdeApp.ProjectOperations.CombineClosed += delegate { NotifyChanged(); }; - IdeApp.ProjectOperations.CombineOpened += delegate { NotifyChanged(); }; + IdeApp.Workspace.FirstWorkspaceItemOpened += delegate { NotifyChanged(); }; + IdeApp.Workspace.LastWorkspaceItemClosed += delegate { NotifyChanged(); }; } public override bool Evaluate (NodeElement condition) { - return IdeApp.ProjectOperations.CurrentOpenCombine != null; + return IdeApp.Workspace.IsOpen; } } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ProjectOpenCondition.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ProjectOpenCondition.cs index 2cce042666..2b7b0dc688 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ProjectOpenCondition.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ProjectOpenCondition.cs @@ -51,7 +51,7 @@ namespace MonoDevelop.Ide.Codons Project project = IdeApp.ProjectOperations.CurrentSelectedProject; if (project == null && IdeApp.ProjectOperations.CurrentOpenCombine != null) { - CombineEntryCollection projects = IdeApp.ProjectOperations.CurrentOpenCombine.GetAllProjects(); + SolutionItemCollection projects = IdeApp.ProjectOperations.CurrentOpenCombine.GetAllProjects(); if (projects.Count > 0) { project = (Project)projects[0]; } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/CustomStringTagProvider.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/CustomStringTagProvider.cs index 5befca5e63..024b41bbae 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/CustomStringTagProvider.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/CustomStringTagProvider.cs @@ -60,12 +60,12 @@ namespace MonoDevelop.Ide.Commands string GetCurrentTargetPath() { if (IdeApp.ProjectOperations.CurrentSelectedProject != null) { - return IdeApp.ProjectOperations.CurrentSelectedProject.GetOutputFileName (); + return IdeApp.ProjectOperations.CurrentSelectedProject.GetOutputFileName (IdeApp.Workspace.ActiveConfiguration); } if (IdeApp.Workbench.ActiveDocument != null) { - string fileName = IdeApp.Workbench.ActiveDocument.FileName; - Project project = IdeApp.ProjectOperations.CurrentOpenCombine.FindProject (fileName); - if (project != null) return project.GetOutputFileName(); + Project project = IdeApp.Workbench.ActiveDocument.Project; + if (project != null) + return project.GetOutputFileName (IdeApp.Workspace.ActiveConfiguration); } return String.Empty; } @@ -137,14 +137,14 @@ namespace MonoDevelop.Ide.Commands break; case "COMBINEDIR": - if (IdeApp.ProjectOperations.CurrentSelectedCombineEntry != null) - return Path.GetDirectoryName (IdeApp.ProjectOperations.CurrentSelectedCombineEntry.RootCombine.FileName); + if (IdeApp.ProjectOperations.CurrentSelectedSolutionItem != null) + return Path.GetDirectoryName (IdeApp.ProjectOperations.CurrentSelectedSolutionItem.ParentSolution.FileName); break; case "COMBINEFILENAME": try { - if (IdeApp.ProjectOperations.CurrentSelectedCombineEntry != null) - return Path.GetFileName (IdeApp.ProjectOperations.CurrentSelectedCombineEntry.RootCombine.FileName); + if (IdeApp.ProjectOperations.CurrentSelectedSolutionItem != null) + return Path.GetFileName (IdeApp.ProjectOperations.CurrentSelectedSolutionItem.ParentSolution.FileName); } catch (Exception) {} break; case "STARTUPPATH": diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/EditCommands.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/EditCommands.cs index 4f3ffae019..3aa85c4b9d 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/EditCommands.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/EditCommands.cs @@ -51,6 +51,7 @@ namespace MonoDevelop.Ide.Commands UnIndentSelection, UppercaseSelection, LowercaseSelection, + WordCount, MonodevelopPreferences, InsertStandardHeader, diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileCommands.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileCommands.cs index 5a436d509b..b8162ef85e 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileCommands.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileCommands.cs @@ -44,7 +44,8 @@ namespace MonoDevelop.Ide.Commands NewProject, CloseFile, CloseAllFiles, - CloseCombine, + CloseWorkspace, + CloseWorkspaceItem, ReloadFile, Save, SaveAll, @@ -66,7 +67,7 @@ namespace MonoDevelop.Ide.Commands { protected override void Run () { - IdeApp.ProjectOperations.NewProject (); + IdeApp.ProjectOperations.NewSolution (); } } @@ -129,9 +130,9 @@ namespace MonoDevelop.Ide.Commands MessageService.ShowError (GettextCatalog.GetString ("The provided file could not be loaded.")); return; } - IProjectService ps = MonoDevelop.Projects.Services.ProjectService; - if (ps.IsCombineEntryFile (name) && fs.SelectedViewer == null) - IdeApp.ProjectOperations.OpenCombine (name); + ProjectService ps = MonoDevelop.Projects.Services.ProjectService; + if ((ps.IsWorkspaceItemFile (name) || ps.IsSolutionItemFile (name)) && fs.SelectedViewer == null) + IdeApp.Workspace.OpenWorkspaceItem (name, fs.CloseCurrentWorkspace); else if (fs.SelectedViewer != null) fs.SelectedViewer.OpenFile (name, fs.Encoding); else @@ -144,16 +145,19 @@ namespace MonoDevelop.Ide.Commands } } - internal class CloseCombineHandler : CommandHandler + internal class CloseWorkspaceHandler : CommandHandler { protected override void Run() { - IdeApp.ProjectOperations.CloseCombine(); + IdeApp.Workspace.Close(); } protected override void Update (CommandInfo info) { - info.Enabled = (IdeApp.ProjectOperations.CurrentOpenCombine != null); + if (IdeApp.Workspace.Items.Count == 0) + info.Enabled = false; + else if (IdeApp.Workspace.Items.Count == 1 && IdeApp.Workspace.Items [0] is Solution) + info.Text = GettextCatalog.GetString ("C_lose Solution"); } } @@ -274,7 +278,14 @@ namespace MonoDevelop.Ide.Commands RecentItem ri = recentOpen.RecentProject[i]; string label = ((ri.Private == null || ri.Private.Length < 1) ? Path.GetFileNameWithoutExtension (ri.ToString ()) : ri.Private); CommandInfo cmd = new CommandInfo (accelaratorKeyPrefix + label.Replace ("_", "__")); - cmd.Description = GettextCatalog.GetString ("Load solution {0}", ri.ToString ()); + string str = GettextCatalog.GetString ("Load solution {0}", ri.ToString ()); + if (IdeApp.Workspace.IsOpen) + str += " - " + GettextCatalog.GetString ("Hold Control to open in current worspace."); + cmd.Description = str; + if (IdeApp.Services.ProjectService.FileFormats.GetFileFormats (ri.LocalPath, typeof(Solution)).Length > 0) + cmd.Icon = "md-solution"; + else + cmd.Icon = "md-workspace"; info.Add (cmd, ri); } } @@ -282,15 +293,10 @@ namespace MonoDevelop.Ide.Commands protected override void Run (object dataItem) { - //FIXME:THIS IS BROKEN!! - string filename = dataItem.ToString(); - - try { - IdeApp.ProjectOperations.OpenCombine(filename); - } catch (Exception ex) { - MessageService.ShowException (ex, "Could not load project or solution: " + filename); - } + Gdk.ModifierType mtype; + bool inWorkspace = Gtk.Global.GetCurrentEventState (out mtype) && (mtype & Gdk.ModifierType.ControlMask) != 0; + IdeApp.Workspace.OpenWorkspaceItem (filename, !inWorkspace); } } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ProjectCommands.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ProjectCommands.cs index 56a852d719..e2402d7aff 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ProjectCommands.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ProjectCommands.cs @@ -36,9 +36,11 @@ namespace MonoDevelop.Ide.Commands public enum ProjectCommands { AddNewProject, - AddNewCombine, + AddNewSolution, + AddNewWorkspace, + AddSolutionFolder, AddProject, - AddCombine, + AddItem, RemoveFromProject, Options, AddResource, @@ -83,8 +85,8 @@ namespace MonoDevelop.Ide.Commands StopHandler.StopBuildOperations (); IdeApp.ProjectOperations.CurrentRunOperation.WaitForCompleted (); } - if (IdeApp.ProjectOperations.CurrentOpenCombine != null) { - IAsyncOperation op = IdeApp.ProjectOperations.Build (IdeApp.ProjectOperations.CurrentOpenCombine); + if (IdeApp.Workspace.IsOpen) { + IAsyncOperation op = IdeApp.ProjectOperations.Build (IdeApp.Workspace); op.Completed += new OperationHandler (ExecuteCombine); } else { doc = IdeApp.Workbench.ActiveDocument; @@ -98,7 +100,7 @@ namespace MonoDevelop.Ide.Commands protected override void Update (CommandInfo info) { info.Text = GettextCatalog.GetString ("_Run"); - if (IdeApp.ProjectOperations.CurrentOpenCombine != null) { + if (IdeApp.Workspace.IsOpen) { if (!IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted) { info.Text = GettextCatalog.GetString ("_Run again"); } @@ -113,7 +115,7 @@ namespace MonoDevelop.Ide.Commands { if (op.Success) // FIXME: check RunWithWarnings - IdeApp.ProjectOperations.Execute (IdeApp.ProjectOperations.CurrentOpenCombine); + IdeApp.ProjectOperations.Execute (IdeApp.Workspace); } void ExecuteFile (IAsyncOperation op) @@ -126,26 +128,21 @@ namespace MonoDevelop.Ide.Commands internal class RunEntryHandler: CommandHandler { - CombineEntry entry; - protected override void Run () { - entry = IdeApp.ProjectOperations.CurrentSelectedCombineEntry; + IBuildTarget entry = IdeApp.ProjectOperations.CurrentSelectedBuildTarget; IAsyncOperation op = IdeApp.ProjectOperations.Build (entry); - op.Completed += new OperationHandler (ExecuteCombine); + op.Completed += delegate { + if (op.Success) + IdeApp.ProjectOperations.Execute (entry); + }; } protected override void Update (CommandInfo info) { - info.Enabled = IdeApp.ProjectOperations.CurrentSelectedCombineEntry != null && + info.Enabled = IdeApp.ProjectOperations.CurrentSelectedBuildTarget != null && IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted; } - - void ExecuteCombine (IAsyncOperation op) - { - if (op.Success) - IdeApp.ProjectOperations.Execute (entry); - } } @@ -160,8 +157,8 @@ namespace MonoDevelop.Ide.Commands return; } - if (IdeApp.ProjectOperations.CurrentOpenCombine != null) { - IAsyncOperation op = IdeApp.ProjectOperations.Build (IdeApp.ProjectOperations.CurrentOpenCombine); + if (IdeApp.Workspace.IsOpen) { + IAsyncOperation op = IdeApp.ProjectOperations.Build (IdeApp.Workspace); op.Completed += new OperationHandler (ExecuteCombine); } else { doc = IdeApp.Workbench.ActiveDocument; @@ -181,7 +178,7 @@ namespace MonoDevelop.Ide.Commands return; } - if (IdeApp.ProjectOperations.CurrentOpenCombine != null) { + if (IdeApp.Workspace.IsOpen) { info.Enabled = IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted; } else { info.Enabled = (IdeApp.Workbench.ActiveDocument != null && IdeApp.Workbench.ActiveDocument.IsBuildTarget); @@ -191,7 +188,7 @@ namespace MonoDevelop.Ide.Commands void ExecuteCombine (IAsyncOperation op) { if (op.Success) - IdeApp.ProjectOperations.Debug (IdeApp.ProjectOperations.CurrentOpenCombine); + IdeApp.ProjectOperations.Debug (IdeApp.Workspace); } void ExecuteFile (IAsyncOperation op) @@ -203,35 +200,30 @@ namespace MonoDevelop.Ide.Commands internal class DebugEntryHandler: CommandHandler { - CombineEntry entry; - protected override void Run () { - entry = IdeApp.ProjectOperations.CurrentSelectedCombineEntry; + IBuildTarget entry = IdeApp.ProjectOperations.CurrentSelectedBuildTarget; IAsyncOperation op = IdeApp.ProjectOperations.Build (entry); - op.Completed += new OperationHandler (ExecuteCombine); + op.Completed += delegate { + if (op.Success) + IdeApp.ProjectOperations.Debug (entry); + }; } protected override void Update (CommandInfo info) { - info.Enabled = IdeApp.ProjectOperations.CurrentSelectedCombineEntry != null && + info.Enabled = IdeApp.ProjectOperations.CurrentSelectedBuildTarget != null && IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted; } - - void ExecuteCombine (IAsyncOperation op) - { - if (op.Success) - IdeApp.ProjectOperations.Debug (entry); - } } internal class BuildHandler: CommandHandler { protected override void Run () { - if (IdeApp.ProjectOperations.CurrentOpenCombine != null) { - if (IdeApp.ProjectOperations.CurrentSelectedCombineEntry != null) - IdeApp.ProjectOperations.Build (IdeApp.ProjectOperations.CurrentSelectedCombineEntry); + if (IdeApp.Workspace.IsOpen) { + if (IdeApp.ProjectOperations.CurrentSelectedBuildTarget != null) + IdeApp.ProjectOperations.Build (IdeApp.ProjectOperations.CurrentSelectedBuildTarget); } else if (IdeApp.Workbench.ActiveDocument != null) { IdeApp.Workbench.ActiveDocument.Save (); @@ -241,12 +233,12 @@ namespace MonoDevelop.Ide.Commands protected override void Update (CommandInfo info) { - if (IdeApp.ProjectOperations.CurrentOpenCombine != null) { - CombineEntry entry = IdeApp.ProjectOperations.CurrentSelectedCombineEntry; + if (IdeApp.Workspace.IsOpen) { + IBuildTarget entry = IdeApp.ProjectOperations.CurrentSelectedBuildTarget; if (entry != null) { info.Enabled = IdeApp.ProjectOperations.CurrentBuildOperation.IsCompleted; info.Text = GettextCatalog.GetString ("B_uild {0}", entry.Name); - if (entry is Combine) + if (entry is SolutionFolder) info.Description = GettextCatalog.GetString ("Build solution {0}", entry.Name); else if (entry is Project) info.Description = GettextCatalog.GetString ("Build project {0}", entry.Name); @@ -273,9 +265,9 @@ namespace MonoDevelop.Ide.Commands { protected override void Run () { - if (IdeApp.ProjectOperations.CurrentOpenCombine != null) { - if (IdeApp.ProjectOperations.CurrentSelectedCombineEntry != null) - IdeApp.ProjectOperations.Rebuild (IdeApp.ProjectOperations.CurrentSelectedCombineEntry); + if (IdeApp.Workspace.IsOpen) { + if (IdeApp.ProjectOperations.CurrentSelectedBuildTarget != null) + IdeApp.ProjectOperations.Rebuild (IdeApp.ProjectOperations.CurrentSelectedBuildTarget); } else if (IdeApp.Workbench.ActiveDocument != null) { IdeApp.Workbench.ActiveDocument.Save (); @@ -285,8 +277,8 @@ namespace MonoDevelop.Ide.Commands protected override void Update (CommandInfo info) { - if (IdeApp.ProjectOperations.CurrentOpenCombine != null) { - CombineEntry entry = IdeApp.ProjectOperations.CurrentSelectedCombineEntry; + if (IdeApp.Workspace.IsOpen) { + IBuildTarget entry = IdeApp.ProjectOperations.CurrentSelectedBuildTarget; if (entry != null) { info.Enabled = IdeApp.ProjectOperations.CurrentBuildOperation.IsCompleted; info.Text = GettextCatalog.GetString ("R_ebuild {0}", entry.Name); @@ -311,13 +303,13 @@ namespace MonoDevelop.Ide.Commands { protected override void Run () { - IdeApp.ProjectOperations.Build (IdeApp.ProjectOperations.CurrentOpenCombine); + IdeApp.ProjectOperations.Build (IdeApp.Workspace); } protected override void Update (CommandInfo info) { info.Enabled = IdeApp.ProjectOperations.CurrentBuildOperation.IsCompleted && - (IdeApp.ProjectOperations.CurrentOpenCombine != null); + (IdeApp.Workspace.IsOpen); } } @@ -325,13 +317,13 @@ namespace MonoDevelop.Ide.Commands { protected override void Run () { - IdeApp.ProjectOperations.Rebuild (IdeApp.ProjectOperations.CurrentOpenCombine); + IdeApp.ProjectOperations.Rebuild (IdeApp.Workspace); } protected override void Update (CommandInfo info) { info.Enabled = IdeApp.ProjectOperations.CurrentBuildOperation.IsCompleted && - (IdeApp.ProjectOperations.CurrentOpenCombine != null); + (IdeApp.Workspace.IsOpen); } } @@ -339,12 +331,12 @@ namespace MonoDevelop.Ide.Commands { protected override void Run () { - IdeApp.ProjectOperations.Clean (IdeApp.ProjectOperations.CurrentOpenCombine); + IdeApp.ProjectOperations.Clean (IdeApp.Workspace); } protected override void Update (CommandInfo info) { - info.Enabled = IdeApp.ProjectOperations.CurrentOpenCombine != null; + info.Enabled = IdeApp.Workspace.IsOpen; } } @@ -352,15 +344,14 @@ namespace MonoDevelop.Ide.Commands { protected override void Run () { - IdeApp.ProjectOperations.Clean (IdeApp.ProjectOperations.CurrentSelectedCombineEntry); + IdeApp.ProjectOperations.Clean (IdeApp.ProjectOperations.CurrentSelectedBuildTarget); } protected override void Update (CommandInfo info) { - if (IdeApp.ProjectOperations.CurrentSelectedCombineEntry != null) { - info.Enabled = IdeApp.ProjectOperations.CurrentSelectedCombineEntry != null; - info.Text = GettextCatalog.GetString ("C_lean {0}", IdeApp.ProjectOperations.CurrentSelectedCombineEntry.Name); - info.Description = GettextCatalog.GetString ("Clean {0}", IdeApp.ProjectOperations.CurrentSelectedCombineEntry.Name); + if (IdeApp.ProjectOperations.CurrentSelectedBuildTarget != null) { + info.Text = GettextCatalog.GetString ("C_lean {0}", IdeApp.ProjectOperations.CurrentSelectedBuildTarget.Name); + info.Description = GettextCatalog.GetString ("Clean {0}", IdeApp.ProjectOperations.CurrentSelectedBuildTarget.Name); } else { info.Enabled = false; } @@ -389,18 +380,18 @@ namespace MonoDevelop.Ide.Commands } } - internal class CombineEntryOptionsHandler: CommandHandler + internal class SolutionItemOptionsHandler: CommandHandler { protected override void Run () { - CombineEntry ce = IdeApp.ProjectOperations.CurrentSelectedCombineEntry; + IBuildTarget ce = IdeApp.ProjectOperations.CurrentSelectedBuildTarget; if (ce != null) IdeApp.ProjectOperations.ShowOptions (ce); } protected override void Update (CommandInfo info) { - info.Enabled = IdeApp.ProjectOperations.CurrentSelectedCombineEntry != null; + info.Enabled = IdeApp.ProjectOperations.CurrentSelectedBuildTarget != null; } } @@ -408,14 +399,14 @@ namespace MonoDevelop.Ide.Commands { protected override void Run (object c) { - CombineEntry ce = IdeApp.ProjectOperations.CurrentSelectedCombineEntry; + IWorkspaceObject ce = IdeApp.ProjectOperations.CurrentSelectedBuildTarget; CustomCommand cmd = (CustomCommand) c; IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetRunProgressMonitor (); Thread t = new Thread ( delegate () { using (monitor) { - cmd.Execute (monitor, ce); + cmd.Execute (monitor, ce, IdeApp.Workspace.ActiveConfiguration); } } ); @@ -425,9 +416,9 @@ namespace MonoDevelop.Ide.Commands protected override void Update (CommandArrayInfo info) { - CombineEntry ce = IdeApp.ProjectOperations.CurrentSelectedCombineEntry; + IConfigurationTarget ce = IdeApp.ProjectOperations.CurrentSelectedBuildTarget as IConfigurationTarget; if (ce != null) { - AbstractConfiguration conf = ce.ActiveConfiguration as AbstractConfiguration; + ItemConfiguration conf = ce.DefaultConfiguration; if (conf != null) { foreach (CustomCommand cmd in conf.CustomCommands) if (cmd.Type == CustomCommandType.Custom) @@ -441,107 +432,14 @@ namespace MonoDevelop.Ide.Commands { protected override void Run () { - CombineEntry ce = IdeApp.ProjectOperations.CurrentSelectedCombineEntry; + IWorkspaceObject ce = IdeApp.ProjectOperations.CurrentSelectedItem as IWorkspaceObject; IdeApp.ProjectOperations.Export (ce, null); } protected override void Update (CommandInfo info) { - info.Enabled = IdeApp.ProjectOperations.CurrentSelectedCombineEntry != null; + info.Enabled = IdeApp.ProjectOperations.CurrentSelectedItem is WorkspaceItem || IdeApp.ProjectOperations.CurrentSelectedItem is SolutionEntityItem; } } - - internal class GenerateProjectDocumentation : CommandHandler - { - protected override void Run () - { - try { - if (IdeApp.ProjectOperations.CurrentSelectedProject != null) { - string assembly = IdeApp.ProjectOperations.CurrentSelectedProject.GetOutputFileName (); - string projectFile = Path.ChangeExtension(assembly, ".ndoc"); - if (!File.Exists(projectFile)) { - StreamWriter sw = File.CreateText(projectFile); - sw.WriteLine("<project>"); - sw.WriteLine(" <assemblies>"); - sw.WriteLine(" <assembly location=\""+ assembly +"\" documentation=\"" + Path.ChangeExtension(assembly, ".xml") + "\" />"); - sw.WriteLine(" </assemblies>"); - /* - sw.WriteLine(" <documenters>"); - sw.WriteLine(" <documenter name=\"JavaDoc\">"); - sw.WriteLine(" <property name=\"Title\" value=\"NDoc\" />"); - sw.WriteLine(" <property name=\"OutputDirectory\" value=\".\\docs\\JavaDoc\" />"); - sw.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"False\" />"); - sw.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"False\" />"); - sw.WriteLine(" <property name=\"ShowMissingParams\" value=\"False\" />"); - sw.WriteLine(" <property name=\"ShowMissingReturns\" value=\"False\" />"); - sw.WriteLine(" <property name=\"ShowMissingValues\" value=\"False\" />"); - sw.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />"); - sw.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />"); - sw.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />"); - sw.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"False\" />"); - sw.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"False\" />"); - sw.WriteLine(" <property name=\"CopyrightText\" value=\"\" />"); - sw.WriteLine(" <property name=\"CopyrightHref\" value=\"\" />"); - sw.WriteLine(" </documenter>"); - sw.WriteLine(" <documenter name=\"MSDN\">"); - sw.WriteLine(" <property name=\"OutputDirectory\" value=\".\\docs\\MSDN\" />"); - sw.WriteLine(" <property name=\"HtmlHelpName\" value=\"NDoc\" />"); - sw.WriteLine(" <property name=\"HtmlHelpCompilerFilename\" value=\"C:\\Program Files\\HTML Help Workshop\\hhc.exe\" />"); - sw.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />"); - sw.WriteLine(" <property name=\"Title\" value=\"An NDoc Documented Class Library\" />"); - sw.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />"); - sw.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />"); - sw.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />"); - sw.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"False\" />"); - sw.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"False\" />"); - sw.WriteLine(" <property name=\"ShowMissingParams\" value=\"False\" />"); - sw.WriteLine(" <property name=\"ShowMissingValues\" value=\"False\" />"); - sw.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />"); - sw.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />"); - sw.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />"); - sw.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"False\" />"); - sw.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"False\" />"); - sw.WriteLine(" <property name=\"CopyrightText\" value=\"\" />"); - sw.WriteLine(" <property name=\"CopyrightHref\" value=\"\" />"); - sw.WriteLine(" </documenter>"); - sw.WriteLine(" <documenter name=\"XML\">"); - sw.WriteLine(" <property name=\"OutputFile\" value=\".\\docs\\doc.xml\" />"); - sw.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"False\" />"); - sw.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"False\" />"); - sw.WriteLine(" <property name=\"ShowMissingParams\" value=\"False\" />"); - sw.WriteLine(" <property name=\"ShowMissingReturns\" value=\"False\" />"); - sw.WriteLine(" <property name=\"ShowMissingValues\" value=\"False\" />"); - sw.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />"); - sw.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />"); - sw.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />"); - sw.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"False\" />"); - sw.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"False\" />"); - sw.WriteLine(" <property name=\"CopyrightText\" value=\"\" />"); - sw.WriteLine(" <property name=\"CopyrightHref\" value=\"\" />"); - sw.WriteLine(" </documenter>"); - sw.WriteLine(" </documenters>");*/ - sw.WriteLine(" </project>"); - sw.Close(); - } - string command = FileService.ApplicationRootPath + - Path.DirectorySeparatorChar + "bin" + - Path.DirectorySeparatorChar + "ndoc" + - Path.DirectorySeparatorChar + "NDocGui.exe"; - string args = '"' + projectFile + '"'; - - ProcessStartInfo psi = new ProcessStartInfo(command, args); - psi.WorkingDirectory = FileService.ApplicationRootPath + - Path.DirectorySeparatorChar + "bin" + - Path.DirectorySeparatorChar + "ndoc"; - psi.UseShellExecute = false; - Process p = new Process(); - p.StartInfo = psi; - p.Start(); - } - } catch (Exception) { - //MessageBox.Show("You need to compile the project first.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1); - } - } - } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/RefactoryCommands.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/RefactoryCommands.cs index b10c64687c..7f36a0b6ee 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/RefactoryCommands.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/RefactoryCommands.cs @@ -63,7 +63,7 @@ namespace MonoDevelop.Ide.Commands protected override void Update (CommandArrayInfo ainfo) { Document doc = IdeApp.Workbench.ActiveDocument; - if (doc != null && doc.FileName != null) { + if (doc != null && doc.FileName != null && IdeApp.ProjectOperations.CurrentSelectedSolution != null) { ITextBuffer editor = IdeApp.Workbench.ActiveDocument.GetContent <ITextBuffer>(); if (editor != null) { bool added = false; @@ -73,11 +73,11 @@ namespace MonoDevelop.Ide.Commands IParseInformation pinfo; IParserContext ctx; if (doc.Project != null) { - ctx = IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (doc.Project); - pinfo = IdeApp.ProjectOperations.ParserDatabase.UpdateFile (doc.Project, doc.FileName, editor.Text); + ctx = IdeApp.Workspace.ParserDatabase.GetProjectParserContext (doc.Project); + pinfo = IdeApp.Workspace.ParserDatabase.UpdateFile (doc.Project, doc.FileName, editor.Text); } else { - ctx = IdeApp.ProjectOperations.ParserDatabase.GetFileParserContext (doc.FileName); - pinfo = IdeApp.ProjectOperations.ParserDatabase.UpdateFile (doc.FileName, editor.Text); + ctx = IdeApp.Workspace.ParserDatabase.GetFileParserContext (doc.FileName); + pinfo = IdeApp.Workspace.ParserDatabase.UpdateFile (doc.FileName, editor.Text); } // Look for an identifier at the cursor position @@ -372,7 +372,7 @@ namespace MonoDevelop.Ide.Commands void FindReferencesThread () { using (monitor) { - CodeRefactorer refactorer = IdeApp.ProjectOperations.CodeRefactorer; + CodeRefactorer refactorer = IdeApp.Workspace.GetCodeRefactorer (IdeApp.ProjectOperations.CurrentSelectedSolution); if (item is IMember) { IMember member = (IMember) item; @@ -451,8 +451,9 @@ namespace MonoDevelop.Ide.Commands using (monitor) { IClass cls = (IClass) item; if (cls == null) return; - - IClass[] classes = IdeApp.ProjectOperations.CodeRefactorer.FindDerivedClasses (cls); + + CodeRefactorer cr = IdeApp.Workspace.GetCodeRefactorer (IdeApp.ProjectOperations.CurrentSelectedSolution); + IClass[] classes = cr.FindDerivedClasses (cls); foreach (IClass sub in classes) { if (sub.Region != null) monitor.ReportResult (sub.Region.FileName, sub.Region.BeginLine, sub.Region.BeginColumn, sub.FullyQualifiedName); @@ -462,7 +463,7 @@ namespace MonoDevelop.Ide.Commands void ImplementInterface (bool explicitly) { - CodeRefactorer refactorer = IdeApp.ProjectOperations.CodeRefactorer; + CodeRefactorer refactorer = IdeApp.Workspace.GetCodeRefactorer (IdeApp.ProjectOperations.CurrentSelectedSolution); IClass iface = item as IClass; if (klass == null) diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/SearchCommands.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/SearchCommands.cs index 48f7bff269..8f3ca600cd 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/SearchCommands.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/SearchCommands.cs @@ -79,7 +79,7 @@ namespace MonoDevelop.Ide.Commands protected override void Update(CommandInfo info) { - info.Enabled = (IdeApp.ProjectOperations.CurrentOpenCombine != null || IdeApp.Workbench.Documents.Count != 0); + info.Enabled = (IdeApp.Workspace.IsOpen || IdeApp.Workbench.Documents.Count != 0); } } @@ -92,7 +92,7 @@ namespace MonoDevelop.Ide.Commands protected override void Update(CommandInfo info) { - info.Enabled = (IdeApp.ProjectOperations.CurrentOpenCombine != null || IdeApp.Workbench.Documents.Count != 0); + info.Enabled = (IdeApp.Workspace.IsOpen || IdeApp.Workbench.Documents.Count != 0); } } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Dom.Output/NetAmbience.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Dom.Output/NetAmbience.cs index 2fccdf14b0..27172e7e5c 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Dom.Output/NetAmbience.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Dom.Output/NetAmbience.cs @@ -33,8 +33,6 @@ namespace MonoDevelop.Ide.Dom.Output { public class NetAmbience : Ambience, IDomVisitor { - const string nullString = "Null"; - protected override IDomVisitor OutputVisitor { get { return this; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Dom.Parser/ProjectParserService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Dom.Parser/ProjectParserService.cs index 7749479881..38f582710d 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Dom.Parser/ProjectParserService.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Dom.Parser/ProjectParserService.cs @@ -59,7 +59,7 @@ namespace MonoDevelop.Ide.Dom.Parser break; } }); - MonoDevelop.Ide.Gui.IdeApp.ProjectOperations.CombineOpened += delegate { + MonoDevelop.Ide.Gui.IdeApp.Workspace.FirstWorkspaceItemOpened += delegate { LoadWholeSolution (); }; LoadWholeSolution (); @@ -90,14 +90,16 @@ namespace MonoDevelop.Ide.Dom.Parser static void LoadWholeSolutionThread () { - foreach (CombineEntry entry in MonoDevelop.Ide.Gui.IdeApp.ProjectOperations.CurrentOpenCombine.GetAllProjects ()) { + if (!MonoDevelop.Ide.Gui.IdeApp.Workspace.IsOpen) + return; + foreach (SolutionItem entry in MonoDevelop.Ide.Gui.IdeApp.Workspace.GetAllProjects ()) { Project project = (Project)entry; IParser parser = GetParser (project.ProjectType); if (parser == null) continue; ProjectDom dom = GetDom (project); - foreach (ProjectFile file in project.ProjectFiles) { + foreach (ProjectFile file in project.Files) { if (file.BuildAction != BuildAction.Compile) continue; dom.UpdateCompilationUnit (parser.Parse (file.FilePath, System.IO.File.ReadAllText (file.FilePath))); @@ -111,8 +113,6 @@ namespace MonoDevelop.Ide.Dom.Parser static void LoadWholeSolution () { - if (MonoDevelop.Ide.Gui.IdeApp.ProjectOperations.CurrentOpenCombine == null) - return; Thread t = new Thread (new ThreadStart (LoadWholeSolutionThread)); t.IsBackground = true; t.Priority = ThreadPriority.Lowest; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.ExternalTools/ExternalToolPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.ExternalTools/ExternalToolPanel.cs index 9a5add274c..43b2d52ae6 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.ExternalTools/ExternalToolPanel.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.ExternalTools/ExternalToolPanel.cs @@ -327,7 +327,6 @@ namespace MonoDevelop.Ide.ExternalTools public bool Validate () { - List<ExternalTool> newlist = new List<ExternalTool> (); TreeIter first; if (toolListBox.Model.GetIterFirst (out first)) { TreeIter current = first; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/TextEditorExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/TextEditorExtension.cs index d509e05602..0a1b8f1e0b 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/TextEditorExtension.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/TextEditorExtension.cs @@ -69,7 +69,7 @@ namespace MonoDevelop.Ide.Gui.Content IViewContent view = document.Window.ViewContent; string file = view.IsUntitled ? view.UntitledName : view.ContentName; Project project = view.Project; - IParserDatabase pdb = IdeApp.ProjectOperations.ParserDatabase; + IParserDatabase pdb = IdeApp.Workspace.ParserDatabase; if (project != null) return pdb.GetProjectParserContext (project); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/CombineEntryFeatureSelector.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/CombineEntryFeatureSelector.cs index 71241ba120..f986f81bb6 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/CombineEntryFeatureSelector.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/CombineEntryFeatureSelector.cs @@ -38,10 +38,10 @@ namespace MonoDevelop.Ide.Gui.Dialogs { public partial class CombineEntryFeatureSelector : Gtk.Bin { - List<ICombineEntryFeature> selectedFeatures = new List<ICombineEntryFeature> (); + List<ISolutionItemFeature> selectedFeatures = new List<ISolutionItemFeature> (); List<Gtk.Widget> selectedEditors = new List<Gtk.Widget> (); - CombineEntry entry; - Combine parentCombine; + SolutionItem entry; + SolutionFolder parentCombine; VBox box = new VBox (); Gdk.Cursor handCursor; @@ -54,7 +54,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs box.Show (); } - public void Fill (Combine parentCombine, CombineEntry entry, ICombineEntryFeature[] features) + public void Fill (SolutionFolder parentCombine, SolutionItem entry, ISolutionItemFeature[] features) { selectedFeatures.Clear (); selectedEditors.Clear (); @@ -67,13 +67,13 @@ namespace MonoDevelop.Ide.Gui.Dialogs w.Destroy (); } // Show enabled features at the beginning - foreach (ICombineEntryFeature feature in features) + foreach (ISolutionItemFeature feature in features) if (feature.IsEnabled (parentCombine, entry)) { Gtk.Widget editor = AddFeature (feature); selectedFeatures.Add (feature); selectedEditors.Add (editor); } - foreach (ICombineEntryFeature feature in features) + foreach (ISolutionItemFeature feature in features) if (!feature.IsEnabled (parentCombine, entry)) AddFeature (feature); @@ -88,7 +88,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs scrolled.AddWithViewport (box); } - Gtk.Widget AddFeature (ICombineEntryFeature feature) + Gtk.Widget AddFeature (ISolutionItemFeature feature) { Gtk.HBox cbox = new Gtk.HBox (); CheckButton check = null; @@ -136,7 +136,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs } if (check != null) { - ICombineEntryFeature f = feature; + ISolutionItemFeature f = feature; check.Toggled += delegate { OnClickFeature (f, check, fbox, editor); }; @@ -146,7 +146,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs return editor; } - void OnClickFeature (ICombineEntryFeature feature, CheckButton check, HBox fbox, Gtk.Widget editor) + void OnClickFeature (ISolutionItemFeature feature, CheckButton check, HBox fbox, Gtk.Widget editor) { if (editor != null) fbox.Visible = check.Active; @@ -162,7 +162,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs public bool Validate () { for (int n=0; n<selectedFeatures.Count; n++) { - ICombineEntryFeature pf = selectedFeatures [n]; + ISolutionItemFeature pf = selectedFeatures [n]; string msg = pf.Validate (parentCombine, entry, selectedEditors [n]); if (!string.IsNullOrEmpty (msg)) { msg = pf.Title + ": " + msg; @@ -177,7 +177,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs { for (int n=0; n<selectedFeatures.Count; n++) { try { - ICombineEntryFeature pf = selectedFeatures [n]; + ISolutionItemFeature pf = selectedFeatures [n]; pf.ApplyFeature (parentCombine, entry, selectedEditors [n]); } catch (Exception ex) { diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/DirtyFilesDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/DirtyFilesDialog.cs index a7b43ff245..4529c3811b 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/DirtyFilesDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/DirtyFilesDialog.cs @@ -24,9 +24,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs tvFiles = new TreeView (tsFiles); TreeIter topCombineIter = TreeIter.Zero; Hashtable projectIters = new Hashtable (); - if (IdeApp.ProjectOperations.CurrentOpenCombine != null) { - topCombineIter = tsFiles.AppendValues (GettextCatalog.GetString ("Solution: {0}", IdeApp.ProjectOperations.CurrentOpenCombine.Name), true, null, false); - } + foreach (Document doc in IdeApp.Workbench.Documents) { if (!doc.IsDirty) continue; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/EncapsulateFieldDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/EncapsulateFieldDialog.cs index e18e606141..a85f4fa936 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/EncapsulateFieldDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/EncapsulateFieldDialog.cs @@ -154,7 +154,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs { void OnOKClicked (object sender, EventArgs e) { - CodeRefactorer refactorer = IdeApp.ProjectOperations.CodeRefactorer; + CodeRefactorer refactorer = IdeApp.Workspace.GetCodeRefactorer (IdeApp.ProjectOperations.CurrentSelectedSolution); IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetBackgroundProgressMonitor (this.Title, null); string name = entryPropertyName.Text; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ExportProjectDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ExportProjectDialog.cs index 3d44820a58..58e98ba4dc 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ExportProjectDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ExportProjectDialog.cs @@ -35,14 +35,17 @@ namespace MonoDevelop.Ide.Gui.Dialogs { public partial class ExportProjectDialog : Gtk.Dialog { - IFileFormat[] formats; + FileFormat[] formats; - public ExportProjectDialog (CombineEntry entry, IFileFormat selectedFormat) + public ExportProjectDialog (IWorkspaceObject entry, FileFormat selectedFormat) { this.Build(); + FileFormat f = entry is WorkspaceItem ? ((WorkspaceItem)entry).FileFormat : ((SolutionEntityItem)entry).FileFormat; + labelNewFormat.Text = f.Name; + formats = Services.ProjectService.FileFormats.GetFileFormatsForObject (entry); - foreach (IFileFormat format in formats) + foreach (FileFormat format in formats) comboFormat.AppendText (format.Name); int sel = Array.IndexOf (formats, selectedFormat); @@ -53,7 +56,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs UpdateControls (); } - public IFileFormat Format { + public FileFormat Format { get { return formats [comboFormat.Active]; } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/FeatureSelectorDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/FeatureSelectorDialog.cs index 592f783e5b..80da6ab503 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/FeatureSelectorDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/FeatureSelectorDialog.cs @@ -36,10 +36,10 @@ namespace MonoDevelop.Ide.Gui.Dialogs public partial class FeatureSelectorDialog : Gtk.Dialog { - public FeatureSelectorDialog (Combine parentCombine, CombineEntry entry) + public FeatureSelectorDialog (SolutionFolder parentCombine, SolutionItem entry) { this.Build(); - featureList.Fill (parentCombine, entry, CombineEntryFeatures.GetFeatures (parentCombine, entry)); + featureList.Fill (parentCombine, entry, SolutionItemFeatures.GetFeatures (parentCombine, entry)); } protected virtual void OnButtonOkClicked(object sender, System.EventArgs e) diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/FileSelectorDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/FileSelectorDialog.cs index a889500f4e..9a9f0fa5dd 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/FileSelectorDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/FileSelectorDialog.cs @@ -48,9 +48,9 @@ namespace MonoDevelop.Ide.Gui.Dialogs Gtk.Label encodingLabel; Gtk.OptionMenu encodingMenu; - Gtk.Label viewerLabel; Gtk.ComboBox viewerSelector; + Gtk.CheckButton closeWorkspaceCheck; ArrayList currentViewers = new ArrayList (); public FileSelectorDialog (string title): this (title, Gtk.FileChooserAction.Open) @@ -126,8 +126,13 @@ namespace MonoDevelop.Ide.Gui.Dialogs viewerLabel.Xalign = 0; table.Attach (viewerLabel, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 0, 0); + Gtk.HBox box = new HBox (false, 6); viewerSelector = Gtk.ComboBox.NewText (); - table.Attach (viewerSelector, 1, 2, 1, 2, AttachOptions.Expand|AttachOptions.Fill, AttachOptions.Expand|AttachOptions.Fill, 0, 0); + box.PackStart (viewerSelector, true, true, 0); + closeWorkspaceCheck = new CheckButton (GettextCatalog.GetString ("Close current workspace")); + closeWorkspaceCheck.Active = true; + box.PackStart (closeWorkspaceCheck, false, false, 0); + table.Attach (box, 1, 2, 1, 2, AttachOptions.Expand|AttachOptions.Fill, AttachOptions.Expand|AttachOptions.Fill, 0, 0); FillViewers (); viewerSelector.Changed += OnViewerChanged; @@ -179,6 +184,10 @@ namespace MonoDevelop.Ide.Gui.Dialogs set { viewerLabel.Visible = viewerSelector.Visible = value; } } + public bool CloseCurrentWorkspace { + get { return closeWorkspaceCheck.Active; } + } + void FillEncodings () { selectOption = -1; @@ -245,8 +254,8 @@ namespace MonoDevelop.Ide.Gui.Dialogs if (Filename == null || Filename.Length == 0 || System.IO.Directory.Exists (Filename)) return; - - if (IdeApp.Services.ProjectService.IsCombineEntryFile (Filename)) { + + if (IdeApp.Services.ProjectService.IsWorkspaceItemFile (Filename) || IdeApp.Services.ProjectService.IsSolutionItemFile (Filename)) { viewerSelector.AppendText (GettextCatalog.GetString ("Solution Workbench")); currentViewers.Add (null); } @@ -271,13 +280,18 @@ namespace MonoDevelop.Ide.Gui.Dialogs if (Filename == null || Filename.Length == 0 || System.IO.Directory.Exists (Filename)) { encodingLabel.Sensitive = encodingMenu.Sensitive = false; viewerLabel.Sensitive = viewerSelector.Sensitive = false; + closeWorkspaceCheck.Visible = false; return; } - - if (IdeApp.Services.ProjectService.IsCombineEntryFile (Filename)) + + if (IdeApp.Services.ProjectService.IsWorkspaceItemFile (Filename) || IdeApp.Services.ProjectService.IsSolutionItemFile (Filename)) { encodingLabel.Sensitive = encodingMenu.Sensitive = (SelectedViewer != null); - else + closeWorkspaceCheck.Visible = viewerLabel.Visible && IdeApp.Workspace.IsOpen; + } + else { encodingLabel.Sensitive = encodingMenu.Sensitive = true; + closeWorkspaceCheck.Visible = false; + } viewerLabel.Sensitive = viewerSelector.Sensitive = currentViewers.Count > 1; } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/GoToDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/GoToDialog.cs index 88b7adddb1..6986b38d82 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/GoToDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/GoToDialog.cs @@ -33,6 +33,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Threading; using Gdk; using Gtk; @@ -338,7 +339,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs if (searchFiles) { CheckFile (doc.FileName, toMatch); } else { - IParserContext ctx = IdeApp.ProjectOperations.ParserDatabase.GetFileParserContext(doc.FileName); + IParserContext ctx = IdeApp.Workspace.ParserDatabase.GetFileParserContext(doc.FileName); if (ctx != null) { IParseInformation info = ctx.ParseFile(doc.FileName); if(info != null) { @@ -351,15 +352,11 @@ namespace MonoDevelop.Ide.Gui.Dialogs } } - Combine s = IdeApp.ProjectOperations.CurrentOpenCombine; - if (s == null) - return; - - CombineEntryCollection projects = s.GetAllProjects (); + ReadOnlyCollection<Project> projects = IdeApp.Workspace.GetAllProjects (); if (projects.Count < 1) return; - foreach (CombineEntry entry in projects) { + foreach (SolutionItem entry in projects) { if (!searchCycleActive) return; Project p = entry as Project; @@ -372,7 +369,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs } if (searchFiles) { - ProjectFileCollection files = p.ProjectFiles; + ProjectFileCollection files = p.Files; if (files.Count < 1) continue; @@ -381,7 +378,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs CheckFile (file.FilePath, toMatch); } } else { - IParserContext ctx = IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (p); + IParserContext ctx = IdeApp.Workspace.ParserDatabase.GetProjectParserContext (p); foreach (IClass c in ctx.GetProjectContents()) { if (!searchCycleActive) return; CheckType (c, toMatch); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/IncludeFilesDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/IncludeFilesDialog.cs index e445f14e1a..83378d72af 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/IncludeFilesDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/IncludeFilesDialog.cs @@ -118,12 +118,12 @@ namespace MonoDevelop.Ide.Gui.Dialogs } else { finfo.BuildAction = BuildAction.Exclude; } - project.ProjectFiles.Add(finfo); + project.Files.Add(finfo); store.IterNext(ref current); } - IdeApp.ProjectOperations.SaveCombine (); + IdeApp.Workspace.Save (); Destroy(); } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/NewFileDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/NewFileDialog.cs index ce3759e144..70b37c2f9d 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/NewFileDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/NewFileDialog.cs @@ -21,6 +21,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.IO; using MonoDevelop.Core.Gui.Components; @@ -53,8 +54,9 @@ namespace MonoDevelop.Ide.Gui.Dialogs TreeStore catStore; // Add To Project widgets - Combine solution; + WorkspaceItem solution; string[] projectNames; + Project[] projectRefs; Project parentProject; string basePath; @@ -543,8 +545,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs void AddToProjectComboChanged (object o, EventArgs e) { int which = projectAddCombo.Active; - string projectName = projectNames[which]; - Project project = solution.FindProject (projectName); + Project project = projectRefs [which]; if (project != null) { if (basePath == null || basePath == String.Empty || @@ -586,12 +587,9 @@ namespace MonoDevelop.Ide.Gui.Dialogs nameEntry.Changed += new EventHandler (NameChanged); nameEntry.Activated += new EventHandler (OpenEvent); - CombineEntryCollection projects = null; - if (parentProject == null) { - solution = IdeApp.ProjectOperations.CurrentOpenCombine; - if (solution != null) - projects = solution.GetAllProjects (); - } + ReadOnlyCollection<Project> projects = null; + if (parentProject == null) + projects = IdeApp.Workspace.GetAllProjects (); if (projects != null) { Project curProject = IdeApp.ProjectOperations.CurrentSelectedProject; @@ -601,23 +599,26 @@ namespace MonoDevelop.Ide.Gui.Dialogs projectAddCheckbox.Toggled += new EventHandler (AddToProjectToggled); projectNames = new string [projects.Count]; + projectRefs = new Project [projects.Count]; int i = 0; - foreach (Project project in projects) - projectNames[i++] = project.Name; + bool singleSolution = IdeApp.Workspace.Items.Count == 1 && IdeApp.Workspace.Items [0] is Solution; - Array.Sort (projectNames); - if (curProject != null) { - for (i = 0; i < projectNames.Length; i++) { - if (projectNames[i] == curProject.Name) - break; - } + foreach (Project project in projects) { + projectRefs[i] = project; + if (singleSolution) + projectNames[i++] = project.Name; + else + projectNames[i++] = project.ParentSolution.Name + "/" + project.Name; } + Array.Sort (projectNames, projectRefs); + i = Array.IndexOf (projectRefs, curProject); + foreach (string pn in projectNames) projectAddCombo.AppendText (pn); - projectAddCombo.Active = i; + projectAddCombo.Active = i != -1 ? i : 0; projectAddCombo.Sensitive = projectAddCheckbox.Active; projectAddCombo.Changed += new EventHandler (AddToProjectComboChanged); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/NewProjectDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/NewProjectDialog.cs index 89e7ce51f4..ce9e73c280 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/NewProjectDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/NewProjectDialog.cs @@ -48,16 +48,17 @@ namespace MonoDevelop.Ide.Gui.Dialogs { IconView TemplateView; TreeStore catStore; - bool openCombine; + bool openSolution; string basePath; - bool newCombine; + bool newSolution; string lastName = ""; ProjectTemplate selectedItem; - CombineEntry currentEntry; - Combine parentCombine; + SolutionItem currentEntry; + SolutionFolder parentFolder; CombineEntryFeatureSelector featureList; + IWorkspaceFileObject newItem; - public NewProjectDialog (Combine parentCombine, bool openCombine, bool newCombine, string basePath) + public NewProjectDialog (SolutionFolder parentFolder, bool openCombine, string basePath) { Build (); featureList = new CombineEntryFeatureSelector (); @@ -66,16 +67,16 @@ namespace MonoDevelop.Ide.Gui.Dialogs { notebook.Page = 0; notebook.ShowTabs = false; - this.parentCombine = parentCombine; + this.parentFolder = parentFolder; this.basePath = basePath; - this.newCombine = newCombine; - this.openCombine = openCombine; + this.newSolution = parentFolder == null; + this.openSolution = openCombine; TransientFor = IdeApp.Workbench.RootWindow; - Title = newCombine ? GettextCatalog.GetString ("New Solution") : GettextCatalog.GetString ("New Project"); + Title = newSolution ? GettextCatalog.GetString ("New Solution") : GettextCatalog.GetString ("New Project"); InitializeTemplates (); - if (!newCombine) { + if (!newSolution) { txt_subdirectory.Hide (); chk_combine_directory.Active = false; chk_combine_directory.Hide (); @@ -199,7 +200,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs { { foreach (ProjectTemplate template in ProjectTemplate.ProjectTemplates) { // When creating a project (not a solution) hide solutions that don't have at least one project - if (!newCombine && template.CombineDescriptor.EntryDescriptors.Length == 0) + if (!newSolution && template.CombineDescriptor.EntryDescriptors.Length == 0) continue; TemplateItem titem = new TemplateItem(template); Category cat = GetCategory(titem.Template.Category); @@ -265,6 +266,12 @@ namespace MonoDevelop.Ide.Gui.Dialogs { return System.IO.Path.Combine (path, GetValidDir (txt_name.Text)); } } + + public IWorkspaceObject NewItem { + get { + return newItem; + } + } protected void SolutionCheckChanged (object sender, EventArgs e) { @@ -289,27 +296,6 @@ namespace MonoDevelop.Ide.Gui.Dialogs { lbl_will_save_in.Text = GettextCatalog.GetString("Project will be saved at") + " " + ProjectLocation; } - public bool IsFilenameAvailable(string fileName) - { - return true; - } - - public void SaveFile(Project project, string filename, string content, bool showFile) - { - project.ProjectFiles.Add (new ProjectFile(filename)); - - StreamWriter sr = System.IO.File.CreateText (filename); - sr.Write (StringParserService.Parse(content, new string[,] { {"PROJECT", txt_name.Text}, {"FILE", System.IO.Path.GetFileName(filename)}})); - sr.Close(); - - if (showFile) { - string longfilename = System.IO.Path.Combine (ProjectLocation, StringParserService.Parse (filename, new string[,] { {"PROJECT", txt_name.Text}})); - IdeApp.Workbench.OpenDocument (longfilename); - } - } - - public string NewCombineEntryLocation; - void OpenEvent (object sender, EventArgs e) { if (!btn_new.Sensitive) @@ -319,28 +305,28 @@ namespace MonoDevelop.Ide.Gui.Dialogs { if (!CreateProject ()) return; - CombineEntry entry; - try { - entry = Services.ProjectService.ReadCombineEntry (NewCombineEntryLocation, new MonoDevelop.Core.ProgressMonitoring.NullProgressMonitor ()); - } - catch (Exception ex) { - MessageService.ShowException (ex, GettextCatalog.GetString ("The file '{0}' could not be loaded.", NewCombineEntryLocation)); - return; - } - if (parentCombine == null) { - parentCombine = (Combine) entry; - if (parentCombine.Entries.Count > 0) - currentEntry = parentCombine.Entries [0]; - else - currentEntry = parentCombine; + Solution parentSolution = null; + + if (parentFolder == null) { + WorkspaceItem item = (WorkspaceItem) newItem; + parentSolution = item as Solution; + if (parentSolution != null) { + if (parentSolution.RootFolder.Items.Count > 0) + currentEntry = parentSolution.RootFolder.Items [0] as SolutionItem; + parentFolder = parentSolution.RootFolder; + } } else { - currentEntry = entry; + SolutionItem item = (SolutionItem) newItem; + parentSolution = parentFolder.ParentSolution; + currentEntry = item; } - try { - featureList.Fill (parentCombine, currentEntry, CombineEntryFeatures.GetFeatures (parentCombine, currentEntry)); - } - catch (Exception ex) { - LoggingService.LogError (ex.ToString ()); + if (currentEntry != null) { + try { + featureList.Fill (parentFolder, currentEntry, SolutionItemFeatures.GetFeatures (parentFolder, currentEntry)); + } + catch (Exception ex) { + LoggingService.LogError (ex.ToString ()); + } } notebook.Page++; btn_new.Label = Gtk.Stock.Ok; @@ -350,16 +336,22 @@ namespace MonoDevelop.Ide.Gui.Dialogs { return; // New combines (not added to parent combines) already have the project as child. - if (!newCombine || (newCombine && !openCombine)) - parentCombine.Entries.Add (currentEntry); + if (!newSolution) { + // Make sure the new item is saved before adding. In this way the + // version control add-in will be able to put it under version control. + if (currentEntry is SolutionEntityItem) + IdeApp.ProjectOperations.Save ((SolutionEntityItem) currentEntry); + parentFolder.Items.Add (currentEntry); + } featureList.ApplyFeatures (); - if (newCombine) - IdeApp.ProjectOperations.SaveCombineEntry (parentCombine); - else - IdeApp.ProjectOperations.SaveCombine (); + if (parentFolder != null) + IdeApp.ProjectOperations.Save (parentFolder.ParentSolution); + else { + IdeApp.ProjectOperations.Save (newItem); + } - if (openCombine) + if (openSolution) selectedItem.OpenCreatedCombine(); Respond (ResponseType.Ok); } @@ -392,7 +384,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs { return false; } - if (parentCombine != null && parentCombine.RootCombine.FindProject (name) != null) { + if (parentFolder != null && parentFolder.ParentSolution.FindProjectByName (name) != null) { MessageService.ShowError (GettextCatalog.GetString ("A Project with that name is already in your Project Space")); return false; } @@ -427,10 +419,10 @@ namespace MonoDevelop.Ide.Gui.Dialogs { // cinfo.ProjectTemplate = item.Template; try { - if (newCombine) - NewCombineEntryLocation = item.CreateCombine (cinfo); + if (newSolution) + newItem = item.CreateWorkspaceItem (cinfo); else - NewCombineEntryLocation = item.CreateProject (cinfo); + newItem = item.CreateProject (cinfo); } catch (Exception ex) { MessageService.ShowException (ex, GettextCatalog.GetString ("The project could not be created")); return false; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ProjectReferencePanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ProjectReferencePanel.cs index d87e72752d..a164c8e4be 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ProjectReferencePanel.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ProjectReferencePanel.cs @@ -129,14 +129,14 @@ namespace MonoDevelop.Ide.Gui.Dialogs { void PopulateListView (Project configureProject) { - Combine openCombine = configureProject.RootCombine; + Solution openSolution = configureProject.ParentSolution; - if (openCombine == null) { + if (openSolution == null) { return; } bool circDeps = false; - foreach (Project projectEntry in openCombine.GetAllProjects()) { + foreach (DotNetProject projectEntry in openSolution.GetAllSolutionItems<DotNetProject>()) { if (projectEntry == configureProject) { continue; @@ -155,13 +155,13 @@ namespace MonoDevelop.Ide.Gui.Dialogs { store.AppendValues ("", "<span foreground='dimgrey'>" + GettextCatalog.GetString ("(Projects referencing '{0}' are not shown,\nsince cyclic dependencies are not allowed)", configureProject.Name) + "</span>", null, false, null, false); } - bool ProjectReferencesProject (Project project, string targetProject) + bool ProjectReferencesProject (DotNetProject project, string targetProject) { - foreach (ProjectReference pr in project.ProjectReferences) { + foreach (ProjectReference pr in project.References) { if (pr.Reference == targetProject) return true; - Project pref = project.RootCombine.FindProject (pr.Reference); + DotNetProject pref = project.ParentSolution.FindProjectByName (pr.Reference) as DotNetProject; if (pref != null && ProjectReferencesProject (pref, targetProject)) return true; } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/RenameItemDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/RenameItemDialog.cs index 070260e7d6..86bf3fa83c 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/RenameItemDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/RenameItemDialog.cs @@ -100,7 +100,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs { void OnOKClicked (object sender, EventArgs e) { - CodeRefactorer refactorer = IdeApp.ProjectOperations.CodeRefactorer; + CodeRefactorer refactorer = IdeApp.Workspace.GetCodeRefactorer (IdeApp.ProjectOperations.CurrentSelectedSolution); IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetBackgroundProgressMonitor (this.Title, null); string name = entry.Text; @@ -120,7 +120,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs { FileService.RenameFile(part.Region.FileName, newFileName); } } - IdeApp.ProjectOperations.SaveProject(IdeApp.ProjectOperations.CurrentSelectedProject); + IdeApp.ProjectOperations.Save(IdeApp.ProjectOperations.CurrentSelectedProject); } } } else if (item is LocalVariable) { diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/SelectReferenceDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/SelectReferenceDialog.cs index 624b57399b..0f018bc923 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/SelectReferenceDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/SelectReferenceDialog.cs @@ -38,7 +38,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs GacReferencePanel gacRefPanel; ProjectReferencePanel projectRefPanel; AssemblyReferencePanel assemblyRefPanel; - Project configureProject; + DotNetProject configureProject; const int NameColumn = 0; const int TypeNameColumn = 1; @@ -60,7 +60,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs } } - public void SetProject (Project configureProject) + public void SetProject (DotNetProject configureProject) { this.configureProject = configureProject; ((ListStore) ReferencesTreeView.Model).Clear (); @@ -70,11 +70,11 @@ namespace MonoDevelop.Ide.Gui.Dialogs DotNetProject netProject = configureProject as DotNetProject; if (netProject != null) - gacRefPanel.SetClrVersion (((DotNetProjectConfiguration)netProject.ActiveConfiguration).ClrVersion); + gacRefPanel.SetClrVersion (((DotNetProjectConfiguration)netProject.DefaultConfiguration).ClrVersion); gacRefPanel.Reset (); assemblyRefPanel.SetBasePath (configureProject.BaseDirectory); - foreach (ProjectReference refInfo in configureProject.ProjectReferences) + foreach (ProjectReference refInfo in configureProject.References) AddReference (refInfo); OnChanged (null, null); @@ -117,10 +117,10 @@ namespace MonoDevelop.Ide.Gui.Dialogs TreeIter AddProjectReference (ProjectReference refInfo) { - Combine c = configureProject.RootCombine; + Solution c = configureProject.ParentSolution; if (c == null) return TreeIter.Zero; - Project p = c.FindProject (refInfo.Reference); + Project p = c.FindProjectByName (refInfo.Reference); if (p == null) return TreeIter.Zero; string iconName = Services.Icons.GetImageForProjectType (p.ProjectType); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/LoadSavePanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/LoadSavePanel.cs index 1c0abc68f1..1de461a528 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/LoadSavePanel.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/LoadSavePanel.cs @@ -21,10 +21,13 @@ using System; using System.IO; using System.Collections; +using System.Collections.Generic; using MonoDevelop.Core.Gui; using MonoDevelop.Core.Gui.Dialogs; using MonoDevelop.Core; +using MonoDevelop.Ide.Gui; +using MonoDevelop.Projects; using Gtk; using MonoDevelop.Components; @@ -63,23 +66,28 @@ namespace MonoDevelop.Ide.Gui.OptionPanels partial class LoadSavePanelWidget : Gtk.Bin { + List<string> formats = new List<string> (); + public LoadSavePanelWidget () { Build (); - // - // load the internationalized strings. - // folderEntry.Path = IdeApp.ProjectOperations.ProjectsDefaultPath; - // - // setup the properties - // - loadUserDataCheckButton.Active = PropertyService.Get ( - "SharpDevelop.LoadDocumentProperties", true); - createBackupCopyCheckButton.Active = PropertyService.Get ( - "SharpDevelop.CreateBackupCopy", false); - loadPrevProjectCheckButton.Active = (bool) PropertyService.Get( - "SharpDevelop.LoadPrevProjectOnStartup", false); + + loadUserDataCheckButton.Active = IdeApp.Preferences.LoadDocumentUserProperties; + createBackupCopyCheckButton.Active = IdeApp.Preferences.CreateFileBackupCopies; + loadPrevProjectCheckButton.Active = IdeApp.Preferences.LoadPrevSolutionOnStartup; + + string defaultFormat = IdeApp.Preferences.DefaultProjectFileFormat; + + Solution sol = new Solution (); + FileFormat[] fs = IdeApp.Services.ProjectService.FileFormats.GetFileFormatsForObject (sol); + foreach (FileFormat f in fs) { + comboFileFormats.AppendText (f.Name); + formats.Add (f.Id); + if (f.Id == defaultFormat) + comboFileFormats.Active = formats.Count - 1; + } } public bool ValidateChanges () @@ -97,9 +105,10 @@ namespace MonoDevelop.Ide.Gui.OptionPanels public void Store () { - PropertyService.Set("SharpDevelop.LoadPrevProjectOnStartup", loadPrevProjectCheckButton.Active); - PropertyService.Set ("SharpDevelop.LoadDocumentProperties", loadUserDataCheckButton.Active); - PropertyService.Set ("SharpDevelop.CreateBackupCopy", createBackupCopyCheckButton.Active); + IdeApp.Preferences.LoadPrevSolutionOnStartup = loadPrevProjectCheckButton.Active; + IdeApp.Preferences.LoadDocumentUserProperties = loadUserDataCheckButton.Active; + IdeApp.Preferences.CreateFileBackupCopies = createBackupCopyCheckButton.Active; + IdeApp.Preferences.DefaultProjectFileFormat = formats [comboFileFormats.Active]; IdeApp.ProjectOperations.ProjectsDefaultPath = folderEntry.Path; } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassBrowser/ClassBrowserPadWidget.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassBrowser/ClassBrowserPadWidget.cs index ec20e82546..a43a44a534 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassBrowser/ClassBrowserPadWidget.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassBrowser/ClassBrowserPadWidget.cs @@ -54,18 +54,18 @@ namespace MonoDevelop.Ide.Gui.Pads.ClassBrowser scrolledwindow1.Add (treeView); scrolledwindow1.ShowAll (); - IdeApp.ProjectOperations.CombineOpened += (CombineEventHandler) DispatchService.GuiDispatch (new CombineEventHandler (OnOpenCombine)); - IdeApp.ProjectOperations.CombineClosed += (CombineEventHandler) DispatchService.GuiDispatch (new CombineEventHandler (OnCloseCombine)); + IdeApp.Workspace.WorkspaceItemOpened += OnOpenCombine; + IdeApp.Workspace.WorkspaceItemClosed += OnCloseCombine; } - void OnOpenCombine (object sender, CombineEventArgs e) + void OnOpenCombine (object sender, WorkspaceItemEventArgs e) { - treeView.LoadTree (e.Combine); + treeView.AddChild (e.Item); } - void OnCloseCombine (object sender, CombineEventArgs e) + void OnCloseCombine (object sender, WorkspaceItemEventArgs e) { - treeView.Clear (); + treeView.RemoveChild (e.Item); } } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassBrowser/ProjectNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassBrowser/ProjectNodeBuilder.cs index 4da7ffa91a..8dc0552104 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassBrowser/ProjectNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassBrowser/ProjectNodeBuilder.cs @@ -43,12 +43,12 @@ namespace MonoDevelop.Ide.Gui.Pads.ClassBrowser { public class ProjectNodeBuilder : TypeNodeBuilder { - CombineEntryRenamedEventHandler projectNameChanged; + SolutionItemRenamedEventHandler projectNameChanged; EventHandler domLoaded; public ProjectNodeBuilder () { - projectNameChanged = (CombineEntryRenamedEventHandler) DispatchService.GuiDispatch (new CombineEntryRenamedEventHandler (OnProjectRenamed)); + projectNameChanged = (SolutionItemRenamedEventHandler) DispatchService.GuiDispatch (new SolutionItemRenamedEventHandler (OnProjectRenamed)); domLoaded = (EventHandler) DispatchService.GuiDispatch (new EventHandler (OnProjectDomLoaded)); } @@ -148,9 +148,9 @@ namespace MonoDevelop.Ide.Gui.Pads.ClassBrowser return true; } - void OnProjectRenamed (object sender, CombineEntryRenamedEventArgs e) + void OnProjectRenamed (object sender, SolutionItemRenamedEventArgs e) { - ITreeBuilder tb = Context.GetTreeBuilder (e.CombineEntry); + ITreeBuilder tb = Context.GetTreeBuilder (e.SolutionItem); if (tb != null) tb.Update (); } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassBrowser/SolutionNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassBrowser/SolutionNodeBuilder.cs index 3b204d848d..63b0e6a71b 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassBrowser/SolutionNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassBrowser/SolutionNodeBuilder.cs @@ -40,19 +40,19 @@ namespace MonoDevelop.Ide.Gui.Pads.ClassBrowser { public class SolutionNodeBuilder : TypeNodeBuilder { - CombineEntryChangeEventHandler combineEntryAdded; - CombineEntryChangeEventHandler combineEntryRemoved; - CombineEntryRenamedEventHandler combineNameChanged; + SolutionItemChangeEventHandler SolutionItemAdded; + SolutionItemChangeEventHandler SolutionItemRemoved; + EventHandler<WorkspaceItemRenamedEventArgs> combineNameChanged; public SolutionNodeBuilder () { - combineEntryAdded = (CombineEntryChangeEventHandler) DispatchService.GuiDispatch (new CombineEntryChangeEventHandler (OnEntryAdded)); - combineEntryRemoved = (CombineEntryChangeEventHandler) DispatchService.GuiDispatch (new CombineEntryChangeEventHandler (OnEntryRemoved)); - combineNameChanged = (CombineEntryRenamedEventHandler) DispatchService.GuiDispatch (new CombineEntryRenamedEventHandler (OnCombineRenamed)); + SolutionItemAdded = (SolutionItemChangeEventHandler) DispatchService.GuiDispatch (new SolutionItemChangeEventHandler (OnEntryAdded)); + SolutionItemRemoved = (SolutionItemChangeEventHandler) DispatchService.GuiDispatch (new SolutionItemChangeEventHandler (OnEntryRemoved)); + combineNameChanged = (EventHandler<WorkspaceItemRenamedEventArgs>) DispatchService.GuiDispatch (new EventHandler<WorkspaceItemRenamedEventArgs> (OnCombineRenamed)); } public override Type NodeDataType { - get { return typeof(Combine); } + get { return typeof(Solution); } } public override string ContextMenuAddinPath { @@ -61,42 +61,32 @@ namespace MonoDevelop.Ide.Gui.Pads.ClassBrowser public override string GetNodeName (ITreeNavigator thisNode, object dataObject) { - return ((Combine)dataObject).Name; + return ((Solution)dataObject).Name; } public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) { - Combine combine = dataObject as Combine; - label = GettextCatalog.GetString ("Solution {0}", combine.Name); + Solution solution = dataObject as Solution; + label = GettextCatalog.GetString ("Solution {0}", solution.Name); icon = Context.GetIcon (Stock.Solution); } public override void BuildChildNodes (ITreeBuilder builder, object dataObject) { - Combine combine = (Combine) dataObject; - foreach (CombineEntry entry in combine.Entries) { + Solution solution = (Solution) dataObject; + foreach (SolutionItem entry in solution.Items) { builder.AddChild (entry); } } - void AddClasses (ITreeBuilder builder, CombineEntry entry) - { - if (entry is Combine) { - foreach (CombineEntry e in ((Combine)entry).Entries) - AddClasses (builder, e); - } else if (entry is Project) { - ProjectNodeBuilder.BuildChildNodes (builder, entry as Project); - } - } - public override bool HasChildNodes (ITreeBuilder builder, object dataObject) { - return ((Combine) dataObject).Entries.Count > 0; + return ((Solution) dataObject).Items.Count > 0; } public override int CompareObjects (ITreeNavigator thisNode, ITreeNavigator otherNode) { - if (otherNode.DataItem is Combine) + if (otherNode.DataItem is Solution) return DefaultSort; else return -1; @@ -104,44 +94,44 @@ namespace MonoDevelop.Ide.Gui.Pads.ClassBrowser public override void OnNodeAdded (object dataObject) { - Combine combine = (Combine) dataObject; - combine.EntryAdded += combineEntryAdded; - combine.EntryRemoved += combineEntryRemoved; - combine.NameChanged += combineNameChanged; + Solution sol = (Solution) dataObject; + sol.SolutionItemAdded += SolutionItemAdded; + sol.SolutionItemRemoved += SolutionItemRemoved; + sol.NameChanged += combineNameChanged; } public override void OnNodeRemoved (object dataObject) { - Combine combine = (Combine) dataObject; - combine.EntryAdded -= combineEntryAdded; - combine.EntryRemoved -= combineEntryRemoved; - combine.NameChanged -= combineNameChanged; + Solution sol = (Solution) dataObject; + sol.SolutionItemAdded -= SolutionItemAdded; + sol.SolutionItemRemoved -= SolutionItemRemoved; + sol.NameChanged -= combineNameChanged; } - void OnEntryAdded (object sender, CombineEntryEventArgs e) + void OnEntryAdded (object sender, SolutionItemEventArgs e) { - DispatchService.GuiDispatch (OnAddEntry, e.CombineEntry); + DispatchService.GuiDispatch (OnAddEntry, e.SolutionItem); } void OnAddEntry (object newEntry) { - CombineEntry e = (CombineEntry) newEntry; - ITreeBuilder tb = Context.GetTreeBuilder (e.ParentCombine); + SolutionItem item = (SolutionItem) newEntry; + ITreeBuilder tb = Context.GetTreeBuilder (item.ParentSolution); if (tb != null) { - tb.AddChild (e, true); + tb.AddChild (item, true); tb.Expanded = true; } } - void OnEntryRemoved (object sender, CombineEntryEventArgs e) + void OnEntryRemoved (object sender, SolutionItemEventArgs e) { - ITreeBuilder tb = Context.GetTreeBuilder (e.CombineEntry); + ITreeBuilder tb = Context.GetTreeBuilder (e.SolutionItem); if (tb != null) tb.Remove (); } - void OnCombineRenamed (object sender, CombineEntryRenamedEventArgs e) + void OnCombineRenamed (object sender, WorkspaceItemRenamedEventArgs e) { - ITreeBuilder tb = Context.GetTreeBuilder (e.CombineEntry); + ITreeBuilder tb = Context.GetTreeBuilder (e.Item); if (tb != null) tb.Update (); } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/CombineNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/CombineNodeBuilder.cs index 1683abdcb2..77d60c33b3 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/CombineNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/CombineNodeBuilder.cs @@ -37,19 +37,15 @@ namespace MonoDevelop.Ide.Gui.Pads.ClassPad { public class CombineNodeBuilder: TypeNodeBuilder { - CombineEntryChangeEventHandler combineEntryAdded; - CombineEntryChangeEventHandler combineEntryRemoved; - CombineEntryRenamedEventHandler combineNameChanged; + SolutionItemRenamedEventHandler combineNameChanged; public CombineNodeBuilder () { - combineEntryAdded = (CombineEntryChangeEventHandler) DispatchService.GuiDispatch (new CombineEntryChangeEventHandler (OnEntryAdded)); - combineEntryRemoved = (CombineEntryChangeEventHandler) DispatchService.GuiDispatch (new CombineEntryChangeEventHandler (OnEntryRemoved)); - combineNameChanged = (CombineEntryRenamedEventHandler) DispatchService.GuiDispatch (new CombineEntryRenamedEventHandler (OnCombineRenamed)); + combineNameChanged = (SolutionItemRenamedEventHandler) DispatchService.GuiDispatch (new SolutionItemRenamedEventHandler (OnCombineRenamed)); } public override Type NodeDataType { - get { return typeof(Combine); } + get { return typeof(SolutionFolder); } } public override string ContextMenuAddinPath { @@ -58,31 +54,32 @@ namespace MonoDevelop.Ide.Gui.Pads.ClassPad public override string GetNodeName (ITreeNavigator thisNode, object dataObject) { - return ((Combine)dataObject).Name; + return ((SolutionFolder)dataObject).Name; } public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) { - Combine combine = dataObject as Combine; + SolutionFolder combine = dataObject as SolutionFolder; label = GettextCatalog.GetString ("Solution {0}", combine.Name); - icon = Context.GetIcon (Stock.Solution); + icon = Context.GetIcon (Stock.SolutionFolderOpen); + closedIcon = Context.GetIcon (Stock.SolutionFolderClosed); } public override void BuildChildNodes (ITreeBuilder builder, object dataObject) { - Combine combine = (Combine) dataObject; + SolutionFolder combine = (SolutionFolder) dataObject; if (builder.Options ["ShowProjects"]) { - foreach (CombineEntry entry in combine.Entries) + foreach (SolutionItem entry in combine.Items) builder.AddChild (entry); } else { AddClasses (builder, combine); } } - void AddClasses (ITreeBuilder builder, CombineEntry entry) + void AddClasses (ITreeBuilder builder, SolutionItem entry) { - if (entry is Combine) { - foreach (CombineEntry e in ((Combine)entry).Entries) + if (entry is SolutionFolder) { + foreach (SolutionItem e in ((SolutionFolder)entry).Items) AddClasses (builder, e); } else if (entry is Project) { ProjectNodeBuilder.BuildChildNodes (builder, entry as Project); @@ -91,12 +88,12 @@ namespace MonoDevelop.Ide.Gui.Pads.ClassPad public override bool HasChildNodes (ITreeBuilder builder, object dataObject) { - return ((Combine) dataObject).Entries.Count > 0; + return ((SolutionFolder) dataObject).Items.Count > 0; } public override int CompareObjects (ITreeNavigator thisNode, ITreeNavigator otherNode) { - if (otherNode.DataItem is Combine) + if (otherNode.DataItem is SolutionFolder) return DefaultSort; else return -1; @@ -104,44 +101,19 @@ namespace MonoDevelop.Ide.Gui.Pads.ClassPad public override void OnNodeAdded (object dataObject) { - Combine combine = (Combine) dataObject; - combine.EntryAdded += combineEntryAdded; - combine.EntryRemoved += combineEntryRemoved; + SolutionFolder combine = (SolutionFolder) dataObject; combine.NameChanged += combineNameChanged; } public override void OnNodeRemoved (object dataObject) { - Combine combine = (Combine) dataObject; - combine.EntryAdded -= combineEntryAdded; - combine.EntryRemoved -= combineEntryRemoved; + SolutionFolder combine = (SolutionFolder) dataObject; combine.NameChanged -= combineNameChanged; } - void OnEntryAdded (object sender, CombineEntryEventArgs e) + void OnCombineRenamed (object sender, SolutionItemRenamedEventArgs e) { - DispatchService.GuiDispatch (OnAddEntry, e.CombineEntry); - } - - void OnAddEntry (object newEntry) - { - CombineEntry e = (CombineEntry) newEntry; - ITreeBuilder tb = Context.GetTreeBuilder (e.ParentCombine); - if (tb != null) { - tb.AddChild (e, true); - tb.Expanded = true; - } - } - - void OnEntryRemoved (object sender, CombineEntryEventArgs e) - { - ITreeBuilder tb = Context.GetTreeBuilder (e.CombineEntry); - if (tb != null) tb.Remove (); - } - - void OnCombineRenamed (object sender, CombineEntryRenamedEventArgs e) - { - ITreeBuilder tb = Context.GetTreeBuilder (e.CombineEntry); + ITreeBuilder tb = Context.GetTreeBuilder (e.SolutionItem); if (tb != null) tb.Update (); } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/NamespaceNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/NamespaceNodeBuilder.cs index 6e51087110..3091293224 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/NamespaceNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/NamespaceNodeBuilder.cs @@ -52,12 +52,12 @@ namespace MonoDevelop.Ide.Gui.Pads.ClassPad protected override void Initialize () { changeClassInformationHandler = (ClassInformationEventHandler) DispatchService.GuiDispatch (new ClassInformationEventHandler (OnClassInformationChanged)); - IdeApp.ProjectOperations.ParserDatabase.ClassInformationChanged += changeClassInformationHandler; + IdeApp.Workspace.ParserDatabase.ClassInformationChanged += changeClassInformationHandler; } public override void Dispose () { - IdeApp.ProjectOperations.ParserDatabase.ClassInformationChanged -= changeClassInformationHandler; + IdeApp.Workspace.ParserDatabase.ClassInformationChanged -= changeClassInformationHandler; } public override string GetNodeName (ITreeNavigator thisNode, object dataObject) @@ -77,13 +77,13 @@ namespace MonoDevelop.Ide.Gui.Pads.ClassPad NamespaceData nsData = dataObject as NamespaceData; if (nsData.Project != null) { - IParserContext ctx = IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (nsData.Project); + IParserContext ctx = IdeApp.Workspace.ParserDatabase.GetProjectParserContext (nsData.Project); LanguageItemCollection list = ctx.GetNamespaceContents (nsData.FullName, false); AddProjectContent (builder, nsData.Project, nsData, list); } else { - foreach (Project p in IdeApp.ProjectOperations.CurrentOpenCombine.GetAllProjects ()) { - IParserContext ctx = IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (p); + foreach (Project p in IdeApp.Workspace.GetAllProjects ()) { + IParserContext ctx = IdeApp.Workspace.ParserDatabase.GetProjectParserContext (p); LanguageItemCollection list = ctx.GetNamespaceContents (nsData.FullName, false); AddProjectContent (builder, p, nsData, list); } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/ProjectNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/ProjectNodeBuilder.cs index f527aa3e2a..3c6bbd4ab8 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/ProjectNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/ProjectNodeBuilder.cs @@ -40,11 +40,11 @@ namespace MonoDevelop.Ide.Gui.Pads.ClassPad { public class ProjectNodeBuilder: TypeNodeBuilder { - CombineEntryRenamedEventHandler projectNameChanged; + SolutionItemRenamedEventHandler projectNameChanged; public ProjectNodeBuilder () { - projectNameChanged = (CombineEntryRenamedEventHandler) DispatchService.GuiDispatch (new CombineEntryRenamedEventHandler (OnProjectRenamed)); + projectNameChanged = (SolutionItemRenamedEventHandler) DispatchService.GuiDispatch (new SolutionItemRenamedEventHandler (OnProjectRenamed)); } public override Type NodeDataType { @@ -90,7 +90,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ClassPad { bool publicOnly = builder.Options ["PublicApiOnly"]; - IParserContext ctx = IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (project); + IParserContext ctx = IdeApp.Workspace.ParserDatabase.GetProjectParserContext (project); LanguageItemCollection list = ctx.GetNamespaceContents ("", false); foreach (ILanguageItem ob in list) { if (ob is Namespace) { @@ -107,7 +107,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ClassPad public static void FillNamespaces (ITreeBuilder builder, Project project, string ns) { - IParserContext ctx = IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (project); + IParserContext ctx = IdeApp.Workspace.ParserDatabase.GetProjectParserContext (project); if (ctx.GetClassList (ns, false, true).Length > 0) { if (builder.Options ["ShowProjects"]) builder.AddChild (new NamespaceData (project, ns)); @@ -127,9 +127,9 @@ namespace MonoDevelop.Ide.Gui.Pads.ClassPad return true; } - void OnProjectRenamed (object sender, CombineEntryRenamedEventArgs e) + void OnProjectRenamed (object sender, SolutionItemRenamedEventArgs e) { - ITreeBuilder tb = Context.GetTreeBuilder (e.CombineEntry); + ITreeBuilder tb = Context.GetTreeBuilder (e.SolutionItem); if (tb != null) tb.Update (); } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/SolutionNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/SolutionNodeBuilder.cs new file mode 100644 index 0000000000..f6fe1911a5 --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/SolutionNodeBuilder.cs @@ -0,0 +1,308 @@ +// SolutionNodeBuilder.cs +// +// Author: +// Lluis Sanchez Gual <lluis@novell.com> +// +// Copyright (c) 2008 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +// + +using System; +using System.Collections; +using System.Collections.Generic; + +using MonoDevelop.Projects; +using MonoDevelop.Core; +using MonoDevelop.Ide.Commands; +using MonoDevelop.Ide.Gui; +using MonoDevelop.Core.Gui; +using MonoDevelop.Components.Commands; +using MonoDevelop.Ide.Gui.Search; + +namespace MonoDevelop.Ide.Gui.Pads.ClassPad +{ + public class SolutionNodeBuilder: TypeNodeBuilder + { + SolutionItemEventHandler combineEntryAdded; + SolutionItemEventHandler combineEntryRemoved; + EventHandler<WorkspaceItemRenamedEventArgs> combineNameChanged; + EventHandler startupChanged; + + public SolutionNodeBuilder () + { + combineEntryAdded = (SolutionItemEventHandler) DispatchService.GuiDispatch (new SolutionItemEventHandler (OnEntryAdded)); + combineEntryRemoved = (SolutionItemEventHandler) DispatchService.GuiDispatch (new SolutionItemEventHandler (OnEntryRemoved)); + combineNameChanged = (EventHandler<WorkspaceItemRenamedEventArgs>) DispatchService.GuiDispatch (new EventHandler<WorkspaceItemRenamedEventArgs> (OnCombineRenamed)); + startupChanged = (EventHandler) DispatchService.GuiDispatch (new EventHandler (OnStartupChanged)); + + IdeApp.Workspace.ItemAddedToSolution += combineEntryAdded; + IdeApp.Workspace.ItemRemovedFromSolution += combineEntryRemoved; + IdeApp.Workspace.StartupItemChanged += OnStartupChanged; + } + + public override void Dispose () + { + base.Dispose (); + IdeApp.Workspace.StartupItemChanged -= OnStartupChanged; + IdeApp.Workspace.ItemAddedToSolution -= combineEntryAdded; + IdeApp.Workspace.ItemRemovedFromSolution -= combineEntryRemoved; + } + + public override Type NodeDataType { + get { return typeof(Solution); } + } + + public override Type CommandHandlerType { + get { return typeof(SolutionNodeCommandHandler); } + } + + public override string GetNodeName (ITreeNavigator thisNode, object dataObject) + { + return ((Solution)dataObject).Name; + } + + public override void GetNodeAttributes (ITreeNavigator treeNavigator, object dataObject, ref NodeAttributes attributes) + { + attributes |= NodeAttributes.AllowRename; + } + + public override string ContextMenuAddinPath { + get { return "/MonoDevelop/Ide/ContextMenu/ProjectPad/Solution"; } + } + + public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) + { + Solution solution = dataObject as Solution; + int count = 0; + foreach (SolutionItem e in solution.GetAllSolutionItems ()) + if (!(e is SolutionFolder)) + count++; + + switch (count) { + case 0: + label = GettextCatalog.GetString ("Solution {0}", solution.Name); + break; + case 1: + label = GettextCatalog.GetString ("Solution {0} (1 entry)", solution.Name); + break; + default: + label = GettextCatalog.GetString ("Solution {0} ({1} entries)", solution.Name, count); + break; + } + + icon = Context.GetIcon (Stock.Solution); + } + + public override void BuildChildNodes (ITreeBuilder ctx, object dataObject) + { + Solution solution = (Solution) dataObject; + foreach (SolutionItem entry in solution.RootFolder.Items) + ctx.AddChild (entry); + } + + public override bool HasChildNodes (ITreeBuilder builder, object dataObject) + { + return ((Solution) dataObject).RootFolder.Items.Count > 0; + } + + public override object GetParentObject (object dataObject) + { + return ((Solution) dataObject).ParentWorkspace; + } + + public override void OnNodeAdded (object dataObject) + { + Solution solution = (Solution) dataObject; + solution.NameChanged += combineNameChanged; + } + + public override void OnNodeRemoved (object dataObject) + { + Solution solution = (Solution) dataObject; + solution.NameChanged -= combineNameChanged; + } + + void OnStartupChanged (object sender, EventArgs args) + { + ITreeBuilder tb = Context.GetTreeBuilder (sender); + if (tb != null) + tb.UpdateAll (); + } + + void OnEntryAdded (object sender, SolutionItemEventArgs e) + { + ITreeBuilder tb; + if (e.SolutionItem.ParentFolder == null) + tb = Context.GetTreeBuilder (e.SolutionItem.ParentSolution); + else + tb = Context.GetTreeBuilder (e.SolutionItem.ParentFolder); + + if (tb != null) + tb.AddChild (e.SolutionItem, true); + } + + void OnEntryRemoved (object sender, SolutionItemEventArgs e) + { + ITreeBuilder tb = Context.GetTreeBuilder (e.SolutionItem); + if (tb != null) { + tb.Remove (true); + } + } + + void OnCombineRenamed (object sender, WorkspaceItemRenamedEventArgs e) + { + ITreeBuilder tb = Context.GetTreeBuilder (e.Item); + if (tb != null) tb.Update (); + } + } + + public class SolutionNodeCommandHandler: NodeCommandHandler + { + public override void RenameItem (string newName) + { + if (newName.IndexOfAny (new char [] { '\'', '(', ')', '"', '{', '}', '|' } ) != -1) { + MessageService.ShowError (GettextCatalog.GetString ("Solution name may not contain any of the following characters: {0}", "', (, ), \", {, }, |")); + return; + } + + Solution sol = (Solution) CurrentNode.DataItem; + sol.Name = newName; + IdeApp.Workspace.Save(); + } + + public override DragOperation CanDragNode () + { + return DragOperation.Move; + } + + public override bool CanDropNode (object dataObject, DragOperation operation) + { + return dataObject is SolutionItem; + } + + public override void OnNodeDrop (object dataObject, DragOperation operation) + { + } + + public override void ActivateItem () + { + Solution sol = CurrentNode.DataItem as Solution; + IdeApp.ProjectOperations.ShowOptions (sol); + } + + [CommandHandler (EditCommands.Delete)] + public void RemoveItem () + { + Solution solution = CurrentNode.DataItem as Solution; + Workspace parent = CurrentNode.GetParentDataItem (typeof(Workspace), false) as Workspace; + if (parent == null) return; + + AlertButton res = MessageService.AskQuestion (GettextCatalog.GetString ("Do you really want to remove solution {0} from workspace {1}?", solution.Name, parent.Name), AlertButton.Remove); + if (res == AlertButton.Remove) { + parent.Items.Remove (solution); + solution.Dispose (); + IdeApp.Workspace.Save(); + } + } + + [CommandUpdateHandler (EditCommands.Delete)] + public void OnUpdateRemoveItem (CommandInfo info) + { + Workspace parent = CurrentNode.GetParentDataItem (typeof(Workspace), false) as Workspace; + info.Enabled = parent != null; + } + + [CommandHandler (ProjectCommands.AddNewProject)] + public void AddNewProjectToSolution () + { + Solution solution = (Solution) CurrentNode.DataItem; + SolutionItem ce = IdeApp.ProjectOperations.CreateProject (solution.RootFolder); + if (ce == null) return; + Tree.AddNodeInsertCallback (ce, new TreeNodeCallback (OnEntryInserted)); + CurrentNode.Expanded = true; + } + + [CommandHandler (ProjectCommands.AddProject)] + public void AddProjectToCombine() + { + Solution solution = (Solution) CurrentNode.DataItem; + SolutionItem ce = IdeApp.ProjectOperations.AddSolutionItem (solution.RootFolder); + if (ce == null) return; + Tree.AddNodeInsertCallback (ce, new TreeNodeCallback (OnEntryInserted)); + CurrentNode.Expanded = true; + } + + [CommandHandler (ProjectCommands.AddSolutionFolder)] + public void AddFolder() + { + Solution solution = (Solution) CurrentNode.DataItem; + SolutionItem ce = new SolutionFolder (); + ce.Name = GettextCatalog.GetString ("New Folder"); + solution.RootFolder.Items.Add (ce); + Tree.AddNodeInsertCallback (ce, OnFolderInserted); + CurrentNode.Expanded = true; + } + + [CommandHandler (ProjectCommands.Reload)] + public void OnReload () + { + Solution solution = (Solution) CurrentNode.DataItem; + using (IProgressMonitor m = IdeApp.Workbench.ProgressMonitors.GetLoadProgressMonitor (true)) { + solution.ParentWorkspace.ReloadItem (m, solution); + } + } + + [CommandUpdateHandler (ProjectCommands.Reload)] + public void OnUpdateReload (CommandInfo info) + { + Solution solution = (Solution) CurrentNode.DataItem; + info.Visible = (solution.ParentWorkspace != null) && solution.NeedsReload; + } + + void OnEntryInserted (ITreeNavigator nav) + { + nav.Selected = true; + nav.Expanded = true; + } + + void OnFolderInserted (ITreeNavigator nav) + { + nav.Selected = true; + nav.Expanded = true; + Tree.StartLabelEdit (); + } + + [CommandHandler (FileCommands.OpenContainingFolder)] + public void OnOpenFolder () + { + Solution solution = (Solution) CurrentNode.DataItem; + System.Diagnostics.Process.Start ("file://" + solution.BaseDirectory); + } + + [CommandHandler (SearchCommands.FindInFiles)] + public void OnFindInFiles () + { + Solution solution = (Solution) CurrentNode.DataItem; + SearchReplaceInFilesManager.SearchOptions.SearchDirectory = solution.BaseDirectory; + SearchReplaceInFilesManager.ShowFindDialog (); + } + } +} diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/CombineNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/CombineNodeBuilder.cs index bd6ff024d9..681b857194 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/CombineNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/CombineNodeBuilder.cs @@ -39,23 +39,17 @@ using MonoDevelop.Ide.Gui.Search; namespace MonoDevelop.Ide.Gui.Pads.ProjectPad { - public class CombineNodeBuilder: TypeNodeBuilder + public class SolutionFolderNodeBuilder: TypeNodeBuilder { - CombineEntryChangeEventHandler combineEntryAdded; - CombineEntryChangeEventHandler combineEntryRemoved; - CombineEntryRenamedEventHandler combineNameChanged; - EventHandler startupChanged; + SolutionItemRenamedEventHandler combineNameChanged; - public CombineNodeBuilder () + public SolutionFolderNodeBuilder () { - combineEntryAdded = (CombineEntryChangeEventHandler) DispatchService.GuiDispatch (new CombineEntryChangeEventHandler (OnEntryAdded)); - combineEntryRemoved = (CombineEntryChangeEventHandler) DispatchService.GuiDispatch (new CombineEntryChangeEventHandler (OnEntryRemoved)); - combineNameChanged = (CombineEntryRenamedEventHandler) DispatchService.GuiDispatch (new CombineEntryRenamedEventHandler (OnCombineRenamed)); - startupChanged = (EventHandler) DispatchService.GuiDispatch (new EventHandler (OnStartupChanged)); + combineNameChanged = (SolutionItemRenamedEventHandler) DispatchService.GuiDispatch (new SolutionItemRenamedEventHandler (OnCombineRenamed)); } public override Type NodeDataType { - get { return typeof(Combine); } + get { return typeof(SolutionFolder); } } public override Type CommandHandlerType { @@ -64,7 +58,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad public override string GetNodeName (ITreeNavigator thisNode, object dataObject) { - return ((Combine)dataObject).Name; + return ((SolutionFolder)dataObject).Name; } public override void GetNodeAttributes (ITreeNavigator treeNavigator, object dataObject, ref NodeAttributes attributes) @@ -73,48 +67,37 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad } public override string ContextMenuAddinPath { - get { return "/MonoDevelop/Ide/ContextMenu/ProjectPad/Combine"; } + get { return "/MonoDevelop/Ide/ContextMenu/ProjectPad/SolutionFolder"; } } public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) { - Combine combine = dataObject as Combine; - - switch (combine.Entries.Count) { - case 0: - label = GettextCatalog.GetString ("Solution {0}", combine.Name); - break; - case 1: - label = GettextCatalog.GetString ("Solution {0} (1 entry)", combine.Name); - break; - default: - label = GettextCatalog.GetString ("Solution {0} ({1} entries)", combine.Name, combine.Entries.Count); - break; - } - - icon = Context.GetIcon (Stock.Solution); + SolutionFolder combine = dataObject as SolutionFolder; + label = combine.Name; + icon = Context.GetIcon (Stock.SolutionFolderOpen); + closedIcon = Context.GetIcon (Stock.SolutionFolderClosed); } public override void BuildChildNodes (ITreeBuilder ctx, object dataObject) { - Combine combine = (Combine) dataObject; - foreach (CombineEntry entry in combine.Entries) + SolutionFolder combine = (SolutionFolder) dataObject; + foreach (SolutionItem entry in combine.Items) ctx.AddChild (entry); } public override bool HasChildNodes (ITreeBuilder builder, object dataObject) { - return ((Combine) dataObject).Entries.Count > 0; + return ((SolutionFolder) dataObject).Items.Count > 0; } public override object GetParentObject (object dataObject) { - return ((CombineEntry) dataObject).ParentCombine; + return ((SolutionItem) dataObject).ParentFolder; } public override int CompareObjects (ITreeNavigator thisNode, ITreeNavigator otherNode) { - if (otherNode.DataItem is Combine) + if (otherNode.DataItem is SolutionFolder) return DefaultSort; else return -1; @@ -122,51 +105,19 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad public override void OnNodeAdded (object dataObject) { - Combine combine = (Combine) dataObject; - combine.EntryAdded += combineEntryAdded; - combine.EntryRemoved += combineEntryRemoved; + SolutionFolder combine = (SolutionFolder) dataObject; combine.NameChanged += combineNameChanged; - combine.StartupPropertyChanged += startupChanged; } public override void OnNodeRemoved (object dataObject) { - Combine combine = (Combine) dataObject; - combine.EntryAdded -= combineEntryAdded; - combine.EntryRemoved -= combineEntryRemoved; + SolutionFolder combine = (SolutionFolder) dataObject; combine.NameChanged -= combineNameChanged; - combine.StartupPropertyChanged -= startupChanged; - } - - void OnStartupChanged (object sender, EventArgs args) - { - ITreeBuilder tb = Context.GetTreeBuilder (sender); - if (tb != null) - tb.UpdateAll (); - } - - void OnEntryAdded (object sender, CombineEntryEventArgs e) - { - ITreeBuilder tb = Context.GetTreeBuilder (sender); - if (tb != null) { - tb.Update (); // Update the entry count - tb.AddChild (e.CombineEntry, true); - tb.Expanded = true; - } - } - - void OnEntryRemoved (object sender, CombineEntryEventArgs e) - { - ITreeBuilder tb = Context.GetTreeBuilder (e.CombineEntry); - if (tb != null) { - tb.Remove (true); - tb.Update (); // Update the entry count - } } - void OnCombineRenamed (object sender, CombineEntryRenamedEventArgs e) + void OnCombineRenamed (object sender, SolutionItemRenamedEventArgs e) { - ITreeBuilder tb = Context.GetTreeBuilder (e.CombineEntry); + ITreeBuilder tb = Context.GetTreeBuilder (e.SolutionItem); if (tb != null) tb.Update (); } } @@ -180,9 +131,9 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad return; } - Combine combine = (Combine) CurrentNode.DataItem; + SolutionFolder combine = (SolutionFolder) CurrentNode.DataItem; combine.Name = newName; - IdeApp.ProjectOperations.SaveCombine(); + IdeApp.Workspace.Save(); } public override DragOperation CanDragNode () @@ -192,45 +143,49 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad public override bool CanDropNode (object dataObject, DragOperation operation) { - return dataObject is CombineEntry; + SolutionItem it = dataObject as SolutionItem; + return it != null && operation == DragOperation.Move; } public override void OnNodeDrop (object dataObject, DragOperation operation) { + SolutionFolder folder = (SolutionFolder) CurrentNode.DataItem; + SolutionItem it = (SolutionItem) dataObject; + if (!MessageService.Confirm (GettextCatalog.GetString ("Are you sure you want to move the item '{0}' to the solution folder '{1}'?", it.Name, folder.Name), AlertButton.Move)) + return; + + it.ParentFolder.Items.Remove (it); + folder.Items.Add (it); + IdeApp.ProjectOperations.Save (folder.ParentSolution); } public override void ActivateItem () { - Combine combine = CurrentNode.DataItem as Combine; + SolutionFolder combine = CurrentNode.DataItem as SolutionFolder; IdeApp.ProjectOperations.ShowOptions (combine); } public override void DeleteItem () { - Combine combine = CurrentNode.DataItem as Combine; - Combine parent = CurrentNode.GetParentDataItem (typeof(Combine), false) as Combine; + SolutionFolder combine = CurrentNode.DataItem as SolutionFolder; + SolutionFolder parent = combine.ParentFolder; if (parent == null) return; - bool yes = MessageService.Confirm (GettextCatalog.GetString ("Do you really want to remove solution {0} from solution {1}?", combine.Name, parent.Name), AlertButton.Remove); + bool yes = MessageService.Confirm (GettextCatalog.GetString ("Do you really want to remove the folder '{0}' from '{1}'?", combine.Name, parent.Name), AlertButton.Remove); if (yes) { - parent.Entries.Remove (combine); + Solution sol = combine.ParentSolution; + parent.Items.Remove (combine); combine.Dispose (); - IdeApp.ProjectOperations.SaveCombine(); + IdeApp.ProjectOperations.Save (sol); } } - public override bool CanDeleteItem () - { - Combine parent = CurrentNode.GetParentDataItem (typeof(Combine), false) as Combine; - return parent != null; - } - [CommandHandler (ProjectCommands.AddNewProject)] public void AddNewProjectToCombine() { - Combine combine = (Combine) CurrentNode.DataItem; - CombineEntry ce = IdeApp.ProjectOperations.CreateProject (combine); + SolutionFolder combine = (SolutionFolder) CurrentNode.DataItem; + SolutionItem ce = IdeApp.ProjectOperations.CreateProject (combine); if (ce == null) return; Tree.AddNodeInsertCallback (ce, new TreeNodeCallback (OnEntryInserted)); CurrentNode.Expanded = true; @@ -239,47 +194,38 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad [CommandHandler (ProjectCommands.AddProject)] public void AddProjectToCombine() { - Combine combine = (Combine) CurrentNode.DataItem; - CombineEntry ce = IdeApp.ProjectOperations.AddCombineEntry (combine); + SolutionFolder combine = (SolutionFolder) CurrentNode.DataItem; + SolutionItem ce = IdeApp.ProjectOperations.AddSolutionItem (combine); if (ce == null) return; Tree.AddNodeInsertCallback (ce, new TreeNodeCallback (OnEntryInserted)); CurrentNode.Expanded = true; } - [CommandHandler (ProjectCommands.AddNewCombine)] - public void AddNewCombineToCombine() + [CommandHandler (ProjectCommands.AddSolutionFolder)] + public void AddFolder() { - Combine combine = (Combine) CurrentNode.DataItem; - CombineEntry ce = IdeApp.ProjectOperations.CreateCombine (combine); - if (ce == null) return; - Tree.AddNodeInsertCallback (ce, new TreeNodeCallback (OnEntryInserted)); - CurrentNode.Expanded = true; - } - - [CommandHandler (ProjectCommands.AddCombine)] - public void AddCombineToCombine() - { - Combine combine = (Combine) CurrentNode.DataItem; - CombineEntry ce = IdeApp.ProjectOperations.AddCombineEntry (combine); - if (ce == null) return; - Tree.AddNodeInsertCallback (ce, new TreeNodeCallback (OnEntryInserted)); + SolutionFolder folder = (SolutionFolder) CurrentNode.DataItem; + SolutionFolder ce = new SolutionFolder (); + ce.Name = GettextCatalog.GetString ("New Folder"); + folder.Items.Add (ce); + Tree.AddNodeInsertCallback (ce, OnFolderInserted); CurrentNode.Expanded = true; } [CommandHandler (ProjectCommands.Reload)] public void OnReload () { - Combine combine = (Combine) CurrentNode.DataItem; + SolutionFolder combine = (SolutionFolder) CurrentNode.DataItem; using (IProgressMonitor m = IdeApp.Workbench.ProgressMonitors.GetLoadProgressMonitor (true)) { - combine.ParentCombine.ReloadEntry (m, combine); + combine.ParentFolder.ReloadItem (m, combine); } } [CommandUpdateHandler (ProjectCommands.Reload)] public void OnUpdateReload (CommandInfo info) { - Combine combine = (Combine) CurrentNode.DataItem; - info.Visible = (combine.ParentCombine != null) && combine.NeedsReload; + SolutionFolder combine = (SolutionFolder) CurrentNode.DataItem; + info.Visible = (combine.ParentFolder != null) && combine.NeedsReload; } void OnEntryInserted (ITreeNavigator nav) @@ -287,19 +233,12 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad nav.Selected = true; nav.Expanded = true; } - [CommandHandler (FileCommands.OpenContainingFolder)] - public void OnOpenFolder () - { - Combine combine = (Combine) CurrentNode.DataItem; - System.Diagnostics.Process.Start ("file://" + combine.BaseDirectory); - } - [CommandHandler (SearchCommands.FindInFiles)] - public void OnFindInFiles () + void OnFolderInserted (ITreeNavigator nav) { - Combine combine = (Combine) CurrentNode.DataItem; - SearchReplaceInFilesManager.SearchOptions.SearchDirectory = combine.BaseDirectory; - SearchReplaceInFilesManager.ShowFindDialog (); + nav.Selected = true; + nav.Expanded = true; + Tree.StartLabelEdit (); } } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/FolderNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/FolderNodeBuilder.cs index 66ecf8bbb6..a9b623e939 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/FolderNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/FolderNodeBuilder.cs @@ -77,7 +77,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad folders = new ArrayList (); string folderPrefix = folder + Path.DirectorySeparatorChar; - foreach (ProjectFile file in project.ProjectFiles) + foreach (ProjectFile file in project.Files) { string dir; @@ -109,7 +109,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad Project project = builder.GetParentDataItem (typeof(Project), true) as Project; // For big projects, a real HasChildNodes value is too slow to get - if (project.ProjectFiles.Count > 500) + if (project.Files.Count > 500) return true; ProjectFileCollection files; @@ -232,7 +232,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad bool move = operation == DragOperation.Move; IdeApp.ProjectOperations.TransferFiles (monitor, sourceProject, source, targetProject, targetPath, move, false); } - IdeApp.ProjectOperations.SaveCombine(); + IdeApp.Workspace.Save(); } [CommandHandler (ProjectCommands.AddFiles)] @@ -260,7 +260,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad string baseDirectory = folder != null ? folder.Path : project.BaseDirectory; IdeApp.ProjectOperations.AddFilesToProject (project, files, baseDirectory); - IdeApp.ProjectOperations.SaveProject (project); + IdeApp.ProjectOperations.Save (project); } [CommandHandler (ProjectCommands.AddNewFiles)] @@ -268,7 +268,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad { Project project = CurrentNode.GetParentDataItem (typeof(Project), true) as Project; IdeApp.ProjectOperations.CreateProjectFile (project, GetFolderPath (CurrentNode.DataItem)); - IdeApp.ProjectOperations.SaveProject (project); + IdeApp.ProjectOperations.Save (project); CurrentNode.Expanded = true; } @@ -299,8 +299,8 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad ProjectFile newFolder = new ProjectFile (directoryName); newFolder.Subtype = Subtype.Directory; - project.ProjectFiles.Add (newFolder); - IdeApp.ProjectOperations.SaveProject (project); + project.Files.Add (newFolder); + IdeApp.ProjectOperations.Save (project); CurrentNode.Expanded = true; Tree.AddNodeInsertCallback (new ProjectFolder (directoryName, project), new TreeNodeCallback (OnFileInserted)); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/LinkedFilesFolderNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/LinkedFilesFolderNodeBuilder.cs index 3ab1be8b10..addd5d3ade 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/LinkedFilesFolderNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/LinkedFilesFolderNodeBuilder.cs @@ -86,7 +86,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad public override void BuildChildNodes (ITreeBuilder builder, object dataObject) { Project project = ((LinkedFilesFolder)dataObject).Project; - foreach (ProjectFile file in project.ProjectFiles) + foreach (ProjectFile file in project.Files) if (file.IsExternalToProject) builder.AddChild (file); } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs index 065e887628..1efbb151e3 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs @@ -116,7 +116,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad try { if (FileService.IsValidFileName (newPath)) { FileService.RenameFile (oldPath, newName); - IdeApp.ProjectOperations.SaveCombine(); + IdeApp.Workspace.Save(); } } catch (System.IO.IOException) { // assume duplicate file MessageService.ShowError (GettextCatalog.GetString ("File or directory name is already in use. Please choose a different one.")); @@ -139,7 +139,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad public override bool CanDropNode (object dataObject, DragOperation operation) { - return dataObject is CombineEntry; + return dataObject is SolutionItem; } public override void OnNodeDrop (object dataObject, DragOperation operation) @@ -165,23 +165,23 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad AlertButton.Delete, AlertButton.Cancel, removeFromProject); if (result != removeFromProject && result != AlertButton.Delete) return; - + if (!file.IsExternalToProject) { - ProjectFile[] inFolder = project.ProjectFiles.GetFilesInPath (Path.GetDirectoryName (file.Name)); + ProjectFile[] inFolder = project.Files.GetFilesInPath (Path.GetDirectoryName (file.Name)); if (inFolder.Length == 1 && inFolder [0] == file) { // This is the last project file in the folder. Make sure we keep // a reference to the folder, so it is not deleted from the tree. ProjectFile folderFile = new ProjectFile (Path.GetDirectoryName (file.Name)); folderFile.Subtype = Subtype.Directory; - project.ProjectFiles.Add (folderFile); + project.Files.Add (folderFile); } } - project.ProjectFiles.Remove (file); + project.Files.Remove (file); if (result == AlertButton.Delete) FileService.DeleteFile (file.Name); - IdeApp.ProjectOperations.SaveProject (project); + IdeApp.ProjectOperations.Save (project); } [CommandUpdateHandler (EditCommands.Delete)] @@ -206,7 +206,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad } else { finfo.BuildAction = BuildAction.Compile; } - IdeApp.ProjectOperations.SaveProject (finfo.Project); + IdeApp.ProjectOperations.Save (finfo.Project); } [CommandUpdateHandler (ProjectCommands.IncludeInDeploy)] @@ -226,7 +226,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad } else { finfo.BuildAction = BuildAction.FileCopy; } - IdeApp.ProjectOperations.SaveProject (finfo.Project); + IdeApp.ProjectOperations.Save (finfo.Project); } [CommandHandler (ViewCommands.OpenWithList)] diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs index 3240e33517..f4da26bb17 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs @@ -157,7 +157,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad if (FileService.IsValidFileName (newFoldername)) { FileService.RenameDirectory (oldFoldername, newName); - IdeApp.ProjectOperations.SaveCombine(); + IdeApp.Workspace.Save(); } } catch (System.IO.IOException) { // assume duplicate file MessageService.ShowError(GettextCatalog.GetString ("File or directory name is already in use. Please choose a different one.")); @@ -171,7 +171,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad { ProjectFolder folder = (ProjectFolder) CurrentNode.DataItem as ProjectFolder; Project project = folder.Project; - ProjectFile[] files = folder.Project.ProjectFiles.GetFilesInPath (folder.Path); + ProjectFile[] files = folder.Project.Files.GetFilesInPath (folder.Path); if (files.Length == 0) { bool yes = MessageService.Confirm (GettextCatalog.GetString ("Are you sure you want to permanently delete the folder {0}?", folder.Path), AlertButton.Delete); @@ -188,20 +188,20 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad bool yes = MessageService.Confirm (GettextCatalog.GetString ("Do you really want to remove folder {0}?", folder.Name), AlertButton.Remove); if (!yes) return; - ProjectFile[] inParentFolder = project.ProjectFiles.GetFilesInPath (Path.GetDirectoryName (folder.Path)); + ProjectFile[] inParentFolder = project.Files.GetFilesInPath (Path.GetDirectoryName (folder.Path)); if (inParentFolder.Length == files.Length) { // This is the last folder in the parent folder. Make sure we keep // a reference to the folder, so it is not deleted from the tree. ProjectFile folderFile = new ProjectFile (Path.GetDirectoryName (folder.Path)); folderFile.Subtype = Subtype.Directory; - project.ProjectFiles.Add (folderFile); + project.Files.Add (folderFile); } foreach (ProjectFile file in files) - folder.Project.ProjectFiles.Remove (file); + folder.Project.Files.Remove (file); - IdeApp.ProjectOperations.SaveCombine(); + IdeApp.Workspace.Save(); } } @@ -221,7 +221,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad project.AddFile (file.Path, BuildAction.Nothing); } - IdeApp.ProjectOperations.SaveProject (project); + IdeApp.ProjectOperations.Save (project); } } @@ -268,7 +268,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad bool HasProjectFiles (Project project, string path) { string basePath = path + Path.DirectorySeparatorChar; - foreach (ProjectFile f in project.ProjectFiles) + foreach (ProjectFile f in project.Files) if (f.Name.StartsWith (basePath)) return true; return false; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectNodeBuilder.cs index ae7d78f425..83be18a2c8 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectNodeBuilder.cs @@ -45,7 +45,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad ProjectFileEventHandler fileRemovedHandler; ProjectFileRenamedEventHandler fileRenamedHandler; ProjectFileEventHandler filePropertyChangedHandler; - CombineEntryRenamedEventHandler projectNameChanged; + SolutionItemRenamedEventHandler projectNameChanged; public override Type NodeDataType { get { return typeof(Project); } @@ -61,20 +61,20 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad fileRemovedHandler = (ProjectFileEventHandler) DispatchService.GuiDispatch (new ProjectFileEventHandler (OnRemoveFile)); filePropertyChangedHandler = (ProjectFileEventHandler) DispatchService.GuiDispatch (new ProjectFileEventHandler (OnFilePropertyChanged)); fileRenamedHandler = (ProjectFileRenamedEventHandler) DispatchService.GuiDispatch (new ProjectFileRenamedEventHandler (OnRenameFile)); - projectNameChanged = (CombineEntryRenamedEventHandler) DispatchService.GuiDispatch (new CombineEntryRenamedEventHandler (OnProjectRenamed)); + projectNameChanged = (SolutionItemRenamedEventHandler) DispatchService.GuiDispatch (new SolutionItemRenamedEventHandler (OnProjectRenamed)); - IdeApp.ProjectOperations.FileAddedToProject += fileAddedHandler; - IdeApp.ProjectOperations.FileRemovedFromProject += fileRemovedHandler; - IdeApp.ProjectOperations.FileRenamedInProject += fileRenamedHandler; - IdeApp.ProjectOperations.FilePropertyChangedInProject += filePropertyChangedHandler; + IdeApp.Workspace.FileAddedToProject += fileAddedHandler; + IdeApp.Workspace.FileRemovedFromProject += fileRemovedHandler; + IdeApp.Workspace.FileRenamedInProject += fileRenamedHandler; + IdeApp.Workspace.FilePropertyChangedInProject += filePropertyChangedHandler; } public override void Dispose () { - IdeApp.ProjectOperations.FileAddedToProject -= fileAddedHandler; - IdeApp.ProjectOperations.FileRemovedFromProject -= fileRemovedHandler; - IdeApp.ProjectOperations.FileRenamedInProject -= fileRenamedHandler; - IdeApp.ProjectOperations.FilePropertyChangedInProject -= filePropertyChangedHandler; + IdeApp.Workspace.FileAddedToProject -= fileAddedHandler; + IdeApp.Workspace.FileRemovedFromProject -= fileRemovedHandler; + IdeApp.Workspace.FileRenamedInProject -= fileRenamedHandler; + IdeApp.Workspace.FilePropertyChangedInProject -= filePropertyChangedHandler; } public override void OnNodeAdded (object dataObject) @@ -117,7 +117,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad label = GettextCatalog.GetString ("{0} <span foreground='red' size='small'>(Unknown language '{1}')</span>", p.Name, ((DotNetProject)p).LanguageName); } else { iconName = Services.Icons.GetImageForProjectType (p.ProjectType); - if (p.ParentCombine != null && p.ParentCombine.StartupEntry == p) + if (IdeApp.Workspace.StartupItem == p) label = "<b>" + p.Name + "</b>"; else label = p.Name; @@ -129,10 +129,12 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad public override void BuildChildNodes (ITreeBuilder builder, object dataObject) { Project project = (Project) dataObject; - builder.AddChild (project.ProjectReferences); - builder.AddChild (new ResourceFolder (project)); + if (project is DotNetProject) { + builder.AddChild (((DotNetProject)project).References); + builder.AddChild (new ResourceFolder (project)); + } - foreach (ProjectFile file in project.ProjectFiles) { + foreach (ProjectFile file in project.Files) { if (file.IsExternalToProject) { builder.AddChild (new LinkedFilesFolder (project)); break; @@ -149,7 +151,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad public override object GetParentObject (object dataObject) { - return ((CombineEntry) dataObject).ParentCombine; + return ((SolutionItem) dataObject).ParentFolder; } void OnAddFile (object sender, ProjectFileEventArgs e) @@ -262,7 +264,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad while (tb.DataItem is ProjectFolder) { ProjectFolder f = (ProjectFolder) tb.DataItem; - if (!Directory.Exists (f.Path) || project.ProjectFiles.GetFilesInPath (f.Path).Length == 0) + if (!Directory.Exists (f.Path) || project.Files.GetFilesInPath (f.Path).Length == 0) tb.Remove (true); else break; @@ -275,9 +277,9 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad if (tb != null) tb.Update (); } - void OnProjectRenamed (object sender, CombineEntryRenamedEventArgs e) + void OnProjectRenamed (object sender, SolutionItemRenamedEventArgs e) { - ITreeBuilder tb = Context.GetTreeBuilder (e.CombineEntry); + ITreeBuilder tb = Context.GetTreeBuilder (e.SolutionItem); if (tb != null) tb.Update (); } @@ -305,7 +307,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad Project project = (Project) CurrentNode.DataItem; project.Name = newName; - IdeApp.ProjectOperations.SaveCombine(); + IdeApp.Workspace.Save(); } public override void ActivateItem () @@ -318,24 +320,19 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad public void SetAsStartupProject () { Project project = CurrentNode.DataItem as Project; - Combine combine = CurrentNode.GetParentDataItem (typeof(Combine), false) as Combine; - - combine.StartupEntry = project; - combine.SingleStartupProject = true; - IdeApp.ProjectOperations.SaveCombine (); + IdeApp.Workspace.StartupItem = project; } public override void DeleteItem () { - Combine cmb = CurrentNode.GetParentDataItem (typeof(Combine), false) as Combine;; Project prj = CurrentNode.DataItem as Project; - - bool yes = MessageService.Confirm (GettextCatalog.GetString ("Do you really want to remove project {0} from solution {1}?", prj.Name, cmb.Name), AlertButton.Remove); + bool yes = MessageService.Confirm (GettextCatalog.GetString ("Do you really want to remove project '{0}' from '{1}'?", prj.Name, prj.ParentFolder.Name), AlertButton.Remove); if (yes) { - cmb.RemoveEntry (prj); + Solution sol = prj.ParentSolution; + prj.ParentFolder.Items.Remove (prj); prj.Dispose (); - IdeApp.ProjectOperations.SaveCombine(); + IdeApp.ProjectOperations.Save (sol); } } [CommandHandler (FileCommands.OpenContainingFolder)] @@ -348,9 +345,15 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad [CommandHandler (ProjectCommands.AddReference)] public void AddReferenceToProject () { - Project p = (Project) CurrentNode.DataItem; + DotNetProject p = (DotNetProject) CurrentNode.DataItem; if (IdeApp.ProjectOperations.AddReferenceToProject (p)) - IdeApp.ProjectOperations.SaveProject (p); + IdeApp.ProjectOperations.Save (p); + } + + [CommandUpdateHandler (ProjectCommands.AddReference)] + public void UpdateAddReferenceToProject (CommandInfo ci) + { + ci.Visible = CurrentNode.DataItem is DotNetProject; } [CommandHandler (ProjectCommands.Reload)] @@ -358,7 +361,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad { Project p = (Project) CurrentNode.DataItem; using (IProgressMonitor m = IdeApp.Workbench.ProgressMonitors.GetLoadProgressMonitor (true)) { - p.ParentCombine.ReloadEntry (m, p); + p.ParentFolder.ReloadItem (m, p); } } @@ -366,7 +369,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad public void OnUpdateReload (CommandInfo info) { Project p = (Project) CurrentNode.DataItem; - info.Visible = (p.ParentCombine != null) && p.NeedsReload; + info.Visible = (p.ParentFolder != null) && p.NeedsReload; } public override DragOperation CanDragNode () diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectReferenceFolderNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectReferenceFolderNodeBuilder.cs index 7a269a6991..aa37a25f49 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectReferenceFolderNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectReferenceFolderNodeBuilder.cs @@ -65,14 +65,14 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad addedHandler = (ProjectReferenceEventHandler) DispatchService.GuiDispatch (new ProjectReferenceEventHandler (OnAddReference)); removedHandler = (ProjectReferenceEventHandler) DispatchService.GuiDispatch (new ProjectReferenceEventHandler (OnRemoveReference)); - IdeApp.ProjectOperations.ReferenceAddedToProject += addedHandler; - IdeApp.ProjectOperations.ReferenceRemovedFromProject += removedHandler; + IdeApp.Workspace.ReferenceAddedToProject += addedHandler; + IdeApp.Workspace.ReferenceRemovedFromProject += removedHandler; } public override void Dispose () { - IdeApp.ProjectOperations.ReferenceAddedToProject -= addedHandler; - IdeApp.ProjectOperations.ReferenceRemovedFromProject -= removedHandler; + IdeApp.Workspace.ReferenceAddedToProject -= addedHandler; + IdeApp.Workspace.ReferenceRemovedFromProject -= removedHandler; } public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) @@ -110,8 +110,11 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad void OnAddReference (object sender, ProjectReferenceEventArgs e) { - ITreeBuilder tb = Context.GetTreeBuilder (e.Project.ProjectReferences); - if (tb != null) tb.AddChild (e.ProjectReference); + DotNetProject p = e.Project as DotNetProject; + if (p != null) { + ITreeBuilder tb = Context.GetTreeBuilder (p.References); + if (tb != null) tb.AddChild (e.ProjectReference); + } } } @@ -132,14 +135,14 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad // It allows dropping either project references or projects. // Dropping a project creates a new project reference to that project - Project project = dataObject as Project; + DotNetProject project = dataObject as DotNetProject; if (project != null) { ProjectReference pr = new ProjectReference (project); - Project p = CurrentNode.GetParentDataItem (typeof(Project), false) as Project; + DotNetProject p = CurrentNode.GetParentDataItem (typeof(DotNetProject), false) as DotNetProject; if (ProjectReferencesProject (project, p.Name)) return; - p.ProjectReferences.Add (pr); - IdeApp.ProjectOperations.SaveProject (p); + p.References.Add (pr); + IdeApp.ProjectOperations.Save (p); return; } @@ -151,58 +154,58 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad if (operation == DragOperation.Move) { NodePosition pos = nav.CurrentPosition; nav.MoveToObject (dataObject); - Project p = nav.GetParentDataItem (typeof(Project), true) as Project; + DotNetProject p = nav.GetParentDataItem (typeof(DotNetProject), true) as DotNetProject; nav.MoveToPosition (pos); - Project p2 = nav.GetParentDataItem (typeof(Project), true) as Project; + DotNetProject p2 = nav.GetParentDataItem (typeof(DotNetProject), true) as DotNetProject; - p.ProjectReferences.Remove (pref); + p.References.Remove (pref); // Check if there is a cyclic reference after removing from the source project if (pref.ReferenceType == ReferenceType.Project) { - Project pdest = p.RootCombine.FindProject (pref.Reference); + DotNetProject pdest = p.ParentSolution.FindProjectByName (pref.Reference) as DotNetProject; if (pdest == null || ProjectReferencesProject (pdest, p2.Name)) { // Restore the dep - p.ProjectReferences.Add (pref); + p.References.Add (pref); return; } } - p2.ProjectReferences.Add (pref); - IdeApp.ProjectOperations.SaveProject (p); - IdeApp.ProjectOperations.SaveProject (p2); + p2.References.Add (pref); + IdeApp.ProjectOperations.Save (p); + IdeApp.ProjectOperations.Save (p2); } else { - nav.MoveToParent (typeof(Project)); - Project p = nav.DataItem as Project; + nav.MoveToParent (typeof(DotNetProject)); + DotNetProject p = nav.DataItem as DotNetProject; // Check for cyclic referencies if (pref.ReferenceType == ReferenceType.Project) { - Project pdest = p.RootCombine.FindProject (pref.Reference); + DotNetProject pdest = p.ParentSolution.FindProjectByName (pref.Reference) as DotNetProject; if (pdest == null || ProjectReferencesProject (pdest, p.Name)) return; } - p.ProjectReferences.Add ((ProjectReference) pref.Clone ()); - IdeApp.ProjectOperations.SaveProject (p); + p.References.Add ((ProjectReference) pref.Clone ()); + IdeApp.ProjectOperations.Save (p); } } [CommandHandler (ProjectCommands.AddReference)] public void AddReferenceToProject () { - Project p = (Project) CurrentNode.GetParentDataItem (typeof(Project), false); + DotNetProject p = (DotNetProject) CurrentNode.GetParentDataItem (typeof(DotNetProject), false); if (IdeApp.ProjectOperations.AddReferenceToProject (p)) { - IdeApp.ProjectOperations.SaveProject (p); + IdeApp.ProjectOperations.Save (p); CurrentNode.Expanded = true; } } - bool ProjectReferencesProject (Project project, string targetProject) + bool ProjectReferencesProject (DotNetProject project, string targetProject) { if (project.Name == targetProject) { MessageService.ShowError (GettextCatalog.GetString ("Cyclic project references are not allowed.")); return true; } - foreach (ProjectReference pr in project.ProjectReferences) { - Project pref = project.RootCombine.FindProject (pr.Reference); + foreach (ProjectReference pr in project.References) { + DotNetProject pref = project.ParentSolution.FindProjectByName (pr.Reference) as DotNetProject; if (pref != null && ProjectReferencesProject (pref, targetProject)) return true; } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectReferenceNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectReferenceNodeBuilder.cs index 7e829fb7ab..80761d5c77 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectReferenceNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectReferenceNodeBuilder.cs @@ -89,7 +89,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad ProjectReference pref = CurrentNode.DataItem as ProjectReference; if (pref == null) return; - foreach (string fileName in pref.GetReferencedFileNames ()) { + foreach (string fileName in pref.GetReferencedFileNames (IdeApp.Workspace.ActiveConfiguration)) { IdeApp.Workbench.OpenDocument (fileName); } } @@ -97,9 +97,9 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad public override void DeleteItem () { ProjectReference pref = (ProjectReference) CurrentNode.DataItem; - Project project = CurrentNode.GetParentDataItem (typeof(Project), false) as Project; - project.ProjectReferences.Remove (pref); - IdeApp.ProjectOperations.SaveProject (project); + DotNetProject project = CurrentNode.GetParentDataItem (typeof(DotNetProject), false) as DotNetProject; + project.References.Remove (pref); + IdeApp.ProjectOperations.Save (project); } [CommandHandler (ProjectCommands.LocalCopyReference)] @@ -108,7 +108,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad ProjectReference pref = (ProjectReference) CurrentNode.DataItem; pref.LocalCopy = !pref.LocalCopy; Project project = CurrentNode.GetParentDataItem (typeof(Project), false) as Project; - IdeApp.ProjectOperations.SaveProject (project); + IdeApp.ProjectOperations.Save (project); } [CommandUpdateHandler (ProjectCommands.LocalCopyReference)] diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectSolutionPad.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectSolutionPad.cs index 1e1d5cb3c4..428bba2437 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectSolutionPad.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectSolutionPad.cs @@ -48,22 +48,19 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad base.OnSelectionChanged (sender, args); ITreeNavigator nav = treeView.GetSelectedNode (); if (nav != null) { - Project p = (Project) nav.GetParentDataItem (typeof(Project), true); - IdeApp.ProjectOperations.CurrentSelectedProject = p; - Combine c = (Combine) nav.GetParentDataItem (typeof(Combine), true); - IdeApp.ProjectOperations.CurrentSelectedCombine = c; - CombineEntry ce = (CombineEntry) nav.GetParentDataItem (typeof(CombineEntry), true); - IdeApp.ProjectOperations.CurrentSelectedCombineEntry = ce; + WorkspaceItem c = (WorkspaceItem) nav.GetParentDataItem (typeof(WorkspaceItem), true); + IdeApp.ProjectOperations.CurrentSelectedWorkspaceItem = c; + SolutionItem ce = (SolutionItem) nav.GetParentDataItem (typeof(SolutionItem), true); + IdeApp.ProjectOperations.CurrentSelectedSolutionItem = ce; IdeApp.ProjectOperations.CurrentSelectedItem = nav.DataItem; } } - protected override void OnCloseCombine (object sender, CombineEventArgs e) + protected override void OnCloseWorkspace (object sender, WorkspaceItemEventArgs e) { - base.OnCloseCombine (sender, e); - IdeApp.ProjectOperations.CurrentSelectedProject = null; - IdeApp.ProjectOperations.CurrentSelectedCombine = null; - IdeApp.ProjectOperations.CurrentSelectedCombineEntry = null; + base.OnCloseWorkspace (sender, e); + IdeApp.ProjectOperations.CurrentSelectedSolutionItem = null; + IdeApp.ProjectOperations.CurrentSelectedWorkspaceItem = null; } void OnWindowChanged (object ob, EventArgs args) @@ -77,7 +74,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad if (doc != null && doc.Project != null) { string file = doc.FileName; if (file != null) { - ProjectFile pf = doc.Project.ProjectFiles.GetFile (doc.FileName); + ProjectFile pf = doc.Project.Files.GetFile (doc.FileName); if (pf != null) { ITreeNavigator nav = treeView.GetNodeAtObject (pf, true); if (nav != null) { diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ResourceFolderNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ResourceFolderNodeBuilder.cs index 54e968349a..4a21407bd9 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ResourceFolderNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ResourceFolderNodeBuilder.cs @@ -70,7 +70,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad public override bool HasChildNodes (ITreeBuilder builder, object dataObject) { Project project = ((ResourceFolder)dataObject).Project; - foreach (ProjectFile file in project.ProjectFiles) + foreach (ProjectFile file in project.Files) if (file.BuildAction == BuildAction.EmbedAsResource) return true; return false; @@ -87,7 +87,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad public override void BuildChildNodes (ITreeBuilder builder, object dataObject) { Project project = ((ResourceFolder)dataObject).Project; - foreach (ProjectFile file in project.ProjectFiles) + foreach (ProjectFile file in project.Files) if (file.BuildAction == BuildAction.EmbedAsResource) builder.AddChild (file); } @@ -111,13 +111,13 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad CurrentNode.Expanded = true; foreach (string fileName in files) { - ProjectFile file = project.ProjectFiles.GetFile (fileName); + ProjectFile file = project.Files.GetFile (fileName); if (file != null) file.BuildAction = BuildAction.EmbedAsResource; else project.AddFile (fileName, BuildAction.EmbedAsResource); } - IdeApp.ProjectOperations.SaveProject (project); + IdeApp.ProjectOperations.Save (project); } string[] AskFiles (Project project) diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ShowAllFilesBuilderExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ShowAllFilesBuilderExtension.cs index e2ae7d7ea7..384750caa6 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ShowAllFilesBuilderExtension.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ShowAllFilesBuilderExtension.cs @@ -68,8 +68,8 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad deletedHandler = (EventHandler<FileEventArgs>) DispatchService.GuiDispatch (new EventHandler<FileEventArgs> (OnSystemFileDeleted)); renamedHandler = (EventHandler<FileCopyEventArgs>) DispatchService.GuiDispatch (new EventHandler<FileCopyEventArgs> (OnSystemFileRenamed)); - IdeApp.ProjectOperations.FileAddedToProject += fileAddedHandler; - IdeApp.ProjectOperations.FileRemovedFromProject += fileRemovedHandler; + IdeApp.Workspace.FileAddedToProject += fileAddedHandler; + IdeApp.Workspace.FileRemovedFromProject += fileRemovedHandler; FileService.FileRenamed += renamedHandler; FileService.FileRemoved += deletedHandler; @@ -78,8 +78,8 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad public override void Dispose () { - IdeApp.ProjectOperations.FileAddedToProject -= fileAddedHandler; - IdeApp.ProjectOperations.FileRemovedFromProject -= fileRemovedHandler; + IdeApp.Workspace.FileAddedToProject -= fileAddedHandler; + IdeApp.Workspace.FileRemovedFromProject -= fileRemovedHandler; FileService.FileRenamed -= renamedHandler; FileService.FileRemoved -= deletedHandler; FileService.FileCreated -= createdHandler; @@ -139,7 +139,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad Project project = (Project) builder.GetParentDataItem (typeof(Project), true); foreach (string file in Directory.GetFiles (path)) { - if (project.ProjectFiles.GetFile (file) == null) + if (project.Files.GetFile (file) == null) builder.AddChild (new SystemFile (file, project)); } @@ -239,7 +239,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad if (e.IsDirectory) { EnsureReachable (project, e.FileName + "/"); } else { - if (project.ProjectFiles.GetFile (e.FileName) == null) + if (project.Files.GetFile (e.FileName) == null) AddFile (e.FileName, project); } } @@ -308,7 +308,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad bool HasProjectFiles (Project project, string path) { string basePath = path + Path.DirectorySeparatorChar; - foreach (ProjectFile f in project.ProjectFiles) + foreach (ProjectFile f in project.Files) if (f.Name.StartsWith (basePath)) return true; return false; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionNodeBuilder.cs new file mode 100644 index 0000000000..085b686234 --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionNodeBuilder.cs @@ -0,0 +1,328 @@ +// SolutionNodeBuilder.cs +// +// Author: +// Lluis Sanchez Gual <lluis@novell.com> +// +// Copyright (c) 2008 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +// + +using System; +using System.Collections; +using System.Collections.Generic; + +using MonoDevelop.Projects; +using MonoDevelop.Core; +using MonoDevelop.Ide.Commands; +using MonoDevelop.Ide.Gui; +using MonoDevelop.Core.Gui; +using MonoDevelop.Components.Commands; +using MonoDevelop.Ide.Gui.Search; + +namespace MonoDevelop.Ide.Gui.Pads.ProjectPad +{ + public class SolutionNodeBuilder: TypeNodeBuilder + { + SolutionItemEventHandler combineEntryAdded; + SolutionItemEventHandler combineEntryRemoved; + EventHandler<WorkspaceItemRenamedEventArgs> combineNameChanged; + + public SolutionNodeBuilder () + { + combineEntryAdded = (SolutionItemEventHandler) DispatchService.GuiDispatch (new SolutionItemEventHandler (OnEntryAdded)); + combineEntryRemoved = (SolutionItemEventHandler) DispatchService.GuiDispatch (new SolutionItemEventHandler (OnEntryRemoved)); + combineNameChanged = (EventHandler<WorkspaceItemRenamedEventArgs>) DispatchService.GuiDispatch (new EventHandler<WorkspaceItemRenamedEventArgs> (OnCombineRenamed)); + + IdeApp.Workspace.StartupItemChanged += OnStartupChanged; + IdeApp.Workspace.ItemAddedToSolution += combineEntryAdded; + IdeApp.Workspace.ItemRemovedFromSolution += combineEntryRemoved; + } + + public override void Dispose () + { + base.Dispose (); + IdeApp.Workspace.StartupItemChanged -= OnStartupChanged; + IdeApp.Workspace.ItemAddedToSolution -= combineEntryAdded; + IdeApp.Workspace.ItemRemovedFromSolution -= combineEntryRemoved; + } + + + public override Type NodeDataType { + get { return typeof(Solution); } + } + + public override Type CommandHandlerType { + get { return typeof(SolutionNodeCommandHandler); } + } + + public override string GetNodeName (ITreeNavigator thisNode, object dataObject) + { + return ((Solution)dataObject).Name; + } + + public override void GetNodeAttributes (ITreeNavigator treeNavigator, object dataObject, ref NodeAttributes attributes) + { + attributes |= NodeAttributes.AllowRename; + } + + public override string ContextMenuAddinPath { + get { return "/MonoDevelop/Ide/ContextMenu/ProjectPad/Solution"; } + } + + public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) + { + Solution solution = dataObject as Solution; + int count = 0; + foreach (SolutionItem e in solution.GetAllSolutionItems ()) + if (!(e is SolutionFolder)) + count++; + + switch (count) { + case 0: + label = GettextCatalog.GetString ("Solution {0}", solution.Name); + break; + case 1: + label = GettextCatalog.GetString ("Solution {0} (1 entry)", solution.Name); + break; + default: + label = GettextCatalog.GetString ("Solution {0} ({1} entries)", solution.Name, count); + break; + } + + icon = Context.GetIcon (Stock.Solution); + } + + public override void BuildChildNodes (ITreeBuilder ctx, object dataObject) + { + Solution solution = (Solution) dataObject; + foreach (SolutionItem entry in solution.RootFolder.Items) + ctx.AddChild (entry); + } + + public override bool HasChildNodes (ITreeBuilder builder, object dataObject) + { + return ((Solution) dataObject).RootFolder.Items.Count > 0; + } + + public override object GetParentObject (object dataObject) + { + return ((Solution) dataObject).ParentWorkspace; + } + + public override void OnNodeAdded (object dataObject) + { + Solution solution = (Solution) dataObject; + solution.NameChanged += combineNameChanged; + } + + public override void OnNodeRemoved (object dataObject) + { + Solution solution = (Solution) dataObject; + solution.NameChanged -= combineNameChanged; + } + + void OnStartupChanged (object sender, EventArgs args) + { + foreach (SolutionEntityItem it in IdeApp.Workspace.GetAllSolutionItems<SolutionEntityItem> ()) { + ITreeBuilder tb = Context.GetTreeBuilder (it); + if (tb != null) + tb.Update (); + } + } + + void OnEntryAdded (object sender, SolutionItemEventArgs e) + { + ITreeBuilder tb; + if (e.SolutionItem.ParentFolder.IsRoot) + tb = Context.GetTreeBuilder (e.SolutionItem.ParentSolution); + else + tb = Context.GetTreeBuilder (e.SolutionItem.ParentFolder); + + if (tb != null) { + tb.Update (); // Update the entry count + tb.AddChild (e.SolutionItem, true); + tb.Expanded = true; + } + } + + void OnEntryRemoved (object sender, SolutionItemEventArgs e) + { + ITreeBuilder tb = Context.GetTreeBuilder (e.SolutionItem); + if (tb != null) { + ITreeBuilder tbs = Context.GetTreeBuilder (e.SolutionItem); + if (tbs.MoveToParent ()) + tbs.Update (); // Update the entry count + tb.Remove (); + } + } + + void OnCombineRenamed (object sender, WorkspaceItemRenamedEventArgs e) + { + ITreeBuilder tb = Context.GetTreeBuilder (e.Item); + if (tb != null) tb.Update (); + } + } + + public class SolutionNodeCommandHandler: NodeCommandHandler + { + public override void RenameItem (string newName) + { + if (newName.IndexOfAny (new char [] { '\'', '(', ')', '"', '{', '}', '|' } ) != -1) { + MessageService.ShowError (GettextCatalog.GetString ("Solution name may not contain any of the following characters: {0}", "', (, ), \", {, }, |")); + return; + } + + Solution sol = (Solution) CurrentNode.DataItem; + sol.Name = newName; + IdeApp.Workspace.Save(); + } + + public override DragOperation CanDragNode () + { + return DragOperation.Move; + } + + public override bool CanDropNode (object dataObject, DragOperation operation) + { + return dataObject is SolutionItem; + } + + public override void OnNodeDrop (object dataObject, DragOperation operation) + { + } + + public override void ActivateItem () + { + Solution sol = CurrentNode.DataItem as Solution; + IdeApp.ProjectOperations.ShowOptions (sol); + } + + [CommandHandler (EditCommands.Delete)] + public void RemoveItem () + { + Solution solution = CurrentNode.DataItem as Solution; + Workspace parent = CurrentNode.GetParentDataItem (typeof(Workspace), false) as Workspace; + if (parent == null) return; + + if (MessageService.Confirm (GettextCatalog.GetString ("Do you really want to remove solution {0} from workspace {1}?", solution.Name, parent.Name), AlertButton.Remove)) { + parent.Items.Remove (solution); + solution.Dispose (); + IdeApp.Workspace.Save(); + } + } + + [CommandUpdateHandler (EditCommands.Delete)] + public void OnUpdateRemoveItem (CommandInfo info) + { + Workspace parent = CurrentNode.GetParentDataItem (typeof(Workspace), false) as Workspace; + info.Enabled = parent != null; + } + + [CommandHandler (ProjectCommands.AddNewProject)] + public void AddNewProjectToSolution () + { + Solution solution = (Solution) CurrentNode.DataItem; + SolutionItem ce = IdeApp.ProjectOperations.CreateProject (solution.RootFolder); + if (ce == null) return; + Tree.AddNodeInsertCallback (ce, new TreeNodeCallback (OnEntryInserted)); + CurrentNode.Expanded = true; + } + + [CommandHandler (ProjectCommands.AddProject)] + public void AddProjectToCombine() + { + Solution solution = (Solution) CurrentNode.DataItem; + SolutionItem ce = IdeApp.ProjectOperations.AddSolutionItem (solution.RootFolder); + if (ce == null) return; + Tree.AddNodeInsertCallback (ce, new TreeNodeCallback (OnEntryInserted)); + CurrentNode.Expanded = true; + } + + [CommandHandler (ProjectCommands.AddSolutionFolder)] + public void AddFolder() + { + Solution solution = (Solution) CurrentNode.DataItem; + SolutionItem ce = new SolutionFolder (); + ce.Name = GettextCatalog.GetString ("New Folder"); + solution.RootFolder.Items.Add (ce); + Tree.AddNodeInsertCallback (ce, OnFolderInserted); + CurrentNode.Expanded = true; + } + + [CommandHandler (ProjectCommands.Reload)] + public void OnReload () + { + Solution solution = (Solution) CurrentNode.DataItem; + using (IProgressMonitor m = IdeApp.Workbench.ProgressMonitors.GetLoadProgressMonitor (true)) { + solution.ParentWorkspace.ReloadItem (m, solution); + } + } + + [CommandUpdateHandler (ProjectCommands.Reload)] + public void OnUpdateReload (CommandInfo info) + { + Solution solution = (Solution) CurrentNode.DataItem; + info.Visible = (solution.ParentWorkspace != null) && solution.NeedsReload; + } + + void OnEntryInserted (ITreeNavigator nav) + { + nav.Selected = true; + nav.Expanded = true; + } + + void OnFolderInserted (ITreeNavigator nav) + { + nav.Selected = true; + nav.Expanded = true; + Tree.StartLabelEdit (); + } + + [CommandHandler (FileCommands.OpenContainingFolder)] + public void OnOpenFolder () + { + Solution solution = (Solution) CurrentNode.DataItem; + System.Diagnostics.Process.Start ("file://" + solution.BaseDirectory); + } + + [CommandHandler (SearchCommands.FindInFiles)] + public void OnFindInFiles () + { + Solution solution = (Solution) CurrentNode.DataItem; + SearchReplaceInFilesManager.SearchOptions.SearchDirectory = solution.BaseDirectory; + SearchReplaceInFilesManager.ShowFindDialog (); + } + + [CommandHandler (FileCommands.CloseWorkspaceItem)] + public void OnCloseItem () + { + Solution solution = (Solution) CurrentNode.DataItem; + IdeApp.Workspace.CloseWorkspaceItem (solution); + } + + [CommandUpdateHandler (FileCommands.CloseWorkspaceItem)] + public void OnUpdateCloseItem (CommandInfo info) + { + Solution solution = (Solution) CurrentNode.DataItem; + info.Visible = solution.ParentWorkspace == null; + } + } +} diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SystemFileNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SystemFileNodeBuilder.cs index be1fae13fa..e4975417dd 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SystemFileNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SystemFileNodeBuilder.cs @@ -151,7 +151,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad else project.AddFile (file.Path, BuildAction.Nothing); - IdeApp.ProjectOperations.SaveProject (project); + IdeApp.ProjectOperations.Save (project); } [CommandUpdateHandler (ProjectCommands.IncludeToProject)] diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/UnknownEntryNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/UnknownEntryNodeBuilder.cs index 5aac5c7383..50d10839f8 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/UnknownEntryNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/UnknownEntryNodeBuilder.cs @@ -40,7 +40,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad public class UnknownEntryNodeBuilder: TypeNodeBuilder { public override Type NodeDataType { - get { return typeof(UnknownCombineEntry); } + get { return typeof(UnknownSolutionItem); } } public override string ContextMenuAddinPath { @@ -53,7 +53,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) { - UnknownCombineEntry entry = (UnknownCombineEntry) dataObject; + UnknownSolutionItem entry = (UnknownSolutionItem) dataObject; if (entry.LoadError.Length > 0) { icon = Context.GetIcon (Gtk.Stock.DialogError); @@ -72,20 +72,20 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad public override bool HasChildNodes (ITreeBuilder builder, object dataObject) { - UnknownCombineEntry entry = (UnknownCombineEntry) dataObject; + UnknownSolutionItem entry = (UnknownSolutionItem) dataObject; return entry.LoadError.Length > 0; } public override void BuildChildNodes (ITreeBuilder treeBuilder, object dataObject) { - UnknownCombineEntry entry = (UnknownCombineEntry) dataObject; + UnknownSolutionItem entry = (UnknownSolutionItem) dataObject; if (entry.LoadError.Length > 0) treeBuilder.AddChild (new TreeViewItem (entry.LoadError)); } public override string GetNodeName (ITreeNavigator thisNode, object dataObject) { - return ((UnknownCombineEntry)dataObject).Name; + return ((UnknownSolutionItem)dataObject).Name; } } @@ -94,33 +94,33 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad [CommandHandler (ProjectCommands.Reload)] public void OnReload () { - UnknownCombineEntry entry = (UnknownCombineEntry) CurrentNode.DataItem; + UnknownSolutionItem entry = (UnknownSolutionItem) CurrentNode.DataItem; using (IProgressMonitor m = IdeApp.Workbench.ProgressMonitors.GetLoadProgressMonitor (true)) { - entry.ParentCombine.ReloadEntry (m, entry); + entry.ParentFolder.ReloadItem (m, entry); } } [CommandUpdateHandler (ProjectCommands.Reload)] public void OnUpdateReload (CommandInfo info) { - UnknownCombineEntry entry = (UnknownCombineEntry) CurrentNode.DataItem; - info.Enabled = entry.ParentCombine != null; + UnknownSolutionItem entry = (UnknownSolutionItem) CurrentNode.DataItem; + info.Enabled = entry.ParentFolder != null; } public override void DeleteItem () { - UnknownCombineEntry entry = (UnknownCombineEntry) CurrentNode.DataItem; - Combine cmb = entry.ParentCombine; + UnknownSolutionItem item = (UnknownSolutionItem) CurrentNode.DataItem; + SolutionFolder cmb = item.ParentFolder; if (cmb == null) return; bool yes = MessageService.Confirm (GettextCatalog.GetString ( - "Do you really want to remove project '{0}' from solution '{1}'", entry.FileName, cmb.Name), AlertButton.Remove); + "Do you really want to remove project '{0}' from solution '{1}'", item.FileName, cmb.Name), AlertButton.Remove); if (yes) { - cmb.RemoveEntry (entry); - entry.Dispose (); - IdeApp.ProjectOperations.SaveCombineEntry (cmb); + cmb.Items.Remove (item); + item.Dispose (); + IdeApp.ProjectOperations.Save (cmb.ParentSolution); } } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/WorkspaceNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/WorkspaceNodeBuilder.cs new file mode 100644 index 0000000000..dc229812fa --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/WorkspaceNodeBuilder.cs @@ -0,0 +1,311 @@ +// WorkspaceNodeBuilder.cs +// +// Author: +// Lluis Sanchez Gual <lluis@novell.com> +// +// Copyright (c) 2008 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +// + +using System; +using System.Collections; +using System.Collections.Generic; + +using MonoDevelop.Projects; +using MonoDevelop.Core; +using MonoDevelop.Ide.Commands; +using MonoDevelop.Ide.Gui; +using MonoDevelop.Core.Gui; +using MonoDevelop.Components.Commands; +using MonoDevelop.Ide.Gui.Search; + +namespace MonoDevelop.Ide.Gui.Pads.ProjectPad +{ + public class WorkspaceNodeBuilder: TypeNodeBuilder + { + EventHandler<WorkspaceItemChangeEventArgs> combineEntryAdded; + EventHandler<WorkspaceItemChangeEventArgs> combineEntryRemoved; + EventHandler<WorkspaceItemRenamedEventArgs> combineNameChanged; + EventHandler startupChanged; + + public WorkspaceNodeBuilder () + { + combineEntryAdded = OnEntryAdded; + combineEntryRemoved = OnEntryRemoved; + combineNameChanged = OnCombineRenamed; + combineEntryAdded = DispatchService.GuiDispatch (combineEntryAdded); + combineEntryRemoved = DispatchService.GuiDispatch (combineEntryRemoved); + combineNameChanged = DispatchService.GuiDispatch (combineNameChanged); + } + + public override Type NodeDataType { + get { return typeof(Workspace); } + } + + public override Type CommandHandlerType { + get { return typeof(WorkspaceNodeCommandHandler); } + } + + public override string GetNodeName (ITreeNavigator thisNode, object dataObject) + { + return ((Workspace)dataObject).Name; + } + + public override void GetNodeAttributes (ITreeNavigator treeNavigator, object dataObject, ref NodeAttributes attributes) + { + attributes |= NodeAttributes.AllowRename; + } + + public override string ContextMenuAddinPath { + get { return "/MonoDevelop/Ide/ContextMenu/ProjectPad/Workspace"; } + } + + public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon) + { + Workspace workspace = dataObject as Workspace; + label = workspace.Name; + icon = Context.GetIcon (Stock.Workspace); + } + + public override void BuildChildNodes (ITreeBuilder ctx, object dataObject) + { + Workspace ws = (Workspace) dataObject; + foreach (WorkspaceItem entry in ws.Items) + ctx.AddChild (entry); + } + + public override bool HasChildNodes (ITreeBuilder builder, object dataObject) + { + return ((Workspace) dataObject).Items.Count > 0; + } + + public override object GetParentObject (object dataObject) + { + return ((Workspace) dataObject).ParentWorkspace; + } + + public override void OnNodeAdded (object dataObject) + { + Workspace ws = (Workspace) dataObject; + ws.ItemAdded += combineEntryAdded; + ws.ItemRemoved += combineEntryRemoved; + ws.NameChanged += combineNameChanged; + } + + public override void OnNodeRemoved (object dataObject) + { + Workspace ws = (Workspace) dataObject; + ws.ItemAdded -= combineEntryAdded; + ws.ItemRemoved -= combineEntryRemoved; + ws.NameChanged -= combineNameChanged; + } + + void OnEntryAdded (object sender, WorkspaceItemEventArgs e) + { + ITreeBuilder tb = Context.GetTreeBuilder (e.Item.ParentWorkspace); + if (tb != null) { + tb.AddChild (e.Item, true); + tb.Expanded = true; + } + } + + void OnEntryRemoved (object sender, WorkspaceItemEventArgs e) + { + ITreeBuilder tb = Context.GetTreeBuilder (e.Item); + if (tb != null) + tb.Remove (); + } + + void OnCombineRenamed (object sender, WorkspaceItemRenamedEventArgs e) + { + ITreeBuilder tb = Context.GetTreeBuilder (e.Item); + if (tb != null) tb.Update (); + } + } + + public class WorkspaceNodeCommandHandler: NodeCommandHandler + { + public override void RenameItem (string newName) + { + if (newName.IndexOfAny (new char [] { '\'', '(', ')', '"', '{', '}', '|' } ) != -1) { + MessageService.ShowError (GettextCatalog.GetString ("Workspace name may not contain any of the following characters: {0}", "', (, ), \", {, }, |")); + return; + } + + Workspace sol = (Workspace) CurrentNode.DataItem; + sol.Name = newName; + IdeApp.Workspace.Save(); + } + + public override DragOperation CanDragNode () + { + return DragOperation.Move; + } + + public override bool CanDropNode (object dataObject, DragOperation operation) + { + if (operation == DragOperation.Move) { + WorkspaceItem it = dataObject as WorkspaceItem; + if (it != null) { + Workspace ws = (Workspace) CurrentNode.DataItem; + return it != ws && !ws.Items.Contains (it); + } + } + return false; + } + + public override void OnNodeDrop (object dataObject, DragOperation operation) + { + Workspace ws = (Workspace) CurrentNode.DataItem; + WorkspaceItem it = (WorkspaceItem) dataObject; + + if (!MessageService.Confirm (GettextCatalog.GetString ("Are you sure you want to move the item '{0}' to the workspace '{1}'?", it.Name, ws.Name), AlertButton.Move)) + return; + + if (it.ParentWorkspace != null) { + it.ParentWorkspace.Items.Remove (it); + ws.Items.Add (it); + IdeApp.ProjectOperations.Save (it.ParentWorkspace); + IdeApp.ProjectOperations.Save (ws); + } else { + IdeApp.Workspace.Items.Remove (it); + ws.Items.Add (it); + IdeApp.ProjectOperations.Save (ws); + } + } + + public override void ActivateItem () + { + Workspace ws = CurrentNode.DataItem as Workspace; + IdeApp.ProjectOperations.ShowOptions (ws); + } + + [CommandHandler (EditCommands.Delete)] + public void RemoveItem () + { + Workspace ws = CurrentNode.DataItem as Workspace; + Workspace parent = CurrentNode.GetParentDataItem (typeof(Workspace), false) as Workspace; + if (parent == null) return; + + if (MessageService.Confirm (GettextCatalog.GetString ("Do you really want to remove the item '{0}' from workspace '{1}'?", ws.Name, parent.Name), AlertButton.Remove)) { + parent.Items.Remove (ws); + ws.Dispose (); + IdeApp.Workspace.Save(); + } + } + + [CommandUpdateHandler (EditCommands.Delete)] + public void OnUpdateRemoveItem (CommandInfo info) + { + Workspace parent = CurrentNode.GetParentDataItem (typeof(Workspace), false) as Workspace; + info.Enabled = parent != null; + info.Text = GettextCatalog.GetString ("Remove"); + } + + [CommandHandler (ProjectCommands.AddNewSolution)] + public void AddNewSolutionToWorkspace () + { + Workspace ws = (Workspace) CurrentNode.DataItem; + WorkspaceItem ce = IdeApp.ProjectOperations.AddNewWorkspaceItem (ws); + if (ce == null) return; + Tree.AddNodeInsertCallback (ce, new TreeNodeCallback (OnEntryInserted)); + CurrentNode.Expanded = true; + } + + [CommandHandler (ProjectCommands.AddNewWorkspace)] + public void AddNewWorkspaceToWorkspace () + { + Workspace ws = (Workspace) CurrentNode.DataItem; + WorkspaceItem ce = IdeApp.ProjectOperations.AddNewWorkspaceItem (ws, "MonoDevelop.Workspace"); + if (ce == null) return; + Tree.AddNodeInsertCallback (ce, new TreeNodeCallback (OnEntryInserted)); + CurrentNode.Expanded = true; + } + + [CommandHandler (ProjectCommands.AddItem)] + public void AddProjectToCombine() + { + Workspace ws = (Workspace) CurrentNode.DataItem; + WorkspaceItem ce = IdeApp.ProjectOperations.AddWorkspaceItem (ws); + if (ce == null) return; + Tree.AddNodeInsertCallback (ce, new TreeNodeCallback (OnEntryInserted)); + CurrentNode.Expanded = true; + } + + [CommandHandler (ProjectCommands.Reload)] + public void OnReload () + { + Workspace ws = (Workspace) CurrentNode.DataItem; + using (IProgressMonitor m = IdeApp.Workbench.ProgressMonitors.GetLoadProgressMonitor (true)) { + ws.ParentWorkspace.ReloadItem (m, ws); + } + } + + [CommandUpdateHandler (ProjectCommands.Reload)] + public void OnUpdateReload (CommandInfo info) + { + Workspace ws = (Workspace) CurrentNode.DataItem; + info.Visible = (ws.ParentWorkspace != null) && ws.NeedsReload; + } + + void OnEntryInserted (ITreeNavigator nav) + { + nav.Selected = true; + nav.Expanded = true; + } + + void OnFolderInserted (ITreeNavigator nav) + { + nav.Selected = true; + nav.Expanded = true; + Tree.StartLabelEdit (); + } + + [CommandHandler (FileCommands.OpenContainingFolder)] + public void OnOpenFolder () + { + Workspace ws = (Workspace) CurrentNode.DataItem; + System.Diagnostics.Process.Start ("file://" + ws.BaseDirectory); + } + + [CommandHandler (SearchCommands.FindInFiles)] + public void OnFindInFiles () + { + Workspace ws = (Workspace) CurrentNode.DataItem; + SearchReplaceInFilesManager.SearchOptions.SearchDirectory = ws.BaseDirectory; + SearchReplaceInFilesManager.ShowFindDialog (); + } + + [CommandHandler (FileCommands.CloseWorkspaceItem)] + public void OnCloseItem () + { + Workspace ws = (Workspace) CurrentNode.DataItem; + IdeApp.Workspace.CloseWorkspaceItem (ws); + } + + [CommandUpdateHandler (FileCommands.CloseWorkspaceItem)] + public void OnUpdateCloseItem (CommandInfo info) + { + Workspace ws = (Workspace) CurrentNode.DataItem; + info.Visible = ws.ParentWorkspace == null; + } + } +} diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/DefaultMonitorPad.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/DefaultMonitorPad.cs index 891dbd7dc9..8f9df8f9b2 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/DefaultMonitorPad.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/DefaultMonitorPad.cs @@ -132,8 +132,8 @@ namespace MonoDevelop.Ide.Gui.Pads endMark = buffer.CreateMark ("end-mark", buffer.EndIter, false); - IdeApp.ProjectOperations.CombineOpened += (CombineEventHandler) DispatchService.GuiDispatch (new CombineEventHandler (OnCombineOpen)); - IdeApp.ProjectOperations.CombineClosed += (CombineEventHandler) DispatchService.GuiDispatch (new CombineEventHandler (OnCombineClosed)); + IdeApp.Workspace.FirstWorkspaceItemOpened += OnCombineOpen; + IdeApp.Workspace.LastWorkspaceItemClosed += OnCombineClosed; Control.ShowAll (); @@ -187,13 +187,13 @@ namespace MonoDevelop.Ide.Gui.Pads asyncOperation.Cancel (); } - void OnCombineOpen (object sender, CombineEventArgs e) + void OnCombineOpen (object sender, EventArgs e) { lock (updates.SyncRoot) outputDispatcherRunning = false; buffer.Clear (); } - void OnCombineClosed (object sender, CombineEventArgs e) + void OnCombineClosed (object sender, EventArgs e) { lock (updates.SyncRoot) outputDispatcherRunning = false; buffer.Clear (); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs index 9a2236a648..b4c4e51447 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs @@ -168,12 +168,13 @@ namespace MonoDevelop.Ide.Gui.Pads sw.ShadowType = ShadowType.None; sw.Add (view); - Services.TaskService.TasksCleared += (EventHandler) DispatchService.GuiDispatch (new EventHandler (ShowResults)); + Services.TaskService.TaskRemoved += (TaskEventHandler) DispatchService.GuiDispatch (new TaskEventHandler (ShowResults)); Services.TaskService.TaskAdded += (TaskEventHandler) DispatchService.GuiDispatch (new TaskEventHandler (TaskAdded)); Services.TaskService.TaskChanged += (TaskEventHandler) DispatchService.GuiDispatch (new TaskEventHandler (TaskChanged)); - IdeApp.ProjectOperations.CombineOpened += (CombineEventHandler) DispatchService.GuiDispatch (new CombineEventHandler (OnCombineOpen)); - IdeApp.ProjectOperations.CombineClosed += (CombineEventHandler) DispatchService.GuiDispatch (new CombineEventHandler (OnCombineClosed)); + IdeApp.Workspace.FirstWorkspaceItemOpened += OnCombineOpen; + IdeApp.Workspace.LastWorkspaceItemClosed += OnCombineClosed; + view.RowActivated += new RowActivatedHandler (OnRowActivated); iconWarning = sw.RenderIcon (Gtk.Stock.DialogWarning, Gtk.IconSize.Menu, ""); @@ -429,12 +430,12 @@ namespace MonoDevelop.Ide.Gui.Pads col.Resizable = true; } - void OnCombineOpen(object sender, CombineEventArgs e) + void OnCombineOpen(object sender, EventArgs e) { Clear(); } - void OnCombineClosed(object sender, CombineEventArgs e) + void OnCombineClosed(object sender, EventArgs e) { Clear(); } @@ -529,7 +530,7 @@ namespace MonoDevelop.Ide.Gui.Pads } while (store.IterNext (ref iter)); } } - + void TaskAdded (object sender, TaskEventArgs e) { AddTasks (e.Tasks); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/FileScout.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/FileScout.cs index 2404804633..84bce634e3 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/FileScout.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/FileScout.cs @@ -74,8 +74,8 @@ namespace MonoDevelop.Ide.Gui.Pads fb.DirectoryChangedEvent += new DirectoryChangedEventHandler (OnDirChanged); filelister.RowActivated += new Gtk.RowActivatedHandler (FileSelected); - IdeApp.ProjectOperations.CombineOpened += (CombineEventHandler) DispatchService.GuiDispatch (new CombineEventHandler(OnCombineOpened)); - IdeApp.ProjectOperations.CombineClosed += (CombineEventHandler) DispatchService.GuiDispatch (new CombineEventHandler(OnCombineClosed)); + IdeApp.Workspace.FirstWorkspaceItemOpened += OnCombineOpened; + IdeApp.Workspace.LastWorkspaceItemClosed += OnCombineClosed; Gtk.ScrolledWindow listsw = new Gtk.ScrolledWindow (); listsw.Add (filelister); @@ -135,24 +135,25 @@ namespace MonoDevelop.Ide.Gui.Pads //FIXME: use mimetypes not extensions // also change to Project tab when its a project - if (Services.ProjectService.IsCombineEntryFile (item.FullName)) - IdeApp.ProjectOperations.OpenCombine (item.FullName); + if (Services.ProjectService.IsWorkspaceItemFile (item.FullName)) + IdeApp.Workspace.OpenWorkspaceItem (item.FullName); else IdeApp.Workbench.OpenDocument (item.FullName); } } - void OnCombineOpened(object sender, CombineEventArgs args) + void OnCombineOpened(object sender, WorkspaceItemEventArgs args) { try { - if (args.Combine.StartupEntry != null) - fb.CurrentDir = args.Combine.StartupEntry.BaseDirectory; + Solution sol = args.Item as Solution; + if (sol != null && sol.StartupItem != null) + fb.CurrentDir = sol.StartupItem.BaseDirectory; } catch { fb.CurrentDir = Environment.GetFolderPath(Environment.SpecialFolder.Personal); } } - void OnCombineClosed(object sender, CombineEventArgs args) + void OnCombineClosed(object sender, EventArgs args) { fb.CurrentDir = Environment.GetFolderPath(Environment.SpecialFolder.Personal); } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/SolutionPad.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/SolutionPad.cs index 7a5d271ba9..fc4a920e2a 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/SolutionPad.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/SolutionPad.cs @@ -40,16 +40,16 @@ namespace MonoDevelop.Ide.Gui.Pads { public SolutionPad () { - IdeApp.ProjectOperations.CombineOpened += (CombineEventHandler) DispatchService.GuiDispatch (new CombineEventHandler (OnOpenCombine)); - IdeApp.ProjectOperations.CombineClosed += (CombineEventHandler) DispatchService.GuiDispatch (new CombineEventHandler (OnCloseCombine)); + IdeApp.Workspace.WorkspaceItemOpened += OnOpenWorkspace; + IdeApp.Workspace.WorkspaceItemClosed += OnCloseWorkspace; PropertyService.PropertyChanged += (EventHandler<PropertyChangedEventArgs>) DispatchService.GuiDispatch (new EventHandler<PropertyChangedEventArgs> (TrackPropertyChange)); } public override void Initialize (NodeBuilder[] builders, TreePadOption[] options) { base.Initialize (builders, options); - if (IdeApp.ProjectOperations.CurrentOpenCombine != null) - treeView.LoadTree (IdeApp.ProjectOperations.CurrentOpenCombine); + foreach (WorkspaceItem it in IdeApp.Workspace.Items) + treeView.AddChild (it); } void TrackPropertyChange (object o, MonoDevelop.Core.PropertyChangedEventArgs e) @@ -59,14 +59,14 @@ namespace MonoDevelop.Ide.Gui.Pads } } - protected virtual void OnOpenCombine (object sender, CombineEventArgs e) + protected virtual void OnOpenWorkspace (object sender, WorkspaceItemEventArgs e) { - treeView.LoadTree (e.Combine); + treeView.AddChild (e.Item); } - protected virtual void OnCloseCombine (object sender, CombineEventArgs e) + protected virtual void OnCloseWorkspace (object sender, WorkspaceItemEventArgs e) { - treeView.Clear (); + treeView.RemoveChild (e.Item); } } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Search/WholeProjectDocumentIterator.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Search/WholeProjectDocumentIterator.cs index 99481f0b30..456ac75866 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Search/WholeProjectDocumentIterator.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Search/WholeProjectDocumentIterator.cs @@ -87,29 +87,20 @@ namespace MonoDevelop.Ide.Gui.Search void AddFiles(Project project)
{
- foreach (ProjectFile file in project.ProjectFiles) {
+ foreach (ProjectFile file in project.Files) {
if (file.Subtype == Subtype.Code) {
files.Add(file.Name);
}
}
}
- void AddFiles(Combine combine)
- {
- foreach (CombineEntry entry in combine.Entries) {
- if (entry is Project) {
- AddFiles ((Project)entry);
- } else if (entry is Combine) {
- AddFiles ((Combine)entry);
- }
- }
- }
-
public void Reset()
{
files.Clear();
- if (IdeApp.ProjectOperations.CurrentOpenCombine != null) {
- AddFiles (IdeApp.ProjectOperations.CurrentOpenCombine);
+ if (IdeApp.Workspace.IsOpen) { + foreach (Project p in IdeApp.Workspace.GetAllProjects ()) {
+ AddFiles (p); + }
}
curIndex = -1;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/AddEntryEventHandler.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/AddEntryEventHandler.cs index 2fb644c91f..16839b9c50 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/AddEntryEventHandler.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/AddEntryEventHandler.cs @@ -37,15 +37,15 @@ namespace MonoDevelop.Ide.Gui { string fileName; bool cancel; - Combine combine; + SolutionFolder combine; - public AddEntryEventArgs (Combine combine, string fileName) + public AddEntryEventArgs (SolutionFolder combine, string fileName) { this.combine = combine; this.fileName = fileName; } - public Combine Combine { + public SolutionFolder Combine { get { return combine; } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ConfigurationComboBox.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ConfigurationComboBox.cs index 43a92e72c6..e0453856d8 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ConfigurationComboBox.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ConfigurationComboBox.cs @@ -36,18 +36,13 @@ namespace MonoDevelop.Ide.Gui { internal class ConfigurationComboBox: ToolbarComboBox { - ConfigurationEventHandler onActiveConfigurationChanged; - ConfigurationEventHandler onConfigurationsChanged; + bool updating; public ConfigurationComboBox () { Combo.Changed += new EventHandler (OnChanged); - - onActiveConfigurationChanged = (ConfigurationEventHandler) DispatchService.GuiDispatch (new ConfigurationEventHandler (OnActiveConfigurationChanged)); - onConfigurationsChanged = (ConfigurationEventHandler) DispatchService.GuiDispatch (new ConfigurationEventHandler (OnConfigurationsChanged)); - - IdeApp.ProjectOperations.CombineOpened += (CombineEventHandler) DispatchService.GuiDispatch (new CombineEventHandler (OpenCombine)); - IdeApp.ProjectOperations.CombineClosed += (CombineEventHandler) DispatchService.GuiDispatch (new CombineEventHandler (CloseCombine)); + IdeApp.Workspace.ConfigurationsChanged += OnConfigurationsChanged; + IdeApp.Workspace.ActiveConfigurationChanged += OnActiveConfigurationChanged; Reset (); } @@ -59,62 +54,57 @@ namespace MonoDevelop.Ide.Gui Combo.Sensitive = false; } - void RefreshCombo (Combine combine) + void RefreshCombo () { ((Gtk.ListStore)Combo.Model).Clear (); - Combo.Sensitive = true; int active = 0; - for (int n=0; n < combine.Configurations.Count; n++) { - IConfiguration c = combine.Configurations [n]; - Combo.AppendText (c.Name); - if (combine.ActiveConfiguration == c) + int n=0; + foreach (string conf in IdeApp.Workspace.GetConfigurations ()) { + Combo.AppendText (conf); + if (conf == IdeApp.Workspace.ActiveConfiguration) active = n; + n++; } + Combo.Sensitive = n > 0; Combo.Active = active; Combo.ShowAll (); } - void OpenCombine (object sender, CombineEventArgs e) + void OnConfigurationsChanged (object sender, EventArgs e) { - RefreshCombo (e.Combine); - e.Combine.ActiveConfigurationChanged += onActiveConfigurationChanged; - e.Combine.ConfigurationAdded += onConfigurationsChanged; - e.Combine.ConfigurationRemoved += onConfigurationsChanged; - } - - void CloseCombine (object sender, CombineEventArgs e) - { - Reset (); - e.Combine.ActiveConfigurationChanged -= onActiveConfigurationChanged; - e.Combine.ConfigurationAdded -= onConfigurationsChanged; - e.Combine.ConfigurationRemoved -= onConfigurationsChanged; - } - - void OnConfigurationsChanged (object sender, ConfigurationEventArgs e) - { - RefreshCombo (IdeApp.ProjectOperations.CurrentOpenCombine); + RefreshCombo (); } - void OnActiveConfigurationChanged (object sender, ConfigurationEventArgs e) + void OnActiveConfigurationChanged (object sender, EventArgs e) { - Combine combine = (Combine) e.CombineEntry; - for (int n=0; n < combine.Configurations.Count; n++) { - IConfiguration c = combine.Configurations [n]; - if (combine.ActiveConfiguration == c) { - Combo.Active = n; - break; + if (updating) + return; + Gtk.TreeIter it; + if (Combo.Model.GetIterFirst (out it)) { + do { + string cs = (string) Combo.Model.GetValue (it, 0); + if (IdeApp.Workspace.ActiveConfiguration == cs) { + updating = true; + Combo.SetActiveIter (it); + updating = false; + break; + } } + while (Combo.Model.IterNext (ref it)); } } protected void OnChanged (object sender, EventArgs args) { - if (IdeApp.ProjectOperations.CurrentOpenCombine != null) { + if (updating) + return; + if (IdeApp.Workspace.IsOpen) { Gtk.TreeIter iter; if (Combo.GetActiveIter (out iter)) { string cs = (string) Combo.Model.GetValue (iter, 0); - IConfiguration conf = IdeApp.ProjectOperations.CurrentOpenCombine.GetConfiguration (cs); - IdeApp.ProjectOperations.CurrentOpenCombine.ActiveConfiguration = conf; + updating = true; + IdeApp.Workspace.ActiveConfiguration = cs; + updating = false; } } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs index dd2bbcc6b2..d485e1995a 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs @@ -195,8 +195,8 @@ namespace MonoDevelop.Ide.Gui file = new Uri(file).LocalPath; try { - if (Services.ProjectService.IsCombineEntryFile (file)) - IdeApp.ProjectOperations.OpenCombine(file); + if (Services.ProjectService.IsWorkspaceItemFile (file)) + IdeApp.Workspace.OpenWorkspaceItem(file); else IdeApp.Workbench.OpenDocument (file); } catch (Exception e) { @@ -254,11 +254,8 @@ namespace MonoDevelop.Ide.Gui layout.RedrawAllComponents(); } - public void CloseContent(IViewContent content) + public void CloseContent (IViewContent content) { - if (PropertyService.Get("SharpDevelop.LoadDocumentProperties", true) && content is IMementoCapable) { - StoreMemento(content); - } if (viewContentCollection.Contains(content)) { viewContentCollection.Remove(content); } @@ -393,37 +390,6 @@ namespace MonoDevelop.Ide.Gui return null; } - public void StoreMemento(IViewContent content) - { - if (content.ContentName == null) { - return; - } - string directory = System.IO.Path.Combine (PropertyService.ConfigPath, "temp"); - if (!Directory.Exists(directory)) { - Directory.CreateDirectory(directory); - } - -// XmlDocument doc = new XmlDocument(); -// doc.LoadXml("<?xml version=\"1.0\"?>\n<Mementoable/>"); -// -// XmlAttribute fileAttribute = doc.CreateAttribute("file"); -// fileAttribute.InnerText = content.ContentName; -// doc.DocumentElement.Attributes.Append(fileAttribute); -// - object memento = ((IMementoCapable)content).CreateMemento(); - -// doc.DocumentElement.AppendChild(memento.ToXmlElement(doc)); -// - string fileName = content.ContentName.Substring(3).Replace('/', '.').Replace('\\', '.').Replace(System.IO.Path.DirectorySeparatorChar, '.'); - // check the file name length because it could be more than the maximum length of a file name - string fullFileName = System.IO.Path.Combine (directory, fileName); - if (FileService.IsValidFileName(fullFileName)) { - ((Properties)memento).Save (fullFileName); -// doc.Save (fullFileName); - } - - } - // interface IMementoCapable public ICustomXmlSerializer CreateMemento() { @@ -530,7 +496,7 @@ namespace MonoDevelop.Ide.Gui if (!IdeApp.OnExit ()) return false; - IdeApp.ProjectOperations.SaveCombinePreferences (); + IdeApp.Workspace.SavePreferences (); IdeApp.CommandService.Dispose (); bool showDirtyDialog = false; @@ -552,7 +518,7 @@ namespace MonoDevelop.Ide.Gui CloseAllViews (); - IdeApp.ProjectOperations.CloseCombine (false); + IdeApp.Workspace.Close (false); PropertyService.Set ("SharpDevelop.Workbench.WorkbenchMemento", CreateMemento()); IdeApp.OnExited (); OnClosed (null); @@ -625,7 +591,7 @@ namespace MonoDevelop.Ide.Gui void AsyncParseCurrentFile (object ob) { object[] data = (object[]) ob; - IdeApp.ProjectOperations.ParserDatabase.UpdateFile ((Project) data[0], (string) data[1], (string) data[2]); + IdeApp.Workspace.ParserDatabase.UpdateFile ((Project) data[0], (string) data[1], (string) data[2]); } public Gtk.Toolbar[] ToolBars { diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs index 235d4ef7aa..3a6389d6b8 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs @@ -82,7 +82,7 @@ namespace MonoDevelop.Ide.Gui this.window = window; window.Closed += OnClosed; window.ActiveViewContentChanged += OnActiveViewContentChanged; - IdeApp.ProjectOperations.EntryRemovedFromCombine += OnEntryRemoved; + IdeApp.Workspace.ItemRemovedFromSolution += OnEntryRemoved; } public string FileName { @@ -322,7 +322,7 @@ namespace MonoDevelop.Ide.Gui ((SdiWorkspaceWindow)window).DetachFromPathedDocument (); window.Closed -= OnClosed; window.ActiveViewContentChanged -= OnActiveViewContentChanged; - IdeApp.ProjectOperations.EntryRemovedFromCombine -= OnEntryRemoved; + IdeApp.Workspace.ItemRemovedFromSolution -= OnEntryRemoved; OnClosed (a); while (editorExtension != null) { @@ -382,9 +382,9 @@ namespace MonoDevelop.Ide.Gui get { return editorExtension; } } - void OnEntryRemoved (object sender, CombineEntryEventArgs args) + void OnEntryRemoved (object sender, SolutionItemEventArgs args) { - if (args.CombineEntry == window.ViewContent.Project) + if (args.SolutionItem == window.ViewContent.Project) window.ViewContent.Project = null; } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Ide.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Ide.cs index 81f55dcd0f..95dc2f86c6 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Ide.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Ide.cs @@ -60,6 +60,8 @@ namespace MonoDevelop.Ide.Gui static HelpOperations helpOperations; static CommandManager commandService; static IdeServices ideServices; + static RootWorkspace workspace; + static IdePreferences preferences; public static event ExitEventHandler Exiting; public static event EventHandler Exited; @@ -77,6 +79,10 @@ namespace MonoDevelop.Ide.Gui get { return projectOperations; } } + public static RootWorkspace Workspace { + get { return workspace; } + } + public static HelpOperations HelpOperations { get { return helpOperations; } } @@ -89,6 +95,10 @@ namespace MonoDevelop.Ide.Gui get { return ideServices; } } + public static IdePreferences Preferences { + get { return preferences; } + } + public static bool IsInitialized { get { return isInitialized; @@ -101,10 +111,12 @@ namespace MonoDevelop.Ide.Gui MonoDevelop.Core.Gui.Services.Resources.ToString (); workbench = new Workbench (); + workspace = new RootWorkspace (); projectOperations = new ProjectOperations (); helpOperations = new HelpOperations (); commandService = new CommandManager (); ideServices = new IdeServices (); + preferences = new IdePreferences (); commandService.CommandError += delegate (object sender, CommandErrorArgs args) { MessageService.ShowException (args.Exception, args.ErrorMessage); @@ -136,6 +148,15 @@ namespace MonoDevelop.Ide.Gui commandService.EnableIdleUpdate = true; + // Default file format + + IdeApp.Services.ProjectService.DefaultFileFormatId = IdeApp.Preferences.DefaultProjectFileFormat; + IdeApp.Preferences.DefaultProjectFileFormatChanged += delegate { + IdeApp.Services.ProjectService.DefaultFileFormatId = IdeApp.Preferences.DefaultProjectFileFormat; + }; + + // Startup commands + AddinManager.AddExtensionNodeHandler ("/MonoDevelop/Ide/StartupHandlers", OnExtensionChanged); monitor.EndTask (); @@ -146,9 +167,9 @@ namespace MonoDevelop.Ide.Gui // Load requested files foreach (string file in StartupInfo.GetRequestedFileList()) { //FIXME: use mimetypes - if (Services.ProjectService.IsCombineEntryFile (file)) { + if (Services.ProjectService.IsWorkspaceItemFile (file)) { try { - IdeApp.ProjectOperations.OpenCombine (file).WaitForCompleted (); + IdeApp.Workspace.OpenWorkspaceItem (file).WaitForCompleted (); } catch (Exception e) { MessageService.ShowException (e, "Could not load solution: " + file); } @@ -167,7 +188,7 @@ namespace MonoDevelop.Ide.Gui RecentOpen recentOpen = Workbench.RecentOpen; if (recentOpen.RecentProject != null && recentOpen.RecentProject.Length > 0) { - IdeApp.ProjectOperations.OpenCombine(recentOpen.RecentProject[0].ToString()).WaitForCompleted (); + IdeApp.Workspace.OpenWorkspaceItem(recentOpen.RecentProject[0].ToString()).WaitForCompleted (); } } @@ -280,7 +301,7 @@ namespace MonoDevelop.Ide.Gui get { return MonoDevelop.Projects.Services.ParserService; } } - public IProjectService ProjectService { + public ProjectService ProjectService { get { return MonoDevelop.Projects.Services.ProjectService; } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IdePreferences.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IdePreferences.cs new file mode 100644 index 0000000000..6aa59eb069 --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IdePreferences.cs @@ -0,0 +1,75 @@ +// IdePreferences.cs +// +// Author: +// Lluis Sanchez Gual <lluis@novell.com> +// +// Copyright (c) 2008 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +// + +using System; +using MonoDevelop.Core; + +namespace MonoDevelop.Ide.Gui +{ + public class IdePreferences + { + public string DefaultProjectFileFormat { + get { return PropertyService.Get ("MonoDevelop.DefaultFileFormat", "MD1"); } + set { PropertyService.Set ("MonoDevelop.DefaultFileFormat", value); } + } + + public event EventHandler<PropertyChangedEventArgs> DefaultProjectFileFormatChanged { + add { PropertyService.AddPropertyHandler ("MonoDevelop.DefaultFileFormat", value); } + remove { PropertyService.RemovePropertyHandler ("MonoDevelop.DefaultFileFormat", value); } + } + + public bool LoadPrevSolutionOnStartup { + get { return PropertyService.Get ("SharpDevelop.LoadPrevProjectOnStartup", false); } + set { PropertyService.Set ("SharpDevelop.LoadPrevProjectOnStartup", value); } + } + + public event EventHandler<PropertyChangedEventArgs> LoadPrevSolutionOnStartupChanged { + add { PropertyService.AddPropertyHandler ("SharpDevelop.LoadPrevProjectOnStartup", value); } + remove { PropertyService.RemovePropertyHandler ("SharpDevelop.LoadPrevProjectOnStartup", value); } + } + + public bool CreateFileBackupCopies { + get { return PropertyService.Get ("SharpDevelop.CreateBackupCopy", false); } + set { PropertyService.Set ("SharpDevelop.CreateBackupCopy", value); } + } + + public event EventHandler<PropertyChangedEventArgs> CreateFileBackupCopiesChanged { + add { PropertyService.AddPropertyHandler ("SharpDevelop.CreateBackupCopy", value); } + remove { PropertyService.RemovePropertyHandler ("SharpDevelop.CreateBackupCopy", value); } + } + + public bool LoadDocumentUserProperties { + get { return PropertyService.Get ("SharpDevelop.LoadDocumentProperties", true); } + set { PropertyService.Set ("SharpDevelop.LoadDocumentProperties", value); } + } + + public event EventHandler<PropertyChangedEventArgs> LoadDocumentUserPropertiesChanged { + add { PropertyService.AddPropertyHandler ("SharpDevelop.LoadDocumentProperties", value); } + remove { PropertyService.RemovePropertyHandler ("SharpDevelop.LoadDocumentProperties", value); } + } + } +} diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IdeStartup.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IdeStartup.cs index b3b0a5cc15..83f71b21e5 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IdeStartup.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/IdeStartup.cs @@ -86,7 +86,7 @@ namespace MonoDevelop.Ide.Gui // If a combine was specified, force --newwindow. if(!options.newwindow) { foreach (string file in StartupInfo.GetRequestedFileList ()) { - if (MonoDevelop.Projects.Services.ProjectService.IsCombineEntryFile (file)) + if (MonoDevelop.Projects.Services.ProjectService.IsWorkspaceItemFile (file)) { options.newwindow = true; break; @@ -247,9 +247,9 @@ namespace MonoDevelop.Ide.Gui string file = fileToOpen; if (file == null || file.Length == 0) return false; - if (MonoDevelop.Projects.Services.ProjectService.IsCombineEntryFile (file)) { + if (MonoDevelop.Projects.Services.ProjectService.IsWorkspaceItemFile (file)) { try { - IdeApp.ProjectOperations.OpenCombine (file); + IdeApp.Workspace.OpenWorkspaceItem (file); } catch { } } else { diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/MonoDevelopTreeView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/MonoDevelopTreeView.cs index e58e3ef214..4947d5689e 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/MonoDevelopTreeView.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/MonoDevelopTreeView.cs @@ -417,6 +417,13 @@ namespace MonoDevelop.Ide.Gui builder.Expanded = true; } + public void RemoveChild (object nodeObject) + { + TreeBuilder builder = new TreeBuilder (this); + if (builder.MoveToObject (nodeObject)) + builder.Remove (); + } + public void Clear () { copyObject = dragObject = null; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/NavigationService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/NavigationService.cs index a865a98011..f9b482d35d 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/NavigationService.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/NavigationService.cs @@ -54,8 +54,8 @@ namespace MonoDevelop.Ide.Gui { { //WorkbenchSingleton.WorkbenchCreated += WorkbenchCreatedHandler; - IdeApp.ProjectOperations.FileRenamedInProject += FileRenamed; - IdeApp.ProjectOperations.CombineClosed += SolutionClosed; + IdeApp.Workspace.FileRenamedInProject += FileRenamed; + IdeApp.Workspace.LastWorkspaceItemClosed += SolutionClosed; } #region Public Properties diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProjectOperations.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProjectOperations.cs index b882ddaebc..3eddf5440b 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProjectOperations.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProjectOperations.cs @@ -58,137 +58,77 @@ namespace MonoDevelop.Ide.Gui /// </summary> public class ProjectOperations { - IProjectService projectService = MonoDevelop.Projects.Services.ProjectService; + ProjectService projectService = MonoDevelop.Projects.Services.ProjectService; IAsyncOperation currentBuildOperation = NullAsyncOperation.Success; IAsyncOperation currentRunOperation = NullAsyncOperation.Success; + IBuildTarget currentBuildOperationOwner; + IBuildTarget currentRunOperationOwner; GuiHelper guiHelper = new GuiHelper (); SelectReferenceDialog selDialog = null; - CombineEntry currentEntry = null; - Project currentProject = null; - Combine currentCombine = null; - Combine openCombine = null; + SolutionItem currentSolutionItem = null; + WorkspaceItem currentWorkspaceItem = null; object currentItem; - IParserDatabase parserDatabase; - CodeRefactorer refactorer; - ICompilerResult lastResult = new DefaultCompilerResult (); - ProjectFileEventHandler fileAddedToProjectHandler; - ProjectFileEventHandler fileRemovedFromProjectHandler; - ProjectFileRenamedEventHandler fileRenamedInProjectHandler; - ProjectFileEventHandler fileChangedInProjectHandler; - ProjectFileEventHandler filePropertyChangedInProjectHandler; - ProjectReferenceEventHandler referenceAddedToProjectHandler; - ProjectReferenceEventHandler referenceRemovedFromProjectHandler; - CombineEntryChangeEventHandler entryAddedToCombineHandler; - CombineEntryChangeEventHandler entryRemovedFromCombineHandler; - internal ProjectOperations () { - fileAddedToProjectHandler = (ProjectFileEventHandler) DispatchService.GuiDispatch (new ProjectFileEventHandler (NotifyFileAddedToProject)); - fileRemovedFromProjectHandler = (ProjectFileEventHandler) DispatchService.GuiDispatch (new ProjectFileEventHandler (NotifyFileRemovedFromProject)); - fileRenamedInProjectHandler = (ProjectFileRenamedEventHandler) DispatchService.GuiDispatch (new ProjectFileRenamedEventHandler (NotifyFileRenamedInProject)); - fileChangedInProjectHandler = (ProjectFileEventHandler) DispatchService.GuiDispatch (new ProjectFileEventHandler (NotifyFileChangedInProject)); - filePropertyChangedInProjectHandler = (ProjectFileEventHandler) DispatchService.GuiDispatch (new ProjectFileEventHandler (NotifyFilePropertyChangedInProject)); - referenceAddedToProjectHandler = (ProjectReferenceEventHandler) DispatchService.GuiDispatch (new ProjectReferenceEventHandler (NotifyReferenceAddedToProject)); - referenceRemovedFromProjectHandler = (ProjectReferenceEventHandler) DispatchService.GuiDispatch (new ProjectReferenceEventHandler (NotifyReferenceRemovedFromProject)); - - entryAddedToCombineHandler = (CombineEntryChangeEventHandler) DispatchService.GuiDispatch (new CombineEntryChangeEventHandler (NotifyEntryAddedToCombine)); - entryRemovedFromCombineHandler = (CombineEntryChangeEventHandler) DispatchService.GuiDispatch (new CombineEntryChangeEventHandler (NotifyEntryRemovedFromCombine)); - - FileService.FileRemoved += (EventHandler<FileEventArgs>) DispatchService.GuiDispatch (new EventHandler<FileEventArgs> (CheckFileRemove)); - FileService.FileRenamed += (EventHandler<FileCopyEventArgs>) DispatchService.GuiDispatch (new EventHandler<FileCopyEventArgs> (CheckFileRename)); - - GLib.Timeout.Add (2000, OnRunProjectChecks); - } - - public IParserDatabase ParserDatabase { - get { - if (parserDatabase == null) { - parserDatabase = Services.ParserService.CreateParserDatabase (); - parserDatabase.TrackFileChanges = true; - parserDatabase.ParseProgressMonitorFactory = new ParseProgressMonitorFactory (); - } - return parserDatabase; - } + IdeApp.Workspace.WorkspaceItemUnloaded += OnWorkspaceItemUnloaded; } - public CodeRefactorer CodeRefactorer { - get { - if (refactorer == null) { - refactorer = new CodeRefactorer (openCombine, ParserDatabase); - refactorer.TextFileProvider = new OpenDocumentFileProvider (); - } - - return refactorer; - } - } - public ICompilerResult LastCompilerResult { get { return lastResult; } } - bool IsDirtyFileInCombine { + public Project CurrentSelectedProject { get { - CombineEntryCollection projects = openCombine.GetAllProjects(); - - foreach (Project projectEntry in projects) { - foreach (ProjectFile fInfo in projectEntry.ProjectFiles) { - foreach (Document doc in IdeApp.Workbench.Documents) { - if (doc.IsDirty && doc.FileName == fInfo.Name) { - return true; - } - } - } - } - return false; + return currentSolutionItem as Project; } } - public bool NeedsCompiling { + public Solution CurrentSelectedSolution { get { - if (openCombine == null) { - return false; - } - return openCombine.NeedsBuilding || IsDirtyFileInCombine; + return currentWorkspaceItem as Solution; } } - public Project CurrentSelectedProject { + public IBuildTarget CurrentSelectedBuildTarget { get { - return currentProject; - } - internal set { - if (value != currentProject) { - System.Diagnostics.Debug.Assert(openCombine != null); - currentProject = value; - OnCurrentProjectChanged(new ProjectEventArgs(currentProject)); - } + if (currentSolutionItem != null) + return currentSolutionItem; + return currentWorkspaceItem; } } - public Combine CurrentSelectedCombine { + public WorkspaceItem CurrentSelectedWorkspaceItem { get { - return currentCombine; + return currentWorkspaceItem; } internal set { - if (value != currentCombine) { - System.Diagnostics.Debug.Assert(openCombine != null); - currentCombine = value; - OnCurrentSelectedCombineChanged(new CombineEventArgs(currentCombine)); + if (value != currentWorkspaceItem) { + WorkspaceItem oldValue = currentWorkspaceItem; + currentWorkspaceItem = value; + if (oldValue is Solution || value is Solution) + OnCurrentSelectedSolutionChanged(new SolutionEventArgs (currentWorkspaceItem as Solution)); } } } - public CombineEntry CurrentSelectedCombineEntry { + public SolutionItem CurrentSelectedSolutionItem { get { - return currentEntry; + if (currentSolutionItem == null && CurrentSelectedSolution != null) + return CurrentSelectedSolution.RootFolder; + return currentSolutionItem; } internal set { - currentEntry = value; + if (value != currentSolutionItem) { + SolutionItem oldValue = currentSolutionItem; + currentSolutionItem = value; + if (oldValue is Project || value is Project) + OnCurrentProjectChanged (new ProjectEventArgs(currentSolutionItem as Project)); + } } } @@ -210,17 +150,6 @@ namespace MonoDevelop.Ide.Gui } } - public Project GetProjectContaining (string fileName) - { - if (this.openCombine == null) - return null; - foreach (Project p in openCombine.GetAllProjects ()) - if (p.GetProjectFile (fileName) != null) - return p; - return null; - } - - public IAsyncOperation CurrentBuildOperation { get { return currentBuildOperation; } } @@ -229,13 +158,34 @@ namespace MonoDevelop.Ide.Gui get { return currentRunOperation; } } - public Combine CurrentOpenCombine { - get { - return openCombine; + public bool IsBuilding (IBuildTarget target) + { + return !currentBuildOperation.IsCompleted && ContainsTarget (target, currentBuildOperationOwner); + } + + public bool IsRunning (IBuildTarget target) + { + return !currentRunOperation.IsCompleted && ContainsTarget (target, currentRunOperationOwner); + } + + bool ContainsTarget (IBuildTarget owner, IBuildTarget target) + { + if (owner == target) { + return true; } - set { - openCombine = value; + else if (owner is Solution) { + foreach (IBuildTarget bt in ((Solution)owner).GetAllSolutionItems <SolutionEntityItem> ()) { + if (bt == target) + return true; + } } + else if (owner is Workspace) { + foreach (WorkspaceItem it in ((Workspace)owner).Items) { + if (ContainsTarget (it, target)) + return true; + } + } + return false; } string GetDeclaredFile(ILanguageItem item) @@ -297,295 +247,14 @@ namespace MonoDevelop.Ide.Gui else return null; } - - public void SaveCombinePreferences () - { - if (CurrentOpenCombine != null) - SaveCombinePreferences (CurrentOpenCombine); - } - - public void CloseCombine() - { - CloseCombine (true); - } - - public void CloseCombine (bool saveCombinePreferencies) - { - if (CurrentOpenCombine != null) { - if (saveCombinePreferencies) - SaveCombinePreferences (); - Combine closedCombine = CurrentOpenCombine; - CurrentSelectedProject = null; - - //stop all operations associated with this combine - if (!CurrentBuildOperation.IsCompleted) - CurrentBuildOperation.Cancel (); - if (!CurrentRunOperation.IsCompleted) - CurrentRunOperation.Cancel (); - - closedCombine.FileAddedToProject -= fileAddedToProjectHandler; - closedCombine.FileRemovedFromProject -= fileRemovedFromProjectHandler; - closedCombine.FileRenamedInProject -= fileRenamedInProjectHandler; - closedCombine.FileChangedInProject -= fileChangedInProjectHandler; - closedCombine.FilePropertyChangedInProject -= filePropertyChangedInProjectHandler; - closedCombine.ReferenceAddedToProject -= referenceAddedToProjectHandler; - closedCombine.ReferenceRemovedFromProject -= referenceRemovedFromProjectHandler; - closedCombine.EntryAddedToCombine -= entryAddedToCombineHandler; - closedCombine.EntryRemovedFromCombine -= entryRemovedFromCombineHandler; - - CurrentOpenCombine = CurrentSelectedCombine = null; - CurrentSelectedCombineEntry = null; - refactorer = null; - - Document[] docs = new Document [IdeApp.Workbench.Documents.Count]; - IdeApp.Workbench.Documents.CopyTo (docs, 0); - foreach (Document doc in docs) { - if (doc.HasProject) - doc.Close (); - } - - ParserDatabase.Unload (closedCombine); - - OnCombineClosed(new CombineEventArgs(closedCombine)); - OnEntryUnloaded (closedCombine); - closedCombine.Dispose(); - } - } - - public IAsyncOperation OpenCombine(string filename) - { - if (openCombine != null) - CloseCombine(); - - if (filename.StartsWith ("file://")) - filename = new Uri(filename).LocalPath; - - IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetLoadProgressMonitor (true); - - object[] data = new object[] { filename, monitor }; - DispatchService.BackgroundDispatch (new StatefulMessageHandler (backgroundLoadCombine), data); - return monitor.AsyncOperation; - } - - void backgroundLoadCombine (object arg) - { - object[] data = (object[]) arg; - string filename = data[0] as string; - IProgressMonitor monitor = data [1] as IProgressMonitor; - - try { - if (!File.Exists (filename)) { - monitor.ReportError (GettextCatalog.GetString ("File not found: {0}", filename), null); - monitor.Dispose (); - return; - } - - string validcombine = Path.ChangeExtension (filename, ".mds"); - if (Path.GetExtension (filename).ToLower () == ".mdp") { - if (File.Exists (validcombine)) - filename = validcombine; - } - - CombineEntry entry = projectService.ReadCombineEntry (filename, monitor); - if (monitor.IsCancelRequested) { - monitor.Dispose (); - return; - } - - if (!(entry is Combine)) { - Combine loadingCombine = new Combine(); - loadingCombine.Entries.Add (entry); - loadingCombine.Name = entry.Name; - loadingCombine.Save (validcombine, monitor); - entry = loadingCombine; - } - - openCombine = (Combine) entry; - - IdeApp.Workbench.RecentOpen.AddLastProject (filename, openCombine.Name); - - openCombine.FileAddedToProject += fileAddedToProjectHandler; - openCombine.FileRemovedFromProject += fileRemovedFromProjectHandler; - openCombine.FileRenamedInProject += fileRenamedInProjectHandler; - openCombine.FileChangedInProject += fileChangedInProjectHandler; - openCombine.FilePropertyChangedInProject += filePropertyChangedInProjectHandler; - openCombine.ReferenceAddedToProject += referenceAddedToProjectHandler; - openCombine.ReferenceRemovedFromProject += referenceRemovedFromProjectHandler; - openCombine.EntryAddedToCombine += entryAddedToCombineHandler; - openCombine.EntryRemovedFromCombine += entryRemovedFromCombineHandler; - - SearchForNewFiles (); - - ParserDatabase.Load (openCombine); - - } catch (Exception ex) { - monitor.ReportError ("Load operation failed.", ex); - monitor.Dispose (); - return; - } - - Gtk.Application.Invoke (delegate { - using (monitor) { - OnEntryLoaded (openCombine); - OnCombineOpened (new CombineEventArgs (openCombine)); - RestoreCombinePreferences (openCombine); - monitor.ReportSuccess (GettextCatalog.GetString ("Solution loaded.")); - } - }); - } - - void OnEntryLoaded (CombineEntry entry) - { - if (entry is Combine) { - foreach (CombineEntry ce in ((Combine)entry).Entries) - OnEntryLoaded (ce); - } - } - - void OnEntryUnloaded (CombineEntry entry) - { - if (entry is Combine) { - foreach (CombineEntry ce in ((Combine)entry).Entries) - OnEntryUnloaded (ce); - } - } - - bool OnRunProjectChecks () - { - // If any project has been modified, reload it - if (openCombine != null) - OnCheckProject (openCombine); - return true; - } - - void OnCheckProject (CombineEntry entry) - { - if (entry.NeedsReload) { - bool warn = false; - if (entry is Project) { - warn = HasOpenDocuments ((Project) entry, false); - } else if (entry is Combine) { - foreach (Project p in ((Combine)entry).GetAllProjects ()) { - if (HasOpenDocuments (p, false)) { - warn = true; - break; - } - } - } - - if (!warn || MessageService.Confirm (GettextCatalog.GetString ("The project '{0}' has been modified by an external application. Do you want to reload it? All project files will be closed.", entry.Name), AlertButton.Reload)) { - if (entry == openCombine) { - string file = openCombine.FileName; - CloseCombine (true); - OpenCombine (file); - } - else { - using (IProgressMonitor m = IdeApp.Workbench.ProgressMonitors.GetSaveProgressMonitor (true)) { - entry.ParentCombine.ReloadEntry (m, entry); - } - } - - if (entry is Combine) - return; - } else - entry.NeedsReload = false; - } - - if (entry is Combine) { - ArrayList ens = new ArrayList (); - foreach (CombineEntry ce in ((Combine)entry).Entries) - ens.Add (ce); - foreach (CombineEntry ce in ens) - OnCheckProject (ce); - } - } - - internal bool HasOpenDocuments (Project project, bool modifiedOnly) - { - foreach (Document doc in IdeApp.Workbench.Documents) { - if (doc.Project == project && (!modifiedOnly || doc.IsDirty)) - return true; - } - return false; - } - - void SearchForNewFiles () - { - foreach (Project p in openCombine.GetAllProjects()) { - if (p.NewFileSearch != NewFileSearch.None) - SearchNewFiles (p); - } - } - - void SearchNewFiles (Project project) - { - StringCollection newFiles = new StringCollection(); - string[] collection = Directory.GetFiles (project.BaseDirectory, "*", SearchOption.AllDirectories); - - foreach (string sfile in collection) { - string extension = Path.GetExtension(sfile).ToUpper(); - string file = Path.GetFileName (sfile); - if (!project.IsFileInProject(sfile) && - extension != ".SCC" && // source safe control files -- Svante Lidmans - extension != ".DLL" && - extension != ".PDB" && - extension != ".EXE" && - extension != ".CMBX" && - extension != ".PRJX" && - extension != ".SWP" && - extension != ".MDSX" && - extension != ".MDS" && - extension != ".MDP" && - extension != ".PIDB" && - !file.EndsWith ("make.sh") && - !file.EndsWith ("~") && - !file.StartsWith (".") && - !(Path.GetDirectoryName(sfile).IndexOf("CVS") != -1) && - !(Path.GetDirectoryName(sfile).IndexOf(".svn") != -1) && - !file.StartsWith ("Makefile") && - !Path.GetDirectoryName(file).EndsWith("ProjectDocumentation")) { - - newFiles.Add(sfile); - } - } - - if (newFiles.Count > 0) { - if (project.NewFileSearch == NewFileSearch.OnLoadAutoInsert) { - foreach (string file in newFiles) { - ProjectFile newFile = new ProjectFile(file); - newFile.BuildAction = project.IsCompileable(file) ? BuildAction.Compile : BuildAction.Nothing; - project.ProjectFiles.Add(newFile); - } - } else { - DispatchService.GuiDispatch ( - delegate (object state) { - NewFilesMessage message = (NewFilesMessage) state; - new IncludeFilesDialog (message.Project, message.NewFiles).ShowDialog (); - }, - new NewFilesMessage (project, newFiles) - ); - } - } - } - private class NewFilesMessage + public void Export (IWorkspaceObject item) { - public Project Project; - public StringCollection NewFiles; - public NewFilesMessage (Project p, StringCollection newFiles) - { - this.Project = p; - this.NewFiles = newFiles; - } + Export (item, null); } - public void Export (CombineEntry entry) - { - Export (entry, null); - } - - public void Export (CombineEntry entry, IFileFormat format) + public void Export (IWorkspaceObject entry, FileFormat format) { ExportProjectDialog dlg = new ExportProjectDialog (entry, format); try { @@ -594,7 +263,8 @@ namespace MonoDevelop.Ide.Gui using (IProgressMonitor mon = IdeApp.Workbench.ProgressMonitors.GetOutputProgressMonitor (GettextCatalog.GetString ("Export Project"), null, true, true)) { string folder = dlg.TargetFolder; - Services.ProjectService.Export (mon, entry.FileName, folder, dlg.Format); + string file = entry is WorkspaceItem ? ((WorkspaceItem)entry).FileName : ((SolutionEntityItem)entry).FileName; + Services.ProjectService.Export (mon, file, folder, dlg.Format); } } } finally { @@ -602,12 +272,12 @@ namespace MonoDevelop.Ide.Gui } } - public void SaveCombine() + public void Save (SolutionEntityItem entry) { IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetSaveProgressMonitor (true); try { - openCombine.Save (monitor); - monitor.ReportSuccess (GettextCatalog.GetString ("Solution saved.")); + entry.Save (monitor); + monitor.ReportSuccess (GettextCatalog.GetString ("Project saved.")); } catch (Exception ex) { monitor.ReportError (GettextCatalog.GetString ("Save failed."), ex); } finally { @@ -615,12 +285,12 @@ namespace MonoDevelop.Ide.Gui } } - public void SaveCombineEntry (CombineEntry entry) + public void Save (Solution item) { IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetSaveProgressMonitor (true); try { - entry.Save (monitor); - monitor.ReportSuccess (GettextCatalog.GetString ("Project saved.")); + item.Save (monitor); + monitor.ReportSuccess (GettextCatalog.GetString ("Solution saved.")); } catch (Exception ex) { monitor.ReportError (GettextCatalog.GetString ("Save failed."), ex); } finally { @@ -628,12 +298,17 @@ namespace MonoDevelop.Ide.Gui } } - public void SaveProject (Project project) + public void Save (IWorkspaceFileObject item) { + if (item is SolutionEntityItem) + Save ((SolutionEntityItem) item); + else if (item is Solution) + Save ((Solution)item); + IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetSaveProgressMonitor (true); try { - project.Save (monitor); - monitor.ReportSuccess (GettextCatalog.GetString ("Project saved.")); + item.Save (monitor); + monitor.ReportSuccess (GettextCatalog.GetString ("Item saved.")); } catch (Exception ex) { monitor.ReportError (GettextCatalog.GetString ("Save failed."), ex); } finally { @@ -643,104 +318,133 @@ namespace MonoDevelop.Ide.Gui public void MarkFileDirty (string filename) { - if (openCombine != null) { - Project entry = openCombine.GetProjectContainingFile (filename); - if (entry != null) { - entry.NeedsBuilding = true; - } + Project entry = IdeApp.Workspace.GetProjectContainingFile (filename); + if (entry != null) { + entry.SetNeedsBuilding (true); } } - - void CheckFileRemove(object sender, FileEventArgs e) - { - if (openCombine != null) - openCombine.RemoveFileFromProjects (e.FileName); - } - void CheckFileRename(object sender, FileCopyEventArgs e) - { - if (openCombine != null) - openCombine.RenameFileInProjects (e.SourceFile, e.TargetFile); - } - - public void ShowOptions (CombineEntry entry) + public void ShowOptions (IWorkspaceObject entry) { ShowOptions (entry, null); } - public void ShowOptions (CombineEntry entry, string panelId) + public void ShowOptions (IWorkspaceObject entry, string panelId) { if (entry is Project) { Project selectedProject = (Project) entry; - ExtensionNode generalOptionsNode = AddinManager.GetExtensionNode ("/MonoDevelop/ProjectModel/Gui/ProjectOptions/GeneralOptions"); - ExtensionNode configurationPropertiesNode = AddinManager.GetExtensionNode ("/MonoDevelop/ProjectModel/Gui/ProjectOptions/ConfigurationOptions"); - - using (ProjectOptionsDialog optionsDialog = new ProjectOptionsDialog (IdeApp.Workbench.RootWindow, selectedProject, generalOptionsNode, configurationPropertiesNode)) { + ProjectOptionsDialog optionsDialog = new ProjectOptionsDialog (IdeApp.Workbench.RootWindow, selectedProject); + try { if (panelId != null) optionsDialog.SelectPanel (panelId); if (optionsDialog.Run() == (int)Gtk.ResponseType.Ok) { - selectedProject.NeedsBuilding = true; - SaveProject (selectedProject); + selectedProject.SetNeedsBuilding (true); + Save (selectedProject); } + } finally { + optionsDialog.Destroy (); } - } else if (entry is Combine) { - Combine combine = (Combine) entry; - - ExtensionNode generalOptionsNode = AddinManager.GetExtensionNode ("/MonoDevelop/ProjectModel/Gui/CombineOptions/GeneralOptions"); - ExtensionNode configurationPropertiesNode = AddinManager.GetExtensionNode ("/MonoDevelop/ProjectModel/Gui/CombineOptions/ConfigurationOptions"); + } else if (entry is Solution) { + Solution solution = (Solution) entry; - using (CombineOptionsDialog optionsDialog = new CombineOptionsDialog (IdeApp.Workbench.RootWindow, combine, generalOptionsNode, configurationPropertiesNode)) { + CombineOptionsDialog optionsDialog = new CombineOptionsDialog (IdeApp.Workbench.RootWindow, solution); + try { if (panelId != null) optionsDialog.SelectPanel (panelId); if (optionsDialog.Run () == (int) Gtk.ResponseType.Ok) - SaveCombine (); + IdeApp.Workspace.Save (); + } finally { + optionsDialog.Destroy (); } } } - public void NewProject () + public void NewSolution () { - NewProjectDialog pd = new NewProjectDialog (null, true, true, null); + NewProjectDialog pd = new NewProjectDialog (null, true, null); pd.Run (); pd.Destroy (); } - public CombineEntry CreateProject (Combine parentCombine) + public WorkspaceItem AddNewWorkspaceItem (Workspace parentWorkspace) { - return CreateCombineEntry (parentCombine, false); + return AddNewWorkspaceItem (parentWorkspace, null); } - public CombineEntry CreateCombine (Combine parentCombine) + public WorkspaceItem AddNewWorkspaceItem (Workspace parentWorkspace, string defaultItemId) { - return CreateCombineEntry (parentCombine, true); + NewProjectDialog npdlg = new NewProjectDialog (null, false, parentWorkspace.BaseDirectory); + npdlg.SelectTemplate (defaultItemId); + try { + if (npdlg.Run () == (int) Gtk.ResponseType.Ok && npdlg.NewItem != null) { + parentWorkspace.Items.Add ((WorkspaceItem) npdlg.NewItem); + Save (parentWorkspace); + return (WorkspaceItem) npdlg.NewItem; + } + } finally { + npdlg.Destroy (); + } + return null; } - CombineEntry CreateCombineEntry (Combine parentCombine, bool createCombine) + public WorkspaceItem AddWorkspaceItem (Workspace parentWorkspace) { - CombineEntry res = null; - string basePath = parentCombine != null ? parentCombine.BaseDirectory : null; - NewProjectDialog npdlg = new NewProjectDialog (parentCombine, parentCombine == null, createCombine, basePath); - if (createCombine && parentCombine != null) - npdlg.SelectTemplate ("MonoDevelop.BlankSolution"); - + WorkspaceItem res = null; + + FileSelector fdiag = new FileSelector (GettextCatalog.GetString ("Add to Workspace")); + try { + fdiag.SetCurrentFolder (parentWorkspace.BaseDirectory); + fdiag.SelectMultiple = false; + if (fdiag.Run () == (int) Gtk.ResponseType.Ok) { + try { + res = AddWorkspaceItem (parentWorkspace, fdiag.Filename); + } + catch (Exception ex) { + MessageService.ShowException (ex, GettextCatalog.GetString ("The file '{0}' could not be loaded.", fdiag.Filename)); + } + } + } finally { + fdiag.Destroy (); + } + + return res; + } + + public WorkspaceItem AddWorkspaceItem (Workspace parentWorkspace, string itemFileName) + { + using (IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetLoadProgressMonitor (true)) { + WorkspaceItem it = Services.ProjectService.ReadWorkspaceItem (monitor, itemFileName); + if (it != null) { + parentWorkspace.Items.Add (it); + Save (parentWorkspace); + } + return it; + } + } + + public SolutionItem CreateProject (SolutionFolder parentFolder) + { + SolutionItem res = null; + string basePath = parentFolder != null ? parentFolder.BaseDirectory : null; + NewProjectDialog npdlg = new NewProjectDialog (parentFolder, false, basePath); npdlg.Run (); npdlg.Destroy (); return res; } - public CombineEntry AddCombineEntry (Combine parentCombine) + public SolutionItem AddSolutionItem (SolutionFolder parentFolder) { - CombineEntry res = null; + SolutionItem res = null; FileSelector fdiag = new FileSelector (GettextCatalog.GetString ("Add to Solution")); try { - fdiag.SetCurrentFolder (parentCombine.BaseDirectory); + fdiag.SetCurrentFolder (parentFolder.BaseDirectory); fdiag.SelectMultiple = false; if (fdiag.Run () == (int) Gtk.ResponseType.Ok) { try { - res = AddCombineEntry (parentCombine, fdiag.Filename); + res = AddSolutionItem (parentFolder, fdiag.Filename); } catch (Exception ex) { MessageService.ShowException (ex, GettextCatalog.GetString ("The file '{0}' could not be loaded.", fdiag.Filename)); @@ -751,20 +455,20 @@ namespace MonoDevelop.Ide.Gui } if (res != null) - SaveCombine (); + IdeApp.Workspace.Save (); return res; } - public CombineEntry AddCombineEntry (Combine combine, string entryFileName) + public SolutionItem AddSolutionItem (SolutionFolder folder, string entryFileName) { - AddEntryEventArgs args = new AddEntryEventArgs (combine, entryFileName); + AddEntryEventArgs args = new AddEntryEventArgs (folder, entryFileName); if (AddingEntryToCombine != null) AddingEntryToCombine (this, args); if (args.Cancel) return null; using (IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetLoadProgressMonitor (true)) { - return combine.AddEntry (args.FileName, monitor); + return folder.AddItem (args.FileName, monitor); } } @@ -783,7 +487,7 @@ namespace MonoDevelop.Ide.Gui } } - public bool AddReferenceToProject (Project project) + public bool AddReferenceToProject (DotNetProject project) { try { if (selDialog == null) @@ -795,16 +499,16 @@ namespace MonoDevelop.Ide.Gui ProjectReferenceCollection newRefs = selDialog.ReferenceInformations; ArrayList toDelete = new ArrayList (); - foreach (ProjectReference refInfo in project.ProjectReferences) + foreach (ProjectReference refInfo in project.References) if (!newRefs.Contains (refInfo)) toDelete.Add (refInfo); foreach (ProjectReference refInfo in toDelete) - project.ProjectReferences.Remove (refInfo); + project.References.Remove (refInfo); foreach (ProjectReference refInfo in selDialog.ReferenceInformations) - if (!project.ProjectReferences.Contains (refInfo)) - project.ProjectReferences.Add(refInfo); + if (!project.References.Contains (refInfo)) + project.References.Add(refInfo); return true; } @@ -835,183 +539,34 @@ namespace MonoDevelop.Ide.Gui selDialog.Hide (); } } - - const string UserCombinePreferencesNode = "UserCombinePreferences"; - const string VersionAttribute = "version"; - const string Version = "1.0"; - const string FilesNode = "Files"; - const string FileNode = "File"; - const string FileNameAttribute = "name"; - const string FileLineAttribute = "line"; - const string FileColumnAttribute = "column"; - const string ViewsNode = "Views"; - const string ViewMementoNode = "ViewMemento"; - const string IdAttribute = "id"; - void RestoreCombinePreferences (object data) - { - Combine combine = (Combine) data; - string preferencesFileName = GetPreferencesFileName (combine); - if (!File.Exists(preferencesFileName)) - return; - XmlTextReader reader = new XmlTextReader (preferencesFileName); - try { - bool invalid = false; - XmlReadHelper.ReadList (reader, UserCombinePreferencesNode, delegate() { - if (invalid) - return true; - switch (reader.LocalName) { - case UserCombinePreferencesNode: - if (reader.GetAttribute (VersionAttribute) != Version) - invalid = true; - return true; - case FilesNode: - XmlReadHelper.ReadList (reader, FilesNode, delegate() { - switch (reader.LocalName) { - case FileNode: - string fileName = FileService.RelativeToAbsolutePath (Path.GetDirectoryName (combine.FileName), reader.GetAttribute (FileNameAttribute)); - int lin=0, col=0; - int.TryParse (reader.GetAttribute (FileLineAttribute), out lin); - int.TryParse (reader.GetAttribute (FileColumnAttribute), out col); - if (File.Exists(fileName)) - IdeApp.Workbench.OpenDocument (fileName, lin, col, false); - return true; - } - return false; - }); - return true; - case ViewsNode: - XmlReadHelper.ReadList (reader, ViewsNode, delegate() { - switch (reader.LocalName) { - case ViewMementoNode: - string id = reader.GetAttribute (IdAttribute); - string raw = reader.ReadInnerXml (); - foreach (Pad pad in IdeApp.Workbench.Pads) { - if (id == pad.Id && pad.Content is IMementoCapable) { - IMementoCapable m = (IMementoCapable) pad.Content; - XmlReader innerReader = new XmlTextReader (new MemoryStream (System.Text.Encoding.UTF8.GetBytes (raw))); - try { - while (innerReader.Read () && innerReader.NodeType != XmlNodeType.Element) - ; - m.SetMemento ((ICustomXmlSerializer)m.CreateMemento ().ReadFrom (innerReader)); - } finally { - innerReader.Close (); - } - } - } - return true; - } - return false; - }); - return true; - case Properties.Node: - Properties properties = Properties.Read (reader); - string name = properties.Get ("ActiveWindow", ""); - Gtk.Application.Invoke (delegate { - foreach (Document document in IdeApp.Workbench.Documents) { - if (document.FileName != null && - document.FileName == name) { - DispatchService.GuiDispatch (new MessageHandler (document.Select)); - break; - } - } - }); - string cname = properties.Get ("ActiveConfiguration", ""); - IConfiguration conf = combine.GetConfiguration (cname); - if (conf != null) - combine.ActiveConfiguration = conf; - return true; - } - return true; - }); - } catch (Exception e) { - LoggingService.LogError ("Exception while loading user combine preferences.", e); - } finally { - reader.Close (); - } - } - - string GetPreferencesFileName (Combine combine) - { - return Path.Combine (Path.GetDirectoryName (combine.FileName), Path.ChangeExtension (combine.FileName, ".userprefs")); - } - void SaveCombinePreferences (Combine combine) - { - XmlTextWriter writer = new XmlTextWriter (GetPreferencesFileName (combine), System.Text.Encoding.UTF8); - writer.Formatting = Formatting.Indented; - try { - writer.WriteStartElement (UserCombinePreferencesNode); - writer.WriteAttributeString (VersionAttribute, Version); - writer.WriteAttributeString ("filename", combine.FileName); - - writer.WriteStartElement (FilesNode); - foreach (Document document in IdeApp.Workbench.Documents) { - if (!String.IsNullOrEmpty (document.FileName)) { - writer.WriteStartElement (FileNode); - writer.WriteAttributeString (FileNameAttribute, FileService.AbsoluteToRelativePath (Path.GetDirectoryName (combine.FileName), document.FileName)); - if (document.TextEditor != null) { - writer.WriteAttributeString (FileLineAttribute, document.TextEditor.CursorLine.ToString ()); - writer.WriteAttributeString (FileColumnAttribute, document.TextEditor.CursorColumn.ToString ()); - } - writer.WriteEndElement (); // File - } - } - writer.WriteEndElement (); // FilesNode - - writer.WriteStartElement (ViewsNode); - foreach (Pad pad in IdeApp.Workbench.Pads) { - if (pad.Content is IMementoCapable) { - writer.WriteStartElement (ViewMementoNode); - writer.WriteAttributeString (IdAttribute, pad.Id); - - ((ICustomXmlSerializer)((IMementoCapable)pad.Content).CreateMemento ()).WriteTo (writer); - writer.WriteEndElement (); // ViewMementoNode - } - } - writer.WriteEndElement (); // Views - - Properties properties = new Properties (); - string name = IdeApp.Workbench.ActiveDocument == null ? String.Empty : IdeApp.Workbench.ActiveDocument.FileName; - properties.Set ("ActiveWindow", name == null ? String.Empty : name); - properties.Set ("ActiveConfiguration", combine.ActiveConfiguration == null ? String.Empty : combine.ActiveConfiguration.Name); - - properties.Write (writer); - - writer.WriteEndElement (); // UserCombinePreferencesNode - } catch (Exception e) { - LoggingService.LogWarning ("Could not save solution preferences: " + GetPreferencesFileName (combine), e); - } finally { - writer.Close (); - } - } - - public IAsyncOperation Execute (CombineEntry entry) + public IAsyncOperation Execute (IBuildTarget entry) { ExecutionContext context = new ExecutionContext (new DefaultExecutionHandlerFactory (), IdeApp.Workbench.ProgressMonitors); return Execute (entry, context); } - public IAsyncOperation Execute (CombineEntry entry, ExecutionContext context) + public IAsyncOperation Execute (IBuildTarget entry, ExecutionContext context) { if (currentRunOperation != null && !currentRunOperation.IsCompleted) return currentRunOperation; IProgressMonitor monitor = new MessageDialogProgressMonitor (); - DispatchService.ThreadDispatch (new StatefulMessageHandler (ExecuteCombineEntryAsync), new object[] {entry, monitor, context}); + DispatchService.ThreadDispatch (delegate { + ExecuteSolutionItemAsync (monitor, entry, context); + }); currentRunOperation = monitor.AsyncOperation; + currentRunOperationOwner = entry; + currentRunOperation.Completed += delegate { currentRunOperationOwner = null; }; return currentRunOperation; } - void ExecuteCombineEntryAsync (object ob) + void ExecuteSolutionItemAsync (IProgressMonitor monitor, IBuildTarget entry, ExecutionContext context) { - object[] data = (object[]) ob; - CombineEntry entry = (CombineEntry) data[0]; - IProgressMonitor monitor = (IProgressMonitor) data[1]; - ExecutionContext context = (ExecutionContext) data[2]; - OnBeforeStartProject (); try { - entry.Execute (monitor, context); + OnBeforeStartProject (); + entry.Execute (monitor, context, IdeApp.Workspace.ActiveConfiguration); } catch (Exception ex) { monitor.ReportError (GettextCatalog.GetString ("Execution failed."), ex); } finally { @@ -1019,7 +574,7 @@ namespace MonoDevelop.Ide.Gui } } - public IAsyncOperation Debug (CombineEntry entry) + public IAsyncOperation Debug (IBuildTarget entry) { if (currentRunOperation != null && !currentRunOperation.IsCompleted) return currentRunOperation; @@ -1030,17 +585,16 @@ namespace MonoDevelop.Ide.Gui ExecutionContext context = new ExecutionContext (IdeApp.Services.DebuggingService.GetExecutionHandlerFactory (), IdeApp.Workbench.ProgressMonitors); DispatchService.ThreadDispatch (delegate { - DebugCombineEntryAsync (monitor, entry, context, null); + DebugSolutionItemAsync (monitor, entry, context, null); }, null); currentRunOperation = monitor.AsyncOperation; return currentRunOperation; } - void DebugCombineEntryAsync (IProgressMonitor monitor, CombineEntry entry, ExecutionContext context, WorkbenchContext oldContext) + void DebugSolutionItemAsync (IProgressMonitor monitor, IBuildTarget entry, ExecutionContext context, WorkbenchContext oldContext) { try { - Console.WriteLine ("pp: " + entry); - entry.Execute (monitor, context); + entry.Execute (monitor, context, IdeApp.Workspace.ActiveConfiguration); } catch (Exception ex) { monitor.ReportError (GettextCatalog.GetString ("Execution failed."), ex); } finally { @@ -1079,9 +633,9 @@ namespace MonoDevelop.Ide.Gui return currentRunOperation; } - public void Clean (CombineEntry entry) + public void Clean (IBuildTarget entry) { - entry.Clean (new NullProgressMonitor ()); + entry.RunTarget (new NullProgressMonitor (), ProjectService.CleanTarget, IdeApp.Workspace.ActiveConfiguration); } public IAsyncOperation BuildFile (string file) @@ -1123,7 +677,7 @@ namespace MonoDevelop.Ide.Gui } } - public IAsyncOperation Rebuild (CombineEntry entry) + public IAsyncOperation Rebuild (IBuildTarget entry) { if (currentBuildOperation != null && !currentBuildOperation.IsCompleted) return currentBuildOperation; @@ -1131,7 +685,7 @@ namespace MonoDevelop.Ide.Gui return Build (entry); } - public IAsyncOperation Build (CombineEntry entry) + public IAsyncOperation Build (IBuildTarget entry) { if (currentBuildOperation != null && !currentBuildOperation.IsCompleted) return currentBuildOperation; @@ -1140,25 +694,30 @@ namespace MonoDevelop.Ide.Gui BeginBuild (monitor); - DispatchService.ThreadDispatch (new StatefulMessageHandler (BuildCombineEntryAsync), new object[] {entry, monitor}); + DispatchService.ThreadDispatch (delegate { + BuildSolutionItemAsync (entry, monitor); + }, null); currentBuildOperation = monitor.AsyncOperation; + currentBuildOperationOwner = entry; + currentBuildOperation.Completed += delegate { currentBuildOperationOwner = null; }; return currentBuildOperation; } - void BuildCombineEntryAsync (object ob) + void BuildSolutionItemAsync (IBuildTarget entry, IProgressMonitor monitor) { - object[] data = (object[]) ob; - CombineEntry entry = (CombineEntry) data [0]; - IProgressMonitor monitor = (IProgressMonitor) data [1]; ICompilerResult result = null; try { - result = entry.Build (monitor); + SolutionItem it = entry as SolutionItem; + if (it != null) + result = it.Build (monitor, IdeApp.Workspace.ActiveConfiguration, true); + else + result = entry.RunTarget (monitor, ProjectService.BuildTarget, IdeApp.Workspace.ActiveConfiguration); } catch (Exception ex) { monitor.ReportError (GettextCatalog.GetString ("Build failed."), ex); } DispatchService.GuiDispatch ( delegate { - BuildDone (monitor, result); // BuildDone disposes the monitor + BuildDone (monitor, result, entry); // BuildDone disposes the monitor }); } @@ -1193,14 +752,19 @@ namespace MonoDevelop.Ide.Gui void BeginBuild (IProgressMonitor monitor) { Services.TaskService.ClearExceptCommentTasks (); - if (StartBuild != null) { + if (StartBuild != null) StartBuild (this, new BuildEventArgs (monitor, true)); - } } - void BuildDone (IProgressMonitor monitor, ICompilerResult result) + void BuildDone (IProgressMonitor monitor, ICompilerResult result, IBuildTarget entry) { Task[] tasks = null; + Solution solution; + + if (entry is SolutionItem) + solution = ((SolutionItem)entry).ParentSolution; + else + solution = entry as Solution; try { if (result != null) { @@ -1212,7 +776,7 @@ namespace MonoDevelop.Ide.Gui for (int n=0; n<tasks.Length; n++) tasks [n] = new Task (null, result.CompilerResults.Errors [n]); - Services.TaskService.AddRange (tasks); + Services.TaskService.AddRange (tasks, solution); string errorString = GettextCatalog.GetPluralString("{0} error", "{0} errors", result.ErrorCount, result.ErrorCount); string warningString = GettextCatalog.GetPluralString("{0} warning", "{0} warnings", result.WarningCount, result.WarningCount); @@ -1373,7 +937,7 @@ namespace MonoDevelop.Ide.Gui ICollection filesToMove; try { if (copyOnlyProjectFiles) { - filesToMove = sourceProject.ProjectFiles.GetFilesInPath (sourcePath); + filesToMove = sourceProject.Files.GetFilesInPath (sourcePath); } else { ProjectFileCollection col = new ProjectFileCollection (); GetAllFilesRecursive (sourcePath, col); @@ -1414,7 +978,7 @@ namespace MonoDevelop.Ide.Gui string sourceFile = file.Name; string newFile = targetPath + sourceFile.Substring (basePath.Length); - ProjectFile oldProjectFile = sourceProject != null ? sourceProject.ProjectFiles.GetFile (sourceFile) : null; + ProjectFile oldProjectFile = sourceProject != null ? sourceProject.Files.GetFile (sourceFile) : null; if (!movingFolder) { try { @@ -1433,12 +997,12 @@ namespace MonoDevelop.Ide.Gui } if (oldProjectFile != null) { - if (removeFromSource && sourceProject.ProjectFiles.Contains (oldProjectFile)) - sourceProject.ProjectFiles.Remove (oldProjectFile); - if (targetProject.ProjectFiles.GetFile (newFile) == null) { + if (removeFromSource && sourceProject.Files.Contains (oldProjectFile)) + sourceProject.Files.Remove (oldProjectFile); + if (targetProject.Files.GetFile (newFile) == null) { ProjectFile projectFile = (ProjectFile) oldProjectFile.Clone (); projectFile.Name = newFile; - targetProject.ProjectFiles.Add (projectFile); + targetProject.Files.Add (projectFile); } } @@ -1469,119 +1033,6 @@ namespace MonoDevelop.Ide.Gui if (!IsDirectoryHierarchyEmpty (dir)) return false; return true; } - - void NotifyFileRemovedFromProject (object sender, ProjectFileEventArgs e) - { - OnFileRemovedFromProject (e); - } - - void NotifyFileAddedToProject (object sender, ProjectFileEventArgs e) - { - OnFileAddedToProject (e); - } - - internal void NotifyFileRenamedInProject (object sender, ProjectFileRenamedEventArgs e) - { - OnFileRenamedInProject (e); - } - - internal void NotifyFileChangedInProject (object sender, ProjectFileEventArgs e) - { - OnFileChangedInProject (e); - } - - internal void NotifyFilePropertyChangedInProject (object sender, ProjectFileEventArgs e) - { - OnFilePropertyChangedInProject (e); - } - - internal void NotifyReferenceAddedToProject (object sender, ProjectReferenceEventArgs e) - { - OnReferenceAddedToProject (e); - } - - internal void NotifyReferenceRemovedFromProject (object sender, ProjectReferenceEventArgs e) - { - OnReferenceRemovedFromProject (e); - } - - void NotifyEntryAddedToCombine (object sender, CombineEntryEventArgs args) - { - OnEntryLoaded (args.CombineEntry); - if (EntryAddedToCombine != null) - EntryAddedToCombine (sender, args); - } - - void NotifyEntryRemovedFromCombine (object sender, CombineEntryEventArgs args) - { - OnEntryUnloaded (args.CombineEntry); - NotifyEntryRemovedFromCombineRec (args.CombineEntry); - } - - void NotifyEntryRemovedFromCombineRec (CombineEntry e) - { - if (e == CurrentSelectedProject) - CurrentSelectedProject = null; - - if (e == CurrentSelectedCombine) - CurrentSelectedCombine = null; - - if (e is Combine) { - foreach (CombineEntry ce in ((Combine)e).Entries) - NotifyEntryRemovedFromCombineRec (ce); - } - if (EntryRemovedFromCombine != null) - EntryRemovedFromCombine (this, new CombineEntryEventArgs (e)); - } - - protected virtual void OnFileRemovedFromProject (ProjectFileEventArgs e) - { - if (FileRemovedFromProject != null) { - FileRemovedFromProject(this, e); - } - } - - protected virtual void OnFileAddedToProject (ProjectFileEventArgs e) - { - if (FileAddedToProject != null) { - FileAddedToProject (this, e); - } - } - - protected virtual void OnFileRenamedInProject (ProjectFileRenamedEventArgs e) - { - if (FileRenamedInProject != null) { - FileRenamedInProject (this, e); - } - } - - protected virtual void OnFileChangedInProject (ProjectFileEventArgs e) - { - if (FileChangedInProject != null) { - FileChangedInProject (this, e); - } - } - - protected virtual void OnFilePropertyChangedInProject (ProjectFileEventArgs e) - { - if (FilePropertyChangedInProject != null) { - FilePropertyChangedInProject (this, e); - } - } - - protected virtual void OnReferenceRemovedFromProject (ProjectReferenceEventArgs e) - { - if (ReferenceRemovedFromProject != null) { - ReferenceRemovedFromProject (this, e); - } - } - - protected virtual void OnReferenceAddedToProject (ProjectReferenceEventArgs e) - { - if (ReferenceAddedToProject != null) { - ReferenceAddedToProject (this, e); - } - } void OnBeforeStartProject() { @@ -1597,24 +1048,24 @@ namespace MonoDevelop.Ide.Gui } } - protected virtual void OnCombineOpened(CombineEventArgs e) + void OnWorkspaceItemUnloaded (object s, WorkspaceItemEventArgs args) { - if (CombineOpened != null) { - CombineOpened(this, e); - } - } - - protected virtual void OnCombineClosed(CombineEventArgs e) - { - if (CombineClosed != null) { - CombineClosed(this, e); - } + if (ContainsTarget (args.Item, currentSolutionItem)) + CurrentSelectedSolutionItem = null; + if (ContainsTarget (args.Item, currentWorkspaceItem)) + CurrentSelectedWorkspaceItem = null; + if ((currentItem is IBuildTarget) && ContainsTarget (args.Item, ((IBuildTarget)currentItem))) + CurrentSelectedItem = null; + if (IsBuilding (args.Item)) + CurrentBuildOperation.Cancel (); + if (IsRunning (args.Item)) + CurrentRunOperation.Cancel (); } - protected virtual void OnCurrentSelectedCombineChanged(CombineEventArgs e) + protected virtual void OnCurrentSelectedSolutionChanged(SolutionEventArgs e) { - if (CurrentSelectedCombineChanged != null) { - CurrentSelectedCombineChanged(this, e); + if (CurrentSelectedSolutionChanged != null) { + CurrentSelectedSolutionChanged (this, e); } } @@ -1624,33 +1075,19 @@ namespace MonoDevelop.Ide.Gui StringParserService.Properties["PROJECTNAME"] = CurrentSelectedProject.Name; } if (CurrentProjectChanged != null) { - CurrentProjectChanged(this, e); + CurrentProjectChanged (this, e); } } - public event ProjectFileEventHandler FileRemovedFromProject; - public event ProjectFileEventHandler FileAddedToProject; - public event ProjectFileEventHandler FileChangedInProject; - public event ProjectFileEventHandler FilePropertyChangedInProject; - public event ProjectFileRenamedEventHandler FileRenamedInProject; - public event BuildEventHandler StartBuild; public event BuildEventHandler EndBuild; public event EventHandler BeforeStartProject; - public event CombineEventHandler CombineOpened; - public event CombineEventHandler CombineClosed; - public event CombineEventHandler CurrentSelectedCombineChanged; - + public event EventHandler<SolutionEventArgs> CurrentSelectedSolutionChanged; public event ProjectEventHandler CurrentProjectChanged; - public event ProjectReferenceEventHandler ReferenceAddedToProject; - public event ProjectReferenceEventHandler ReferenceRemovedFromProject; - // Fired just before an entry is added to a combine public event AddEntryEventHandler AddingEntryToCombine; - public event CombineEntryEventHandler EntryAddedToCombine; - public event CombineEntryEventHandler EntryRemovedFromCombine; // All methods inside this class are gui thread safe diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/RootWorkspace.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/RootWorkspace.cs new file mode 100644 index 0000000000..67169c684e --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/RootWorkspace.cs @@ -0,0 +1,1130 @@ +// RootWorkspace.cs +// +// Author: +// Lluis Sanchez Gual <lluis@novell.com> +// +// Copyright (c) 2008 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +// + +using System; +using System.IO; +using System.Collections; +using System.Collections.Specialized; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Xml; +using MonoDevelop.Projects; +using MonoDevelop.Core; +using MonoDevelop.Core.Gui; +using MonoDevelop.Projects.Gui; +using MonoDevelop.Projects.Serialization; +using MonoDevelop.Projects.Parser; +using MonoDevelop.Projects.CodeGeneration; +using MonoDevelop.Ide.Gui.Dialogs; + +namespace MonoDevelop.Ide.Gui +{ + public class RootWorkspace: IBuildTarget, IWorkspaceObject + { + WorkspaceItemCollection items; + IParserDatabase parserDatabase; + string activeConfiguration; + Dictionary<WorkspaceItem, PropertyBag> userPrefs; + SolutionEntityItem startupItem; + + ProjectFileEventHandler fileAddedToProjectHandler; + ProjectFileEventHandler fileRemovedFromProjectHandler; + ProjectFileRenamedEventHandler fileRenamedInProjectHandler; + ProjectFileEventHandler fileChangedInProjectHandler; + ProjectFileEventHandler filePropertyChangedInProjectHandler; + ProjectReferenceEventHandler referenceAddedToProjectHandler; + ProjectReferenceEventHandler referenceRemovedFromProjectHandler; + SolutionItemChangeEventHandler itemAddedToSolutionHandler; + SolutionItemChangeEventHandler itemRemovedFromSolutionHandler; + EventHandler<WorkspaceItemChangeEventArgs> descendantItemAddedHandler; + EventHandler<WorkspaceItemChangeEventArgs> descendantItemRemovedHandler; + EventHandler configurationsChanged; + + internal RootWorkspace () + { + fileAddedToProjectHandler = (ProjectFileEventHandler) DispatchService.GuiDispatch (new ProjectFileEventHandler (NotifyFileAddedToProject)); + fileRemovedFromProjectHandler = (ProjectFileEventHandler) DispatchService.GuiDispatch (new ProjectFileEventHandler (NotifyFileRemovedFromProject)); + fileRenamedInProjectHandler = (ProjectFileRenamedEventHandler) DispatchService.GuiDispatch (new ProjectFileRenamedEventHandler (NotifyFileRenamedInProject)); + fileChangedInProjectHandler = (ProjectFileEventHandler) DispatchService.GuiDispatch (new ProjectFileEventHandler (NotifyFileChangedInProject)); + filePropertyChangedInProjectHandler = (ProjectFileEventHandler) DispatchService.GuiDispatch (new ProjectFileEventHandler (NotifyFilePropertyChangedInProject)); + referenceAddedToProjectHandler = (ProjectReferenceEventHandler) DispatchService.GuiDispatch (new ProjectReferenceEventHandler (NotifyReferenceAddedToProject)); + referenceRemovedFromProjectHandler = (ProjectReferenceEventHandler) DispatchService.GuiDispatch (new ProjectReferenceEventHandler (NotifyReferenceRemovedFromProject)); + + itemAddedToSolutionHandler = (SolutionItemChangeEventHandler) DispatchService.GuiDispatch (new SolutionItemChangeEventHandler (NotifyItemAddedToSolution)); + itemRemovedFromSolutionHandler = (SolutionItemChangeEventHandler) DispatchService.GuiDispatch (new SolutionItemChangeEventHandler (NotifyItemRemovedFromSolution)); + + descendantItemAddedHandler = (EventHandler<WorkspaceItemChangeEventArgs>) DispatchService.GuiDispatch (new EventHandler<WorkspaceItemChangeEventArgs> (NotifyDescendantItemAdded)); + descendantItemRemovedHandler = (EventHandler<WorkspaceItemChangeEventArgs>) DispatchService.GuiDispatch (new EventHandler<WorkspaceItemChangeEventArgs> (NotifyDescendantItemRemoved)); + configurationsChanged = (EventHandler) DispatchService.GuiDispatch (new EventHandler (NotifyConfigurationsChanged)); + + FileService.FileRemoved += (EventHandler<FileEventArgs>) DispatchService.GuiDispatch (new EventHandler<FileEventArgs> (CheckFileRemove)); + FileService.FileRenamed += (EventHandler<FileCopyEventArgs>) DispatchService.GuiDispatch (new EventHandler<FileCopyEventArgs> (CheckFileRename)); + + userPrefs = new Dictionary<WorkspaceItem,PropertyBag> (); + + GLib.Timeout.Add (2000, OnRunProjectChecks); + } + + public WorkspaceItemCollection Items { + get { + if (items == null) + items = new RootWorkspaceItemCollection (this); + return items; + } + } + + public IParserDatabase ParserDatabase { + get { + if (parserDatabase == null) { + parserDatabase = Services.ParserService.CreateParserDatabase (); + parserDatabase.TrackFileChanges = true; + parserDatabase.ParseProgressMonitorFactory = new ParseProgressMonitorFactory (); + } + return parserDatabase; + } + } + + public string ActiveConfiguration { + get { + return activeConfiguration; + } + set { + if (activeConfiguration != value) { + activeConfiguration = value; + if (ActiveConfigurationChanged != null) + ActiveConfigurationChanged (this, EventArgs.Empty); + } + } + } + + public bool IsOpen { + get { return Items.Count > 0; } + } + + public CodeRefactorer GetCodeRefactorer (Solution solution) + { + CodeRefactorer refactorer = new CodeRefactorer (solution, ParserDatabase); + refactorer.TextFileProvider = new OpenDocumentFileProvider (); + return refactorer; + } + + IDictionary IExtendedDataItem.ExtendedProperties { + get { + throw new NotSupportedException ("Root namespace can't have extended properties."); + } + } + + string IWorkspaceObject.Name { + get { + return "MonoDevelop Workspace"; + } + set { + throw new NotSupportedException ("Can't change the name of the root workspace."); + } + } + + public string BaseDirectory { + get { + return IdeApp.ProjectOperations.ProjectsDefaultPath; + } + } + + public SolutionEntityItem StartupItem { + get { + return startupItem; + } + set { + startupItem = value; + if (startupItem != null) { + WorkspaceItem pit = startupItem.ParentSolution; + while (pit != null) { + pit.ExtendedProperties ["__StartupItem"] = startupItem; + pit = pit.ParentWorkspace; + } + } + if (StartupItemChanged != null) + StartupItemChanged (this, EventArgs.Empty); + } + } + + public PropertyBag GetUserPreferences (WorkspaceItem item) + { + PropertyBag props; + if (userPrefs.TryGetValue (item, out props)) + return props; + props = new PropertyBag (); + userPrefs [item] = props; + return props; + } + +#region Model queries + + public SolutionEntityItem FindSolutionItem (string fileName) + { + foreach (WorkspaceItem it in Items) { + SolutionEntityItem si = it.FindSolutionItem (fileName); + if (si != null) + return si; + } + return null; + } + + public ReadOnlyCollection<SolutionItem> GetAllSolutionItems () + { + return GetAllSolutionItems<SolutionItem> (); + } + + public virtual ReadOnlyCollection<T> GetAllSolutionItems<T> () where T: SolutionItem + { + List<T> list = new List<T> (); + foreach (WorkspaceItem it in Items) { + list.AddRange (it.GetAllSolutionItems<T> ()); + } + return list.AsReadOnly (); + } + + public ReadOnlyCollection<Project> GetAllProjects () + { + return GetAllSolutionItems<Project> (); + } + + public ReadOnlyCollection<Solution> GetAllSolutions () + { + return GetAllItems<Solution> (); + } + + public ReadOnlyCollection<T> GetAllItems<T> () where T:WorkspaceItem + { + List<T> list = new List<T> (); + foreach (WorkspaceItem it in Items) + GetAllItems<T> (list, it); + return list.AsReadOnly (); + } + + void GetAllItems<T> (List<T> list, WorkspaceItem item) where T: WorkspaceItem + { + if (item is T) + list.Add ((T) item); + + if (item is Workspace) { + foreach (WorkspaceItem citem in ((Workspace)item).Items) + GetAllItems<T> (list, citem); + } + } + + public Project GetProjectContainingFile (string fileName) + { + foreach (WorkspaceItem it in Items) { + Project p = it.GetProjectContainingFile (fileName); + if (p != null) + return p; + } + return null; + } + +#endregion + +#region Build and run operations + + public void Save () + { + IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetSaveProgressMonitor (true); + try { + Save (monitor); + monitor.ReportSuccess (GettextCatalog.GetString ("Workspace saved.")); + } catch (Exception ex) { + monitor.ReportError (GettextCatalog.GetString ("Save failed."), ex); + } finally { + monitor.Dispose (); + } + } + + public IAsyncOperation Build () + { + return IdeApp.ProjectOperations.Build (this); + } + + public void Clean () + { + IdeApp.ProjectOperations.Clean (this); + } + + public IAsyncOperation Execute () + { + return IdeApp.ProjectOperations.Execute (this); + } + + public void Dispose () + { + } + + public void Save (IProgressMonitor monitor) + { + monitor.BeginTask (GettextCatalog.GetString ("Saving Workspace..."), Items.Count); + foreach (WorkspaceItem it in Items) { + it.Save (monitor); + monitor.Step (1); + } + monitor.EndTask (); + } + + ICompilerResult IBuildTarget.RunTarget (IProgressMonitor monitor, string target, string configuration) + { + DefaultCompilerResult result = null; + foreach (WorkspaceItem it in Items) { + ICompilerResult res = it.RunTarget (monitor, target, configuration); + if (res != null) { + if (result == null) + result = new DefaultCompilerResult (); + result.Append (res); + } + } + return result; + } + + public void Execute (MonoDevelop.Core.IProgressMonitor monitor, ExecutionContext context, string configuration) + { + throw new NotImplementedException(); + } + + public bool NeedsBuilding () + { + return NeedsBuilding (IdeApp.Workspace.ActiveConfiguration) || IsDirtyFileInCombine; + } + + public bool NeedsBuilding (string configuration) + { + foreach (WorkspaceItem it in Items) { + if (it.NeedsBuilding (configuration)) + return true; + } + return false; + } + + public void SetNeedsBuilding (bool needsBuilding, string configuration) + { + foreach (WorkspaceItem it in Items) + it.SetNeedsBuilding (needsBuilding, configuration); + } + + bool IsDirtyFileInCombine { + get { + foreach (Project projectEntry in GetAllProjects()) { + foreach (ProjectFile fInfo in projectEntry.Files) { + foreach (Document doc in IdeApp.Workbench.Documents) { + if (doc.IsDirty && doc.FileName == fInfo.Name) { + return true; + } + } + } + } + return false; + } + } + + public ReadOnlyCollection<string> GetConfigurations () + { + List<string> configs = new List<string> (); + foreach (WorkspaceItem it in Items) { + foreach (string conf in it.GetConfigurations ()) { + if (!configs.Contains (conf)) + configs.Add (conf); + } + } + return configs.AsReadOnly (); + } +#endregion + +#region Opening and closing + + public void SavePreferences () + { + foreach (WorkspaceItem it in Items) + SavePreferences (it); + } + + public void Close () + { + Close (true); + } + + public void Close (bool saveWorkspacePreferencies) + { + if (Items.Count > 0) { + if (saveWorkspacePreferencies) + SavePreferences (); + + Document[] docs = new Document [IdeApp.Workbench.Documents.Count]; + IdeApp.Workbench.Documents.CopyTo (docs, 0); + foreach (Document doc in docs) { + if (doc.HasProject) + doc.Close (); + } + foreach (WorkspaceItem it in new List<WorkspaceItem> (Items)) { + try { + Items.Remove (it); + } catch (Exception ex) { + MessageService.ShowException (ex, GettextCatalog.GetString ("Could not close solution '{0}.'", it.Name)); + } + } + } + } + + public void CloseWorkspaceItem (WorkspaceItem item) + { + if (!Items.Contains (item)) + throw new InvalidOperationException ("Only top level items can be closed."); + + if (WorkspaceItemClosing != null) { + try { + WorkspaceItemClosing (this, new WorkspaceItemEventArgs (item)); + } catch (Exception ex) { + LoggingService.LogError ("Exception in WorkspaceItemClosing.", ex); + } + } + + Items.Remove (item); + } + + public IAsyncOperation OpenWorkspaceItem (string filename) + { + return OpenWorkspaceItem (filename, true); + } + + public IAsyncOperation OpenWorkspaceItem (string filename, bool closeCurrent) + { + if (closeCurrent) + Close (); + + if (filename.StartsWith ("file://")) + filename = new Uri(filename).LocalPath; + + IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetLoadProgressMonitor (true); + + object[] data = new object[] { filename, monitor }; + DispatchService.BackgroundDispatch (delegate { + BackgroundLoadWorkspace (monitor, filename); + }); + return monitor.AsyncOperation; + } + + void BackgroundLoadWorkspace (IProgressMonitor monitor, string filename) + { + WorkspaceItem item = null; + + try { + if (!File.Exists (filename)) { + monitor.ReportError (GettextCatalog.GetString ("File not found: {0}", filename), null); + monitor.Dispose (); + return; + } + + if (!Services.ProjectService.IsWorkspaceItemFile (filename)) { + if (!Services.ProjectService.IsSolutionItemFile (filename)) { + monitor.ReportError (GettextCatalog.GetString ("File is not a project or solution: {0}", filename), null); + monitor.Dispose (); + return; + } + + // It is a project, not a solution. Try to create a dummy solution and add the project to it + // First of all, check if a solution with the same name already exists + + FileFormat[] formats = Services.ProjectService.FileFormats.GetFileFormats (filename, typeof(SolutionEntityItem)); + if (formats.Length == 0) + throw new InvalidOperationException ("Unknown file format: " + filename); + + Solution tempSolution = new Solution (); + string solFileName = formats [0].GetValidFileName (tempSolution, filename); + + if (File.Exists (solFileName)) { + filename = solFileName; + } + else { + // Create a temporary solution and add the project to the solution + tempSolution.FileName = filename; + SolutionEntityItem sitem = Services.ProjectService.ReadSolutionItem (monitor, filename); + tempSolution.FileFormat = sitem.FileFormat; + tempSolution.RootFolder.Items.Add (sitem); + tempSolution.CreateDefaultConfigurations (); + tempSolution.Save (monitor); + item = tempSolution; + filename = tempSolution.FileName; + } + } + + if (item == null) { + item = Services.ProjectService.ReadWorkspaceItem (monitor, filename); + if (monitor.IsCancelRequested) { + monitor.Dispose (); + return; + } + } + + IdeApp.Workbench.RecentOpen.AddLastProject (filename, item.Name); + + Items.Add (item); + + SearchForNewFiles (); + + } catch (Exception ex) { + monitor.ReportError ("Load operation failed.", ex); + + // Don't use 'finally' to dispose the monitor, since it has to be disposed later + monitor.Dispose (); + return; + } + + Gtk.Application.Invoke (delegate { + using (monitor) { + if (Items.Count == 1) + RestoreWorkspacePreferences (item); + monitor.ReportSuccess (GettextCatalog.GetString ("Solution loaded.")); + } + }); + } + + void SearchForNewFiles () + { + foreach (Project p in GetAllProjects()) { + if (p.NewFileSearch != NewFileSearch.None) + SearchNewFiles (p); + } + } + + + void SearchNewFiles (Project project) + { + StringCollection newFiles = new StringCollection(); + string[] collection = Directory.GetFiles (project.BaseDirectory, "*", SearchOption.AllDirectories); + + foreach (string sfile in collection) { + string extension = Path.GetExtension(sfile).ToUpper(); + string file = Path.GetFileName (sfile); + + if (!project.IsFileInProject(sfile) && + extension != ".SCC" && // source safe control files -- Svante Lidmans + extension != ".DLL" && + extension != ".PDB" && + extension != ".EXE" && + extension != ".CMBX" && + extension != ".PRJX" && + extension != ".SWP" && + extension != ".MDSX" && + extension != ".MDS" && + extension != ".MDP" && + extension != ".PIDB" && + !file.EndsWith ("make.sh") && + !file.EndsWith ("~") && + !file.StartsWith (".") && + !(Path.GetDirectoryName(sfile).IndexOf("CVS") != -1) && + !(Path.GetDirectoryName(sfile).IndexOf(".svn") != -1) && + !file.StartsWith ("Makefile") && + !Path.GetDirectoryName(file).EndsWith("ProjectDocumentation")) { + + newFiles.Add(sfile); + } + } + + if (newFiles.Count > 0) { + if (project.NewFileSearch == NewFileSearch.OnLoadAutoInsert) { + foreach (string file in newFiles) { + ProjectFile newFile = new ProjectFile(file); + newFile.BuildAction = project.IsCompileable(file) ? BuildAction.Compile : BuildAction.Nothing; + project.Files.Add(newFile); + } + } else { + DispatchService.GuiDispatch ( + delegate (object state) { + NewFilesMessage message = (NewFilesMessage) state; + new IncludeFilesDialog (message.Project, message.NewFiles).ShowDialog (); + }, + new NewFilesMessage (project, newFiles) + ); + } + } + } + + private class NewFilesMessage + { + public Project Project; + public StringCollection NewFiles; + public NewFilesMessage (Project p, StringCollection newFiles) + { + this.Project = p; + this.NewFiles = newFiles; + } + } + + void RestoreWorkspacePreferences (WorkspaceItem item) + { + string preferencesFileName = GetPreferencesFileName (item); + if (!File.Exists(preferencesFileName)) + return; + + PropertyBag props = null; + XmlTextReader reader = new XmlTextReader (preferencesFileName); + try { + reader.MoveToContent (); + if (reader.LocalName != "Properties") + return; + + XmlDataSerializer ser = new XmlDataSerializer (new DataContext ()); + ser.SerializationContext.BaseFile = preferencesFileName; + props = (PropertyBag) ser.Deserialize (reader, typeof(PropertyBag)); + } catch (Exception e) { + LoggingService.LogError ("Exception while loading user solution preferences.", e); + return; + } finally { + reader.Close (); + } + + // Restore local configuration data + + try { + WorkspaceUserData data = props.GetValue<WorkspaceUserData> ("MonoDevelop.Ide.Workspace"); + if (data != null) { + ActiveConfiguration = data.ActiveConfiguration; + if (data.StartupItem != null) + StartupItem = FindSolutionItem (data.StartupItem); + } + } + catch (Exception ex) { + LoggingService.LogError ("Exception while loading user solution preferences.", ex); + } + + // Allow add-ins to restore preferences + + if (LoadingUserPreferences != null) { + UserPreferencesEventArgs args = new UserPreferencesEventArgs (item, props); + try { + LoadingUserPreferences (this, args); + } catch (Exception ex) { + LoggingService.LogError ("Exception in LoadingUserPreferences.", ex); + } + } + } + + string GetPreferencesFileName (WorkspaceItem item) + { + return Path.Combine (Path.GetDirectoryName (item.FileName), Path.ChangeExtension (item.FileName, ".userprefs")); + } + + void SavePreferences (WorkspaceItem item) + { + PropertyBag props = GetUserPreferences (item); + + // Local configuration info + + WorkspaceUserData data = new WorkspaceUserData (); + data.ActiveConfiguration = ActiveConfiguration; + + SolutionEntityItem sit = (SolutionEntityItem) item.ExtendedProperties ["__StartupItem"]; + if (sit != null) + data.StartupItem = sit.FileName; + + props.SetValue ("MonoDevelop.Ide.Workspace", data); + + // Allow add-ins to fill-up data + + if (StoringUserPreferences != null) { + UserPreferencesEventArgs args = new UserPreferencesEventArgs (item, props); + try { + StoringUserPreferences (this, args); + } catch (Exception ex) { + LoggingService.LogError ("Exception in UserPreferencesRequested.", ex); + } + } + + // Save the file + + string file = GetPreferencesFileName (item); + + if (props.IsEmpty) { + if (File.Exists (file)) + File.Delete (file); + return; + } + + XmlTextWriter writer = new XmlTextWriter (file, System.Text.Encoding.UTF8); + writer.Formatting = Formatting.Indented; + XmlDataSerializer ser = new XmlDataSerializer (new DataContext ()); + ser.SerializationContext.BaseFile = file; + + try { + ser.Serialize (writer, props, typeof(PropertyBag)); + } catch (Exception e) { + LoggingService.LogWarning ("Could not save solution preferences: " + GetPreferencesFileName (item), e); + } finally { + writer.Close (); + } + } + + bool OnRunProjectChecks () + { + // If any project has been modified, reload it + foreach (WorkspaceItem it in new List<WorkspaceItem> (Items)) + OnCheckWorkspaceItem (it); + return true; + } + + void OnCheckWorkspaceItem (WorkspaceItem item) + { + if (item.NeedsReload) { + if (AllowReload (item.GetAllProjects ())) { + if (item.ParentWorkspace == null) { + string file = item.FileName; + CloseWorkspaceItem (item); + OpenWorkspaceItem (file); + } + else { + using (IProgressMonitor m = IdeApp.Workbench.ProgressMonitors.GetSaveProgressMonitor (true)) { + item.ParentWorkspace.ReloadItem (m, item); + } + } + + return; + } else + item.NeedsReload = false; + } + + if (item is Workspace) { + Workspace ws = (Workspace) item; + List<WorkspaceItem> items = new List<WorkspaceItem> (ws.Items); + foreach (WorkspaceItem it in items) + OnCheckWorkspaceItem (it); + } + else if (item is Solution) { + Solution sol = (Solution) item; + OnCheckProject (sol.RootFolder); + } + } + + void OnCheckProject (SolutionItem entry) + { + if (entry.NeedsReload) { + IEnumerable projects = null; + if (entry is Project) { + projects = new Project [] { (Project) entry }; + } else if (entry is SolutionFolder) { + projects = ((SolutionFolder)entry).GetAllProjects (); + } + + if (AllowReload (projects)) { + using (IProgressMonitor m = IdeApp.Workbench.ProgressMonitors.GetSaveProgressMonitor (true)) { + // Root folders never need to reload + entry.ParentFolder.ReloadItem (m, entry); + } + return; + } else + entry.NeedsReload = false; + } + + if (entry is SolutionFolder) { + ArrayList ens = new ArrayList (); + foreach (SolutionItem ce in ((SolutionFolder)entry).Items) + ens.Add (ce); + foreach (SolutionItem ce in ens) + OnCheckProject (ce); + } + } + + bool AllowReload (IEnumerable projects) + { + if (projects == null) + return true; + + Project projectWarn = null; + foreach (Project p in projects) { + if (HasOpenDocuments (p, false)) { + projectWarn = p; + break; + } + } + + return (projectWarn == null || MessageService.Confirm (GettextCatalog.GetString ("The project '{0}' has been modified by an external application. Do you want to reload it? All project files will be closed.", projectWarn.Name), AlertButton.Reload)); + } + + internal bool HasOpenDocuments (Project project, bool modifiedOnly) + { + foreach (Document doc in IdeApp.Workbench.Documents) { + if (doc.Project == project && (!modifiedOnly || doc.IsDirty)) + return true; + } + return false; + } + + +#endregion + +#region Event handling + + internal void NotifyItemAdded (WorkspaceItem item) + { + if (DispatchService.IsGuiThread) + NotifyItemAddedGui (item); + else + Gtk.Application.Invoke (delegate { + NotifyItemAddedGui (item); + }); + } + + void NotifyItemAddedGui (WorkspaceItem item) + { + parserDatabase.Load (item); + + Workspace ws = item as Workspace; + if (ws != null) { + ws.DescendantItemAdded += descendantItemAddedHandler; + ws.DescendantItemRemoved += descendantItemRemovedHandler; + } + item.ConfigurationsChanged += configurationsChanged; + + WorkspaceItemEventArgs args = new WorkspaceItemEventArgs (item); + NotifyDescendantItemAdded (this, args); + NotifyConfigurationsChanged (null, args); + + if (WorkspaceItemOpened != null) + WorkspaceItemOpened (this, args); + if (Items.Count == 1 && FirstWorkspaceItemOpened != null) + FirstWorkspaceItemOpened (this, args); + } + + internal void NotifyItemRemoved (WorkspaceItem item) + { + if (DispatchService.IsGuiThread) + NotifyItemRemovedGui (item); + else + Gtk.Application.Invoke (delegate { + NotifyItemRemovedGui (item); + }); + } + + internal void NotifyItemRemovedGui (WorkspaceItem item) + { + Workspace ws = item as Workspace; + if (ws != null) { + ws.DescendantItemAdded -= descendantItemAddedHandler; + ws.DescendantItemRemoved -= descendantItemRemovedHandler; + } + item.ConfigurationsChanged -= configurationsChanged; + + if (Items.Count == 0 && LastWorkspaceItemClosed != null) + LastWorkspaceItemClosed (this, EventArgs.Empty); + + WorkspaceItemEventArgs args = new WorkspaceItemEventArgs (item); + NotifyConfigurationsChanged (null, args); + + if (WorkspaceItemClosed != null) + WorkspaceItemClosed (this, args); + + parserDatabase.Unload (item); + + NotifyDescendantItemRemoved (this, args); + } + + void SubscribeSolution (Solution sol) + { + sol.FileAddedToProject += fileAddedToProjectHandler; + sol.FileRemovedFromProject += fileRemovedFromProjectHandler; + sol.FileRenamedInProject += fileRenamedInProjectHandler; + sol.FileChangedInProject += fileChangedInProjectHandler; + sol.FilePropertyChangedInProject += filePropertyChangedInProjectHandler; + sol.ReferenceAddedToProject += referenceAddedToProjectHandler; + sol.ReferenceRemovedFromProject += referenceRemovedFromProjectHandler; + sol.SolutionItemAdded += itemAddedToSolutionHandler; + sol.SolutionItemRemoved += itemRemovedFromSolutionHandler; + } + + void UnsubscribeSolution (Solution solution) + { + solution.FileAddedToProject -= fileAddedToProjectHandler; + solution.FileRemovedFromProject -= fileRemovedFromProjectHandler; + solution.FileRenamedInProject -= fileRenamedInProjectHandler; + solution.FileChangedInProject -= fileChangedInProjectHandler; + solution.FilePropertyChangedInProject -= filePropertyChangedInProjectHandler; + solution.ReferenceAddedToProject -= referenceAddedToProjectHandler; + solution.ReferenceRemovedFromProject -= referenceRemovedFromProjectHandler; + solution.SolutionItemAdded -= itemAddedToSolutionHandler; + solution.SolutionItemRemoved -= itemRemovedFromSolutionHandler; + } + + void NotifyConfigurationsChanged (object s, EventArgs a) + { + if (ConfigurationsChanged != null) + ConfigurationsChanged (this, a); + } + + void NotifyFileRemovedFromProject (object sender, ProjectFileEventArgs e) + { + if (FileRemovedFromProject != null) { + FileRemovedFromProject(this, e); + } + } + + void NotifyFileAddedToProject (object sender, ProjectFileEventArgs e) + { + if (FileAddedToProject != null) { + FileAddedToProject (this, e); + } + } + + internal void NotifyFileRenamedInProject (object sender, ProjectFileRenamedEventArgs e) + { + if (FileRenamedInProject != null) { + FileRenamedInProject (this, e); + } + } + + internal void NotifyFileChangedInProject (object sender, ProjectFileEventArgs e) + { + if (FileChangedInProject != null) { + FileChangedInProject (this, e); + } + } + + internal void NotifyFilePropertyChangedInProject (object sender, ProjectFileEventArgs e) + { + if (FilePropertyChangedInProject != null) { + FilePropertyChangedInProject (this, e); + } + } + + internal void NotifyReferenceAddedToProject (object sender, ProjectReferenceEventArgs e) + { + if (ReferenceAddedToProject != null) { + ReferenceAddedToProject (this, e); + } + } + + internal void NotifyReferenceRemovedFromProject (object sender, ProjectReferenceEventArgs e) + { + if (ReferenceRemovedFromProject != null) { + ReferenceRemovedFromProject (this, e); + } + } + + void NotifyItemAddedToSolution (object sender, SolutionItemEventArgs args) + { + // Delay the notification of this event to ensure that the new project is properly + // registered in the parser database when it is fired + + Gtk.Application.Invoke (delegate { + if (ItemAddedToSolution != null) + ItemAddedToSolution (sender, args); + }); + } + + void NotifyItemRemovedFromSolution (object sender, SolutionItemEventArgs args) + { + NotifyItemRemovedFromSolutionRec (sender, args.SolutionItem); + } + + void NotifyItemRemovedFromSolutionRec (object sender, SolutionItem e) + { + if (e == IdeApp.ProjectOperations.CurrentSelectedSolutionItem) + IdeApp.ProjectOperations.CurrentSelectedSolutionItem = null; + if (e == startupItem) + StartupItem = null; + + if (e is SolutionFolder) { + foreach (SolutionItem ce in ((SolutionFolder)e).Items) + NotifyItemRemovedFromSolutionRec (sender, ce); + } + if (ItemRemovedFromSolution != null) + ItemRemovedFromSolution (sender, new SolutionItemEventArgs (e)); + } + + void NotifyDescendantItemAdded (object s, WorkspaceItemEventArgs args) + { + // If a top level item has been moved to a child item, remove it from + // the top + if (s != this && Items.Contains (args.Item)) + Items.Remove (args.Item); + foreach (WorkspaceItem item in args.Item.GetAllItems ()) { + if (item is Solution) + SubscribeSolution ((Solution)item); + OnItemLoaded (item); + } + } + + void NotifyDescendantItemRemoved (object s, WorkspaceItemEventArgs args) + { + foreach (WorkspaceItem item in args.Item.GetAllItems ()) { + OnItemUnloaded (item); + if (item is Solution) + UnsubscribeSolution ((Solution)item); + } + } + + void OnItemLoaded (WorkspaceItem item) + { + try { + if (WorkspaceItemLoaded != null) + WorkspaceItemLoaded (this, new WorkspaceItemEventArgs (item)); + if (item is Solution && SolutionLoaded != null) + SolutionLoaded (this, new SolutionEventArgs ((Solution)item)); + } catch (Exception ex) { + LoggingService.LogError ("Error in SolutionOpened event.", ex); + } + } + + void OnItemUnloaded (WorkspaceItem item) + { + try { + userPrefs.Remove (item); + if (WorkspaceItemUnloaded != null) + WorkspaceItemUnloaded (this, new WorkspaceItemEventArgs (item)); + if (item is Solution && SolutionUnloaded != null) + SolutionUnloaded (this, new SolutionEventArgs ((Solution)item)); + } catch (Exception ex) { + LoggingService.LogError ("Error in SolutionClosed event.", ex); + } + } + + void CheckFileRemove(object sender, FileEventArgs e) + { + foreach (Solution sol in GetAllSolutions ()) + sol.RootFolder.RemoveFileFromProjects (e.FileName); + } + + void CheckFileRename(object sender, FileCopyEventArgs e) + { + foreach (Solution sol in GetAllSolutions ()) + sol.RootFolder.RenameFileInProjects (e.SourceFile, e.TargetFile); + } + +#endregion + +#region Event declaration + + public event ProjectFileEventHandler FileRemovedFromProject; + public event ProjectFileEventHandler FileAddedToProject; + public event ProjectFileEventHandler FileChangedInProject; + public event ProjectFileEventHandler FilePropertyChangedInProject; + public event ProjectFileRenamedEventHandler FileRenamedInProject; + + public event EventHandler<SolutionEventArgs> SolutionLoaded; + public event EventHandler<SolutionEventArgs> SolutionUnloaded; + public event EventHandler<WorkspaceItemEventArgs> FirstWorkspaceItemOpened; + public event EventHandler LastWorkspaceItemClosed; + public event EventHandler<WorkspaceItemEventArgs> WorkspaceItemLoaded; + public event EventHandler<WorkspaceItemEventArgs> WorkspaceItemUnloaded; + public event EventHandler<WorkspaceItemEventArgs> WorkspaceItemOpened; + public event EventHandler<WorkspaceItemEventArgs> WorkspaceItemClosing; + public event EventHandler<WorkspaceItemEventArgs> WorkspaceItemClosed; + public event EventHandler<UserPreferencesEventArgs> StoringUserPreferences; + public event EventHandler<UserPreferencesEventArgs> LoadingUserPreferences; + + public event EventHandler<SolutionEventArgs> CurrentSelectedSolutionChanged; + + public event ProjectEventHandler CurrentProjectChanged; + + public event ProjectReferenceEventHandler ReferenceAddedToProject; + public event ProjectReferenceEventHandler ReferenceRemovedFromProject; + + // Fired just before an entry is added to a combine + public event SolutionItemEventHandler ItemAddedToSolution; + public event SolutionItemEventHandler ItemRemovedFromSolution; + + public event EventHandler ActiveConfigurationChanged; + public event EventHandler ConfigurationsChanged; + public event EventHandler StartupItemChanged; +#endregion + } + + class RootWorkspaceItemCollection: WorkspaceItemCollection + { + RootWorkspace parent; + + public RootWorkspaceItemCollection (RootWorkspace parent) + { + this.parent = parent; + } + + protected override void ClearItems () + { + if (parent != null) { + List<WorkspaceItem> items = new List<WorkspaceItem> (this); + foreach (WorkspaceItem it in items) + parent.NotifyItemRemoved (it); + } + else + base.ClearItems (); + } + + protected override void InsertItem (int index, WorkspaceItem item) + { + base.InsertItem (index, item); + if (parent != null) + parent.NotifyItemAdded (item); + } + + protected override void RemoveItem (int index) + { + WorkspaceItem item = this [index]; + base.RemoveItem (index); + if (parent != null) + parent.NotifyItemRemoved (item); + } + + protected override void SetItem (int index, WorkspaceItem item) + { + WorkspaceItem oldItem = this [index]; + base.SetItem (index, item); + if (parent != null) { + parent.NotifyItemRemoved (oldItem); + parent.NotifyItemAdded (item); + } + } + } + + public class UserPreferencesEventArgs: WorkspaceItemEventArgs + { + PropertyBag properties; + + public PropertyBag Properties { + get { + return properties; + } + } + + public UserPreferencesEventArgs (WorkspaceItem item, PropertyBag properties): base (item) + { + this.properties = properties; + } + } + + [DataItem ("Workspace")] + class WorkspaceUserData + { + [ItemProperty] + public string ActiveConfiguration; + + [ProjectPathItemProperty] + public string StartupItem; + } +} diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs index 37f3a4165a..b7a3fc975f 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs @@ -29,6 +29,7 @@ using System; using System.IO; +using System.Xml; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -77,6 +78,8 @@ namespace MonoDevelop.Ide.Gui PropertyService.PropertyChanged += new EventHandler<PropertyChangedEventArgs> (TrackPropertyChanges); FileService.FileRemoved += (EventHandler<FileEventArgs>) DispatchService.GuiDispatch (new EventHandler<FileEventArgs> (IdeApp.Workbench.RecentOpen.FileRemoved)); FileService.FileRenamed += (EventHandler<FileCopyEventArgs>) DispatchService.GuiDispatch (new EventHandler<FileCopyEventArgs> (IdeApp.Workbench.RecentOpen.FileRenamed)); + IdeApp.Workspace.StoringUserPreferences += OnStoringWorkspaceUserPreferences; + IdeApp.Workspace.LoadingUserPreferences += OnLoadingWorkspaceUserPreferences; pads = null; // Make sure we get an up to date pad list. monitor.Step (1); @@ -450,7 +453,6 @@ namespace MonoDevelop.Ide.Gui if (panelId != null) ops.SelectPanel (panelId); if (ops.Run () == (int) Gtk.ResponseType.Ok) { - Console.WriteLine ("pp saved: "); PropertyService.SaveProperties (); } ops.Destroy (); @@ -644,7 +646,7 @@ namespace MonoDevelop.Ide.Gui binding = DisplayBindings.GetBindingPerFileName(fileName); if (binding != null) { - Project project = IdeApp.ProjectOperations.CurrentOpenCombine != null ? IdeApp.ProjectOperations.CurrentOpenCombine.GetProjectContainingFile (fileName) : null; + Project project = IdeApp.Workspace.GetProjectContainingFile (fileName); LoadFileWrapper fw = new LoadFileWrapper (workbench, binding, project, oFileInfo); fw.Invoke (fileName); RecentOpen.AddLastFile (fileName, project != null ? project.Name : null); @@ -666,6 +668,80 @@ namespace MonoDevelop.Ide.Gui } } + void OnStoringWorkspaceUserPreferences (object s, UserPreferencesEventArgs args) + { + WorkbenchUserPrefs prefs = new WorkbenchUserPrefs (); + + foreach (Document document in Documents) { + if (!String.IsNullOrEmpty (document.FileName)) { + DocumentUserPrefs dp = new DocumentUserPrefs (); + dp.FileName = FileService.AbsoluteToRelativePath (args.Item.BaseDirectory, document.FileName); + if (document.TextEditor != null) { + dp.Line = document.TextEditor.CursorLine; + dp.Column = document.TextEditor.CursorColumn; + } + prefs.Files.Add (dp); + } + } + + foreach (Pad pad in Pads) { + if (pad.Content is IMementoCapable) { + ICustomXmlSerializer mem = ((IMementoCapable)pad.Content).CreateMemento (); + if (mem != null) { + PadUserPrefs data = new PadUserPrefs (); + data.Id = pad.Id; + StringWriter w = new StringWriter (); + XmlTextWriter tw = new XmlTextWriter (w); + mem.WriteTo (tw); + XmlDocument doc = new XmlDocument (); + doc.LoadXml (w.ToString ()); + data.State = doc.DocumentElement; + prefs.Pads.Add (data); + } + } + } + + if (ActiveDocument != null) + prefs.ActiveDocument = FileService.AbsoluteToRelativePath (args.Item.BaseDirectory, ActiveDocument.FileName); + + args.Properties.SetValue ("MonoDevelop.Ide.Workbench", prefs); + } + + void OnLoadingWorkspaceUserPreferences (object s, UserPreferencesEventArgs args) + { + WorkbenchUserPrefs prefs = args.Properties.GetValue<WorkbenchUserPrefs> ("MonoDevelop.Ide.Workbench"); + if (prefs == null) + return; + + Document currentDoc; + string currentFileName = prefs.ActiveDocument != null ? Path.GetFullPath (Path.Combine (args.Item.BaseDirectory, prefs.ActiveDocument)) : null; + + foreach (DocumentUserPrefs doc in prefs.Files) { + string fileName = Path.GetFullPath (Path.Combine (args.Item.BaseDirectory, doc.FileName)); + if (File.Exists (fileName)) + IdeApp.Workbench.OpenDocument (fileName, doc.Line, doc.Column, fileName == currentFileName); + } + + foreach (PadUserPrefs pi in prefs.Pads) { + foreach (Pad pad in IdeApp.Workbench.Pads) { + if (pi.Id == pad.Id && pad.Content is IMementoCapable) { + try { + string xml = pi.State.OuterXml; + IMementoCapable m = (IMementoCapable) pad.Content; + XmlReader innerReader = new XmlTextReader (new StringReader (xml)); + innerReader.MoveToContent (); + ICustomXmlSerializer cs = (ICustomXmlSerializer)m.CreateMemento (); + if (cs != null) + m.SetMemento (cs.ReadFrom (innerReader)); + } catch (Exception ex) { + LoggingService.LogError ("Error loading view memento.", ex); + } + break; + } + } + } + } + internal Document FindDocument (IWorkbenchWindow window) { foreach (Document doc in Documents) diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/WorkbenchMemento.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/WorkbenchMemento.cs index 87522628e2..6c5d062adf 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/WorkbenchMemento.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/WorkbenchMemento.cs @@ -19,10 +19,12 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA using System; +using System.Collections.Generic; using System.Drawing; using System.Xml; using MonoDevelop.Core; +using MonoDevelop.Projects.Serialization; namespace MonoDevelop.Ide.Gui { @@ -83,4 +85,43 @@ namespace MonoDevelop.Ide.Gui this.properties = properties; } } + + [DataItem ("File")] + class DocumentUserPrefs + { + [ItemProperty] + public string FileName; + + [ItemProperty (DefaultValue = 0)] + public int Line; + + [ItemProperty (DefaultValue = 0)] + public int Column; + } + + [DataItem ("Pad")] + class PadUserPrefs + { + [ItemProperty] + public string Id; + + [ItemProperty] + public XmlElement State; + } + + [DataItem ("Workbench")] + class WorkbenchUserPrefs + { + [ItemProperty] + public string ActiveConfiguration; + + [ItemProperty] + public string ActiveDocument; + + [ItemProperty] + public List<DocumentUserPrefs> Files = new List<DocumentUserPrefs> (); + + [ItemProperty] + public List<PadUserPrefs> Pads = new List<PadUserPrefs> (); + } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.StandardHeader/StandardHeaderService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.StandardHeader/StandardHeaderService.cs index eb27daa77e..4ddad57689 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.StandardHeader/StandardHeaderService.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.StandardHeader/StandardHeaderService.cs @@ -50,17 +50,6 @@ namespace MonoDevelop.Ide.StandardHeaders static List<KeyValuePair<string, string>> headerTemplates = new List<KeyValuePair<string, string>> (); static List<KeyValuePair<string, string>> customTemplates = new List<KeyValuePair<string, string>> (); - public static IEnumerable<KeyValuePair<string, string>> Templates { - get { - foreach (KeyValuePair<string, string> pair in customTemplates) { - yield return pair; - } - foreach (KeyValuePair<string, string> pair in headerTemplates) { - yield return pair; - } - } - } - public static ReadOnlyCollection<KeyValuePair<string, string>> HeaderTemplates { get { return headerTemplates.AsReadOnly (); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/CommentTasksView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/CommentTasksView.cs index 7132fd6dbe..64543e4bda 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/CommentTasksView.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/CommentTasksView.cs @@ -110,7 +110,6 @@ namespace MonoDevelop.Ide.Tasks LoadColumnsVisibility (); - Services.TaskService.TasksCleared += (EventHandler) DispatchService.GuiDispatch (new EventHandler (GeneratedTasksCleared)); Services.TaskService.TaskAdded += (TaskEventHandler) DispatchService.GuiDispatch (new TaskEventHandler (GeneratedTaskAdded)); Services.TaskService.TaskRemoved += (TaskEventHandler) DispatchService.GuiDispatch (new TaskEventHandler (GeneratedTaskRemoved)); @@ -148,12 +147,6 @@ namespace MonoDevelop.Ide.Tasks PropertyService.Set ("Monodevelop.CommentTasksColumns", columns); } - void GeneratedTasksCleared (object sender, EventArgs e) - { - store.Clear (); - tasks.Clear (); - } - void GeneratedTaskAdded (object sender, TaskEventArgs e) { foreach (Task t in e.Tasks) { diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/Task.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/Task.cs index 4ecd087dda..6bef77a124 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/Task.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/Task.cs @@ -48,6 +48,7 @@ namespace MonoDevelop.Ide.Tasks int savedLine = -1; string errorNumber; + object owner; public override string ToString () { @@ -114,10 +115,10 @@ namespace MonoDevelop.Ide.Tasks return fileName; } set { - if (System.IO.File.Exists (fileName)) + if (!string.IsNullOrEmpty (value)) fileName = System.IO.Path.GetFullPath (value); else - fileName = value; + fileName = null; } } @@ -132,6 +133,15 @@ namespace MonoDevelop.Ide.Tasks return errorNumber; } } + + public object OwnerItem { + get { + return owner; + } + internal set { + owner = value; + } + } // public Task (string fileName, string description, int column, int line) // { diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/TaskService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/TaskService.cs index 031483d606..06730ecc9a 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/TaskService.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/TaskService.cs @@ -36,23 +36,23 @@ namespace MonoDevelop.Ide.Tasks public class TaskService : GuiSyncObject { - List<Task> tasks = new List<Task> (); + Dictionary<object,List<Task>> tasks = new Dictionary<object,List<Task>> (); Dictionary<TaskType, int> taskCount = new Dictionary<TaskType, int> (); Dictionary<string, TaskPriority> priorities = new Dictionary<string, TaskPriority> (); - List<UserTask> userTasks = new List<UserTask> (); + Dictionary<object,List<UserTask>> userTasks = new Dictionary<object,List<UserTask>> (); string compilerOutput = String.Empty; - Combine combine; public TaskService () { ReloadPriories (); - IdeApp.ProjectOperations.CombineOpened += new CombineEventHandler (ProjectServiceSolutionOpened); - IdeApp.ProjectOperations.CombineClosed += new CombineEventHandler (ProjectServiceSolutionClosed); - IdeApp.ProjectOperations.FileRenamedInProject += new ProjectFileRenamedEventHandler (ProjectFileRenamed); - IdeApp.ProjectOperations.FileRemovedFromProject += new ProjectFileEventHandler (ProjectFileRemoved); + IdeApp.Workspace.WorkspaceItemLoaded += ProjectServiceSolutionOpened; + IdeApp.Workspace.WorkspaceItemUnloaded += ProjectServiceSolutionClosed; + IdeApp.Workspace.FileRenamedInProject += new ProjectFileRenamedEventHandler (ProjectFileRenamed); + IdeApp.Workspace.FileRemovedFromProject += new ProjectFileEventHandler (ProjectFileRemoved); PropertyService.PropertyChanged += (EventHandler<PropertyChangedEventArgs>) DispatchService.GuiDispatch (new EventHandler<PropertyChangedEventArgs> (OnPropertyUpdated)); + IdeApp.Workspace.ParserDatabase.CommentTasksChanged += new CommentTasksChangedEventHandler (OnCommentTasksChanged); MonoDevelop.Projects.Text.TextFileService.CommitCountChanges += delegate (object sender, MonoDevelop.Projects.Text.TextFileEventArgs args) { foreach (Task task in this.Tasks) { @@ -97,36 +97,46 @@ namespace MonoDevelop.Ide.Tasks } OnTaskChanged (new TaskEventArgs (tasks)); }; + + this.tasks [this] = new List<Task> (); } - void ProjectServiceSolutionOpened (object sender, CombineEventArgs e) + void ProjectServiceSolutionOpened (object sender, WorkspaceItemEventArgs e) { - combine = e.Combine; - IdeApp.ProjectOperations.ParserDatabase.CommentTasksChanged += new CommentTasksChangedEventHandler (OnCommentTasksChanged); + Solution sol = e.Item as Solution; + if (sol != null) { + // Load all tags that are stored in pidb files + foreach (Project p in sol.GetAllProjects ()) + { + IProjectParserContext pContext = IdeApp.Workspace.ParserDatabase.GetProjectParserContext (p); + if (pContext == null) + continue; + foreach (ProjectFile file in p.Files) + { + TagCollection tags = pContext.GetFileSpecialComments (file.Name); + if (tags !=null) + UpdateCommentTags (sol, file.Name, tags); + } + } + } + + List<UserTask> utasks = new List<UserTask> (); + userTasks [e.Item] = utasks; + + List<Task> stasks = new List<Task> (); + tasks [e.Item] = stasks; - // Load all tags that are stored in pidb files - foreach (Project p in IdeApp.ProjectOperations.CurrentOpenCombine.GetAllProjects ()) - { - IProjectParserContext pContext = IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (p); - foreach (ProjectFile file in p.ProjectFiles) - { - TagCollection tags = pContext.GetFileSpecialComments (file.Name); - if (tags !=null) - UpdateCommentTags (file.Name, tags); - } - } - // Load User Tasks from xml file - string fileToLoad = GetUserTasksFilename (e.Combine); + string fileToLoad = GetUserTasksFilename (e.Item); if (File.Exists (fileToLoad)) { try { - XmlSerializer serializer = new XmlSerializer (userTasks.GetType ()); + XmlSerializer serializer = new XmlSerializer (utasks.GetType ()); Stream stream = new FileStream (fileToLoad, FileMode.Open, FileAccess.Read, FileShare.None); - userTasks = new List<UserTask>((IEnumerable<UserTask>)serializer.Deserialize (stream)); + utasks.AddRange ((IEnumerable<UserTask>)serializer.Deserialize (stream)); stream.Close (); - if (userTasks.Count > 0 && UserTasksChanged != null) + if (utasks.Count > 0 && UserTasksChanged != null) UserTasksChanged (this, EventArgs.Empty); } catch (Exception ex) @@ -136,28 +146,36 @@ namespace MonoDevelop.Ide.Tasks } } - void ProjectServiceSolutionClosed (object sender, CombineEventArgs e)
+ void ProjectServiceSolutionClosed (object sender, WorkspaceItemEventArgs e)
{
- combine = null; - IdeApp.ProjectOperations.ParserDatabase.CommentTasksChanged -= new CommentTasksChangedEventHandler (OnCommentTasksChanged); - // Save UserTasks to xml file - string fileToSave = GetUserTasksFilename (e.Combine); + string fileToSave = GetUserTasksFilename (e.Item); try { - XmlSerializer serializer = new XmlSerializer (userTasks.GetType ()); + List<UserTask> utasks = userTasks [e.Item]; + XmlSerializer serializer = new XmlSerializer (utasks.GetType ()); Stream stream = new FileStream (fileToSave, FileMode.Create, FileAccess.Write, FileShare.None); - serializer.Serialize (stream, userTasks); + serializer.Serialize (stream, utasks); stream.Close (); } catch (Exception ex) { LoggingService.LogWarning ("Could not save user tasks: " + fileToSave, ex); } + + // Remove solution tasks + + List<Task> ttasks; + if (tasks.TryGetValue (e.Item, out ttasks)) { + tasks.Remove (e.Item); + + foreach (Task t in ttasks) + taskCount [t.TaskType]--;
+ + OnTaskRemoved (new TaskEventArgs (ttasks.ToArray ())); + } - //Cleanup - Clear (); - userTasks.Clear (); + userTasks.Remove (e.Item); if (UserTasksChanged != null) UserTasksChanged (this, EventArgs.Empty);
} @@ -167,47 +185,36 @@ namespace MonoDevelop.Ide.Tasks if (e.Key == "Monodevelop.TaskListTokens" && e.NewValue != e.OldValue) { ReloadPriories (); - if (combine != null) - { - // update priorities - foreach (Project p in IdeApp.ProjectOperations.CurrentOpenCombine.GetAllProjects ()) - { - IProjectParserContext pContext = IdeApp.ProjectOperations.ParserDatabase.GetProjectParserContext (p); - foreach (ProjectFile file in p.ProjectFiles) - { - TagCollection tags = pContext.GetFileSpecialComments (file.Name); - if (tags !=null) - UpdateCommentTags (file.Name, tags); - } - } - } + // update priorities + foreach (Project p in IdeApp.Workspace.GetAllProjects ()) + { + IProjectParserContext pContext = IdeApp.Workspace.ParserDatabase.GetProjectParserContext (p); + foreach (ProjectFile file in p.Files) + { + TagCollection tags = pContext.GetFileSpecialComments (file.Name); + if (tags !=null) + UpdateCommentTags (p.ParentSolution, file.Name, tags); + } + } } } void ProjectFileRemoved (object sender, ProjectFileEventArgs e) { - for (int i = 0; i < tasks.Count; ++i) {
- Task curTask = tasks[i]; - string fname = e.ProjectFile.Name; - // The method GetFullPath only works if the file exists - if (File.Exists (fname)) - fname = Path.GetFullPath (fname); - if (curTask.FileName == fname) {
- Remove (curTask);
- --i;
- }
+ foreach (Task curTask in new List<Task> (Tasks)) {
+ if (curTask.FileName == e.ProjectFile.FilePath) + Remove (curTask); } } void ProjectFileRenamed (object sender, ProjectFileRenamedEventArgs e) { - for (int i = 0; i < tasks.Count; ++i) {
- Task curTask = tasks[i];
- if (Path.GetFullPath (curTask.FileName) == Path.GetFullPath (e.OldName)) {
+ List<Task> ctasks = new List<Task> (Tasks); + foreach (Task curTask in ctasks) {
+ if (curTask.FileName == e.OldName) {
Remove (curTask); - curTask.FileName = Path.GetFullPath (e.NewName);
- Add (curTask);
- --i;
+ curTask.FileName = e.NewName;
+ Add (curTask, curTask.OwnerItem);
}
} } @@ -215,12 +222,27 @@ namespace MonoDevelop.Ide.Tasks [AsyncDispatch] void OnCommentTasksChanged (object sender, CommentTasksChangedEventArgs e) { - UpdateCommentTags (e.FileName, e.TagComments); + Project p = IdeApp.Workspace.GetProjectContainingFile (e.FileName); + if (p != null) + UpdateCommentTags (p.ParentSolution, e.FileName, e.TagComments); } - - string GetUserTasksFilename (Combine combine) + + public void ClearExceptCommentTasks ()
{ - string combineFilename = combine.FileName; + List<Task> tlist = new List<Task> (); + foreach (Task t in Tasks) { + if (t.TaskType != TaskType.Comment) + tlist.Add (t); + } + foreach (Task t in tlist) + InternalRemove (t); + + OnTaskRemoved (new TaskEventArgs (tlist.ToArray ())); + } + + string GetUserTasksFilename (WorkspaceItem item) + { + string combineFilename = item.FileName; string combinePath = Path.GetDirectoryName (combineFilename); string userTasksFilename = Path.Combine(combinePath, Path.GetFileNameWithoutExtension(combineFilename) + ".usertasks"); return userTasksFilename; @@ -229,36 +251,40 @@ namespace MonoDevelop.Ide.Tasks void ReloadPriories () { priorities.Clear (); - string tokens = (string)PropertyService.Get ("Monodevelop.TaskListTokens", "FIXME:2;TODO:1;HACK:1;UNDONE:0"); - foreach (string token in tokens.Split (new char[] {';'}, StringSplitOptions.RemoveEmptyEntries)) + string tokens = (string)PropertyService.Get ("Monodevelop.TaskListTokens", "FIXME:2;TODO:1;HACK:1;UNDONE:0"); + foreach (string token in tokens.Split (new char[] {';'}, StringSplitOptions.RemoveEmptyEntries)) + { + int pos = token.IndexOf (':'); + if (pos != -1) { - int pos = token.IndexOf (':'); - if (pos != -1) - { - int priority; - if (! int.TryParse (token.Substring (pos + 1), out priority)) - priority = 1; - priorities.Add (token.Substring (0, pos), (TaskPriority)priority); - } else - { - priorities.Add (token, TaskPriority.Normal); - } + int priority; + if (! int.TryParse (token.Substring (pos + 1), out priority)) + priority = 1; + priorities.Add (token.Substring (0, pos), (TaskPriority)priority); + } else + { + priorities.Add (token, TaskPriority.Normal); } + } } public int TaskCount {
- get {
- return tasks.Count - GetCount (TaskType.Comment);
+ get { + int c = 0; + foreach (List<Task> tt in tasks.Values) + c += tt.Count;
+ return c - GetCount (TaskType.Comment);
}
} public List<Task> Tasks {
get {
List<Task> retTasks = new List<Task> (); - foreach (Task task in tasks) {
- if (task.TaskType != TaskType.Comment) {
- retTasks.Add (task);
- }
+ foreach (List<Task> tt in tasks.Values) { + foreach (Task task in tt) {
+ if (task.TaskType != TaskType.Comment)
+ retTasks.Add (task);
+ } } return retTasks;
}
@@ -267,16 +293,25 @@ namespace MonoDevelop.Ide.Tasks public List<Task> CommentTasks {
get {
List<Task> retTasks = new List<Task> (); - foreach (Task task in tasks) {
- if (task.TaskType == TaskType.Comment) {
- retTasks.Add (task);
- }
+ foreach (List<Task> tt in tasks.Values) { + foreach (Task task in tt) {
+ if (task.TaskType == TaskType.Comment) {
+ retTasks.Add (task);
+ }
+ } } return retTasks;
}
} - public List<UserTask> UserTasks { get { return userTasks; } } + public List<UserTask> UserTasks { + get { + List<UserTask> retTasks = new List<UserTask> (); + foreach (List<UserTask> tt in userTasks.Values) + retTasks.AddRange (tt); + return retTasks; + } + } int GetCount (TaskType type)
{
@@ -319,73 +354,76 @@ namespace MonoDevelop.Ide.Tasks }
} - public string CompilerOutput { - get { - return compilerOutput; - } - set { - compilerOutput = value; - OnCompilerOutputChanged (null); - } + public void Add (Task task)
+ { + Add (task, this); } - public void Add (Task task)
+ public void Add (Task task, object owner)
{ + task.OwnerItem = owner; AddInternal (task);
OnTaskAdded (new TaskEventArgs (new Task[] {task}));
}
public void AddRange (IEnumerable<Task> tasks)
- {
- foreach (Task task in tasks) {
+ { + AddRange (tasks, this); + } +
+ public void AddRange (IEnumerable<Task> tasks, object owner)
+ { + foreach (Task task in tasks) { + task.OwnerItem = owner;
AddInternal (task);
}
OnTaskAdded (new TaskEventArgs (tasks));
} void AddInternal (Task task)
- {
- tasks.Add (task);
+ { + if (task.OwnerItem == null) + throw new InvalidOperationException (); + + List<Task> tlist; + if (!tasks.TryGetValue (task.OwnerItem, out tlist)) + return; + tlist.Add (task);
if (!taskCount.ContainsKey (task.TaskType)) {
taskCount[task.TaskType] = 1;
} else {
taskCount[task.TaskType]++;
- }
+ } }
- public void AddUserTasksRange (IEnumerable<UserTask> tasks) +/* public void AddUserTasksRange (IEnumerable<UserTask> tasks) { userTasks.AddRange (tasks); if (UserTasksChanged != null) UserTasksChanged (this, EventArgs.Empty); } +*/ public void Remove (Task task)
- {
- if (tasks.Contains (task)) {
- tasks.Remove (task);
- taskCount[task.TaskType]--;
+ { + if (InternalRemove (task)) OnTaskRemoved (new TaskEventArgs (new Task[] {task})); - }
} - public void Clear ()
- {
- taskCount.Clear ();
- tasks.Clear ();
- OnTasksCleared (EventArgs.Empty);
+ bool InternalRemove (Task task)
+ { + if (task.OwnerItem != null) { + List<Task> tlist; + if (tasks.TryGetValue (task.OwnerItem, out tlist) && tlist.Contains (task)) { + tlist.Remove (task);
+ taskCount[task.TaskType]--; + return true;
+ } + } + return false;
} - public void ClearExceptCommentTasks ()
- {
- List<Task> commentTasks = new List<Task> (CommentTasks);
- Clear ();
- foreach (Task t in commentTasks) {
- Add (t);
- }
- } - - public void UpdateCommentTags (string fileName, TagCollection tagComments)
+ public void UpdateCommentTags (Solution sol, string fileName, TagCollection tagComments)
{
if (fileName == null) {
return;
@@ -395,12 +433,14 @@ namespace MonoDevelop.Ide.Tasks if (tagComments != null) { foreach (MonoDevelop.Projects.Parser.Tag tag in tagComments) { if (!priorities.ContainsKey (tag.Key)) - continue;
- newTasks.Add (new Task (fileName,
+ continue; + Task t = new Task (fileName,
tag.Key + tag.CommentString,
tag.Region.BeginColumn - 1,
tag.Region.BeginLine,
- TaskType.Comment, priorities[tag.Key]));
+ TaskType.Comment, priorities[tag.Key]); + t.OwnerItem = sol; + newTasks.Add (t);
} }
List<Task> oldTasks = new List<Task> ();
@@ -428,7 +468,7 @@ namespace MonoDevelop.Ide.Tasks foreach (Task task in newTasks) {
if (task != null) {
- Add (task);
+ Add (task, sol);
}
}
@@ -451,46 +491,30 @@ namespace MonoDevelop.Ide.Tasks pad.BringToFront (); } - protected virtual void OnCompilerOutputChanged (EventArgs e) - { - if (CompilerOutputChanged != null) { - CompilerOutputChanged (this, e); - } - } - - protected virtual void OnTaskAdded (TaskEventArgs e) + protected void OnTaskAdded (TaskEventArgs e) { if (TaskAdded != null) { TaskAdded (this, e); } } - protected virtual void OnTaskRemoved (TaskEventArgs e) + protected void OnTaskRemoved (TaskEventArgs e) { if (TaskRemoved != null) { TaskRemoved (this, e); } } - protected virtual void OnTaskChanged (TaskEventArgs e) + protected void OnTaskChanged (TaskEventArgs e) { if (TaskChanged != null) { TaskChanged (this, e); } } - protected virtual void OnTasksCleared (EventArgs e) - { - if (TasksCleared != null) { - TasksCleared (this, e); - } - } - public event TaskEventHandler TaskAdded; public event TaskEventHandler TaskRemoved; public event TaskEventHandler TaskChanged; - public event EventHandler TasksCleared; - public event EventHandler CompilerOutputChanged; public event EventHandler UserTasksChanged; } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/UserTask.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/UserTask.cs index bbeee9e7f7..40c53b34c5 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/UserTask.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/UserTask.cs @@ -31,15 +31,16 @@ using System.Collections.Generic; using System.Runtime.Serialization; using System.Xml.Serialization; using MonoDevelop.Core; +using MonoDevelop.Projects; namespace MonoDevelop.Ide.Tasks { public class UserTask - { - + { TaskPriority priority = TaskPriority.Normal; bool completed = false; string description; + Solution solution; public TaskPriority Priority { @@ -58,6 +59,16 @@ namespace MonoDevelop.Ide.Tasks get { return description; } set { description = value; } } + + [System.Xml.Serialization.XmlIgnoreAttribute] + public Solution Solution { + get { + return solution; + } + internal set { + solution = value; + } + } public override string ToString () { diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/UserTasksView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/UserTasksView.cs index bfcafe77bf..01d948a35f 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/UserTasksView.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/UserTasksView.cs @@ -130,21 +130,21 @@ namespace MonoDevelop.Ide.Tasks delButton.SetTooltip (tips, GettextCatalog.GetString ("Delete Task"), GettextCatalog.GetString ("Delete Task")); Services.TaskService.UserTasksChanged += (EventHandler) DispatchService.GuiDispatch (new EventHandler (UserTasksChanged)); - IdeApp.ProjectOperations.CombineOpened += (CombineEventHandler) DispatchService.GuiDispatch (new CombineEventHandler (CombineOpened)); - IdeApp.ProjectOperations.CombineClosed += (CombineEventHandler) DispatchService.GuiDispatch (new CombineEventHandler (CombineClosed)); + IdeApp.Workspace.FirstWorkspaceItemOpened += CombineOpened; + IdeApp.Workspace.LastWorkspaceItemClosed += CombineClosed; PropertyService.PropertyChanged += (EventHandler<PropertyChangedEventArgs>) DispatchService.GuiDispatch (new EventHandler<PropertyChangedEventArgs> (OnPropertyUpdated)); ValidateButtons (); // Initialize with existing tags. UserTasksChanged (this, EventArgs.Empty); } - void CombineOpened (object sender, CombineEventArgs e) + void CombineOpened (object sender, EventArgs e) { solutionLoaded = true; ValidateButtons (); } - void CombineClosed (object sender, CombineEventArgs e) + void CombineClosed (object sender, EventArgs e) { solutionLoaded = true; ValidateButtons (); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/CombineDescriptor.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/CombineDescriptor.cs index 7885dfe0ae..ad5725a2c7 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/CombineDescriptor.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/CombineDescriptor.cs @@ -22,6 +22,7 @@ using System; using System.IO; using System.Xml; using System.Collections; +using System.Collections.Generic; using System.Collections.Specialized; using System.Diagnostics; using System.Reflection; @@ -33,7 +34,7 @@ using MonoDevelop.Core.ProgressMonitoring; namespace MonoDevelop.Ide.Templates { - internal class CombineDescriptor: ICombineEntryDescriptor + internal class CombineDescriptor { ArrayList entryDescriptors = new ArrayList(); @@ -54,29 +55,29 @@ namespace MonoDevelop.Ide.Templates this.typeName = type; } - public ICombineEntryDescriptor[] EntryDescriptors { - get { return (ICombineEntryDescriptor[]) entryDescriptors.ToArray (typeof(ICombineEntryDescriptor)); } + public ISolutionItemDescriptor[] EntryDescriptors { + get { return (ISolutionItemDescriptor[]) entryDescriptors.ToArray (typeof(ISolutionItemDescriptor)); } } - public string CreateEntry (ProjectCreateInformation projectCreateInformation, string defaultLanguage) + public WorkspaceItem CreateEntry (ProjectCreateInformation projectCreateInformation, string defaultLanguage) { - Combine newCombine; - + WorkspaceItem item; + if (typeName != null && typeName.Length > 0) { Type type = Type.GetType (typeName); - if (type == null) { + if (type == null || !typeof(WorkspaceItem).IsAssignableFrom (type)) { MessageService.ShowError (GettextCatalog.GetString ("Can't create solution with type: {0}", typeName)); - return String.Empty; + return null; } - newCombine = (Combine) Activator.CreateInstance (type); + item = (WorkspaceItem) Activator.CreateInstance (type); } else - newCombine = new Combine(); - + item = new Solution (); + string newCombineName = StringParserService.Parse(name, new string[,] { {"ProjectName", projectCreateInformation.CombineName} }); - newCombine.Name = newCombineName; + item.Name = newCombineName; string oldCombinePath = projectCreateInformation.CombinePath; string oldProjectPath = projectCreateInformation.ProjectBasePath; @@ -91,28 +92,32 @@ namespace MonoDevelop.Ide.Templates } } - // Create sub projects - foreach (ICombineEntryDescriptor entryDescriptor in entryDescriptors) { - newCombine.AddEntry (entryDescriptor.CreateEntry (projectCreateInformation, defaultLanguage), null); + Solution sol = item as Solution; + if (sol != null) { + List<string> configs = new List<string> (); + + // Create sub projects + foreach (ISolutionItemDescriptor entryDescriptor in entryDescriptors) { + SolutionItem sit = entryDescriptor.CreateEntry (projectCreateInformation, defaultLanguage); + sol.RootFolder.Items.Add (sit); + if (sit is IConfigurationTarget) { + foreach (ItemConfiguration c in ((IConfigurationTarget)sit).Configurations) { + if (!configs.Contains (c.Id)) + configs.Add (c.Id); + } + } + } + + // Create configurations + foreach (string conf in configs) + sol.AddConfiguration (conf, true); } projectCreateInformation.CombinePath = oldCombinePath; projectCreateInformation.ProjectBasePath = oldProjectPath; + item.FileName = Path.Combine (projectCreateInformation.CombinePath, newCombineName); - // Save combine - using (IProgressMonitor monitor = new NullProgressMonitor ()) { - string combineLocation = Path.Combine (projectCreateInformation.CombinePath, newCombineName + ".mds"); - if (File.Exists(combineLocation)) { - if (MessageService.Confirm (GettextCatalog.GetString ("Solution file {0} already exists, do you want to overwrite\nthe existing file?", combineLocation), AlertButton.OverwriteFile)) { - newCombine.Save (combineLocation, monitor); - } - } else { - newCombine.Save (combineLocation, monitor); - } - - newCombine.Dispose(); - return combineLocation; - } + return item; } public static CombineDescriptor CreateCombineDescriptor(XmlElement element) @@ -137,7 +142,8 @@ namespace MonoDevelop.Ide.Templates combineDescriptor.entryDescriptors.Add (CreateCombineDescriptor((XmlElement)node)); break; case "CombineEntry": - combineDescriptor.entryDescriptors.Add (CombineEntryDescriptor.CreateDescriptor((XmlElement)node)); + case "SolutionItem": + combineDescriptor.entryDescriptors.Add (SolutionItemDescriptor.CreateDescriptor((XmlElement)node)); break; } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ICombineEntryDescriptor.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ISolutionItemDescriptor.cs index 4b0c88f79f..a8f5e01f2e 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ICombineEntryDescriptor.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ISolutionItemDescriptor.cs @@ -1,5 +1,5 @@ // -// ICombineEntryDescriptor.cs +// ISolutionItemDescriptor.cs // // Author: // Lluis Sanchez Gual @@ -32,8 +32,8 @@ using MonoDevelop.Projects; namespace MonoDevelop.Ide.Templates { - internal interface ICombineEntryDescriptor + internal interface ISolutionItemDescriptor { - string CreateEntry (ProjectCreateInformation projectCreateInformation, string defaultLanguage); + SolutionEntityItem CreateEntry (ProjectCreateInformation projectCreateInformation, string defaultLanguage); } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ICombineEntryFeature.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ISolutionItemFeature.cs index fc273ec637..06ed38e1d6 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ICombineEntryFeature.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ISolutionItemFeature.cs @@ -1,4 +1,4 @@ -// ICombineEntryFeature.cs +// ISolutionItemFeature.cs // // Author: // Lluis Sanchez Gual <lluis@novell.com> @@ -34,24 +34,24 @@ using Mono.Addins; namespace MonoDevelop.Ide.Templates { - public interface ICombineEntryFeature + public interface ISolutionItemFeature { - bool SupportsCombineEntry (Combine parentCombine, CombineEntry entry); + bool SupportsSolutionItem (SolutionFolder parentCombine, SolutionItem entry); string Title { get; } string Description { get; } - Gtk.Widget CreateFeatureEditor (Combine parentCombine, CombineEntry entry); - bool IsEnabled (Combine parentCombine, CombineEntry entry); - string Validate (Combine parentCombine, CombineEntry entry, Gtk.Widget editor); - void ApplyFeature (Combine parentCombine, CombineEntry entry, Gtk.Widget editor); + Gtk.Widget CreateFeatureEditor (SolutionFolder parentCombine, SolutionItem entry); + bool IsEnabled (SolutionFolder parentCombine, SolutionItem entry); + string Validate (SolutionFolder parentCombine, SolutionItem entry, Gtk.Widget editor); + void ApplyFeature (SolutionFolder parentCombine, SolutionItem entry, Gtk.Widget editor); } - internal class CombineEntryFeatures + internal class SolutionItemFeatures { - public static ICombineEntryFeature[] GetFeatures (Combine parentCombine, CombineEntry entry) + public static ISolutionItemFeature[] GetFeatures (SolutionFolder parentCombine, SolutionItem entry) { - List<ICombineEntryFeature> list = new List<ICombineEntryFeature> (); - foreach (ICombineEntryFeature e in AddinManager.GetExtensionObjects ("/MonoDevelop/Ide/ProjectFeatures", typeof(ICombineEntryFeature), true)) { - if (e.SupportsCombineEntry (parentCombine, entry)) + List<ISolutionItemFeature> list = new List<ISolutionItemFeature> (); + foreach (ISolutionItemFeature e in AddinManager.GetExtensionObjects ("/MonoDevelop/Ide/ProjectFeatures", typeof(ISolutionItemFeature), true)) { + if (e.SupportsSolutionItem (parentCombine, entry)) list.Add (e); } return list.ToArray (); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ParentProjectFileTemplateCondition.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ParentProjectFileTemplateCondition.cs index 94f01835c9..1747b40f81 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ParentProjectFileTemplateCondition.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ParentProjectFileTemplateCondition.cs @@ -117,7 +117,7 @@ namespace MonoDevelop.Ide.Templates string requiredFile = (f[0] == '/')? Path.Combine (proj.BaseDirectory, f.Substring(1)) : Path.Combine (projectPath, f); - if (proj.ProjectFiles.GetFile (requiredFile) != null) + if (proj.Files.GetFile (requiredFile) != null) requiredFileNotFound = true; } if (requiredFileNotFound) @@ -131,7 +131,7 @@ namespace MonoDevelop.Ide.Templates string excludedFile = (f[0] == '/')? Path.Combine (proj.BaseDirectory, f.Substring(1)) : Path.Combine (projectPath, f); - if (proj.ProjectFiles.GetFile (excludedFile) != null) + if (proj.Files.GetFile (excludedFile) != null) foundExcludedFile = true; } if (foundExcludedFile) diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectDescriptor.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectDescriptor.cs index 15ed9c187b..63e2b992db 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectDescriptor.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectDescriptor.cs @@ -37,7 +37,7 @@ namespace MonoDevelop.Ide.Templates /// <summary> /// This class is used inside the combine templates for projects. /// </summary> - internal class ProjectDescriptor: ICombineEntryDescriptor + internal class ProjectDescriptor: ISolutionItemDescriptor { string name; string projectType; @@ -79,7 +79,7 @@ namespace MonoDevelop.Ide.Templates this.name = name; } - public string CreateEntry (ProjectCreateInformation projectCreateInformation, string defaultLanguage) + public SolutionEntityItem CreateEntry (ProjectCreateInformation projectCreateInformation, string defaultLanguage) { if (projectOptions.GetAttribute ("language") == "") { @@ -92,19 +92,22 @@ namespace MonoDevelop.Ide.Templates if (project == null) { MessageService.ShowError (GettextCatalog.GetString ("Can't create project with type : {0}", projectType)); - return String.Empty; + return null; } string newProjectName = StringParserService.Parse(name, new string[,] { {"ProjectName", projectCreateInformation.ProjectName} }); - project.FileName = Path.Combine (projectCreateInformation.ProjectBasePath, newProjectName + ".mdp"); + project.FileName = Path.Combine (projectCreateInformation.ProjectBasePath, newProjectName); project.Name = newProjectName; - // Add References - foreach (ProjectReference projectReference in references) { - project.ProjectReferences.Add(projectReference); + DotNetProject netProject = project as DotNetProject; + if (netProject != null) { + // Add References + foreach (ProjectReference projectReference in references) { + netProject.References.Add (projectReference); + } } foreach (FileDescriptionTemplate file in resources) { @@ -117,7 +120,7 @@ namespace MonoDevelop.Ide.Templates ProjectFile resource = new ProjectFile (fileName); resource.BuildAction = BuildAction.EmbedAsResource; - project.ProjectFiles.Add(resource); + project.Files.Add(resource); } catch (Exception ex) { MessageService.ShowException (ex, GettextCatalog.GetString ("File {0} could not be written.", file.Name)); } @@ -133,7 +136,7 @@ namespace MonoDevelop.Ide.Templates } // Save project - +/* using (IProgressMonitor monitor = new NullProgressMonitor ()) { if (File.Exists (project.FileName)) { if (MessageService.Confirm (GettextCatalog.GetString ("File already exists"), @@ -145,8 +148,8 @@ namespace MonoDevelop.Ide.Templates project.Save (monitor); } } - - return project.FileName; +*/ + return project; } public static ProjectDescriptor CreateProjectDescriptor(XmlElement element) diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectTemplate.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectTemplate.cs index 9911915090..6f6a899ad8 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectTemplate.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectTemplate.cs @@ -253,20 +253,21 @@ namespace MonoDevelop.Ide.Templates string lastCombine = null; ProjectCreateInformation projectCreateInformation; - public string CreateCombine (ProjectCreateInformation projectCreateInformation) + public WorkspaceItem CreateWorkspaceItem (ProjectCreateInformation projectCreateInformation) { this.projectCreateInformation = projectCreateInformation; - lastCombine = combineDescriptor.CreateEntry (projectCreateInformation, this.languagename); - return lastCombine; + WorkspaceItem item = combineDescriptor.CreateEntry (projectCreateInformation, this.languagename); + lastCombine = item.FileName; + return item; } - public string CreateProject (ProjectCreateInformation projectCreateInformation) + public SolutionEntityItem CreateProject (ProjectCreateInformation projectCreateInformation) { this.projectCreateInformation = projectCreateInformation; // Create a project using the first child template of the combine template - ICombineEntryDescriptor[] entries = combineDescriptor.EntryDescriptors; + ISolutionItemDescriptor[] entries = combineDescriptor.EntryDescriptors; if (entries.Length == 0) throw new InvalidOperationException ("Combine template does not contain any project template"); @@ -276,7 +277,7 @@ namespace MonoDevelop.Ide.Templates public void OpenCreatedCombine() { - IAsyncOperation op = IdeApp.ProjectOperations.OpenCombine (lastCombine); + IAsyncOperation op = IdeApp.Workspace.OpenWorkspaceItem (lastCombine); op.WaitForCompleted (); if (op.Success) { foreach (OpenFileAction action in actions) diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/CombineEntryDescriptor.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/SolutionItemDescriptor.cs index 3c3b1b4678..02987259ba 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/CombineEntryDescriptor.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/SolutionItemDescriptor.cs @@ -1,5 +1,5 @@ // -// CombineEntryDescriptor.cs +// SolutionItemDescriptor.cs // // Author: // Lluis Sanchez Gual @@ -43,14 +43,14 @@ namespace MonoDevelop.Ide.Templates /// <summary> /// This class is used inside the combine templates for projects. /// </summary> - internal class CombineEntryDescriptor: ICombineEntryDescriptor + internal class SolutionItemDescriptor: ISolutionItemDescriptor { string name; // string relativePath; string typeName; XmlElement template; - protected CombineEntryDescriptor (XmlElement element) + protected SolutionItemDescriptor (XmlElement element) { name = element.GetAttribute ("name"); // relativePath = element.GetAttribute ("directory"); @@ -58,16 +58,16 @@ namespace MonoDevelop.Ide.Templates template = element; } - public string CreateEntry (ProjectCreateInformation projectCreateInformation, string defaultLanguage) + public SolutionEntityItem CreateEntry (ProjectCreateInformation projectCreateInformation, string defaultLanguage) { Type type = Type.GetType (typeName); if (type == null) { MessageService.ShowError (GettextCatalog.GetString ("Can't create project with type : {0}", typeName)); - return String.Empty; + return null; } - CombineEntry entry = (CombineEntry) Activator.CreateInstance (type); + SolutionEntityItem entry = (SolutionEntityItem) Activator.CreateInstance (type); entry.InitializeFromTemplate (template); string newProjectName = StringParserService.Parse (name, new string[,] { @@ -75,30 +75,13 @@ namespace MonoDevelop.Ide.Templates }); entry.Name = newProjectName; - - IFileFormat[] fileFormats = Services.ProjectService.FileFormats.GetFileFormatsForObject (entry); - if (fileFormats.Length == 0) - throw new InvalidOperationException ("Can't find a file format for the type: " + type); - - string fileName = fileFormats[0].GetValidFormatName (entry, Path.Combine (projectCreateInformation.ProjectBasePath, newProjectName)); - - using (IProgressMonitor monitor = new NullProgressMonitor ()) { - if (File.Exists (fileName)) { - if (MessageService.Confirm (GettextCatalog.GetString ( - "Project file {0} already exists. Do you want to overwrite\nthe existing file?", fileName), AlertButton.OverwriteFile)) { - entry.Save (fileName, monitor); - } - } else { - entry.Save (fileName, monitor); - } - } - - return fileName; + entry.FileName = Path.Combine (projectCreateInformation.ProjectBasePath, newProjectName); + return entry; } - public static CombineEntryDescriptor CreateDescriptor (XmlElement element) + public static SolutionItemDescriptor CreateDescriptor (XmlElement element) { - return new CombineEntryDescriptor (element); + return new SolutionItemDescriptor (element); } } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/TextTemplate.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/TextTemplate.cs deleted file mode 100644 index d03cb66bc2..0000000000 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/TextTemplate.cs +++ /dev/null @@ -1,109 +0,0 @@ -// TextTemplate.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.IO; -using System.Xml; -using System.Collections; -using System.Collections.Specialized; -using System.Diagnostics; - -using MonoDevelop.Core; - -namespace MonoDevelop.Ide.Templates -{ - /// <summary> - /// This class defines and holds text templates - /// they're a bit similar than code templates, but they're - /// not inserted automaticaly - /// </summary> - internal class TextTemplate - { - public static ArrayList TextTemplates = new ArrayList(); - - string name = null; - ArrayList entries = new ArrayList(); - - public string Name { - get { - return name; - } - } - - public ArrayList Entries { - get { - return entries; - } - } - - public class Entry - { - public string Display; - public string Value; - - public Entry(XmlElement el) - { - this.Display = el.Attributes["display"].InnerText; - this.Value = el.Attributes["value"].InnerText; - } - - public override string ToString() - { - return Display; - } - } - - public TextTemplate(string filename) - { - try { - XmlDocument doc = new XmlDocument(); - doc.Load(filename); - - name = doc.DocumentElement.Attributes["name"].InnerText; - - XmlNodeList nodes = doc.DocumentElement.ChildNodes; - foreach (XmlNode entrynode in nodes) { - XmlElement entryelem = entrynode as XmlElement; - if (entryelem == null) - continue; - entries.Add(new Entry(entryelem)); - } - } catch (Exception e) { - throw new System.IO.FileLoadException("Can't load standard sidebar template file", filename, e); - } - } - - static void LoadTextTemplate(string filename) - { - TextTemplates.Add(new TextTemplate(filename)); - } - - static TextTemplate() - { - string[] files = Directory.GetFiles (Path.Combine (Path.Combine (PropertyService.DataPath, "options"), "textlib"), - "*.xml", - SearchOption.AllDirectories); - foreach (string file in files) { - LoadTextTemplate(file); - } - } - } -} - diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.addin.xml b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.addin.xml index d5dfcd873d..efe8c0a098 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.addin.xml +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.addin.xml @@ -90,11 +90,21 @@ <ExtensionNodeSet id="MonoDevelop.Components.Commands.ItemSet"/> </ExtensionPoint> - <ExtensionPoint path = "/MonoDevelop/Ide/ContextMenu/ProjectPad/Combine" name = "Solution context menu"> + <ExtensionPoint path = "/MonoDevelop/Ide/ContextMenu/ProjectPad/Workspace" name = "Workspace context menu"> + <Description>Context menu for workspaces in the solution pad.</Description> + <ExtensionNodeSet id="MonoDevelop.Components.Commands.ItemSet"/> + </ExtensionPoint> + + <ExtensionPoint path = "/MonoDevelop/Ide/ContextMenu/ProjectPad/Solution" name = "Solution context menu"> <Description>Context menu for solutions in the solution pad.</Description> <ExtensionNodeSet id="MonoDevelop.Components.Commands.ItemSet"/> </ExtensionPoint> + <ExtensionPoint path = "/MonoDevelop/Ide/ContextMenu/ProjectPad/SolutionFolder" name = "Solution folder context menu"> + <Description>Context menu for solution folders in the solution pad.</Description> + <ExtensionNodeSet id="MonoDevelop.Components.Commands.ItemSet"/> + </ExtensionPoint> + <ExtensionPoint path = "/MonoDevelop/Ide/ContextMenu/ProjectPad/ResourceFolder" name = "Resource folder context menu"> <Description>Context menu for the resource folder in the solution pad.</Description> <ExtensionNodeSet id="MonoDevelop.Components.Commands.ItemSet"/> @@ -312,6 +322,9 @@ shortcut = "Control|Shift|L" _description = "Convert the selected text to lowercase" _label = "_Lowercase Selection" /> + <Command id = "MonoDevelop.Ide.Commands.EditCommands.WordCount" + _label = "_Word Count..." + description = "Count words in a text file"/> <Command id = "MonoDevelop.Ide.Commands.EditCommands.MonodevelopPreferences" defaultHandler = "MonoDevelop.Ide.Commands.MonodevelopPreferencesHandler" _label = "Pr_eferences" @@ -342,22 +355,30 @@ _label = "_Add New Project..." _description = "Add a new project to the selected solution" icon = "md-new-project-icon" /> - <Command id = "MonoDevelop.Ide.Commands.ProjectCommands.AddNewCombine" - _label = "A_dd New Solution..." - _description = "Add a new solution to the selected solution" + <Command id = "MonoDevelop.Ide.Commands.ProjectCommands.AddNewWorkspace" + _label = "_Add New Workspace..." + _description = "Add a new child workspace to the selected workspace" + icon = "md-workspace" /> + <Command id = "MonoDevelop.Ide.Commands.ProjectCommands.AddNewSolution" + _label = "_Add New Solution..." + _description = "Add a new child workspace to the selected workspace" icon = "md-new-solution-icon" /> + <Command id = "MonoDevelop.Ide.Commands.ProjectCommands.AddSolutionFolder" + _label = "Add Solution _Folder" + _description = "Add a new solution folder to the selected solution" + icon = "md-new-folder-icon" /> <Command id = "MonoDevelop.Ide.Commands.ProjectCommands.AddProject" _description = "Add a project to the selected solution" - _label = "Add existing _Project" /> - <Command id = "MonoDevelop.Ide.Commands.ProjectCommands.AddCombine" - _description = "Add a solution to the selected solution" - _label = "Add existing _Solution" /> + _label = "Add Existing _Project" /> + <Command id = "MonoDevelop.Ide.Commands.ProjectCommands.AddItem" + _description = "Add an existing item to the selected workspace" + _label = "Add Existing _Item" /> <Command id = "MonoDevelop.Ide.Commands.ProjectCommands.RemoveFromProject" _label = "_Remove From Project" _description = "Remove an item from the project" icon = "gtk-delete" /> <Command id = "MonoDevelop.Ide.Commands.ProjectCommands.Options" - defaultHandler = "MonoDevelop.Ide.Commands.CombineEntryOptionsHandler" + defaultHandler = "MonoDevelop.Ide.Commands.SolutionItemOptionsHandler" _label = "_Options" _description = "Show options window" icon = "md-properties-icon" /> @@ -514,10 +535,15 @@ _description = "Close All Files" icon = "gtk-close" shortcut = "Control|Shift|W" /> - <Command id = "MonoDevelop.Ide.Commands.FileCommands.CloseCombine" - defaultHandler = "MonoDevelop.Ide.Commands.CloseCombineHandler" - _label = "C_lose Solution" - _description = "Close solution" + <Command id = "MonoDevelop.Ide.Commands.FileCommands.CloseWorkspace" + defaultHandler = "MonoDevelop.Ide.Commands.CloseWorkspaceHandler" + _label = "C_lose Workspace" + _description = "Close all solutions open in the current workspace" + icon = "md-close-combine-icon" /> + <Command id = "MonoDevelop.Ide.Commands.FileCommands.CloseWorkspaceItem" + defaultHandler = "MonoDevelop.Ide.Commands.CloseWorkspaceHandler" + _label = "C_lose" + _description = "Close the active solution or workspace item" icon = "md-close-combine-icon" /> <Command id = "MonoDevelop.Ide.Commands.FileCommands.ReloadFile" _label = "_Revert" @@ -994,7 +1020,34 @@ <Scheme _name = "MonoDevelop 1.0" resource="KeyBindingSchemeMonoDevelop1.xml"/> </Extension> - <Extension path = "/MonoDevelop/Ide/ContextMenu/ProjectPad/Combine"> + <Extension path = "/MonoDevelop/Ide/ContextMenu/ProjectPad/Workspace"> + <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.Build" /> + <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.Rebuild" /> + <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.Clean" /> + <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.Reload" /> + <ItemSet id = "Tools" _label = "_Tools" > + </ItemSet> + <SeparatorItem id = "RunSeparator" /> + <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.RunEntry" /> + <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.DebugEntry" /> + <SeparatorItem id = "CombineBuildGroupSeparator" /> + <ItemSet id = "CombineAddMenu" _label = "_Add" > + <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.AddNewSolution" /> + <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.AddNewWorkspace" /> + <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.AddItem" /> + </ItemSet> + <SeparatorItem id = "AddSeparator" /> + <CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.Delete" /> + <CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.Rename" /> + <CommandItem id = "MonoDevelop.Ide.Commands.FileCommands.CloseWorkspaceItem" /> + <SeparatorItem id = "FindInFilesSeparator" /> + <CommandItem id = "MonoDevelop.Ide.Commands.SearchCommands.FindInFiles" /> + <CommandItem id = "MonoDevelop.Ide.Commands.FileCommands.OpenContainingFolder" /> + <SeparatorItem id = "CombineOptionsSeparator" /> + <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.Options" /> + </Extension> + + <Extension path = "/MonoDevelop/Ide/ContextMenu/ProjectPad/Solution"> <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.Build" /> <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.Rebuild" /> <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.Clean" /> @@ -1010,20 +1063,40 @@ <SeparatorItem id = "CombineBuildGroupSeparator" /> <ItemSet id = "CombineAddMenu" _label = "_Add" > <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.AddNewProject" /> - <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.AddNewCombine" /> - <SeparatorItem id = "Separator1" /> <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.AddProject" /> - <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.AddCombine" /> + <SeparatorItem id = "Separator1" /> + <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.AddSolutionFolder" /> </ItemSet> <SeparatorItem id = "AddSeparator" /> <CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.Delete" /> <CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.Rename" /> + <CommandItem id = "MonoDevelop.Ide.Commands.FileCommands.CloseWorkspaceItem" /> <SeparatorItem id = "FindInFilesSeparator" /> <CommandItem id = "MonoDevelop.Ide.Commands.SearchCommands.FindInFiles" /> <CommandItem id = "MonoDevelop.Ide.Commands.FileCommands.OpenContainingFolder" /> <SeparatorItem id = "CombineOptionsSeparator" /> <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.Options" /> </Extension> + + <Extension path = "/MonoDevelop/Ide/ContextMenu/ProjectPad/SolutionFolder"> + <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.Build" /> + <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.Rebuild" /> + <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.Clean" /> + <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.Reload" /> + <SeparatorItem id = "CombineBuildGroupSeparator" /> + <ItemSet id = "CombineAddMenu" _label = "Add" > + <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.AddNewProject" /> + <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.AddProject" /> + <SeparatorItem id = "Separator1" /> + <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.AddSolutionFolder" /> + </ItemSet> + <SeparatorItem id = "AddSeparator" /> + <CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.Delete" /> + <CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.Rename" /> + <SeparatorItem id = "FindInFilesSeparator" /> + <CommandItem id = "MonoDevelop.Ide.Commands.SearchCommands.FindInFiles" /> + <CommandItem id = "MonoDevelop.Ide.Commands.FileCommands.OpenContainingFolder" /> + </Extension> <Extension path = "/MonoDevelop/Ide/ContextMenu/ProjectPad/ResourceFolder"> <CommandItem id = "MonoDevelop.Ide.Commands.ProjectCommands.AddResource" /> @@ -1162,7 +1235,9 @@ <SolutionPad id = "ProjectPad" defaultPlacement = "Left" _label = "Solution" icon = "md-solution" class = "MonoDevelop.Ide.Gui.Pads.ProjectPad.ProjectSolutionPad"> <PadOption id = "ShowAllFiles" _label = "Show All Files" defaultValue = "False" /> - <NodeBuilder class = "MonoDevelop.Ide.Gui.Pads.ProjectPad.CombineNodeBuilder"/> + <NodeBuilder class = "MonoDevelop.Ide.Gui.Pads.ProjectPad.WorkspaceNodeBuilder"/> + <NodeBuilder class = "MonoDevelop.Ide.Gui.Pads.ProjectPad.SolutionNodeBuilder"/> + <NodeBuilder class = "MonoDevelop.Ide.Gui.Pads.ProjectPad.SolutionFolderNodeBuilder"/> <NodeBuilder class = "MonoDevelop.Ide.Gui.Pads.ProjectPad.LinkedFilesFolderNodeBuilder"/> <NodeBuilder class = "MonoDevelop.Ide.Gui.Pads.ProjectPad.ProjectNodeBuilder"/> <NodeBuilder class = "MonoDevelop.Ide.Gui.Pads.ProjectPad.ProjectReferenceFolderNodeBuilder"/> @@ -1181,7 +1256,8 @@ <PadOption id = "GroupByAccess" _label = "Group members by access" defaultValue = "False" /> <PadOption id = "GroupByType" _label = "Group members by member type" defaultValue = "True" /> <PadOption id = "PublicApiOnly" _label = "Show public members only" defaultValue = "False" /> - + <NodeBuilder class = "MonoDevelop.Ide.Gui.Pads.ProjectPad.WorkspaceNodeBuilder"/> + <NodeBuilder class = "MonoDevelop.Ide.Gui.Pads.ClassPad.SolutionNodeBuilder"/> <NodeBuilder class = "MonoDevelop.Ide.Gui.Pads.ClassPad.CombineNodeBuilder"/> <NodeBuilder class = "MonoDevelop.Ide.Gui.Pads.ClassPad.ProjectNodeBuilder"/> <NodeBuilder class = "MonoDevelop.Ide.Gui.Pads.ClassPad.NamespaceNodeBuilder"/> @@ -1336,7 +1412,7 @@ </ItemSet> <SeparatorItem id = "ExitSeparator" /> - <CommandItem id = "MonoDevelop.Ide.Commands.FileCommands.CloseCombine" /> + <CommandItem id = "MonoDevelop.Ide.Commands.FileCommands.CloseWorkspace" /> <CommandItem id = "MonoDevelop.Ide.Commands.FileCommands.CloseFile" _label = "_Close" /> <CommandItem id = "MonoDevelop.Ide.Commands.FileCommands.Exit" /> </ItemSet> @@ -1373,6 +1449,7 @@ <CommandItem id = "MonoDevelop.Ide.Commands.TextEditorCommands.ShowCompletionWindow" /> <CommandItem id = "MonoDevelop.Ide.Commands.TextEditorCommands.ShowParameterCompletionWindow" /> <SeparatorItem id = "Separator5" /> + <CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.WordCount" /> <CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.InsertStandardHeader" /> <SeparatorItem id = "optionssep5" /> @@ -1531,7 +1608,7 @@ <Extension path = "/MonoDevelop/Ide/ProjectTemplates"> <ProjectTemplate id = "MonoDevelop.BlankSolution" resource = "BlankCombine.xpt.xml"/> -<!-- <ProjectTemplate id = "MonoDevelop.Workspace" resource = "Workspace.xpt.xml"/>--> + <ProjectTemplate id = "MonoDevelop.Workspace" resource = "Workspace.xpt.xml"/> <ProjectTemplate id = "MonoDevelop.GenericProject" resource = "GenericProject.xpt.xml"/> </Extension> diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.mdp b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.mdp index 9e257c42b2..3352fa682c 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.mdp +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.mdp @@ -58,7 +58,6 @@ <File name="MonoDevelop.Ide.Templates/FileDescriptionTemplate.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Ide.Templates/FileTemplate.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Ide.Templates/INewFileCreator.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.Ide.Templates/TextTemplate.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Ide.Templates/CombineDescriptor.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Ide.Templates/ProjectDescriptor.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Ide.Templates/ProjectTemplate.cs" subtype="Code" buildaction="Compile" /> @@ -192,8 +191,8 @@ <File name="MonoDevelop.Ide.Codons/PadCodon.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Ide.Codons/PadOptionCodon.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Ide.Codons/SolutionPadCodon.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.Ide.Templates/ICombineEntryDescriptor.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.Ide.Templates/CombineEntryDescriptor.cs" subtype="Code" buildaction="Compile" /> + <File name="MonoDevelop.Ide.Templates/ISolutionItemDescriptor.cs" subtype="Code" buildaction="Compile" /> + <File name="MonoDevelop.Ide.Templates/SolutionItemDescriptor.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Ide.Gui/ConfigurationComboBox.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Ide.Gui/IPadContainer.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Ide.CodeTemplates/TemplateCompletionDataProvider.cs" subtype="Code" buildaction="Compile" /> @@ -253,7 +252,7 @@ <File name="MonoDevelop.Ide.Commands/NavigationCommands.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Ide.Gui/NavigationHistory.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Ide.Gui.Dialogs/ExportProjectDialog.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.Ide.Templates/ICombineEntryFeature.cs" subtype="Code" buildaction="Compile" /> + <File name="MonoDevelop.Ide.Templates/ISolutionItemFeature.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Ide.Gui.Dialogs/CombineEntryFeatureSelector.cs" subtype="Code" buildaction="Compile" /> <File name="gtk-gui/objects.xml" subtype="Code" buildaction="EmbedAsResource" /> <File name="MonoDevelop.Ide.Gui/DefaultDisplayBinding.cs" subtype="Code" buildaction="Compile" /> @@ -374,6 +373,7 @@ <File name="MonoDevelop.Ide.Gui.OptionPanels/IDEStyleOptionsPanel.cs" subtype="Code" buildaction="Compile" /> <File name="gtk-gui/MonoDevelop.Ide.Gui.OptionPanels.IDEStyleOptionsPanelWidget.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Ide.Gui.Content/IZoomable.cs" subtype="Code" buildaction="Compile" /> + <File name="MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionNodeBuilder.cs" subtype="Code" buildaction="Compile" /> <File name="icons/keyboard-shortcuts-16.png" subtype="Code" buildaction="EmbedAsResource" /> <File name="icons/keyboard-shortcuts-22.png" subtype="Code" buildaction="EmbedAsResource" /> <File name="icons/text-editor-16.png" subtype="Code" buildaction="EmbedAsResource" /> @@ -382,8 +382,12 @@ <File name="icons/navigate-next-24.png" subtype="Code" buildaction="EmbedAsResource" /> <File name="icons/navigate-previous-16.png" subtype="Code" buildaction="EmbedAsResource" /> <File name="icons/navigate-previous-24.png" subtype="Code" buildaction="EmbedAsResource" /> + <File name="MonoDevelop.Ide.Gui.Pads.ClassPad/SolutionNodeBuilder.cs" subtype="Code" buildaction="Compile" /> + <File name="MonoDevelop.Ide.Gui.Pads.ProjectPad/WorkspaceNodeBuilder.cs" subtype="Code" buildaction="Compile" /> + <File name="MonoDevelop.Ide.Gui/RootWorkspace.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Ide.Dom/DomLocation.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Ide.Gui.Content/DocumentStateTracker.cs" subtype="Code" buildaction="Compile" /> + <File name="MonoDevelop.Ide.Gui/IdePreferences.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Ide.Gui.Pads.ClassBrowser/SolutionNodeBuilder.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Ide.Gui.Pads.ClassBrowser/ProjectNodeBuilder.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Ide.Gui.Pads.ClassBrowser/TypeNodeBuilder.cs" subtype="Code" buildaction="Compile" /> diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Services.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Services.cs index 22f6623283..fcc4ece7a2 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Services.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Services.cs @@ -77,7 +77,7 @@ namespace MonoDevelop.Ide get { return MonoDevelop.Projects.Services.ParserService; } } - public static IProjectService ProjectService { + public static ProjectService ProjectService { get { return MonoDevelop.Projects.Services.ProjectService; } } } diff --git a/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Gui.Dialogs.ExportProjectDialog.cs b/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Gui.Dialogs.ExportProjectDialog.cs index cc41d5b3b8..82ea15495f 100644 --- a/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Gui.Dialogs.ExportProjectDialog.cs +++ b/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Gui.Dialogs.ExportProjectDialog.cs @@ -21,10 +21,14 @@ namespace MonoDevelop.Ide.Gui.Dialogs { private MonoDevelop.Components.FolderEntry folderEntry; - private Gtk.Label label1; - private Gtk.Label label2; + private Gtk.Label label3; + + private Gtk.Label label4; + + private Gtk.Label labelNewFormat; + private Gtk.Button button51; private Gtk.Button buttonOk; @@ -42,13 +46,14 @@ namespace MonoDevelop.Ide.Gui.Dialogs { w1.Events = ((Gdk.EventMask)(256)); w1.Name = "dialog_VBox"; w1.Spacing = 6; + w1.BorderWidth = ((uint)(2)); // Container child dialog_VBox.Gtk.Box+BoxChild this.vbox2 = new Gtk.VBox(); this.vbox2.Name = "vbox2"; this.vbox2.Spacing = 12; this.vbox2.BorderWidth = ((uint)(6)); // Container child vbox2.Gtk.Box+BoxChild - this.table1 = new Gtk.Table(((uint)(2)), ((uint)(2)), false); + this.table1 = new Gtk.Table(((uint)(3)), ((uint)(2)), false); this.table1.Name = "table1"; this.table1.RowSpacing = ((uint)(6)); this.table1.ColumnSpacing = ((uint)(6)); @@ -57,6 +62,8 @@ namespace MonoDevelop.Ide.Gui.Dialogs { this.comboFormat.Name = "comboFormat"; this.table1.Add(this.comboFormat); Gtk.Table.TableChild w2 = ((Gtk.Table.TableChild)(this.table1[this.comboFormat])); + w2.TopAttach = ((uint)(1)); + w2.BottomAttach = ((uint)(2)); w2.LeftAttach = ((uint)(1)); w2.RightAttach = ((uint)(2)); w2.YOptions = ((Gtk.AttachOptions)(4)); @@ -65,48 +72,70 @@ namespace MonoDevelop.Ide.Gui.Dialogs { this.folderEntry.Name = "folderEntry"; this.table1.Add(this.folderEntry); Gtk.Table.TableChild w3 = ((Gtk.Table.TableChild)(this.table1[this.folderEntry])); - w3.TopAttach = ((uint)(1)); - w3.BottomAttach = ((uint)(2)); + w3.TopAttach = ((uint)(2)); + w3.BottomAttach = ((uint)(3)); w3.LeftAttach = ((uint)(1)); w3.RightAttach = ((uint)(2)); w3.XOptions = ((Gtk.AttachOptions)(4)); w3.YOptions = ((Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild - this.label1 = new Gtk.Label(); - this.label1.Name = "label1"; - this.label1.Xalign = 0F; - this.label1.LabelProp = Mono.Unix.Catalog.GetString("File format:"); - this.table1.Add(this.label1); - Gtk.Table.TableChild w4 = ((Gtk.Table.TableChild)(this.table1[this.label1])); - w4.XOptions = ((Gtk.AttachOptions)(4)); - w4.YOptions = ((Gtk.AttachOptions)(4)); - // Container child table1.Gtk.Table+TableChild this.label2 = new Gtk.Label(); this.label2.Name = "label2"; this.label2.Xalign = 0F; this.label2.LabelProp = Mono.Unix.Catalog.GetString("Target folder:"); this.table1.Add(this.label2); - Gtk.Table.TableChild w5 = ((Gtk.Table.TableChild)(this.table1[this.label2])); + Gtk.Table.TableChild w4 = ((Gtk.Table.TableChild)(this.table1[this.label2])); + w4.TopAttach = ((uint)(2)); + w4.BottomAttach = ((uint)(3)); + w4.XOptions = ((Gtk.AttachOptions)(4)); + w4.YOptions = ((Gtk.AttachOptions)(4)); + // Container child table1.Gtk.Table+TableChild + this.label3 = new Gtk.Label(); + this.label3.Name = "label3"; + this.label3.Xalign = 0F; + this.label3.LabelProp = Mono.Unix.Catalog.GetString("New format:"); + this.table1.Add(this.label3); + Gtk.Table.TableChild w5 = ((Gtk.Table.TableChild)(this.table1[this.label3])); w5.TopAttach = ((uint)(1)); w5.BottomAttach = ((uint)(2)); w5.XOptions = ((Gtk.AttachOptions)(4)); w5.YOptions = ((Gtk.AttachOptions)(4)); + // Container child table1.Gtk.Table+TableChild + this.label4 = new Gtk.Label(); + this.label4.Name = "label4"; + this.label4.Xalign = 0F; + this.label4.LabelProp = Mono.Unix.Catalog.GetString("Current format:"); + this.table1.Add(this.label4); + Gtk.Table.TableChild w6 = ((Gtk.Table.TableChild)(this.table1[this.label4])); + w6.XOptions = ((Gtk.AttachOptions)(4)); + w6.YOptions = ((Gtk.AttachOptions)(4)); + // Container child table1.Gtk.Table+TableChild + this.labelNewFormat = new Gtk.Label(); + this.labelNewFormat.Name = "labelNewFormat"; + this.labelNewFormat.Xalign = 0F; + this.labelNewFormat.LabelProp = ""; + this.table1.Add(this.labelNewFormat); + Gtk.Table.TableChild w7 = ((Gtk.Table.TableChild)(this.table1[this.labelNewFormat])); + w7.LeftAttach = ((uint)(1)); + w7.RightAttach = ((uint)(2)); + w7.XOptions = ((Gtk.AttachOptions)(4)); + w7.YOptions = ((Gtk.AttachOptions)(4)); this.vbox2.Add(this.table1); - Gtk.Box.BoxChild w6 = ((Gtk.Box.BoxChild)(this.vbox2[this.table1])); - w6.Position = 0; - w6.Expand = false; - w6.Fill = false; + Gtk.Box.BoxChild w8 = ((Gtk.Box.BoxChild)(this.vbox2[this.table1])); + w8.Position = 0; + w8.Expand = false; + w8.Fill = false; w1.Add(this.vbox2); - Gtk.Box.BoxChild w7 = ((Gtk.Box.BoxChild)(w1[this.vbox2])); - w7.Position = 0; - w7.Expand = false; - w7.Fill = false; + Gtk.Box.BoxChild w9 = ((Gtk.Box.BoxChild)(w1[this.vbox2])); + w9.Position = 0; + w9.Expand = false; + w9.Fill = false; // Internal child MonoDevelop.Ide.Gui.Dialogs.ExportProjectDialog.ActionArea - Gtk.HButtonBox w8 = this.ActionArea; - w8.Name = "MonoDevelop.Ide.ExportProjectDialog_ActionArea"; - w8.Spacing = 10; - w8.BorderWidth = ((uint)(5)); - w8.LayoutStyle = ((Gtk.ButtonBoxStyle)(4)); + Gtk.HButtonBox w10 = this.ActionArea; + w10.Name = "MonoDevelop.Ide.ExportProjectDialog_ActionArea"; + w10.Spacing = 6; + w10.BorderWidth = ((uint)(5)); + w10.LayoutStyle = ((Gtk.ButtonBoxStyle)(4)); // Container child MonoDevelop.Ide.ExportProjectDialog_ActionArea.Gtk.ButtonBox+ButtonBoxChild this.button51 = new Gtk.Button(); this.button51.CanDefault = true; @@ -116,9 +145,9 @@ namespace MonoDevelop.Ide.Gui.Dialogs { this.button51.UseUnderline = true; this.button51.Label = "gtk-cancel"; this.AddActionWidget(this.button51, -6); - Gtk.ButtonBox.ButtonBoxChild w9 = ((Gtk.ButtonBox.ButtonBoxChild)(w8[this.button51])); - w9.Expand = false; - w9.Fill = false; + Gtk.ButtonBox.ButtonBoxChild w11 = ((Gtk.ButtonBox.ButtonBoxChild)(w10[this.button51])); + w11.Expand = false; + w11.Fill = false; // Container child MonoDevelop.Ide.ExportProjectDialog_ActionArea.Gtk.ButtonBox+ButtonBoxChild this.buttonOk = new Gtk.Button(); this.buttonOk.CanDefault = true; @@ -128,15 +157,15 @@ namespace MonoDevelop.Ide.Gui.Dialogs { this.buttonOk.UseUnderline = true; this.buttonOk.Label = "gtk-ok"; this.AddActionWidget(this.buttonOk, -5); - Gtk.ButtonBox.ButtonBoxChild w10 = ((Gtk.ButtonBox.ButtonBoxChild)(w8[this.buttonOk])); - w10.Position = 1; - w10.Expand = false; - w10.Fill = false; + Gtk.ButtonBox.ButtonBoxChild w12 = ((Gtk.ButtonBox.ButtonBoxChild)(w10[this.buttonOk])); + w12.Position = 1; + w12.Expand = false; + w12.Fill = false; if ((this.Child != null)) { this.Child.ShowAll(); } this.DefaultWidth = 509; - this.DefaultHeight = 167; + this.DefaultHeight = 195; this.Show(); this.folderEntry.PathChanged += new System.EventHandler(this.OnFolderEntryPathChanged); } diff --git a/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Gui.OptionPanels.LoadSavePanelWidget.cs b/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Gui.OptionPanels.LoadSavePanelWidget.cs index af97d2e084..02c9eeac8f 100644 --- a/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Gui.OptionPanels.LoadSavePanelWidget.cs +++ b/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Gui.OptionPanels.LoadSavePanelWidget.cs @@ -17,6 +17,12 @@ namespace MonoDevelop.Ide.Gui.OptionPanels { private Gtk.VBox vbox26; + private Gtk.Label label1; + + private Gtk.HBox hbox1; + + private Gtk.ComboBox comboFileFormats; + private Gtk.Label locationLabel; private MonoDevelop.Components.FolderEntry folderEntry; @@ -63,6 +69,33 @@ namespace MonoDevelop.Ide.Gui.OptionPanels { this.vbox26.Name = "vbox26"; this.vbox26.Spacing = 6; // Container child vbox26.Gtk.Box+BoxChild + this.label1 = new Gtk.Label(); + this.label1.Name = "label1"; + this.label1.Xalign = 0F; + this.label1.LabelProp = Mono.Unix.Catalog.GetString("Project file format to use when creating new projects:"); + this.vbox26.Add(this.label1); + Gtk.Box.BoxChild w1 = ((Gtk.Box.BoxChild)(this.vbox26[this.label1])); + w1.Position = 0; + w1.Expand = false; + w1.Fill = false; + // Container child vbox26.Gtk.Box+BoxChild + this.hbox1 = new Gtk.HBox(); + this.hbox1.Name = "hbox1"; + this.hbox1.Spacing = 6; + // Container child hbox1.Gtk.Box+BoxChild + this.comboFileFormats = Gtk.ComboBox.NewText(); + this.comboFileFormats.Name = "comboFileFormats"; + this.hbox1.Add(this.comboFileFormats); + Gtk.Box.BoxChild w2 = ((Gtk.Box.BoxChild)(this.hbox1[this.comboFileFormats])); + w2.Position = 0; + w2.Expand = false; + w2.Fill = false; + this.vbox26.Add(this.hbox1); + Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.vbox26[this.hbox1])); + w3.Position = 1; + w3.Expand = false; + w3.Fill = false; + // Container child vbox26.Gtk.Box+BoxChild this.locationLabel = new Gtk.Label(); this.locationLabel.Name = "locationLabel"; this.locationLabel.Xalign = 0F; @@ -70,22 +103,22 @@ namespace MonoDevelop.Ide.Gui.OptionPanels { this.locationLabel.LabelProp = Mono.Unix.Catalog.GetString("Default _Solution location"); this.locationLabel.UseUnderline = true; this.vbox26.Add(this.locationLabel); - Gtk.Box.BoxChild w1 = ((Gtk.Box.BoxChild)(this.vbox26[this.locationLabel])); - w1.Position = 0; - w1.Expand = false; - w1.Fill = false; + Gtk.Box.BoxChild w4 = ((Gtk.Box.BoxChild)(this.vbox26[this.locationLabel])); + w4.Position = 2; + w4.Expand = false; + w4.Fill = false; // Container child vbox26.Gtk.Box+BoxChild this.folderEntry = new MonoDevelop.Components.FolderEntry(); this.folderEntry.Name = "folderEntry"; this.vbox26.Add(this.folderEntry); - Gtk.Box.BoxChild w2 = ((Gtk.Box.BoxChild)(this.vbox26[this.folderEntry])); - w2.Position = 1; - w2.Expand = false; - w2.Fill = false; + Gtk.Box.BoxChild w5 = ((Gtk.Box.BoxChild)(this.vbox26[this.folderEntry])); + w5.Position = 3; + w5.Expand = false; + w5.Fill = false; this.vbox17.Add(this.vbox26); - Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.vbox17[this.vbox26])); - w3.Position = 0; - w3.Expand = false; + Gtk.Box.BoxChild w6 = ((Gtk.Box.BoxChild)(this.vbox17[this.vbox26])); + w6.Position = 0; + w6.Expand = false; // Container child vbox17.Gtk.Box+BoxChild this.vbox18 = new Gtk.VBox(); this.vbox18.Name = "vbox18"; @@ -98,10 +131,10 @@ namespace MonoDevelop.Ide.Gui.OptionPanels { this.loadLabel.LabelProp = Mono.Unix.Catalog.GetString("<b>Load</b>"); this.loadLabel.UseMarkup = true; this.vbox18.Add(this.loadLabel); - Gtk.Box.BoxChild w4 = ((Gtk.Box.BoxChild)(this.vbox18[this.loadLabel])); - w4.Position = 0; - w4.Expand = false; - w4.Fill = false; + Gtk.Box.BoxChild w7 = ((Gtk.Box.BoxChild)(this.vbox18[this.loadLabel])); + w7.Position = 0; + w7.Expand = false; + w7.Fill = false; // Container child vbox18.Gtk.Box+BoxChild this.hbox14 = new Gtk.HBox(); this.hbox14.Name = "hbox14"; @@ -113,10 +146,10 @@ namespace MonoDevelop.Ide.Gui.OptionPanels { this.label25.Yalign = 0F; this.label25.LabelProp = " "; this.hbox14.Add(this.label25); - Gtk.Box.BoxChild w5 = ((Gtk.Box.BoxChild)(this.hbox14[this.label25])); - w5.Position = 0; - w5.Expand = false; - w5.Fill = false; + Gtk.Box.BoxChild w8 = ((Gtk.Box.BoxChild)(this.hbox14[this.label25])); + w8.Position = 0; + w8.Expand = false; + w8.Fill = false; // Container child hbox14.Gtk.Box+BoxChild this.hbox10 = new Gtk.HBox(); this.hbox10.Name = "hbox10"; @@ -132,10 +165,10 @@ namespace MonoDevelop.Ide.Gui.OptionPanels { this.loadUserDataCheckButton.DrawIndicator = true; this.loadUserDataCheckButton.UseUnderline = true; this.vbox65.Add(this.loadUserDataCheckButton); - Gtk.Box.BoxChild w6 = ((Gtk.Box.BoxChild)(this.vbox65[this.loadUserDataCheckButton])); - w6.Position = 0; - w6.Expand = false; - w6.Fill = false; + Gtk.Box.BoxChild w9 = ((Gtk.Box.BoxChild)(this.vbox65[this.loadUserDataCheckButton])); + w9.Position = 0; + w9.Expand = false; + w9.Fill = false; // Container child vbox65.Gtk.Box+BoxChild this.loadPrevProjectCheckButton = new Gtk.CheckButton(); this.loadPrevProjectCheckButton.Name = "loadPrevProjectCheckButton"; @@ -143,25 +176,25 @@ namespace MonoDevelop.Ide.Gui.OptionPanels { this.loadPrevProjectCheckButton.DrawIndicator = true; this.loadPrevProjectCheckButton.UseUnderline = true; this.vbox65.Add(this.loadPrevProjectCheckButton); - Gtk.Box.BoxChild w7 = ((Gtk.Box.BoxChild)(this.vbox65[this.loadPrevProjectCheckButton])); - w7.Position = 1; - w7.Expand = false; - w7.Fill = false; + Gtk.Box.BoxChild w10 = ((Gtk.Box.BoxChild)(this.vbox65[this.loadPrevProjectCheckButton])); + w10.Position = 1; + w10.Expand = false; + w10.Fill = false; this.hbox10.Add(this.vbox65); - Gtk.Box.BoxChild w8 = ((Gtk.Box.BoxChild)(this.hbox10[this.vbox65])); - w8.Position = 0; - w8.Expand = false; - w8.Fill = false; + Gtk.Box.BoxChild w11 = ((Gtk.Box.BoxChild)(this.hbox10[this.vbox65])); + w11.Position = 0; + w11.Expand = false; + w11.Fill = false; this.hbox14.Add(this.hbox10); - Gtk.Box.BoxChild w9 = ((Gtk.Box.BoxChild)(this.hbox14[this.hbox10])); - w9.Position = 1; + Gtk.Box.BoxChild w12 = ((Gtk.Box.BoxChild)(this.hbox14[this.hbox10])); + w12.Position = 1; this.vbox18.Add(this.hbox14); - Gtk.Box.BoxChild w10 = ((Gtk.Box.BoxChild)(this.vbox18[this.hbox14])); - w10.Position = 1; + Gtk.Box.BoxChild w13 = ((Gtk.Box.BoxChild)(this.vbox18[this.hbox14])); + w13.Position = 1; this.vbox17.Add(this.vbox18); - Gtk.Box.BoxChild w11 = ((Gtk.Box.BoxChild)(this.vbox17[this.vbox18])); - w11.Position = 1; - w11.Expand = false; + Gtk.Box.BoxChild w14 = ((Gtk.Box.BoxChild)(this.vbox17[this.vbox18])); + w14.Position = 1; + w14.Expand = false; // Container child vbox17.Gtk.Box+BoxChild this.vbox19 = new Gtk.VBox(); this.vbox19.Name = "vbox19"; @@ -174,10 +207,10 @@ namespace MonoDevelop.Ide.Gui.OptionPanels { this.saveLabel.LabelProp = Mono.Unix.Catalog.GetString("<b>Save</b>"); this.saveLabel.UseMarkup = true; this.vbox19.Add(this.saveLabel); - Gtk.Box.BoxChild w12 = ((Gtk.Box.BoxChild)(this.vbox19[this.saveLabel])); - w12.Position = 0; - w12.Expand = false; - w12.Fill = false; + Gtk.Box.BoxChild w15 = ((Gtk.Box.BoxChild)(this.vbox19[this.saveLabel])); + w15.Position = 0; + w15.Expand = false; + w15.Fill = false; // Container child vbox19.Gtk.Box+BoxChild this.hbox11 = new Gtk.HBox(); this.hbox11.Name = "hbox11"; @@ -189,10 +222,10 @@ namespace MonoDevelop.Ide.Gui.OptionPanels { this.label21.Yalign = 0F; this.label21.LabelProp = " "; this.hbox11.Add(this.label21); - Gtk.Box.BoxChild w13 = ((Gtk.Box.BoxChild)(this.hbox11[this.label21])); - w13.Position = 0; - w13.Expand = false; - w13.Fill = false; + Gtk.Box.BoxChild w16 = ((Gtk.Box.BoxChild)(this.hbox11[this.label21])); + w16.Position = 0; + w16.Expand = false; + w16.Fill = false; // Container child hbox11.Gtk.Box+BoxChild this.vbox20 = new Gtk.VBox(); this.vbox20.Name = "vbox20"; @@ -204,19 +237,19 @@ namespace MonoDevelop.Ide.Gui.OptionPanels { this.createBackupCopyCheckButton.DrawIndicator = true; this.createBackupCopyCheckButton.UseUnderline = true; this.vbox20.Add(this.createBackupCopyCheckButton); - Gtk.Box.BoxChild w14 = ((Gtk.Box.BoxChild)(this.vbox20[this.createBackupCopyCheckButton])); - w14.Position = 0; - w14.Expand = false; - w14.Fill = false; + Gtk.Box.BoxChild w17 = ((Gtk.Box.BoxChild)(this.vbox20[this.createBackupCopyCheckButton])); + w17.Position = 0; + w17.Expand = false; + w17.Fill = false; this.hbox11.Add(this.vbox20); - Gtk.Box.BoxChild w15 = ((Gtk.Box.BoxChild)(this.hbox11[this.vbox20])); - w15.Position = 1; + Gtk.Box.BoxChild w18 = ((Gtk.Box.BoxChild)(this.hbox11[this.vbox20])); + w18.Position = 1; this.vbox19.Add(this.hbox11); - Gtk.Box.BoxChild w16 = ((Gtk.Box.BoxChild)(this.vbox19[this.hbox11])); - w16.Position = 1; + Gtk.Box.BoxChild w19 = ((Gtk.Box.BoxChild)(this.vbox19[this.hbox11])); + w19.Position = 1; this.vbox17.Add(this.vbox19); - Gtk.Box.BoxChild w17 = ((Gtk.Box.BoxChild)(this.vbox17[this.vbox19])); - w17.Position = 2; + Gtk.Box.BoxChild w20 = ((Gtk.Box.BoxChild)(this.vbox17[this.vbox19])); + w20.Position = 2; this.Add(this.vbox17); if ((this.Child != null)) { this.Child.ShowAll(); diff --git a/main/src/core/MonoDevelop.Ide/gtk-gui/gui.stetic b/main/src/core/MonoDevelop.Ide/gtk-gui/gui.stetic index 26566ce5a7..e6189bfec3 100644 --- a/main/src/core/MonoDevelop.Ide/gtk-gui/gui.stetic +++ b/main/src/core/MonoDevelop.Ide/gtk-gui/gui.stetic @@ -190,7 +190,7 @@ </widget> </child> </widget> - <widget class="Gtk.Dialog" id="MonoDevelop.Ide.Gui.Dialogs.ExportProjectDialog" design-size="509 167"> + <widget class="Gtk.Dialog" id="MonoDevelop.Ide.Gui.Dialogs.ExportProjectDialog" design-size="509 195"> <property name="MemberName" /> <property name="Events">ButtonPressMask</property> <property name="Title" translatable="yes">Export Project</property> @@ -203,6 +203,7 @@ <property name="MemberName" /> <property name="Events">ButtonPressMask</property> <property name="Spacing">6</property> + <property name="BorderWidth">2</property> <child> <widget class="Gtk.VBox" id="vbox2"> <property name="MemberName" /> @@ -211,7 +212,7 @@ <child> <widget class="Gtk.Table" id="table1"> <property name="MemberName" /> - <property name="NRows">2</property> + <property name="NRows">3</property> <property name="NColumns">2</property> <property name="RowSpacing">6</property> <property name="ColumnSpacing">6</property> @@ -222,6 +223,8 @@ <property name="Items" translatable="yes" /> </widget> <packing> + <property name="TopAttach">1</property> + <property name="BottomAttach">2</property> <property name="LeftAttach">1</property> <property name="RightAttach">2</property> <property name="AutoSize">False</property> @@ -240,8 +243,8 @@ <signal name="PathChanged" handler="OnFolderEntryPathChanged" /> </widget> <packing> - <property name="TopAttach">1</property> - <property name="BottomAttach">2</property> + <property name="TopAttach">2</property> + <property name="BottomAttach">3</property> <property name="LeftAttach">1</property> <property name="RightAttach">2</property> <property name="AutoSize">True</property> @@ -256,12 +259,14 @@ </packing> </child> <child> - <widget class="Gtk.Label" id="label1"> + <widget class="Gtk.Label" id="label2"> <property name="MemberName" /> <property name="Xalign">0</property> - <property name="LabelProp" translatable="yes">File format:</property> + <property name="LabelProp" translatable="yes">Target folder:</property> </widget> <packing> + <property name="TopAttach">2</property> + <property name="BottomAttach">3</property> <property name="AutoSize">True</property> <property name="XOptions">Fill</property> <property name="YOptions">Fill</property> @@ -274,10 +279,10 @@ </packing> </child> <child> - <widget class="Gtk.Label" id="label2"> + <widget class="Gtk.Label" id="label3"> <property name="MemberName" /> <property name="Xalign">0</property> - <property name="LabelProp" translatable="yes">Target folder:</property> + <property name="LabelProp" translatable="yes">New format:</property> </widget> <packing> <property name="TopAttach">1</property> @@ -293,6 +298,44 @@ <property name="YShrink">False</property> </packing> </child> + <child> + <widget class="Gtk.Label" id="label4"> + <property name="MemberName" /> + <property name="Xalign">0</property> + <property name="LabelProp" translatable="yes">Current format:</property> + </widget> + <packing> + <property name="AutoSize">True</property> + <property name="XOptions">Fill</property> + <property name="YOptions">Fill</property> + <property name="XExpand">False</property> + <property name="XFill">True</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> + </packing> + </child> + <child> + <widget class="Gtk.Label" id="labelNewFormat"> + <property name="MemberName" /> + <property name="Xalign">0</property> + <property name="LabelProp" translatable="yes" /> + </widget> + <packing> + <property name="LeftAttach">1</property> + <property name="RightAttach">2</property> + <property name="AutoSize">True</property> + <property name="XOptions">Fill</property> + <property name="YOptions">Fill</property> + <property name="XExpand">False</property> + <property name="XFill">True</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> + </packing> + </child> </widget> <packing> <property name="Position">0</property> @@ -314,7 +357,7 @@ <child internal-child="ActionArea"> <widget class="Gtk.HButtonBox" id="MonoDevelop.Ide.ExportProjectDialog_ActionArea"> <property name="MemberName" /> - <property name="Spacing">10</property> + <property name="Spacing">6</property> <property name="BorderWidth">5</property> <property name="Size">2</property> <property name="LayoutStyle">End</property> @@ -2212,7 +2255,7 @@ </widget> </child> </widget> - <widget class="Gtk.Bin" id="MonoDevelop.Ide.Gui.OptionPanels.LoadSavePanelWidget" design-size="320 178"> + <widget class="Gtk.Bin" id="MonoDevelop.Ide.Gui.OptionPanels.LoadSavePanelWidget" design-size="344 238"> <property name="MemberName" /> <property name="GeneratePublic">False</property> <child> @@ -2224,6 +2267,47 @@ <property name="MemberName" /> <property name="Spacing">6</property> <child> + <widget class="Gtk.Label" id="label1"> + <property name="MemberName" /> + <property name="Xalign">0</property> + <property name="LabelProp" translatable="yes">Project file format to use when creating new projects:</property> + </widget> + <packing> + <property name="Position">0</property> + <property name="AutoSize">True</property> + <property name="Expand">False</property> + <property name="Fill">False</property> + </packing> + </child> + <child> + <widget class="Gtk.HBox" id="hbox1"> + <property name="MemberName" /> + <property name="Spacing">6</property> + <child> + <widget class="Gtk.ComboBox" id="comboFileFormats"> + <property name="MemberName" /> + <property name="IsTextCombo">True</property> + <property name="Items" translatable="yes" /> + </widget> + <packing> + <property name="Position">0</property> + <property name="AutoSize">True</property> + <property name="Expand">False</property> + <property name="Fill">False</property> + </packing> + </child> + <child> + <placeholder /> + </child> + </widget> + <packing> + <property name="Position">1</property> + <property name="AutoSize">True</property> + <property name="Expand">False</property> + <property name="Fill">False</property> + </packing> + </child> + <child> <widget class="Gtk.Label" id="locationLabel"> <property name="MemberName" /> <property name="Xalign">0</property> @@ -2232,7 +2316,7 @@ <property name="UseUnderline">True</property> </widget> <packing> - <property name="Position">0</property> + <property name="Position">2</property> <property name="AutoSize">False</property> <property name="Expand">False</property> <property name="Fill">False</property> @@ -2243,7 +2327,7 @@ <property name="MemberName" /> </widget> <packing> - <property name="Position">1</property> + <property name="Position">3</property> <property name="AutoSize">True</property> <property name="Expand">False</property> <property name="Fill">False</property> diff --git a/main/src/core/MonoDevelop.Ide/gtk-gui/objects.xml b/main/src/core/MonoDevelop.Ide/gtk-gui/objects.xml index 4e8ce201a6..aa20ee392b 100644 --- a/main/src/core/MonoDevelop.Ide/gtk-gui/objects.xml +++ b/main/src/core/MonoDevelop.Ide/gtk-gui/objects.xml @@ -1,10 +1,4 @@ <objects> - <object type="MonoDevelop.Ide.Gui.Dialogs.CombineEntryFeatureSelector" palette-category="MonoDevelop.Ide" allow-children="false" base-type="Gtk.Widget"> - <itemgroups> - </itemgroups> - <signals> - </signals> - </object> <object type="MonoDevelop.Ide.StandardHeaders.StandardHeaderPanel" palette-category="MonoDevelop.Ide" allow-children="false" base-type="Gtk.Bin" internal="true"> <itemgroups> </itemgroups> @@ -17,6 +11,10 @@ <signals> </signals> </object> + <object type="MonoDevelop.Ide.Gui.Dialogs.CombineEntryFeatureSelector" palette-category="MonoDevelop.Ide" allow-children="false" base-type="Gtk.Widget"> + <itemgroups /> + <signals /> + </object> <object type="MonoDevelop.Ide.Gui.Pads.ClassBrowser.ClassBrowserPadWidget" palette-category="MonoDevelop.Ide" allow-children="false" base-type="Gtk.Bin"> <itemgroups /> <signals /> diff --git a/main/src/core/MonoDevelop.Projects.Gui/ChangeLog b/main/src/core/MonoDevelop.Projects.Gui/ChangeLog index 0fd966f1cd..4981669a54 100644 --- a/main/src/core/MonoDevelop.Projects.Gui/ChangeLog +++ b/main/src/core/MonoDevelop.Projects.Gui/ChangeLog @@ -1,3 +1,29 @@ +2008-05-21 Lluis Sanchez Gual <lluis@novell.com> + + * MonoDevelop.Projects.Gui.addin.xml, MonoDevelop.Projects.Gui.mdp, + MonoDevelop.Projects.Gui/ProjectsGuiServices.cs, + MonoDevelop.Projects.Gui.Dialogs/MultiConfigItemOptionsDialog.cs, + MonoDevelop.Projects.Gui.Dialogs/MultiConfigItemOptionsPanel.cs, + MonoDevelop.Projects.Gui.Dialogs/ProjectOptionsDialog.cs, + MonoDevelop.Projects.Gui.Dialogs/CombineOptionsDialog.cs, + MonoDevelop.Projects.Gui.Dialogs/ItemOptionsPanel.cs, + gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineInformationWidget.cs, + gtk-gui/MonoDevelop.Projects.Gui.Dialogs.NewConfigurationDialog.cs, + gtk-gui/gui.stetic, Makefile.am, + MonoDevelop.Projects.Gui.Completion/CodeCompletionData.cs, + MonoDevelop.Projects.Gui.Dialogs.OptionPanels/OutputOptionsPanel.cs, + MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CustomCommandPanelWidget.cs, + MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CustomCommandWidget.cs, + MonoDevelop.Projects.Gui.Dialogs.OptionPanels/RuntimeOptionsPanel.cs, + MonoDevelop.Projects.Gui.Dialogs.OptionPanels/GeneralProjectOptions.cs, + MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineInformationPanel.cs, + MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineConfigurationPanel.cs, + MonoDevelop.Projects.Gui.Dialogs.OptionPanels/SolutionItemConfigurationsPanel.cs, + MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineBuildOptions.cs, + MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CommonAssemblySigningPreferences.cs, + MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CustomCommandPanel.cs: + New project model changes. + 2008-05-19 Michael Hutchinson <mhutchinson@novell.com> * MonoDevelop.Projects.Gui.Completion/ListWindow.cs: Only return a diff --git a/main/src/core/MonoDevelop.Projects.Gui/Makefile.am b/main/src/core/MonoDevelop.Projects.Gui/Makefile.am index 0974e480ee..571b6a22c4 100644 --- a/main/src/core/MonoDevelop.Projects.Gui/Makefile.am +++ b/main/src/core/MonoDevelop.Projects.Gui/Makefile.am @@ -21,9 +21,7 @@ FILES = \ gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineConfigurationPanelWidget.cs \ gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineEntryConfigurationsPanelWidget.cs \ gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineInformationWidget.cs \ - gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineStartupPanelWidget.cs \ gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CommonAssemblySigningPreferences.cs \ - gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CompileFileOptionsWidget.cs \ gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CustomCommandPanelWidget.cs \ gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CustomCommandWidget.cs \ gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.GeneralProjectOptionsWidget.cs \ @@ -47,19 +45,20 @@ FILES = \ MonoDevelop.Projects.Gui.Completion/WindowTransparencyDecorator.cs \ MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineBuildOptions.cs \ MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineConfigurationPanel.cs \ - MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineEntryConfigurationsPanel.cs \ MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineInformationPanel.cs \ - MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineStartupPanel.cs \ MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CommonAssemblySigningPreferences.cs \ - MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CompileFileProjectOptions.cs \ MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CustomCommandPanel.cs \ MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CustomCommandPanelWidget.cs \ MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CustomCommandWidget.cs \ MonoDevelop.Projects.Gui.Dialogs.OptionPanels/GeneralProjectOptions.cs \ MonoDevelop.Projects.Gui.Dialogs.OptionPanels/OutputOptionsPanel.cs \ MonoDevelop.Projects.Gui.Dialogs.OptionPanels/RuntimeOptionsPanel.cs \ + MonoDevelop.Projects.Gui.Dialogs.OptionPanels/SolutionItemConfigurationsPanel.cs \ MonoDevelop.Projects.Gui.Dialogs/CombineOptionsDialog.cs \ MonoDevelop.Projects.Gui.Dialogs/DeleteConfigDialog.cs \ + MonoDevelop.Projects.Gui.Dialogs/ItemOptionsPanel.cs \ + MonoDevelop.Projects.Gui.Dialogs/MultiConfigItemOptionsDialog.cs \ + MonoDevelop.Projects.Gui.Dialogs/MultiConfigItemOptionsPanel.cs \ MonoDevelop.Projects.Gui.Dialogs/NewConfigurationDialog.cs \ MonoDevelop.Projects.Gui.Dialogs/ProjectOptionsDialog.cs \ MonoDevelop.Projects.Gui.Dialogs/RenameConfigDialog.cs \ diff --git a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Completion/CodeCompletionData.cs b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Completion/CodeCompletionData.cs index 605f83a746..f78f22131a 100644 --- a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Completion/CodeCompletionData.cs +++ b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Completion/CodeCompletionData.cs @@ -186,7 +186,7 @@ namespace MonoDevelop.Projects.Gui.Completion public CodeCompletionData (string s, string image, string description, string completionString) { - description = pango_description = description; + this.description = pango_description = description; documentation = String.Empty; text = s; this.completionString = completionString; diff --git a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineBuildOptions.cs b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineBuildOptions.cs index 1a6e83145f..8a0785f679 100644 --- a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineBuildOptions.cs +++ b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineBuildOptions.cs @@ -30,37 +30,35 @@ using MonoDevelop.Components; namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels { - internal class CombineBuildOptions : AbstractOptionPanel + internal class CombineBuildOptions : ItemOptionsPanel { CombineBuildOptionsWidget widget; - public override void LoadPanelContents() + public override Widget CreatePanelWidget() { - Add (widget = new CombineBuildOptionsWidget ((Properties) CustomizationObject)); + return (widget = new CombineBuildOptionsWidget (ConfiguredSolution)); } - public override bool StorePanelContents() + public override void ApplyChanges () { - bool success = widget.Store (); - return success; + widget.Store (); } } partial class CombineBuildOptionsWidget : Gtk.Bin { - Combine combine; + Solution solution; - public CombineBuildOptionsWidget (Properties CustomizationObject) + public CombineBuildOptionsWidget (Solution solution) { Build (); - this.combine = ((Properties)CustomizationObject).Get<Combine> ("Combine"); - folderEntry.Path = combine.OutputDirectory; + this.solution = solution; + folderEntry.Path = solution.OutputDirectory; } - public bool Store() + public void Store() { - combine.OutputDirectory = folderEntry.Path; - return true; + solution.OutputDirectory = folderEntry.Path; } } } diff --git a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineConfigurationPanel.cs b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineConfigurationPanel.cs index 7aaf8ab775..690c3262ca 100644 --- a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineConfigurationPanel.cs +++ b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineConfigurationPanel.cs @@ -37,31 +37,34 @@ using Gtk; namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels { - internal class CombineConfigurationPanel : AbstractOptionPanel + internal class CombineConfigurationPanel : MultiConfigItemOptionsPanel { CombineConfigurationPanelWidget widget; - public override void LoadPanelContents() + public override Widget CreatePanelWidget() { - Add (widget = new CombineConfigurationPanelWidget ((Properties) CustomizationObject)); + return widget = new CombineConfigurationPanelWidget (); } - public override bool StorePanelContents() + public override void LoadConfigData () { - bool success = widget.Store (); - return success; + widget.Load ((SolutionConfiguration) CurrentConfiguration); + } + + public override void ApplyChanges () + { + widget.Store (); } } partial class CombineConfigurationPanelWidget : Gtk.Bin { TreeStore store; - CombineConfiguration configuration; + SolutionConfiguration configuration; - public CombineConfigurationPanelWidget (Properties CustomizationObject) + public CombineConfigurationPanelWidget () { Build (); - configuration = ((Properties)CustomizationObject).Get<CombineConfiguration> ("Config"); store = new TreeStore (typeof(object), typeof(string), typeof(bool)); configsList.Model = store; @@ -83,28 +86,35 @@ namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels CellRendererComboBox comboCell = new CellRendererComboBox (); comboCell.Changed += new ComboSelectionChangedHandler (OnConfigSelectionChanged); configsList.AppendColumn (GettextCatalog.GetString ("Configuration"), comboCell, new TreeCellDataFunc (OnSetConfigurationsData)); - - foreach (CombineConfigurationEntry ce in configuration.Entries) { - store.AppendValues (ce, ce.Entry.Name, ce.Build); + } + + public void Load (SolutionConfiguration config) + { + configuration = config; + + store.Clear (); + foreach (SolutionConfigurationEntry ce in configuration.Configurations) { + if (ce.Item != null) + store.AppendValues (ce, ce.Item.Name, ce.Build); } } void OnSetConfigurationsData (Gtk.TreeViewColumn treeColumn, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) { - CombineConfigurationEntry entry = (CombineConfigurationEntry) store.GetValue (iter, 0); - string[] values = new string [entry.Entry.Configurations.Count]; + SolutionConfigurationEntry entry = (SolutionConfigurationEntry) store.GetValue (iter, 0); + string[] values = new string [entry.Item.Configurations.Count]; for (int n=0; n<values.Length; n++) - values [n] = entry.Entry.Configurations [n].Name; + values [n] = entry.Item.Configurations [n].Id; CellRendererComboBox comboCell = (CellRendererComboBox) cell; comboCell.Values = values; - comboCell.Text = entry.ConfigurationName; + comboCell.Text = entry.ItemConfiguration; } void OnBuildToggled (object sender, ToggledArgs args) { TreeIter iter; if (store.GetIter (out iter, new TreePath (args.Path))) { - CombineConfigurationEntry entry = (CombineConfigurationEntry) store.GetValue (iter, 0); + SolutionConfigurationEntry entry = (SolutionConfigurationEntry) store.GetValue (iter, 0); entry.Build = !entry.Build; store.SetValue (iter, 2, entry.Build); } @@ -114,18 +124,17 @@ namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels { TreeIter iter; if (store.GetIter (out iter, new TreePath (args.Path))) { - CombineConfigurationEntry entry = (CombineConfigurationEntry) store.GetValue (iter, 0); + SolutionConfigurationEntry entry = (SolutionConfigurationEntry) store.GetValue (iter, 0); if (args.Active != -1) - entry.ConfigurationName = entry.Entry.Configurations [args.Active].Name; + entry.ItemConfiguration = entry.Item.Configurations [args.Active].Id; else - entry.ConfigurationName = null; + entry.ItemConfiguration = null; } } - public bool Store() + public void Store () { // Data stored at dialog level - return true; } } diff --git a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineInformationPanel.cs b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineInformationPanel.cs index 729fd91275..b6dc40c713 100644 --- a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineInformationPanel.cs +++ b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineInformationPanel.cs @@ -38,42 +38,38 @@ using MonoDevelop.Components; namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels { - internal class CombineInformationPanel : AbstractOptionPanel + internal class CombineInformationPanel : ItemOptionsPanel { CombineInformationWidget widget; - public override void LoadPanelContents() + public override Widget CreatePanelWidget() { - Add ( widget = new CombineInformationWidget ((Properties) CustomizationObject)); + return widget = new CombineInformationWidget (ConfiguredSolution); } - public override bool StorePanelContents() + public override void ApplyChanges() { - widget.Store ((Properties) CustomizationObject); - return true; + widget.Store (ConfiguredSolution); } } partial class CombineInformationWidget : Gtk.Bin { - Combine combine; - - public CombineInformationWidget (Properties CustomizationObject) + public CombineInformationWidget (Solution solution) { Build (); - this.combine = ((Properties)CustomizationObject).Get<Combine> ("Combine"); versLabel.UseUnderline = true; descLabel.UseUnderline = true; - versEntry.Text = combine.Version; - descView.Buffer.Text = combine.Description; + versEntry.Text = solution.Version; + descView.Buffer.Text = solution.Description; } - public void Store (Properties CustomizationObject) + public void Store (Solution solution) { - combine.Version = versEntry.Text; - combine.Description = descView.Buffer.Text; + solution.Version = versEntry.Text; + solution.Description = descView.Buffer.Text; } } } diff --git a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineStartupPanel.cs b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineStartupPanel.cs deleted file mode 100644 index 2eed37f143..0000000000 --- a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineStartupPanel.cs +++ /dev/null @@ -1,276 +0,0 @@ -// CombineStartupPanel.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using System; -using System.Collections; -using System.ComponentModel; - -using MonoDevelop.Core; -using MonoDevelop.Core.Gui.Dialogs; -using MonoDevelop.Projects; -using MonoDevelop.Core.Gui; - -using Gtk; -using MonoDevelop.Components; - -namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels -{ - internal class CombineStartupPanel : AbstractOptionPanel - { - CombineStartupPanelWidget widget; - - public override void LoadPanelContents() - { - Add (widget = new CombineStartupPanelWidget ((Properties) CustomizationObject)); - } - - public override bool StorePanelContents() - { - bool success = widget.Store (); - return success; - } - } - - partial class CombineStartupPanelWidget : Gtk.Bin - { - public ListStore store; - - Combine combine; - - public CombineStartupPanelWidget (Properties CustomizationObject) - { - Build (); - - this.combine = ((Properties)CustomizationObject).Get<Combine> ("Combine"); - - singleRadioButton.Active = combine.SingleStartupProject; - singleRadioButton.Clicked += new EventHandler(OnSingleRadioButtonClicked); - multipleRadioButton.Active = !combine.SingleStartupProject; - //singleRadioButton.Clicked += new EventHandler(OptionsChanged); - - // Setting up OptionMenus - ListStore tmpStore = new ListStore (typeof (string)); - int active = -1; - for (int i = 0; i < combine.Entries.Count; i++) { - CombineEntry entry = (CombineEntry) combine.Entries[i]; - tmpStore.AppendValues (entry.Name); - - if (combine.StartupEntry == entry) - active = i; - } - singleCombo.Model = tmpStore; - - CellRendererText cr = new CellRendererText (); - singleCombo.PackStart (cr, true); - singleCombo.AddAttribute (cr, "text", 0); - singleCombo.Active = active; - - tmpStore = new ListStore (typeof (string)); - tmpStore.AppendValues (GettextCatalog.GetString ("None")); - tmpStore.AppendValues (GettextCatalog.GetString ("Execute")); - actionCombo.Model = tmpStore; - actionCombo.PackStart (cr, true); - actionCombo.AddAttribute (cr, "text", 0); - actionCombo.Changed += new EventHandler(OptionsChanged); - - // Populating entryTreeView - store = new ListStore (typeof(string), typeof(string), typeof(CombineExecuteDefinition) ); - entryTreeView.Model = store; - - string entryHeader = StringParserService.Parse(GettextCatalog.GetString ("Entry")); - entryTreeView.AppendColumn (entryHeader, new CellRendererText (), "text", 0); - string actionHeader = StringParserService.Parse(GettextCatalog.GetString ("Action")); - entryTreeView.AppendColumn (actionHeader, new CellRendererText (), "text", 1); - - // sanity check to ensure we had a proper execture definitions save last time rounf - if(combine.CombineExecuteDefinitions.Count == combine.Entries.Count) { - // add the previously saved execute definitions to the treeview list - for (int n = 0; n < combine.CombineExecuteDefinitions.Count; n++) { - CombineExecuteDefinition edef = (CombineExecuteDefinition)combine.CombineExecuteDefinitions[n]; - if (edef == null || edef.Entry == null) { - // Invalid - store.Clear (); - AddEmptyExecuteDefinitions (); - break; - } - string action = edef.Type == EntryExecuteType.None ? GettextCatalog.GetString ("None") : GettextCatalog.GetString ("Execute"); - store.AppendValues (edef.Entry.Name, action, edef); - } - } else { - AddEmptyExecuteDefinitions (); - } - - entryTreeView.Selection.Changed += new EventHandler(SelectedEntryChanged); - entryTreeView.Selection.SelectPath(new TreePath ("0")); - - // Setting up Buttons - moveUpButton.Clicked += new EventHandler(OnMoveUpButtonClicked); - moveDownButton.Clicked += new EventHandler(OnMoveDownButtonClicked); - - OnSingleRadioButtonClicked(null, null); - } - - void AddEmptyExecuteDefinitions () - { - for (int n = 0; n < combine.Entries.Count; n++) { - CombineExecuteDefinition edef = new CombineExecuteDefinition ((CombineEntry) combine.Entries[n],EntryExecuteType.None); - string action = edef.Type == EntryExecuteType.None ? GettextCatalog.GetString ("None") : GettextCatalog.GetString ("Execute"); - store.AppendValues (edef.Entry.Name, action, edef); - } - - // tell the user we encountered and worked around an issue - Gtk.Application.Invoke (delegate { - MonoDevelop.Core.Gui.MessageService.ShowError (MonoDevelop.Core.GettextCatalog.GetString ("The Solution Execute Definitions for this Solution were invalid. A new empty set of Execute Definitions has been created.")); - }); - } - - protected void OnMoveUpButtonClicked(object sender, EventArgs e) - { - if(entryTreeView.Selection.CountSelectedRows() == 1) - { - TreeIter selectedItem; - TreeModel ls; - ((ListStore)entryTreeView.Model).GetIter( - out selectedItem, (TreePath) entryTreeView.Selection.GetSelectedRows(out ls)[0]); - // we know we have a selected item so get it's index - // use that to get the path of the item before it, and swap the two - int index = GetSelectedIndex(entryTreeView); - // only swap if at the top - if(index > 0) - { - TreeIter prev; - if(entryTreeView.Model.GetIterFromString(out prev, (index - 1).ToString())) - { - ((ListStore)ls).Swap(selectedItem, prev); - } - } - } - } - - - protected void OnMoveDownButtonClicked(object sender, EventArgs e) - { - if(entryTreeView.Selection.CountSelectedRows() == 1) - { - TreeIter selectedItem; - TreeModel ls; - ((ListStore)entryTreeView.Model).GetIter( - out selectedItem, (TreePath) entryTreeView.Selection.GetSelectedRows(out ls)[0]); - // swap it with the next one - TreeIter toSwap = selectedItem; - if(ls.IterNext(ref toSwap)) - { - ((ListStore)ls).Swap(selectedItem, toSwap); - } - } - } - - void OnSingleRadioButtonClicked(object sender, EventArgs e) - { - multipleBox.Sensitive = multipleRadioButton.Active; - singleCombo.Sensitive = singleRadioButton.Active; - } - - void OptionsChanged (object sender, EventArgs e) - { - TreeIter iter; - TreeModel model; - ComboBox combo = sender as ComboBox; - - if (entryTreeView.Selection.GetSelected (out model, out iter)) - { - CombineExecuteDefinition edef = (CombineExecuteDefinition) model.GetValue (iter, 2); - switch (combo.Active) { - case 0: - edef.Type = EntryExecuteType.None; - break; - case 1: - edef.Type = EntryExecuteType.Execute; - break; - default: - break; - } - - model.SetValue (iter, 2, edef); - string action = edef.Type == EntryExecuteType.None ? GettextCatalog.GetString ("None") : GettextCatalog.GetString ("Execute"); - model.SetValue (iter, 1, action); - } - } - - void SelectedEntryChanged(object sender, EventArgs e) - { - TreeIter iter; - TreeModel model; - TreeSelection selection = sender as TreeSelection; - - if (selection.GetSelected (out model, out iter)) - { - string txt = (string) model.GetValue (iter, 1); - if (txt == GettextCatalog.GetString ("None")) - actionCombo.Active = 0; - else - actionCombo.Active = 1; - } - } - - // added this event to get the last select row index from gtk TreeView - int GetSelectedIndex(Gtk.TreeView tv) - { - if(entryTreeView.Selection.CountSelectedRows() == 1) - { - TreeIter selectedIter; - TreeModel lv; - ((ListStore)entryTreeView.Model).GetIter( - out selectedIter, (TreePath) entryTreeView.Selection.GetSelectedRows(out lv)[0]); - - // return index of first level node (since only 1 level list model) - return lv.GetPath(selectedIter).Indices[0]; - } - else - { - return -1; - } - } - - public bool Store() - { - if (singleCombo.Active != -1) - combine.StartupEntry = (CombineEntry) combine.Entries [singleCombo.Active]; - else - combine.StartupEntry = null; - combine.SingleStartupProject = singleRadioButton.Active; - - // write back new combine execute definitions - combine.CombineExecuteDefinitions.Clear(); - TreeIter first; - store.GetIterFirst(out first); - TreeIter current = first; - for (int i = 0; i < store.IterNChildren() ; ++i) { - - CombineExecuteDefinition edef = (CombineExecuteDefinition) store.GetValue(current, 2); - combine.CombineExecuteDefinitions.Add(edef); - - store.IterNext(ref current); - } - return true; - } - } - -} - diff --git a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CommonAssemblySigningPreferences.cs b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CommonAssemblySigningPreferences.cs index 0af3142fe5..13a7212a83 100644 --- a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CommonAssemblySigningPreferences.cs +++ b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CommonAssemblySigningPreferences.cs @@ -34,129 +34,93 @@ using MonoDevelop.Core; namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels { - internal partial class CommonAssemblySigningPreferences : Gtk.Bin, IDialogPanel + internal partial class CommonAssemblySigningPreferences : Gtk.Bin { - Project project; - AbstractProjectConfiguration configuration; - public CommonAssemblySigningPreferences() + ItemConfiguration[] configurations; + string keyFile; + + public CommonAssemblySigningPreferences () { this.Build(); } - public void LoadPanelContents () + public void LoadPanelContents (Project project, ItemConfiguration[] configurations) { - Properties props = (Properties) CustomizationObject; - configuration = props.Get<AbstractProjectConfiguration> ("Config"); - project = ((Properties)CustomizationObject).Get<Project> ("Project"); - this.signAssemblyCheckbutton.Toggled += new EventHandler (SignAssemblyCheckbuttonActivated); - if (configuration != null) { - this.signAssemblyCheckbutton.Active = configuration.SignAssembly; - this.strongNameFileEntry.Path = configuration.AssemblyKeyFile; + this.configurations = configurations; + + int signAsm = -1; + + keyFile = null; + foreach (ProjectConfiguration c in configurations) { + int r = c.SignAssembly ? 1 : 0; + if (signAsm == -1) + signAsm = r; + else if (signAsm != r) + signAsm = 2; + if (keyFile == null) + keyFile = c.AssemblyKeyFile; + else if (keyFile != c.AssemblyKeyFile) + keyFile = "?"; } - if (project != null) { - this.strongNameFileEntry.DefaultPath = project.BaseDirectory; + + if (signAsm == 2) + signAssemblyCheckbutton.Inconsistent = true; + else { + signAssemblyCheckbutton.Inconsistent = false; + signAssemblyCheckbutton.Active = signAsm == 1; } - SignAssemblyCheckbuttonActivated (null, null); + + if (keyFile == null || keyFile == "?") + this.strongNameFileEntry.Path = string.Empty; + else + this.strongNameFileEntry.Path = keyFile; + + this.strongNameFileEntry.DefaultPath = project.BaseDirectory; + this.strongNameFileLabel.Sensitive = this.strongNameFileEntry.Sensitive = signAsm != 0; + this.signAssemblyCheckbutton.Toggled += new EventHandler (SignAssemblyCheckbuttonActivated); } void SignAssemblyCheckbuttonActivated (object sender, EventArgs e) { + signAssemblyCheckbutton.Inconsistent = false; this.strongNameFileLabel.Sensitive = this.strongNameFileEntry.Sensitive = this.signAssemblyCheckbutton.Active; } - public bool StorePanelContents () + public void StorePanelContents () { - if (configuration != null) { - configuration.SignAssembly = this.signAssemblyCheckbutton.Active; - configuration.AssemblyKeyFile = this.strongNameFileEntry.Path; + foreach (ProjectConfiguration c in configurations) { + if (!signAssemblyCheckbutton.Inconsistent) + c.SignAssembly = this.signAssemblyCheckbutton.Active; + if (strongNameFileEntry.Path.Length > 0 || keyFile != "?") + c.AssemblyKeyFile = this.strongNameFileEntry.Path; } - return true; } + } + + class CommonAssemblySigningPreferencesPanel: MultiConfigItemOptionsPanel + { + CommonAssemblySigningPreferences widget; -#region Cut&paste from abstract option panel - bool wasActivated = false; - bool isFinished = true; - object customizationObject = null; - - public Gtk.Widget Control { - get { - return this; - } + public override bool IsVisible () + { + return ConfiguredProject is DotNetProject; } - public virtual Gtk.Image Icon { - get { - return null; - } - } - - public bool WasActivated { - get { - return wasActivated; - } - } - - public virtual object CustomizationObject { - get { - return customizationObject; - } - set { - customizationObject = value; - OnCustomizationObjectChanged(); - } - } - - public virtual bool EnableFinish { - get { - return isFinished; - } - set { - if (isFinished != value) { - isFinished = value; - OnEnableFinishChanged(); - } - } - } - - public virtual bool ReceiveDialogMessage(DialogMessage message) + public override Gtk.Widget CreatePanelWidget () { - try { - switch (message) { - case DialogMessage.Activated: - if (!wasActivated) { - LoadPanelContents(); - wasActivated = true; - } - break; - case DialogMessage.OK: - if (wasActivated) { - return StorePanelContents(); - } - break; - } - } catch (Exception ex) { - MessageService.ShowException (ex); - } - - return true; + AllowMixedConfigurations = true; + return (widget = new CommonAssemblySigningPreferences ()); } - - protected virtual void OnEnableFinishChanged() + + public override void LoadConfigData () { - if (EnableFinishChanged != null) { - EnableFinishChanged(this, null); - } + widget.LoadPanelContents (ConfiguredProject, CurrentConfigurations); } - protected virtual void OnCustomizationObjectChanged() + + public override void ApplyChanges () { - if (CustomizationObjectChanged != null) { - CustomizationObjectChanged(this, null); - } + widget.StorePanelContents (); } - - public event EventHandler CustomizationObjectChanged; - public event EventHandler EnableFinishChanged; -#endregion } } diff --git a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CompileFileProjectOptions.cs b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CompileFileProjectOptions.cs deleted file mode 100644 index dbdf5cf2a1..0000000000 --- a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CompileFileProjectOptions.cs +++ /dev/null @@ -1,120 +0,0 @@ -// CompileFileProjectOptions.cs -// -// This file was derived from a file from #Develop. -// -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; - -using MonoDevelop.Projects; -using MonoDevelop.Core; -using MonoDevelop.Core.Gui; -using MonoDevelop.Core.Gui.Components; -using MonoDevelop.Core.Gui.Dialogs; -using MonoDevelop.Components; - -using Gtk; - -namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels -{ - internal class CompileFileProjectOptions : AbstractOptionPanel - { - CompileFileOptionsWidget widget; - - public override void LoadPanelContents() - { - Add (widget = new CompileFileOptionsWidget ((Properties) CustomizationObject)); - } - - public override bool StorePanelContents() - { - return widget.Store (); - } - } - - partial class CompileFileOptionsWidget : Gtk.Bin - { - public ListStore store; - - Project project; - - public CompileFileOptionsWidget (Properties CustomizationObject) - { - Build (); - - this.project = ((Properties)CustomizationObject).Get<Project> ("Project"); - - includeLabel.UseUnderline = true; - store = new ListStore (typeof(bool), typeof(string)); - store.SetSortColumnId (1, SortType.Ascending); - includeTreeView.Selection.Mode = SelectionMode.None; - includeTreeView.Model = store; - CellRendererToggle rendererToggle = new CellRendererToggle (); - rendererToggle.Activatable = true; - rendererToggle.Toggled += new ToggledHandler (ItemToggled); - includeTreeView.AppendColumn ("Choosen", rendererToggle, "active", 0); - includeTreeView.AppendColumn ("Name", new CellRendererText (), "text", 1); - - foreach (ProjectFile info in project.ProjectFiles) { - if (info.BuildAction == BuildAction.Nothing || info.BuildAction == BuildAction.Compile) { - string name = FileService.NormalizeRelativePath ( - FileService.AbsoluteToRelativePath( - project.BaseDirectory, info.Name)); - store.AppendValues (info.BuildAction == BuildAction.Compile ? true : false, name); - } - } - } - - private void ItemToggled (object o, ToggledArgs args) - { - const int column = 0; - Gtk.TreeIter iter; - - if (store.GetIterFromString (out iter, args.Path)) { - bool val = (bool) store.GetValue(iter, column); - store.SetValue(iter, column, !val); - } - } - - public bool Store () - { - bool success = true; - TreeIter current; - store.GetIterFirst (out current); - - for (int i = 0; i < store.IterNChildren (); i++) { - if (i != 0) - store.IterNext(ref current); - string name = FileService.RelativeToAbsolutePath( - project.BaseDirectory, "." + System.IO.Path.DirectorySeparatorChar + store.GetValue(current, 1)); - int j = 0; - while (j < project.ProjectFiles.Count && project.ProjectFiles[j].Name != name) { - ++j; - } - if (j < project.ProjectFiles.Count) { - project.ProjectFiles[j].BuildAction = (bool) store.GetValue(current, 0) ? BuildAction.Compile : BuildAction.Nothing; - } else { - MessageService.ShowError (GettextCatalog.GetString ("File {0} not found in {1}.", name, project.Name)); - success = false; - } - } - return success; - } - } - - -} diff --git a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CustomCommandPanel.cs b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CustomCommandPanel.cs index e7df3987db..d2227ad007 100644 --- a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CustomCommandPanel.cs +++ b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CustomCommandPanel.cs @@ -27,41 +27,30 @@ using System; +using System.Collections.Generic; using MonoDevelop.Core.Gui.Dialogs; using MonoDevelop.Projects; using MonoDevelop.Core; namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels { - internal class CustomCommandPanel: AbstractOptionPanel + internal class CustomCommandPanel: MultiConfigItemOptionsPanel { - AbstractConfiguration configuration; - CustomCommandCollection commands; + CustomCommandPanelWidget widget; - public override void LoadPanelContents () + public override Gtk.Widget CreatePanelWidget () { - Properties props = (Properties) CustomizationObject; - configuration = props.Get<AbstractConfiguration> ("Config"); - if (configuration != null) { - CombineEntry entry = props.Get<CombineEntry> ("CombineEntry"); - commands = configuration.CustomCommands.Clone (); - Add (new CustomCommandPanelWidget (entry, commands)); - } + return (widget = new CustomCommandPanelWidget ()); + } + + public override void LoadConfigData () + { + widget.Load (ConfiguredSolutionItem, CurrentConfiguration.CustomCommands); } - public override bool StorePanelContents () + public override void ApplyChanges () { - if (configuration != null) { - configuration.CustomCommands.CopyFrom (commands); - // Remove empty commands - for (int n=0; n<configuration.CustomCommands.Count; n++) { - if (configuration.CustomCommands [n].Command == "") { - configuration.CustomCommands.RemoveAt (n); - n--; - } - } - } - return true; + // Do nothing. Changes to cloned configurations are automatically applied. } } } diff --git a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CustomCommandPanelWidget.cs b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CustomCommandPanelWidget.cs index 6fbe9f6f0d..c8f54f443a 100644 --- a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CustomCommandPanelWidget.cs +++ b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CustomCommandPanelWidget.cs @@ -35,14 +35,26 @@ namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels { CustomCommandCollection commands; CustomCommandWidget lastSlot; - CombineEntry entry; + SolutionEntityItem entry; - public CustomCommandPanelWidget (CombineEntry entry, CustomCommandCollection commands) + public CustomCommandPanelWidget () { this.Build(); + } + + public void Load (SolutionEntityItem entry, CustomCommandCollection commands) + { this.entry = entry; this.commands = commands; + // Clean the list + foreach (CustomCommandWidget ccw in vboxCommands.Children) { + ccw.CommandCreated -= OnCommandCreated; + ccw.CommandRemoved -= OnCommandRemoved; + vboxCommands.Remove (ccw); + ccw.Destroy (); + } + foreach (CustomCommand cmd in commands) { AddCommandSlot (cmd); } diff --git a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CustomCommandWidget.cs b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CustomCommandWidget.cs index 8911a5c095..5e7c566fd0 100644 --- a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CustomCommandWidget.cs +++ b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CustomCommandWidget.cs @@ -37,7 +37,7 @@ namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels internal partial class CustomCommandWidget : Gtk.Bin { CustomCommand cmd; - CombineEntry entry; + IWorkspaceObject entry; bool updating; // snatched from MonoDevelop.Ide.Gui.OptionPanels/ExternalToolPanel.cs @@ -67,21 +67,33 @@ namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels // }; static string[,] projectWorkingDirInsertMenu = new string[,] { + // Keep in sync with CustomCommand.cs {GettextCatalog.GetString ("_Target Directory"), "${TargetDir}"}, - {GettextCatalog.GetString ("Target Name"), "${TargetName}"}, + {GettextCatalog.GetString ("Target _Name"), "${TargetName}"}, {"-", ""}, - {GettextCatalog.GetString ("_Project Directory"), "${ProjectDir}"}, + {GettextCatalog.GetString ("_Project Directory"), "${ItemDir}"}, + {GettextCatalog.GetString ("P_roject Name"), "${ItemName}"}, {"-", ""}, - {GettextCatalog.GetString ("_Root Solution Directory"), "${CombineDir}"}, + {GettextCatalog.GetString ("_Solution Directory"), "${SolutionDir}"}, + {GettextCatalog.GetString ("So_lution Name"), "${SolutionName}"}, }; static string[,] entryWorkingDirInsertMenu = new string[,] { - {GettextCatalog.GetString ("_Project Directory"), "${ProjectDir}"}, + // Keep in sync with CustomCommand.cs + {GettextCatalog.GetString ("Solution _Item Directory"), "${ItemDir}"}, + {GettextCatalog.GetString ("Solution Item _Name"), "${ItemName}"}, {"-", ""}, - {GettextCatalog.GetString ("_Root Solution Directory"), "${CombineDir}"}, + {GettextCatalog.GetString ("_Solution Directory"), "${SolutionDir}"}, + {GettextCatalog.GetString ("So_lution Name"), "${SolutionName}"}, }; - public CustomCommandWidget (CombineEntry entry, CustomCommand cmd) + static string[,] solutionWorkingDirInsertMenu = new string[,] { + // Keep in sync with CustomCommand.cs + {GettextCatalog.GetString ("_Solution Directory"), "${SolutionDir}"}, + {GettextCatalog.GetString ("So_lution Name"), "${SolutionName}"}, + }; + + public CustomCommandWidget (IWorkspaceObject entry, CustomCommand cmd) { this.Build(); this.cmd = cmd; @@ -95,7 +107,14 @@ namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels UpdateControls (); this.WidgetFlags |= Gtk.WidgetFlags.NoShowAll; - string[,] workingDirInsertMenu = entry is Project? projectWorkingDirInsertMenu : entryWorkingDirInsertMenu; + string[,] workingDirInsertMenu; + if (entry is Project) + workingDirInsertMenu = projectWorkingDirInsertMenu; + else if (entry is SolutionEntityItem) + workingDirInsertMenu = entryWorkingDirInsertMenu; + else + workingDirInsertMenu = solutionWorkingDirInsertMenu; + new MenuButtonEntry (workingdirEntry, workingdirQuickInsertButton, workingDirInsertMenu); } diff --git a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/GeneralProjectOptions.cs b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/GeneralProjectOptions.cs index 25c5e15a96..6661b95e41 100644 --- a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/GeneralProjectOptions.cs +++ b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/GeneralProjectOptions.cs @@ -33,19 +33,18 @@ using MonoDevelop.Components; namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels { - internal class GeneralProjectOptions : AbstractOptionPanel + internal class GeneralProjectOptions : ItemOptionsPanel { GeneralProjectOptionsWidget widget; - public override void LoadPanelContents() + public override Widget CreatePanelWidget() { - Add (widget = new GeneralProjectOptionsWidget ((Properties) CustomizationObject)); + return (widget = new GeneralProjectOptionsWidget (ConfiguredProject)); } - public override bool StorePanelContents() + public override void ApplyChanges() { - widget.Store ((Properties) CustomizationObject); - return true; + widget.Store (); } } @@ -53,21 +52,24 @@ namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels { Project project; - public GeneralProjectOptionsWidget (Properties CustomizationObject) + public GeneralProjectOptionsWidget (Project project) { Build (); - this.project = ((Properties)CustomizationObject).Get<Project> ("Project"); + this.project = project; nameLabel.UseUnderline = true; descriptionLabel.UseUnderline = true; projectNameEntry.Text = project.Name; - projectDefaultNamespaceEntry.Text = project.DefaultNamespace; parentDirectoryNamespaceCheckButton.Active = project.UseParentDirectoryAsNamespace; projectDescriptionTextView.Buffer.Text = project.Description; + // TODO msbuild Move to build panel? + if (project is DotNetProject) + projectDefaultNamespaceEntry.Text = ((DotNetProject)project).DefaultNamespace; + switch (project.NewFileSearch) { case NewFileSearch.None: @@ -103,12 +105,13 @@ namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels projectDefaultNamespaceEntry.Sensitive = !parentDirectoryNamespaceCheckButton.Active; } - public void Store (Properties CustomizationObject) + public void Store () { project.Name = projectNameEntry.Text; - project.DefaultNamespace = projectDefaultNamespaceEntry.Text; project.UseParentDirectoryAsNamespace = parentDirectoryNamespaceCheckButton.Active; project.Description = projectDescriptionTextView.Buffer.Text; + if (project is DotNetProject) + ((DotNetProject)project).DefaultNamespace = projectDefaultNamespaceEntry.Text; if (newFilesOnLoadCheckButton.Active) { project.NewFileSearch = autoInsertNewFilesCheckButton.Active ? NewFileSearch.OnLoadAutoInsert : NewFileSearch.OnLoad; diff --git a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/OutputOptionsPanel.cs b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/OutputOptionsPanel.cs index 10ba244490..0ddc5cfa99 100644 --- a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/OutputOptionsPanel.cs +++ b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/OutputOptionsPanel.cs @@ -31,19 +31,34 @@ using Gtk; namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels { - internal class OutputOptionsPanel : AbstractOptionPanel + internal class OutputOptionsPanel : MultiConfigItemOptionsPanel { OutputOptionsPanelWidget widget; - public override void LoadPanelContents() + + public override bool IsVisible () + { + return ConfiguredProject is DotNetProject; + } + + public override Widget CreatePanelWidget() + { + return (widget = new OutputOptionsPanelWidget ()); + } + + public override bool ValidateChanges () { - Add (widget = new OutputOptionsPanelWidget ((Properties) CustomizationObject)); + return widget.ValidateChanges (); } - public override bool StorePanelContents() + public override void LoadConfigData () { - bool result = true; - result = widget.Store (); - return result; + widget.Load (ConfiguredProject, (DotNetProjectConfiguration) CurrentConfiguration); + } + + + public override void ApplyChanges() + { + widget.Store (); } } @@ -51,15 +66,16 @@ namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels partial class OutputOptionsPanelWidget : Gtk.Bin { DotNetProjectConfiguration configuration; - Project project; - public OutputOptionsPanelWidget(Properties CustomizationObject) - { + public OutputOptionsPanelWidget () + { Build (); - configuration = ((Properties)CustomizationObject).Get<DotNetProjectConfiguration>("Config"); - project = ((Properties)CustomizationObject).Get<Project>("Project"); externalConsoleCheckButton.Toggled += new EventHandler (ExternalConsoleToggle); - + } + + public void Load (Project project, DotNetProjectConfiguration config) + { + this.configuration = config; assemblyNameEntry.Text = configuration.OutputAssembly; parametersEntry.Text = configuration.CommandLineParameters; @@ -69,12 +85,11 @@ namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels externalConsoleCheckButton.Active = configuration.ExternalConsole; pauseConsoleOutputCheckButton.Active = configuration.PauseConsoleOutput; - if (!externalConsoleCheckButton.Active) - pauseConsoleOutputCheckButton.Sensitive = false; + pauseConsoleOutputCheckButton.Sensitive = externalConsoleCheckButton.Active; } - public bool Store () - { + public bool ValidateChanges () + { if (configuration == null) { return true; } @@ -89,12 +104,19 @@ namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels return false; } + return true; + } + + public void Store () + { + if (configuration == null) + return; + configuration.OutputAssembly = assemblyNameEntry.Text; configuration.OutputDirectory = outputPathEntry.Path; configuration.CommandLineParameters = parametersEntry.Text; configuration.ExternalConsole = externalConsoleCheckButton.Active; configuration.PauseConsoleOutput = pauseConsoleOutputCheckButton.Active; - return true; } void ExternalConsoleToggle (object sender, EventArgs e) diff --git a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/RuntimeOptionsPanel.cs b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/RuntimeOptionsPanel.cs index 36be393aa0..37c7463896 100644 --- a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/RuntimeOptionsPanel.cs +++ b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/RuntimeOptionsPanel.cs @@ -31,7 +31,7 @@ using System.Collections; using System.IO; using MonoDevelop.Projects; -using MonoDevelop.Core.Gui.Dialogs; +using MonoDevelop.Projects.Gui.Dialogs; using MonoDevelop.Components; using MonoDevelop.Core; @@ -39,20 +39,23 @@ using Gtk; namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels { - internal class RuntimeOptionsPanel : AbstractOptionPanel + internal class RuntimeOptionsPanel : ItemOptionsPanel { RuntimeOptionsPanelWidget widget; - public override void LoadPanelContents() + public override bool IsVisible () { - Add (widget = new RuntimeOptionsPanelWidget ((Properties) CustomizationObject)); + return ConfiguredProject is DotNetProject; } - public override bool StorePanelContents() + public override Widget CreatePanelWidget() { - bool result = true; - result = widget.Store (); - return result; + return (widget = new RuntimeOptionsPanelWidget ((DotNetProject)ConfiguredProject)); + } + + public override void ApplyChanges() + { + widget.Store (); } } @@ -61,11 +64,11 @@ namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels DotNetProject project; ArrayList supportedVersions = new ArrayList (); - public RuntimeOptionsPanelWidget (Properties CustomizationObject) + public RuntimeOptionsPanelWidget (DotNetProject project) { Build (); - project = ((Properties)CustomizationObject).Get<DotNetProject>("Project") ; + this.project = project; if (project != null) { // Get the list of available versions, and add only those supported by the target language. ClrVersion[] langSupported = project.LanguageBinding.GetSupportedClrVersions (); @@ -98,13 +101,11 @@ namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels Sensitive = false; } - public bool Store () + public void Store () { if (project == null || runtimeVersionCombo.Active == -1) - return true; - + return; project.ClrVersion = (ClrVersion) supportedVersions [runtimeVersionCombo.Active]; - return true; } } } diff --git a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineEntryConfigurationsPanel.cs b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/SolutionItemConfigurationsPanel.cs index 51048f0778..c1f8905f88 100644 --- a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineEntryConfigurationsPanel.cs +++ b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels/SolutionItemConfigurationsPanel.cs @@ -1,5 +1,5 @@ // -// CombineEntryConfigurationsPanel.cs +// SolutionItemConfigurationsPanel.cs // // Author: // Lluis Sanchez Gual @@ -28,6 +28,7 @@ using System; using System.Collections; +using System.Collections.Generic; using System.Reflection; using MonoDevelop.Projects; @@ -39,19 +40,19 @@ using Gtk; namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels { - internal class CombineEntryConfigurationsPanel : AbstractOptionPanel + internal class SolutionItemConfigurationsPanel : ItemOptionsPanel { CombineEntryConfigurationsPanelWidget widget; - public override void LoadPanelContents() + public override Widget CreatePanelWidget () { - Add (widget = new CombineEntryConfigurationsPanelWidget ((Properties) CustomizationObject)); + MultiConfigItemOptionsDialog dlg = (MultiConfigItemOptionsDialog) ParentDialog; + return (widget = new CombineEntryConfigurationsPanelWidget (dlg)); } - public override bool StorePanelContents() + public override void ApplyChanges() { - bool success = widget.Store (); - return success; + widget.Store (); } } @@ -60,12 +61,11 @@ namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels TreeStore store; ConfigurationData configData; - public CombineEntryConfigurationsPanelWidget (Properties CustomizationObject) + public CombineEntryConfigurationsPanelWidget (MultiConfigItemOptionsDialog dlg) { Build (); -// combine = (Combine)((Properties)CustomizationObject).Get("Combine"); - configData = ((Properties)CustomizationObject).Get<ConfigurationData>("CombineConfigData"); + configData = dlg.ConfigurationData; store = new TreeStore (typeof(object), typeof(string)); configsList.Model = store; @@ -78,8 +78,8 @@ namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels col.Title = GettextCatalog.GetString ("Configuration"); configsList.AppendColumn (col); - foreach (CombineConfiguration cc in configData.Configurations) - store.AppendValues (cc, cc.Name); + foreach (ItemConfiguration cc in configData.Configurations) + store.AppendValues (cc, cc.Id); addButton.Clicked += new EventHandler (OnAddConfiguration); removeButton.Clicked += new EventHandler (OnRemoveConfiguration); @@ -99,8 +99,8 @@ namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels if (!configsList.Selection.GetSelected (out foo, out iter)) return; - CombineConfiguration cc = (CombineConfiguration) store.GetValue (iter, 0); - AddConfiguration (cc.Name); + ItemConfiguration cc = (ItemConfiguration) store.GetValue (iter, 0); + AddConfiguration (cc.Id); } void AddConfiguration (string copyFrom) @@ -115,8 +115,8 @@ namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels } else if (configData.Configurations [dlg.ConfigName] != null) { MessageService.ShowWarning (GettextCatalog.GetString ("A configuration with the name '{0}' already exists.", dlg.ConfigName)); } else { - CombineConfiguration cc = (CombineConfiguration) configData.AddConfiguration (dlg.ConfigName, copyFrom, dlg.CreateChildren); - store.AppendValues (cc, cc.Name); + ItemConfiguration cc = configData.AddConfiguration (dlg.ConfigName, copyFrom, dlg.CreateChildren); + store.AppendValues (cc, cc.Id); done = true; } } else @@ -139,12 +139,12 @@ namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels return; } - CombineConfiguration cc = (CombineConfiguration) store.GetValue (iter, 0); + ItemConfiguration cc = (ItemConfiguration) store.GetValue (iter, 0); DeleteConfigDialog dlg = new DeleteConfigDialog (); try { if (dlg.Run () == (int) Gtk.ResponseType.Yes) { - configData.RemoveConfiguration (cc.Name, dlg.DeleteChildren); + configData.RemoveConfiguration (cc.Id, dlg.DeleteChildren); store.Remove (ref iter); } } finally { @@ -159,9 +159,9 @@ namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels if (!configsList.Selection.GetSelected (out foo, out iter)) return; - CombineConfiguration cc = (CombineConfiguration) store.GetValue (iter, 0); + ItemConfiguration cc = (ItemConfiguration) store.GetValue (iter, 0); RenameConfigDialog dlg = new RenameConfigDialog (); - dlg.ConfigName = cc.Name; + dlg.ConfigName = cc.Id; try { bool done = false; @@ -172,8 +172,8 @@ namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels } else if (configData.Configurations [dlg.ConfigName] != null) { MessageService.ShowWarning (GettextCatalog.GetString ("A configuration with the name '{0}' already exists.", dlg.ConfigName)); } else { - configData.RenameConfiguration (cc.Name, dlg.ConfigName, dlg.RenameChildren); - store.SetValue (iter, 1, cc.Name); + configData.RenameConfiguration (cc.Id, dlg.ConfigName, dlg.RenameChildren); + store.SetValue (iter, 1, cc.Id); done = true; } } else diff --git a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs/CombineOptionsDialog.cs b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs/CombineOptionsDialog.cs index 8893c16b1b..ab0a169894 100644 --- a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs/CombineOptionsDialog.cs +++ b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs/CombineOptionsDialog.cs @@ -28,6 +28,7 @@ using System; using System.Collections; +using System.Collections.Generic; using System.ComponentModel; using Mono.Addins; @@ -37,202 +38,11 @@ using MonoDevelop.Core.Gui.Dialogs; namespace MonoDevelop.Projects.Gui.Dialogs { - public class CombineOptionsDialog : TreeViewOptions + public class CombineOptionsDialog : MultiConfigItemOptionsDialog { - Combine combine; - - ExtensionNode configurationNode; - ConfigurationData configData; - Gtk.TreeIter configIter; - - public CombineOptionsDialog (Gtk.Window parentWindow, Combine combine, ExtensionNode node, ExtensionNode configurationNode) : base (parentWindow, null, null) + public CombineOptionsDialog (Gtk.Window parentWindow, Solution solution) : base (parentWindow, solution, "/MonoDevelop/ProjectModel/Gui/SolutionOptions") { - this.combine = combine; - this.configurationNode = configurationNode; - this.Title = GettextCatalog.GetString ("Solution Options") + " - " + combine.Name; - - configData = ConfigurationData.Build (combine); - configData.ConfigurationsChanged += new EventHandler (OnConfigChanged); - - properties = new Properties(); - properties.Set ("Combine", combine); - properties.Set ("CombineEntry", combine); - properties.Set ("CombineConfigData", configData); - - AddNodes (properties, Gtk.TreeIter.Zero, node.GetChildObjects (false)); - - SelectFirstNode (); + this.Title = GettextCatalog.GetString ("Solution Options") + " - " + solution.Name; } - - protected override bool StoreContents () - { - if (base.StoreContents ()) - configData.Update (); - return true; - } - - void OnConfigChanged (object o, EventArgs a) - { - Gtk.TreeIter iter; - if (treeStore.IterChildren (out iter, configIter)) { - while (treeStore.Remove (ref iter)); - } - FillConfigurations (); - Gtk.TreePath path = treeStore.GetPath (configIter); - TreeView.ExpandRow (path, false); - } - - void FillConfigurations () - { - foreach (IConfiguration config in configData.Configurations) { - Properties configNodeProperties = new Properties(); - configNodeProperties.Set("Combine", combine); - configNodeProperties.Set("CombineEntry", combine); - configNodeProperties.Set("Config", config); - configNodeProperties.Set ("CombineConfigData", configData); - - object[] list = configurationNode.GetChildObjects (false); - if (list.Length > 1) { - Gtk.TreeIter newNode = AddPath (config.Name, configIter); - AddNodes (configNodeProperties, newNode, list); - } else { - AddNode (config.Name, configNodeProperties, configIter, (IDialogPanelDescriptor) list [0]); - } - } - } - - protected override void AddChildNodes (object customizer, Gtk.TreeIter iter, IDialogPanelDescriptor descriptor) - { - if (descriptor.ID != "Configurations") { - base.AddChildNodes (customizer, iter, descriptor); - } else { - configIter = iter; - FillConfigurations (); - TreeView.ExpandRow (treeStore.GetPath (configIter), false); - } - } - - protected override void OnSelectNode (Gtk.TreeIter iter, IDialogPanelDescriptor descriptor) - { - base.OnSelectNode (iter, descriptor); - if (descriptor != null && descriptor.ID == "Configurations") { - Gtk.TreePath path = treeStore.GetPath (iter); - TreeView.ExpandRow (path, false); - } - } - } - - class ConfigurationData - { - public ConfigurationCollection Configurations = new ConfigurationCollection (); - public ArrayList Children = new ArrayList (); - public CombineEntry Entry; - - public ConfigurationData (CombineEntry entry) - { - this.Entry = entry; - } - - public static ConfigurationData Build (CombineEntry entry) - { - ConfigurationData data = new ConfigurationData (entry); - foreach (IConfiguration conf in entry.Configurations) { - IConfiguration copy = entry.CreateConfiguration (conf.Name); - if (copy != null) { - copy.CopyFrom (conf); - data.Configurations.Add (copy); - } - } - if (entry is Combine) { - foreach (CombineEntry e in ((Combine)entry).Entries) - data.Children.Add (ConfigurationData.Build (e)); - } - return data; - } - - public void Update () - { - foreach (IConfiguration conf in Configurations) { - IConfiguration old = Entry.Configurations [conf.Name]; - if (old != null) { - old.CopyFrom (conf); - } else { - Entry.Configurations.Add (conf); - } - } - ArrayList toRemove = new ArrayList (); - foreach (IConfiguration conf in Entry.Configurations) { - if (Configurations [conf.Name] == null) - toRemove.Add (conf); - } - - foreach (IConfiguration conf in toRemove) - Entry.Configurations.Remove (conf); - - foreach (ConfigurationData data in Children) - data.Update (); - } - - public IConfiguration AddConfiguration (string name, string sourceName, bool createChildConfigurations) - { - IConfiguration conf = Entry.CreateConfiguration (name); - if (sourceName != null) { - IConfiguration sc = Configurations [sourceName]; - if (sc != null) - conf.CopyFrom (sc); - } - - if (Entry is Combine) { - CombineConfiguration cc = (CombineConfiguration) conf; - foreach (ConfigurationData data in Children) { - CombineConfigurationEntry ce = cc.AddEntry (data.Entry); - if (createChildConfigurations) { - ce.ConfigurationName = name; - if (data.Configurations [name] == null) - data.AddConfiguration (name, sourceName, createChildConfigurations); - } else { - if (data.Configurations.Count > 0) - ce.ConfigurationName = data.Configurations [0].Name; - } - } - } - - Configurations.Add (conf); - if (ConfigurationsChanged != null) - ConfigurationsChanged (this, null); - return conf; - } - - public void RemoveConfiguration (string name, bool removeChildConfigurations) - { - Configurations.Remove (name); - if (removeChildConfigurations) { - foreach (ConfigurationData data in Children) - data.RemoveConfiguration (name, true); - } - if (ConfigurationsChanged != null) - ConfigurationsChanged (this, null); - } - - public void RenameConfiguration (string oldName, string newName, bool renameChildConfigurations) - { - IConfiguration cc = Configurations [oldName]; - if (cc != null) { - IConfiguration nc = Entry.CreateConfiguration (newName); - nc.CopyFrom (cc); - Configurations.Remove (oldName); - Configurations.Add (nc); - if (ConfigurationsChanged != null) - ConfigurationsChanged (this, null); - } - if (renameChildConfigurations) { - foreach (ConfigurationData data in Children) - data.RenameConfiguration (oldName, newName, true); - } - if (ConfigurationsChanged != null) - ConfigurationsChanged (this, null); - } - - public event EventHandler ConfigurationsChanged; } } diff --git a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs/ItemOptionsPanel.cs b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs/ItemOptionsPanel.cs new file mode 100644 index 0000000000..357a419695 --- /dev/null +++ b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs/ItemOptionsPanel.cs @@ -0,0 +1,72 @@ +// SolutionItemOptionsPanel.cs +// +// Author: +// Lluis Sanchez Gual <lluis@novell.com> +// +// Copyright (c) 2008 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +// + +using System; +using MonoDevelop.Core; +using MonoDevelop.Core.Gui.Dialogs; + +namespace MonoDevelop.Projects.Gui.Dialogs +{ + public abstract class ItemOptionsPanel: OptionsPanel + { + SolutionEntityItem solutionItem; + WorkspaceItem workspaceItem; + + public SolutionEntityItem ConfiguredSolutionItem { + get { + return solutionItem; + } + } + + public Project ConfiguredProject { + get { return solutionItem as Project; } + } + + public WorkspaceItem ConfiguredWorkspaceItem { + get { + return workspaceItem; + } + } + + public Solution ConfiguredSolution { + get { + return workspaceItem as Solution; + } + } + + public override void Initialize (OptionsDialog dialog, object dataObject) + { + base.Initialize (dialog, dataObject); + + solutionItem = dataObject as SolutionEntityItem; + if (solutionItem != null) + workspaceItem = solutionItem.ParentSolution; + else + workspaceItem = dataObject as WorkspaceItem; + } + } +} diff --git a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs/MultiConfigItemOptionsDialog.cs b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs/MultiConfigItemOptionsDialog.cs new file mode 100644 index 0000000000..48888faa58 --- /dev/null +++ b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs/MultiConfigItemOptionsDialog.cs @@ -0,0 +1,218 @@ +// MultiConfigItemOptionsDialog.cs +// +// Author: +// Lluis Sanchez Gual <lluis@novell.com> +// +// Copyright (c) 2008 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +// + +using System; +using System.Collections.Generic; +using MonoDevelop.Core; +using MonoDevelop.Core.Gui.Dialogs; + +namespace MonoDevelop.Projects.Gui.Dialogs +{ + public class MultiConfigItemOptionsDialog: OptionsDialog + { + ConfigurationData configData; + string currentConfig; + string currentPlatform; + + public MultiConfigItemOptionsDialog (string extensionPath): this (null, null, extensionPath) + { + } + + public MultiConfigItemOptionsDialog (Gtk.Window parentWindow, object dataObject, string extensionPath): base (parentWindow, dataObject, extensionPath) + { + IConfigurationTarget ct = DataObject as IConfigurationTarget; + if (ct == null) + throw new System.InvalidOperationException ("MultiConfigItemOptionsDialog can only be used for SolutionEntityItem and Solution objects"); + if (ct.DefaultConfiguration != null) { + currentConfig = ct.DefaultConfiguration.Name; + currentPlatform = ct.DefaultConfiguration.Platform; + } + } + + internal ConfigurationData ConfigurationData { + get { + if (configData == null) { + IConfigurationTarget ct = (IConfigurationTarget) DataObject; + configData = MonoDevelop.Projects.Gui.Dialogs.ConfigurationData.Build (ct); + } + return configData; + } + } + + protected override void ApplyChanges () + { + base.ApplyChanges (); + + if (configData != null) + configData.Update (); + } + + + public string CurrentConfig { + get { + return currentConfig; + } + set { + currentConfig = value; + } + } + + public string CurrentPlatform { + get { + return currentPlatform; + } + set { + currentPlatform = value; + } + } + } + + public class ConfigurationData + { + ItemConfigurationCollection<ItemConfiguration> configurations = new ItemConfigurationCollection<ItemConfiguration> (); + IConfigurationTarget entry; + List<ConfigurationData> children = new List<ConfigurationData> (); + + internal ConfigurationData (IConfigurationTarget obj) + { + this.entry = obj; + } + + internal static ConfigurationData Build (IConfigurationTarget entry) + { + ConfigurationData data = new ConfigurationData (entry); + + foreach (ItemConfiguration conf in entry.Configurations) { + ItemConfiguration copy = (ItemConfiguration) conf.Clone (); + data.Configurations.Add (copy); + } + if (entry is Solution) { + foreach (SolutionItem e in ((Solution)entry).Items) { + if (e is SolutionEntityItem) + data.children.Add (ConfigurationData.Build ((SolutionEntityItem) e)); + } + } + return data; + } + + public IConfigurationTarget Entry { + get { return entry; } + } + + public ItemConfigurationCollection<ItemConfiguration> Configurations { + get { + return configurations; + } + } + + public void Update () + { + foreach (ItemConfiguration conf in configurations) { + ItemConfiguration old = entry.Configurations [conf.Id]; + if (old != null) { + old.CopyFrom (conf); + } else { + entry.Configurations.Add (conf); + } + } + List<ItemConfiguration> toRemove = new List<ItemConfiguration> (); + foreach (ItemConfiguration conf in entry.Configurations) { + if (configurations [conf.Id] == null) + toRemove.Add (conf); + } + + foreach (ItemConfiguration conf in toRemove) + entry.Configurations.Remove (conf); + + foreach (ConfigurationData data in children) + data.Update (); + } + + public ItemConfiguration AddConfiguration (string name, string sourceName, bool createChildConfigurations) + { + ItemConfiguration conf = entry.CreateConfiguration (name); + + if (sourceName != null) { + ItemConfiguration sc = configurations [sourceName]; + if (sc != null) + conf.CopyFrom (sc); + } + + if (entry is Solution) { + SolutionConfiguration cc = (SolutionConfiguration) conf; + foreach (ConfigurationData data in children) { + SolutionConfigurationEntry ce = cc.AddItem ((SolutionEntityItem) data.Entry); + if (createChildConfigurations) { + ce.ItemConfiguration = name; + if (data.Configurations [name] == null) + data.AddConfiguration (name, sourceName, createChildConfigurations); + } else { + if (data.Configurations.Count > 0) + ce.ItemConfiguration = data.Configurations [0].Id; + } + } + } + + configurations.Add (conf); + if (ConfigurationsChanged != null) + ConfigurationsChanged (this, null); + return conf; + } + + public void RemoveConfiguration (string name, bool removeChildConfigurations) + { + configurations.Remove (name); + if (removeChildConfigurations) { + foreach (ConfigurationData data in children) + data.RemoveConfiguration (name, true); + } + if (ConfigurationsChanged != null) + ConfigurationsChanged (this, null); + } + + public void RenameConfiguration (string oldName, string newName, bool renameChildConfigurations) + { + ItemConfiguration cc = configurations [oldName]; + if (cc != null) { + ItemConfiguration nc = entry.CreateConfiguration (newName); + nc.CopyFrom (cc); + configurations.Remove (oldName); + configurations.Add (nc); + if (ConfigurationsChanged != null) + ConfigurationsChanged (this, null); + } + if (renameChildConfigurations) { + foreach (ConfigurationData data in children) + data.RenameConfiguration (oldName, newName, true); + } + if (ConfigurationsChanged != null) + ConfigurationsChanged (this, null); + } + + public event EventHandler ConfigurationsChanged; + } +} diff --git a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs/MultiConfigItemOptionsPanel.cs b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs/MultiConfigItemOptionsPanel.cs new file mode 100644 index 0000000000..1ac0c6ffb7 --- /dev/null +++ b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs/MultiConfigItemOptionsPanel.cs @@ -0,0 +1,299 @@ +// MultiConfigItemOptionsPanel.cs +// +// Author: +// Lluis Sanchez Gual <lluis@novell.com> +// +// Copyright (c) 2008 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +// + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using MonoDevelop.Core; +using MonoDevelop.Core.Gui.Dialogs; + +namespace MonoDevelop.Projects.Gui.Dialogs +{ + public abstract class MultiConfigItemOptionsPanel: ItemOptionsPanel, IOptionsPanel + { + MultiConfigItemOptionsDialog dialog; + Gtk.ComboBox configCombo; + Gtk.ComboBox platformCombo; + List<ItemConfiguration> currentConfigs = new List<ItemConfiguration> (); + List<string> platforms = new List<string> (); + + bool loading; + bool widgetCreated; + bool allowMixedConfigurations; + int lastConfigSelection = -1; + int lastPlatformSelection = -1; + + public ConfigurationData ConfigurationData { + get { return dialog.ConfigurationData; } + } + + public override void Initialize (OptionsDialog dialog, object dataObject) + { + base.Initialize (dialog, dataObject); + this.dialog = dialog as MultiConfigItemOptionsDialog; + if (this.dialog == null) + throw new System.InvalidOperationException ("MultiConfigItemOptionsPanel can only be used in options dialogs of type MultiConfigItemOptionsDialog"); + this.dialog.ConfigurationData.ConfigurationsChanged += OnConfigurationsChanged; + } + + + + public ItemConfiguration CurrentConfiguration { + get { + if (allowMixedConfigurations) + throw new System.InvalidOperationException ("The options panel is working in multiple configuration selection mode (AllowMixedConfigurations=true). Use the property CurrentConfigurations to get the list of all selected configurations."); + return currentConfigs [0]; + } + } + + public ItemConfiguration[] CurrentConfigurations { + get { + if (!allowMixedConfigurations) + throw new System.InvalidOperationException ("The options panel is working in single configuration selection mode (AllowMixedConfigurations=false). Use the property CurrentConfiguration to get the selected configuration."); + return currentConfigs.ToArray (); + } + } + + // Set to true to allow the user changing data of several configurations + // at the same time + public bool AllowMixedConfigurations { + get { + return allowMixedConfigurations; + } + set { + allowMixedConfigurations = value; + if (widgetCreated) { + FillConfigurations (); + UpdateSelection (); + } + } + } + + Gtk.Widget IOptionsPanel.CreatePanelWidget () + { + Gtk.VBox cbox = new Gtk.VBox (false, 6); + Gtk.HBox combosBox = new Gtk.HBox (false, 6); + cbox.PackStart (combosBox, false, false, 0); + combosBox.PackStart (new Gtk.Label (GettextCatalog.GetString ("Configuration:")), false, false, 0); + configCombo = Gtk.ComboBox.NewText (); + combosBox.PackStart (configCombo, false, false, 0); + combosBox.PackStart (new Gtk.Label (GettextCatalog.GetString ("Platform:")), false, false, 0); + platformCombo = Gtk.ComboBox.NewText (); + combosBox.PackStart (platformCombo, false, false, 0); + cbox.PackStart (new Gtk.HSeparator (), false, false, 0); + cbox.ShowAll (); + + cbox.Shown += OnPageShown; + + lastConfigSelection = -1; + lastPlatformSelection = -1; + + FillConfigurations (); + UpdateSelection (); + + configCombo.Changed += OnConfigChanged; + platformCombo.Changed += OnConfigChanged; + + bool oldMixed = allowMixedConfigurations; + cbox.PackStart (CreatePanelWidget (), true, true, 0); + + if (allowMixedConfigurations != oldMixed) { + // If mixed mode has changed, update the configuration list + FillConfigurations (); + UpdateSelection (); + } + widgetCreated = true; + + LoadConfigData (); + + return cbox; + } + + void FillConfigurations () + { + loading = true; + ((Gtk.ListStore)configCombo.Model).Clear (); + + if (allowMixedConfigurations) + configCombo.AppendText (GettextCatalog.GetString ("All Configurations")); + + foreach (ItemConfiguration config in dialog.ConfigurationData.Configurations) + configCombo.AppendText (config.Name); + + loading = false; + } + + void FillPlatforms () + { + loading = true; + + ((Gtk.ListStore)platformCombo.Model).Clear (); + platforms.Clear (); + + string configName = null; + if (!allowMixedConfigurations || configCombo.Active > 0) { + int i = configCombo.Active; + if (allowMixedConfigurations) + i--; + ItemConfiguration config = dialog.ConfigurationData.Configurations [i]; + configName = config.Name; + } + + foreach (ItemConfiguration config in dialog.ConfigurationData.Configurations) { + if ((configName == null || config.Name == configName) && !platforms.Contains (config.Platform)) { + platforms.Add (config.Platform); + if (config.Platform.Length > 0) + platformCombo.AppendText (config.Platform); + else + platformCombo.AppendText (GettextCatalog.GetString ("Any CPU")); + } + } + loading = false; + } + + void OnConfigChanged (object s, EventArgs a) + { + if (loading) + return; + + if (!ValidateChanges ()) { + loading = true; + configCombo.Active = lastConfigSelection; + platformCombo.Active = lastPlatformSelection; + loading = false; + return; + } + + if (s == configCombo) { + FillPlatforms (); + SelectPlatform (dialog.CurrentPlatform); + } + + UpdateCurrentConfiguration (); + } + + void UpdateCurrentConfiguration () + { + lastConfigSelection = configCombo.Active; + lastPlatformSelection = platformCombo.Active; + + if (widgetCreated) + ApplyChanges (); + + currentConfigs.Clear (); + + string configName = dialog.CurrentConfig = configCombo.ActiveText; + if (configName == GettextCatalog.GetString ("All Configurations")) + configName = null; + + string platform = dialog.CurrentPlatform = platformCombo.ActiveText; + if (platform == GettextCatalog.GetString ("Any CPU")) + platform = string.Empty; + + foreach (ItemConfiguration config in dialog.ConfigurationData.Configurations) { + if ((configName == null || config.Name == configName) && config.Platform == platform) + currentConfigs.Add (config); + } + + if (widgetCreated && currentConfigs.Count > 0) + LoadConfigData (); + } + + void OnConfigurationsChanged (object s, EventArgs a) + { + if (!widgetCreated) + return; + FillConfigurations (); + UpdateSelection (); + } + + void UpdateSelection () + { + SelectConfiguration (dialog.CurrentConfig); + if (lastConfigSelection != configCombo.Active) + FillPlatforms (); + + SelectPlatform (dialog.CurrentPlatform); + if (lastConfigSelection != configCombo.Active || lastPlatformSelection != platformCombo.Active) + UpdateCurrentConfiguration (); + } + + void OnPageShown (object s, EventArgs a) + { + UpdateSelection (); + } + + void SelectConfiguration (string config) + { + loading = true; + + Gtk.TreeIter it; + if (configCombo.Model.GetIterFirst (out it)) { + do { + if (config == (string) configCombo.Model.GetValue (it, 0)) { + configCombo.SetActiveIter (it); + break; + } + } + while (configCombo.Model.IterNext (ref it)); + } + + if (configCombo.Active == -1) + configCombo.Active = 0; + + loading = false; + } + + void SelectPlatform (string platform) + { + loading = true; + + Gtk.TreeIter it; + if (platformCombo.Model.GetIterFirst (out it)) { + do { + if (platform == (string) platformCombo.Model.GetValue (it, 0)) { + platformCombo.SetActiveIter (it); + break; + } + } + while (platformCombo.Model.IterNext (ref it)); + } + + if (platformCombo.Active == -1) + platformCombo.Active = 0; + + loading = false; + } + + void IOptionsPanel.ApplyChanges () + { + ApplyChanges (); + } + + public abstract void LoadConfigData (); + } +} diff --git a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs/ProjectOptionsDialog.cs b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs/ProjectOptionsDialog.cs index a037d61b2c..e25cf72931 100644 --- a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs/ProjectOptionsDialog.cs +++ b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.Dialogs/ProjectOptionsDialog.cs @@ -1,22 +1,29 @@ -// ProjectOptionsDialog.cs +// ProjectOptionsDialog.cs +// +// Author: +// Lluis Sanchez Gual <lluis@novell.com> +// +// Copyright (c) 2008 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. // -// This file was derived from a file from #Develop. // -// Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA using System; using System.Collections; @@ -31,287 +38,13 @@ using MonoDevelop.Core.Gui.Dialogs; namespace MonoDevelop.Projects.Gui.Dialogs { /// <summary> - /// Dialog for viewing the project options (plain treeview isn't good enough :/) + /// Dialog for viewing the project options. /// </summary> - public class ProjectOptionsDialog : TreeViewOptions + public class ProjectOptionsDialog : MultiConfigItemOptionsDialog { - Project project; - - ExtensionNode configurationNode; - Gtk.TreeIter configurationTreeNode; - Gtk.CellRendererText textRenderer; // used to set an editable node - Gtk.TreeViewColumn textColumn; // used to set an editable node - - public ProjectOptionsDialog (Gtk.Window parentWindow, Project project, ExtensionNode node, ExtensionNode configurationNode) : base (parentWindow, null, null) + public ProjectOptionsDialog (Gtk.Window parentWindow, Project project) : base (parentWindow, project, "/MonoDevelop/ProjectModel/Gui/ProjectOptions") { - this.project = project; - this.configurationNode = configurationNode; this.Title = GettextCatalog.GetString ("Project Options") + " - " + project.Name; - - properties = new Properties(); - properties.Set("Project", project); - properties.Set("CombineEntry", project); - - AddNodes(properties, Gtk.TreeIter.Zero, node.GetChildObjects (false)); - - // - // This code has to add treeview node items to the treeview. under a configuration node - // - AddConfigurationNodes(); - - //TreeView.ButtonReleaseEvent += new EventHandler (OnButtonRelease); - - SelectFirstNode (); - } - - void AddConfigurationNodes() - { - configurationTreeNode = treeStore.AppendValues (GettextCatalog.GetString ("Configurations"), null); - - foreach (IConfiguration config in project.Configurations) { - Gtk.TreeIter newNode ; - - if (config == project.ActiveConfiguration) { - newNode = treeStore.AppendValues (configurationTreeNode, config.Name + " " + GettextCatalog.GetString ("(Active)"), config); - //newNode.NodeFont = boldFont; - } else { - newNode = treeStore.AppendValues (configurationTreeNode, config.Name, config); - //newNode.NodeFont = plainFont; - } - - Properties configNodeProperties = new Properties(); - configNodeProperties.Set("Project", project); - configNodeProperties.Set("CombineEntry", project); - configNodeProperties.Set("Config", config); - AddNodes(configNodeProperties, newNode, configurationNode.GetChildObjects (false)); - } - TreeView.ExpandRow (treeStore.GetPath (configurationTreeNode), false); - } - - // override base method so that we can make the text cell render editable - protected override void InitializeComponent () - { - treeStore = new Gtk.TreeStore (typeof (string), typeof (IDialogPanelDescriptor)); - - TreeView.Model = treeStore; - // need editable text cell so we can rename configs - textRenderer = new Gtk.CellRendererText (); - textRenderer.Edited += new Gtk.EditedHandler (HandleOnEdit); - textColumn = TreeView.AppendColumn ("", textRenderer , "text", 0); - TreeView.Selection.Changed += new EventHandler (SelectNode); - } - - // handle the cell edit event - void HandleOnEdit (object o, Gtk.EditedArgs e) - { - // stop editability - textRenderer.Editable = false; - - Gtk.TreeIter iter; - if (! treeStore.GetIterFromString (out iter, e.Path)) { - throw new Exception("Error calculating iter for path in project options dialog: " + e.Path); - } - - AfterLabelEdit(iter, e.NewText); - } - - #region context menu commands - - [CommandHandler ("AddConfiguration")] - public void AddProjectConfiguration() - { - int number = -1; - string name = "New Configuration"; // don't localize this project configs should have per default an english name - - // make sure you have unique configuration names - string newName = name; - bool duplicateNumber; - do { - duplicateNumber = false; - foreach (IConfiguration config in project.Configurations) { - newName = (number >= 0) ? name + number : name; - if (newName == config.Name) { - ++number; - duplicateNumber = true; - break; - } - } - } while (duplicateNumber); - - // append new configuration node to the configurationTreeNode - - IConfiguration newConfig = project.CreateConfiguration (newName); - newConfig.CopyFrom (project.ActiveConfiguration); - - Gtk.TreeIter newNode = treeStore.AppendValues (configurationTreeNode, newConfig.Name , newConfig); - - // add the config to the project - project.Configurations.Add (newConfig); - properties.Set ("Config", newConfig); - - // add the child nodes to this new config - AddNodes (properties, newNode, configurationNode.GetChildObjects (false)); - - //select new config node and set it for renaming - Gtk.TreePath newPath = treeStore.GetPath (newNode); - TreeView.ExpandToPath (newPath); - TreeView.Selection.SelectPath (newPath); - RenameProjectConfiguration(); - } - - [CommandHandler ("RemoveConfiguration")] - public void RemoveProjectConfiguration() - { - Gtk.TreeModel mdl; - Gtk.TreeIter iter; - if (TreeView.Selection.GetSelected (out mdl, out iter)) { - IConfiguration config = (IConfiguration) mdl.GetValue(iter, 1); - if (project.Configurations.Count > 1) { - project.Configurations.Remove(config); - project.ActiveConfiguration = (IConfiguration)project.Configurations[0]; - - if (((Gtk.TreeStore)mdl).Remove(ref iter)) { - UpdateBoldConfigurationNode(); - SelectSpecificNode(configurationTreeNode); - } - } - } - } - - void UpdateBoldConfigurationNode() - { - if (treeStore.IterHasChild(configurationTreeNode)) { - for(int i = 0; i < treeStore.IterNChildren(configurationTreeNode); i++) { - Gtk.TreeIter node; - if (treeStore.IterNthChild(out node, configurationTreeNode, i)) { - - // determine if this is the active config - IConfiguration config = (IConfiguration) treeStore.GetValue(node, 1); - if (project.ActiveConfiguration == config) { - treeStore.SetValue(node, 0, config.Name + " " + GettextCatalog.GetString ("(Active)")); - } else { - treeStore.SetValue(node, 0, config.Name); - } - } - } - } - } - - [CommandHandler ("RenameConfiguration")] - public void RenameProjectConfiguration() - { - Gtk.TreeModel mdl; - Gtk.TreeIter iter; - if (TreeView.Selection.GetSelected (out mdl, out iter)) { - // make sure the node is a config node - IConfiguration config = mdl.GetValue(iter, 1) as IConfiguration; - if (config != null) { - // see if it's the active columne (if so remove the active text on the end) before editing - if (project.ActiveConfiguration == config) { - string name = (string) mdl.GetValue(iter, 0); - name = name.Replace(" " + GettextCatalog.GetString ("(Active)"), string.Empty); - mdl.SetValue(iter, 0, name); - } - - // make the cell editable - textRenderer.Editable = true; - TreeView.SetCursor (mdl.GetPath(iter), textColumn, true); - //TreeView.GrabFocus (); - } - } - } - - void AfterLabelEdit(Gtk.TreeIter iter, string newLabel) - { - // canceled edit (or empty name) - if (newLabel == null || newLabel.Length == 0) { - UpdateBoldConfigurationNode(); - return; - } - - bool duplicateLabel = false; - foreach (IConfiguration config in project.Configurations) { - if (newLabel == config.Name) { - duplicateLabel = true; - break; - } - } - - // set the new label - if (!duplicateLabel) { - IConfiguration config = (IConfiguration) treeStore.GetValue(iter, 1); - IConfiguration newc = project.CreateConfiguration (newLabel); - newc.CopyFrom (config); - - project.Configurations.Remove (config); - project.Configurations.Add (newc); - - treeStore.SetValue(iter, 1, newc); - treeStore.SetValue(iter, 0, newLabel); - } - - // if got this far then someone tried to edit a label, so reset the active string (in case it was removed) - UpdateBoldConfigurationNode(); - } - #endregion - - #region context menu setup - - // override select node to allow config and config child nodes (braches) to be selected - protected override void SelectNode(object sender, EventArgs e) - { - Gtk.TreeModel mdl; - Gtk.TreeIter iter; - if (TreeView.Selection.GetSelected (out mdl, out iter)) { - if (treeStore.IterHasChild (iter)) { - // only interested if a row has been selected - Gtk.TreePath path = TreeView.Model.GetPath(iter); - Gtk.TreePath configPath = TreeView.Model.GetPath(configurationTreeNode); - // see if the itter is a config iter or it's direct child - // if so don't force focus onto child node just yet - if (!iter.Equals(configurationTreeNode) && - !((path.Indices[0] == configPath.Indices[0]) && (path.Depth - configPath.Depth) == 1)) { - Gtk.TreeIter new_iter; - treeStore.IterChildren (out new_iter, iter); - Gtk.TreePath new_path = treeStore.GetPath (new_iter); - TreeView.ExpandToPath (new_path); - TreeView.Selection.SelectPath (new_path); - } - } else { - SetOptionPanelTo ((IDialogPanelDescriptor)treeStore.GetValue (iter, 1)); - } - } - } - - protected override void OnButtonRelease(object sender, Gtk.ButtonReleaseEventArgs e) - { - // only interested in right mouse button click - if (e.Event.Button == 3) { - - // only interested if a row has been selected - Gtk.TreeModel mdl; - Gtk.TreeIter iter; - Gtk.TreePath configPath = TreeView.Model.GetPath(configurationTreeNode); - if (TreeView.Selection.GetSelected (out mdl, out iter)) { - Gtk.TreePath path = TreeView.Model.GetPath(iter); - - // now see if the iter is the configuration root node iter - if (iter.Equals(configurationTreeNode)) { - CommandEntrySet cset = new CommandEntrySet (); - cset.Add (new LocalCommandEntry ("AddConfiguration", GettextCatalog.GetString ("Add"))); - CommandManager.ShowContextMenu (cset); - } else if (path.Indices[0] == configPath.Indices[0] && (path.Depth - configPath.Depth) == 1) { - // now see if it's a specific configuration node (i.e. the configuration root node is it's parent - CommandEntrySet cset = new CommandEntrySet (); - cset.Add (new LocalCommandEntry ("RenameConfiguration", GettextCatalog.GetString ("Rename"))); - cset.Add (new LocalCommandEntry ("RemoveConfiguration", GettextCatalog.GetString ("Remove"))); - cset.Add (new CommandEntry (Command.Separator)); - CommandManager.ShowContextMenu (cset); - } - } - } } - - #endregion } } diff --git a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.addin.xml b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.addin.xml index 6cb56ae072..1f0605cd58 100644 --- a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.addin.xml +++ b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.addin.xml @@ -14,24 +14,14 @@ <!-- Extension points --> - <ExtensionPoint path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/GeneralOptions"> + <ExtensionPoint path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions"> <Description>Dialog panels for project options.</Description> - <ExtensionNodeSet id="MonoDevelop.Core.Gui.DialogPanel" /> + <ExtensionNodeSet id="MonoDevelop.Core.Gui.OptionsDialogSection"/> </ExtensionPoint> - <ExtensionPoint path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/ConfigurationOptions"> - <Description>Dialog panels for project configuration options.</Description> - <ExtensionNodeSet id="MonoDevelop.Core.Gui.DialogPanel" /> - </ExtensionPoint> - - <ExtensionPoint path = "/MonoDevelop/ProjectModel/Gui/CombineOptions/GeneralOptions"> + <ExtensionPoint path = "/MonoDevelop/ProjectModel/Gui/SolutionOptions"> <Description>Dialog panels for solution options.</Description> - <ExtensionNodeSet id="MonoDevelop.Core.Gui.DialogPanel" /> - </ExtensionPoint> - - <ExtensionPoint path = "/MonoDevelop/ProjectModel/Gui/CombineOptions/ConfigurationOptions"> - <Description>Dialog panels for solution configuration options.</Description> - <ExtensionNodeSet id="MonoDevelop.Core.Gui.DialogPanel" /> + <ExtensionNodeSet id="MonoDevelop.Core.Gui.OptionsDialogSection"/> </ExtensionPoint> <ExtensionPoint path = "/MonoDevelop/ProjectModel/Gui/Icons" name="Project service icons"> @@ -40,54 +30,60 @@ <!-- Extensions points --> - <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/GeneralOptions"> - <DialogPanel id = "Common" - _label = "General"> - <DialogPanel id = "GeneralProjectPanel" - _label = "Project Options" + <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions"> + <Section id="Common" _label="General"> + <Section id = "GeneralProjectPanel" + _label = "Project" class = "MonoDevelop.Projects.Gui.Dialogs.OptionPanels.GeneralProjectOptions"/> - <DialogPanel id = "Compile" - _label = "Compile" - class = "MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CompileFileProjectOptions"/> - </DialogPanel> - </Extension> - - <Extension path = "/MonoDevelop/ProjectModel/Gui/ProjectOptions/ConfigurationOptions"> - <DialogPanel id = "CustomCommands" + + <Section id = "CustomCommands" _label = "Custom Commands" + fill = "true" class = "MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CustomCommandPanel"/> - <Condition id = "activeproject" value = "DotNet"> - <DialogPanel id = "SigningPreferences" - _label = "Assembly Signing" - class = "MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CommonAssemblySigningPreferences"/> - </Condition> + </Section> + <Section id="Build" _label="Build"> + <Section id="General" _label="General"> + <Panel id = "RuntimeOptionsPanel" + _label = "Runtime Options" + class = "MonoDevelop.Projects.Gui.Dialogs.OptionPanels.RuntimeOptionsPanel"/> + </Section> + <Section id = "Configurations" + _label = "Configurations" + fill = "true" + class = "MonoDevelop.Projects.Gui.Dialogs.OptionPanels.SolutionItemConfigurationsPanel"/> + <Section id="Compiler" _label="Compiler" /> + <Section id = "SigningPreferences" + _label = "Assembly Signing" + class = "MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CommonAssemblySigningPreferencesPanel"/> + <Section id = "OutputOptionsPanel" + _label = "Output" + class = "MonoDevelop.Projects.Gui.Dialogs.OptionPanels.OutputOptionsPanel"/> + </Section> </Extension> - <Extension path = "/MonoDevelop/ProjectModel/Gui/CombineOptions/GeneralOptions"> - <DialogPanel id = "Common" - _label = "Common"> - <DialogPanel id = "Information" + <Extension path = "/MonoDevelop/ProjectModel/Gui/SolutionOptions"> + <Section id = "Common" _label = "General"> + <Section id = "Information" _label = "Solution Information" class = "MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineInformationPanel"/> - <DialogPanel id = "Startup" - _label = "Startup Properties" - class = "MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineStartupPanel"/> - <DialogPanel id = "Build" - _label = "Build Properties" + <Section id = "Build" + _label = "Build" class = "MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineBuildOptions"/> - </DialogPanel> - - <DialogPanel id = "Configurations" - _label = "Configurations" - class = "MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineEntryConfigurationsPanel"/> - </Extension> - - <Extension path = "/MonoDevelop/ProjectModel/Gui/CombineOptions/ConfigurationOptions"> - <DialogPanel id = "EntryConfigurations" - _label = "Configurations" - class = "MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineConfigurationPanel"/> - <DialogPanel id = "CustomCommands" - _label = "Custom Commands" - class = "MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CustomCommandPanel"/> + <Section id = "Build" _label="Configurations"> + <Panel id = "Configurations" + _label = "Configurations" + fill = "true" + class = "MonoDevelop.Projects.Gui.Dialogs.OptionPanels.SolutionItemConfigurationsPanel"/> + <Panel id = "EntryConfigurations" + _label = "Configuration Mappings" + fill = "true" + grouping="Tab" + class = "MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineConfigurationPanel"/> + </Section> + <Section id = "CustomCommands" + _label = "Custom Commands" + fill = "true" + class = "MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CustomCommandPanel"/> + </Section> </Extension> </Addin> diff --git a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.mdp b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.mdp index 2d46471fe1..821125dd78 100644 --- a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.mdp +++ b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui.mdp @@ -18,8 +18,6 @@ <File name="MonoDevelop.Projects.Gui.Dialogs/ProjectOptionsDialog.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineBuildOptions.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineConfigurationPanel.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineStartupPanel.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CompileFileProjectOptions.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Projects.Gui.Dialogs.OptionPanels/GeneralProjectOptions.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Projects.Gui.Dialogs.OptionPanels/OutputOptionsPanel.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Projects.Gui.Dialogs/CombineOptionsDialog.cs" subtype="Code" buildaction="Compile" /> @@ -32,7 +30,7 @@ <File name="MonoDevelop.Projects.Gui.Completion/ICompletionWidget.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Projects.Gui.Completion/ListWindow.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Projects.Gui.Completion/TextUtilities.cs" subtype="Code" buildaction="Compile" /> - <File name="MonoDevelop.Projects.Gui.Dialogs.OptionPanels/CombineEntryConfigurationsPanel.cs" subtype="Code" buildaction="Compile" /> + <File name="MonoDevelop.Projects.Gui.Dialogs.OptionPanels/SolutionItemConfigurationsPanel.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Projects.Gui/ProjectsGuiServices.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Projects.Gui.Dialogs.OptionPanels/RuntimeOptionsPanel.cs" subtype="Code" buildaction="Compile" /> <File name="ChangeLog" subtype="Code" buildaction="Nothing" /> @@ -64,11 +62,12 @@ <File name="gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineBuildOptionsWidget.cs" subtype="Code" buildaction="Compile" /> <File name="gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineEntryConfigurationsPanelWidget.cs" subtype="Code" buildaction="Compile" /> <File name="gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineInformationWidget.cs" subtype="Code" buildaction="Compile" /> - <File name="gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineStartupPanelWidget.cs" subtype="Code" buildaction="Compile" /> - <File name="gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CompileFileOptionsWidget.cs" subtype="Code" buildaction="Compile" /> <File name="gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.RuntimeOptionsPanelWidget.cs" subtype="Code" buildaction="Compile" /> <File name="gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineConfigurationPanelWidget.cs" subtype="Code" buildaction="Compile" /> <File name="gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.GeneralProjectOptionsWidget.cs" subtype="Code" buildaction="Compile" /> + <File name="MonoDevelop.Projects.Gui.Dialogs/ItemOptionsPanel.cs" subtype="Code" buildaction="Compile" /> + <File name="MonoDevelop.Projects.Gui.Dialogs/MultiConfigItemOptionsPanel.cs" subtype="Code" buildaction="Compile" /> + <File name="MonoDevelop.Projects.Gui.Dialogs/MultiConfigItemOptionsDialog.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Projects.Gui.Completion/WindowTransparencyDecorator.cs" subtype="Code" buildaction="Compile" /> <File name="MonoDevelop.Projects.Gui.Completion/TooltipWindow.cs" subtype="Code" buildaction="Compile" /> </Contents> diff --git a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui/ProjectsGuiServices.cs b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui/ProjectsGuiServices.cs index 531000117f..32c29c2dfb 100644 --- a/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui/ProjectsGuiServices.cs +++ b/main/src/core/MonoDevelop.Projects.Gui/MonoDevelop.Projects.Gui/ProjectsGuiServices.cs @@ -47,7 +47,7 @@ namespace MonoDevelop.Projects.Gui get { return MonoDevelop.Projects.Services.Languages; } } - internal static IProjectService ProjectService { + internal static ProjectService ProjectService { get { return MonoDevelop.Projects.Services.ProjectService; } } diff --git a/main/src/core/MonoDevelop.Projects.Gui/gtk-gui/MonoDevelop.Projects.Gui.Dialogs.NewConfigurationDialog.cs b/main/src/core/MonoDevelop.Projects.Gui/gtk-gui/MonoDevelop.Projects.Gui.Dialogs.NewConfigurationDialog.cs index 6f7ba985a6..ce2a20e630 100644 --- a/main/src/core/MonoDevelop.Projects.Gui/gtk-gui/MonoDevelop.Projects.Gui.Dialogs.NewConfigurationDialog.cs +++ b/main/src/core/MonoDevelop.Projects.Gui/gtk-gui/MonoDevelop.Projects.Gui.Dialogs.NewConfigurationDialog.cs @@ -86,7 +86,7 @@ namespace MonoDevelop.Projects.Gui.Dialogs { // Internal child MonoDevelop.Projects.Gui.Dialogs.NewConfigurationDialog.ActionArea Gtk.HButtonBox w7 = this.ActionArea; w7.Name = "dialog-action_area6"; - w7.Spacing = 10; + w7.Spacing = 6; w7.BorderWidth = ((uint)(5)); w7.LayoutStyle = ((Gtk.ButtonBoxStyle)(4)); // Container child dialog-action_area6.Gtk.ButtonBox+ButtonBoxChild @@ -108,8 +108,8 @@ namespace MonoDevelop.Projects.Gui.Dialogs { if ((this.Child != null)) { this.Child.ShowAll(); } - this.DefaultWidth = 301; - this.DefaultHeight = 143; + this.DefaultWidth = 320; + this.DefaultHeight = 147; this.Show(); } } diff --git a/main/src/core/MonoDevelop.Projects.Gui/gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineInformationWidget.cs b/main/src/core/MonoDevelop.Projects.Gui/gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineInformationWidget.cs index 777d74d3ba..8375c093fa 100644 --- a/main/src/core/MonoDevelop.Projects.Gui/gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineInformationWidget.cs +++ b/main/src/core/MonoDevelop.Projects.Gui/gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineInformationWidget.cs @@ -11,7 +11,7 @@ namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels { - public partial class CombineInformationWidget { + internal partial class CombineInformationWidget { private Gtk.VBox vbox86; diff --git a/main/src/core/MonoDevelop.Projects.Gui/gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineStartupPanelWidget.cs b/main/src/core/MonoDevelop.Projects.Gui/gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineStartupPanelWidget.cs deleted file mode 100644 index 000b64a35a..0000000000 --- a/main/src/core/MonoDevelop.Projects.Gui/gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineStartupPanelWidget.cs +++ /dev/null @@ -1,236 +0,0 @@ -// ------------------------------------------------------------------------------ -// <autogenerated> -// This code was generated by a tool. -// Mono Runtime Version: 2.0.50727.42 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// </autogenerated> -// ------------------------------------------------------------------------------ - -namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels { - - - internal partial class CombineStartupPanelWidget { - - private Gtk.VBox vbox57; - - private Gtk.VBox vbox58; - - private Gtk.RadioButton singleRadioButton; - - private Gtk.HBox hbox37; - - private Gtk.Label label65; - - private Gtk.ComboBox singleCombo; - - private Gtk.VBox vbox59; - - private Gtk.RadioButton multipleRadioButton; - - private Gtk.HBox hbox38; - - private Gtk.Label label66; - - private Gtk.VBox multipleBox; - - private Gtk.HBox hbox39; - - private Gtk.ScrolledWindow scrolledwindow8; - - private Gtk.TreeView entryTreeView; - - private Gtk.VBox vbox61; - - private Gtk.Button moveUpButton; - - private Gtk.Button moveDownButton; - - private Gtk.HBox hbox40; - - private Gtk.Label ActionLabel; - - private Gtk.ComboBox actionCombo; - - protected virtual void Build() { - Stetic.Gui.Initialize(this); - // Widget MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineStartupPanelWidget - Stetic.BinContainer.Attach(this); - this.Name = "MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineStartupPanelWidget"; - // Container child MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineStartupPanelWidget.Gtk.Container+ContainerChild - this.vbox57 = new Gtk.VBox(); - this.vbox57.Name = "vbox57"; - this.vbox57.Spacing = 12; - // Container child vbox57.Gtk.Box+BoxChild - this.vbox58 = new Gtk.VBox(); - this.vbox58.Name = "vbox58"; - this.vbox58.Spacing = 6; - // Container child vbox58.Gtk.Box+BoxChild - this.singleRadioButton = new Gtk.RadioButton(MonoDevelop.Core.GettextCatalog.GetString("_Single Startup Project")); - this.singleRadioButton.Name = "singleRadioButton"; - this.singleRadioButton.Active = true; - this.singleRadioButton.DrawIndicator = true; - this.singleRadioButton.UseUnderline = true; - this.singleRadioButton.Group = new GLib.SList(System.IntPtr.Zero); - this.vbox58.Add(this.singleRadioButton); - Gtk.Box.BoxChild w1 = ((Gtk.Box.BoxChild)(this.vbox58[this.singleRadioButton])); - w1.Position = 0; - w1.Expand = false; - w1.Fill = false; - // Container child vbox58.Gtk.Box+BoxChild - this.hbox37 = new Gtk.HBox(); - this.hbox37.Name = "hbox37"; - this.hbox37.Spacing = 6; - // Container child hbox37.Gtk.Box+BoxChild - this.label65 = new Gtk.Label(); - this.label65.Name = "label65"; - this.label65.LabelProp = MonoDevelop.Core.GettextCatalog.GetString(" "); - this.hbox37.Add(this.label65); - Gtk.Box.BoxChild w2 = ((Gtk.Box.BoxChild)(this.hbox37[this.label65])); - w2.Position = 0; - w2.Expand = false; - w2.Fill = false; - // Container child hbox37.Gtk.Box+BoxChild - this.singleCombo = new Gtk.ComboBox(); - this.singleCombo.Name = "singleCombo"; - this.hbox37.Add(this.singleCombo); - Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.hbox37[this.singleCombo])); - w3.Position = 1; - this.vbox58.Add(this.hbox37); - Gtk.Box.BoxChild w4 = ((Gtk.Box.BoxChild)(this.vbox58[this.hbox37])); - w4.Position = 1; - this.vbox57.Add(this.vbox58); - Gtk.Box.BoxChild w5 = ((Gtk.Box.BoxChild)(this.vbox57[this.vbox58])); - w5.Position = 0; - w5.Expand = false; - w5.Fill = false; - // Container child vbox57.Gtk.Box+BoxChild - this.vbox59 = new Gtk.VBox(); - this.vbox59.Name = "vbox59"; - this.vbox59.Spacing = 6; - // Container child vbox59.Gtk.Box+BoxChild - this.multipleRadioButton = new Gtk.RadioButton(MonoDevelop.Core.GettextCatalog.GetString("_Multiple Startup Project")); - this.multipleRadioButton.Name = "multipleRadioButton"; - this.multipleRadioButton.DrawIndicator = true; - this.multipleRadioButton.UseUnderline = true; - this.multipleRadioButton.Group = this.singleRadioButton.Group; - this.vbox59.Add(this.multipleRadioButton); - Gtk.Box.BoxChild w6 = ((Gtk.Box.BoxChild)(this.vbox59[this.multipleRadioButton])); - w6.Position = 0; - w6.Expand = false; - w6.Fill = false; - // Container child vbox59.Gtk.Box+BoxChild - this.hbox38 = new Gtk.HBox(); - this.hbox38.Name = "hbox38"; - this.hbox38.Spacing = 6; - // Container child hbox38.Gtk.Box+BoxChild - this.label66 = new Gtk.Label(); - this.label66.Name = "label66"; - this.label66.LabelProp = MonoDevelop.Core.GettextCatalog.GetString(" "); - this.hbox38.Add(this.label66); - Gtk.Box.BoxChild w7 = ((Gtk.Box.BoxChild)(this.hbox38[this.label66])); - w7.Position = 0; - w7.Expand = false; - w7.Fill = false; - // Container child hbox38.Gtk.Box+BoxChild - this.multipleBox = new Gtk.VBox(); - this.multipleBox.Name = "multipleBox"; - this.multipleBox.Spacing = 6; - // Container child multipleBox.Gtk.Box+BoxChild - this.hbox39 = new Gtk.HBox(); - this.hbox39.Name = "hbox39"; - this.hbox39.Spacing = 6; - // Container child hbox39.Gtk.Box+BoxChild - this.scrolledwindow8 = new Gtk.ScrolledWindow(); - this.scrolledwindow8.WidthRequest = 200; - this.scrolledwindow8.HeightRequest = 200; - this.scrolledwindow8.Name = "scrolledwindow8"; - this.scrolledwindow8.ShadowType = ((Gtk.ShadowType)(1)); - // Container child scrolledwindow8.Gtk.Container+ContainerChild - this.entryTreeView = new Gtk.TreeView(); - this.entryTreeView.Name = "entryTreeView"; - this.entryTreeView.HeadersClickable = true; - this.scrolledwindow8.Add(this.entryTreeView); - this.hbox39.Add(this.scrolledwindow8); - Gtk.Box.BoxChild w9 = ((Gtk.Box.BoxChild)(this.hbox39[this.scrolledwindow8])); - w9.Position = 0; - // Container child hbox39.Gtk.Box+BoxChild - this.vbox61 = new Gtk.VBox(); - this.vbox61.Name = "vbox61"; - this.vbox61.Spacing = 6; - // Container child vbox61.Gtk.Box+BoxChild - this.moveUpButton = new Gtk.Button(); - this.moveUpButton.Name = "moveUpButton"; - this.moveUpButton.UseStock = true; - this.moveUpButton.UseUnderline = true; - this.moveUpButton.Label = "gtk-go-up"; - this.vbox61.Add(this.moveUpButton); - Gtk.Box.BoxChild w10 = ((Gtk.Box.BoxChild)(this.vbox61[this.moveUpButton])); - w10.Position = 0; - w10.Expand = false; - w10.Fill = false; - // Container child vbox61.Gtk.Box+BoxChild - this.moveDownButton = new Gtk.Button(); - this.moveDownButton.Name = "moveDownButton"; - this.moveDownButton.UseStock = true; - this.moveDownButton.UseUnderline = true; - this.moveDownButton.Label = "gtk-go-down"; - this.vbox61.Add(this.moveDownButton); - Gtk.Box.BoxChild w11 = ((Gtk.Box.BoxChild)(this.vbox61[this.moveDownButton])); - w11.Position = 1; - w11.Expand = false; - w11.Fill = false; - this.hbox39.Add(this.vbox61); - Gtk.Box.BoxChild w12 = ((Gtk.Box.BoxChild)(this.hbox39[this.vbox61])); - w12.Position = 1; - w12.Expand = false; - w12.Fill = false; - this.multipleBox.Add(this.hbox39); - Gtk.Box.BoxChild w13 = ((Gtk.Box.BoxChild)(this.multipleBox[this.hbox39])); - w13.Position = 0; - w13.Expand = false; - w13.Fill = false; - // Container child multipleBox.Gtk.Box+BoxChild - this.hbox40 = new Gtk.HBox(); - this.hbox40.Name = "hbox40"; - this.hbox40.Spacing = 6; - // Container child hbox40.Gtk.Box+BoxChild - this.ActionLabel = new Gtk.Label(); - this.ActionLabel.Name = "ActionLabel"; - this.ActionLabel.LabelProp = MonoDevelop.Core.GettextCatalog.GetString("Action"); - this.hbox40.Add(this.ActionLabel); - Gtk.Box.BoxChild w14 = ((Gtk.Box.BoxChild)(this.hbox40[this.ActionLabel])); - w14.Position = 0; - w14.Expand = false; - w14.Fill = false; - // Container child hbox40.Gtk.Box+BoxChild - this.actionCombo = new Gtk.ComboBox(); - this.actionCombo.Name = "actionCombo"; - this.hbox40.Add(this.actionCombo); - Gtk.Box.BoxChild w15 = ((Gtk.Box.BoxChild)(this.hbox40[this.actionCombo])); - w15.Position = 1; - w15.Expand = false; - w15.Fill = false; - this.multipleBox.Add(this.hbox40); - Gtk.Box.BoxChild w16 = ((Gtk.Box.BoxChild)(this.multipleBox[this.hbox40])); - w16.Position = 1; - w16.Expand = false; - w16.Fill = false; - this.hbox38.Add(this.multipleBox); - Gtk.Box.BoxChild w17 = ((Gtk.Box.BoxChild)(this.hbox38[this.multipleBox])); - w17.Position = 1; - this.vbox59.Add(this.hbox38); - Gtk.Box.BoxChild w18 = ((Gtk.Box.BoxChild)(this.vbox59[this.hbox38])); - w18.Position = 1; - this.vbox57.Add(this.vbox59); - Gtk.Box.BoxChild w19 = ((Gtk.Box.BoxChild)(this.vbox57[this.vbox59])); - w19.Position = 1; - this.Add(this.vbox57); - if ((this.Child != null)) { - this.Child.ShowAll(); - } - this.Show(); - } - } -} diff --git a/main/src/core/MonoDevelop.Projects.Gui/gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CompileFileOptionsWidget.cs b/main/src/core/MonoDevelop.Projects.Gui/gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CompileFileOptionsWidget.cs deleted file mode 100644 index ff2368c93e..0000000000 --- a/main/src/core/MonoDevelop.Projects.Gui/gtk-gui/MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CompileFileOptionsWidget.cs +++ /dev/null @@ -1,66 +0,0 @@ -// ------------------------------------------------------------------------------ -// <autogenerated> -// This code was generated by a tool. -// Mono Runtime Version: 2.0.50727.42 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// </autogenerated> -// ------------------------------------------------------------------------------ - -namespace MonoDevelop.Projects.Gui.Dialogs.OptionPanels { - - - internal partial class CompileFileOptionsWidget { - - private Gtk.VBox vbox48; - - private Gtk.Label includeLabel; - - private Gtk.ScrolledWindow scrolledwindow6; - - private Gtk.TreeView includeTreeView; - - protected virtual void Build() { - Stetic.Gui.Initialize(this); - // Widget MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CompileFileOptionsWidget - Stetic.BinContainer.Attach(this); - this.Name = "MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CompileFileOptionsWidget"; - // Container child MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CompileFileOptionsWidget.Gtk.Container+ContainerChild - this.vbox48 = new Gtk.VBox(); - this.vbox48.Name = "vbox48"; - this.vbox48.Spacing = 6; - // Container child vbox48.Gtk.Box+BoxChild - this.includeLabel = new Gtk.Label(); - this.includeLabel.Name = "includeLabel"; - this.includeLabel.Xalign = 0F; - this.includeLabel.LabelProp = MonoDevelop.Core.GettextCatalog.GetString("_Include files in compile run"); - this.includeLabel.UseUnderline = true; - this.vbox48.Add(this.includeLabel); - Gtk.Box.BoxChild w1 = ((Gtk.Box.BoxChild)(this.vbox48[this.includeLabel])); - w1.Position = 0; - w1.Expand = false; - w1.Fill = false; - // Container child vbox48.Gtk.Box+BoxChild - this.scrolledwindow6 = new Gtk.ScrolledWindow(); - this.scrolledwindow6.Name = "scrolledwindow6"; - this.scrolledwindow6.ShadowType = ((Gtk.ShadowType)(1)); - // Container child scrolledwindow6.Gtk.Container+ContainerChild - this.includeTreeView = new Gtk.TreeView(); - this.includeTreeView.WidthRequest = 300; - this.includeTreeView.HeightRequest = 200; - this.includeTreeView.Name = "includeTreeView"; - this.includeTreeView.HeadersVisible = false; - this.includeTreeView.HeadersClickable = true; - this.scrolledwindow6.Add(this.includeTreeView); - this.vbox48.Add(this.scrolledwindow6); - Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.vbox48[this.scrolledwindow6])); - w3.Position = 1; - this.Add(this.vbox48); - if ((this.Child != null)) { - this.Child.ShowAll(); - } - this.Show(); - } - } -} diff --git a/main/src/core/MonoDevelop.Projects.Gui/gtk-gui/gui.stetic b/main/src/core/MonoDevelop.Projects.Gui/gtk-gui/gui.stetic index abaaeb826d..ae6c33ad85 100644 --- a/main/src/core/MonoDevelop.Projects.Gui/gtk-gui/gui.stetic +++ b/main/src/core/MonoDevelop.Projects.Gui/gtk-gui/gui.stetic @@ -456,289 +456,7 @@ Custom Command</property> </widget> </child> </widget> - <widget class="Gtk.Bin" id="MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CompileFileOptionsWidget" design-size="451 347"> - <property name="MemberName" /> - <property name="GeneratePublic">False</property> - <child> - <widget class="Gtk.VBox" id="vbox48"> - <property name="MemberName" /> - <property name="Spacing">6</property> - <child> - <widget class="Gtk.Label" id="includeLabel"> - <property name="MemberName" /> - <property name="Xalign">0</property> - <property name="LabelProp" translatable="yes">_Include files in compile run</property> - <property name="UseUnderline">True</property> - </widget> - <packing> - <property name="Position">0</property> - <property name="AutoSize">False</property> - <property name="Expand">False</property> - <property name="Fill">False</property> - </packing> - </child> - <child> - <widget class="Gtk.ScrolledWindow" id="scrolledwindow6"> - <property name="MemberName" /> - <property name="ShadowType">In</property> - <child> - <widget class="Gtk.TreeView" id="includeTreeView"> - <property name="MemberName" /> - <property name="WidthRequest">300</property> - <property name="HeightRequest">200</property> - <property name="HeadersVisible">False</property> - <property name="HeadersClickable">True</property> - </widget> - </child> - </widget> - <packing> - <property name="Position">1</property> - <property name="AutoSize">False</property> - </packing> - </child> - </widget> - </child> - </widget> - <widget class="Gtk.Bin" id="MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineStartupPanelWidget" design-size="576 369"> - <property name="MemberName" /> - <property name="GeneratePublic">False</property> - <child> - <widget class="Gtk.VBox" id="vbox57"> - <property name="MemberName" /> - <property name="Spacing">12</property> - <child> - <widget class="Gtk.VBox" id="vbox58"> - <property name="MemberName" /> - <property name="Spacing">6</property> - <child> - <widget class="Gtk.RadioButton" id="singleRadioButton"> - <property name="MemberName" /> - <property name="Label" translatable="yes">_Single Startup Project</property> - <property name="Active">True</property> - <property name="DrawIndicator">True</property> - <property name="HasLabel">True</property> - <property name="UseUnderline">True</property> - <property name="Group">singleRadioButton</property> - </widget> - <packing> - <property name="Position">0</property> - <property name="AutoSize">False</property> - <property name="Expand">False</property> - <property name="Fill">False</property> - </packing> - </child> - <child> - <widget class="Gtk.HBox" id="hbox37"> - <property name="MemberName" /> - <property name="Spacing">6</property> - <child> - <widget class="Gtk.Label" id="label65"> - <property name="MemberName" /> - <property name="LabelProp" translatable="yes"> </property> - </widget> - <packing> - <property name="Position">0</property> - <property name="AutoSize">False</property> - <property name="Expand">False</property> - <property name="Fill">False</property> - </packing> - </child> - <child> - <widget class="Gtk.ComboBox" id="singleCombo"> - <property name="MemberName" /> - <property name="IsTextCombo">False</property> - <property name="Items" translatable="yes" /> - </widget> - <packing> - <property name="Position">1</property> - <property name="AutoSize">False</property> - </packing> - </child> - </widget> - <packing> - <property name="Position">1</property> - <property name="AutoSize">False</property> - </packing> - </child> - </widget> - <packing> - <property name="Position">0</property> - <property name="AutoSize">False</property> - <property name="Expand">False</property> - <property name="Fill">False</property> - </packing> - </child> - <child> - <widget class="Gtk.VBox" id="vbox59"> - <property name="MemberName" /> - <property name="Spacing">6</property> - <child> - <widget class="Gtk.RadioButton" id="multipleRadioButton"> - <property name="MemberName" /> - <property name="Label" translatable="yes">_Multiple Startup Project</property> - <property name="DrawIndicator">True</property> - <property name="HasLabel">True</property> - <property name="UseUnderline">True</property> - <property name="Group">singleRadioButton</property> - </widget> - <packing> - <property name="Position">0</property> - <property name="AutoSize">False</property> - <property name="Expand">False</property> - <property name="Fill">False</property> - </packing> - </child> - <child> - <widget class="Gtk.HBox" id="hbox38"> - <property name="MemberName" /> - <property name="Spacing">6</property> - <child> - <widget class="Gtk.Label" id="label66"> - <property name="MemberName" /> - <property name="LabelProp" translatable="yes"> </property> - </widget> - <packing> - <property name="Position">0</property> - <property name="AutoSize">False</property> - <property name="Expand">False</property> - <property name="Fill">False</property> - </packing> - </child> - <child> - <widget class="Gtk.VBox" id="multipleBox"> - <property name="MemberName" /> - <property name="Spacing">6</property> - <child> - <widget class="Gtk.HBox" id="hbox39"> - <property name="MemberName" /> - <property name="Spacing">6</property> - <child> - <widget class="Gtk.ScrolledWindow" id="scrolledwindow8"> - <property name="MemberName" /> - <property name="WidthRequest">200</property> - <property name="HeightRequest">200</property> - <property name="ShadowType">In</property> - <child> - <widget class="Gtk.TreeView" id="entryTreeView"> - <property name="MemberName" /> - <property name="HeadersClickable">True</property> - </widget> - </child> - </widget> - <packing> - <property name="Position">0</property> - <property name="AutoSize">False</property> - </packing> - </child> - <child> - <widget class="Gtk.VBox" id="vbox61"> - <property name="MemberName" /> - <property name="Spacing">6</property> - <child> - <widget class="Gtk.Button" id="moveUpButton"> - <property name="MemberName" /> - <property name="UseStock">True</property> - <property name="Type">StockItem</property> - <property name="StockId">gtk-go-up</property> - <property name="label">gtk-go-up</property> - </widget> - <packing> - <property name="Position">0</property> - <property name="AutoSize">False</property> - <property name="Expand">False</property> - <property name="Fill">False</property> - </packing> - </child> - <child> - <widget class="Gtk.Button" id="moveDownButton"> - <property name="MemberName" /> - <property name="UseStock">True</property> - <property name="Type">StockItem</property> - <property name="StockId">gtk-go-down</property> - <property name="label">gtk-go-down</property> - </widget> - <packing> - <property name="Position">1</property> - <property name="AutoSize">False</property> - <property name="Expand">False</property> - <property name="Fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="Position">1</property> - <property name="AutoSize">False</property> - <property name="Expand">False</property> - <property name="Fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="Position">0</property> - <property name="AutoSize">False</property> - <property name="Expand">False</property> - <property name="Fill">False</property> - </packing> - </child> - <child> - <widget class="Gtk.HBox" id="hbox40"> - <property name="MemberName" /> - <property name="Spacing">6</property> - <child> - <widget class="Gtk.Label" id="ActionLabel"> - <property name="MemberName" /> - <property name="LabelProp" translatable="yes">Action</property> - </widget> - <packing> - <property name="Position">0</property> - <property name="AutoSize">False</property> - <property name="Expand">False</property> - <property name="Fill">False</property> - </packing> - </child> - <child> - <widget class="Gtk.ComboBox" id="actionCombo"> - <property name="MemberName" /> - <property name="IsTextCombo">False</property> - <property name="Items" translatable="yes" /> - </widget> - <packing> - <property name="Position">1</property> - <property name="AutoSize">False</property> - <property name="Expand">False</property> - <property name="Fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="Position">1</property> - <property name="AutoSize">False</property> - <property name="Expand">False</property> - <property name="Fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="Position">1</property> - <property name="AutoSize">False</property> - </packing> - </child> - </widget> - <packing> - <property name="Position">1</property> - <property name="AutoSize">False</property> - </packing> - </child> - </widget> - <packing> - <property name="Position">1</property> - <property name="AutoSize">False</property> - </packing> - </child> - </widget> - </child> - </widget> - <widget class="Gtk.Bin" id="MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineBuildOptionsWidget" design-size="249 72"> + <widget class="Gtk.Bin" id="MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineBuildOptionsWidget" design-size="249 74"> <property name="MemberName" /> <property name="GeneratePublic">False</property> <child> @@ -1188,7 +906,7 @@ Custom Command</property> </widget> </child> </widget> - <widget class="Gtk.Dialog" id="MonoDevelop.Projects.Gui.Dialogs.NewConfigurationDialog" design-size="301 143"> + <widget class="Gtk.Dialog" id="MonoDevelop.Projects.Gui.Dialogs.NewConfigurationDialog" design-size="320 147"> <property name="MemberName" /> <property name="GeneratePublic">False</property> <property name="Title" translatable="yes">New Configuration</property> @@ -1266,7 +984,7 @@ Custom Command</property> <child internal-child="ActionArea"> <widget class="Gtk.HButtonBox" id="dialog-action_area6"> <property name="MemberName" /> - <property name="Spacing">10</property> + <property name="Spacing">6</property> <property name="BorderWidth">5</property> <property name="Size">2</property> <property name="LayoutStyle">End</property> @@ -1561,8 +1279,9 @@ Custom Command</property> </widget> </child> </widget> - <widget class="Gtk.Bin" id="MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineInformationWidget"> + <widget class="Gtk.Bin" id="MonoDevelop.Projects.Gui.Dialogs.OptionPanels.CombineInformationWidget" design-size="434 184"> <property name="MemberName" /> + <property name="GeneratePublic">False</property> <child> <widget class="Gtk.VBox" id="vbox86"> <property name="MemberName" /> |