/// <exception cref="RelationshipException">
		/// Cannot create realization.
		/// </exception>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="implementer"/> is null.-or-
		/// <paramref name="baseType"/> is null.
		/// </exception>
		internal RealizationRelationship(TypeBase implementer, InterfaceType baseType)
			: base(implementer, baseType)
		{
			if (!(implementer is IInterfaceImplementer))
				throw new RelationshipException(Strings.ErrorNotInterfaceImplementer);
			Attach();
		}
Example #2
0
        void InitEditor(TypeBase typeBase)
        {
            if (typeBase is CompositeType)
            {
                editor = new CompositeTypeEditor().SetCompositeType((CompositeType)typeBase);
                
            }
            else if (typeBase is EnumType)
            {
                editor = new EnumTypeEditor().SetEnumType((EnumType)typeBase);
            }
            else if (typeBase is DelegateType)
            {
                editor = new DelegateTypeEditor().SetDelegateType((DelegateType)typeBase);
            }
            else
                throw new NotSupportedException(typeBase.GetType().FullName);

            Handler.EditHandler = editor;
            editor.Dock = System.Windows.Forms.DockStyle.Fill;
            Controls.Add(editor);
            UpdateName();
            typeBase.Renamed += new EventHandler(typeBase_StateChanged);
            typeBase.StateChanged += new EventHandler(typeBase_StateChanged);
        }
Example #3
0
 protected void SetTypeBase(TypeBase typeBase)
 {
     type = typeBase;
     type.Clean();
     type.Modified += new EventHandler(type_Modified);
     type.ProjectInfo.Saved += new EventHandler(Project_Saved);
 }
Example #4
0
 public TypeNode(TypeBase type)
 {
     ImageKey = type.EntityType.ToString();
     SelectedImageKey = ImageKey;
     TypeBase = type;
     TypeBase.Renamed += new EventHandler(TypeBase_Renamed);
     Text = TypeBase.Name;
 }
		/// <exception cref="ArgumentNullException">
		/// <paramref name="first"/> is null.-or-
		/// <paramref name="second"/> is null.
		/// </exception>
		protected TypeRelationship(TypeBase first, TypeBase second)
		{
			if (first == null)
				throw new ArgumentNullException("first");
			if (second == null)
				throw new ArgumentNullException("second");

			this.first = first;
			this.second = second;
		}
        public void ShowDialog(TypeBase typeBase, bool memberOnly = false)
        {
            type = typeBase;
            TypeBase copy = null;

            if (typeBase is CompositeType)
            {
                if (type is ClassType)
                    copy = ((ClassType)type).Clone();
                else if (type is StructureType)
                    copy = ((StructureType)type).Clone();
                else if (type is InterfaceType)
                    copy = ((InterfaceType)type).Clone();
                copy.ProjectInfo = type.ProjectInfo;
                editor = new CompositeTypeEditor().SetCompositeType((CompositeType)copy, memberOnly);
                MinimumSize = new Size(790, 610);
                Size = new Size(1000, 700);
            }
            else if (typeBase is EnumType)
            {
                copy = ((EnumType)type).Clone();
                copy.ProjectInfo = type.ProjectInfo;
                editor = new EnumTypeEditor().SetEnumType((EnumType)copy, memberOnly);
            }
            else if (typeBase is DelegateType)
            {
                copy = ((DelegateType)type).Clone();
                copy.ProjectInfo = type.ProjectInfo;
                editor = new DelegateTypeEditor().SetDelegateType((DelegateType)copy, memberOnly);
            }
            else
                throw new NotSupportedException(typeBase.GetType().FullName);

            UpdateButtons();
            editor.EditStateChanged += new EventHandler(editor_EditStateChanged);

            editor.Dock = System.Windows.Forms.DockStyle.Fill;
            kryptonPanelMain.Controls.Add(editor);
            ShowDialog();
        }
Example #7
0
		protected override void CopyFrom(TypeBase type)
		{
			base.CopyFrom(type);

			CompositeType compositeType = (CompositeType) type;
			fields.Clear();
			fields.Capacity = compositeType.fields.Capacity;
			operations.Clear();
			operations.Capacity = compositeType.operations.Capacity;

			foreach (Field field in compositeType.fields)
			{
				AddField(field.Clone(this));
			}
			foreach (Operation operation in compositeType.operations)
			{
				AddOperation(operation.Clone(this));
			}
		}
Example #8
0
		internal void RemoveNestedChild(TypeBase type)
		{
			if (type != null && nestedChildren.Remove(type))
				Changed();
		}
Example #9
0
		internal void AddNestedChild(TypeBase type)
		{
			if (type != null && !nestedChildren.Contains(type))
			{
				nestedChildren.Add(type);
				Changed();
			}
		}
