
### Class Diagram ###
diagram.toolbar.button.ClassDiagram.Package = createPackage()
diagram.toolbar.button.ClassDiagram.Package.icon = "DiagramElementsToolbar/Package.gif"
diagram.toolbar.button.ClassDiagram.Class = createNodeByPattern("DefaultFor:Class")
diagram.toolbar.button.ClassDiagram.Class.condition = %DEFAULT_LANGUAGE% != "idl"
diagram.toolbar.button.ClassDiagram.Class.icon = "DiagramElementsToolbar/Class.gif"
diagram.toolbar.button.ClassDiagram.Struct = createNodeByPattern("DefaultFor:Class")
diagram.toolbar.button.ClassDiagram.Struct.condition = %DEFAULT_LANGUAGE% == "idl"
diagram.toolbar.button.ClassDiagram.Struct.icon = "DiagramElementsToolbar/Class.gif"
diagram.toolbar.button.ClassDiagram.Interface = createNodeByPattern("DefaultFor:Interface")
diagram.toolbar.button.ClassDiagram.Interface.icon = "DiagramElementsToolbar/Interface.gif"
diagram.toolbar.button.ClassDiagram.Interface.condition = isFeatureEnabledByWorkspace("diagram.toolbar.Interface")
diagram.toolbar.button.ClassDiagram.Valuetype = createNodeByPattern("DefaultFor:Valuetype")
diagram.toolbar.button.ClassDiagram.Valuetype.condition = %DEFAULT_LANGUAGE% == "idl"
diagram.toolbar.button.ClassDiagram.Valuetype.icon = "DiagramElementsToolbar/Valuetype.gif"
diagram.toolbar.button.ClassDiagram.Exception = createNodeByPattern("DefaultFor:Exception")
diagram.toolbar.button.ClassDiagram.Exception.condition = %DEFAULT_LANGUAGE% == "idl"
diagram.toolbar.button.ClassDiagram.Exception.icon = "DiagramElementsToolbar/Exception.gif"
diagram.toolbar.button.ClassDiagram.Class by Pattern = choosePatternAndCreateNode()
diagram.toolbar.button.ClassDiagram.Class by Pattern.icon = "DiagramElementsToolbar/CustomClass.gif"
diagram.toolbar.button.ClassDiagram.Generalization/Implementation =
\    if (!%src%->hasPropertyValue("$language", "design") && !%dst%->hasPropertyValue("$language", "design"),
\      isSrcInterface = %src%->hasProperty("$interface");
\      isDstInterface = %dst%->hasProperty("$interface");
\      if (isSrcInterface == isDstInterface,
\          createLinkByPattern("DefaultFor:GeneralizationLink"),
\          createLinkByPattern("DefaultFor:ImplementationLink")
\         ),
\      createLink("GeneralizationLink") )
diagram.toolbar.button.ClassDiagram.Generalization/Implementation.icon = "DiagramElementsToolbar/GeneralizationLink.gif"
diagram.toolbar.button.ClassDiagram.Association =
\  if (!%src%->hasPropertyValue("$language", "design") && !%dst%->hasPropertyValue("$language", "design"),
\      createLinkByPattern("DefaultFor:AssociationLink"),
\      createLink("AssociatesLink"))
diagram.toolbar.button.ClassDiagram.Association.icon = "DiagramElementsToolbar/AssociationLink.gif"
diagram.toolbar.button.ClassDiagram.Aggregation =
\  if (!%src%->hasPropertyValue("$language", "design") && !%dst%->hasPropertyValue("$language", "design"),
\      createLinkByPattern("DefaultFor:AggregationLink"),
\      link=createLink("AssociatesLink");
\      link->setProperty( "aggregation", true ))
diagram.toolbar.button.ClassDiagram.Aggregation.icon = "DiagramElementsToolbar/AggregationLink.gif"
### Aggregation button is more useful for C++ ###
diagram.toolbar.button.ClassDiagram.Aggregation.condition = %DEFAULT_LANGUAGE% == "cpp"
diagram.toolbar.button.ClassDiagram.Link by Pattern = choosePatternAndCreateLink()
diagram.toolbar.button.ClassDiagram.Link by Pattern.condition = isFeatureEnabledByWorkspace("diagram.toolbar.Link by Pattern")
diagram.toolbar.button.ClassDiagram.Link by Pattern.icon = "DiagramElementsToolbar/CustomLink.gif"
diagram.toolbar.button.ClassDiagram.Dependency =
\  if (!%src%->hasPropertyValue("$language", "design") && !%dst%->hasPropertyValue("$language", "design"),
\      createLinkByPattern("DefaultFor:DependencyLink"),
\      createLink("DependencyLink"))
diagram.toolbar.button.ClassDiagram.Dependency.icon = "DiagramElementsToolbar/DependencyLink.gif"
diagram.toolbar.button.ClassDiagram.Dependency.condition = isFeatureEnabledByWorkspace("diagram.toolbar.Dependency")
diagram.toolbar.button.ClassDiagram.Object = createNode("Object")
diagram.toolbar.button.ClassDiagram.Object.icon = "DiagramElementsToolbar/Object.gif"

