/// <summary> /// The copy id item click event copies the selected feature node id to the clipboard. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The MenuItemEventArgs.</param> void CopyIdItem_Click(object sender, MenuItemEventArgs e) { IExplorerNode owner = (IExplorerNode)e.Owner; IFeatureNodeInfo annotation = owner.Annotations.GetValue <IFeatureNodeInfo>(); if (annotation.Id != null) { Clipboard.SetData(DataFormats.Text, annotation.Id.ToString("D")); } }
/// <summary> /// Creates the feature dependency nodes. /// </summary> /// <param name="parentNode">The parent node.</param> internal static void CreateFeatureDependencyNodes(IExplorerNode parentNode) { IFeatureNodeInfo info = parentNode.ParentNode.Annotations.GetValue <IFeatureNodeInfo>(); FeatureInfo featureDetails = new FeatureInfo() { FeatureID = info.Id }; FeatureDependencyInfo[] dependencies = parentNode.Context.SharePointConnection.ExecuteCommand <FeatureInfo, FeatureDependencyInfo[]>(FeatureSharePointCommandIds.GetFeatureDependencies, featureDetails); foreach (FeatureDependencyInfo dependency in dependencies) { CreateNode(parentNode, dependency); } }
/// <summary> /// Creates the feature element nodes. /// </summary> /// <param name="parentNode">The parent node.</param> internal static void CreateFeatureElementNodes(IExplorerNode parentNode) { IFeatureNodeInfo info = parentNode.ParentNode.Annotations.GetValue <IFeatureNodeInfo>(); FeatureInfo featureDetails = new FeatureInfo() { FeatureID = info.Id }; FeatureElementInfo[] elements = parentNode.Context.SharePointConnection.ExecuteCommand <FeatureInfo, FeatureElementInfo[]>(FeatureSharePointCommandIds.GetFeatureElements, featureDetails); foreach (FeatureElementInfo element in elements) { IExplorerNode elementNode = CreateNode(parentNode, element); elementNode.DoubleClick += ElementNode_DoubleClick; } }
/// <summary> /// Create the child nodes and register their events. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The ExplorerNodeMenuItemsRequestedEventArgs.</param> void NodeType_NodeMenuItemsRequested(object sender, ExplorerNodeMenuItemsRequestedEventArgs e) { IFeatureNodeInfo info = e.Node.Annotations.GetValue <IFeatureNodeInfo>(); FeatureInfo featureDetails = new FeatureInfo() { FeatureID = info.Id, Scope = (Scope)info.Scope }; if (EnabledExtensionsOptionsPage.GetSetting <bool>(EnabledExtensionsOptions.ActivateDeactivateFeature, true)) { AddToggleFeatureMenuItem(e.Node, e.MenuItems, featureDetails); } if (EnabledExtensionsOptionsPage.GetSetting <bool>(EnabledExtensionsOptions.FeatureCopyID, true)) { AddCopyIDMenuItem(e.Node, e.MenuItems, info); } }
/// <summary> /// Add the copy Id menu item. /// </summary> /// <param name="parent">The parent node.</param> /// <param name="items">The menu item collection.</param> /// <param name="nodeInfo">The feature info.</param> void AddCopyIDMenuItem(IExplorerNode parent, IMenuItemCollection items, IFeatureNodeInfo nodeInfo) { IMenuItem copyIdItem = items.Add(CKSProperties.FeatureNodeExtension_CopyIdNodeName, 1); copyIdItem.Click += new EventHandler <MenuItemEventArgs>(CopyIdItem_Click); }