Program: 146234
Project: 146234
Buggy source:
protected void createCharacteristicsContent(FormToolkit toolkit,Composite charComposite){
  try {
    desAntionComposite=new DescAnnotationComposite("String_Node_Str","String_Node_Str",toolkit,charComposite,(AMainPageV2)this);
    windowTarget=new DropTarget(this.getPartControl(),DND.DROP_MOVE);
    windowTarget.setTransfer(new Transfer[]{TextTransfer.getInstance()});
    windowTarget.addDropListener(new DCDropTargetListener());
    Composite permissionsGroup=this.getNewSectionComposite("String_Node_Str");
    permissionsGroup.setLayout(new GridLayout(1,true));
    Composite objectTypesComposite=toolkit.createComposite(permissionsGroup,SWT.NULL);
    objectTypesComposite.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
    objectTypesComposite.setLayout(new GridLayout(4,false));
    Label objectTypeLabel=toolkit.createLabel(objectTypesComposite,"String_Node_Str",SWT.NULL);
    objectTypeLabel.setLayoutData(new GridData(SWT.BEGINNING,SWT.CENTER,false,true,1,1));
    objectTypesCombo=new Combo(objectTypesComposite,SWT.READ_ONLY | SWT.DROP_DOWN | SWT.SINGLE);
    objectTypesCombo.setLayoutData(new GridData(SWT.BEGINNING,SWT.NONE,false,false,1,1));
    objectTypesCombo.setVisibleItemCount(20);
    objectTypesCombo.addModifyListener(new ModifyListener(){
      public void modifyText(      ModifyEvent e){
        String objecType=objectTypesCombo.getText();
        Role.Specification specification=role.getSpecifications().get(objecType);
        if (specification == null) {
          specification=role.new Specification();
          role.getSpecifications().put(objecType,specification);
        }
        instancesComposite.setVisible(!specification.isAdmin());
        isAdminButton.setSelection(specification.isAdmin());
        if (!specification.isAdmin()) {
          instanceNameCombo.removeAll();
          try {
            feedInstanceNameCombo();
          }
 catch (          Exception ex) {
            ex.printStackTrace();
          }
          ;
          instanceAccessCombo.select(0);
          instancesViewer.setInput(specification.getInstances());
        }
        paramsContainerComposite.setVisible(false);
        if ("String_Node_Str".equals(objectTypesCombo.getText())) {
          isAdminButton.setEnabled(false);
          instanceAccessCombo.setEnabled(false);
        }
 else {
          isAdminButton.setEnabled(true);
          instanceAccessCombo.setEnabled(true);
        }
      }
    }
);
    isAdminButton=toolkit.createButton(objectTypesComposite,"String_Node_Str",SWT.CHECK);
    isAdminButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,true,1,1));
    isAdminButton.addMouseListener(new MouseListener(){
      public void mouseUp(      MouseEvent e){
        Role.Specification specification=role.getSpecifications().get(objectTypesCombo.getText());
        if (specification == null) {
          specification=role.new Specification();
          role.getSpecifications().put(objectTypesCombo.getText(),specification);
        }
        instancesComposite.setVisible(!isAdminButton.getSelection());
        specification.setAdmin(isAdminButton.getSelection());
        if (!isAdminButton.getSelection()) {
          instancesViewer.setInput(specification.getInstances());
          instancesViewer.setSelection(null);
        }
        paramsContainerComposite.setVisible(false);
        markDirty();
      }
      public void mouseDoubleClick(      MouseEvent e){
      }
      public void mouseDown(      MouseEvent e){
      }
    }
);
    instancesComposite=toolkit.createComposite(permissionsGroup,SWT.BORDER);
    instancesComposite.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
    instancesComposite.setLayout(new GridLayout(3,false));
    Label instancesLabel=toolkit.createLabel(instancesComposite,"String_Node_Str",SWT.NULL);
    instancesLabel.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,3,1));
    instanceNameCombo=new Combo(instancesComposite,SWT.DROP_DOWN | SWT.SINGLE);
    instanceNameCombo.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
    instanceAccessCombo=new Combo(instancesComposite,SWT.READ_ONLY | SWT.DROP_DOWN | SWT.SINGLE);
    instanceAccessCombo.setLayoutData(new GridData(SWT.BEGINNING,SWT.NONE,false,false,1,1));
    instanceAccessCombo.add("String_Node_Str");
    instanceAccessCombo.add("String_Node_Str");
    instanceAccessCombo.addModifyListener(new ModifyListener(){
      public void modifyText(      ModifyEvent e){
      }
    }
);
    instanceAccessCombo.select(0);
    Button addInstanceButton=toolkit.createButton(instancesComposite,"String_Node_Str",SWT.PUSH | SWT.TRAIL);
    addInstanceButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,true,1,1));
    addInstanceButton.addSelectionListener(new SelectionListener(){
      public void widgetDefaultSelected(      org.eclipse.swt.events.SelectionEvent e){
      }
      public void widgetSelected(      org.eclipse.swt.events.SelectionEvent e){
        Role.Specification specification=role.getSpecifications().get(objectTypesCombo.getText());
        if (specification == null) {
          specification=role.new Specification();
          role.getSpecifications().put(objectTypesCombo.getText(),specification);
        }
        Role.Specification.Instance instance=specification.new Instance();
        instance.setWritable(instanceAccessCombo.getSelectionIndex() == 1);
        specification.getInstances().put(instanceNameCombo.getText(),instance);
        instancesViewer.refresh();
        paramsContainerComposite.setVisible(false);
        markDirty();
      }
    }
);
    final String INSTANCE_NAME="String_Node_Str";
    final String INSTANCE_ACCESS="String_Node_Str";
    instancesViewer=new TableViewer(instancesComposite,SWT.FULL_SELECTION);
    instancesViewer.getControl().setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,3,1));
    ((GridData)instancesViewer.getControl().getLayoutData()).heightHint=100;
    Table table=instancesViewer.getTable();
    new TableColumn(table,SWT.LEFT).setText(INSTANCE_NAME);
    new TableColumn(table,SWT.CENTER).setText(INSTANCE_ACCESS);
    table.getColumn(0).setWidth(200);
    table.getColumn(1).setWidth(200);
    for (int i=2, n=table.getColumnCount(); i < n; i++) {
      table.getColumn(i).pack();
    }
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    CellEditor[] editors=new CellEditor[4];
    editors[0]=new TextCellEditor(table);
    editors[1]=new TextCellEditor(table);
    instancesViewer.setCellEditors(editors);
    instancesViewer.setContentProvider(new IStructuredContentProvider(){
      public void dispose(){
      }
      public void inputChanged(      Viewer viewer,      Object oldInput,      Object newInput){
      }
      public Object[] getElements(      Object inputElement){
        HashMap<String,Role.Specification.Instance> instances=(HashMap<String,Role.Specification.Instance>)inputElement;
        Set<String> names=instances.keySet();
        ArrayList<InstanceLine> lines=new ArrayList<InstanceLine>();
        for (Iterator iter=names.iterator(); iter.hasNext(); ) {
          String name=(String)iter.next();
          InstanceLine line=new InstanceLine(name,instances.get(name).isWritable());
          lines.add(line);
        }
        return lines.toArray(new InstanceLine[lines.size()]);
      }
    }
);
    instancesViewer.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){
        InstanceLine line=(InstanceLine)element;
switch (columnIndex) {
case 0:
          return line.getInstanceName();
case 1:
        return line.isWritable() ? "String_Node_Str" : "String_Node_Str";
    }
    return "String_Node_Str";
  }
  public Image getColumnImage(  Object element,  int columnIndex){
    return null;
  }
}
);
instancesViewer.setColumnProperties(new String[]{INSTANCE_NAME,INSTANCE_ACCESS});
instancesViewer.setCellModifier(new ICellModifier(){
  public boolean canModify(  Object element,  String property){
    return false;
  }
  public void modify(  Object element,  String property,  Object value){
  }
  public Object getValue(  Object element,  String property){
    InstanceLine line=(InstanceLine)element;
    if (INSTANCE_NAME.equals(property)) {
      return line.getInstanceName();
    }
    if (INSTANCE_ACCESS.equals(property)) {
      return line.isWritable() ? "String_Node_Str" : "String_Node_Str";
    }
    return null;
  }
}
);
instancesViewer.addSelectionChangedListener(new ISelectionChangedListener(){
  public void selectionChanged(  SelectionChangedEvent event){
    InstanceLine line=(InstanceLine)((IStructuredSelection)event.getSelection()).getFirstElement();
    if (line != null) {
      if ("String_Node_Str".equals(objectTypesCombo.getText())) {
        showViewParameters(line.getInstanceName());
      }
      if ("String_Node_Str".equals(objectTypesCombo.getText())) {
        showMenuParameters(line.getInstanceName());
      }
    }
  }
}
);
instancesViewer.getTable().addKeyListener(new KeyListener(){
  public void keyPressed(  KeyEvent e){
  }
  public void keyReleased(  KeyEvent e){
    if ((e.stateMask == 0) && (e.character == SWT.DEL) && (instancesViewer.getSelection() != null)) {
      InstanceLine line=(InstanceLine)((IStructuredSelection)instancesViewer.getSelection()).getFirstElement();
      role.getSpecifications().get(objectTypesCombo.getText()).getInstances().remove(line.getInstanceName());
      instancesViewer.refresh();
      paramsContainerComposite.setVisible(false);
      markDirty();
    }
  }
}
);
instancesViewer.refresh();
paramsContainerComposite=toolkit.createComposite(permissionsGroup,SWT.BORDER);
paramsContainerComposite.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
paramsContainerComposite.setLayout(new GridLayout(1,false));
paramsLabel=toolkit.createLabel(paramsContainerComposite,"String_Node_Str",SWT.NULL);
paramsLabel.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
paramsClientComposite=toolkit.createComposite(paramsContainerComposite,SWT.BORDER);
paramsClientComposite.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
paramsClientComposite.setLayout(new StackLayout());
refreshData();
}
 catch (Exception e) {
e.printStackTrace();
}
}

