Exemplo n.º 1
0
        public void CloneTest()
        {
            var cls  = new ClassDefinition("Foo", "Bar");
            var prop = new DataPropertyDefinition("ID", "");

            prop.DataType        = DataPropertyType.Int32;
            prop.IsAutoGenerated = true;
            var prop2 = new DataPropertyDefinition("Prop1", "");

            Assert.Null(cls.FindProperty("ID"));
            cls.AddProperty(prop, true);
            Assert.Null(cls.FindProperty("Prop1"));
            cls.AddProperty(prop2);
            Assert.AreEqual(cls, prop.Parent);
            Assert.AreEqual(cls, prop2.Parent);
            Assert.AreEqual(2, cls.Properties.Count);
            Assert.AreEqual(1, cls.IdentityProperties.Count);

            var cls2 = ClassDefinition.Clone(cls);

            Assert.AreEqual(cls.Name, cls2.Name);
            Assert.AreEqual(cls.Description, cls2.Description);
            Assert.AreEqual(cls.Properties.Count, cls2.Properties.Count);
            Assert.AreEqual(cls.IdentityProperties.Count, cls2.IdentityProperties.Count);
            Assert.AreNotSame(cls, cls2);
        }
Exemplo n.º 2
0
 public void EmitStatement(EmitMode mode, D4.OperatorBlock block)
 {
     if (ClassDefinition != null)
     {
         block.ClassDefinition = (ClassDefinition)ClassDefinition.Clone();
     }
     else
     {
         block.Block = BlockNode.EmitStatement(mode);
     }
 }
Exemplo n.º 3
0
        public AccessorBlock EmitAccessorBlock(EmitMode mode)
        {
            AccessorBlock block = new AccessorBlock();

            if (ClassDefinition != null)
            {
                block.ClassDefinition = (ClassDefinition)ClassDefinition.Clone();
            }
            else
            {
                block.Block = BlockNode.EmitStatement(mode);
            }
            return(block);
        }
Exemplo n.º 4
0
        private void editClass(object sender, EventArgs e)
        {
            if (classList.SelectedItem == null)
            {
                return;
            }
            ClassDefinition selected = Program.Context.GetClass((string)classList.SelectedItem, null);

            if (selected != null)
            {
                string    sel = selected.Name;
                ClassForm r   = new ClassForm(selected.Clone());
                r.Saved += ClassSaved;
                r.Show();
            }
        }
Exemplo n.º 5
0
 public void MakeHistory(string id)
 {
     if (!doHistory)
     {
         return;
     }
     if (id == null)
     {
         id = "";
     }
     if (id == "" || id != lastid)
     {
         UndoBuffer.AddLast(cls.Clone());
         RedoBuffer.Clear();
         onChange();
         if (UndoBuffer.Count > MaxBuffer)
         {
             UndoBuffer.RemoveFirst();
         }
         UnsavedChanges++;
     }
     lastid = id;
 }
 /// <summary>
 /// Creates a new instance
 /// </summary>
 /// <param name="feature"></param>
 /// <param name="source"></param>
 protected MutableFeatureBase(IRecordInitialize feature, ClassDefinition source)
     : base(feature)
 {
     _clsDef = ClassDefinition.Clone(source);
 }