Program: 147621
Project: 147621
Buggy source:
public void createControl(Composite parent){
  Composite composite=new Composite(parent,SWT.BORDER);
  composite.setLayout(new GridLayout(1,false));
  browseViewer=new TableViewer(composite,SWT.FULL_SELECTION | SWT.MULTI | SWT.H_SCROLL);
  GridData gd=new GridData(SWT.FILL,SWT.FILL,true,true,1,1);
  gd.widthHint=600;
  browseViewer.getControl().setLayoutData(gd);
  ((GridData)browseViewer.getControl().getLayoutData()).heightHint=100;
  Table table=browseViewer.getTable();
  TableColumn column=new TableColumn(table,SWT.CENTER);
  column.setText(INSTANCE_NAME);
  column.setWidth(615);
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  CellEditor[] editors=new CellEditor[1];
  editors[0]=new TextCellEditor(table);
  browseViewer.setCellEditors(editors);
  browseViewer.setContentProvider(new IStructuredContentProvider(){
    public void dispose(){
    }
    public void inputChanged(    Viewer viewer,    Object oldInput,    Object newInput){
    }
    public Object[] getElements(    Object inputElement){
      ArrayList<XSDElementDeclaration> values=(ArrayList<XSDElementDeclaration>)inputElement;
      return values.toArray(new XSDElementDeclaration[values.size()]);
    }
  }
);
  browseViewer.setLabelProvider(new ITableLabelProvider(){
    public boolean isLabelProperty(    Object element,    String property){
      return false;
    }
    public void dispose(){
    }
    public void addListener(    ILabelProviderListener listener){
    }
    public void removeListener(    ILabelProviderListener listener){
    }
    public String getColumnText(    Object element,    int columnIndex){
      return BROWSE_ITEMS + ((XSDElementDeclaration)element).getName();
    }
    public Image getColumnImage(    Object element,    int columnIndex){
      return null;
    }
  }
);
  browseViewer.setCellModifier(new ICellModifier(){
    public boolean canModify(    Object element,    String property){
      return true;
    }
    public void modify(    Object element,    String property,    Object value){
      TableItem item=(TableItem)element;
      String tValue=value.toString().trim();
      if (Pattern.compile("String_Node_Str").matcher(value.toString()).matches() || tValue.replaceAll("String_Node_Str","String_Node_Str").length() != tValue.length()) {
        MessageDialog.openInformation(null,Messages.Warning,Messages.NotContainEmpty);
        return;
      }
      if (!value.toString().startsWith(BROWSE_ITEMS)) {
        MessageDialog.openInformation(null,Messages.Warning,Messages.bind(Messages.NameStartWith,BROWSE_ITEMS));
        return;
      }
      XSDElementDeclaration elem=(XSDElementDeclaration)item.getData();
      String declName=elem.getName();
      if (!(BROWSE_ITEMS + declName).equals(tValue)) {
        for (        XSDElementDeclaration theElem : declList) {
          if (theElem == elem) {
            continue;
          }
          if ((BROWSE_ITEMS + theElem.getName()).equals(tValue)) {
            MessageDialog.openInformation(null,Messages.Warning,Messages.BrowseNameExists);
            return;
          }
        }
        List<Line> lines=browseItemToRoles.get(BROWSE_ITEMS + declName);
        browseItemToRoles.remove(BROWSE_ITEMS + declName);
        int prex=tValue.indexOf(BROWSE_ITEMS);
        if (prex != -1 && (prex + BROWSE_ITEMS.length()) <= tValue.length()) {
          elem.setName(tValue.substring(prex + BROWSE_ITEMS.length()));
        }
        browseItemToRoles.put(tValue,lines);
        refreshRoleView(BROWSE_ITEMS + elem.getName());
        browseViewer.update(elem,null);
        elem.setName(declName);
      }
    }
    public Object getValue(    Object element,    String property){
      XSDElementDeclaration elem=(XSDElementDeclaration)element;
      return BROWSE_ITEMS + elem.getName();
    }
  }
);
  browseViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      applyChangeToRoles();
      IStructuredSelection selection=(IStructuredSelection)event.getSelection();
      if (selection.size() > 1) {
        List selectObjs=selection.toList();
        refreshRoleView(selectObjs);
        UpdateComplexViewButton(true);
      }
 else       if (selection.size() == 1) {
        XSDElementDeclaration decl=(XSDElementDeclaration)selection.getFirstElement();
        refreshRoleView(BROWSE_ITEMS + decl.getName());
        UpdateComplexViewButton(true);
      }
    }
    private void UpdateComplexViewButton(    final boolean b){
      if (exAdapter != null) {
        exAdapter.UpdateComplexViewButton(b);
      }
    }
  }
);
  browseViewer.setInput(declList);
  browseViewer.setColumnProperties(new String[]{INSTANCE_NAME});
  browseViewer.refresh();
  if (exAdapter != null) {
    exAdapter.createRoleControl(composite);
  }
  setControl(composite);
}

