Example #1
0
        public static UMLAssociation CreateNew(
			CanvasGroup group,
			DI.Diagram ownerDiagram,
			UML.Association associationModel )
        {
            return null;
        }
 public void ShowOwnedElementsFor(UML.Element element)
 {
     _owner = element;
     _ownedElements = (IList)_owner.GetType().InvokeMember(
         _ownedPropertyName,
         BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Instance,
         null,
         _owner,
         null);
     string[] propertyList = new string[_ownedElements.Count];
     UML.NamedElement ne;
     object current;
     Type currentType;
     string label;
     for(int i = 0; i < _ownedElements.Count; i ++)
     {
         current = _ownedElements[i];
         ne = current as UML.NamedElement;
         label = (ne!=null ? ne.Name : null);
         if(label == null || label == "")
         {
             label = current.ToString();
             currentType = current.GetType();
             if(label == "" || label == currentType.FullName)
             {
                 // removes the "__Impl" part of the class name
                 label = currentType.Name.Substring(6);
             }
         }
         propertyList[i] = label;
     }
     base.ShowList(propertyList);
 }
Example #3
0
        public static UMLClassifier CreateNew(
			UMLDiagram ownerDiagram,
			UML.Classifier classifierModel )
        {
            DI.GraphNode classifierGN = UMLBox.CreateNewGraphNode(ownerDiagram, classifierModel);
            return new UMLClassifier (ownerDiagram, classifierGN);
        }
        public AssemblyConstructor(AssemblyImporter importer, Uml2.Class umlType,
			ConstructorInfo constructor)
            : base(importer, umlType)
        {
            _ctorInfo = constructor;
            Begin ();
        }
 public void ShowOwnedOperationsFor(UML.Classifier element)
 {
     _owner = element;
     // sets a global reference to the collection
     UML.Class ownerClass;
     UML.DataType ownerDatatype;
     UML.Interface ownerInterface;
     if((ownerClass = _owner as UML.Class) != null)
     {
         _ownedOperations = ownerClass.OwnedOperation;
     }
     else if((ownerDatatype = _owner as UML.DataType) != null)
     {
         _ownedOperations = ownerDatatype.OwnedOperation;
     }
     else if((ownerInterface = _owner as UML.Interface) != null)
     {
         _ownedOperations = ownerInterface.OwnedOperation;
     }
     // shows the collection items
     string[] operationList = new string[_ownedOperations.Count];
     UML.Operation prop;
     for(int i = 0; i < _ownedOperations.Count; i ++)
     {
         prop = (UML.Operation)_ownedOperations[i];
         operationList[i] = prop.Name;
     }
     base.ShowList(operationList);
 }
 public void ShowElementTypeFor(UML.Element element)
 {
     _element = element;
     _lblType.Text = (element == null ?
         String.Empty : element.GetType().Name.Substring(6));
     _btnGoUp.Sensitive = (element.Owner != null);
 }
        public static UMLInstanceSpecification CreateNew(
			UMLDiagram ownerDiagram,
			UML.InstanceSpecification iSpecModel)
        {
            DI.GraphNode isGN = UMLBox.CreateNewGraphNode(ownerDiagram, iSpecModel);
            return new UMLInstanceSpecification (ownerDiagram, isGN);
        }