### Sequence Diagram ###
diagram.toolbar.button.SequenceDiagram.Object = createNode( "Object" )
diagram.toolbar.button.SequenceDiagram.Object.icon = if( hasPropertyValue( %diagram%, "$viewType", "collaborationView" ),
\                                                        "DiagramElementsToolbar/Object.gif",
\                                                        "DiagramElementsToolbar/ObjectSequence.gif" )
diagram.toolbar.button.SequenceDiagram.Actor =
\                     actor = createNode( "Object" );
\                     actor->setProperty( "stereotype", "actor" )
diagram.toolbar.button.SequenceDiagram.Actor.icon = "DiagramElementsToolbar/Actor.gif"

diagram.toolbar.button.SequenceDiagram.Message = createMessageLink( false, false )
diagram.toolbar.button.SequenceDiagram.Message.icon = "DiagramElementsToolbar/MessageHorizontalLink.gif"
diagram.toolbar.button.SequenceDiagram.Message with delivery time = createMessageLink( false, true )
diagram.toolbar.button.SequenceDiagram.Message with delivery time.icon = "DiagramElementsToolbar/MessageNonHorizontalLink.gif"
diagram.toolbar.button.SequenceDiagram.Message with delivery time.condition = !hasPropertyValue( %diagram%, "$viewType", "collaborationView" )
diagram.toolbar.button.SequenceDiagram.Self Message = createMessageLink( true, false )
diagram.toolbar.button.SequenceDiagram.Self Message.icon = "DiagramElementsToolbar/MessageToSelfLink.gif"
diagram.toolbar.button.SequenceDiagram.Statement Block = createStatementBlock()
diagram.toolbar.button.SequenceDiagram.Statement Block.condition = !hasProperty( %diagram%, "$viewType" )
diagram.toolbar.button.SequenceDiagram.Statement Block.icon = "DiagramElementsToolbar/StateBlock.gif"

diagram.toolbar.button.SequenceDiagram.Associates = createLink("AssociatesLink")
diagram.toolbar.button.SequenceDiagram.Associates.icon = "DiagramElementsToolbar/AssociationLink.gif"
diagram.toolbar.button.SequenceDiagram.Associates.condition = hasPropertyValue( %diagram%, "$viewType", "collaborationView" )
diagram.toolbar.button.SequenceDiagram.Aggregates = createLink("AggregatesLink")
diagram.toolbar.button.SequenceDiagram.Aggregates.icon = "DiagramElementsToolbar/AggregationLink.gif"
diagram.toolbar.button.SequenceDiagram.Aggregates.condition = hasPropertyValue( %diagram%, "$viewType", "collaborationView" )
diagram.toolbar.button.SequenceDiagram.Becomes =
\                                               link = createLink( "DependencyLink" );
\                                               link->setProperty( "stereotype" , "becomes" )
diagram.toolbar.button.SequenceDiagram.Becomes.icon = "DiagramElementsToolbar/DependencyLink.gif"
diagram.toolbar.button.SequenceDiagram.Becomes.condition = hasPropertyValue( %diagram%, "$viewType", "collaborationView" )




