示例#1
0
 public override UML.Profiles.TaggedValue createTaggedValue(object objectToWrap)
 {
     UML.Profiles.TaggedValue newTaggedValue = null;
     if (objectToWrap is global::EA.TaggedValue)
     {
         newTaggedValue = this.createElementTag((global::EA.TaggedValue)objectToWrap);
     }
     else if (objectToWrap is global::EA.AttributeTag)
     {
         newTaggedValue = this.createAttributeTag((global::EA.AttributeTag)objectToWrap);
     }
     else if (objectToWrap is global::EA.MethodTag)
     {
         newTaggedValue = this.createOperationTag((global::EA.MethodTag)objectToWrap);
     }
     else if (objectToWrap is global::EA.ConnectorTag)
     {
         newTaggedValue = this.createRelationTag((global::EA.ConnectorTag)objectToWrap);
     }
     else if (objectToWrap is global::EA.ParamTag)
     {
         newTaggedValue = this.createParameterTag((global::EA.ParamTag)objectToWrap);
     }
     return(newTaggedValue);
 }
        /// <summary>
        /// returns the name to show as node name for this element
        /// </summary>
        /// <param name="element"></param>
        public string getNodeName(UML.UMLItem element)
        {
            string name = string.Empty;

            if (element != null)
            {
                name  = this.getStereotypeString(element);
                name += element.name;
            }
            if (element is UML.Classes.Kernel.Parameter)
            {
                UML.Classes.Kernel.Parameter parameter = (UML.Classes.Kernel.Parameter)element;
                if (parameter.direction != UML.Classes.Kernel.ParameterDirectionKind._return)
                {
                    name = parameter.name + " (" + this.getNodeName(parameter.operation) + ")";
                }
            }
            else if (element is UML.Classes.Kernel.Feature)
            {
                UML.Classes.Kernel.Feature feature = (UML.Classes.Kernel.Feature)element;
                UML.Classes.Kernel.Element owner   = feature.owner;
                if (owner != null)
                {
                    name = owner.name;
                }
                else
                {
                    name = "[owner missing]";
                }
                name += "." + this.getStereotypeString(element) + feature.name;
            }
            else if (element is UML.Profiles.TaggedValue)
            {
                UML.Profiles.TaggedValue taggedValue = (UML.Profiles.TaggedValue)element;
                if (taggedValue.owner.name.Length > 0)
                {
                    name = taggedValue.owner.name + "." + taggedValue.name;
                }
            }
            return(name);
        }
        public int getImageIndex(UML.UMLItem element)
        {
            int imageIndex;

            if (element is UML.Classes.Kernel.Property)
            {
                imageIndex = this.attributeIndex;
            }
            else if (element is UML.Classes.Kernel.Operation)
            {
                imageIndex = this.operationIndex;
            }
            else if (element is UML.Classes.Kernel.Package)
            {
                if (element.owner == null)
                {
                    imageIndex = this.rootPackageIndex;
                }
                else
                {
                    //packaging components are both components as packages.
                    if (element is UTF_EA.ElementWrapper && ((UTF_EA.ElementWrapper)element).subType == "PackagingComponent")
                    {
                        imageIndex = this.packagingComponentIndex;
                    }
                    else
                    {
                        imageIndex = this.packageIndex;
                    }
                }
            }

            else if (element is UML.Diagrams.Diagram)
            {
                if (element is UML.Diagrams.ActivityDiagram)
                {
                    imageIndex = this.activityDiagramIndex;
                }
                else if (element is UML.Diagrams.ClassDiagram)
                {
                    imageIndex = this.classDiagramIndex;
                }
                else if (element is UML.Diagrams.CommunicationDiagram)
                {
                    imageIndex = this.communicationDiagramIndex;
                }
                else if (element is UML.Diagrams.ComponentDiagram)
                {
                    imageIndex = this.componentDiagramIndex;
                }
                else if (element is UML.Diagrams.CompositeStructureDiagram)
                {
                    imageIndex = this.compositeStructureDiagramIndex;
                }
                else if (element is UML.Diagrams.DeploymentDiagram)
                {
                    imageIndex = this.deploymentDiagramIndex;
                }
                else if (element is UML.Diagrams.InteractionOverviewDiagram)
                {
                    imageIndex = this.interactionOverviewDiagramIndex;
                }
                else if (element is UML.Diagrams.ObjectDiagram)
                {
                    imageIndex = this.objectDiagramIndex;
                }
                else if (element is UML.Diagrams.PackageDiagram)
                {
                    imageIndex = this.packageDiagramIndex;
                }
                else if (element is UML.Diagrams.SequenceDiagram)
                {
                    imageIndex = this.sequenceDiagramIndex;
                }
                else if (element is UML.Diagrams.StateMachineDiagram)
                {
                    imageIndex = this.stateMachineDiagramIndex;
                }
                else if (element is UML.Diagrams.TimingDiagram)
                {
                    imageIndex = this.timingDiagramIndex;
                }
                else if (element is UML.Diagrams.UseCaseDiagram)
                {
                    imageIndex = this.useCaseDiagramIndex;
                }
                else
                {
                    // default diagram image
                    imageIndex = this.diagramIndex;
                }
            }
            else if (element is UML.Interactions.BasicInteractions.Interaction)
            {
                imageIndex = this.interactionIndex;
            }
            else if (element is UML.StateMachines.BehaviorStateMachines.StateMachine)
            {
                imageIndex = this.stateMachineIndex;
            }
            else if (element is UML.Activities.FundamentalActivities.Activity)
            {
                imageIndex = this.activityIndex;
            }
            else if (element is UML.Classes.Kernel.PrimitiveType)
            {
                imageIndex = this.primitiveIndex;
            }
            else if (element is UML.Classes.Kernel.Relationship)
            {
                imageIndex = this.messagIndex;
            }
            else if (element is UML.Actions.BasicActions.Action)
            {
                imageIndex = this.actionIndex;
            }
            else if (element is UML.Classes.Kernel.Class)
            {
                imageIndex = this.classIndex;
            }
            else if (element is UML.Classes.Kernel.Parameter)
            {
                imageIndex = this.parameterIndex;
            }
            else if (element is UML.Profiles.TaggedValue)
            {
                UML.Profiles.TaggedValue taggedValue = (UML.Profiles.TaggedValue)element;
                if (taggedValue.owner is UML.Classes.Kernel.Property)
                {
                    imageIndex = this.attributeTagIndex;
                }
                else if (taggedValue.owner is UML.Classes.Kernel.Operation)
                {
                    imageIndex = this.operationTagIndex;
                }
                else if (taggedValue.owner is UML.Classes.Kernel.Parameter)
                {
                    imageIndex = this.parameterTagIndex;
                }
                else if (taggedValue.owner is UML.Classes.Kernel.Relationship)
                {
                    imageIndex = this.relationTagIndex;
                }
                else if (taggedValue.owner is UML.Classes.Kernel.Element)
                {
                    imageIndex = this.elementTagIndex;
                }
                else
                {
                    imageIndex = this.taggedValueIndex;
                }
            }
            else if (element is UML.Classes.Kernel.Enumeration)
            {
                imageIndex = this.enumerationIndex;
            }
            else if (element is UML.Classes.Kernel.DataType)
            {
                imageIndex = this.dataTypeIndex;
            }
            else if (element is UML.Classes.Interfaces.Interface)
            {
                imageIndex = this.interfaceIndex;
            }
            else if (element is TSF.UmlToolingFramework.Wrappers.EA.ElementWrapper)
            {
                //workaround to be able to display the correct icon, even if the element type hasn't been implemented in the UMLTooling Framework, of in case of EA specific element types such as requirement.
                TSF.UmlToolingFramework.Wrappers.EA.ElementWrapper elementWrapper = (TSF.UmlToolingFramework.Wrappers.EA.ElementWrapper)element;
                switch (elementWrapper.subType)
                {
                case "Signal":
                    imageIndex = this.signalIndex;
                    break;

                case "Association":
                    imageIndex = this.associationElementIndex;
                    break;

                case "PackagingComponent":
                    imageIndex = this.packagingComponentIndex;
                    break;

                case "Component":
                    imageIndex = this.componentIndex;
                    break;

                case "ProvidedInterface":
                    imageIndex = this.providedInterfaceIndex;
                    break;

                case "RequiredInterface":
                    imageIndex = this.requiredInterfaceIndex;
                    break;

                case "Object":
                    imageIndex = this.objectIndex;
                    break;

                case "Port":
                    imageIndex = this.portIndex;
                    break;

                case "Artifact":
                    imageIndex = this.artifactIndex;
                    break;

                case "Part":
                    imageIndex = this.partIndex;
                    break;

                case "Collaboration":
                case "CollaborationOccurrence":
                    imageIndex = this.collaborationIndex;
                    break;

                case "Node":
                case "Device":
                case "ExecutionEnvironment":
                    imageIndex = this.nodeIndex;
                    break;

                case "DeploymentSpecification":
                    imageIndex = this.deploymentSpecificationIndex;
                    break;

                case "InformationItem":
                    imageIndex = this.informationItemIndex;
                    break;

                case "Actor":
                    imageIndex = this.actorIndex;
                    break;

                case "UseCase":
                    imageIndex = this.usecaseIndex;
                    break;

                case "Boundary":
                    imageIndex = this.boundaryIndex;
                    break;

                case "ActivityPartition":
                    imageIndex = this.activityPartitionIndex;
                    break;

                case "CentralBufferNode":
                    imageIndex = this.classIndex;
                    break;

                case "Decision":
                case "MergeNode":
                case "StateChoice":
                    imageIndex = this.decisionIndex;
                    break;

                case "Event":
                    imageIndex = this.eventIndex;
                    break;

                case "ActivityInitial":
                case "StateInitial":
                case "StateJunction":
                    imageIndex = this.activityInitialIndex;
                    break;

                case "ActivityFinal":
                case "StateFinal":
                    imageIndex = this.activityFinalIndex;
                    break;

                case "FlowFinal":
                case "StateExitPoint":
                case "StateTerminate":
                    imageIndex = this.flowFinalNodeIndex;
                    break;

                case "SynchronisationNode":
                    imageIndex = this.synchronisationNodeIndex;
                    break;

                case "InterruptibleActivityRegion":
                    imageIndex = this.interuptableActivityRegionIndex;
                    break;

                case "ExpansionRegion":
                    imageIndex = this.expansionRegionIndex;
                    break;

                case "ExceptionHandler":
                    imageIndex = this.exceptionHandlerIndex;
                    break;

                case "ObjectNode":
                    imageIndex = this.objectNodeIndex;
                    break;

                case "Synchronization":
                    imageIndex = this.synchronizationIndex;
                    break;

                case "Sequence":
                    imageIndex = this.lifeLineIndex;
                    break;

                case "MessageEndpoint":
                    imageIndex = this.gateIndex;
                    break;

                case "InteractionFragment":
                    imageIndex = this.fragmentIndex;
                    break;

                case "InteractionState":
                    imageIndex = this.interactionStateIndex;
                    break;

                case "State":
                    imageIndex = this.stateIndex;
                    break;

                case "StateHistory":
                case "StateEntryPoint":
                    imageIndex = this.entryPointIndex;
                    break;

                case "TimeLine":
                    imageIndex = this.timeLineIndex;
                    break;

                case "Requirement":
                    imageIndex = this.requirementIndex;
                    break;

                case "Feature":
                    imageIndex = this.featureIndex;
                    break;

                case "Risk":
                    imageIndex = this.riskIndex;
                    break;

                case "Issue":
                    imageIndex = this.issueIndex;
                    break;

                case "Change":
                    imageIndex = this.changeIndex;
                    break;

                case "Screen":
                    imageIndex = this.screenIdex;
                    break;

                case "GUIElement":
                    imageIndex = this.uiControlIndex;
                    break;

                case "Note":
                    imageIndex = this.noteIndex;
                    break;

                case "Constraint":
                    imageIndex = this.constraintIndex;
                    break;

                case "Text":
                    imageIndex = this.textIndex;
                    break;

                case "Legend":
                    imageIndex = this.legendIndex;
                    break;

                case "DiagramNotes":
                    imageIndex = this.diagramNotesIndex;
                    break;

                case "Hyperlink":
                    imageIndex = this.hyperlinkIndex;
                    break;

                default:
                    imageIndex = this.elementIndex;
                    break;
                }
            }
            else
            {
                imageIndex = this.elementIndex;
            }
            return(imageIndex);
        }