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

Bug 370370

Summary: Support of Eclipse 4 Parts in WindowBuilder
Product: z_Archived Reporter: Lars Vogel <Lars.Vogel>
Component: WindowBuilderAssignee: Konstantin Scheglov <Konstantin.Scheglov>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P1 CC: clayberg, daniel.esser, ines.lelle, Lars.Vogel, michael.schiepe, nobody, Peter_Weihrauch, remy.suen, robert.scheibe, sven.klemm, vincenzo.caselli
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 368543    
Bug Blocks:    
Attachments:
Description Flags
Screenshot
none
WB Screenshot none

Description Lars Vogel CLA 2012-02-01 15:08:37 EST
Eric Clayberg indicated that WB might be supporting Eclipse 4 Parts. That would be great, especially as Eclipse 3.8 will be last Eclipse 3.x release. 

I would be great to have a bug to get notifications if updates happen.

Also in http://www.eclipse.org/forums/index.php/t/281920/ Eric asked for a template. Here it is again:

package com.example.e4.rcp.todo.parts;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

import org.eclipse.swt.widgets.Composite;

public class TodoDetailsPart {

@PostConstruct
public void createPartControls(Composite parent) {
}

@PreDestroy
public void dispose() {

}

@Focus
public void setFocus() {
// TODO Set Focus to control
}


}
Comment 1 Lars Vogel CLA 2012-02-01 16:10:06 EST
Got the feedback from the Eclipse UI team (Remy Suen) that createControls(Composite parent) would be better, as the class may be reused for another model element. Hence new suggestion:

ackage com.example.e4.rcp.todo.parts;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

import org.eclipse.swt.widgets.Composite;

public class TodoDetailsPart {

@PostConstruct
public void createControls(Composite parent) {
}

@PreDestroy
public void dispose() {

}

@Focus
public void setFocus() {
// TODO Set Focus to control
}


}
Comment 2 Konstantin Scheglov CLA 2012-02-10 09:15:59 EST
Fixed in trunk.
WindowBuilder looks now method with @PostConstruct annotation and Composite parameter.
Then it parses this method using Composite parameter as root of UI.
Comment 3 Eric Clayberg CLA 2012-02-10 09:36:17 EST
There is also a new e4 ViewPart wizard provided by WB. This will all be part of the next build.
Comment 4 Lars Vogel CLA 2012-02-10 13:04:52 EST
Thanks you Konstantin and Eric. That is a big step for efficient Eclipse 4 development and for acceptance of Eclipse 4 as platform.
Comment 5 Sven Klemm CLA 2012-02-10 13:09:36 EST
Thx - this will help us a lot in development!
Comment 6 Lars Vogel CLA 2012-04-17 14:03:09 EDT
I just tested with Eclipse 4.2 M6 and a Pojo Part and I got an error. Stacktrace below.
-------------

package com.example.e4.rcp.todo.ui.parts;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

import org.eclipse.e4.ui.di.Focus;
import org.eclipse.swt.widgets.Composite;

public class PlaygroundPart {
	@PostConstruct
	public void createControls(Composite parent) {
	}

	@PreDestroy
	public void dispose() {

	}


	@Focus
	public void setFocus() {
	// TODO Set Focus to control
	}
}
-------------