### State Diagram ###
diagram.toolbar.button.StateDiagram.State = createNode("State")
diagram.toolbar.button.StateDiagram.State.icon = "DiagramElementsToolbar/State.gif"
diagram.toolbar.button.StateDiagram.Start = createNode("StartState")
diagram.toolbar.button.StateDiagram.Start.icon = "DiagramElementsToolbar/StartState.gif"
diagram.toolbar.button.StateDiagram.End = createNode("EndState")
diagram.toolbar.button.StateDiagram.End.icon = "DiagramElementsToolbar/EndState.gif"
diagram.toolbar.button.StateDiagram.History = createNode("History")
diagram.toolbar.button.StateDiagram.History.icon = "DiagramElementsToolbar/History.gif"
diagram.toolbar.button.StateDiagram.Horizontal Fork/Join = createNode("SyncBar")
diagram.toolbar.button.StateDiagram.Horizontal Fork/Join.icon = "DiagramElementsToolbar/SyncBar_h.gif"
diagram.toolbar.button.StateDiagram.Vertical Fork/Join = node = createNode("SyncBar");
\                                                          node->setProperty( "vertical", true )
diagram.toolbar.button.StateDiagram.Vertical Fork/Join.icon = "DiagramElementsToolbar/SyncBar.gif"
diagram.toolbar.button.StateDiagram.Transition = createLink("TransitionLink")
diagram.toolbar.button.StateDiagram.Transition.icon = "DiagramElementsToolbar/TransitionLink.gif"
diagram.toolbar.button.StateDiagram.Object = createNode("Object")
diagram.toolbar.button.StateDiagram.Object.icon = "DiagramElementsToolbar/Object.gif"


### Use Case Diagram ###
diagram.toolbar.button.UseCaseDiagram.Actor = createNode("Actor")
diagram.toolbar.button.UseCaseDiagram.Actor.icon = "DiagramElementsToolbar/Actor.gif"
diagram.toolbar.button.UseCaseDiagram.Use Case = createNode("UseCase")
diagram.toolbar.button.UseCaseDiagram.Use Case.icon = "DiagramElementsToolbar/UseCase.gif"
diagram.toolbar.button.UseCaseDiagram.Communicates = createLink("CommunicatesLink")
diagram.toolbar.button.UseCaseDiagram.Communicates.icon = "DiagramElementsToolbar/CommunicatesLink.gif"
diagram.toolbar.button.UseCaseDiagram.Extends  = createLink("ExtendsLink")
diagram.toolbar.button.UseCaseDiagram.Extends.icon = "DiagramElementsToolbar/ExtendsLink.gif"
diagram.toolbar.button.UseCaseDiagram.Includes  = createLink("IncludesLink")
diagram.toolbar.button.UseCaseDiagram.Includes.icon = "DiagramElementsToolbar/IncludeLink.gif"
diagram.toolbar.button.UseCaseDiagram.Generalization = createLink("GeneralizationLink")
diagram.toolbar.button.UseCaseDiagram.Generalization.icon = "DiagramElementsToolbar/GeneralizationLink.gif"
diagram.toolbar.button.UseCaseDiagram.System Boundary = createNode("SystemBoundary")
diagram.toolbar.button.UseCaseDiagram.System Boundary.icon = "DiagramElementsToolbar/SystemBoundary.gif"


