public static void Remove() { if (instance != null) { instance.Document.BookmarkManager.RemoveMark(instance); instance.RemoveMarker(); instance = null; } }
/*public static void SetPosition(IViewContent viewContent, int makerStartLine, int makerStartColumn, int makerEndLine, int makerEndColumn) * { * ITextEditorControlProvider tecp = viewContent as ITextEditorControlProvider; * if (tecp != null) * SetPosition(tecp.TextEditorControl.FileName, tecp.TextEditorControl.Document, makerStartLine, makerStartColumn, makerEndLine, makerEndColumn); * else * Remove(); * }*/ public static void SetPosition(string fileName, IDocument document, int makerStartLine, int makerStartColumn, int makerEndLine, int makerEndColumn) { Remove(); startLine = makerStartLine; startColumn = makerStartColumn; endLine = makerEndLine; endColumn = makerEndColumn; LineSegment line = document.GetLineSegment(startLine - 1); instance = new CurrentLineBookmark(fileName, document, startLine - 1); document.BookmarkManager.AddMark(instance); document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.LinesBetween, startLine - 1, endLine - 1)); document.CommitUpdate(); }
/*public static void SetPosition(IViewContent viewContent, int makerStartLine, int makerStartColumn, int makerEndLine, int makerEndColumn) { ITextEditorControlProvider tecp = viewContent as ITextEditorControlProvider; if (tecp != null) SetPosition(tecp.TextEditorControl.FileName, tecp.TextEditorControl.Document, makerStartLine, makerStartColumn, makerEndLine, makerEndColumn); else Remove(); }*/ public static void SetPosition(string fileName, IDocument document, int makerStartLine, int makerStartColumn, int makerEndLine, int makerEndColumn) { Remove(); startLine = makerStartLine; startColumn = makerStartColumn; endLine = makerEndLine; endColumn = makerEndColumn; LineSegment line = document.GetLineSegment(startLine - 1); instance = new CurrentLineBookmark(fileName, document, startLine - 1); document.BookmarkManager.AddMark(instance); document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.LinesBetween, startLine - 1, endLine - 1)); document.CommitUpdate(); }