Skip to content

Properties remain in model browser after deletion #3557

@amolenaar

Description

@amolenaar

Describe the bug

When an association is removed, properties owned (or at least a member) of the class they refer to are still present in the model browser.

It looks like removal from the model works fine: when the model is reloaded, the properties no longer show

To Reproduce

Steps to reproduce the behavior:

  1. create 2 classes
  2. create an association and make both end navigable
  3. remove the association
  4. Note that the properties are still visible in the model browser. Interacting with those elements raises exceptions.

Selecting the "ghost" element raises an exception:

gaphor.ui.elementeditor ERROR Could not construct property page for TypedElementPropertyPage
Traceback (most recent call last):
  File "/Users/arjan/Development/gaphor/gaphor/ui/elementeditor.py", line 212, in create_pages
    page = adapter.construct()
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/arjan/Development/gaphor/gaphor/UML/propertypages.py", line 40, in construct
    model = list_of_classifiers(typed_element.model, UML.Classifier)
                                ^^^^^^^^^^^^^^^^^^^
  File "/Users/arjan/Development/gaphor/gaphor/core/modeling/base.py", line 89, in model
    raise TypeError(
TypeError: Can't retrieve the model since it's not set on construction
gaphor.ui.elementeditor ERROR Could not construct property page for StereotypePage
Traceback (most recent call last):
  File "/Users/arjan/Development/gaphor/gaphor/ui/elementeditor.py", line 212, in create_pages
    page = adapter.construct()
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/arjan/Development/gaphor/gaphor/UML/profiles/stereotypepropertypages.py", line 33, in construct
    stereotypes = UML.recipes.get_stereotypes(subject)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/arjan/Development/gaphor/gaphor/UML/recipes.py", line 125, in get_stereotypes
    model = element.model
            ^^^^^^^^^^^^^
  File "/Users/arjan/Development/gaphor/gaphor/core/modeling/base.py", line 89, in model
    raise TypeError(
TypeError: Can't retrieve the model since it's not set on construction

Expected behavior

The Model Browser should represent the actual state of the model.

Version

Version of Gaphor: main

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn issue in the application

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions