Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 356444

Summary: [refactoring] RenameLinkedMode fails with qualified names
Product: [Modeling] TMF Reporter: Jan Koehnlein <jan>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Holger.Schill, sven.efftinge, vpiskarov
Version: 2.0.1Flags: jan: indigo+
Target Milestone: SR2   
Hardware: All   
OS: All   
Whiteboard:

Description Jan Koehnlein CLA 2011-09-01 05:16:02 EDT
When refactoring is triggered on a parent segement of a qualified name, the rename linked mode throws an IllegalStateException.

Reproducible in Xtend, dmodel etc., e.g.

  class X extends javaPackage.JavaClass {}

where JavaClass is an existing Java class. 
Trigger refactoring on "javaPackage" -> Exception:

Caused by: java.lang.IllegalStateException: Current selection is not within any
linked editing position
    at
org.eclipse.xtext.ui.refactoring.ui.RenameLinkedMode.start(RenameLinkedMode.java:82)
    at
org.eclipse.xtext.ui.refactoring.ui.RenameRefactoringController$1.run(RenameRefactoringController.java:105)
    at
org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
    ... 51 more

The cursor was inside 'example'. After that failure, other attempts give me

java.lang.NullPointerException
    at
org.eclipse.xtext.ui.refactoring.ui.RenameRefactoringController.startRefactoring(RenameRefactoringController.java:66)
    at
org.eclipse.xtext.ui.refactoring.ui.RenameRefactoringController.startLinkedEditing(RenameRefactoringController.java:94)
    at
org.eclipse.xtext.ui.refactoring.ui.RenameRefactoringController.startRefactoring(RenameRefactoringController.java:57)
    at
org.eclipse.xtext.ui.refactoring.ui.DefaultRenameElementHandler.startRenameElement(DefaultRenameElementHandler.java:80)
    at
org.eclipse.xtext.ui.refactoring.ui.DefaultRenameElementHandler.execute(DefaultRenameElementHandler.java:59)
Comment 1 Jan Koehnlein CLA 2011-09-01 05:20:24 EDT
*** Bug 354731 has been marked as a duplicate of this bug. ***
Comment 2 Jan Koehnlein CLA 2011-09-01 05:21:13 EDT
Continued from bug 354731
Comment 3 Holger Schill CLA 2011-09-12 08:32:14 EDT
How should the implementation behave in this case. I think it is unpossible to find out what element leaded to a special part of a qualified name. Should the refactoring just jump to the offset of the last segment of a qualified name? Or should the refactoring open a dialog to point out that a refactoring is not possible. Or should the refactoring just not respond?
Comment 4 Jan Koehnlein CLA 2011-09-12 08:37:47 EDT
This should already be fixed on HEAD. The last segment is selected in this case. Please reopen if the problem persists.
Comment 5 Karsten Thoms CLA 2017-09-19 17:21:23 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 6 Karsten Thoms CLA 2017-09-19 17:32:46 EDT
Closing all bugs that were set to RESOLVED before Neon.0