NMF icon indicating copy to clipboard operation
NMF copied to clipboard

API question: how to find all usages of an object?

Open RobertWalterU3d opened this issue 3 years ago • 2 comments

Hi,

is there an API that allows me to get all usages of a object (all references) in the scope of the currently loaded model?

Thanks!

RobertWalterU3d avatar Jan 26 '22 13:01 RobertWalterU3d

Hi,

so the immediate answer is "no, there isn't", but interestingly, I think such an API could be possible without that much computational effort, though either quite dirty or coming with breaking changes to the generated code.

The thing is that when a model element references another, it currently subscribes to its Deleted event. That is an implicit reference that could be either brought to a good level (clean solution) or simply abused by iterating the target objects of the invocation list of that event and gathering all model elements from there.

The problem here is that I am in the middle of a rather complex refactoring without really having time for NMF at all. I cannot commit to any timeline at the moment.

Best regards,

Georg

georghinkel avatar Jan 26 '22 19:01 georghinkel

No worries Georg, and thanks for the explanation. Turns out I actually don't need it for my prototype, since my use case (rename-refactoring) works out of the box.

RobertWalterU3d avatar Jan 27 '22 17:01 RobertWalterU3d