Renaming a pin is not visible in tree
### Describe the bug
The name of the pin shall be visible in the tree. It is not.

### To Reproduce
Steps to reproduce the behavior:
1. Create an activity diagram
2. Add action
3. Add pin to action
4. Rename the pin
5. Problem: the name is not visible in the tree

### Expected behavior
The name shall be visible in the tree.

### Screenshots
![image](https://github.com/gaphor/gaphor/assets/8182138/d96b59fc-a501-46b3-8582-c61041095558)

### OS
- [X] Linux (Latest ubuntu)
- [ ] macOS
- [ ] Windows

### Version
Version of Gaphor: main branch

diff --git a/gaphor/UML/tests/test_umlfmt.py b/gaphor/UML/tests/test_umlfmt.py
index cf7a76632..0146440f2 100644
--- a/gaphor/UML/tests/test_umlfmt.py
+++ b/gaphor/UML/tests/test_umlfmt.py
@@ -147,3 +147,10 @@ def test_slot(factory):
     slot = add_tag_is_foo_metadata_field(a, factory)
 
     assert 'tag = "foo"' == format(slot)
+
+
+def test_pin(factory):
+    pin = factory.create(UML.InputPin)
+    pin.name = "foo"
+
+    assert format(pin) == "foo"
diff --git a/gaphor/UML/umlfmt.py b/gaphor/UML/umlfmt.py
index f78a35291..aab4ef089 100644
--- a/gaphor/UML/umlfmt.py
+++ b/gaphor/UML/umlfmt.py
@@ -180,8 +180,8 @@ def format_slot(el):
 
 
 @format.register(UML.NamedElement)
+@format.register(UML.Pin)
 def format_namedelement(el, **kwargs):
-    """Format named element."""
     return el.name or ""
 
 
['gaphor/UML/tests/test_umlfmt.py', 'gaphor/UML/umlfmt.py']