Fixed version (ground truth):
public void createControl(Composite parent){
  Composite composite=new Composite(parent,SWT.BORDER);
  composite.setLayout(new GridLayout(1,false));
  browseViewer=new TableViewer(composite,SWT.FULL_SELECTION | SWT.MULTI | SWT.H_SCROLL);
  GridData gd=new GridData(SWT.FILL,SWT.FILL,true,true,1,1);
  gd.widthHint=600;
  browseViewer.getControl().setLayoutData(gd);
  ((GridData)browseViewer.getControl().getLayoutData()).heightHint=100;
  Table table=browseViewer.getTable();
  TableColumn column=new TableColumn(table,SWT.CENTER);
  column.setText(INSTANCE_NAME);
  column.setWidth(615);
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  CellEditor[] editors=new CellEditor[1];
  editors[0]=new TextCellEditor(table);
  browseViewer.setCellEditors(editors);
  browseViewer.setContentProvider(new IStructuredContentProvider(){
    public void dispose(){
    }
    public void inputChanged(    Viewer viewer,    Object oldInput,    Object newInput){
    }
    public Object[] getElements(    Object inputElement){
      ArrayList<XSDElementDeclaration> values=(ArrayList<XSDElementDeclaration>)inputElement;
      return values.toArray(new XSDElementDeclaration[values.size()]);
    }
  }
);
  browseViewer.setLabelProvider(new ITableLabelProvider(){
    public boolean isLabelProperty(    Object element,    String property){
      return false;
    }
    public void dispose(){
    }
    public void addListener(    ILabelProviderListener listener){
    }
    public void removeListener(    ILabelProviderListener listener){
    }
    public String getColumnText(    Object element,    int columnIndex){
      return BROWSE_ITEMS + ((XSDElementDeclaration)element).getName();
    }
    public Image getColumnImage(    Object element,    int columnIndex){
      return null;
    }
  }
);
  browseViewer.setCellModifier(new ICellModifier(){
    public boolean canModify(    Object element,    String property){
      return true;
    }
    public void modify(    Object element,    String property,    Object value){
      TableItem item=(TableItem)element;
      String tValue=value.toString().trim();
      if (Pattern.compile("String_Node_Str").matcher(value.toString()).matches() || tValue.replaceAll("String_Node_Str","String_Node_Str").length() != tValue.length()) {
        MessageDialog.openInformation(null,Messages.Warning,Messages.NotContainEmpty);
        return;
      }
      if (!value.toString().startsWith(BROWSE_ITEMS)) {
        MessageDialog.openInformation(null,Messages.Warning,Messages.bind(Messages.NameStartWith,BROWSE_ITEMS));
        return;
      }
      XSDElementDeclaration elem=(XSDElementDeclaration)item.getData();
      String declName=elem.getName();
      if (!(BROWSE_ITEMS + declName).equals(tValue)) {
        for (        XSDElementDeclaration theElem : declList) {
          if (theElem == elem) {
            continue;
          }
          if ((BROWSE_ITEMS + theElem.getName()).equals(tValue)) {
            MessageDialog.openInformation(null,Messages.Warning,Messages.BrowseNameExists);
            return;
          }
        }
        String key=BROWSE_ITEMS + declName;
        for (        String k : browseItemToRoles.keySet()) {
          if (k.startsWith(key)) {
            key=k;
            break;
          }
        }
        List<Line> lines=browseItemToRoles.get(key);
        browseItemToRoles.remove(key);
        int prex=tValue.indexOf(BROWSE_ITEMS);
        if (prex != -1 && (prex + BROWSE_ITEMS.length()) <= tValue.length()) {
          elem.setName(tValue.substring(prex + BROWSE_ITEMS.length()));
        }
        browseItemToRoles.put(tValue,lines);
        refreshRoleView(BROWSE_ITEMS + elem.getName());
        browseViewer.update(elem,null);
        elem.setName(declName);
      }
    }
    public Object getValue(    Object element,    String property){
      XSDElementDeclaration elem=(XSDElementDeclaration)element;
      return BROWSE_ITEMS + elem.getName();
    }
  }
);
  browseViewer.addSelectionChangedListener(new ISelectionChangedListener(){
    public void selectionChanged(    SelectionChangedEvent event){
      applyChangeToRoles();
      IStructuredSelection selection=(IStructuredSelection)event.getSelection();
      if (selection.size() > 1) {
        List selectObjs=selection.toList();
        refreshRoleView(selectObjs);
        UpdateComplexViewButton(true);
      }
 else       if (selection.size() == 1) {
        XSDElementDeclaration decl=(XSDElementDeclaration)selection.getFirstElement();
        refreshRoleView(BROWSE_ITEMS + decl.getName());
        UpdateComplexViewButton(true);
      }
    }
    private void UpdateComplexViewButton(    final boolean b){
      if (exAdapter != null) {
        exAdapter.UpdateComplexViewButton(b);
      }
    }
  }
);
  browseViewer.setInput(declList);
  browseViewer.setColumnProperties(new String[]{INSTANCE_NAME});
  browseViewer.refresh();
  if (exAdapter != null) {
    exAdapter.createRoleControl(composite);
  }
  setControl(composite);
}