statecharts
statecharts copied to clipboard
Provide support for xtext based rename refactorings
This will have 2 aspects:
- update cross-references within specifications based on a change outside the SCT resource
- update all cross-references triggered from within an embedded resource context in SCT
The first aspect can be handled by implementing an IReferenceUpdater for the SCT resource. This reference updater have to apply text changes calculated by xtext to specification features properly.
The second aspect is accessible through the SCT embedded editor > right click > Refactoring > 'Rename..'. The current implementation is based on Stext but could be based on Xtext (RenameelementProcessor) so that it can be applied for Xtext based languages integrated via the sct domains embedded editor feature. The element rename processor will delegate to all IReferenceUpdater contributions for resources where cross references can be found. So a refactoring of an embedded element will use the IReferenceUpdater to update the specifications placed logically in the same file as the elements of the embedded fake resource.
Following things left:
- renaming of e.g. variable definitions fail
- owner of the definition is transient, so xtext excludes these changes (see temporary SCTTransientValueService)
- renaming usage of variables is already working
- calculate element to rename from selection in embedded context
- current implementation fails if the rename refactoring is triggered from e.g. a variable definition within a statechart specification itself
- tests for
- SCTXtextSpecificationReferenceUpdater
- used propagate updates for specifications within an sct resource
- RenameEmbeddedXtextReferenceHandler
- hard to test automatically without some kind of ui test framework, manual test
- have to be discussed
- SCTXtextSpecificationReferenceUpdater
Other issues:
- presentation of changes in preview isn't optimal
i rebased the current state and pushed it to Yakindu/statecharts/tree/issue_1364_integration a few days ago
scheduling this for backlog as discussed
Rename Refactoring currently does not work on event names: