Community
Participate
Working Groups
When the rename refactoring is invoked with the cursor (or selection) at an inappropriate location (e.g. a keyword, comment, or whitespace), an error dialog with the title "Error initializing refactoring" and the message "java.lang.reflect.InvocationTargetException" (nothing else) is displayed. The corresponding entry from the error log has been attached below. The problem seems to be that the original exception is wrapped into an InvocationTargetException by org.eclipse.jface.operation.ModalContext and the original message thus gets lost in transition. In the JDT the behavior is different: The context menu item is not even displayed if the selection doesn't correspond to something which can be renamed. Further, if the rename refactoring is invoked using the accelerator, an Info (not Error) dialog with title "Rename" and the message "Operation unavailable on the current selection. Select a Java project, source folder, resource, package, compilation unit, type, field, method, parameter or a local variable" is displayed. And no error is logged. org.eclipse.emf.common.util.WrappedException: java.lang.reflect.InvocationTargetException at org.eclipse.xtext.ui.refactoring.ui.RenameRefactoringController.startLinkedEditing(RenameRefactoringController.java:116) at org.eclipse.xtext.ui.refactoring.ui.RenameRefactoringController.startRefactoring(RenameRefactoringController.java:57) at org.eclipse.xtext.ui.refactoring.ui.RenameElementHandler.startRenameElement(RenameElementHandler.java:80) at org.eclipse.xtext.xbase.ui.jvmmodel.refactoring.jdt.JvmRenameElementHandler.startRenameElement(JvmRenameElementHandler.java:83) at org.eclipse.xtext.ui.refactoring.ui.RenameElementHandler.execute(RenameElementHandler.java:59) at org.eclipse.xtext.xbase.ui.jvmmodel.refactoring.jdt.JvmRenameElementHandler.execute(JvmRenameElementHandler.java:50) at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:294) at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508) at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:470) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:824) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:880) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:569) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:510) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:125) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:965) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3542) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1250) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1273) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1287) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1283) at org.eclipse.swt.widgets.Canvas.sendKeyEvent(Canvas.java:433) at org.eclipse.swt.widgets.Composite.keyDown(Composite.java:523) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4655) at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method) at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:202) at org.eclipse.swt.widgets.Widget.windowSendEvent(Widget.java:1753) at org.eclipse.swt.widgets.Shell.windowSendEvent(Shell.java:1825) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4713) at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method) at org.eclipse.swt.widgets.Display.applicationSendEvent(Display.java:4285) at org.eclipse.swt.widgets.Display.applicationProc(Display.java:4352) at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method) at org.eclipse.swt.internal.cocoa.NSApplication.sendEvent(NSApplication.java:101) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3097) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514) at org.eclipse.equinox.launcher.Main.run(Main.java:1311) at org.eclipse.equinox.launcher.Main.main(Main.java:1287) Caused by: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:477) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372) at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:507) at org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog.run(ProgressMonitorJobsDialog.java:275) at org.eclipse.ui.internal.progress.ProgressManager.run(ProgressManager.java:1178) at org.eclipse.xtext.ui.refactoring.ui.RenameRefactoringController.startLinkedEditing(RenameRefactoringController.java:108) ... 58 more 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:83) at org.eclipse.xtext.ui.refactoring.ui.RenameRefactoringController$1.run(RenameRefactoringController.java:111) at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464) ... 63 more
Continued in bug 356342 *** This bug has been marked as a duplicate of bug 356342 ***
Improved error messages with fix for bug 356342, but still need an earlier decision whether refactoring is available.
Pushed to MASTER: - DefaultRenameHandler checks whether refactoring is available. - RenameLinkedMode always uses first position and fits selection inside.
Closing all bugs that were set to RESOLVED before Neon.0