Program: 133551
Project: 133551
Buggy source:
/** 
 * Creates the UI for the PlotEditor and calls the visualization service to draw the opened plot.
 * @param barManager Manager for the editor's toolbar
 * @param body The composite in which the editor will be drawn
 * @param selectedService A PlotEditorInput containing the IPlot created with the selected visualization service
 * @param thisEditor A reference to the editor being created.
 * @param seriesToPlot The list of the valid series for this editor to be able to plot. should have already checked the validity (at least one element) in this list.
 * @param selectedPlotType The type of the initial plot to draw
 */
private void createUI(ToolBarManager barManager,final Composite body,final PlotEditorInput selectedService,final IEditorPart thisEditor,final List<ISeries> seriesToPlot,final ISeries independentSeries,final String[] categories){
  body.setLayout(new GridLayout());
  body.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
  ToolBar bar=barManager.createControl(body);
  final Composite plotComposite=new Composite(body,SWT.NONE);
  MenuManager menu=new MenuManager("String_Node_Str");
  ActionTree menuTree=new ActionTree("String_Node_Str");
  Map<String,ActionTree> categoryTrees=null;
  ActionTree seriesTree=new ActionTree("String_Node_Str");
  if (categories.length > 1) {
    categoryTrees=new TreeMap<String,ActionTree>();
    for (int i=0; i < categories.length; i++) {
      String category=categories[i];
      ActionTree catTree=new ActionTree(category);
      menuTree.add(catTree);
      categoryTrees.put(category,catTree);
    }
  }
 else {
    menuTree.add(seriesTree);
  }
  for (  final ISeries series : seriesToPlot) {
    Action tempAction=new Action(series.getLabel()){
      @Override public void run(){
        try {
          series.setEnabled(true);
          if (series instanceof ConnectionSeries) {
            selectedService.getPlot().setIndependentSeries(series);
          }
          selectedService.getPlot().draw(plotComposite);
          body.layout();
        }
 catch (        Exception e) {
          logger.error(getClass().getName() + "String_Node_Str",e);
        }
      }
    }
;
    if (categoryTrees == null) {
      seriesTree.add(new ActionTree(tempAction));
    }
 else {
      categoryTrees.get(series.getCategory()).add(new ActionTree(tempAction));
    }
  }
  Action close=new Action("String_Node_Str"){
    @Override public void run(){
      thisEditor.getEditorSite().getPage().closeEditor(thisEditor,false);
    }
  }
;
  menuTree.add(new ActionTree(close));
  if (categoryTrees == null) {
    seriesTree.getContributionItem().fill(menu.getMenu(),-1);
  }
 else {
    for (    String category : categoryTrees.keySet()) {
      categoryTrees.get(category).getContributionItem().fill(menu.getMenu(),-1);
    }
  }
  menu.updateAll(true);
  barManager.add(menuTree.getContributionItem());
  bar.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,false));
  barManager.update(true);
  plotComposite.setBackground(body.getBackground());
  plotComposite.setLayout(new FillLayout());
  GridDataFactory.fillDefaults().grab(true,true).applyTo(plotComposite);
  try {
    if (independentSeries instanceof ConnectionSeries) {
      selectedService.getPlot().setIndependentSeries(independentSeries);
    }
    selectedService.getPlot().draw(plotComposite);
    body.layout();
  }
 catch (  Exception e) {
    logger.error(getClass().getName() + "String_Node_Str",e);
    e.printStackTrace();
  }
  body.layout();
}

Fixed version (ground truth):
/** 
 * Creates the UI for the PlotEditor and calls the visualization service to draw the opened plot.
 * @param barManager Manager for the editor's toolbar
 * @param body The composite in which the editor will be drawn
 * @param selectedService A PlotEditorInput containing the IPlot created with the selected visualization service
 * @param thisEditor A reference to the editor being created.
 * @param seriesToPlot The list of the valid series for this editor to be able to plot. should have already checked the validity (at least one element) in this list.
 * @param selectedPlotType The type of the initial plot to draw
 */
private void createUI(ToolBarManager barManager,final Composite body,final PlotEditorInput selectedService,final IEditorPart thisEditor,final List<ISeries> seriesToPlot,final ISeries independentSeries,final String[] categories){
  body.setLayout(new GridLayout());
  body.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
  ToolBar bar=barManager.createControl(body);
  final Composite plotComposite=new Composite(body,SWT.NONE);
  MenuManager menu=new MenuManager("String_Node_Str");
  ActionTree menuTree=new ActionTree("String_Node_Str");
  Map<String,ActionTree> categoryTrees=null;
  ActionTree seriesTree=new ActionTree("String_Node_Str");
  if (categories.length > 1) {
    categoryTrees=new TreeMap<String,ActionTree>();
    for (int i=0; i < categories.length; i++) {
      String category=categories[i];
      ActionTree catTree=new ActionTree(category);
      menuTree.add(catTree);
      categoryTrees.put(category,catTree);
    }
  }
 else {
    menuTree.add(seriesTree);
  }
  for (  final ISeries series : seriesToPlot) {
    Action tempAction=new Action(series.getLabel()){
      @Override public void run(){
        try {
          series.setEnabled(true);
          if (series instanceof ConnectionSeries) {
            selectedService.getPlot().setIndependentSeries(series);
          }
          series.setEnabled(true);
          selectedService.getPlot().draw(plotComposite);
          body.layout();
        }
 catch (        Exception e) {
          logger.error(getClass().getName() + "String_Node_Str",e);
        }
      }
    }
;
    if (categoryTrees == null) {
      seriesTree.add(new ActionTree(tempAction));
    }
 else {
      categoryTrees.get(series.getCategory()).add(new ActionTree(tempAction));
    }
  }
  Action close=new Action("String_Node_Str"){
    @Override public void run(){
      thisEditor.getEditorSite().getPage().closeEditor(thisEditor,false);
    }
  }
;
  menuTree.add(new ActionTree(close));
  if (categoryTrees == null) {
    seriesTree.getContributionItem().fill(menu.getMenu(),-1);
  }
 else {
    for (    String category : categoryTrees.keySet()) {
      categoryTrees.get(category).getContributionItem().fill(menu.getMenu(),-1);
    }
  }
  menu.updateAll(true);
  barManager.add(menuTree.getContributionItem());
  bar.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,false));
  barManager.update(true);
  plotComposite.setBackground(body.getBackground());
  plotComposite.setLayout(new FillLayout());
  GridDataFactory.fillDefaults().grab(true,true).applyTo(plotComposite);
  try {
    if (independentSeries instanceof ConnectionSeries) {
      selectedService.getPlot().setIndependentSeries(independentSeries);
    }
    selectedService.getPlot().draw(plotComposite);
    body.layout();
  }
 catch (  Exception e) {
    logger.error(getClass().getName() + "String_Node_Str",e);
    e.printStackTrace();
  }
  body.layout();
}