Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 333085 - [Compatibility] WorkbenchWindowAdvisor.postWindowOpen is not being called
Summary: [Compatibility] WorkbenchWindowAdvisor.postWindowOpen is not being called
Status: RESOLVED FIXED
Alias: None
Product: e4
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 1.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.1 M7   Edit
Assignee: Remy Suen CLA
QA Contact: Remy Suen CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-22 08:02 EST by Thomas Kratz CLA
Modified: 2011-04-19 02:31 EDT (History)
2 users (show)

See Also:


Attachments
Advisor notification patch v1 (2.41 KB, patch)
2011-01-04 10:56 EST, Remy Suen CLA
no flags Details | Diff
Workbench patch v1 (1.30 KB, patch)
2011-04-14 09:21 EDT, Remy Suen CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Kratz CLA 2010-12-22 08:02:57 EST
Build Identifier: e4 M4a

I find in my 3.6 based app Running on e4.1 that the postWindowOpen hook never gets called. As I start my p2 update queries there this is essential to me.

Reproducible: Always

Steps to Reproduce:
1. create a old school rcp app
2. put a breakpoint or log msg in postWindowOpen
3. wait forever ;)
Comment 1 Thomas Kratz CLA 2010-12-25 05:03:54 EST
After some diving I found that the workbenchwindow is actually openend in the WBWRenderer.postProcess() and I have no clue (maybe thats the point) how to access the workbenchwindowadvisor from there. 

Could anyone give me an idea how to hook in there to fire something after the window is openened ?
Comment 2 Remy Suen CLA 2011-01-04 10:31:03 EST
3.x call trace as follows:

Thread [main] (Suspended (breakpoint at line 241 in WorkbenchWindowAdvisor))
	IDEWorkbenchWindowAdvisor(WorkbenchWindowAdvisor).postWindowOpen() line: 241	
	WorkbenchWindow.fireWindowOpened() line: 1329	
	WorkbenchWindow.open() line: 803	
	Workbench$66.runWithException() line: 3658	
	Workbench$66(StartupThreading$StartupRunnable).run() line: 31	
	RunnableLock.run() line: 35	
	UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 134	
	Display.runAsyncMessages(boolean) line: 4059	
	Display.readAndDispatch() line: 3678	
	IDEWorkbenchAdvisor(WorkbenchAdvisor).openWindows() line: 803	
	Workbench$31.runWithException() line: 1567	
	Workbench$31(StartupThreading$StartupRunnable).run() line: 31	
	RunnableLock.run() line: 35	
	UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 134	
	Display.runAsyncMessages(boolean) line: 4059	
	Display.readAndDispatch() line: 3678	
	Workbench.runUI() line: 2548	
	Workbench.access$4(Workbench) line: 2438	
	Workbench$7.run() line: 671	
	Realm.runWithDefault(Realm, Runnable) line: 332	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 664	
	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: 48	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 37	
	Method.invoke(Object, Object...) line: 600	
	Main.invokeFramework(String[], URL[]) line: 622	
	Main.basicRun(String[]) line: 577	
	Main.run(String[]) line: 1410	
	Main.main(String[]) line: 1386	

(In reply to comment #1)
> After some diving I found that the workbenchwindow is actually openend in the
> WBWRenderer.postProcess() and I have no clue (maybe thats the point) how to
> access the workbenchwindowadvisor from there. 
> 
> Could anyone give me an idea how to hook in there to fire something after the
> window is openened ?

From a cursory glance, I don't think this is where we should be putting that code.
Comment 3 Thomas Kratz CLA 2011-01-04 10:37:06 EST
Hi, I could workaround by putting it in earlyStartup extension. so this is not a blocker anymore. But I guess its hard to fix.
Comment 4 Remy Suen CLA 2011-01-04 10:56:55 EST
Created attachment 186016 [details]
Advisor notification patch v1

Due to the differences in how startup is done, it's difficult to say if sending out the notification at this point is necessarily "correct".

Thomas, since you don't seem to be doing anything related to the actual workbench window, I think this patch should do the trick for you.
Comment 5 Remy Suen CLA 2011-01-10 14:19:25 EST
Updated patch released to CVS HEAD.
Comment 6 Remy Suen CLA 2011-01-26 09:22:41 EST
Verified by source inspection with I20110125-2200 on Windows XP that the code changes are there.

Thanks for the bug report, Thomas!
Comment 7 Joachim Mairböck CLA 2011-04-14 02:52:47 EDT
postWindowOpen() is still not called here. I don't see any log messages I have there and the debugger doesn't stop when putting a breakpoint in it. Please reopen this bug. My version is Eclipse 4.1 Build I20110407-2200.
Comment 8 Remy Suen CLA 2011-04-14 06:48:37 EDT
(In reply to comment #7)
> postWindowOpen() is still not called here. I don't see any log messages I have
> there and the debugger doesn't stop when putting a breakpoint in it. Please
> reopen this bug. My version is Eclipse 4.1 Build I20110407-2200.

Without looking at the code I suspect this is either a) a problem on first startup but disappears on subsequent startups, or b) not a problem on first startup but becomes a problem on subsequent startups.
Comment 9 Remy Suen CLA 2011-04-14 09:21:32 EDT
Created attachment 193252 [details]
Workbench patch v1

(In reply to comment #8)
> (In reply to comment #7)
> > postWindowOpen() is still not called here. I don't see any log messages I have
> > there and the debugger doesn't stop when putting a breakpoint in it. Please
> > reopen this bug. My version is Eclipse 4.1 Build I20110407-2200.
> 
> Without looking at the code I suspect this is either a) a problem on first
> startup but disappears on subsequent startups, or b) not a problem on first
> startup but becomes a problem on subsequent startups.

The problem has identified as being A.
Comment 10 Remy Suen CLA 2011-04-14 09:22:35 EDT
(In reply to comment #9)
> Created attachment 193252 [details]
> Workbench patch v1

Patch released to HEAD.

Thank you very much for letting us know about this problem, Joachim!
Comment 11 Joachim Mairböck CLA 2011-04-19 02:31:25 EDT
Thank you for fixing the bug so quickly. I finally managed to update my installation and now I can see my output there.