/// <summary> /// Creates or updates the Confeaturator tree. /// </summary> private void RefreshConfeaturatorTree() { try { SingleDiagramDocView diagramDocView = DesignerHelper.GetDiagramDocView(serviceProvider); FeatureModelDSLDiagram diagram = diagramDocView.CurrentDiagram as FeatureModelDSLDiagram; if (diagram != null) { FeatureModel featureModel = diagram.Subject as FeatureModel; if (featureModel != null) { Feature rootFeature = FeatureModel.GetCrossDiagramRootFeature(featureModel); trvFeatures.Nodes.Clear(); if (rootFeature != null) { addedFeatures = new List <string>(); FeatureModelTreeNode rootNode = CreateFeatureModelTreeNode(rootFeature); trvFeatures.Nodes.Add(rootNode); rootNode.Expand(); rootNode.Kind = FeatureModelNodeKind.Root; rootNode.Status = FeatureModelNodeStatus.CheckedAndDisabled; trvFeatures.SelectedNode = rootNode; } else { Util.ShowError("Feature model was loaded but root feature is null."); } } else { Util.ShowError("Could not load feature model into Confeaturator. Please ensure you have a valid feature model file opened."); } } else { Util.ShowError("Please have the feature model diagram you want to refresh into Confeaturator open and active in Visual Studio."); } } catch (Exception ex) { Util.ShowError("Error loading feature model into Confeaturator: " + ex.Message); } }