Exemplo n.º 1
0
            /// <summary>
            /// Removes the given item from the collection
            /// </summary>
            /// <returns>True, if the item was removed, otherwise False</returns>
            /// <param name="item">The item that should be removed</param>
            public override bool Remove(IModelElement item)
            {
                IEClass eClassItem = item.As <IEClass>();

                if (((eClassItem != null) &&
                     this._parent.ESuperTypes.Remove(eClassItem)))
                {
                    return(true);
                }
                IEOperation eOperationItem = item.As <IEOperation>();

                if (((eOperationItem != null) &&
                     this._parent.EOperations.Remove(eOperationItem)))
                {
                    return(true);
                }
                IEStructuralFeature eStructuralFeatureItem = item.As <IEStructuralFeature>();

                if (((eStructuralFeatureItem != null) &&
                     this._parent.EStructuralFeatures.Remove(eStructuralFeatureItem)))
                {
                    return(true);
                }
                return(false);
            }
Exemplo n.º 2
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                IEClass eSuperTypesCasted = item.As <IEClass>();

                if ((eSuperTypesCasted != null))
                {
                    this._parent.ESuperTypes.Add(eSuperTypesCasted);
                }
                IEOperation eOperationsCasted = item.As <IEOperation>();

                if ((eOperationsCasted != null))
                {
                    this._parent.EOperations.Add(eOperationsCasted);
                }
                IEStructuralFeature eStructuralFeaturesCasted = item.As <IEStructuralFeature>();

                if ((eStructuralFeaturesCasted != null))
                {
                    this._parent.EStructuralFeatures.Add(eStructuralFeaturesCasted);
                }
                IEGenericType eGenericSuperTypesCasted = item.As <IEGenericType>();

                if ((eGenericSuperTypesCasted != null))
                {
                    this._parent.EGenericSuperTypes.Add(eGenericSuperTypesCasted);
                }
            }
Exemplo n.º 3
0
        /// <summary>
        /// Gets called when the parent model element of the current model element is about to change
        /// </summary>
        /// <param name="oldParent">The old parent model element</param>
        /// <param name="newParent">The new parent model element</param>
        protected override void OnParentChanging(IModelElement newParent, IModelElement oldParent)
        {
            IEOperation           oldEOperation = ModelHelper.CastAs <IEOperation>(oldParent);
            IEOperation           newEOperation = ModelHelper.CastAs <IEOperation>(newParent);
            ValueChangedEventArgs e             = new ValueChangedEventArgs(oldEOperation, newEOperation);

            this.OnEOperationChanging(e);
            this.OnPropertyChanging("EOperation", e, _eOperationReference);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Adds the given element to the collection
 /// </summary>
 /// <param name="item">The item to add</param>
 public override void Add(IModelElement item)
 {
     if ((this._parent.EOperation == null))
     {
         IEOperation eOperationCasted = item.As <IEOperation>();
         if ((eOperationCasted != null))
         {
             this._parent.EOperation = eOperationCasted;
             return;
         }
     }
 }
Exemplo n.º 5
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                IEOperation eOperationsCasted = item.As <IEOperation>();

                if ((eOperationsCasted != null))
                {
                    this._parent.EOperations.Add(eOperationsCasted);
                }
                IEStructuralFeature eStructuralFeaturesCasted = item.As <IEStructuralFeature>();

                if ((eStructuralFeaturesCasted != null))
                {
                    this._parent.EStructuralFeatures.Add(eStructuralFeaturesCasted);
                }
            }
Exemplo n.º 6
0
 /// <summary>
 /// Performs an operation on each instance of Internet Explorer
 /// </summary>
 /// <param name="operation"></param>
 public static void TryForEachInternetExplorer(IEOperation operation, bool justOnce = false)
 {
     ShellWindows iExplorerInstances = new ShellWindows();
     foreach (var iExplorerInstance in iExplorerInstances)
     {
         try
         {
             var iExplorer = (InternetExplorer)iExplorerInstance;
             if (iExplorer.Name == "Internet Explorer" || iExplorer.Name == "Windows Internet Explorer")
             {
                 operation(iExplorer);
                 if (justOnce)
                     break;
             }
         }
         catch (Exception) { }
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// Gets called when the parent model element of the current model element changes
        /// </summary>
        /// <param name="oldParent">The old parent model element</param>
        /// <param name="newParent">The new parent model element</param>
        protected override void OnParentChanged(IModelElement newParent, IModelElement oldParent)
        {
            IEOperation oldEOperation = ModelHelper.CastAs <IEOperation>(oldParent);
            IEOperation newEOperation = ModelHelper.CastAs <IEOperation>(newParent);

            if ((oldEOperation != null))
            {
                oldEOperation.EParameters.Remove(this);
            }
            if ((newEOperation != null))
            {
                newEOperation.EParameters.Add(this);
            }
            ValueChangedEventArgs e = new ValueChangedEventArgs(oldEOperation, newEOperation);

            this.OnEOperationChanged(e);
            this.OnPropertyChanged("EOperation", e);
        }