Allows registering a line tracker on a TextDocument using a weak reference from the document to the line tracker.
Inheritance: ILineTracker
		/// <summary>
		///     Registers the <paramref name="targetTracker" /> as line tracker for the <paramref name="textDocument" />.
		///     A weak reference to the target tracker will be used, and the WeakLineTracker will deregister itself
		///     when the target tracker is garbage collected.
		/// </summary>
		public static WeakLineTracker Register(TextDocument textDocument, ILineTracker targetTracker)
		{
			if (textDocument == null)
				throw new ArgumentNullException("textDocument");
			if (targetTracker == null)
				throw new ArgumentNullException("targetTracker");
			var wlt = new WeakLineTracker(textDocument, targetTracker);
			textDocument.LineTrackers.Add(wlt);
			return wlt;
		}
Esempio n. 2
0
        /// <summary>
        ///     Registers the <paramref name="targetTracker" /> as line tracker for the <paramref name="textDocument" />.
        ///     A weak reference to the target tracker will be used, and the WeakLineTracker will deregister itself
        ///     when the target tracker is garbage collected.
        /// </summary>
        public static WeakLineTracker Register(TextDocument textDocument, ILineTracker targetTracker)
        {
            if (textDocument == null)
            {
                throw new ArgumentNullException("textDocument");
            }
            if (targetTracker == null)
            {
                throw new ArgumentNullException("targetTracker");
            }
            var wlt = new WeakLineTracker(textDocument, targetTracker);

            textDocument.LineTrackers.Add(wlt);
            return(wlt);
        }