Exemplo n.º 1
0
        void HandleOnAfterAttributeChange(VSCOOKIE cookie, uint grfAttribs, string oldName, string newName, string eventName)
        {
            RdtAttributes attrs = (RdtAttributes)(int)grfAttribs;

            string eventText = $"{eventName}: attributes={attrs}";

            if (attrs.HasFlag(RdtAttributes.RDTA_MkDocument))
            {
                eventText += $", old={oldName}, new={newName}";
            }

            RdtEvent evt = MakeEvent(cookie, eventText);

            _ds.RecordEvent(evt);

            RdtEntry entry = _ds.FindEntry(cookie);

            if (entry == null)
            {
                return;
            }

            if (attrs.HasFlag(RdtAttributes.RDTA_DocDataIsDirty))
            {
                entry.IsDirty = true;
            }
            else if (attrs.HasFlag(RdtAttributes.RDTA_DocDataIsNotDirty))
            {
                entry.IsDirty = false;
            }

            if (attrs.HasFlag(RdtAttributes.RDTA_DocDataIsReadOnly))
            {
                entry.IsReadOnly = true;
            }
            else if (attrs.HasFlag(RdtAttributes.RDTA_DocDataIsNotReadOnly))
            {
                entry.IsReadOnly = false;
            }

            if (attrs.HasFlag(RdtAttributes.RDTA_MkDocument))
            {
                entry.Moniker = newName;
            }
        }
Exemplo n.º 2
0
        public int OnAfterFirstDocumentLock(VSCOOKIE cookie, uint lockType, uint readLocksRemaining, uint editLocksRemaining)
        {
            RdtFlags flags = (RdtFlags)(int)lockType;
            RdtEvent evt   = MakeEvent(cookie, "OnAfterFirstDocumentLock: Lock Type={0}, Read Locks Remaining={1}, Edit Locks Remaining={2}", flags, readLocksRemaining, editLocksRemaining);

            _ds.RecordEvent(evt);

            // add this document to the data source if it's not there yet
            RdtEntry entry = _ds.FindEntry(cookie);

            if (entry == null)
            {
                RunningDocumentTable rdt  = new RunningDocumentTable();
                RunningDocumentInfo  info = rdt.GetDocumentInfo(cookie);

                entry = new RdtEntry(info);
                _ds.Entries.Add(entry);
            }

            return(VSConstants.S_OK);
        }
Exemplo n.º 3
0
        public void OnAfterDocumentLockCountChanged(VSCOOKIE cookie, uint lockType, VSCOOKIE oldCount, VSCOOKIE newCount)
        {
            RdtFlags flags = (RdtFlags)(int)lockType;
            RdtEvent evt   = MakeEvent(cookie, "OnAfterDocumentLockCountChanged: Lock Type={0}, Before={1}, After={2}", flags, oldCount, newCount);

            _ds.RecordEvent(evt);

            RdtEntry entry = _ds.FindEntry(cookie);

            if (entry == null)
            {
                return;
            }

            if (flags.HasFlag(RdtFlags.RDT_ReadLock))
            {
                entry.ReadLocks = newCount;
            }

            else if (flags.HasFlag(RdtFlags.RDT_EditLock))
            {
                entry.EditLocks = newCount;
            }
        }