1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

Ticket #96 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

Inline Rename Refactoring (Alt+Shift+R) is broken in eclipse 3.6

Reported by: fabien-b Owned by: waweee
Priority: major Component: Eclipse Integration
Version: 0.14.0 Keywords: refactoring


Alt+Shift+R renaming of methods and classes doesn't work anymore. A popup complains about "a method handle" that "cannot be found". Interestingly enough, renaming locals still works.

This is the only bugs that really prevents me to us this otherwise very cool piece of software. Keep up the great work!

Change History

Changed 3 years ago by rikonigsberg

TL;DR, press Alt-Shift-R a second time as a workaround.

I have done a bunch of research about this issue, and while I don't have a fix, I do have an understanding of the underlying cause.

* The error is being generated at this point:

Class org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor?

private RefactoringStatus? initialize(JavaRefactoringArguments? extended) {

... final IJavaElement element= JavaRefactoringDescriptorUtil?.handleToElement(extended.getProject(), handle, false);

if (element == null !element.exists() element.getElementType() != IJavaElement.TYPE)

return JavaRefactoringDescriptorUtil?.createInputFatalStatus(element, getProcessorName(), IJavaRefactorings.RENAME_TYPE);

The reason this is happening is because while the standard Eclipse editor is smart enough to know that the change you make directoy in the editor goes to a working copy (one that isn't committed to the backing model). The vrapper overloaded editor isn't smart enough to do that. Instead it commits the change immediately. In other words, once you commit that change, the compiler rebuilds the underlying model.

I haven't seen that for _sure_, but I know it because the expression above evaluates to false because "element.exists()" is false. (IJavaElement instances are just handles to underlying data, it doesn't mean the data exists.)

So of course, vrapper needs to do the same thing, which is not commit the change, just use the editor workspace as a working copy, and not commit the change.

* What do you do?

If you disabled vrapper and pressed cmd-opt-R , you would see the hint: a dropdown that gives a hint to what you can do, which is to press Alt-Shift-R AGAIN. Pressing it twice in a row brings up a dialog box. When you can rename your class there, instead of within the editor, the underlying java model remains pristine, and the RenameTypeProcessor? can find the IJavaElement, and all is good with the world.

Make sense?

Changed 3 years ago by rikonigsberg

Alternatively, and arguably much simpler, is this: Preferences > Java > and uncheck "Rename in editor without dialog". I haven't tried _that_ but I'll bet a dollar that does the same thing so you don't have to do Alt-Shift-R twice.

Changed 3 years ago by keforbes

  • status changed from new to closed
  • resolution set to fixed

The unstable update site now has an extension to vrapper for the JDT. This extension provides access to the inline rename tool by typing 'gR'. Since it's a hook into the JDT it is only available for Java right now. Give it a try and see if it resolves this issue for you. If things are looking good then I'll promote the extension to the stable update site with the next vrapper release.

I'm going to close this bug because I *think* the JDT extension will resolve the issue. Feel free to re-open it if there's a problem.

Note: See TracTickets for help on using tickets.