DESCRIPTION

[syncView] Simplify operations on change actions

Simplify operations when repository changed and resource changed events
occurs.

Also ignores non-resource-change events (like breakpoint add/remove) in
resource changed event listener.

Bug: 358898
Change-Id: I8ace9413981f38435ce34cf540933aaddc654d6b
Signed-off-by: Leslie Stephenson xxx@xxx.xxx


COMMENTS

author: Leslie Stephenson
date: 2011-10-26 15:05:09.000000000

Uploaded patch set 4.

-------------------------------------
author: Brenden Conley
date: 2011-10-26 15:05:12.000000000

Patch Set 4:

Build Started https://hudson.eclipse.org/sandbox/job/egit.gerrit/1815/ 

-------------------------------------
author: Brenden Conley
date: 2011-10-26 15:19:38.000000000

Patch Set 4: Build Successful

Build Successful 
 
https://hudson.eclipse.org/sandbox/job/egit.gerrit/1815/ : SUCCESS

-------------------------------------
author: Jaylon Avila
date: 2011-10-26 15:29:27.000000000

Patch Set 4:

With your latest code, the value is always 0 on I20111018-0850.

-------------------------------------
author: Jaylon Avila
date: 2011-10-26 15:41:18.000000000

Patch Set 4:

When I get a resource change event the delta's list of affected children are IProjects. You are getting IFiles in your list, Dariusz?

-------------------------------------
author: Leslie Stephenson
date: 2011-10-26 16:01:41.000000000

Patch Set 4:

I always get instance of IProject for file content change and breakpoint add/remove

-------------------------------------
author: Jaylon Avila
date: 2011-10-26 16:55:42.000000000

Patch Set 4:

Hm, that's odd that you're getting a non-zero value for your getFlags() then as I'm getting zeros when toggling breakpoints and for saving files.

-------------------------------------
author: Leslie Stephenson
date: 2011-10-26 18:01:33.000000000

Patch Set 4:

For file save I get two separate events first with delta flags == 0 second with delta flags != 0

-------------------------------------
author: Jaylon Avila
date: 2011-10-26 18:32:05.000000000

Patch Set 4:

Are you saving Java files? If yes, that explains why you are getting two events as the second event is for the generation of the .class files. Based on your fourth patch set, the resource change event never gets pass the 'if' statement for me. I don't understand why you are getting a non-zero value if your resource delta's resource is the project as the project itself should not have been affected by the file save operation. If you save a non-Java file do you only get one resource change event with a value of zero?

-------------------------------------
author: Leslie Stephenson
date: 2011-10-26 19:09:03.000000000

Patch Set 4:

Yes, I was always testing on java files. But this works same way for non-java files. For test I've created 3 text files one in java package, one in source folder and one in project root and I always got two events, same as for java files ...

-------------------------------------
author: Jaylon Avila
date: 2011-10-26 20:19:34.000000000

Patch Set 4:

Very odd. When you get the two events, please suspend the thread and provide a thread dump so that we can see where the events are coming from.

-------------------------------------
author: Leslie Stephenson
date: 2011-10-26 20:28:58.000000000

Patch Set 4:

