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

Bug 308637

Summary: Invoking Replace With > Latest from in compare editor results in a warning dialog
Product: [Eclipse Project] Platform Reporter: Pawel Pogorzelski <pawel.pogorzelski1>
Component: TeamAssignee: Platform Team Inbox <platform-team-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: Alfredo.Bencomo, daniel_megert
Version: 3.6   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Pawel Pogorzelski CLA 2010-04-09 09:13:55 EDT
Build id: HEAD

1 Synchronize a project with at least one file changed locally
2 Open the file in both regular and compare editor
3 Run "Replace With > Latest from HEAD" from compare editor's context menu
4 Select OK when prompted about overriding uncommitted changes
5 Compare editor closes since there are no more changes to display

Actual:
6A Dialog saying "The file X has been changed on the files system. Do you want to replace the editor contents with these changes?" appears

Expected
6B No dialog is displayed, changes are picked up by other editor silently

See bug 286219, comments 6 and 9 for other steps to reproduce the problem.
Comment 1 Pawel Pogorzelski CLA 2010-04-09 12:13:35 EDT
The problem can be also reproduced without a fix for bug 286219, using eclipse-SDK-N20100408-2000 and a fresh workspace. There are steps for it on bug 286219, comment 9 but they lack some details. Here is a complete list:

Steps:
1. Fetch org.eclipse.compare from the repostitory
2. Open TextMergeViewer and change a date in copyrights
3. Synchronize with a repository (with switching to Synchronize perspestive)
4. Having a Java editor open select Open in compare
5. Open Project Explorer view
6. Invoke Replace with > Latest from HEAD using Project Explorer
7. Click OK when prompted for overriding uncommitted changes
8. IMMEDIATELY after the dialog closes switch to the left side of compare editor

Result:
9. Dialog saying "The file TextMergeViewer.java has been changed on the files system. Do you want to replace the editor contents with these changes?" appears

The issue is time specific so it's important to switch to compare editor as soon as possible when the dialog from step 7 disappears. Good luck Dani:)
Comment 2 Dani Megert CLA 2010-04-12 06:44:20 EDT
>Good luck Dani:)
I was :-) and I also found out why I couldn't reproduce in my fresh workspace last Friday:
>2 Open the file in both regular and compare editor
To execute this step I simply used Compare With > Latest from HEAD out of the Package Explorer and when doing so, this bug here does not happen. I also found out the difference: in my scenario the Compare Editor remains open, saying that there are no differences. However, if the Compare Editor is opened via Synchronize view like in your steps from comment 1, the editor gets closed. This editor closing behavior can then result in the additional dialog.

I think if you can make sure that the Compare Editor doesn't close, then we also get rid of this bug here.

It looks like the Compare Editor thinks that the input got change. Here's the stack trace that causes the closing:
Thread [main] (Suspended (breakpoint at line 2630 in JavaEditor))	
	owns: RunnableLock  (id=148)	
	JavaMergeViewer$CompilationUnitEditorAdapter(JavaEditor).dispose() line: 2630	
	JavaMergeViewer$CompilationUnitEditorAdapter(CompilationUnitEditor).dispose() line: 1467	
	JavaMergeViewer.handleDispose(DisposeEvent) line: 113	
	ContentViewer$2.widgetDisposed(DisposeEvent) line: 214	
	TypedListener.handleEvent(Event) line: 117	
	EventTable.sendEvent(Event) line: 84	
	ContentMergeViewer$7(Widget).sendEvent(Event) line: 1050	
	ContentMergeViewer$7(Widget).sendEvent(int, Event, boolean) line: 1074	
	ContentMergeViewer$7(Widget).sendEvent(int) line: 1055	
	ContentMergeViewer$7(Widget).release(boolean) line: 807	
	CompareContentViewerSwitchingPane(Composite).releaseChildren(boolean) line: 872	
	CompareContentViewerSwitchingPane(Widget).release(boolean) line: 810	
	Splitter(Composite).releaseChildren(boolean) line: 872	
	Splitter(Widget).release(boolean) line: 810	
	PageBook(Composite).releaseChildren(boolean) line: 872	
	PageBook(Widget).release(boolean) line: 810	
	Composite.releaseChildren(boolean) line: 872	
	Composite(Widget).release(boolean) line: 810	
	Composite.releaseChildren(boolean) line: 872	
	Composite(Widget).release(boolean) line: 810	
	Composite(Widget).dispose() line: 445	
	EditorPane(PartPane).dispose() line: 180	
	EditorReference(WorkbenchPartReference).dispose() line: 681	
	WorkbenchPage.disposePart(WorkbenchPartReference) line: 1721	
	WorkbenchPage.handleDeferredEvents() line: 1426	
	WorkbenchPage.deferUpdates(boolean) line: 1410	
	WorkbenchPage.closeEditors(IEditorReference[], boolean) line: 1384	
	WorkbenchPage.closeEditor(IEditorPart, boolean) line: 1448	
	SaveableCompareEditorInput$3.run() line: 290	
	ModelCompareEditorInput(SaveableCompareEditorInput).closeEditor(boolean) line: 294	
	SaveableCompareEditorInput$1.compareInputChanged(ICompareInput) line: 167	
	AbstractCompareInput$1.run() line: 74	
	SafeRunner.run(ISafeRunnable) line: 42	
	ResourceDiffCompareInput(AbstractCompareInput).fireChange() line: 72	
	ResourceDiffCompareInput.fireChange() line: 168	
	ResourceDiffCompareInput.update() line: 277	
	ResourceCompareInputChangeNotifier(CompareInputChangeNotifier).fireChange(ICompareInput) line: 389	
	ResourceCompareInputChangeNotifier(CompareInputChangeNotifier).fireChanges(ICompareInput[]) line: 295	
	CompareInputChangeNotifier$1.run() line: 253	
	UILockListener.doPendingWork() line: 164	
	UISynchronizer$3.run() line: 158	
	RunnableLock.run() line: 35	
	UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 134	
	Display.runAsyncMessages(boolean) line: 4014	
	Display.readAndDispatch() line: 3633	
	Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2416	
	Workbench.runUI() line: 2380	
	Workbench.access$4(Workbench) line: 2229	
	Workbench$5.run() line: 504	
	Realm.runWithDefault(Realm, Runnable) line: 332	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 497	
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149	
	IDEApplication.start(IApplicationContext) line: 115	
	EclipseAppHandle.run(Object) line: 196	
	EclipseAppLauncher.runApplication(Object) line: 110	
	EclipseAppLauncher.start(Object) line: 79	
	EclipseStarter.run(Object) line: 369	
	EclipseStarter.run(String[], Runnable) line: 179	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25	
	Method.invoke(Object, Object...) line: 597	
	Main.invokeFramework(String[], URL[]) line: 619	
	Main.basicRun(String[]) line: 574	
	Main.run(String[]) line: 1407	
	Main.main(String[]) line: 1383
Comment 3 Al B CLA 2011-09-23 01:50:32 EDT
Any update or progress on this?
Comment 4 Lars Vogel CLA 2019-11-14 03:47:00 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

If the bug is still relevant, please remove the "stalebug" whiteboard tag.