Bug 342998 Refactor ESelectionService into multiple classes
While there is a master/slave relationship "enforced" by the current implementation, it is non-obvious as the code is quite convoluted. The implementation needs to be refactored to enhance readability.
tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/ESelectionServiceTest.java
partService.showPart("partC", PartState.CREATE); 
		assertNull(listener.getPart());
		assertNull(listener.getSelection());
		IEclipseContext contextC = partC.getContext();
		ESelectionService serviceC = (ESelectionService) contextC
				.get(ESelectionService.class.getName());
		listener.reset();
		serviceC.setSelection(selection);
		assertEquals(partC, listener.getPart());
		assertEquals(selection, listener.getSelection());
	}
	static class ConsumerPart {
		public Object input;
		@Inject
		@Optional
		public void setInput(@Named(ESelectionService.SELECTION) Object current) {
			input = current;
		}
	}
	static class ProviderPart extends ConsumerPart {
		private ESelectionService selectionService;
		@Inject
		public void setSelectionService(ESelectionService s) {
			selectionService = s;
		}
		public void setSelection(Object selection) {
			selectionService.setSelection(selection);
		}
	}
	static class TrackingProviderPart extends ProviderPart {