Example #8
0
        public static UMLClass CreateNew(
			UMLDiagram ownerDiagram,
			UML.Class clsModel )
        {
            // creates the graphical representation of the new Class
            DI.GraphNode classifierGN = new DI.GraphNode ();
            //    model bridge to the UML model element (Class)
            Uml2SemanticModelBridge bridge = new Uml2SemanticModelBridge ();
            bridge.Element = clsModel;
            classifierGN.SemanticModel = bridge;
            // graphical representation of the property "Name"
            DI.GraphNode nameGN = new DI.GraphNode ();
            //    graphical properties
            nameGN.Position.X = 4D;
            nameGN.Position.Y = 6D;
            nameGN.Property[DI.StandardProperty.FontFamily] = "Verdana";
            nameGN.Property[DI.StandardProperty.FontSize] = "10";
            //    model bridge to the property
            DI.SimpleSemanticModelElement nameBridge = new DI.SimpleSemanticModelElement ();
            nameBridge.TypeInfo = "NameCompartment";
            nameGN.SemanticModel = nameBridge;
            // adds the name GN to the Use Case GN
            classifierGN.Contained.Add (nameGN);
            nameGN.Container = classifierGN;
            // adds the classifier to the diagram
            ownerDiagram.DIDiagram.Contained.Add (classifierGN);
            classifierGN.Container = ownerDiagram.DIDiagram;
            return new UMLClass (ownerDiagram, classifierGN);
        }
 public void ShowPropertiesFor(UML.MultiplicityElement element)
 {
     _multiplicityElement = element;
     _orderedViewer.ShowPropertyValueFor(element);
     _uniqueViewer.ShowPropertyValueFor(element);
     _lower.Text = element.Lower.ToString();
     _upper.Text = element.Upper.ToString();
 }
        public static UMLStereotypedEdge CreateNewAndAdd(
			UMLDiagram owningDiagram,
			UML.Relationship stereotypedEdgeModel,
			DI.GraphElement fromGE,
			DI.GraphElement toGE
		)
        {
            // creates the graphical representation of the new Stereotyped Edge
            DI.GraphEdge stereotypedEdgeGE = new DI.GraphEdge ();
            // model semanticModelBridge to the UML model element
            Uml2SemanticModelBridge semanticModelBridge = new Uml2SemanticModelBridge ();
            semanticModelBridge.Element = stereotypedEdgeModel;
            stereotypedEdgeGE.SemanticModel = semanticModelBridge;
            // adds anchors and anchorages
            DI.GraphConnector cnn;

            cnn = new DI.GraphConnector ();
            cnn.GraphElement = fromGE;
            fromGE.Position.CopyTo (cnn.Position);
            fromGE.Anchorage.Add (cnn);
            stereotypedEdgeGE.Anchor.Add (cnn);
            cnn.GraphEdge.Add(stereotypedEdgeGE);

            cnn = new DI.GraphConnector ();
            cnn.GraphElement = toGE;
            toGE.Position.CopyTo (cnn.Position);
            toGE.Anchorage.Add (cnn);
            stereotypedEdgeGE.Anchor.Add (cnn);
            cnn.GraphEdge.Add(stereotypedEdgeGE);
            // adds waypoints
            DI.GraphNode gn = fromGE as DI.GraphNode;
            DI.Point f = (gn != null ? gn.Center : fromGE.Position.Clone ());
            gn = toGE as DI.GraphNode;
            DI.Point t = (gn != null ? gn.Center : toGE.Position.Clone ());
            stereotypedEdgeGE.Waypoints.Add (f);
            stereotypedEdgeGE.Waypoints.Add (t);
            // adds the stereotype compartment
            DI.SimpleSemanticModelElement bridge;
            DI.GraphNode stCompartmentGN = new DI.GraphNode ();
            bridge = new DI.SimpleSemanticModelElement ();
            bridge.TypeInfo = "StereotypeCompartment";
            stCompartmentGN.SemanticModel = bridge;
            stereotypedEdgeGE.Contained.Add (stCompartmentGN);
            stCompartmentGN.Container = stereotypedEdgeGE;
            DI.Point.GetHalfWayPoint (fromGE.Position, toGE.Position).CopyTo (stCompartmentGN.Position);
            DI.GraphNode keywordMetaclassGN = new DI.GraphNode ();
            bridge = new DI.SimpleSemanticModelElement ();
            bridge.TypeInfo = "KeywordMetaclass";
            keywordMetaclassGN.SemanticModel = bridge;
            stCompartmentGN.Contained.Add (keywordMetaclassGN);
            keywordMetaclassGN.Container = stCompartmentGN;
            // adds the stereotypedEdge to the diagram
            owningDiagram.DIDiagram.Contained.Add (stereotypedEdgeGE);
            stereotypedEdgeGE.Container = owningDiagram.DIDiagram;
            UMLStereotypedEdge stereotypedEdge = new UMLStereotypedEdge (owningDiagram, stereotypedEdgeGE, stereotypedEdgeModel);
            owningDiagram.UMLCanvas.AddElement (stereotypedEdge);
            return stereotypedEdge;
        }
Example #11
0
        private UMLGeneralization(
			UMLDiagram ownerDiagram,
			DI.GraphEdge generalizationGraphEdge,
			UML.Generalization generalizationModel
		)
            : base(ownerDiagram, generalizationGraphEdge, false)
        {
            _modelElement = generalizationModel;
            SetEdgeEnds ();
        }
Example #12
0
 public void ShowCommentsFor(UML.Element element)
 {
     _umlElement = element;
     string[] commentList = new string[element.OwnedComment.Count];
     for(int i = 0; i < element.OwnedComment.Count; i ++)
     {
         commentList[i] = ((UML.Comment)element.OwnedComment[i]).Body;
     }
     base.ShowList(commentList);
 }
 public void ShowExtensionLocationFor(UML.Extend element)
 {
     _extend = element;
     string[] extensionLocationList = new string[element.ExtensionLocation.Count];
     for(int i = 0; i < element.ExtensionLocation.Count; i ++)
     {
         extensionLocationList[i] = ((UML.ExtensionPoint)element.ExtensionLocation[i]).QualifiedName;
     }
     base.ShowList(extensionLocationList);
 }
