public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { Store store = GetStore(context.Instance); ClassShape classShape = context.Instance as ClassShape; ModelClass modelClass = classShape?.Subject as ModelClass; string targetClassName = modelClass?.Name; List <string> validNames = store.ElementDirectory .FindElements <ModelClass>() .Where(e => e.Name != targetClassName) .OrderBy(c => c.Name) .Select(c => c.Name) .ToList(); validNames.Insert(0, null); return(new StandardValuesCollection(validNames)); }
public override void ElementAdded(ElementAddedEventArgs e) { base.ElementAdded(e); ClassShape element = (ClassShape)e.ModelElement; Store store = element.Store; Transaction current = store.TransactionManager.CurrentTransaction; ModelRoot modelRoot = store.ModelRoot(); if (current.IsSerializing || ModelRoot.BatchUpdating) { return; } // if the diagram we're adding to isn't the current visible diagram, add the shape but don't show it Diagram currentDiagram = ModelRoot.GetCurrentDiagram?.Invoke(); if (element.Diagram != currentDiagram) { element.Hide(); } }
public void UpdateNodeImage() { if (RepresentedElement is ModelAttribute modelAttribute) { ThreadHelper.Generic.BeginInvoke(() => { SelectedImageKey = ImageKey = ClassShape.GetExplorerPropertyImageName(modelAttribute); }); } }
public void UpdateNodeImage() { // we're using the images determined by the shape class to keep the explorer and diagram glyphs in sync // available images are determined in EFModelExplorer.Init() if (RepresentedElement is ModelAttribute modelAttribute) { ThreadHelper.Generic.BeginInvoke(() => { SelectedImageKey = ImageKey = ClassShape.GetExplorerNodeImageName(modelAttribute); }); } else if (RepresentedElement is ModelClass modelClass) { ThreadHelper.Generic.BeginInvoke(() => { SelectedImageKey = ImageKey = ClassShape.GetExplorerNodeImageName(modelClass); }); } else if (RepresentedElement is ModelEnum modelEnum) { ThreadHelper.Generic.BeginInvoke(() => { SelectedImageKey = ImageKey = (modelEnum.IsVisible() ? nameof(Resources.Enumerator_16xVisible) : nameof(Resources.Enumerator_16x)); }); } }