Ejemplo n.º 1
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);
            }
        }
Ejemplo n.º 2
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;
                }
            }
        }
Ejemplo 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);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
		private void AddInterface(IInterfaceImplementer implementer, InterfaceType _interface)
		{
			if (implementer == null || _interface == null)
				return;

			TreeNode node = CreateInterfaceNode(_interface.Name);
			AddOperations(implementer, _interface, node);
		}
Ejemplo n.º 5
0
        private void AddInterface(IInterfaceImplementer implementer, InterfaceType _interface)
        {
            if ((implementer == null) || (_interface == null))
            {
                return;
            }

            TreeNode node = CreateInterfaceNode(_interface.Name);

            AddOperations(implementer, _interface, node);
        }
Ejemplo n.º 6
0
		public DialogResult ShowDialog(IInterfaceImplementer implementer)
		{
			if (implementer == null)
				return DialogResult.None;

			chkImplementExplicitly.Checked = false;
            chkImplementExplicitly.Visible = (implementer.Language.SupportsExplicitImplementation);

			OperationTree.Nodes.Clear();
			foreach (InterfaceType _interface in implementer.Interfaces)
				AddInterface(implementer, _interface);
			RemoveEmptyNodes();

			return ShowDialog();
		}
Ejemplo n.º 7
0
        protected virtual void RefreshToolAvailability()
        {
            toolOverrideList.Visible = Shape.CompositeType is SingleInharitanceType;

            IInterfaceImplementer implementer = Shape.CompositeType as IInterfaceImplementer;

            if (implementer != null)
            {
                toolImplementList.Visible = true;
                toolImplementList.Enabled = implementer.ImplementsInterface;
            }
            else
            {
                toolImplementList.Visible = false;
            }
        }
Ejemplo n.º 8
0
        public DialogResult ShowDialog(IInterfaceImplementer implementer)
        {
            if (implementer == null)
            {
                return(DialogResult.None);
            }

            chkImplementExplicitly.Checked = false;
            chkImplementExplicitly.Visible = implementer.Language.SupportsExplicitImplementation;

            OperationTree.Nodes.Clear( );
            foreach (InterfaceType _interface in implementer.Interfaces)
            {
                AddInterface(implementer, _interface);
            }
            RemoveEmptyNodes( );

            return(ShowDialog( ));
        }
Ejemplo n.º 9
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);
            }
        }
Ejemplo n.º 10
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;
				}
			}
		}
Ejemplo n.º 11
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);
			}
		}