diff options
author | Mikayla Hutchinson <m.j.hutchinson@gmail.com> | 2018-06-25 21:57:41 +0300 |
---|---|---|
committer | Mikayla Hutchinson <m.j.hutchinson@gmail.com> | 2018-06-25 21:57:41 +0300 |
commit | d9bc68d3ba0ba2e7d084cb2f6fb18c53138cb323 (patch) | |
tree | 85763f2f85bfa69696ca7254a38fd2bbea709be1 /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components | |
parent | 305bddc1e9dcd90caf25f8bed1a042efc317528b (diff) |
[Ide] Allow FileType condition on solution tree menu
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/ExtensibleTreeView.cs | 82 |
1 files changed, 42 insertions, 40 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/ExtensibleTreeView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/ExtensibleTreeView.cs index 4208f2476d..be8aa68061 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/ExtensibleTreeView.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/ExtensibleTreeView.cs @@ -1,52 +1,48 @@ -// -// ExtensibleTreeView.cs -// -// Author: -// Lluis Sanchez Gual -// Mike Krüger <mkrueger@novell.com> -// -// Copyright (C) 2005-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. -// - -//#define TREE_VERIFY_INTEGRITY - +//
+// ExtensibleTreeView.cs
+//
+// Author:
+// Lluis Sanchez Gual
+// Mike Krüger <mkrueger@novell.com>
+//
+// Copyright (C) 2005-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.
+//
+
+//#define TREE_VERIFY_INTEGRITY
+
using System; using System.Collections; using System.Collections.Generic; +using System.Linq; using System.Text; - using Mono.Addins; -using MonoDevelop.Core; using MonoDevelop.Components; -using MonoDevelop.Components.AtkCocoaHelper; -using MonoDevelop.Ide.Commands; using MonoDevelop.Components.Commands; +using MonoDevelop.Core; +using MonoDevelop.Ide.Commands; +using MonoDevelop.Ide.Extensions;
using MonoDevelop.Ide.Gui.Pads; using MonoDevelop.Projects.Extensions; -using System.Linq; -using MonoDevelop.Ide.Tasks; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - +
namespace MonoDevelop.Ide.Gui.Components { public partial class ExtensibleTreeView : Control, ICommandRouter @@ -1981,6 +1977,12 @@ namespace MonoDevelop.Ide.Gui.Components } else { ExtensionContext ctx = AddinManager.CreateExtensionContext (); ctx.RegisterCondition ("ItemType", new ItemTypeCondition (tnav.DataItem.GetType (), contextMenuTypeNameAliases)); + if (tnav.DataItem is MonoDevelop.Projects.IFileItem fileItem) { + var fileTypeCondition = new FileTypeCondition (); + fileTypeCondition.SetFileName (fileItem.FileName);
+ ctx.RegisterCondition ("FileType", fileTypeCondition); + } + CommandEntrySet eset = IdeApp.CommandService.CreateCommandEntrySet (ctx, menuPath); eset.AddItem (Command.Separator); |