VisualLineElement that represents a piece of text and is a clickable link.
Inheritance: ICSharpCode.AvalonEdit.Rendering.VisualLineText
 protected override VisualLineElement ConstructElementFromMatch(Match m)
 {
     Uri uri = GetUriFromMatch(m);
     if (uri == null)
         return null;
     VisualLineLinkText linkText = new VisualLineLinkText(CurrentContext.VisualLine, m.Length);    
     linkText.NavigateUri = uri;
     linkText.RequireControlModifierForClick = this.RequireControlModifierForClick;
    
     return linkText;
 }
Beispiel #2
0
        /// <summary>
        /// Constructs a VisualLineElement that replaces the matched text.
        /// The default implementation will create a <see cref="VisualLineLinkText"/>
        /// based on the URI provided by <see cref="GetUriFromMatch"/>.
        /// </summary>
        protected virtual VisualLineElement ConstructElementFromMatch(Match m)
        {
            Uri uri = GetUriFromMatch(m);

            if (uri == null)
            {
                return(null);
            }
            VisualLineLinkText linkText = new VisualLineLinkText(CurrentContext.VisualLine, m.Length);

            linkText.NavigateUri = uri;
            linkText.RequireControlModifierForClick = this.RequireControlModifierForClick;
            return(linkText);
        }
Beispiel #3
0
		/// <inheritdoc/>
		public override VisualLineElement ConstructElement(int offset)
		{
			int matchOffset;
			Match m = GetMatch(offset, out matchOffset);
			if (m.Success && matchOffset == offset) {
				Uri uri = GetUriFromMatch(m);
				if (uri == null)
					return null;
				VisualLineLinkText linkText = new VisualLineLinkText(CurrentContext.VisualLine, m.Length);
				linkText.NavigateUri = uri;
				linkText.RequireControlModifierForClick = this.RequireControlModifierForClick;
				return linkText;
			} else {
				return null;
			}
		}
        /// <inheritdoc/>
        public override VisualLineElement ConstructElement(int offset)
        {
            Match m = GetMatch(offset);

            if (m.Success && m.Index == 0)
            {
                VisualLineLinkText linkText = new VisualLineLinkText(CurrentContext.VisualLine, m.Length);
                linkText.NavigateUri = GetUriFromMatch(m);
                linkText.RequireControlModifierForClick = this.RequireControlModifierForClick;
                return(linkText);
            }
            else
            {
                return(null);
            }
        }
Beispiel #5
0
        /// <inheritdoc/>
        public override VisualLineElement ConstructElement(int offset)
        {
            int   matchOffset;
            Match m = GetMatch(offset, out matchOffset);

            if (m.Success && matchOffset == offset)
            {
                Uri uri = GetUriFromMatch(m);
                if (uri == null)
                {
                    return(null);
                }
                VisualLineLinkText linkText = new VisualLineLinkText(CurrentContext.VisualLine, m.Length);
                linkText.NavigateUri = uri;
                linkText.RequireControlModifierForClick = this.RequireControlModifierForClick;
                return(linkText);
            }
            else
            {
                return(null);
            }
        }
Beispiel #6
0
 /// <inheritdoc/>
 public override VisualLineElement ConstructElement(int offset)
 {
     Match m = GetMatch(offset);
     if (m.Success && m.Index == 0) {
         try
         {
             VisualLineLinkText linkText = new VisualLineLinkText(CurrentContext.VisualLine, m.Length);
             linkText.NavigateUri = GetUriFromMatch(m);
             linkText.RequireControlModifierForClick = this.RequireControlModifierForClick;
             return linkText;
         }
         catch
         {
             return null;
         }
     } else {
         return null;
     }
 }