Program: 168163
Project: 168163
Buggy source:
@Override protected void createMasterPart(final IManagedForm managedForm,Composite parent){
  FormToolkit toolkit=managedForm.getToolkit();
  Section section=toolkit.createSection(parent,Section.DESCRIPTION | Section.TITLE_BAR);
  section.setText("String_Node_Str");
  Composite client=toolkit.createComposite(section,SWT.WRAP);
  GridLayout layout=new GridLayout();
  layout.numColumns=2;
  layout.marginWidth=2;
  layout.marginHeight=2;
  client.setLayout(layout);
  toolkit.paintBordersFor(client);
  final TreeViewer corpuses=new TreeViewer(client,SWT.BORDER);
  GridData gd=new GridData(GridData.FILL_BOTH);
  gd.heightHint=400;
  gd.widthHint=100;
  corpuses.getTree().setLayoutData(gd);
  Composite buttonComposite=new Composite(client,SWT.NONE);
  GridLayout buttonLayout=new GridLayout();
  buttonLayout.marginWidth=buttonLayout.marginHeight=0;
  buttonLayout.makeColumnsEqualWidth=true;
  buttonComposite.setLayout(buttonLayout);
  buttonComposite.setLayoutData(new GridData(GridData.FILL_VERTICAL));
  Button addCorpora=toolkit.createButton(buttonComposite,"String_Node_Str",SWT.PUSH);
  GridDataFactory.fillDefaults().grab(false,false).span(1,1).applyTo(addCorpora);
  final Button addClass=toolkit.createButton(buttonComposite,"String_Node_Str",SWT.PUSH);
  GridDataFactory.fillDefaults().grab(false,false).span(1,1).applyTo(addClass);
  Button remove=toolkit.createButton(buttonComposite,"String_Node_Str",SWT.PUSH);
  GridDataFactory.fillDefaults().grab(false,false).span(1,1).applyTo(remove);
  section.setClient(client);
  final SectionPart spart=new SectionPart(section);
  managedForm.addPart(spart);
  corpuses.addSelectionChangedListener(new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent event){
      managedForm.fireSelectionChanged(spart,event.getSelection());
      try {
        IStructuredSelection selection=(IStructuredSelection)event.getSelection();
        Object selectedObj=selection.getFirstElement();
        if (selectedObj instanceof ICorpus) {
          addClass.setEnabled(true);
        }
 else         if (selectedObj instanceof ICorpusClass) {
          addClass.setEnabled(false);
        }
      }
 catch (      Exception exp) {
      }
    }
  }
);
  corpuses.setContentProvider(new MasterContentProvider());
  corpuses.setLabelProvider(new MasterLabelProvider());
  corpuses.setInput(corpusList);
  addCorpora.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      StringBuilder corpusTempName=new StringBuilder("String_Node_Str");
      corpusTempName.append(corpusList.size() + 1);
      Corpus c=new Corpus(new String(corpusTempName),DataType.PLAIN_TEXT,corpuses);
      c.addClass(new CorpusClass("String_Node_Str","String_Node_Str",corpuses));
      ;
      corpusList.add(c);
      Object[] expandedItems=corpuses.getExpandedElements();
      corpuses.setInput(corpusList);
      corpuses.setExpandedElements(expandNewCorpus(expandedItems,c));
      corpuses.setSelection(new StructuredSelection(c),true);
    }
  }
);
  addClass.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      IStructuredSelection selection=(IStructuredSelection)corpuses.getSelection();
      try {
        ICorpus corpusSelected=(ICorpus)selection.getFirstElement();
        int corpusIndex=corpusList.indexOf(corpusSelected);
        StringBuilder classTempName=new StringBuilder("String_Node_Str");
        classTempName.append(corpusList.get(corpusIndex).getClasses().size() + 1);
        CorpusClass newClass=new CorpusClass(new String(classTempName),"String_Node_Str",corpuses);
        ((Corpus)corpusSelected).addClass(newClass);
        corpusList.set(corpusIndex,corpusSelected);
        corpuses.refresh();
        corpuses.setExpandedElements(expandNewCorpus(corpuses.getExpandedElements(),(Corpus)corpusList.get(corpusIndex)));
        corpuses.setSelection(new StructuredSelection(newClass),true);
      }
 catch (      Exception exp) {
      }
    }
  }
);
  remove.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      IStructuredSelection selection=(IStructuredSelection)corpuses.getSelection();
      try {
        Object selectedObj=selection.getFirstElement();
        if (selectedObj instanceof ICorpus) {
          ICorpus selectedCorpus=(ICorpus)selection.getFirstElement();
          corpusList.remove(selectedCorpus);
        }
 else         if (selectedObj instanceof ICorpusClass) {
          ITreeSelection classSelection=(ITreeSelection)selection;
          ICorpusClass selectedClass=(ICorpusClass)selection.getFirstElement();
          Corpus parentCorpus=(Corpus)classSelection.getPaths()[0].getParentPath().getLastSegment();
          parentCorpus.removeClass(selectedClass);
        }
        corpuses.refresh();
      }
 catch (      Exception exp) {
      }
    }
  }
);
}

