Exemple #1
0
            private void HandleIgnoredTag(bool opening, IEditable output)
            {
                const string IGNORED_ANNOTATION_KEY   = "DUMMY_KEY";
                const string IGNORED_ANNOTATION_VALUE = "DUMMY_VALUE";

                var len = output.Length();

                if (opening)
                {
                    output.SetSpan(new Annotation(IGNORED_ANNOTATION_KEY, IGNORED_ANNOTATION_VALUE), len, len, SpanTypes.MarkMark);
                }
                else
                {
                    var start =
                        output.GetSpans(0, output.Length(), Java.Lang.Class.FromType(typeof(Annotation)))
                        .Cast <Annotation>()
                        .Where(a => output.GetSpanFlags(a) == SpanTypes.MarkMark)
                        .Where(a => a.Key == IGNORED_ANNOTATION_KEY)
                        .Where(a => a.Value == IGNORED_ANNOTATION_VALUE)
                        .FirstOrDefault();
                    if (start != null)
                    {
                        var where = output.GetSpanStart(start);
                        output.RemoveSpan(start);
                        output.Delete(where, len);
                    }
                }
            }
Exemple #2
0
 /**
  * Get last marked position of a specific tag kind (private class)
  */
 private static Java.Lang.Object GetLast(IEditable text, Type kind)
 {
     Java.Lang.Object[] objs = text.GetSpans(0, text.Length(), Java.Lang.Class.FromType(kind)); // TODO: LOl will this work?
     if (objs.Length == 0)
     {
         return(null);
     }
     else
     {
         for (int i = objs.Length; i > 0; i--)
         {
             if (text.GetSpanFlags(objs[i - 1]) == SpanTypes.MarkMark)
             {
                 return(objs[i - 1]);
             }
         }
         return(null);
     }
 }
Exemple #3
0
 /**
  * Get last marked position of a specific tag kind (private class)
  */
 private static Java.Lang.Object getLast(IEditable Text, Type kind)
 {
     Java.Lang.Object[] objs = Text.GetSpans(0, Text.Length(), Java.Lang.Class.FromType(kind)); // TODO: LOl will this work?
     if (objs.Length == 0) {
         return null;
     } else {
         for (int i = objs.Length; i > 0; i--) {
             if (Text.GetSpanFlags(objs[i - 1]) == SpanTypes.MarkMark) {
                 return objs[i - 1];
             }
         }
         return null;
     }
 }