Program: 127046
Project: 127046
Buggy source:
private void regisitPerspectiveListener(){
  PlatformUI.getWorkbench().getActiveWorkbenchWindow().addPerspectiveListener(new PerspectiveAdapter(){
    @Override public void perspectiveActivated(    IWorkbenchPage page,    IPerspectiveDescriptor perspective){
      String pId=perspective.getId();
      IRepositoryView view=RepositoryManager.getRepositoryView();
      if (view != null) {
        if (IBrandingConfiguration.PERSPECTIVE_DI_ID.equals(pId) || IBrandingConfiguration.PERSPECTIVE_CAMEL_ID.equals(pId)) {
          view.refresh();
          TalendPaletteHelper.checkAndInitToolBar();
        }
 else         if (IBrandingConfiguration.PERSPECTIVE_DQ_ID.equals(pId)) {
          if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQRepositoryService.class)) {
            ITDQRepositoryService tdqRepositoryService=(ITDQRepositoryService)GlobalServiceRegister.getDefault().getService(ITDQRepositoryService.class);
            if (tdqRepositoryService != null) {
              tdqRepositoryService.refresh();
            }
          }
          IViewReference findViewReference=RepositoryManagerHelper.findRepositoryViewRef();
          if (findViewReference != null) {
            page.hideView(findViewReference);
          }
        }
      }
    }
  }
);
  PlatformUI.getWorkbench().getActiveWorkbenchWindow().addPerspectiveListener(new CheatSheetPerspectiveAdapter(CheatSheetPerspectiveAdapter.DQ_CHEATSHEET_START_ID));
}

Fixed version (ground truth):
private void regisitPerspectiveListener(){
  PlatformUI.getWorkbench().getActiveWorkbenchWindow().addPerspectiveListener(new PerspectiveAdapter(){
    @Override public void perspectiveActivated(    IWorkbenchPage page,    IPerspectiveDescriptor perspective){
      String pId=perspective.getId();
      IRepositoryView view=RepositoryManager.getRepositoryView();
      if (view != null) {
        if (IBrandingConfiguration.PERSPECTIVE_DI_ID.equals(pId) || IBrandingConfiguration.PERSPECTIVE_CAMEL_ID.equals(pId)) {
          view.refresh();
          TalendPaletteHelper.checkAndInitToolBar();
        }
 else         if (IBrandingConfiguration.PERSPECTIVE_DQ_ID.equals(pId)) {
          if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQRepositoryService.class)) {
            ITDQRepositoryService tdqRepositoryService=(ITDQRepositoryService)GlobalServiceRegister.getDefault().getService(ITDQRepositoryService.class);
            if (tdqRepositoryService != null) {
              tdqRepositoryService.refresh();
            }
          }
          IViewReference findViewReference=RepositoryManagerHelper.findRepositoryViewRef();
          if (findViewReference != null) {
            page.hideView(findViewReference);
          }
        }
      }
    }
    @Override public void perspectiveDeactivated(    IWorkbenchPage page,    IPerspectiveDescriptor perspective){
      String pId=perspective.getId();
      if (IBrandingConfiguration.PERSPECTIVE_DI_ID.equals(pId)) {
        IComponentSettingsView viewer=(IComponentSettingsView)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(IComponentSettingsView.ID);
        if (viewer != null) {
          viewer.cleanDisplay();
        }
      }
    }
  }
);
  PlatformUI.getWorkbench().getActiveWorkbenchWindow().addPerspectiveListener(new CheatSheetPerspectiveAdapter(CheatSheetPerspectiveAdapter.DQ_CHEATSHEET_START_ID));
}