Exemplo n.º 1
0
        private void AddOperations(IInterfaceImplementer implementer, InterfaceType _interface, TreeNode node)
        {
            if ((implementer == null) || (_interface == null) || (node == null))
            {
                return;
            }

            foreach (InterfaceType baseInterface in _interface.Bases)
            {
                AddOperations(implementer, baseInterface, node);
            }

            foreach (Operation operation in _interface.Operations)
            {
                Operation defined = implementer.GetDefinedOperation(operation);

                if (defined == null)
                {
                    CreateOperationNode(node, operation);
                }
                else if ((defined.Type != operation.Type) && _interface.Language.SupportsExplicitImplementation)
                {
                    TreeNode operationNode = CreateOperationNode(node, operation);
                    operationNode.ForeColor = Color.Gray;
                }
            }
        }
Exemplo n.º 2
0
        private void Implement(IInterfaceImplementer parent, Operation operation,
                               bool mustExplicit)
        {
            if (parent == null || operation == null)
            {
                return;
            }

            Operation defined = parent.GetDefinedOperation(operation);

            if (!operation.Language.SupportsExplicitImplementation)
            {
                mustExplicit = false;
            }

            if (defined == null)
            {
                Operation implemented = parent.Implement(operation, mustExplicit);
                AddOperationToList(implemented);
                checkAddMethod(implemented);
            }
            else if (defined.Type != operation.Type)
            {
                Operation implemented = parent.Implement(operation, true);
                AddOperationToList(implemented);
                checkAddMethod(implemented);
            }
        }
Exemplo n.º 3
0
        private void toolImplementList_Click(object sender, EventArgs e)
        {
            IInterfaceImplementer type = Shape.CompositeType as IInterfaceImplementer;

            if (type != null)
            {
                using (ImplementDialog dialog = new ImplementDialog())
                {
                    if (dialog.ShowDialog(type) == DialogResult.OK)
                    {
                        foreach (Operation operation in dialog.GetSelectedOperations())
                        {
                            Operation defined             = type.GetDefinedOperation(operation);
                            bool      implementExplicitly = dialog.ImplementExplicitly &&
                                                            type.Language.SupportsExplicitImplementation;

                            if (defined == null)
                            {
                                type.Implement(operation, implementExplicitly);
                            }
                            else if (defined.Type != operation.Type)
                            {
                                type.Implement(operation, true);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
        private void Implement(IInterfaceImplementer parent,
                               Operation operation,
                               bool mustExplicit)
        {
            var defined = parent.GetDefinedOperation(operation);

            if (!operation.Language.SupportsExplicitImplementation)
            {
                mustExplicit = false;
            }

            if (defined == null)
            {
                var implemented = parent.Implement(operation, mustExplicit);
                AddOperationToList(implemented);
            }
            else if (defined.Type != operation.Type)
            {
                var implemented = parent.Implement(operation, true);
                AddOperationToList(implemented);
            }
        }
Exemplo n.º 5
0
		private void AddOperations(IInterfaceImplementer implementer,
			InterfaceType _interface, TreeNode node)
		{
			if (implementer == null || _interface == null || node == null)
				return;

			foreach (InterfaceType baseInterface in _interface.Bases)
				AddOperations(implementer, baseInterface, node);

			foreach (Operation operation in _interface.Operations) {
				Operation defined = implementer.GetDefinedOperation(operation);

				if (defined == null) {
					CreateOperationNode(node, operation);
				}
				else if (defined.Type != operation.Type &&
                    _interface.Language.SupportsExplicitImplementation)
				{
					TreeNode operationNode = CreateOperationNode(node, operation);
					operationNode.ForeColor = Color.Gray;
				}
			}
		}
Exemplo n.º 6
0
		private void Implement(IInterfaceImplementer parent, Operation operation,
			bool mustExplicit)
		{
			Operation defined = parent.GetDefinedOperation(operation);
			if (!operation.Language.SupportsExplicitImplementation)
				mustExplicit = false;

			if (defined == null) {
				Operation implemented = parent.Implement(operation, mustExplicit);
				AddOperationToList(implemented);
			}
			else if (defined.Type != operation.Type) {
				Operation implemented = parent.Implement(operation, true);
				AddOperationToList(implemented);
			}
		}