statecharts icon indicating copy to clipboard operation
statecharts copied to clipboard

Provide support for xtext based rename refactorings

Open jdicks opened this issue 7 years ago • 4 comments

This will have 2 aspects:

  1. update cross-references within specifications based on a change outside the SCT resource
  2. 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.

jdicks avatar May 09 '17 13:05 jdicks

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

Other issues:

  • presentation of changes in preview isn't optimal

jdicks avatar May 11 '17 15:05 jdicks

i rebased the current state and pushed it to Yakindu/statecharts/tree/issue_1364_integration a few days ago

jdicks avatar Aug 08 '17 08:08 jdicks

scheduling this for backlog as discussed

andreasmuelder avatar Sep 12 '17 12:09 andreasmuelder

Rename Refactoring currently does not work on event names: renamerefactoring

svenjawendler avatar Sep 13 '17 06:09 svenjawendler