diff options
author | Lluis Sanchez <lluis@novell.com> | 2007-12-04 13:54:06 +0300 |
---|---|---|
committer | Lluis Sanchez <lluis@novell.com> | 2007-12-04 13:54:06 +0300 |
commit | fb3d82535d1eb51b03b9df5c8c3b24c0e6fa6d92 (patch) | |
tree | 5c9c507ec718981e2dda5406e126b8efd02fa3b2 /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons | |
parent | 6342b2ae0820167754b9f39077777520e20c08a0 (diff) |
Directory reorganization
svn path=/branches/monodevelop/reorg/; revision=90640
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons')
21 files changed, 1323 insertions, 0 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/CombineOpenCondition.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/CombineOpenCondition.cs new file mode 100644 index 0000000000..39adabe73d --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/CombineOpenCondition.cs @@ -0,0 +1,52 @@ +// CombineOpenCondition.cs +// +// Author: +// Lluis Sanchez Gual <lluis@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 Mono.Addins; +using MonoDevelop.Core; +using MonoDevelop.Core.Gui; +using MonoDevelop.Ide.Gui; + +namespace MonoDevelop.Ide.Codons +{ + internal class CombineOpenCondition : ConditionType + { + public CombineOpenCondition () + { + IdeApp.ProjectOperations.CombineClosed += delegate { NotifyChanged(); }; + IdeApp.ProjectOperations.CombineOpened += delegate { NotifyChanged(); }; + } + + public override bool Evaluate (NodeElement condition) + { + return IdeApp.ProjectOperations.CurrentOpenCombine != null; + } + } +} diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ContextPadCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ContextPadCodon.cs new file mode 100644 index 0000000000..2e94ea1b52 --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ContextPadCodon.cs @@ -0,0 +1,43 @@ +// +// ContextPadCodon.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.ComponentModel; +using Mono.Addins; + +namespace MonoDevelop.Ide.Codons +{ + [ExtensionNode (Description="Makes a pad available in workbench context. The id property is the id of a registered pad.")] + internal class ContextPadCodon : ExtensionNode + { + } +} diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/DisplayBindingCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/DisplayBindingCodon.cs new file mode 100644 index 0000000000..39c2cf8cd6 --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/DisplayBindingCodon.cs @@ -0,0 +1,45 @@ +// DisplayBindingCodon.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.Diagnostics; +using System.ComponentModel; + +using Mono.Addins; +using MonoDevelop.Ide.Gui; + +namespace MonoDevelop.Ide.Codons +{ + [ExtensionNode (Description="A display binding. The specified class must implement MonoDevelop.Ide.Codons.IDisplayBinding.")] + internal class DisplayBindingCodon : TypeExtensionNode + { + public IDisplayBinding DisplayBinding { + get { + return GetInstance () as IDisplayBinding; + } + } + public ISecondaryDisplayBinding SecondaryDisplayBinding { + get { + return GetInstance () as ISecondaryDisplayBinding; + } + } + } +} diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/FileFilterCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/FileFilterCodon.cs new file mode 100644 index 0000000000..a63b9a457b --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/FileFilterCodon.cs @@ -0,0 +1,62 @@ +// FileFilterCodon.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 Mono.Addins; +using MonoDevelop.Core; + +namespace MonoDevelop.Ide.Codons +{ + [ExtensionNode (Description="A file filter to be used in the Open File dialog.")] + internal class FileFilterCodon : TypeExtensionNode + { + [NodeAttribute ("_label", true, "Display name of the filter.", Localizable=true)] + string filtername = null; + + [NodeAttribute("extensions", true, "Extensions to use as filter.")] + string[] extensions = null; + + public string FilterName { + get { + return filtername; + } + set { + filtername = value; + } + } + + public string[] Extensions { + get { + return extensions; + } + set { + extensions = value; + } + } + + public override object CreateInstance () + { + return StringParserService.Parse (filtername) + "|" + String.Join(";", extensions); + } + } +} diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/FileTemplateConditionTypeCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/FileTemplateConditionTypeCodon.cs new file mode 100644 index 0000000000..ae5d1573c2 --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/FileTemplateConditionTypeCodon.cs @@ -0,0 +1,48 @@ +// +// FileTemplateConditionTypeCodon.cs +// +// Author: +// Michael Hutchinson <mhutchinson@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.Collections; +using System.Diagnostics; +using System.ComponentModel; + +using Mono.Addins; + +namespace MonoDevelop.Ide.Codons +{ + [ExtensionNode (Description="A condition that limits when a file template is shown. The specified class must be a subclass of MonoDevelop.Ide.Templates.FileTemplateCondition")] + internal class FileTemplateConditionTypeCodon : TypeExtensionNode + { + [NodeAttribute("name", true, "Name to use to reference this condition type in a file template.")] + string name; + + public string ElementName { + get { return name; } + } + } +}
\ No newline at end of file diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/FileTemplateTypeCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/FileTemplateTypeCodon.cs new file mode 100644 index 0000000000..c5c34a2e5b --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/FileTemplateTypeCodon.cs @@ -0,0 +1,49 @@ +// +// FileTemplateTypeCodon.cs +// +// Author: +// Lluis Sanchez Gual +// +// 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.Diagnostics; +using System.ComponentModel; + +using Mono.Addins; + +namespace MonoDevelop.Ide.Codons +{ + [ExtensionNode (Description="A file template type. The specified class must be a subclass of MonoDevelop.Ide.Templates.FileDescriptionTemplate")] + internal class FileTemplateTypeCodon : TypeExtensionNode + { + [NodeAttribute("name", true, "Name to use to reference this template type in a file template.")] + string name; + + public string ElementName { + get { return name; } + } + } +} diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/IDisplayBinding.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/IDisplayBinding.cs new file mode 100644 index 0000000000..6610a09eae --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/IDisplayBinding.cs @@ -0,0 +1,68 @@ +// IDisplayBinding.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 MonoDevelop.Projects; +using MonoDevelop.Ide.Gui; + +namespace MonoDevelop.Ide.Codons +{ + /// <summary> + /// This class defines the SharpDevelop display binding interface, it is a factory + /// structure, which creates IViewContents. + /// </summary> + public interface IDisplayBinding + { + // Display name of the binding, to be shown when there are several + // options for opening a file. + string DisplayName { get; } + + /// <remarks> + /// This function determines, if this display binding is able to create + /// an IViewContent for the file given by fileName. + /// </remarks> + /// <returns> + /// true, if this display binding is able to create + /// an IViewContent for the file given by fileName. + /// false otherwise + /// </returns> + bool CanCreateContentForFile(string fileName); + + bool CanCreateContentForMimeType (string mimetype); + + /// <remarks> + /// Creates a new IViewContent object for the file fileName + /// </remarks> + /// <returns> + /// A newly created IViewContent object. + /// </returns> + IViewContent CreateContentForFile(string fileName); + + /// <remarks> + /// Creates a new IViewContent object for the given mime type + /// </remarks> + /// <returns> + /// A newly created IViewContent object. + /// </returns> + IViewContent CreateContentForMimeType (string mimeType, Stream content); + } +} diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ISubDisplayBinding.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ISubDisplayBinding.cs new file mode 100644 index 0000000000..b0d5204f2a --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ISubDisplayBinding.cs @@ -0,0 +1,39 @@ +// ISubDisplayBinding.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 MonoDevelop.Projects; +using MonoDevelop.Ide.Gui; + +namespace MonoDevelop.Ide.Codons +{ + /// <summary> + /// This class defines the SharpDevelop display binding interface, it is a factory + /// structure, which creates IViewContents. + /// </summary> + public interface ISecondaryDisplayBinding + { + bool CanAttachTo(IViewContent content); + + ISecondaryViewContent CreateSecondaryViewContent(IViewContent viewContent); + } +} diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/LanguageActiveCondition.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/LanguageActiveCondition.cs new file mode 100644 index 0000000000..4af36b9532 --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/LanguageActiveCondition.cs @@ -0,0 +1,64 @@ +// LanguageActiveCondition.cs +// +// Author: +// Lluis Sanchez Gual <lluis@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.Collections; +using System.Xml; + + +using Mono.Addins; +using MonoDevelop.Core.Gui; +using MonoDevelop.Core; +using MonoDevelop.Projects; +using MonoDevelop.Ide.Gui; + +namespace MonoDevelop.Ide.Codons +{ + internal class LanguageActiveCondition : ConditionType + { + public LanguageActiveCondition () + { + IdeApp.ProjectOperations.CurrentProjectChanged += delegate { NotifyChanged (); }; + } + + public override bool Evaluate (NodeElement condition) + { + string lang = condition.GetAttribute ("value"); + Project project = IdeApp.ProjectOperations.CurrentSelectedProject; + + if (lang == "*") + return (project is DotNetProject); + + if (project != null) + foreach (string suppLang in project.SupportedLanguages) + if (suppLang == lang) return true; + + return false; + } + } + +} diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/NodeBuilderCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/NodeBuilderCodon.cs new file mode 100644 index 0000000000..aab2af270f --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/NodeBuilderCodon.cs @@ -0,0 +1,47 @@ +// +// NodeBuilderCodon.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.ComponentModel; +using Mono.Addins; +using MonoDevelop.Ide.Gui.Pads; + +namespace MonoDevelop.Ide.Codons +{ + [ExtensionNode ("NodeBuilder", "A node builder for a SolutionPad. The specified class must subclass MonoDevelop.Ide.Gui.Pads.NodeBuilder or MonoDevelop.Ide.Gui.Pads.NodeBuilderExtension.")] + internal class NodeBuilderCodon : TypeExtensionNode + { + public NodeBuilder NodeBuilder { + get { return (NodeBuilder) GetInstance (typeof(NodeBuilder)); } + } + } +} diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadCodon.cs new file mode 100644 index 0000000000..0023d8a559 --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadCodon.cs @@ -0,0 +1,135 @@ +// +// PadCodon.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.ComponentModel; +using MonoDevelop.Core; +using Mono.Addins; +using MonoDevelop.Core.Gui; +using MonoDevelop.Ide.Gui; + +namespace MonoDevelop.Ide.Codons +{ + [ExtensionNode ("Pad", "Registers a pad to be shown in the workbench.")] + public class PadCodon : ExtensionNode + { + IPadContent content; + string id; + + [NodeAttribute("_label", "Display name of the pad.", Localizable=true)] + string label = null; + + [NodeAttribute("class", "Class name.")] + string className = null; + + [NodeAttribute("icon", "Icon of the pad. It can be a stock icon or a resource icon (use 'res:' as prefix in the last case).")] + string icon = null; + + [NodeAttribute("defaultPlacement", + "Default placement of the pad inside the workbench. " + + "It can be: left, right, top, bottom, or a relative position, for example: 'ProjectPad/left'" + + "would show the pad at the left side of the project pad. When using " + + "relative placements several positions can be provided. If the " + + "pad can be placed in the first position, the next one will be " + + "tried. For example 'ProjectPad/left; bottom'." + )] + string defaultPlacement = "left"; + + string[] contexts; + + public IPadContent PadContent { + get { + if (content == null) + content = CreatePad (); + return content; + } + } + + public string PadId { + get { return id != null ? id : base.Id; } + set { id = value; } + } + + public string Label { + get { return label; } + } + + public string Icon { + get { return icon; } + } + + public string ClassName { + get { return className; } + } + + /// <summary> + /// Returns the default placement of the pad: left, right, top, bottom. + /// Relative positions can be used, for example: "ProjectPad/left" + /// would show the pad at the left of the project pad. When using + /// relative placements several positions can be provided. If the + /// pad can be placed in the first position, the next one will be + /// tried. For example "ProjectPad/left; bottom". + /// </summary> + public string DefaultPlacement { + get { return defaultPlacement; } + } + + public string[] Contexts { + get { return contexts; } + } + + public bool Initialized { + get { + return content != null; + } + } + + public PadCodon () + { + } + + public PadCodon (IPadContent content, string id, string label, string defaultPlacement, string icon) + { + this.id = id; + this.content = content; + this.label = label; + this.defaultPlacement = defaultPlacement; + this.icon = icon; + } + + protected virtual IPadContent CreatePad () + { + return (IPadContent) Addin.CreateInstance (className, true); + } + + } +} diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadOptionCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadOptionCodon.cs new file mode 100644 index 0000000000..acff9af06b --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadOptionCodon.cs @@ -0,0 +1,62 @@ +// +// PadOptionCodon.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.ComponentModel; +using MonoDevelop.Ide.Gui.Pads; +using MonoDevelop.Core; +using Mono.Addins; + +namespace MonoDevelop.Ide.Codons +{ + [ExtensionNode (Description="A display option of a solution pad.")] + internal class PadOptionCodon : ExtensionNode + { + [NodeAttribute("_label", true, "Display name of the option", Localizable=true)] + string label = null; + + [NodeAttribute("defaultValue", "Default value of the option")] + bool defaultValue; + + TreePadOption option; + + public TreePadOption Option { + get { return option; } + } + + protected override void Read (NodeElement elem) + { + base.Read (elem); + option = new TreePadOption (Id, label, defaultValue); + } + } +} diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ProjectActiveCondition.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ProjectActiveCondition.cs new file mode 100644 index 0000000000..c038a20786 --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ProjectActiveCondition.cs @@ -0,0 +1,62 @@ +// ProjectActiveCondition.cs +// +// Author: +// Lluis Sanchez Gual <lluis@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.Collections; +using System.Xml; + + +using Mono.Addins; +using MonoDevelop.Core.Gui; +using MonoDevelop.Core; +using MonoDevelop.Projects; +using MonoDevelop.Ide.Gui; + +namespace MonoDevelop.Ide.Codons +{ + internal class ProjectActiveCondition : ConditionType + { + public ProjectActiveCondition () + { + IdeApp.ProjectOperations.CurrentProjectChanged += delegate { + NotifyChanged(); + }; + } + + public override bool Evaluate (NodeElement condition) + { + string activeproject = condition.GetAttribute ("value"); + + Project project = IdeApp.ProjectOperations.CurrentSelectedProject; + if (activeproject == "*") { + return project != null; + } + return project != null && project.ProjectType == activeproject; + } + } + +} diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ProjectOpenCondition.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ProjectOpenCondition.cs new file mode 100644 index 0000000000..2cce042666 --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ProjectOpenCondition.cs @@ -0,0 +1,67 @@ +// ProjectOpenCondition.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.Xml; + + +using Mono.Addins; +using MonoDevelop.Core.Gui; +using MonoDevelop.Core; +using MonoDevelop.Projects; +using MonoDevelop.Ide.Gui; + +namespace MonoDevelop.Ide.Codons +{ + [ConditionAttribute()] + internal class ProjectOpenCondition : AbstractCondition + { + [XmlMemberAttribute("openproject", IsRequired = true)] + string openproject; + + public string OpenProject { + get { + return openproject; + } + set { + openproject = value; + } + } + + public override bool IsValid(object owner) + { + Project project = IdeApp.ProjectOperations.CurrentSelectedProject; + + if (project == null && IdeApp.ProjectOperations.CurrentOpenCombine != null) { + CombineEntryCollection projects = IdeApp.ProjectOperations.CurrentOpenCombine.GetAllProjects(); + if (projects.Count > 0) { + project = (Project)projects[0]; + } + } + + if (openproject == "*") { + return project != null; + } + return project != null && project.ProjectType == openproject; + } + } + +} diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ProjectTemplateCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ProjectTemplateCodon.cs new file mode 100644 index 0000000000..440d482fae --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ProjectTemplateCodon.cs @@ -0,0 +1,68 @@ +// +// ProjectTemplateCodon.cs +// +// Author: +// Lluis Sanchez Gual +// + +// +// 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.IO; +using System.Xml; + +using Mono.Addins; + +namespace MonoDevelop.Ide.Codons +{ + [ExtensionNode (Description="A project template.")] + internal class ProjectTemplateCodon : ExtensionNode + { + [NodeAttribute("resource", "Name of the resource where the template is stored.")] + string resource; + + [NodeAttribute("file", "Name of the file where the template is stored.")] + string file; + + public XmlDocument GetTemplate () + { + Stream stream; + if (file != null) + stream = File.OpenRead (Addin.GetFilePath (file)); + else if (resource != null) { + stream = Addin.GetResource (resource); + if (stream == null) + throw new ApplicationException ("Template " + resource + " not found"); + } + else + throw new InvalidOperationException ("Template file or resource not provided"); + + using (stream) { + XmlDocument doc = new XmlDocument(); + doc.Load(stream); + return doc; + } + } + } +} diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/SolutionPadCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/SolutionPadCodon.cs new file mode 100644 index 0000000000..8ec7caa145 --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/SolutionPadCodon.cs @@ -0,0 +1,105 @@ +// +// SolutionPadCodon.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 MonoDevelop.Core; +using Mono.Addins; +using MonoDevelop.Core.Gui; +using MonoDevelop.Ide.Gui; +using MonoDevelop.Ide.Gui.Pads; +using System.ComponentModel; + +namespace MonoDevelop.Ide.Codons +{ + [ExtensionNode ("SolutionPad", "Registers a pad which shows information about a project in a tree view.")] + internal class SolutionPadCodon : PadCodon + { + NodeBuilder[] builders; + TreePadOption[] options; + TreeViewPad pad; + /* + string placement = null;*/ + +// public string DefaultPlacement { +// get { return placement; } +// } + + void BuildChildren () + { + ArrayList bs = new ArrayList (); + ArrayList ops = new ArrayList (); + + foreach (ExtensionNode ob in ChildNodes) { + NodeBuilderCodon nbc = ob as NodeBuilderCodon; + if (nbc != null) + bs.Add (nbc.NodeBuilder); + else { + PadOptionCodon poc = ob as PadOptionCodon; + if (poc != null) + ops.Add (poc.Option); + } + } + builders = (NodeBuilder[]) bs.ToArray (typeof(NodeBuilder)); + options = (TreePadOption[]) ops.ToArray (typeof(TreePadOption)); + } + + protected override IPadContent CreatePad () + { + if (builders == null) + BuildChildren (); + + AddinManager.ExtensionChanged += OnExtensionChanged; + + if (ClassName != null && ClassName.Length > 0) { + object ob = Addin.CreateInstance (ClassName, true); + if (!(ob is TreeViewPad)) + throw new InvalidOperationException ("'" + ClassName + "' is not a subclass of TreeViewPad."); + pad = (TreeViewPad) ob; + } else + pad = new SolutionPad (); + + pad.Initialize (builders, options); +// pad.DefaultPlacement = placement; + pad.Id = Id; + return pad; + } + + void OnExtensionChanged (object s, ExtensionEventArgs args) + { + string codonpath = Path + "/" + this.Id; + if (args.PathChanged (codonpath)) { + BuildChildren (); + pad.UpdateBuilders (builders, options); + } + } + } +} diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/TaskListViewCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/TaskListViewCodon.cs new file mode 100644 index 0000000000..3edeee1392 --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/TaskListViewCodon.cs @@ -0,0 +1,72 @@ +// +// TaskListViewCodon.cs +// +// Author: +// David Makovský <yakeen@sannyas-on.net> +// +// Copyright (C) 2006 David Makovský +// +// 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.ComponentModel; +using MonoDevelop.Core; +using Mono.Addins; +using MonoDevelop.Core.Gui; +using MonoDevelop.Ide.Gui; +using MonoDevelop.Ide.Tasks; + +namespace MonoDevelop.Ide.Codons +{ + [ExtensionNode (Description="Registers a task list view to be shown in the task list pad.")] + internal class TaskListViewCodon : ExtensionNode + { + ITaskListView view; + + [NodeAttribute("_label", "Display name of the view.", Localizable=true)] + string label = null; + + [NodeAttribute("class", "Class of the view.")] + string className; + + public ITaskListView View { + get { + if (view == null) + view = CreateView (); + return view; + } + } + + public string Class { + get { return className; } + } + + public string Label { + get { return label; } + } + + protected virtual ITaskListView CreateView () + { + return (ITaskListView) Addin.CreateInstance (className, true); + } + } +} diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/WindowActiveCondition.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/WindowActiveCondition.cs new file mode 100644 index 0000000000..90e9ccf191 --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/WindowActiveCondition.cs @@ -0,0 +1,60 @@ +// WindowActiveCondition.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.Xml; + + +using Mono.Addins; +using MonoDevelop.Core.Gui; +using MonoDevelop.Ide.Gui; + +namespace MonoDevelop.Ide.Codons +{ + internal class WindowActiveCondition : ConditionType + { + public WindowActiveCondition () + { + IdeApp.Workbench.ActiveDocumentChanged += delegate { NotifyChanged (); }; + } + + public override bool Evaluate (NodeElement condition) + { + string activewindow = condition.GetAttribute ("value"); + + if (activewindow == "*") { + return IdeApp.Workbench.ActiveDocument != null; + } + if (IdeApp.Workbench.ActiveDocument == null) { + return false; + } + Type currentType = IdeApp.Workbench.ActiveDocument.GetContent<IBaseViewContent> ().GetType (); + if (currentType.ToString() == activewindow) { + return true; + } + foreach (Type i in currentType.GetInterfaces()) { + if (i.ToString() == activewindow) { + return true; + } + } + return false; + } + } +} diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/WindowOpenCondition.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/WindowOpenCondition.cs new file mode 100644 index 0000000000..69292c7c93 --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/WindowOpenCondition.cs @@ -0,0 +1,65 @@ +// WindowOpenCondition.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.Xml; + + +using Mono.Addins; +using MonoDevelop.Ide.Gui; +using MonoDevelop.Core.Gui; + +namespace MonoDevelop.Ide.Codons +{ + [ConditionAttribute()] + internal class WindowOpenCondition : AbstractCondition + { + [XmlMemberAttribute("openwindow", IsRequired = true)] + string openwindow; + + public string ActiveWindow { + get { + return openwindow; + } + set { + openwindow = value; + } + } + + public override bool IsValid(object owner) + { + if (openwindow == "*") { + return IdeApp.Workbench.ActiveDocument != null; + } + foreach (Document doc in IdeApp.Workbench.Documents) { + Type currentType = doc.Window.ViewContent.GetType(); + if (currentType.ToString() == openwindow) { + return true; + } + foreach (Type i in currentType.GetInterfaces()) { + if (i.ToString() == openwindow) { + return true; + } + } + } + return false; + } + } +} diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/WorkbenchContextCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/WorkbenchContextCodon.cs new file mode 100644 index 0000000000..6529dec3a1 --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/WorkbenchContextCodon.cs @@ -0,0 +1,59 @@ +// +// WorkbenchContextCodon .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.ComponentModel; +using Mono.Addins; + +namespace MonoDevelop.Ide.Codons +{ + [ExtensionNode (Description="A workbench context.")] + internal class WorkbenchContextCodon : ExtensionNode + { + ContextPadCodon[] pads; + + public ContextPadCodon[] Pads { + get { + if (pads == null) { + ArrayList bs = new ArrayList (); + foreach (ExtensionNode ob in ChildNodes) { + ContextPadCodon spad = ob as ContextPadCodon; + if (spad != null) + bs.Add (spad); + } + pads = (ContextPadCodon[]) bs.ToArray (typeof(ContextPadCodon)); + } + return pads; + } + } + } +} diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/WorkbenchContextCondition.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/WorkbenchContextCondition.cs new file mode 100644 index 0000000000..31e746aa4a --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/WorkbenchContextCondition.cs @@ -0,0 +1,51 @@ +// WorkbenchContextCondition.cs +// +// Author: +// Lluis Sanchez Gual <lluis@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 Mono.Addins; +using MonoDevelop.Core.Gui; +using MonoDevelop.Ide.Gui; + +namespace MonoDevelop.Ide.Codons +{ + internal class WorkbenchContextCondition : ConditionType + { + public override bool Evaluate (NodeElement condition) + { + string context = condition.GetAttribute ("value"); + if (context == "*") + return true; + + if (context == IdeApp.Workbench.Context.Id) + return true; + + return false; + } + } +} |