From 46c5c037aaad79066f76e9b4396e67195968b3e5 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Thu, 22 Aug 2013 17:21:46 +0200 Subject: [PATCH] check ActiveViewContent.Services as well, when evaluating WindowActive-Condition --- .../WindowOpenEvaluator.cs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/Main/Base/Project/Src/Internal/ConditionEvaluators/WindowOpenEvaluator.cs b/src/Main/Base/Project/Src/Internal/ConditionEvaluators/WindowOpenEvaluator.cs index 890a10cad9..032ba3ff9b 100644 --- a/src/Main/Base/Project/Src/Internal/ConditionEvaluators/WindowOpenEvaluator.cs +++ b/src/Main/Base/Project/Src/Internal/ConditionEvaluators/WindowOpenEvaluator.cs @@ -17,7 +17,7 @@ namespace ICSharpCode.SharpDevelop /// "*" to test if any window is open. /// /// - /// <Condition name="WindowOpen" openwindow="ICSharpCode.SharpDevelop.Editor.ITextEditorProvider"> + /// <Condition name="WindowOpen" openwindow="ICSharpCode.SharpDevelop.Editor.ITextEditor"> /// /// /// <Condition name="WindowOpen" openwindow="*"> @@ -30,19 +30,28 @@ namespace ICSharpCode.SharpDevelop return false; } - string openwindow = condition.Properties["openwindow"]; + string openWindow = condition.Properties["openwindow"]; - if (openwindow == "*") { + Type openWindowType = Type.GetType(openWindow, false); + if (openWindowType == null) { + SD.Log.WarnFormatted("WindowActiveCondition: cannot find Type {0}", openWindow); + return false; + } + + if (SD.GetActiveViewContentService(openWindowType) != null) + return true; + + if (openWindow == "*") { return SD.Workbench.ActiveWorkbenchWindow != null; } foreach (IViewContent view in SD.Workbench.ViewContentCollection) { Type currentType = view.GetType(); - if (currentType.ToString() == openwindow) { + if (currentType.ToString() == openWindow) { return true; } foreach (Type i in currentType.GetInterfaces()) { - if (i.ToString() == openwindow) { + if (i.ToString() == openWindow) { return true; } }