Exemplo n.º 1
0
        public void Open(IOleParentUndoUnit pPUU)
        {
#if DEBUGUNDOREDO
            Debug.WriteLine($@">>> ParentRecord.Open({Sequence}{_unitDescription}): Open pPUU({(pPUU as ParentRecord).Sequence}/{(pPUU as ParentRecord)._unitDescription})");
#endif
            OpenChildren.Add(pPUU);
        }
Exemplo n.º 2
0
        public int Close(IOleParentUndoUnit pPUU, int fCommit)
        {
            if (pPUU == null)
            {
                return(VSConstants.S_FALSE);
            }

            if (_openParent == null)
            {
                return(VSConstants.S_FALSE);
            }

            var hr = _openParent.Close(pPUU, fCommit);

            if (VSErrorHandler.Failed(hr))
            {
                return(hr);
            }

            if (_openParent == pPUU)
            {
                _openParent = null;
                if (fCommit != 0)
                {
                    _children.Add(pPUU);
                }
                return(VSConstants.S_OK);
            }
            else
            {
                throw new ArgumentException("Closing the wrong parent unit!");
            }
        }
Exemplo n.º 3
0
 internal AtomicBlock(ViewModel.ViewModelController controller, string description)
 {
     Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
     Controller = controller;
     UndoUnit   = new UndoRedo.ParentRecord(controller, description);
     controller.UndoManager.Open(UndoUnit);
 }
Exemplo n.º 4
0
 public void Open(IOleParentUndoUnit pPUU)
 {
     if (_openParent == null)
     {
         _openParent = pPUU;
     }
     else
     {
         _openParent.Open(pPUU);
     }
 }
Exemplo n.º 5
0
        public int Close(IOleParentUndoUnit pPUU, int fCommit)
        {
            if (OpenChildren.Count == 0)
            {
#if DEBUGUNDOREDO
                Debug.WriteLine($@">>> ParentRecord.Close({Sequence}/{_unitDescription}):) Reporting Closed");
#endif
                return(VSConstants.S_FALSE);
            }

#if DEBUGUNDOREDO
            Debug.WriteLine($@">>> ParentRecord.Close({Sequence}/{_unitDescription}): CLosing pPUU({(pPUU as ParentRecord).Sequence}/{(pPUU as ParentRecord)._unitDescription})");
#endif

            int hr = OpenChildren.Last().Close(pPUU, fCommit);
            switch (hr)
            {
            case VSConstants.S_OK:
#if DEBUGUNDOREDO
                Debug.WriteLine($@">>> ParentRecord.Close({Sequence}/{_unitDescription}):  pPUU({(pPUU as ParentRecord).Sequence}/{(pPUU as ParentRecord)._unitDescription}) returned S_OK");
#endif
                return(VSConstants.S_OK);

            case VSConstants.S_FALSE:
                if (OpenChildren.Contains(pPUU))
                {
                    OpenChildren.Remove(pPUU);
#if DEBUGUNDOREDO
                    Debug.WriteLine($@">>> ParentRecord.Close({Sequence}/{_unitDescription}):  pPUU({(pPUU as ParentRecord).Sequence}/{(pPUU as ParentRecord)._unitDescription}) returned S_FALSE, we're returning S_OK");
#endif
                    return(VSConstants.S_OK);
                }
                else
                {
#if DEBUGUNDOREDO
                    Debug.WriteLine($@">>> ParentRecord.Close({Sequence}/{_unitDescription}):  pPUU({(pPUU as ParentRecord).Sequence}/{(pPUU as ParentRecord)._unitDescription}) returned S_FALSE, we're returning E_INVALIDARG");
#endif
                    return(VSConstants.E_INVALIDARG);
                }

            default:
                throw new NotImplementedException();
            }
        }
Exemplo n.º 6
0
 public void Open(IOleParentUndoUnit pPUU)
 {
     _wrappedUndoManager.Open(pPUU);
 }
Exemplo n.º 7
0
 public int Close(IOleParentUndoUnit pPUU, int fCommit)
 {
     return(_wrappedUndoManager.Close(pPUU, fCommit));
 }
Exemplo n.º 8
0
 public void Open(IOleParentUndoUnit pPUU)
 {
     if (_openParent == null)
     {
         _openParent = pPUU;
     }
     else
     {
         _openParent.Open(pPUU);
     }
 }
Exemplo n.º 9
0
        public int Close(IOleParentUndoUnit pPUU, int fCommit)
        {
            if (pPUU == null)
            {
                return VSConstants.S_FALSE;
            }

            if (_openParent == null)
            {
                return VSConstants.S_FALSE;
            }

            var hr = _openParent.Close(pPUU, fCommit);
            if (VSErrorHandler.Failed(hr))
            {
                return hr;
            }

            if (_openParent == pPUU)
            {
                _openParent = null;
                if (fCommit != 0)
                {
                    _children.Add(pPUU);
                }
                return VSConstants.S_OK;
            }
            else
            {
                throw new ArgumentException("Closing the wrong parent unit!");
            }
        }
Exemplo n.º 10
0
 public void Open(IOleParentUndoUnit pPUU)
 {
     _wrappedUndoManager.Open(pPUU);
 }
Exemplo n.º 11
0
 public int Close(IOleParentUndoUnit pPUU, int fCommit)
 {
     return _wrappedUndoManager.Close(pPUU, fCommit);
 }