Fixed version (ground truth):
@Override protected void createMasterPart(final IManagedForm managedForm,Composite parent){
  FormToolkit toolkit=managedForm.getToolkit();
  Section section=toolkit.createSection(parent,Section.DESCRIPTION | Section.TITLE_BAR);
  section.setText("String_Node_Str");
  Composite client=toolkit.createComposite(section,SWT.WRAP);
  GridLayout layout=new GridLayout();
  layout.numColumns=2;
  layout.marginWidth=2;
  layout.marginHeight=2;
  client.setLayout(layout);
  toolkit.paintBordersFor(client);
  final TreeViewer corpuses=new TreeViewer(client,SWT.BORDER);
  GridData gd=new GridData(GridData.FILL_BOTH);
  gd.heightHint=400;
  gd.widthHint=100;
  corpuses.getTree().setLayoutData(gd);
  Composite buttonComposite=new Composite(client,SWT.NONE);
  GridLayout buttonLayout=new GridLayout();
  buttonLayout.marginWidth=buttonLayout.marginHeight=0;
  buttonLayout.makeColumnsEqualWidth=true;
  buttonComposite.setLayout(buttonLayout);
  buttonComposite.setLayoutData(new GridData(GridData.FILL_VERTICAL));
  Button addCorpora=toolkit.createButton(buttonComposite,"String_Node_Str",SWT.PUSH);
  GridDataFactory.fillDefaults().grab(false,false).span(1,1).applyTo(addCorpora);
  final Button addClass=toolkit.createButton(buttonComposite,"String_Node_Str",SWT.PUSH);
  GridDataFactory.fillDefaults().grab(false,false).span(1,1).applyTo(addClass);
  Button remove=toolkit.createButton(buttonComposite,"String_Node_Str",SWT.PUSH);
  GridDataFactory.fillDefaults().grab(false,false).span(1,1).applyTo(remove);
  section.setClient(client);
  final SectionPart spart=new SectionPart(section);
  managedForm.addPart(spart);
  corpuses.addSelectionChangedListener(new ISelectionChangedListener(){
    @Override public void selectionChanged(    SelectionChangedEvent event){
      managedForm.fireSelectionChanged(spart,event.getSelection());
      try {
        IStructuredSelection selection=(IStructuredSelection)event.getSelection();
        Object selectedObj=selection.getFirstElement();
        if (selectedObj instanceof ICorpus) {
          addClass.setEnabled(true);
        }
 else         if (selectedObj instanceof ICorpusClass) {
          addClass.setEnabled(false);
        }
      }
 catch (      Exception exp) {
      }
    }
  }
);
  corpuses.setContentProvider(new MasterContentProvider());
  corpuses.setLabelProvider(new MasterLabelProvider());
  for (  ICorpus corpus : corpusList)   corpus.setViewer(corpuses);
  corpuses.setInput(corpusList);
  addCorpora.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      StringBuilder corpusTempName=new StringBuilder("String_Node_Str");
      corpusTempName.append(corpusList.size() + 1);
      Corpus c=new Corpus(new String(corpusTempName),DataType.PLAIN_TEXT,corpuses);
      c.addClass(new CorpusClass("String_Node_Str","String_Node_Str",corpuses));
      ;
      corpusList.add(c);
      Object[] expandedItems=corpuses.getExpandedElements();
      corpuses.setInput(corpusList);
      corpuses.setExpandedElements(expandNewCorpus(expandedItems,c));
      corpuses.setSelection(new StructuredSelection(c),true);
    }
  }
);
  addClass.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      IStructuredSelection selection=(IStructuredSelection)corpuses.getSelection();
      try {
        ICorpus corpusSelected=(ICorpus)selection.getFirstElement();
        int corpusIndex=corpusList.indexOf(corpusSelected);
        StringBuilder classTempName=new StringBuilder("String_Node_Str");
        classTempName.append(corpusList.get(corpusIndex).getClasses().size() + 1);
        CorpusClass newClass=new CorpusClass(new String(classTempName),"String_Node_Str",corpuses);
        ((Corpus)corpusSelected).addClass(newClass);
        corpusList.set(corpusIndex,corpusSelected);
        corpuses.refresh();
        corpuses.setExpandedElements(expandNewCorpus(corpuses.getExpandedElements(),(Corpus)corpusList.get(corpusIndex)));
        corpuses.setSelection(new StructuredSelection(newClass),true);
      }
 catch (      Exception exp) {
      }
    }
  }
);
  remove.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      IStructuredSelection selection=(IStructuredSelection)corpuses.getSelection();
      try {
        Object selectedObj=selection.getFirstElement();
        if (selectedObj instanceof ICorpus) {
          ICorpus selectedCorpus=(ICorpus)selection.getFirstElement();
          corpusList.remove(selectedCorpus);
        }
 else         if (selectedObj instanceof ICorpusClass) {
          ITreeSelection classSelection=(ITreeSelection)selection;
          ICorpusClass selectedClass=(ICorpusClass)selection.getFirstElement();
          Corpus parentCorpus=(Corpus)classSelection.getPaths()[0].getParentPath().getLastSegment();
          parentCorpus.removeClass(selectedClass);
        }
        corpuses.refresh();
      }
 catch (      Exception exp) {
      }
    }
  }
);
}