Exemplo n.º 1
0
        public IEAConnector ConnectTo(IEAElement suppliedElement, String type, String stereotype, bool allowMultiple)
        {
            //check if two elements are already connected with this connector
            if (!allowMultiple)
            {
                IList <IEAConnector> connectors = FindConnectors(suppliedElement, stereotype, type);
                if (connectors.Count > 0)
                {
                    return(connectors.FirstOrDefault());
                }
            }

            Connector connector = _native.Connectors.AddNew("", type);

            connector.Stereotype = stereotype;
            connector.SupplierID = suppliedElement.ID;
            connector.Update();

            _native.Connectors.Refresh();
            _native.Update();
            ((EAElement)suppliedElement)._native.Connectors.Refresh();
            suppliedElement.Update();

            return(EAConnector.Wrap(connector));
        }
Exemplo n.º 2
0
        public IEnumerable <IEAElement> GetConnectedRequirements()
        {
            if (_native == null)
            {
                return(new EAElement[0]);
            }
            IList <IEAConnector> connectors =
                (from Connector c in _native.Connectors select EAConnector.Wrap(c)).ToList();

            IEnumerable <IEAElement> connectedRequirements = from IEAConnector connector in connectors
                                                             where connector.Stereotype.Equals("classified by")
                                                             select(connector.GetClient());

            return(connectedRequirements);
        }
Exemplo n.º 3
0
        /// <summary>
        ///     Implements IEAElement.RemoveConnector(IEAConnector connector)
        /// </summary>
        /// <param name="connector"></param>
        public void RemoveConnector(IEAConnector connector)
        {
            for (short i = 0; i < _native.Connectors.Count; i++)
            {
                EAConnector con = EAConnector.Wrap(_native.Connectors.GetAt(i));

                if (!con.GUID.Equals(connector.GUID))
                {
                    continue;
                }
                _native.Connectors.Delete(i);
                _native.Connectors.Refresh();
                _native.Update();
                return;
            }
        }
Exemplo n.º 4
0
        public IEnumerable <IEAElement> GetTracedElements()
        {
            if (_native == null)
            {
                return(new EAElement[0]);
            }
            IList <IEAConnector> connectors =
                (from Connector c in _native.Connectors select EAConnector.Wrap(c)).ToList();

            IEnumerable <IEAElement> traces = from IEAConnector trace in connectors
                                              where trace.Stereotype.Equals(EAConstants.RelationTrace)
                                              select(trace.SupplierId == ID
                                                         ? trace.GetClient()
                                                         : trace.GetSupplier()
                                                     );

            return(traces);
        }
Exemplo n.º 5
0
        public IEnumerable <IEAElement> GetConnectedConcerns(string diagramGuid)
        {
            if (_native == null)
            {
                return(new EAElement[0]);
            }

            // Get the connectors with the native element as a client
            IList <IEAConnector> connectors =
                (from Connector c in _native.Connectors select EAConnector.Wrap(c)).Where(
                    c => c.GetClient().GUID.Equals(GUID)).ToList();

            // Get the SuppliedElement for each connector in connectors in the current diagram
            IEnumerable <IEAElement> suppliers = from IEAConnector connector in connectors
                                                 where
                                                 connector.Stereotype.Equals(EAConstants.RelationClassifiedBy) &&
                                                 inDiagram(connector, diagramGuid)
                                                 select(connector.GetSupplier());

            // Get the elements from connectedConcerns which are Concerns
            return(suppliers.Where(x => x.TaggedValueExists(EATaggedValueKeys.IsConcernElement, diagramGuid)));
        }
Exemplo n.º 6
0
 public override IEAConnector GetConnectorByGUID(string guid)
 {
     return(EAConnector.Wrap(Native.GetConnectorByGuid(guid)));
 }
Exemplo n.º 7
0
 public override IEAConnector GetConnectorByID(int connectorId)
 {
     return(EAConnector.Wrap(Native.GetConnectorByID(connectorId)));
 }