How selection changed when select difference part in eclipse

One Part One Site, One Site One SelectionProvider, When you switch between
difference views or editors, the Part changed, so the SelectionProvider
changed also.
In WorkbenchPage class:
private PageSelectionService selectionService = new
PageSelectionService(this);
private WorkbenchPagePartList partList = new
WorkbenchPagePartList(selectionService); // selectionService construct
relation with partList

method: private void setActivePart(IWorkbenchPart newPart)

partList.setActivePart(partref); //when select difference parts, it will
update selectionService, at some time, PropertySheet will update too.

In WorkbenchPagePartList class, fireActivePartChanged method will do the
real things:
protected void fireActivePartChanged(IWorkbenchPartReference oldRef,
IWorkbenchPartReference newRef) {
partService.setActivePart(newRef);

IWorkbenchPart realPart = newRef == null? null : newRef.getPart(false);
selectionService.setActivePart(realPart); //this also changed selectionService
in WorkbenchPage class.
}

Last, the selectionService in WorkbenchPage and selectionService in partList
is same .


http://www.eclipse.org/articles/Article-WorkbenchSelections/article.html