Program: 78090
Project: 78090
Buggy source:
public void partActivated(IWorkbenchPart part){
  if (part != this) {
    if (part instanceof PageBookView) {
      PageBookView view=(PageBookView)part;
      if (view.getCurrentPage() instanceof DesignerOutlinePage) {
        ISelectionProvider provider=(ISelectionProvider)view.getCurrentPage();
        ReportRequest request=new ReportRequest(view.getCurrentPage());
        List list=new ArrayList();
        if (provider.getSelection() instanceof IStructuredSelection) {
          list=((IStructuredSelection)provider.getSelection()).toList();
        }
        request.setSelectionObject(list);
        request.setType(ReportRequest.SELECTION);
        SessionHandleAdapter.getInstance().getMediator().notifyRequest(request);
        SessionHandleAdapter.getInstance().getMediator().pushState();
      }
    }
    if (getActivePageInstance() instanceof GraphicalEditorWithFlyoutPalette) {
      if (((GraphicalEditorWithFlyoutPalette)getActivePageInstance()).getGraphicalViewer().getEditDomain().getPaletteViewer() != null) {
        GraphicalEditorWithFlyoutPalette editor=(GraphicalEditorWithFlyoutPalette)getActivePageInstance();
        GraphicalViewer view=editor.getGraphicalViewer();
        view.getEditDomain().loadDefaultTool();
      }
    }
    return;
  }
  if (part == this) {
    if (getActivePageInstance() instanceof GraphicalEditorWithFlyoutPalette) {
      GraphicalEditorWithFlyoutPalette editor=(GraphicalEditorWithFlyoutPalette)getActivePageInstance();
      GraphicalViewer view=editor.getGraphicalViewer();
      UIUtil.resetViewSelection(view,true);
    }
    if (getEditorInput().exists()) {
      handleActivation();
      SessionHandleAdapter.getInstance().setReportDesignHandle(getModel());
      DataSetManager.initCurrentInstance(getEditorInput());
    }
  }
}

Fixed version (ground truth):
public void partActivated(IWorkbenchPart part){
  if (part != this) {
    if (part instanceof PageBookView) {
      PageBookView view=(PageBookView)part;
      if (view.getCurrentPage() instanceof DesignerOutlinePage) {
        ISelectionProvider provider=(ISelectionProvider)view.getCurrentPage();
        ReportRequest request=new ReportRequest(view.getCurrentPage());
        List list=new ArrayList();
        if (provider.getSelection() instanceof IStructuredSelection) {
          list=((IStructuredSelection)provider.getSelection()).toList();
        }
        request.setSelectionObject(list);
        request.setType(ReportRequest.SELECTION);
        SessionHandleAdapter.getInstance().getMediator().notifyRequest(request);
        SessionHandleAdapter.getInstance().getMediator().pushState();
      }
    }
    if (getActivePageInstance() instanceof GraphicalEditorWithFlyoutPalette) {
      if (((GraphicalEditorWithFlyoutPalette)getActivePageInstance()).getGraphicalViewer().getEditDomain().getPaletteViewer() != null) {
        GraphicalEditorWithFlyoutPalette editor=(GraphicalEditorWithFlyoutPalette)getActivePageInstance();
        GraphicalViewer view=editor.getGraphicalViewer();
        view.getEditDomain().loadDefaultTool();
      }
    }
    return;
  }
  if (part == this) {
    if (getActivePageInstance() instanceof GraphicalEditorWithFlyoutPalette) {
      GraphicalEditorWithFlyoutPalette editor=(GraphicalEditorWithFlyoutPalette)getActivePageInstance();
      GraphicalViewer view=editor.getGraphicalViewer();
      UIUtil.resetViewSelection(view,true);
    }
    if (getEditorInput().exists()) {
      handleActivation();
      SessionHandleAdapter.getInstance().setReportDesignHandle(getModel());
    }
  }
}