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;
}
}