Example #10
0
 public MemberInfo(TypeBase type)
 {
     Type = type;
 }
		/// <exception cref="RelationshipException">
		/// Cannot create nesting relationship.
		/// </exception>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="parentClass"/> is null.-or-
		/// <paramref name="innerClass"/> is null.
		/// </exception>
		internal NestingRelationship(CompositeType parentType, TypeBase innerType)
			: base(parentType, innerType)
		{
			Attach();
		}
Example #12
0
 public TypeDocument(TypeBase document, IDockForm dockForm)
 {
     InitializeComponent();
     DockForm = dockForm;
     InitEditor(document);
 }
Example #13
0
		/// <exception cref="ArgumentNullException">
		/// <paramref name="type"/> is null.
		/// </exception>
		public static Image GetImage(TypeBase type)
		{
			if (type == null)
				throw new ArgumentNullException("type");

			return GetImage(type.EntityType, type.AccessModifier);
		}
Example #14
0
 public TypeModel(TypeBase type, IEnumerable<TypeBase> types, IRazorTemplate template)
     : base(type.ProjectInfo.Name, template)
 {
     Type = type;
     Types = types;
 }
Example #15
0
 public string GetNested(TypeBase type)
 {
     var model = new TypeModel(type, Types, Template);
     return RazorHelper.Parse(Template.Template, model);
 }
		public DependencyRelationship Clone(TypeBase first, TypeBase second)
		{
			DependencyRelationship dependency = new DependencyRelationship(first, second);
			dependency.CopyFrom(this);
			return dependency;
		}
		/// <exception cref="ArgumentNullException">
		/// <paramref name="first"/> is null.-or-
		/// <paramref name="second"/> is null.
		/// </exception>
		internal DependencyRelationship(TypeBase first, TypeBase second) : base(first, second)
		{
			Attach();
		}
		public NestingRelationship Clone(CompositeType parentType, TypeBase innerType)
		{
			NestingRelationship nesting = new NestingRelationship(parentType, innerType);
			nesting.CopyFrom(this);
			return nesting;
		}
		public AssociationRelationship Clone(TypeBase first, TypeBase second)
		{
			AssociationRelationship association = new AssociationRelationship(first, second);
			association.CopyFrom(this);
			return association;
		}
		public RealizationRelationship Clone(TypeBase implementer, InterfaceType baseType)
		{
			RealizationRelationship realization = new RealizationRelationship(implementer, baseType);
			realization.CopyFrom(this);
			return realization;
		}
Example #21
0
		protected override void CopyFrom(TypeBase type)
		{
			base.CopyFrom(type);

			EnumType enumType = (EnumType) type;
			values.Clear();
			values.Capacity = enumType.values.Capacity;
			foreach (EnumValue value in enumType.values)
			{
				values.Add(value.Clone());
			}
		}
Example #22
0
		protected override void CopyFrom(TypeBase type)
		{
			base.CopyFrom(type);

			DelegateType delegateType = (DelegateType) type;
			returnType = delegateType.returnType;
			argumentList = delegateType.argumentList.Clone();
		}
Example #23
0
 protected virtual void CopyFrom(TypeBase type)
 {
     Id = type.Id;
     name = type.name;
     access = type.access;
     comments = type.comments;
 }
		/// <exception cref="ArgumentNullException">
		/// <paramref name="first"/> or <paramref name="second"/> is null.
		/// </exception>
		internal AssociationRelationship(TypeBase first, TypeBase second)
			: base(first, second)
        {
			Attach();
		}
Example #25
0
		protected override void CopyFrom(TypeBase type)
		{
			base.CopyFrom(type);
			ClassType classType = (ClassType) type;
			modifier = classType.modifier;
			strategy = classType.strategy;
		}
		/// <exception cref="ArgumentNullException">
		/// <paramref name="first"/> is null.-or-
		/// <paramref name="second"/> is null.
		/// </exception>
		internal AssociationRelationship(TypeBase first, TypeBase second, AssociationType type)
			: base(first, second)
		{
			this.associationType = type;
			Attach();
		}
Example #27
0
 /// <exception cref="ArgumentNullException">
 /// <paramref name="typeBase"/> is null.
 /// </exception>
 protected TypeShape(TypeBase typeBase)
     : base(typeBase)
 {
     MinimumSize = new Size(DefaultWidth, MinimumSize.Height);
     typeBase.Modified += new EventHandler(typeBase_Modified);
 }
		protected override void CopyFrom(TypeBase type)
		{
			base.CopyFrom(type);

			tableName = ((SingleInharitanceType)type).TableName;
		}
Example #29
0
 private bool IsNestedAncestor(TypeBase type)
 {
     if (NestingParent != null && NestingParent.IsNestedAncestor(type))
         return true;
     else
         return (type == this);
 }