Example #14
0
        public UMLNamedEdge(
			UMLDiagram ownerDiagram,
			DI.GraphEdge graphEdge,
			UML.NamedElement namedElementModel,
			bool forceRedraw)
            : base(ownerDiagram, graphEdge, forceRedraw)
        {
            _namedElementModel = namedElementModel;
            SearchAndDrawName (graphEdge, ownerDiagram);
        }
 public void ShowPropertyValueFor(UML.Element element)
 {
     _owner = element;
     _checkButton.Active = (bool)_owner.GetType().InvokeMember(
         _propertyName,
         BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Instance,
         null,
         _owner,
         null);
 }
        private UMLInterfaceRealization(
			UMLDiagram ownerDiagram,
			DI.GraphEdge interfaceRealizationGraphEdge,
			UML.InterfaceRealization interfaceRealizationModel
		)
            : base(ownerDiagram, interfaceRealizationGraphEdge, false)
        {
            _modelElement = interfaceRealizationModel;
            SetEdgeEnds ();
        }
Example #17
0
        private UMLAssociation(
			UMLDiagram ownerDiagram,
			DI.GraphEdge associationGraphEdge,
			UML.Association associationModel
		)
            : base(ownerDiagram, associationGraphEdge, associationModel, false)
        {
            _modelElement = associationModel;
            SetEdgeEnds ();
            SearchAndDrawEndTexts ();
        }
Example #18
0
        protected void CreateOperation(Uml2.Operation operation, ParameterInfo[] parms)
        {
            _operation = operation;

            foreach (ParameterInfo parm in parms)
            {
                Uml2.Parameter parameter = Uml2.Create.Parameter ();
                parameter.Name = parm.Name;
                AssemblyHelper.SetParameter (parameter, parm.ParameterType, _importer);
                _operation.OwnedParameter.Add (parameter);
            }
        }
        public UMLStereotypedEdge(
			UMLDiagram ownerDiagram,
			DI.GraphEdge graphEdge,
			UML.Relationship edgeModel
		)
            : base(ownerDiagram, graphEdge, false)
        {
            _modelElement = edgeModel;
            base.AddToEnd (new UMLOpenArrow (ChildrensRoot));
            SearchAndDrawStereotype (graphEdge, ownerDiagram);
            base.ForceRedraw ();
        }
 public void ShowAnnotatedElementsFor(UML.Comment comment)
 {
     _comment = comment;
     UML.NamedElement named;
     string[] annotatedList = new string[comment.AnnotatedElement.Count];
     object current;
     for(int i = 0; i < comment.AnnotatedElement.Count; i ++)
     {
         current = comment.AnnotatedElement[i];
         named = current as UML.NamedElement;
         annotatedList[i] = (named == null ?
             current.GetType().Name.Substring(6) : named.QualifiedName);
     }
     base.ShowList(annotatedList);
 }
 public void ShowPropertyValueFor(UML.Element element)
 {
     if(_owner!=null && !object.ReferenceEquals(_owner, element))
     {
         CheckIfChanged();
     }
     _owner = element;
     _lastValue = (string)_owner.GetType().InvokeMember(
         _propertyName,
         BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Instance,
         null,
         _owner,
         null);
     _entry.Text = _lastValue==null ? String.Empty : _lastValue;
 }
Example #22
0
 public void ShowOwnedTypeFor(UML.Package package)
 {
     _package = package;
     string name;
     string[] typeList = new string[package.OwnedType.Count];
     for(int i = 0; i < package.OwnedType.Count; i ++)
     {
         name = ((UML.Type)package.OwnedType[i]).Name;
         if (name==null || name==String.Empty)
         {
             name = "<<" + package.OwnedType[i].GetType().Name.Substring(6) + ">>";
         }
         typeList[i] = name;
     }
     base.ShowList(typeList);
 }
 public void ShowConditionFor(UML.Extend extend)
 {
     _extend = extend;
     string representation = null;
     if(extend.Condition != null)
     {
         if(extend.Condition.Specification != null)
         {
             representation = extend.Condition.Specification.ToString();
         }
         else
         {
             representation = GettextCatalog.GetString ("<<A constraint>>");
         }
     }
     base.SetValue(representation);
 }
Example #24
0
 public void ShowIncludeFor(UML.UseCase element)
 {
     _useCase = element;
     UML.Include include;
     string[] includeList = new string[element.Include.Count];
     for(int i = 0; i < element.Include.Count; i ++)
     {
         include = (UML.Include)element.Include[i];
         if(include.Addition == null)
         {
             includeList[i] = GettextCatalog.GetString ("Include #") + i;
         }
         else
         {
             includeList[i] = include.Addition.QualifiedName;
         }
     }
     base.ShowList(includeList);
 }
