textcontentcondition.cs

来自「c#源代码」· CS 代码 · 共 48 行

CS
48
字号
// <file>
//     <copyright see="prj:///doc/copyright.txt"/>
//     <license see="prj:///doc/license.txt"/>
//     <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
//     <version value="$version"/>
// </file>

using System;
using System.Xml;


using ICSharpCode.Core.AddIns.Conditions;
using ICSharpCode.Core.AddIns;

using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.TextEditor;

namespace ICSharpCode.SharpDevelop.DefaultEditor.Conditions
{
	[ConditionAttribute()]
	public class TextContentCondition : AbstractCondition
	{
		[XmlMemberAttribute("textcontent", IsRequired = true)]
		string textcontent;
		
		public string TextContent {
			get {
				return textcontent;
			}
			set {
				textcontent = value;
			}
		}
		
		public override bool IsValid(object owner)
		{
			if (owner is TextEditorControl) {
				TextEditorControl ctrl = (TextEditorControl)owner;
				if (ctrl.Document != null && ctrl.Document.HighlightingStrategy != null) {
					return textcontent == ctrl.Document.HighlightingStrategy.Name;
				}
			}
			return false;
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?