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
}
		});
		parent.setLayout(new FillLayout());
		parent.addPaintListener(new PaintListener() {
			public void paintControl(PaintEvent e) {
				if (e.gc.isDisposed())
					return;
				
				e.gc.fillRectangle(new Rectangle(e.x, e.y, e.width, e.height));
				Image i = currentImage;
				if (i != null && !i.isDisposed()) {
					Rectangle imageBounds = currentImage.getBounds();
					int x = (parent.getBounds().width - imageBounds.width) / 2;
					int y = bottomImageMargin;
					if(borderColor == null)
						borderColor = new Color(e.gc.getDevice(), 229, 229, 229);
					Color lastBackground = e.gc.getBackground();
					e.gc.setBackground(borderColor);
					e.gc.fillRoundRectangle(x, y, imageBounds.width + (frameWidth * 2), imageBounds.height + (frameWidth * 2), frameWidth, frameWidth);
					e.gc.setBackground(lastBackground);
					e.gc.drawImage(i, x + frameWidth, y + frameWidth);
				}
			}
		});
		parent.addControlListener(new ControlListener() {
			public void controlMoved(ControlEvent e) {
			}
			public void controlResized(ControlEvent e) {
				final Point newSize = parent.getSize();
				bgRealm.asyncExec(new Runnable() {