Bug 337141 Recursive part activation warnings fired from photo demo
!ENTRY org.eclipse.e4.ui.workbench 2 0 2011-02-14 11:37:24.765 !MESSAGE Blocked recursive attempt to activate part !STACK 0 java.lang.IllegalStateException at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer$1.setFocus(ContributedPartRenderer.java:95) at org.eclipse.e4.demo.e4photo.Preview.setFocus(Preview.java:167) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:618) at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56) at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:226) at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:203) at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:101) at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer$1.setFocus(ContributedPartRenderer.java:77) at org.eclipse.e4.demo.e4photo.Preview.setFocus(Preview.java:167) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:618) at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56) at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:226) at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:203) at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:101) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:508) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:477) at org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer.activate(AbstractPartRenderer.java:105) at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer$3.handleEvent(ContributedPartRenderer.java:210) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
examples/org.eclipse.e4.demo.e4photo/src/org/eclipse/e4/demo/e4photo/Preview.java
};
		this.parentSize = new WritableValue(bgRealm);
		this.scaledImageData = new ComputedValue(bgRealm) {
			protected Object calculate() {
				ImageData rawData = (ImageData) rawImageData.getValue();
				Point maxSize = (Point) parentSize.getValue();
				if (rawData == null || maxSize == null) {
					return null;
				}
				Point targetSize = getBestSize(rawData.width, rawData.height,
						maxSize.x, maxSize.y);
				return rawData.scaledTo(targetSize.x, targetSize.y);
			}
		};
		scaledImageData.addChangeListener(new IChangeListener() {
			public void handleChange(ChangeEvent event) {
				final ImageData imageData = (ImageData) scaledImageData
						.getValue();
				parent.getDisplay().asyncExec(new Runnable() {
					public void run() {
						if (imageData == null)
							return;
						if (currentImage != null) {
							currentImage.dispose();
							currentImage = null;
						}
						currentImage = new Image(parent.getDisplay(), imageData);
						parent.redraw();
					}
				});