### Activity Diagram ###
diagram.toolbar.button.ActivityDiagram.Activity = createNode("Activity")
diagram.toolbar.button.ActivityDiagram.Activity.icon = "DiagramElementsToolbar/Activity.gif"
diagram.toolbar.button.ActivityDiagram.Decision = createNode("Decision")
diagram.toolbar.button.ActivityDiagram.Decision.icon = "DiagramElementsToolbar/Decision.gif"
diagram.toolbar.button.ActivityDiagram.Signal Receipt = createNode("SignalReceipt")
diagram.toolbar.button.ActivityDiagram.Signal Receipt.icon = "DiagramElementsToolbar/Receive.gif"
diagram.toolbar.button.ActivityDiagram.Signal Sending = createNode("SignalSending")
diagram.toolbar.button.ActivityDiagram.Signal Sending.icon = "DiagramElementsToolbar/Send.gif"
diagram.toolbar.button.ActivityDiagram.State = createNode("State")
diagram.toolbar.button.ActivityDiagram.State.icon = "DiagramElementsToolbar/State.gif"
diagram.toolbar.button.ActivityDiagram.Object = createNode("Object")
diagram.toolbar.button.ActivityDiagram.Object.icon = "DiagramElementsToolbar/Object.gif"
diagram.toolbar.button.ActivityDiagram.Start = createNode("StartState")
diagram.toolbar.button.ActivityDiagram.Start.icon = "DiagramElementsToolbar/StartState.gif"
diagram.toolbar.button.ActivityDiagram.End = createNode("EndState")
diagram.toolbar.button.ActivityDiagram.End.icon = "DiagramElementsToolbar/EndState.gif"
diagram.toolbar.button.ActivityDiagram.Horizontal Fork/Join = createNode("SyncBar")
diagram.toolbar.button.ActivityDiagram.Horizontal Fork/Join.icon = "DiagramElementsToolbar/SyncBar_h.gif"
diagram.toolbar.button.ActivityDiagram.Vertical Fork/Join = node = createNode("SyncBar");
\                                                             node->setProperty( "vertical", true )
diagram.toolbar.button.ActivityDiagram.Vertical Fork/Join.icon = "DiagramElementsToolbar/SyncBar.gif"
diagram.toolbar.button.ActivityDiagram.Swimlane  = createNode("SwimLane")
diagram.toolbar.button.ActivityDiagram.Swimlane.icon = "DiagramElementsToolbar/SwimLane.gif"
diagram.toolbar.button.ActivityDiagram.Transition  = createLink("TransitionLink")
diagram.toolbar.button.ActivityDiagram.Transition.icon = "DiagramElementsToolbar/TransitionLink.gif"
diagram.toolbar.button.ActivityDiagram.Object Flow  = createLink("ObjectFlowLink")
diagram.toolbar.button.ActivityDiagram.Object Flow.icon = "DiagramElementsToolbar/ObjectFlowLink.gif"


### Component Diagram ###
diagram.toolbar.button.ComponentDiagram.Subsystem = node = createNode("Subsystem")
diagram.toolbar.button.ComponentDiagram.Subsystem.icon = "DiagramElementsToolbar/Package.gif"
diagram.toolbar.button.ComponentDiagram.Component = node = createNode("Component")
diagram.toolbar.button.ComponentDiagram.Component.icon = "DiagramElementsToolbar/Component.gif"
diagram.toolbar.button.ComponentDiagram.Interface = createNode("Interface")
diagram.toolbar.button.ComponentDiagram.Interface.icon = "DiagramElementsToolbar/ComponentInterface.gif"
diagram.toolbar.button.ComponentDiagram.Supports = createLink("SupportsLink")
diagram.toolbar.button.ComponentDiagram.Supports.icon = "DiagramElementsToolbar/SupportsLink.gif"
diagram.toolbar.button.ComponentDiagram.Dependency = createLink("DependencyLink")
diagram.toolbar.button.ComponentDiagram.Dependency.icon = "DiagramElementsToolbar/DependencyLink.gif"

### Deployment Diagram ###
diagram.toolbar.button.DeploymentDiagram.Node = createNode("Node")
diagram.toolbar.button.DeploymentDiagram.Node.icon = "DiagramElementsToolbar/DeploymentNode.gif"
diagram.toolbar.button.DeploymentDiagram.Component = node = createNode("Component");
\                                                          node->setProperty( "instanceForm", true )
diagram.toolbar.button.DeploymentDiagram.Component.icon = "DiagramElementsToolbar/Component.gif"
diagram.toolbar.button.DeploymentDiagram.Interface = node = createNode("Interface")
diagram.toolbar.button.DeploymentDiagram.Interface.icon = "DiagramElementsToolbar/ComponentInterface.gif"
diagram.toolbar.button.DeploymentDiagram.Supports = createLink("SupportsLink")
diagram.toolbar.button.DeploymentDiagram.Supports.icon = "DiagramElementsToolbar/SupportsLink.gif"
diagram.toolbar.button.DeploymentDiagram.Associates = createLink("AssociatesLink")
diagram.toolbar.button.DeploymentDiagram.Associates.icon = "DiagramElementsToolbar/AssociationLink.gif"
diagram.toolbar.button.DeploymentDiagram.Aggregates = createLink("AggregatesLink")
diagram.toolbar.button.DeploymentDiagram.Aggregates.icon = "DiagramElementsToolbar/AggregationLink.gif"
diagram.toolbar.button.DeploymentDiagram.Object = createNode("Object")
diagram.toolbar.button.DeploymentDiagram.Object.icon = "DiagramElementsToolbar/Object.gif"
diagram.toolbar.button.DeploymentDiagram.Dependency = createLink("DependencyLink")
diagram.toolbar.button.DeploymentDiagram.Dependency.icon = "DiagramElementsToolbar/DependencyLink.gif"

