Skip to content

Conversation

amolenaar
Copy link
Member

@amolenaar amolenaar commented Nov 14, 2024

PR Type

What kind of change does this PR introduce?

  • Bug fix
  • Feature
  • Chore (refactoring, formatting, local variables, other cleanup)
  • Documentation content changes

What is the current behavior?

The model browser mainly depends on the Element.owner/ownedElement relationship for ownership.
It also supports memberNamespace, mainly for association ends without owner.

Builds on #3568.

Issue Number: #3540

Fixes #3557

What is the new behavior?

Separate the concept of ownership out of the model browser, so it can be extended.

The owner() dispatch method tells who's the owner of an element: another element, Root, or None. In case of None, the element is not supposed to be shown in the model browser.

Does this PR introduce a breaking change?

  • Yes
  • No

A separate element ownership function.

Other information

The only issue is that event handling (in ModelBrowser) still checks for the properties used. This should change at some point, but I think this is already a nice simplification.

I do love to get rid of the owns() dispatch function -- basically the counterpart of owner() -- but I have no idea how, yet.

@amolenaar amolenaar marked this pull request as draft November 14, 2024 18:42
@github-actions github-actions bot added the python Pull requests that update Python code label Nov 14, 2024
@pbrown12303
Copy link
Contributor

I don't see any changes here to the .gaphor models for Core and UML. What do they look like with this approach?

Also, if Core has an ownership relation and the language model has similar relations, what's involved in keeping them synchronized? Language-specific logic that updates the Core ownership relation when the language-specific relation changes? How do you deal with a tree drag-and-drop that moves an element to another location in the tree?

@amolenaar
Copy link
Member Author

Changes to the model come later. Once the concept of ownership is separated from the model browser, I can start implementing different variations: two for UML, one for diagrams.

In the end I plan to move the Element class to the UML model. Diagram will probably have a uni-directional relation to a parent. Picture can go away, since we have Image in the UML model already.

How do you deal with a tree drag-and-drop that moves an element to another location in the tree?

I have to figure out parts of that still. I think I need something like a service that notifies the model browser when an element's owner has changed.

The ultimate goal would be to make the model browser modeling language agnostic. But that'll take several PR's to achieve.

@amolenaar amolenaar force-pushed the tree-model-dispatch branch 3 times, most recently from b0719aa to fbba30b Compare November 16, 2024 10:35
@amolenaar amolenaar changed the base branch from main to image November 16, 2024 15:40
@amolenaar amolenaar force-pushed the tree-model-dispatch branch 2 times, most recently from e47f067 to 35ad318 Compare November 16, 2024 15:49
@amolenaar amolenaar marked this pull request as ready for review November 16, 2024 15:57
@amolenaar amolenaar requested a review from danyeaw November 16, 2024 15:57
@danyeaw danyeaw added feature A new feature and removed python Pull requests that update Python code labels Nov 18, 2024
Copy link
Member

@danyeaw danyeaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @amolenaar, these changes look great!

@danyeaw danyeaw merged commit bcb2902 into image Nov 18, 2024
5 checks passed
@danyeaw danyeaw deleted the tree-model-dispatch branch November 18, 2024 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Properties remain in model browser after deletion
3 participants