public override void ElementAdded(ElementAddedEventArgs e) { if (e.ModelElement != null) { if (e.ModelElement.Store.TransactionManager.CurrentTransaction != null) { if (e.ModelElement.Store.TransactionManager.CurrentTransaction.IsSerializing) { return; } } } if (e.ModelElement == null) { return; } if (ImmutabilityExtensionMethods.GetLocks(e.ModelElement) != Locks.None) { return; } PropertyGridEditor propertyGridEditor = e.ModelElement as PropertyGridEditor; if (propertyGridEditor != null) { if (System.String.IsNullOrEmpty(propertyGridEditor.Namespace) || System.String.IsNullOrWhiteSpace(propertyGridEditor.Namespace)) { propertyGridEditor.Namespace = propertyGridEditor.MetaModel.Namespace; } } }
public override string GetMonikerQualifier(DomainXmlSerializerDirectory directory, ModelElement element) { if (directory == null) { throw new System.ArgumentNullException("directory"); } if (element == null) { throw new System.ArgumentNullException("element"); } PropertyGridEditor propertyGridEditor = element as PropertyGridEditor; object[] objArr = new object[] { propertyGridEditor.MetaModel.Name }; return(System.String.Format(CultureInfo.CurrentCulture, "/{0}", objArr)); }
public override string CalculateQualifiedName(Microsoft.VisualStudio.Modeling.DomainXmlSerializerDirectory directory, Microsoft.VisualStudio.Modeling.ModelElement element) { if (directory == null) { throw new System.ArgumentNullException("directory"); } if (element == null) { throw new System.ArgumentNullException("element"); } PropertyGridEditor propertyGridEditor = element as PropertyGridEditor; string s1 = this.GetMonikerQualifier(directory, propertyGridEditor); string s2 = propertyGridEditor.Name; object[] objArr = new object[] { s1, s2 }; return(System.String.Format(System.Globalization.CultureInfo.CurrentCulture, "{0}/{1}", objArr)); }
private static void FixUpPropertyGridEditors(MetaModel model) { PropertyGridEditor stringEditor = new PropertyGridEditor(model.Store); stringEditor.Name = "StringEditorViewModel"; stringEditor.Namespace = "Tum.PDE.ToolFramework.Modeling.Visualization.ViewModel.PropertyGrid"; stringEditor.ShouldBeGenerated = false; model.PropertyGridEditors.Add(stringEditor); PropertyGridEditor boolEditor = new PropertyGridEditor(model.Store); boolEditor.Name = "BooleanEditorViewModel"; boolEditor.Namespace = "Tum.PDE.ToolFramework.Modeling.Visualization.ViewModel.PropertyGrid"; boolEditor.ShouldBeGenerated = false; model.PropertyGridEditors.Add(boolEditor); PropertyGridEditor enumEditor = new PropertyGridEditor(model.Store); enumEditor.Name = "EnumerationEditorViewModel"; enumEditor.Namespace = "Tum.PDE.ToolFramework.Modeling.Visualization.ViewModel.PropertyGrid"; enumEditor.ShouldBeGenerated = false; model.PropertyGridEditors.Add(enumEditor); PropertyGridEditor dEditor = new PropertyGridEditor(model.Store); dEditor.Name = "DoubleEditorViewModel"; dEditor.Namespace = "Tum.PDE.ToolFramework.Modeling.Visualization.ViewModel.PropertyGrid"; dEditor.ShouldBeGenerated = false; model.PropertyGridEditors.Add(dEditor); PropertyGridEditor iEditor = new PropertyGridEditor(model.Store); iEditor.Name = "IntegerEditorViewModel"; iEditor.Namespace = "Tum.PDE.ToolFramework.Modeling.Visualization.ViewModel.PropertyGrid"; iEditor.ShouldBeGenerated = false; model.PropertyGridEditors.Add(iEditor); }
protected override IList <Microsoft.VisualStudio.Modeling.ModelElement> BuildElementList(object component) { Microsoft.VisualStudio.Modeling.DomainClassInfo domainClassInfo = DomainRoleInfo.RolePlayer; if (domainClassInfo == null || component == null) { return(new System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement>()); } Microsoft.VisualStudio.Modeling.Store store = this.GetStore(component); DomainRole domainRole = component as DomainRole; System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement> list = new System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement>(); list.AddRange(domainRole.Relationship.GetMetaModel().PropertyGridEditors); System.Collections.Generic.IList <Microsoft.VisualStudio.Modeling.ModelElement> ilist = store.ElementDirectory.FindElements(domainClassInfo, false); foreach (Microsoft.VisualStudio.Modeling.ModelElement modelElement in ilist) { PropertyGridEditor p = modelElement as PropertyGridEditor; bool bFound = false; foreach (PropertyGridEditor e in list) { if (e.Name == p.Name) { bFound = true; break; } } if (!bFound) { list.Add(p); } } return(list); }