示例#1
0
 internal static BubbledChangeEventArgs Unlock(ModelElement modelElement, UnlockEventArgs unlockEventArgs)
 {
     return(new BubbledChangeEventArgs(modelElement)
     {
         ChangeType = ChangeType.UnlockRequest,
         OriginalEventArgs = unlockEventArgs
     });
 }
示例#2
0
        /// <summary>
        /// Tries to unlock the current model element in order to make changes possible
        /// </summary>
        /// <returns>True, if unlocking the model element succeeds, otherwise False</returns>
        public bool TryUnlock()
        {
            if (IsFlagSet(ModelElementFlag.Locked))
            {
                if (IsFlagSet(ModelElementFlag.Frozen))
                {
                    return(false);
                }

                var unlockEventArgs = new UnlockEventArgs(this);
                OnBubbledChange(BubbledChangeEventArgs.Unlock(this, unlockEventArgs));

                if (unlockEventArgs.MayUnlock)
                {
                    UnlockInternal();
                }
                else
                {
                    return(false);
                }
            }
            return(true);
        }