/// <summary> /// Gets the type of the node. /// </summary> /// <returns> /// The node type. /// </returns> /// <remarks> /// This method only works when the add-in description to which the node belongs has been /// loaded from an add-in registry. /// </remarks> public ExtensionNodeType GetNodeType() { if (Parent is Extension) { Extension ext = (Extension)Parent; object ob = ext.GetExtendedObject(); if (ob is ExtensionPoint) { ExtensionPoint ep = (ExtensionPoint)ob; return(ep.NodeSet.GetAllowedNodeTypes() [NodeName]); } else if (ob is ExtensionNodeDescription) { ExtensionNodeDescription pn = (ExtensionNodeDescription)ob; ExtensionNodeType pt = ((ExtensionNodeDescription)pn).GetNodeType(); if (pt != null) { return(pt.GetAllowedNodeTypes() [NodeName]); } } } else if (Parent is ExtensionNodeDescription) { ExtensionNodeType pt = ((ExtensionNodeDescription)Parent).GetNodeType(); if (pt != null) { return(pt.GetAllowedNodeTypes() [NodeName]); } } return(null); }
/// <summary> /// Gets the node types allowed in this extension. /// </summary> /// <returns> /// The allowed node types. /// </returns> /// <remarks> /// This method only works when the add-in description to which the extension belongs has been /// loaded from an add-in registry. /// </remarks> public ExtensionNodeTypeCollection GetAllowedNodeTypes() { ObjectDescription ob = GetExtendedObject(); ExtensionPoint ep = ob as ExtensionPoint; if (ep != null) { return(ep.NodeSet.GetAllowedNodeTypes()); } ExtensionNodeDescription node = ob as ExtensionNodeDescription; if (node != null) { ExtensionNodeType nt = node.GetNodeType(); if (nt != null) { return(nt.GetAllowedNodeTypes()); } } return(new ExtensionNodeTypeCollection()); }