java.lang.NullPointerException
	at org.eclipse.wb.internal.core.editor.multi.SourcePage.updateSourceActions(SourcePage.java:140)
	at org.eclipse.wb.internal.core.editor.multi.SourcePage.handleActiveState(SourcePage.java:74)
	at org.eclipse.wb.internal.core.editor.multi.DefaultMultiMode.showPage(DefaultMultiMode.java:125)
	at org.eclipse.wb.internal.core.editor.multi.MultiPagesMode.showSource(MultiPagesMode.java:54)
	at org.eclipse.wb.internal.core.editor.multi.MultiPagesMode.create(MultiPagesMode.java:100)
	at org.eclipse.wb.internal.core.editor.multi.DesignerEditor.createPartControl(DesignerEditor.java:87)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPartControl(CompatibilityPart.java:123)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor.createPartControl(CompatibilityEditor.java:95)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:266)
	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.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:853)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:833)
	at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:111)
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:318)
	at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:240)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:161)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:102)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:71)
	at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:53)
	at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:141)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:882)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:616)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:718)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:689)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:683)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:668)
	at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.showTab(StackRenderer.java:1010)
	at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer$1.handleEvent(LazyStackRenderer.java:66)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:41)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4290)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:184)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38)
	at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
	at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135)
	at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)
	at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)
	at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:81)
	at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:57)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
	at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:171)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:418)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:385)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.delegateBringToTop(PartServiceImpl.java:578)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.bringToTop(PartServiceImpl.java:314)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:962)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2812)
	at org.eclipse.ui.internal.WorkbenchPage.access$20(WorkbenchPage.java:2737)
	at org.eclipse.ui.internal.WorkbenchPage$8.run(WorkbenchPage.java:2719)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2715)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2674)
	at org.eclipse.ui.actions.OpenWithMenu.openEditor(OpenWithMenu.java:338)
	at org.eclipse.ui.actions.OpenWithMenu$2.handleEvent(OpenWithMenu.java:180)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1271)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3553)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3178)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1015)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:909)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:85)
	at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:580)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:535)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
	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:353)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
	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:629)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
Comment 7 Eric Clayberg CLA 2012-04-18 00:24:39 EDT
This was already fixed immediately after M6. See...

https://bugs.eclipse.org/bugs/show_bug.cgi?id=372720
Comment 8 Lars Vogel CLA 2012-04-18 01:23:45 EDT
Thanks Eric, but I'm getting the same error with the latest Eclipse 4 Integration build. Also the rendering of the editor is really weird.

I'm using the Juno update site to install WB, if that makes any difference.
Comment 9 Lars Vogel CLA 2012-04-18 01:24:14 EDT
Created attachment 214158 [details]
Screenshot

Screenshot showing the rendering and stacktrace.
Comment 10 Eric Clayberg CLA 2012-04-18 12:01:04 EDT
We are unable to reproduce this. You should use the WB update site to get the latest WB build. The Juno build site probably is using the WB M6 bits which predates the fix.
Comment 11 Lars Vogel CLA 2012-04-20 04:38:31 EDT
I installed the latest version from WB into Eclipse 4.2 Build id: I20120411-2034 and the rendering looks very strange.

I used the following update site.

http://download.eclipse.org/windowbuilder/WB/integration/4.2/


Screenshot attached.
Comment 12 Lars Vogel CLA 2012-04-20 04:38:59 EDT
Created attachment 214294 [details]
WB Screenshot
Comment 13 Eric Clayberg CLA 2012-04-20 10:50:15 EDT
It looks like a couple different cases are being mixed up here. Are you still seeing the stack trace that you reported earlier?

Is the rendering issue you are seeing related to editing e4 parts (this case) or a generic rendering issue (not this case)? Your screen shot looks to be some sort of Linux rendering issue that is unrelated to e4 part support. Can you confirm this and open a new case if needed? We need details of when you are seeing this or not. Which versions of Eclipse (just 4.2 or also 3.8)? Which exact OS distro?
Comment 14 Lars Vogel CLA 2012-04-20 11:12:09 EDT
Thanks Eric. Stacktrace is indeed gone. Looks like https://bugs.eclipse.org/bugs/show_bug.cgi?id=368543 is reappearing, this time the workaround does not seem to solve this issue.

In case you want to test, I'm using Eclipse 4.2 Build id: I20120411-2034 with standard Ubuntu 11.10 using Unity.

Feel free to close this bug, if 368543 covers everything.
Comment 15 Eric Clayberg CLA 2012-04-20 13:04:49 EDT
OK. Closing this one. Display issues tracked in... https://bugs.eclipse.org/bugs/show_bug.cgi?id=368543