Bug 122566 Exception from project rename in target workbench
when renaming a project in a target workbench an EmptyStackException is thrown if you try to undo the rename. Steps to reproduse: 1. run a target workbench 2. create a new java project 3. rename it via the refactoring menu 4. undo the rename This problem does not happen in Eclipse itself, it only seems to occur in a target workbench. Below is the exeption stack trace java.util.EmptyStackException at org.eclipse.ltk.internal.core.refactoring.history.RefactoringHistoryService$RefactoringDescriptorStack.peek(RefactoringHistoryService.java:161) at org.eclipse.ltk.internal.core.refactoring.history.RefactoringHistoryService$RefactoringDescriptorStack.access$0(RefactoringHistoryService.java:158) at org.eclipse.ltk.internal.core.refactoring.history.RefactoringHistoryService.handleChangeUndone(RefactoringHistoryService.java:755) at org.eclipse.ltk.internal.core.refactoring.history.RefactoringHistoryService$RefactoringOperationHistoryListener.historyNotification(RefactoringHistoryService.java:315) at org.eclipse.core.commands.operations.DefaultOperationHistory.notifyListeners(DefaultOperationHistory.java:861) at org.eclipse.core.commands.operations.DefaultOperationHistory.notifyUndone(DefaultOperationHistory.java:988) at org.eclipse.core.commands.operations.DefaultOperationHistory.doUndo(DefaultOperationHistory.java:458) at org.eclipse.core.commands.operations.DefaultOperationHistory.undo(DefaultOperationHistory.java:1223) at org.eclipse.ui.operations.UndoActionHandler.runCommand(UndoActionHandler.java:66) at org.eclipse.ui.operations.OperationHistoryActionHandler$4.run(OperationHistoryActionHandler.java:275) at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:360) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:305) at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:453) at org.eclipse.ui.internal.operations.TimeTriggeredProgressMonitorDialog.access$6(TimeTriggeredProgressMonitorDialog.java:1) at org.eclipse.ui.internal.operations.TimeTriggeredProgressMonitorDialog$2.run(TimeTriggeredProgressMonitorDialog.java:201) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.ui.internal.operations.TimeTriggeredProgressMonitorDialog.run(TimeTriggeredProgressMonitorDialog.java:213) at org.eclipse.ui.operations.OperationHistoryActionHandler.run(OperationHistoryActionHandler.java:284) at org.eclipse.jface.action.Action.runWithEvent(Action.java:492) at org.eclipse.ui.actions.RetargetAction.runWithEvent(RetargetAction.java:222) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:530) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:480) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:392) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:914) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3285) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2905) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1764) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1728) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:398) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:106) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:109) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:379) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177) 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:324) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:338) at org.eclipse.core.launcher.Main.basicRun(Main.java:282) at org.eclipse.core.launcher.Main.run(Main.java:977) at org.eclipse.core.launcher.Main.main(Main.java:952)
org.eclipse.ltk.core.refactoring/src/org/eclipse/ltk/internal/core/refactoring/history/RefactoringHistoryService.java
break;
						}
					}
				} finally {
					subMonitor.done();
				}
				if (monitor.isCanceled())
					throw new OperationCanceledException();
				monitor.worked(1);
				final String name= proxy.getProject();
				final IFileStore store= EFS.getLocalFileSystem().getStore(RefactoringCorePlugin.getDefault().getStateLocation()).getChild(NAME_HISTORY_FOLDER);
				if (name != null && !"".equals(name)) {
					final IProject project= ResourcesPlugin.getWorkspace().getRoot().getProject(name);
					if (project.isAccessible()) {
						if (hasSharedRefactoringHistory(project)) {
							final URI uri= project.getLocationURI();
							if (uri != null)
								getManager(EFS.getStore(uri).getChild(RefactoringHistoryService.NAME_HISTORY_FOLDER), name).setComment(proxy, comment, new SubProgressMonitor(monitor, 2));
						} else
							getManager(store.getChild(name), name).setComment(proxy, comment, new SubProgressMonitor(monitor, 2));
					}
				} else
					getManager(store.getChild(NAME_WORKSPACE_PROJECT), null).setComment(proxy, comment, new SubProgressMonitor(monitor, 2));
			} finally {
				monitor.done();
			}
		}
	}
	
	private final class RefactoringOperationHistoryListener implements IOperationHistoryListener {