Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#sort: on MooseGroup not working #2518

Closed
NicolasAnquetil opened this issue Jan 21, 2024 · 8 comments
Closed

#sort: on MooseGroup not working #2518

NicolasAnquetil opened this issue Jan 21, 2024 · 8 comments
Assignees

Comments

@NicolasAnquetil
Copy link
Contributor

For example on packages, it always sorts on alphabetical order

Note: #sort: changes the internal collection and I don't see why ?!?

MooseGroup >> sort: aBlock
	self entities: (self entities sorted: aBlock)

Apart from that, (self entities sorted: aBlock) works as expected

@jecisc
Copy link
Member

jecisc commented Jan 22, 2024

#sort: changes the internal collection because #sort: should not return a new one but order itself and return itself.

I think we could improve it to ask to the internal collection to sort itself instead of creating a new one.

I tried to add some tests but for now they are passing (but at some point I tried to sort packages in an inspector and it did not work).

I'll do some more digging

@ClotildeToullec
Copy link
Member

#sort does work.
The problem is the display in the inspector. We have a sort by name block in MiNavigationBrowser>>#initializePresenters.
This has been a choice to always show entities in the same order but hides the actual order of the inner collection.

@jecisc
Copy link
Member

jecisc commented Jan 22, 2024

I did a PR to improve the implementation. moosetechnology/Famix#692

Now about the inspector what Clotilde said makes sense. Should we close the issue?

@NicolasAnquetil
Copy link
Contributor Author

before closing

  1. do we remove the automatic sorting in the inspector ? I would say yes because it is confusing (as was demonstrated)
  2. can we fix the existing MooseGroup >> #sort: implementation ?

@jecisc
Copy link
Member

jecisc commented Jan 23, 2024

The 2 is done already.

For the 1 I am not sure what is the best (there is the raw view for real state of the object)

@ClotildeToullec
Copy link
Member

I think I found a solution. We could remove the automatic sorting but add the little arrows in the table, to do the sort when needed (as it is when inspecting an OrderedCollection for example)
What do you think?

@jecisc
Copy link
Member

jecisc commented Jan 26, 2024

I like it

@ClotildeToullec
Copy link
Member

Proposed fix here: moosetechnology/MooseIDE#1004

@jecisc jecisc closed this as completed Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants