Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 51282 - [RCP] WorkbenchAdvisor.preShutdown not called
Summary: [RCP] WorkbenchAdvisor.preShutdown not called
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M9   Edit
Assignee: Nick Edgar CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 56564 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-02-06 09:21 EST by Andrew Eidsness CLA
Modified: 2004-05-04 00:40 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Eidsness CLA 2004-02-06 09:21:44 EST
From the class comment in WorkbenchAdvisor it looks like this should be used, 
but one of my test cases never receives the call.  The test case I'm using has 
no windows, perhaps the intent is for #preShutdown to be used only when windows 
within the app are to be closed?  At the very least, I think the comment should 
be updated.
Comment 1 Andrew Eidsness CLA 2004-02-16 15:16:06 EST
Along the same lines, it looks like WorkbenchAdvisor.postRestore is never called 
either.
Comment 2 Nick Edgar CLA 2004-04-06 14:10:48 EDT
*** Bug 56564 has been marked as a duplicate of this bug. ***
Comment 3 Nick Edgar CLA 2004-04-06 14:12:48 EDT
preShutdown was just never getting called.  We were considering simply removing
it.  However, having looked at what we do in busyClose, I think it would be
beneficial to keep preShutdown after all, and allow it to veto the shutdown.
There's a fair bit of work that gets done in busyClose, and the app may want to
extend this to do more work, before the workbench windows are closed.
Comment 4 Nick Edgar CLA 2004-04-06 15:34:37 EDT
I've added the call to preShutdown, and removed postRestore.  

postRestore is not necessary since postStartup is probably close enough, and if
not the app has control over when restore is done anyway (see
WorkbenchAdvisor.openWindows).

The RCP tests have been fixed up, and I've removed Andrew's '#ifdef's for this bug.
Comment 5 Nick Edgar CLA 2004-04-06 16:00:53 EDT
Ed, you should know about the changes here.
Comment 6 Ed Burnette CLA 2004-05-03 22:47:39 EDT
You got rid of postRestore() but not postWindowRestore() - shouldn't 
postWindowOpen() be close enough? In the current code there is a call to it 
but nobody overrides it that I can see.

Shouldn't WorkbenchAdvisor.basicInitialize be called internalBasicInitialize 
or something like that to indicate it shouldn't be called? (besides the note 
in the Javadoc).
Comment 7 Ed Burnette CLA 2004-05-03 22:55:04 EDT
In comment #6 I meant "shouldn't postWindowCreate() be close enough" not 
postWindowOpen. I can't think of a use for postWindowRestore and removing it 
would be orthogonal to removing postRestore.

BTW, I've made these updates in the RCP tutorials text but I'll hold off on 
redrawing the picture in case this other method is removed too.
Comment 8 Nick Edgar CLA 2004-05-04 00:40:58 EDT
The SDK implements postWindowRestore, to handle the switching of a restored
window to a new perspective coming in on a newly-installed feature.
See bug 21347 for the original request.  This is a case where it needs to
distinguish between a window that is being restored from a previous session, and
one that is being newly created.

A different way of doing this would be to pass a "restored" flag to
postWindowCreate, but I don't see that as being tangibly better.
I have no plans to change this for 3.0.

I've renamed basicInitialize to internalBasicInitialize as you suggest.
Note that it also protects itself from being called more than once.