示例#1
0
        /// <summary>
        /// Creates a new instance of <see cref="AnnotatedDocument"/>.
        /// </summary>
        /// <param name="command">The command object associated with this annoated document.</param>
        /// <param name="fileName">The path of the target file to annotate.</param>
        public static AnnotatedDocument CreateAnnotatedDocument(IBlameCommand command, string fileName)
        {
            string title = Path.Combine(Path.GetDirectoryName(fileName), "[Annotated] " + Path.GetFileName(fileName));
            var    doc   = PluginBase.MainForm.CreateEditableDocument(title, string.Empty, Encoding.UTF8.CodePage) as ITabbedDocument;

            return(doc == null ? null : new AnnotatedDocument(command, fileName, doc));
        }
示例#2
0
        private AnnotatedDocument(IBlameCommand cmd, string file, ITabbedDocument doc)
        {
            documents.Add(this);
            command     = cmd;
            fileName    = file;
            document    = doc;
            sci         = document.SciControl;
            annotations = null;
            commits     = new Dictionary <string, AnnotationData>();
            tooltip     = new ToolTip();
            contextMenu = new ContextMenuStrip();

            InitializeContextMenu();
            AddEventHandlers();
        }
示例#3
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                    documents.Remove(this);
                    if (command != null)
                    {
                        command.Dispose();
                    }
                    if (tooltip != null)
                    {
                        tooltip.Dispose();
                    }
                    if (document != null)
                    {
                        ((Form)document).FormClosed -= Document_FormClosed;
                    }
                    if (sci != null)
                    {
                        sci.DwellStart -= Sci_DwellStart;
                        sci.DwellEnd   -= Sci_DwellEnd;
                    }
                    if (contextMenu != null)
                    {
                        contextMenu.Opening             -= ContextMenu_Opening;
                        showOnFileHistoryMenuItem.Click -= ShowOnFileHistoryMenuItem_Click;
                    }
                }

                command     = null;
                fileName    = null;
                document    = null;
                sci         = null;
                annotations = null;
                commits     = null;
                tooltip     = null;
                contextMenu = null;
                showOnFileHistoryMenuItem = null;

                disposed = true;
            }
        }