public UndoTransactionImpl(ITextUndoHistory history, ITextUndoTransaction parent, string description) {
            if (history == null) {
                throw new ArgumentNullException(nameof(history));
            }

            if (string.IsNullOrEmpty(description)) {
                throw new ArgumentNullException(nameof(description));
            }

            _history = history as UndoHistoryImpl;

            if (_history == null) {
                throw new ArgumentException("Invalid history in registry");
            }

            _parent = parent as UndoTransactionImpl;

            if (_parent == null && parent != null) {
                throw new ArgumentException("Invalid parent in transaction");
            }

            Description = description;

            _state = UndoTransactionState.Open;
            _primitives = new List<ITextUndoPrimitive>();
            _mergePolicy = NullMergeUndoTransactionPolicy.Instance;
            IsReadOnly = true;
        }
Example #2
0
        public UndoTransactionImpl(ITextUndoHistory history, ITextUndoTransaction parent, string description)
        {
            if (history == null)
            {
                throw new ArgumentNullException(nameof(history));
            }

            if (string.IsNullOrEmpty(description))
            {
                throw new ArgumentNullException(nameof(description));
            }

            _history = history as UndoHistoryImpl;

            if (_history == null)
            {
                throw new ArgumentException("Invalid history in registry");
            }

            _parent = parent as UndoTransactionImpl;

            if (_parent == null && parent != null)
            {
                throw new ArgumentException("Invalid parent in transaction");
            }

            Description = description;

            _state       = UndoTransactionState.Open;
            _primitives  = new List <ITextUndoPrimitive>();
            _mergePolicy = NullMergeUndoTransactionPolicy.Instance;
            IsReadOnly   = true;
        }
Example #3
0
        public UndoTransactionImpl(ITextUndoHistory history, ITextUndoTransaction parent, string description)
        {
            if (history == null)
            {
                throw new ArgumentNullException("history", String.Format(CultureInfo.CurrentUICulture, "Strings.ArgumentCannotBeNull", "UndoTransactionImpl", "history"));
            }

            if (String.IsNullOrEmpty(description))
            {
                throw new ArgumentNullException("description", String.Format(CultureInfo.CurrentUICulture, "Strings.ArgumentCannotBeNull", "UndoTransactionImpl", "description"));
            }

            this.history = history as UndoHistoryImpl;

            if (this.history == null)
            {
                throw new ArgumentException("Strings.InvalidHistoryInTransaction");
            }

            this.parent = parent as UndoTransactionImpl;

            if (this.parent == null && parent != null)
            {
                throw new ArgumentException("Strings.InvalidParentInTransaction");
            }

            this.description = description;

            this.state       = UndoTransactionState.Open;
            this.primitives  = new List <ITextUndoPrimitive>();
            this.mergePolicy = NullMergeUndoTransactionPolicy.Instance;
            this.IsReadOnly  = true;
        }
Example #4
0
        public UndoTransactionImpl(ITextUndoHistory history, ITextUndoTransaction parent, string description)
        {
            if (history == null)
            {
                throw new ArgumentNullException(nameof(history));
            }

            if (string.IsNullOrEmpty(description))
            {
                throw new ArgumentNullException(nameof(description));
            }

            this.history = history as UndoHistoryImpl;

            if (this.history == null)
            {
                throw new ArgumentException("Strings.InvalidHistoryInTransaction");
            }

            this.parent = parent as UndoTransactionImpl;

            if (this.parent == null && parent != null)
            {
                throw new ArgumentException("Strings.InvalidParentInTransaction");
            }

            this.description = description;

            this.state       = UndoTransactionState.Open;
            this.primitives  = new List <ITextUndoPrimitive>();
            this.mergePolicy = NullMergeUndoTransactionPolicy.Instance;
            this.IsReadOnly  = true;
        }
Example #5
0
        public bool TestCompatiblePolicy(IMergeTextUndoTransactionPolicy other)
        {
            if (other == null)
            {
                throw new ArgumentNullException("other");
            }

            // Only merge transaction if they are both a text transaction
            return(this.GetType() == other.GetType());
        }
Example #6
0
        public UndoTransactionImpl(ITextUndoHistory history, ITextUndoTransaction parent, string description)
        {
            Check.ArgumentNull(nameof(history), history);
            Check.ArgumentStringNullOrEmpty(nameof(description), description);

            _history = history as UndoHistoryImpl;
            Check.ArgumentNull(nameof(history), _history);

            _parent = parent as UndoTransactionImpl;
            Check.Argument(nameof(parent), () => _parent != null || parent == null);

            Description = description;

            _state       = UndoTransactionState.Open;
            _primitives  = new List <ITextUndoPrimitive>();
            _mergePolicy = NullMergeUndoTransactionPolicy.Instance;
            IsReadOnly   = true;
        }
 public bool TestCompatiblePolicy(IMergeTextUndoTransactionPolicy other) {
     return false;
 }
 public bool TestCompatiblePolicy(IMergeTextUndoTransactionPolicy other)
 {
     // We are compatible with any other merging policy
     return(other is AutomaticCodeChangeMergePolicy);
 }
 public bool TestCompatiblePolicy(IMergeTextUndoTransactionPolicy other)
 {
     // We are compatible with any other merging policy
     return other is AutomaticCodeChangeMergePolicy;
 }
 public bool TestCompatiblePolicy(IMergeTextUndoTransactionPolicy other)
 {
     return(false);
 }
        public bool TestCompatiblePolicy(IMergeTextUndoTransactionPolicy other)
        {
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            // Only merge transaction if they are both a text transaction
            return this.GetType() == other.GetType();
        }
 public bool TestCompatiblePolicy(IMergeTextUndoTransactionPolicy other) {
     return GetType() == other.GetType();
 }
Example #13
0
 public bool TestCompatiblePolicy(IMergeTextUndoTransactionPolicy other)
 {
     return(GetType() == other.GetType());
 }