protected override void ReplaceFieldDeclaration(ICSharpCode.TextEditor.Document.IDocument document, IField oldField, string newFieldDeclaration)
        {
            // In VB, the field region begins at the start of the declaration
            // and ends on the first column of the line following the declaration.
            int startOffset = document.PositionToOffset(new TextLocation(0, oldField.Region.BeginLine - 1));
            int endOffset   = document.PositionToOffset(new TextLocation(0, oldField.Region.EndLine - 1));

            document.Replace(startOffset, endOffset - startOffset, tabs + newFieldDeclaration + Environment.NewLine);
        }
        protected override void RemoveFieldDeclaration(ICSharpCode.TextEditor.Document.IDocument document, IField field)
        {
            // In VB, the field region begins at the start of the declaration
            // and ends on the first column of the line following the declaration.
            int startOffset = document.PositionToOffset(new TextLocation(0, field.Region.BeginLine - 1));
            int endOffset   = document.PositionToOffset(new TextLocation(0, field.Region.EndLine - 1));

            document.Remove(startOffset, endOffset - startOffset);
        }
示例#3
0
        internal static void SelectText(ICSharpCode.TextEditor.TextEditorControl Editor, string Text)
        {
            int offset    = Editor.Text.IndexOf(Text);
            int endOffset = offset + Text.Length;

            Editor.ActiveTextAreaControl.TextArea.Caret.Position = Editor.ActiveTextAreaControl.TextArea.Document.OffsetToPosition(endOffset);
            Editor.ActiveTextAreaControl.TextArea.SelectionManager.ClearSelection();
            ICSharpCode.TextEditor.Document.IDocument        document  = Editor.ActiveTextAreaControl.TextArea.Document;
            ICSharpCode.TextEditor.Document.DefaultSelection selection = new ICSharpCode.TextEditor.Document.DefaultSelection(document, document.OffsetToPosition(offset), document.OffsetToPosition(endOffset));
            Editor.ActiveTextAreaControl.TextArea.SelectionManager.SetSelection(selection);
        }
示例#4
0
        //public override void IndentLines(ICSharpCode.TextEditor.TextArea textArea, int begin, int end)
        //{
        //}

        protected override int SmartIndentLine(ICSharpCode.TextEditor.TextArea area, int line)
        {
            ICSharpCode.TextEditor.Document.IDocument   document    = area.Document;
            ICSharpCode.TextEditor.Document.LineSegment lineSegment = document.GetLineSegment(line - 1);
            if (document.GetText(lineSegment).EndsWith(":"))
            {
                ICSharpCode.TextEditor.Document.LineSegment segment = document.GetLineSegment(line);
                string indent_str = "    ";// ICSharpCode.TextEditor.Actions.Tab.GetIndentationString(document);
                if (!area.TextEditorProperties.ConvertTabsToSpaces)
                {
                    indent_str = "\t";
                }
                string str = base.GetIndentation(area, line - 1) + indent_str;
                document.Replace(segment.Offset, segment.Length, str + document.GetText(segment));
                return(str.Length);
            }
            return(base.SmartIndentLine(area, line));
        }
        static TextLocation FindMethodStart(ICSharpCode.TextEditor.Document.IDocument document, DomRegion bodyRegion)
        {
            if (bodyRegion.IsEmpty)
            {
                return(TextLocation.Empty);
            }
            int offset = document.PositionToOffset(new TextLocation(bodyRegion.BeginColumn - 1, bodyRegion.BeginLine - 1));

            while (offset < document.TextLength)
            {
                if (document.GetCharAt(offset) == '{')
                {
                    return(document.OffsetToPosition(offset + 1));
                }
                offset++;
            }
            return(TextLocation.Empty);
        }
示例#6
0
 public ActiveMark(string f, ICSharpCode.TextEditor.Document.IDocument d, int l)
     : base(d, l)
 {
 }
示例#7
0
        protected override DomRegion GetReplaceRegion(ICSharpCode.TextEditor.Document.IDocument document, IMethod method)
        {
            DomRegion r = method.BodyRegion;

            return(new DomRegion(r.BeginLine + 1, 1, r.EndLine + 1, 1));
        }
示例#8
0
 public BreakPoint(ICSharpCode.TextEditor.Document.IDocument document,
                   ICSharpCode.TextEditor.TextLocation location)
     : base(document, location)
 {
 }
示例#9
0
 /// <summary>
 /// Line Number Must Be 0-based!
 /// </summary>
 public Breakpoint(string filename, ICSharpCode.TextEditor.Document.IDocument d, int l)
     : base(d, l)
 {
     this.filename = filename;
 }