Example #25
0
 public void ShowExtendFor(UML.UseCase element)
 {
     _useCase = element;
     UML.Extend extend;
     string[] extendList = new string[element.Extend.Count];
     for(int i = 0; i < element.Extend.Count; i ++)
     {
         extend = (UML.Extend)element.Extend[i];
         if(extend.ExtendedCase == null)
         {
             extendList[i] = GettextCatalog.GetString ("Extend #") + i;
         }
         else
         {
             extendList[i] = extend.ExtendedCase.QualifiedName;
         }
     }
     base.ShowList(extendList);
 }
 public void ShowGeneralizationsFor(UML.Classifier element)
 {
     _owner = element;
     string[] propertyList = new string[element.Generalization.Count];
     UML.NamedElement ne;
     UML.Generalization current;
     string label;
     for(int i = 0; i < element.Generalization.Count; i ++)
     {
         current = (UML.Generalization)element.Generalization[i];
         ne = current.General;
         label = (ne!=null ? ne.Name : null);
         if(label == null || label == "")
         {
             label = GettextCatalog.GetString ("<<anonymous Generalization>>");
         }
         propertyList[i] = label;
     }
     base.ShowList(propertyList);
 }
 public void ShowOwnedAttributesFor(UML.Classifier element)
 {
     _owner = element;
     // sets a global reference to the collection
     UML.Association ownerAssociation;
     UML.Class ownerClass;
     UML.DataType ownerDatatype;
     UML.Interface ownerInterface;
     if((ownerAssociation = _owner as UML.Association) != null)
     {
         _ownedAttributes = ownerAssociation.OwnedEnd;
     }
     else if((ownerClass = _owner as UML.Class) != null)
     {
         _ownedAttributes = ownerClass.OwnedAttribute;
     }
     else if((ownerDatatype = _owner as UML.DataType) != null)
     {
         _ownedAttributes = ownerDatatype.OwnedAttribute;
     }
     else if((ownerInterface = _owner as UML.Interface) != null)
     {
         _ownedAttributes = ownerInterface.OwnedAttribute;
     }
     // shows the collection items
     string[] propertyList = new string[_ownedAttributes.Count];
     UML.Property prop;
     string propName;
     for(int i = 0; i < _ownedAttributes.Count; i ++)
     {
         prop = (UML.Property)_ownedAttributes[i];
         propName = prop.Name;
         if (propName == null || propName == "")
         {
             propName = "<<"+GettextCatalog.GetString ("anonymous")+ prop.GetType().Name.Substring(6) + ">>";
         }
         propertyList[i] = propName;
     }
     base.ShowList(propertyList);
 }
Example #28
0
 public static DI.GraphNode CreateNewGraphNode(UML.Property end)
 {
     DI.GraphNode endCompartment = new DI.GraphNode ();
     Uml2SemanticModelBridge modelBridge = new Uml2SemanticModelBridge ();
     modelBridge.Element = end;
     endCompartment.SemanticModel = modelBridge;
     // compartments
     AddNewCompartment (endCompartment, "Multiplicity");
     AddNewCompartment (endCompartment, "Name");
     AddNewCompartment (endCompartment, "Visibility");
     return endCompartment;
 }
Example #29
0
 // Changes the owner of the property.
 private void ChangeOwner(UML.Property attribute, UML.Classifier newOwner)
 {
     IBroadcaster b = Hub.Instance.Broadcaster;
     UML.Class cls;
     UML.DataType dt;
     UML.Interface iface;
     UML.Association assoc;
     // deletes the relationship with the old owner
     UML.Element oldOwner = attribute.Owner;
     if ((cls = oldOwner as UML.Class) != null)
     {
         cls.OwnedAttribute.Remove (attribute);
     }
     else if ((dt = oldOwner as UML.DataType) != null)
     {
         dt.OwnedAttribute.Remove (attribute);
     }
     else if ((iface = oldOwner as UML.Interface) != null)
     {
         iface.OwnedAttribute.Remove (attribute);
     }
     else if ((assoc = oldOwner as UML.Association) != null)
     {
         assoc.OwnedEnd.Remove (attribute);
     }
     b.BroadcastElementChange (oldOwner);
     // creates the relationship with the new owner
     if ((cls = newOwner as UML.Class) != null)
     {
         attribute.Class = cls;
         cls.OwnedAttribute.Add (attribute);
     }
     else if ((dt = newOwner as UML.DataType) != null)
     {
         attribute.Datatype = dt;
         dt.OwnedAttribute.Add (attribute);
     }
     else if ((iface = newOwner as UML.Interface) != null)
     {
         attribute.Interface = iface;
         iface.OwnedAttribute.Add (attribute);
     }
     else if ((assoc = newOwner as UML.Association) != null)
     {
         attribute.OwningAssociation = assoc;
         assoc.OwnedEnd.Add (attribute);
     }
     b.BroadcastElementChange (newOwner);
 }
 public void ShowDirectionFor(UML.Parameter element)
 {
     _parameter = element;
     this.Value = _parameter.Direction;
 }