Repository: gaphor/gaphor
Issue: UML Composite and Shared Association Don't Work

### I'm submitting a...
- [X] Bug report  <!-- Please search GitHub for a similar issue or PR before submitting -->
- [ ] Feature request
- [ ] Documentation issue or request

### Current behavior
Selecting the Composite or Shared Association tool gives you a normal association in the UML palette, they work fine for SysML.


### Expected behavior
Filled and open diamonds show up properly.


### System Information
OS:
- [X] Linux (Please put in notes the specific distro)
- [ ] MacOS
- [ ] Windows 10
- [ ] Windows 7

NOTES:


Changed files:
gaphor/UML/toolbox.py, gaphor/SysML/toolbox.py

diff --git a/gaphor/SysML/toolbox.py b/gaphor/SysML/toolbox.py
index f2aad03b8..d13d30497 100644
--- a/gaphor/SysML/toolbox.py
+++ b/gaphor/SysML/toolbox.py
@@ -1,7 +1,5 @@
 """The action definition for the SysML toolbox."""
 
-from enum import Enum
-
 from gaphas.item import SE
 
 from gaphor import UML, diagram
@@ -11,48 +9,13 @@ from gaphor.diagram.diagramtools import PlacementTool
 from gaphor.SysML import diagramitems as sysml_items
 from gaphor.SysML import sysml
 from gaphor.UML import diagramitems as uml_items
-from gaphor.UML.toolbox import namespace_config
-
-
-class AssociationType(Enum):
-    COMPOSITE = "composite"
-    SHARED = "shared"
-
-
-def initial_pseudostate_config(new_item):
-    new_item.subject.kind = "initial"
-
-
-def history_pseudostate_config(new_item):
-    new_item.subject.kind = "shallowHistory"
-
-
-def metaclass_config(new_item):
-    namespace_config(new_item)
-    new_item.subject.name = "Class"
-
-
-def create_association(
-    assoc_item: uml_items.AssociationItem, association_type: AssociationType
-) -> None:
-    assoc = assoc_item.subject
-    assoc.memberEnd.append(assoc_item.model.create(UML.Property))
-    assoc.memberEnd.append(assoc_item.model.create(UML.Property))
-
-    assoc_item.head_end.subject = assoc.memberEnd[0]
-    assoc_item.tail_end.subject = assoc.memberEnd[1]
-
-    UML.model.set_navigability(assoc, assoc_item.head_end.subject, True)
-    assoc_item.head_end.subject.aggregation = association_type.value
-
-
-def composite_association_config(assoc_item: uml_items.AssociationItem) -> None:
-    create_association(assoc_item, AssociationType.COMPOSITE)
-
-
-def shared_association_config(assoc_item: uml_items.AssociationItem) -> None:
-    create_association(assoc_item, AssociationType.SHARED)
-
+from gaphor.UML.toolbox import (
+    composite_association_config,
+    history_pseudostate_config,
+    initial_pseudostate_config,
+    namespace_config,
+    shared_association_config,
+)
 
 # Actions: ((section (name, label, icon_name, shortcut)), ...)
 sysml_toolbox_actions: ToolboxDefinition = (
diff --git a/gaphor/UML/toolbox.py b/gaphor/UML/toolbox.py
index 50b5f72b8..c9daf8d7f 100644
--- a/gaphor/UML/toolbox.py
+++ b/gaphor/UML/toolbox.py
@@ -1,5 +1,6 @@
 """The action definition for the UML toolbox."""
 
+from enum import Enum
 
 from gaphas.item import SE
 
@@ -10,6 +11,11 @@ from gaphor.diagram.diagramtools import PlacementTool
 from gaphor.UML import diagramitems
 
 
+class AssociationType(Enum):
+    COMPOSITE = "composite"
+    SHARED = "shared"
+
+
 def namespace_config(new_item):
     subject = new_item.subject
     diagram = new_item.diagram
@@ -30,6 +36,28 @@ def metaclass_config(new_item):
     new_item.subject.name = "Class"
 
 
+def create_association(
+    assoc_item: diagramitems.AssociationItem, association_type: AssociationType
+) -> None:
+    assoc = assoc_item.subject
+    assoc.memberEnd.append(assoc_item.model.create(UML.Property))
+    assoc.memberEnd.append(assoc_item.model.create(UML.Property))
+
+    assoc_item.head_end.subject = assoc.memberEnd[0]
+    assoc_item.tail_end.subject = assoc.memberEnd[1]
+
+    UML.model.set_navigability(assoc, assoc_item.head_end.subject, True)
+    assoc_item.head_end.subject.aggregation = association_type.value
+
+
+def composite_association_config(assoc_item: diagramitems.AssociationItem) -> None:
+    create_association(assoc_item, AssociationType.COMPOSITE)
+
+
+def shared_association_config(assoc_item: diagramitems.AssociationItem) -> None:
+    create_association(assoc_item, AssociationType.SHARED)
+
+
 # Actions: ((section (name, label, icon_name, shortcut)), ...)
 uml_toolbox_actions: ToolboxDefinition = (
     (
@@ -124,14 +152,22 @@ uml_toolbox_actions: ToolboxDefinition = (
                 gettext("Composite Association"),
                 "gaphor-composite-association-symbolic",
                 "<Shift>Z",
-                PlacementTool.new_item_factory(diagramitems.AssociationItem),
+                PlacementTool.new_item_factory(
+                    diagramitems.AssociationItem,
+                    UML.Association,
+                    config_func=composite_association_config,
+                ),
             ),
             ToolDef(
                 "toolbox-shared-association",
                 gettext("Shared Association"),
                 "gaphor-shared-association-symbolic",
                 "<Shift>Q",
-                PlacementTool.new_item_factory(diagramitems.AssociationItem),
+                PlacementTool.new_item_factory(
+                    diagramitems.AssociationItem,
+                    UML.Association,
+                    config_func=shared_association_config,
+                ),
             ),
             ToolDef(
                 "toolbox-association",