private void setPart(IWorkbenchPart part, boolean notify) {
if (fPart != null) {
// remove myself as a listener from the existing part
ISelectionProvider sp = fPart.getSite().getSelectionProvider();
if (sp != null) {
sp.removeSelectionChangedListener(selectionListener);
if (sp instanceof IPostSelectionProvider) {
((IPostSelectionProvider) sp)
.removePostSelectionChangedListener(postSelectionListener);
} else {
sp.removeSelectionChangedListener(postSelectionListener);