Program: 126014
Project: 126014
Buggy source:
@Override public void postWindowOpen(){
  try {
    JavaHomeUtil.initializeJavaHome();
  }
 catch (  CoreException e1) {
    CommonExceptionHandler.process(e1);
  }
  createActions();
  registerActions();
  adviser.getHelper().postWindowOpen();
  IBrandingService service=(IBrandingService)GlobalServiceRegister.getDefault().getService(IBrandingService.class);
  getWindowConfigurer().setTitle(getWindowConfigurer().getTitle() + service.getBrandingConfiguration().getAdditionalTitle());
  if (!PluginChecker.isRefProjectLoaded()) {
    String[] prefsId={"String_Node_Str"};
    ApplicationDeletionUtil.removeAndResetPreferencePages(this.getWindowConfigurer().getWindow(),Arrays.asList(prefsId),true);
  }
 else {
    String[] prefsId={"String_Node_Str"};
    ApplicationDeletionUtil.removeAndResetPreferencePages(this.getWindowConfigurer().getWindow(),Arrays.asList(prefsId),false);
  }
  List<HidePreferencePageProvider> providers=HidePreferencePagesManager.getInstance().getProviders();
  List<String> needRemovedPrefs=new ArrayList<String>();
  for (  HidePreferencePageProvider provider : providers) {
    String prefPageId=provider.getPrefPageId();
    IHidePreferencePageValidator validator=provider.getValidator();
    if (prefPageId != null && (validator == null || validator.validate())) {
      needRemovedPrefs.add(prefPageId);
    }
  }
  ApplicationDeletionUtil.removeAndResetPreferencePages(this.getWindowConfigurer().getWindow(),needRemovedPrefs,false);
  if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQRepositoryService.class)) {
    ITDQRepositoryService tdqRepositoryService=(ITDQRepositoryService)GlobalServiceRegister.getDefault().getService(ITDQRepositoryService.class);
    if (tdqRepositoryService != null) {
      tdqRepositoryService.addPartListener();
      tdqRepositoryService.addSoftwareSystemUpdateListener();
    }
  }
  showStarting();
  regisitPerspectiveListener();
  if (PluginChecker.isBPMloaded()) {
    IPath path=WorkbenchPlugin.getDefault().getDataLocation();
    if (path == null) {
      return;
    }
    final File stateFile=path.append("String_Node_Str").toFile();
    if (stateFile.exists()) {
      IWorkbenchWindow workBenchWindow=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
      IWorkbenchPage activePage=workBenchWindow.getActivePage();
      FileInputStream input;
      try {
        input=new FileInputStream(stateFile);
        BufferedReader reader=new BufferedReader(new InputStreamReader(input,"String_Node_Str"));
        IMemento memento=XMLMemento.createReadRoot(reader);
        IMemento[] hideMenuArray=memento.getChild(IWorkbenchConstants.TAG_WINDOW).getChild(IWorkbenchConstants.TAG_PAGE).getChild(IWorkbenchConstants.TAG_PERSPECTIVES).getChild(IWorkbenchConstants.TAG_PERSPECTIVE).getChildren(IWorkbenchConstants.TAG_HIDE_MENU);
        if (hideMenuArray.length == 0) {
          activePage.resetPerspective();
        }
 else {
          String bonitaMenues="String_Node_Str";
          boolean isBPMFilterWork=false;
          for (int i=0; hideMenuArray != null && i < hideMenuArray.length; i++) {
            IMemento hideMenu=hideMenuArray[i];
            String string=hideMenu.getString(IWorkbenchConstants.TAG_ID);
            if (string != null && string.startsWith(bonitaMenues)) {
              isBPMFilterWork=true;
              break;
            }
          }
          if (!isBPMFilterWork) {
            activePage.resetPerspective();
          }
        }
      }
 catch (      Exception e) {
      }
    }
  }
  final IPreferenceStore store=CoreUIPlugin.getDefault().getPreferenceStore();
  if (!store.getBoolean(ITalendCorePrefConstants.DATA_COLLECTOR)) {
    TokenCollectorFactory.getFactory().send(true);
    store.setValue(ITalendCorePrefConstants.DATA_COLLECTOR,true);
    if (store instanceof ScopedPreferenceStore) {
      try {
        ((ScopedPreferenceStore)store).save();
      }
 catch (      IOException e) {
        ExceptionHandler.process(e);
      }
    }
  }
  IWorkbenchActivitySupport activitySupport=getWindowConfigurer().getWindow().getWorkbench().getActivitySupport();
  String hideUpdateSiteId="String_Node_Str";
  Set<String> enabledActivities=new HashSet<String>();
  enabledActivities.addAll(activitySupport.getActivityManager().getEnabledActivityIds());
  if (!PluginChecker.isSVNProviderPluginLoaded()) {
    if (activitySupport.getActivityManager().getActivity(hideUpdateSiteId).isDefined()) {
      enabledActivities.remove(hideUpdateSiteId);
    }
  }
 else {
    if (activitySupport.getActivityManager().getActivity(hideUpdateSiteId).isDefined()) {
      enabledActivities.add(hideUpdateSiteId);
    }
  }
  activitySupport.setEnabledActivityIds(enabledActivities);
  IWorkbenchWindowConfigurer workbenchWindowConfigurer=getWindowConfigurer();
  IActionBarConfigurer actionBarConfigurer=workbenchWindowConfigurer.getActionBarConfigurer();
  IMenuManager menuManager=actionBarConfigurer.getMenuManager();
  IContributionItem[] menuItems=menuManager.getItems();
  for (  IContributionItem menuItem : menuItems) {
    if ("String_Node_Str".equals(menuItem.getId()) || "String_Node_Str".equals(menuItem.getId())) {
      menuManager.remove(menuItem);
    }
  }
  menuManager.update(true);
  RestoreAllRegisteredPerspectivesProvider perspProvider=new RestoreAllRegisteredPerspectivesProvider();
  IWorkbench workbench=PlatformUI.getWorkbench();
  IEclipseContext activeContext=((IEclipseContext)workbench.getService(IEclipseContext.class)).getActiveLeaf();
  ContextInjectionFactory.inject(perspProvider,activeContext);
  perspProvider.restoreAlwaysVisiblePerspectives();
  IWorkbenchPage activePage=getWindowConfigurer().getWindow().getWorkbench().getActiveWorkbenchWindow().getActivePage();
  if (activePage != null && !(activePage.getActivePart() instanceof org.eclipse.ui.internal.ViewIntroAdapterPart)) {
    if (CheatSheetUtils.getInstance().isFirstTime() && activePage.getPerspective().getId().equals(ProductUtils.PERSPECTIVE_DQ_ID)) {
      CheatSheetUtils.getInstance().findAndmaxDisplayCheatSheet("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
@Override public void postWindowOpen(){
  try {
    JavaHomeUtil.initializeJavaHome();
  }
 catch (  CoreException e1) {
    CommonExceptionHandler.process(e1);
  }
  createActions();
  registerActions();
  adviser.getHelper().postWindowOpen();
  IBrandingService service=(IBrandingService)GlobalServiceRegister.getDefault().getService(IBrandingService.class);
  getWindowConfigurer().setTitle(getWindowConfigurer().getTitle() + service.getBrandingConfiguration().getAdditionalTitle());
  if (!PluginChecker.isRefProjectLoaded()) {
    String[] prefsId={"String_Node_Str"};
    ApplicationDeletionUtil.removeAndResetPreferencePages(this.getWindowConfigurer().getWindow(),Arrays.asList(prefsId),true);
  }
 else {
    String[] prefsId={"String_Node_Str"};
    ApplicationDeletionUtil.removeAndResetPreferencePages(this.getWindowConfigurer().getWindow(),Arrays.asList(prefsId),false);
  }
  List<HidePreferencePageProvider> providers=HidePreferencePagesManager.getInstance().getProviders();
  List<String> needRemovedPrefs=new ArrayList<String>();
  for (  HidePreferencePageProvider provider : providers) {
    String prefPageId=provider.getPrefPageId();
    IHidePreferencePageValidator validator=provider.getValidator();
    if (prefPageId != null && (validator == null || validator.validate())) {
      needRemovedPrefs.add(prefPageId);
    }
  }
  ApplicationDeletionUtil.removeAndResetPreferencePages(this.getWindowConfigurer().getWindow(),needRemovedPrefs,false);
  showStarting();
  regisitPerspectiveListener();
  if (PluginChecker.isBPMloaded()) {
    IPath path=WorkbenchPlugin.getDefault().getDataLocation();
    if (path == null) {
      return;
    }
    final File stateFile=path.append("String_Node_Str").toFile();
    if (stateFile.exists()) {
      IWorkbenchWindow workBenchWindow=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
      IWorkbenchPage activePage=workBenchWindow.getActivePage();
      FileInputStream input;
      try {
        input=new FileInputStream(stateFile);
        BufferedReader reader=new BufferedReader(new InputStreamReader(input,"String_Node_Str"));
        IMemento memento=XMLMemento.createReadRoot(reader);
        IMemento[] hideMenuArray=memento.getChild(IWorkbenchConstants.TAG_WINDOW).getChild(IWorkbenchConstants.TAG_PAGE).getChild(IWorkbenchConstants.TAG_PERSPECTIVES).getChild(IWorkbenchConstants.TAG_PERSPECTIVE).getChildren(IWorkbenchConstants.TAG_HIDE_MENU);
        if (hideMenuArray.length == 0) {
          activePage.resetPerspective();
        }
 else {
          String bonitaMenues="String_Node_Str";
          boolean isBPMFilterWork=false;
          for (int i=0; hideMenuArray != null && i < hideMenuArray.length; i++) {
            IMemento hideMenu=hideMenuArray[i];
            String string=hideMenu.getString(IWorkbenchConstants.TAG_ID);
            if (string != null && string.startsWith(bonitaMenues)) {
              isBPMFilterWork=true;
              break;
            }
          }
          if (!isBPMFilterWork) {
            activePage.resetPerspective();
          }
        }
      }
 catch (      Exception e) {
      }
    }
  }
  final IPreferenceStore store=CoreUIPlugin.getDefault().getPreferenceStore();
  if (!store.getBoolean(ITalendCorePrefConstants.DATA_COLLECTOR)) {
    TokenCollectorFactory.getFactory().send(true);
    store.setValue(ITalendCorePrefConstants.DATA_COLLECTOR,true);
    if (store instanceof ScopedPreferenceStore) {
      try {
        ((ScopedPreferenceStore)store).save();
      }
 catch (      IOException e) {
        ExceptionHandler.process(e);
      }
    }
  }
  IWorkbenchActivitySupport activitySupport=getWindowConfigurer().getWindow().getWorkbench().getActivitySupport();
  String hideUpdateSiteId="String_Node_Str";
  Set<String> enabledActivities=new HashSet<String>();
  enabledActivities.addAll(activitySupport.getActivityManager().getEnabledActivityIds());
  if (!PluginChecker.isSVNProviderPluginLoaded()) {
    if (activitySupport.getActivityManager().getActivity(hideUpdateSiteId).isDefined()) {
      enabledActivities.remove(hideUpdateSiteId);
    }
  }
 else {
    if (activitySupport.getActivityManager().getActivity(hideUpdateSiteId).isDefined()) {
      enabledActivities.add(hideUpdateSiteId);
    }
  }
  activitySupport.setEnabledActivityIds(enabledActivities);
  IWorkbenchWindowConfigurer workbenchWindowConfigurer=getWindowConfigurer();
  IActionBarConfigurer actionBarConfigurer=workbenchWindowConfigurer.getActionBarConfigurer();
  IMenuManager menuManager=actionBarConfigurer.getMenuManager();
  IContributionItem[] menuItems=menuManager.getItems();
  for (  IContributionItem menuItem : menuItems) {
    if ("String_Node_Str".equals(menuItem.getId()) || "String_Node_Str".equals(menuItem.getId())) {
      menuManager.remove(menuItem);
    }
  }
  menuManager.update(true);
  RestoreAllRegisteredPerspectivesProvider perspProvider=new RestoreAllRegisteredPerspectivesProvider();
  IWorkbench workbench=PlatformUI.getWorkbench();
  IEclipseContext activeContext=((IEclipseContext)workbench.getService(IEclipseContext.class)).getActiveLeaf();
  ContextInjectionFactory.inject(perspProvider,activeContext);
  IWorkbenchPage activePage=getWindowConfigurer().getWindow().getWorkbench().getActiveWorkbenchWindow().getActivePage();
  if (activePage != null && !(activePage.getActivePart() instanceof org.eclipse.ui.internal.ViewIntroAdapterPart && activePage.getPerspective().getId().equals(ProductUtils.PERSPECTIVE_DQ_ID))) {
    perspProvider.restoreAlwaysVisiblePerspectives();
  }
  if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQRepositoryService.class)) {
    ITDQRepositoryService tdqRepositoryService=(ITDQRepositoryService)GlobalServiceRegister.getDefault().getService(ITDQRepositoryService.class);
    if (tdqRepositoryService != null) {
      tdqRepositoryService.addPartListener();
      tdqRepositoryService.addSoftwareSystemUpdateListener();
    }
  }
}