public void Run(IActiveRecordDescriptor descriptor) { using (CodePreviewDialog dlg = new CodePreviewDialog(descriptor)) { dlg.ShowDialog(Workspace.ActiveWindow); } }
private Shape CreateShapeFrom(IActiveRecordDescriptor descriptor) { Shape shape = null; if (descriptor is ActiveRecordBaseDescriptor) { ActiveRecordBaseClassShape arshape = (ActiveRecordBaseClassShape) graphControl1.AddShape("castle.ar.base.shape", new PointF(80, 20)); arshape.RelatedDescriptor = descriptor as ActiveRecordBaseDescriptor; arshape.FitSize(false); shape = arshape; } else { ActiveRecordShape arshape = (ActiveRecordShape) graphControl1.AddShape("castle.ar.shape", new PointF(30, 20)); arshape.ActiveRecordDescriptor = (ActiveRecordDescriptor)descriptor; shape = arshape; } System.Diagnostics.Debug.Assert(shape != null); shape.X = descriptor.PositionInView.X; shape.Y = descriptor.PositionInView.Y; _desc2Shape[descriptor] = shape; return(shape); }
public CodeTypeDeclaration Generate(IActiveRecordDescriptor descriptor) { if (descriptor.ClassName == null) return null; CodeTypeDeclaration declaration = new CodeTypeDeclaration(descriptor.ClassName); declaration.Attributes |= MemberAttributes.Public; if (descriptor is ActiveRecordBaseDescriptor) { } else { ActiveRecordDescriptor arDescriptor = (ActiveRecordDescriptor) descriptor; if (arDescriptor is ActiveRecordDescriptorSubClass) { declaration.BaseTypes.Add( new CodeTypeReference( (arDescriptor as ActiveRecordDescriptorSubClass).BaseClass.ClassName ) ); } else { declaration.BaseTypes.Add( new CodeTypeReference("ActiveRecordBase") ); } AddActiveRecordAttribute(declaration, arDescriptor); AddProperties(arDescriptor, declaration); AddRelations(arDescriptor, declaration); AddOperations(arDescriptor, declaration); } return declaration; }
public void Run(IActiveRecordDescriptor descriptor) { using(CodePreviewDialog dlg = new CodePreviewDialog(descriptor)) { dlg.ShowDialog(Workspace.ActiveWindow); } }
public void AddActiveRecordDescriptor( IActiveRecordDescriptor descriptor ) { if (descriptor == null) throw new ArgumentNullException("descriptor"); if (_descriptors.Contains(descriptor)) throw new ArgumentException("Already exists"); _descriptors.Add(descriptor); }
private void UpdateTree(Project project) { treeView1.Nodes.Clear(); TreeNode projectNode = new TreeNode(project.Name, ImageConstants.Database_Views, ImageConstants.Database_Views); treeView1.Nodes.Add(projectNode); foreach (DatabaseDefinition def in project.Databases) { TreeNode dbNode = new TreeNode(def.Alias, ImageConstants.Database_Catalog, ImageConstants.Database_Catalog); projectNode.Nodes.Add(dbNode); dbNode.EnsureVisible(); foreach (TableDefinition table in def.Tables) { TreeNode tableNode = new TreeNode(table.Name, ImageConstants.Database_Table, ImageConstants.Database_Table); dbNode.Nodes.Add(tableNode); foreach (ColumnDefinition colDef in table.Columns) { TreeNode colNode = new TreeNode(colDef.Name, ImageConstants.Database_Field, ImageConstants.Database_Field); tableNode.Nodes.Add(colNode); } } } Hashtable db2Node = new Hashtable(); foreach (DictionaryEntry entry in project.BaseClasses) { IActiveRecordDescriptor baseDesc = entry.Value as IActiveRecordDescriptor; TreeNode arBaseNode = new TreeNode(baseDesc.ClassName, ImageConstants.Classes_Entity, ImageConstants.Classes_Entity); arBaseNode.Tag = baseDesc; projectNode.Nodes.Add(arBaseNode); db2Node[entry.Key] = arBaseNode; } foreach (IActiveRecordDescriptor desc in project.Descriptors) { ActiveRecordDescriptor arDesc = desc as ActiveRecordDescriptor; if (arDesc == null) { continue; } TreeNode arNode = new TreeNode(desc.ClassName, ImageConstants.Classes_Entity, ImageConstants.Classes_Entity); arNode.Tag = arDesc; TreeNode parent = db2Node[arDesc.Table.DatabaseDefinition] as TreeNode; parent.Nodes.Add(arNode); } }
public CodePreviewDialog(IActiveRecordDescriptor descriptor) : this() { codeproviderFactory = ServiceRegistry.Instance[typeof(ICodeProviderFactory)] as ICodeProviderFactory; ICodeDomGenerator codeDomGen = ServiceRegistry.Instance[typeof(ICodeDomGenerator)] as ICodeDomGenerator; typeDecl = codeDomGen.Generate(descriptor); language.ValueMember = "Label"; foreach (CodeProviderInfo info in codeproviderFactory.GetAvailableProviders()) { language.Items.Add(info); } language.SelectedIndex = 0; }
public CodePreviewDialog(IActiveRecordDescriptor descriptor) : this() { codeproviderFactory = ServiceRegistry.Instance[ typeof(ICodeProviderFactory) ] as ICodeProviderFactory; ICodeDomGenerator codeDomGen = ServiceRegistry.Instance[ typeof(ICodeDomGenerator) ] as ICodeDomGenerator; typeDecl = codeDomGen.Generate(descriptor); language.ValueMember = "Label"; foreach(CodeProviderInfo info in codeproviderFactory.GetAvailableProviders()) { language.Items.Add(info); } language.SelectedIndex = 0; }
public CodeTypeDeclaration Generate(IActiveRecordDescriptor descriptor) { if (descriptor.ClassName == null) { return(null); } CodeTypeDeclaration declaration = new CodeTypeDeclaration(descriptor.ClassName); declaration.Attributes |= MemberAttributes.Public; if (descriptor is ActiveRecordBaseDescriptor) { } else { ActiveRecordDescriptor arDescriptor = (ActiveRecordDescriptor)descriptor; if (arDescriptor is ActiveRecordDescriptorSubClass) { declaration.BaseTypes.Add(new CodeTypeReference((arDescriptor as ActiveRecordDescriptorSubClass).BaseClass.ClassName)); } else { declaration.BaseTypes.Add(new CodeTypeReference("ActiveRecordBase")); } AddActiveRecordAttribute(declaration, arDescriptor); AddProperties(arDescriptor, declaration); AddRelations(arDescriptor, declaration); AddOperations(arDescriptor, declaration); } return(declaration); }
private Shape ObtainShape(IActiveRecordDescriptor desc) { return(_desc2Shape[desc] as Shape); }
private Shape CreateShapeFrom(IActiveRecordDescriptor descriptor) { Shape shape = null; if (descriptor is ActiveRecordBaseDescriptor) { ActiveRecordBaseClassShape arshape = (ActiveRecordBaseClassShape) graphControl1.AddShape("castle.ar.base.shape", new PointF(80, 20)); arshape.RelatedDescriptor = descriptor as ActiveRecordBaseDescriptor; arshape.FitSize(false); shape = arshape; } else { ActiveRecordShape arshape = (ActiveRecordShape) graphControl1.AddShape("castle.ar.shape", new PointF(30, 20)); arshape.ActiveRecordDescriptor = (ActiveRecordDescriptor) descriptor; shape = arshape; } System.Diagnostics.Debug.Assert( shape != null ); shape.X = descriptor.PositionInView.X; shape.Y = descriptor.PositionInView.Y; _desc2Shape[descriptor] = shape; return shape; }
private Shape ObtainShape(IActiveRecordDescriptor desc) { return _desc2Shape[desc] as Shape; }
public void PreviewCode(IActiveRecordDescriptor descriptor) { codePreviewAction.Run(descriptor); }
public bool RemoveDescriptor(IActiveRecordDescriptor descriptor) { if (descriptor is ActiveRecordDescriptorSubClass || descriptor is ActiveRecordDescriptorJoinedSubClass) { _descriptors.Remove(descriptor); return true; } return false; }