private Tree CreateErrorTree(string treeId, string errorMessage) { var tree = new Tree("ERRORTREE:" + treeId) { BuildProcessContext = new BuildProcessContext(), BuildResult = new BuildResult() }; tree.AttachmentPoints.Add( new EntityTokenAttachmentPoint { EntityToken = new DeveloperApplicationProviderEntityToken(DeveloperApplicationProviderEntityToken.TreeDefinitionId, treeId), Position = ElementAttachingProviderPosition.Top } ); tree.RootTreeNode = new RootTreeNode() { Id = "ERRORTREEROOT", Tree = tree }; var simpleElementTreeNode = new SimpleElementTreeNode() { Label = StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "KeyFacade.ErrorTreeNode.Label"), Id = "ERROR", ToolTip = errorMessage, Icon = ResourceHandle.BuildIconFromDefaultProvider("close"), Tree = tree }; var messageBoxActionNode = new MessageBoxActionNode { Id = 1, OwnerNode = simpleElementTreeNode, Label = StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "KeyFacade.ErrorTreeNode.ShowMessage.Label"), ToolTip = StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "KeyFacade.ErrorTreeNode.ShowMessage.ToolTip"), Icon = ResourceHandle.BuildIconFromDefaultProvider("log-showlog"), Title = StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "KeyFacade.ErrorTreeNode.ShowMessage.Title"), Message = errorMessage, DialogType = DialogType.Error, PermissionTypes = new List <PermissionType> { PermissionType.Administrate } }; simpleElementTreeNode.AddActionNode(messageBoxActionNode); tree.RootTreeNode.AddChildTreeNode(simpleElementTreeNode); return(tree); }
private static void DoInitialize(string elementAttachingProviderName) { var sharedRootFolders = new Dictionary <string, CustomTreePerspectiveInfo>(); var treeNodeDynamicContext = new TreeNodeDynamicContext(TreeNodeDynamicContextDirection.Down); treeNodeDynamicContext.Piggybag = new Dictionary <string, string>(); foreach (var tree in TreeFacade.AllTrees) { if (!tree.ShareRootElementById) { continue; } IEnumerable <NamedAttachmentPoint> namedAttachmentPoints = tree.AttachmentPoints. OfType <NamedAttachmentPoint>(); if (namedAttachmentPoints.Count() != 1) { continue; } if (tree.RootTreeNode.ChildNodes.Count() != 1) { continue; } SimpleElementTreeNode childTreeNode = tree.RootTreeNode.ChildNodes.Single() as SimpleElementTreeNode; if (childTreeNode == null) { continue; } NamedAttachmentPoint namedAttachmentPoint = namedAttachmentPoints.Single(); EntityToken perspectiveEntityToken; if (!sharedRootFolders.ContainsKey(childTreeNode.Id)) { perspectiveEntityToken = new TreePerspectiveEntityToken(childTreeNode.Id); var dynamicValuesHelperReplaceContext = new DynamicValuesHelperReplaceContext( namedAttachmentPoint.AttachingPoint.EntityToken, null); // MRJ: Collection actions Element element = new Element(new ElementHandle(elementAttachingProviderName, perspectiveEntityToken)) { VisualData = new ElementVisualizedData { Label = childTreeNode.LabelDynamicValuesHelper.ReplaceValues(dynamicValuesHelperReplaceContext), ToolTip = childTreeNode.ToolTipDynamicValuesHelper.ReplaceValues(dynamicValuesHelperReplaceContext), HasChildren = true, Icon = childTreeNode.Icon, OpenedIcon = childTreeNode.OpenIcon } }; sharedRootFolders.Add(childTreeNode.Id, new CustomTreePerspectiveInfo { AttachmentPoint = new NamedAttachmentPoint { AttachingPoint = new AttachingPoint(namedAttachmentPoint.AttachingPoint), Position = namedAttachmentPoint.Position }, Element = element, Trees = new List <Tree> { tree } }); } else { perspectiveEntityToken = sharedRootFolders[childTreeNode.Id].Element.ElementHandle.EntityToken; sharedRootFolders[childTreeNode.Id].Trees.Add(tree); } namedAttachmentPoint.AttachingPoint = new AttachingPoint(perspectiveEntityToken); tree.RootTreeNode = childTreeNode; } _sharedRootFolders = sharedRootFolders; }