示例#1
0
        public static LibraryMemberInfo getAssociatedHelpMemberInfo(iCS_EditorObject edObj)
        {
            if (edObj != null)
            {
                if (edObj.IsPort)
                {
                    // check for special types of ports.
                    // TODO: support these.
                    if (edObj.PortIndex == (int)PortIndex.Return && edObj.ParentNode.IsStaticField)
                    {
                        // return port will be same as parent node description.
                    }
                    else if (edObj.IsKindOfPackagePort && !edObj.IsInstanceNodePort && !edObj.IsProposedDataPort)
                    {
                        return(null);
                    }
                    else if (edObj.PortIndex >= (int)PortIndex.ParametersEnd)
                    {
                        return(null);
                    }

                    // Following port will contain the member info
                    if (edObj.IsProposedDataPort)
                    {
                        // contained in edObj
                    }
                    else if (edObj.IsInputPort)
                    {
                        var consumerPorts = edObj.SegmentEndConsumerPorts;
                        var aConsumer     = consumerPorts.Length != 0 ? consumerPorts[0] : edObj;
                        edObj = aConsumer.Parent;
                    }
                    else if (edObj.IsOutputPort)
                    {
                        edObj = edObj.SegmentProducerPort.Parent;
                    }
                }

                LibraryMemberInfo memberInfo = null;

                // Try and Get Member Info from GetAssociatedDescriptor
                if (edObj.IsKindOfFunction || edObj.IsEventHandler)
                {
                    memberInfo = edObj.GetLibraryObject() as LibraryMemberInfo;
                }

                return(memberInfo);
            }
            return(null);
        }