Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 354685 - [Compatibility] IWorkbenchPartReference does not initialize on legacy EditorParts
Summary: [Compatibility] IWorkbenchPartReference does not initialize on legacy EditorP...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.1   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-13 06:25 EDT by Thomas Kratz CLA
Modified: 2011-08-13 07:34 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Kratz CLA 2011-08-13 06:25:15 EDT
Build Identifier: e4.1 M7

I have a WorkbenchPartListener which is called on close of my editors. Inside the listener I have
private Object getEntity(IWorkbenchPartReference ref) {
		IWorkbenchPart part = ref.getPart(true);
		if (!(part instanceof IEditorPart)) {
			return null;
		}
		IEditorPart editor = (IEditorPart) part;

to get access to the actual editor part and its input. But the call to ref.getPart(true) returns null in my case. Sadly I do not correctly understand the inner workings of this method, legacypart of the reference is null in my case but size of children after the init is not 1.

Would be great if we could investigate this, as my database record stays locked until timeout as long as the close of my editors is not recognised.

Reproducible: Always
Comment 1 Thomas Kratz CLA 2011-08-13 06:27:33 EDT
PS if this should be going to "runtime" please change it, I'm not sure.
Comment 2 Remy Suen CLA 2011-08-13 07:16:57 EDT
(In reply to comment #0)
> Build Identifier: e4.1 M7
> 
> I have a WorkbenchPartListener which is called on close of my editors. Inside
> the listener I have
> private Object getEntity(IWorkbenchPartReference ref) {
>         IWorkbenchPart part = ref.getPart(true);
>         if (!(part instanceof IEditorPart)) {
>             return null;
>         }
>         IEditorPart editor = (IEditorPart) part;
> 
> to get access to the actual editor part and its input. But the call to
> ref.getPart(true) returns null in my case.

This sounds to me like the same problem as bug 342366.
http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?h=R4_development&id=faeb9c58f9da28ab87e2f96edb03dd1d41365553

(In reply to comment #1)
> PS if this should be going to "runtime" please change it, I'm not sure.

With 4.1 out the door, you can just open bugs against Platform/UI and then put the version as 4.1, Thomas.
Comment 3 Thomas Kratz CLA 2011-08-13 07:34:12 EDT
Thanks Remy, that solved my problem. 
I fail to update my target platform :) is always  trouble with my patches and getting the build to work again.