First hit (getFlags() ==0)
org.eclipse.egit.core.synchronize.GitSubscriberMergeContext$2.resourceChanged(GitSubscriberMergeContext.java:71)
	at org.eclipse.core.internal.events.NotificationManager$1.run(NotificationManager.java:291)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:285)
	at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:149)
	at org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:395)
	at org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:1530)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2353)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118)
	at org.eclipse.ui.internal.editors.text.WorkspaceOperationRunner.run(WorkspaceOperationRunner.java:75)
	at org.eclipse.ui.internal.editors.text.WorkspaceOperationRunner.run(WorkspaceOperationRunner.java:65)
	at org.eclipse.ui.editors.text.TextFileDocumentProvider.executeOperation(TextFileDocumentProvider.java:456)
	at org.eclipse.ui.editors.text.TextFileDocumentProvider.saveDocument(TextFileDocumentProvider.java:772)
	at org.eclipse.ui.texteditor.AbstractTextEditor.performSave(AbstractTextEditor.java:5048)
	at org.eclipse.ui.texteditor.AbstractTextEditor.doSave(AbstractTextEditor.java:4837)
	at org.eclipse.ui.texteditor.AbstractTextEditor$TextEditorSavable.doSave(AbstractTextEditor.java:7177)
	at org.eclipse.ui.Saveable.doSave(Saveable.java:214)
	at org.eclipse.ui.internal.SaveableHelper.doSaveModel(SaveableHelper.java:349)
	at org.eclipse.ui.internal.SaveableHelper$3.run(SaveableHelper.java:195)
	at org.eclipse.ui.internal.SaveableHelper$5.run(SaveableHelper.java:277)
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
	at org.eclipse.jface.window.ApplicationWindow$1.run(ApplicationWindow.java:759)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.jface.window.ApplicationWindow.run(ApplicationWindow.java:756)
	at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2642)
	at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:285)
	at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:264)
	at org.eclipse.ui.internal.SaveableHelper.saveModels(SaveableHelper.java:207)
	at org.eclipse.ui.internal.SaveableHelper.savePart(SaveableHelper.java:144)
	at org.eclipse.ui.internal.EditorManager.savePart(EditorManager.java:1399)
	at org.eclipse.ui.internal.WorkbenchPage.savePart(WorkbenchPage.java:3416)
	at org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPage.java:3429)
	at org.eclipse.ui.internal.handlers.SaveHandler.execute(SaveHandler.java:54)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
	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:468)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:786)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:885)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:567)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:508)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:123)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1531)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1257)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1282)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1267)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1294)
	at org.eclipse.swt.widgets.Widget.gtk_key_press_event(Widget.java:730)
	at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:3019)
	at org.eclipse.swt.widgets.Composite.gtk_key_press_event(Composite.java:734)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1743)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:5016)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4408)
	at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:8422)
	at org.eclipse.swt.widgets.Display.eventProc(Display.java:1245)
	at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
	at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2276)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3207)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	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:344)
	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:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)


Second hit (getFlags() == 131072)
org.eclipse.egit.core.synchronize.GitSubscriberMergeContext$2.resourceChanged(GitSubscriberMergeContext.java:71)
	at org.eclipse.core.internal.events.NotificationManager$1.run(NotificationManager.java:291)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:285)
	at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:149)
	at org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:395)
	at org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:1530)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:156)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

-------------------------------------
author: Jaylon Avila
date: 2011-10-26 21:17:40.000000000

Patch Set 4:

If you traverse the tree of affected child deltas in the second event, what is at the tip of those branches?

-------------------------------------
author: Leslie Stephenson
date: 2011-10-26 21:57:58.000000000

Patch Set 4:

I've changed file in project root, so the first ResourceDiff contains IProject, the nested ResourceDiff had IFile instance that was actually file that was changed.

-------------------------------------
author: Jaylon Avila
date: 2011-10-26 22:16:17.000000000

Patch Set 4:

That's odd because IResourceChangeEvent's getDelta() javadoc states that the delta starts off at the workspace root. I'd suggest someone else take a look at this patch because I cannot say that the current change set works for me.

-------------------------------------
author: Leslie Stephenson
date: 2011-10-27 06:35:09.000000000

Patch Set 4:

Damn ... I forgot about IResourceDelta that is in event, and yes it is pointing on workspace root ... my fault

-------------------------------------
author: Leslie Stephenson
date: 2011-10-27 06:35:27.000000000

Patch Set 4: Looks good to me, approved; Build Successful; IP review completed



-------------------------------------
author: Leslie Stephenson
date: 2011-10-27 06:35:30.000000000

Change has been successfully merged into the git repository.

-------------------------------------
author: Leslie Stephenson
date: 2011-10-27 06:43:34.000000000

Patch Set 4: Reverted

This patchset was reverted in change: I14aec5e7dae024f15c6ee9127cb46151d253c21b

-------------------------------------
author: Leslie Stephenson
date: 2011-10-30 21:36:28.000000000

Patch Set 4:

This change was merged by mistake.

Review is continued in I6ae88da36dffaa913dc37525aec5ad8dca240fe0

-------------------------------------