Fixed version (ground truth):
protected void createCharacteristicsContent(FormToolkit toolkit,Composite charComposite){
  try {
    desAntionComposite=new DescAnnotationComposite("String_Node_Str","String_Node_Str",toolkit,charComposite,(AMainPageV2)this);
    desAntionComposite.setAnnotationDialogTitle("String_Node_Str");
    windowTarget=new DropTarget(this.getPartControl(),DND.DROP_MOVE);
    windowTarget.setTransfer(new Transfer[]{TextTransfer.getInstance()});
    windowTarget.addDropListener(new DCDropTargetListener());
    Composite permissionsGroup=this.getNewSectionComposite("String_Node_Str");
    permissionsGroup.setLayout(new GridLayout(1,true));
    Composite objectTypesComposite=toolkit.createComposite(permissionsGroup,SWT.NULL);
    objectTypesComposite.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
    objectTypesComposite.setLayout(new GridLayout(4,false));
    Label objectTypeLabel=toolkit.createLabel(objectTypesComposite,"String_Node_Str",SWT.NULL);
    objectTypeLabel.setLayoutData(new GridData(SWT.BEGINNING,SWT.CENTER,false,true,1,1));
    objectTypesCombo=new Combo(objectTypesComposite,SWT.READ_ONLY | SWT.DROP_DOWN | SWT.SINGLE);
    objectTypesCombo.setLayoutData(new GridData(SWT.BEGINNING,SWT.NONE,false,false,1,1));
    objectTypesCombo.setVisibleItemCount(20);
    objectTypesCombo.addModifyListener(new ModifyListener(){
      public void modifyText(      ModifyEvent e){
        String objecType=objectTypesCombo.getText();
        Role.Specification specification=role.getSpecifications().get(objecType);
        if (specification == null) {
          specification=role.new Specification();
          role.getSpecifications().put(objecType,specification);
        }
        instancesComposite.setVisible(!specification.isAdmin());
        isAdminButton.setSelection(specification.isAdmin());
        if (!specification.isAdmin()) {
          instanceNameCombo.removeAll();
          try {
            feedInstanceNameCombo();
          }
 catch (          Exception ex) {
            ex.printStackTrace();
          }
          ;
          instanceAccessCombo.select(0);
          instancesViewer.setInput(specification.getInstances());
        }
        paramsContainerComposite.setVisible(false);
        if ("String_Node_Str".equals(objectTypesCombo.getText())) {
          isAdminButton.setEnabled(false);
          instanceAccessCombo.setEnabled(false);
        }
 else {
          isAdminButton.setEnabled(true);
          instanceAccessCombo.setEnabled(true);
        }
      }
    }
);
    isAdminButton=toolkit.createButton(objectTypesComposite,"String_Node_Str",SWT.CHECK);
    isAdminButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,true,1,1));
    isAdminButton.addMouseListener(new MouseListener(){
      public void mouseUp(      MouseEvent e){
        Role.Specification specification=role.getSpecifications().get(objectTypesCombo.getText());
        if (specification == null) {
          specification=role.new Specification();
          role.getSpecifications().put(objectTypesCombo.getText(),specification);
        }
        instancesComposite.setVisible(!isAdminButton.getSelection());
        specification.setAdmin(isAdminButton.getSelection());
        if (!isAdminButton.getSelection()) {
          instancesViewer.setInput(specification.getInstances());
          instancesViewer.setSelection(null);
        }
        paramsContainerComposite.setVisible(false);
        markDirty();
      }
      public void mouseDoubleClick(      MouseEvent e){
      }
      public void mouseDown(      MouseEvent e){
      }
    }
);
    instancesComposite=toolkit.createComposite(permissionsGroup,SWT.BORDER);
    instancesComposite.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
    instancesComposite.setLayout(new GridLayout(3,false));
    Label instancesLabel=toolkit.createLabel(instancesComposite,"String_Node_Str",SWT.NULL);
    instancesLabel.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,3,1));
    instanceNameCombo=new Combo(instancesComposite,SWT.DROP_DOWN | SWT.SINGLE);
    instanceNameCombo.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
    instanceAccessCombo=new Combo(instancesComposite,SWT.READ_ONLY | SWT.DROP_DOWN | SWT.SINGLE);
    instanceAccessCombo.setLayoutData(new GridData(SWT.BEGINNING,SWT.NONE,false,false,1,1));
    instanceAccessCombo.add("String_Node_Str");
    instanceAccessCombo.add("String_Node_Str");
    instanceAccessCombo.addModifyListener(new ModifyListener(){
      public void modifyText(      ModifyEvent e){
      }
    }
);
    instanceAccessCombo.select(0);
    Button addInstanceButton=toolkit.createButton(instancesComposite,"String_Node_Str",SWT.PUSH | SWT.TRAIL);
    addInstanceButton.setLayoutData(new GridData(SWT.FILL,SWT.FILL,false,true,1,1));
    addInstanceButton.addSelectionListener(new SelectionListener(){
      public void widgetDefaultSelected(      org.eclipse.swt.events.SelectionEvent e){
      }
      public void widgetSelected(      org.eclipse.swt.events.SelectionEvent e){
        Role.Specification specification=role.getSpecifications().get(objectTypesCombo.getText());
        if (specification == null) {
          specification=role.new Specification();
          role.getSpecifications().put(objectTypesCombo.getText(),specification);
        }
        Role.Specification.Instance instance=specification.new Instance();
        instance.setWritable(instanceAccessCombo.getSelectionIndex() == 1);
        specification.getInstances().put(instanceNameCombo.getText(),instance);
        instancesViewer.refresh();
        paramsContainerComposite.setVisible(false);
        markDirty();
      }
    }
);
    final String INSTANCE_NAME="String_Node_Str";
    final String INSTANCE_ACCESS="String_Node_Str";
    instancesViewer=new TableViewer(instancesComposite,SWT.FULL_SELECTION);
    instancesViewer.getControl().setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,3,1));
    ((GridData)instancesViewer.getControl().getLayoutData()).heightHint=100;
    Table table=instancesViewer.getTable();
    new TableColumn(table,SWT.LEFT).setText(INSTANCE_NAME);
    new TableColumn(table,SWT.CENTER).setText(INSTANCE_ACCESS);
    table.getColumn(0).setWidth(200);
    table.getColumn(1).setWidth(200);
    for (int i=2, n=table.getColumnCount(); i < n; i++) {
      table.getColumn(i).pack();
    }
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    CellEditor[] editors=new CellEditor[4];
    editors[0]=new TextCellEditor(table);
    editors[1]=new TextCellEditor(table);
    instancesViewer.setCellEditors(editors);
    instancesViewer.setContentProvider(new IStructuredContentProvider(){
      public void dispose(){
      }
      public void inputChanged(      Viewer viewer,      Object oldInput,      Object newInput){
      }
      public Object[] getElements(      Object inputElement){
        HashMap<String,Role.Specification.Instance> instances=(HashMap<String,Role.Specification.Instance>)inputElement;
        Set<String> names=instances.keySet();
        ArrayList<InstanceLine> lines=new ArrayList<InstanceLine>();
        for (Iterator iter=names.iterator(); iter.hasNext(); ) {
          String name=(String)iter.next();
          InstanceLine line=new InstanceLine(name,instances.get(name).isWritable());
          lines.add(line);
        }
        return lines.toArray(new InstanceLine[lines.size()]);
      }
    }
);
    instancesViewer.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){
        InstanceLine line=(InstanceLine)element;
switch (columnIndex) {
case 0:
          return line.getInstanceName();
case 1:
        return line.isWritable() ? "String_Node_Str" : "String_Node_Str";
    }
    return "String_Node_Str";
  }
  public Image getColumnImage(  Object element,  int columnIndex){
    return null;
  }
}
);
instancesViewer.setColumnProperties(new String[]{INSTANCE_NAME,INSTANCE_ACCESS});
instancesViewer.setCellModifier(new ICellModifier(){
  public boolean canModify(  Object element,  String property){
    return false;
  }
  public void modify(  Object element,  String property,  Object value){
  }
  public Object getValue(  Object element,  String property){
    InstanceLine line=(InstanceLine)element;
    if (INSTANCE_NAME.equals(property)) {
      return line.getInstanceName();
    }
    if (INSTANCE_ACCESS.equals(property)) {
      return line.isWritable() ? "String_Node_Str" : "String_Node_Str";
    }
    return null;
  }
}
);
instancesViewer.addSelectionChangedListener(new ISelectionChangedListener(){
  public void selectionChanged(  SelectionChangedEvent event){
    InstanceLine line=(InstanceLine)((IStructuredSelection)event.getSelection()).getFirstElement();
    if (line != null) {
      if ("String_Node_Str".equals(objectTypesCombo.getText())) {
        showViewParameters(line.getInstanceName());
      }
      if ("String_Node_Str".equals(objectTypesCombo.getText())) {
        showMenuParameters(line.getInstanceName());
      }
    }
  }
}
);
instancesViewer.getTable().addKeyListener(new KeyListener(){
  public void keyPressed(  KeyEvent e){
  }
  public void keyReleased(  KeyEvent e){
    if ((e.stateMask == 0) && (e.character == SWT.DEL) && (instancesViewer.getSelection() != null)) {
      InstanceLine line=(InstanceLine)((IStructuredSelection)instancesViewer.getSelection()).getFirstElement();
      role.getSpecifications().get(objectTypesCombo.getText()).getInstances().remove(line.getInstanceName());
      instancesViewer.refresh();
      paramsContainerComposite.setVisible(false);
      markDirty();
    }
  }
}
);
instancesViewer.refresh();
paramsContainerComposite=toolkit.createComposite(permissionsGroup,SWT.BORDER);
paramsContainerComposite.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
paramsContainerComposite.setLayout(new GridLayout(1,false));
paramsLabel=toolkit.createLabel(paramsContainerComposite,"String_Node_Str",SWT.NULL);
paramsLabel.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
paramsClientComposite=toolkit.createComposite(paramsContainerComposite,SWT.BORDER);
paramsClientComposite.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
paramsClientComposite.setLayout(new StackLayout());
refreshData();
}
 catch (Exception e) {
e.printStackTrace();
}
}