### Business Process Diagram ###
diagram.toolbar.button.BusinessProcessDiagram.Actor = createNode("Actor")
diagram.toolbar.button.BusinessProcessDiagram.Actor.icon = "DiagramElementsToolbar/Actor.gif"
diagram.toolbar.button.BusinessProcessDiagram.Use Case = createNode("UseCase")
diagram.toolbar.button.BusinessProcessDiagram.Use Case.icon = "DiagramElementsToolbar/UseCase.gif"
diagram.toolbar.button.BusinessProcessDiagram.Communicates = createLink("CommunicatesLink")
diagram.toolbar.button.BusinessProcessDiagram.Communicates.icon = "DiagramElementsToolbar/CommunicatesLink.gif"
diagram.toolbar.button.BusinessProcessDiagram.Extends  = createLink("ExtendsLink")
diagram.toolbar.button.BusinessProcessDiagram.Extends.icon = "DiagramElementsToolbar/ExtendsLink.gif"
diagram.toolbar.button.BusinessProcessDiagram.Includes  = createLink("IncludesLink")
diagram.toolbar.button.BusinessProcessDiagram.Includes.icon = "DiagramElementsToolbar/IncludeLink.gif"
diagram.toolbar.button.BusinessProcessDiagram.Worker = node = createNode("BusinessWorker")
diagram.toolbar.button.BusinessProcessDiagram.Worker.icon = "DiagramElementsToolbar/Worker.gif"
diagram.toolbar.button.BusinessProcessDiagram.Entity = node = createNode("BusinessEntity")
diagram.toolbar.button.BusinessProcessDiagram.Entity.icon = "DiagramElementsToolbar/Entity.gif"
diagram.toolbar.button.BusinessProcessDiagram.Subscribes = createLink("SubscribesLink")
diagram.toolbar.button.BusinessProcessDiagram.Subscribes.icon = "DiagramElementsToolbar/SubscribesLink.gif"
diagram.toolbar.button.BusinessProcessDiagram.Aggregates = createLink("AggregatesLink")
diagram.toolbar.button.BusinessProcessDiagram.Aggregates.icon = "DiagramElementsToolbar/AggregationLink.gif"
diagram.toolbar.button.BusinessProcessDiagram.Generalization = createLink("GeneralizationLink")
diagram.toolbar.button.BusinessProcessDiagram.Generalization.icon = "DiagramElementsToolbar/GeneralizationLink.gif"
diagram.toolbar.button.BusinessProcessDiagram.Associates = createLink("AssociatesLink")
diagram.toolbar.button.BusinessProcessDiagram.Associates.icon = "DiagramElementsToolbar/AssociationLink.gif"
diagram.toolbar.button.BusinessProcessDiagram.System Boundary = createNode("SystemBoundary")
diagram.toolbar.button.BusinessProcessDiagram.System Boundary.icon = "DiagramElementsToolbar/SystemBoundary.gif"

### Note and its link ###
diagram.toolbar.button.*.Note = createNode("Note")
diagram.toolbar.button.*.Note.icon = "DiagramElementsToolbar/Note.gif"
diagram.toolbar.button.*.Note link = if (%src%->hasPropertyValue("$shapeType", "Note"), createLink("NoteLink", %dst%, %src%), createLink("NoteLink"))
diagram.toolbar.button.*.Note link.icon = "DiagramElementsToolbar/NoteLink.gif"
