nus-yam/ex-repair huggingface dataset:
Program: 120383
Project: 120383
Buggy source:
/** 
 * DOC hwang JobletContainerFigure constructor comment.
 * @param model
 */
public JobletContainerFigure(final JobletContainer jobletContainer){
  setLayoutManager(new FreeformLayout());
  this.jobletContainer=jobletContainer;
  isSubjobDisplay=this.jobletContainer.getSubjobContainer().isDisplayed();
  outlineFigure=new RoundedRectangle();
  rectFig=new GreenRectangle();
  titleFigure=new SimpleHtmlFigure();
  titleFigure.setOpaque(true);
  collapseFigure=new JobletCollapseFigure();
  collapseFigure.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent event){
      doCollapse();
    }
  }
);
  errorFigure=new ImageFigure();
  errorFigure.setImage(ImageProvider.getImage(EImage.ERROR_SMALL));
  errorFigure.setVisible(false);
  errorFigure.setSize(errorFigure.getPreferredSize());
  this.add(errorFigure);
  warningFigure=new ImageFigure();
  warningFigure.setImage(ImageProvider.getImage(EImage.WARNING_SMALL));
  warningFigure.setVisible(false);
  warningFigure.setSize(warningFigure.getPreferredSize());
  this.add(warningFigure);
  initMRFigures();
  htmlStatusHint=new SimpleHtmlFigure();
  initJobletContainerColor();
  updateData();
  initializejobletContainer(jobletContainer.getJobletContainerRectangle());
  if (jobletContainer.getNode().isMapReduceStart()) {
    refreshNodes(false);
  }
}

Fixed version (ground truth):
/** 
 * DOC hwang JobletContainerFigure constructor comment.
 * @param model
 */
public JobletContainerFigure(final JobletContainer jobletContainer){
  setLayoutManager(new FreeformLayout());
  this.jobletContainer=jobletContainer;
  isSubjobDisplay=this.jobletContainer.getSubjobContainer().isDisplayed();
  outlineFigure=new RoundedRectangle();
  rectFig=new GreenRectangle();
  rectFig.setAlpha(ALPHA_VALUE);
  titleFigure=new SimpleHtmlFigure();
  collapseFigure=new JobletCollapseFigure();
  collapseFigure.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent event){
      doCollapse();
    }
  }
);
  warningFigure=new ImageFigure();
  warningFigure.setImage(ImageProvider.getImage(EImage.WARNING_SMALL));
  warningFigure.setVisible(false);
  warningFigure.setSize(warningFigure.getPreferredSize());
  this.add(warningFigure);
  errorFigure=new ImageFigure();
  errorFigure.setImage(ImageProvider.getImage(EImage.ERROR_SMALL));
  errorFigure.setVisible(false);
  errorFigure.setSize(errorFigure.getPreferredSize());
  this.add(errorFigure);
  initMRFigures();
  htmlStatusHint=new SimpleHtmlFigure();
  initJobletContainerColor();
  updateData();
  initializejobletContainer(jobletContainer.getJobletContainerRectangle());
  if (jobletContainer.getNode().isMapReduceStart()) {
    refreshNodes(false);
  }
}
Program: 120385
Project: 120385
Buggy source:
protected List getModelChildren(){
  return ((JobletContainer)this.getModel()).getElements();
}

Fixed version (ground truth):
@Override protected List getModelChildren(){
  return ((JobletContainer)this.getModel()).getElements();
}
Program: 120386
Project: 120386
Buggy source:
public NodePart getNodePart(){
  Object o=this.getChildren().get(0);
  if (o instanceof NodePart) {
    return (NodePart)o;
  }
  return null;
}

Fixed version (ground truth):
@Override public NodePart getNodePart(){
  Object o=this.getChildren().get(0);
  if (o instanceof NodePart) {
    return (NodePart)o;
  }
  return null;
}
Program: 120387
Project: 120387
Buggy source:
public void activate(){
  super.activate();
  ((JobletContainer)getModel()).addPropertyChangeListener(this);
}

Fixed version (ground truth):
@Override public void activate(){
  super.activate();
  ((JobletContainer)getModel()).addPropertyChangeListener(this);
}
Program: 120389
Project: 120389
Buggy source:
protected void refreshVisuals(){
  Boolean isDisplayJoblet=((JobletContainer)this.getModel()).isDisplayed();
  if (getParent() == null) {
    return;
  }
  Rectangle rectangle=((JobletContainer)this.getModel()).getJobletContainerRectangle();
  if (rectangle == null) {
    return;
  }
  Rectangle cleanRectangle=((NodeContainer)this.getModel()).getNodeMarkRectangle();
  if (this.getParent() != null) {
    if (this.getParent().getModel() instanceof SubjobContainer) {
      Rectangle subjobRec=((SubjobContainer)this.getParent().getModel()).getSubjobContainerRectangle();
      ((GraphicalEditPart)getParent()).setLayoutConstraint(this,getFigure(),rectangle);
    }
  }
  ((JobletContainerFigure)getFigure()).initializejobletContainer(rectangle);
}

Fixed version (ground truth):
@Override protected void refreshVisuals(){
  Boolean isDisplayJoblet=((JobletContainer)this.getModel()).isDisplayed();
  if (getParent() == null) {
    return;
  }
  Rectangle rectangle=((JobletContainer)this.getModel()).getJobletContainerRectangle();
  if (rectangle == null) {
    return;
  }
  Rectangle cleanRectangle=((NodeContainer)this.getModel()).getNodeMarkRectangle();
  if (this.getParent() != null) {
    if (this.getParent().getModel() instanceof SubjobContainer) {
      Rectangle subjobRec=((SubjobContainer)this.getParent().getModel()).getSubjobContainerRectangle();
      ((GraphicalEditPart)getParent()).setLayoutConstraint(this,getFigure(),rectangle);
    }
  }
  ((JobletContainerFigure)getFigure()).initializejobletContainer(rectangle);
}
Program: 120390
Project: 120390
Buggy source:
public void deactivate(){
  super.deactivate();
  ((JobletContainer)getModel()).removePropertyChangeListener(this);
}

Fixed version (ground truth):
@Override public void deactivate(){
  super.deactivate();
  ((JobletContainer)getModel()).removePropertyChangeListener(this);
}
Program: 120391
Project: 120391
Buggy source:
@Override protected List getModelChildren(){
  return ((SubjobContainer)getModel()).getNodeContainers();
}

Fixed version (ground truth):
@Override protected List getModelChildren(){
  List<NodeContainer> nodeContainers=new ArrayList<NodeContainer>(((SubjobContainer)getModel()).getNodeContainers());
  Collections.sort(nodeContainers,new Comparator<NodeContainer>(){
    @Override public int compare(    NodeContainer nc1,    NodeContainer nc2){
      if (nc1.getNode().isJoblet() || nc2.getNode().isJoblet()) {
        return 0;
      }
      if (!(nc1 instanceof JobletContainer) && !(nc2 instanceof JobletContainer)) {
        return 0;
      }
 else       if (nc1 instanceof JobletContainer && !(nc2 instanceof JobletContainer)) {
        return -1;
      }
 else       if (!(nc1 instanceof JobletContainer) && nc2 instanceof JobletContainer) {
        return 1;
      }
 else       if (nc1 instanceof JobletContainer && nc2 instanceof JobletContainer) {
        if (((JobletContainer)nc1).getMrStartContainer() == nc1 && ((JobletContainer)nc2).getMrStartContainer() == nc2) {
          return 0;
        }
 else         if (((JobletContainer)nc1).getMrStartContainer() != nc1 && ((JobletContainer)nc2).getMrStartContainer() == nc2) {
          return 1;
        }
 else         if (((JobletContainer)nc1).getMrStartContainer() == nc1 && ((JobletContainer)nc2).getMrStartContainer() != nc2) {
          return -1;
        }
 else         if (((JobletContainer)nc1).getMrStartContainer() != nc1 && ((JobletContainer)nc2).getMrStartContainer() != nc2) {
          return 0;
        }
      }
      return 0;
    }
  }
);
  return nodeContainers;
}
Program: 120392
Project: 120392
Buggy source:
public ConnectionAnchor getTargetConnectionAnchor(Request request){
  return new ChopboxAnchor(getFigure());
}

Fixed version (ground truth):
@Override public ConnectionAnchor getTargetConnectionAnchor(Request request){
  return new ChopboxAnchor(getFigure());
}
Program: 120393
Project: 120393
Buggy source:
public void propertyChange(PropertyChangeEvent evt){
  String prop=evt.getPropertyName();
  if (SubjobContainer.UPDATE_SUBJOB_CONTENT.equals(prop)) {
    refresh();
    List<AbstractGraphicalEditPart> childrens=getChildren();
    for (    AbstractGraphicalEditPart part : childrens) {
      part.refresh();
    }
  }
 else   if (SubjobContainer.UPDATE_SUBJOB_CONNECTIONS.equals(prop)) {
    refreshSourceConnections();
  }
 else   if (SubjobContainer.UPDATE_SUBJOB_TITLE_COLOR.equals(prop)) {
    if (getFigure() instanceof SubjobContainerFigure) {
      ((SubjobContainerFigure)getFigure()).updateSubJobTitleColor();
      refreshVisuals();
    }
  }
 else   if (SubjobContainer.UPDATE_SUBJOB_DISPLAY.equals(prop)) {
    List<NodeContainer> tmpList=new ArrayList<NodeContainer>(((SubjobContainer)getModel()).getNodeContainers());
    ((SubjobContainer)getModel()).getNodeContainers().clear();
    refreshChildren();
    List elems=((Process)getParent().getModel()).getElements();
    elems.remove(getModel());
    EditPart parent=getParent();
    parent.refresh();
    ((SubjobContainer)getModel()).getNodeContainers().addAll(tmpList);
    elems.add(getModel());
    parent.refresh();
  }
 else {
    if (getFigure() instanceof SubjobContainerFigure) {
      ((SubjobContainerFigure)getFigure()).updateData();
      refreshVisuals();
    }
  }
}

Fixed version (ground truth):
@Override public void propertyChange(PropertyChangeEvent evt){
  String prop=evt.getPropertyName();
  if (SubjobContainer.UPDATE_SUBJOB_CONTENT.equals(prop)) {
    refresh();
    List<AbstractGraphicalEditPart> childrens=getChildren();
    for (    AbstractGraphicalEditPart part : childrens) {
      part.refresh();
    }
  }
 else   if (SubjobContainer.UPDATE_SUBJOB_CONNECTIONS.equals(prop)) {
    refreshSourceConnections();
  }
 else   if (SubjobContainer.UPDATE_SUBJOB_TITLE_COLOR.equals(prop)) {
    if (getFigure() instanceof SubjobContainerFigure) {
      ((SubjobContainerFigure)getFigure()).updateSubJobTitleColor();
      refreshVisuals();
    }
  }
 else   if (SubjobContainer.UPDATE_SUBJOB_DISPLAY.equals(prop)) {
    List<NodeContainer> tmpList=new ArrayList<NodeContainer>(((SubjobContainer)getModel()).getNodeContainers());
    ((SubjobContainer)getModel()).getNodeContainers().clear();
    refreshChildren();
    List elems=((Process)getParent().getModel()).getElements();
    elems.remove(getModel());
    EditPart parent=getParent();
    parent.refresh();
    ((SubjobContainer)getModel()).getNodeContainers().addAll(tmpList);
    elems.add(getModel());
    parent.refresh();
  }
 else {
    if (getFigure() instanceof SubjobContainerFigure) {
      ((SubjobContainerFigure)getFigure()).updateData();
      refreshVisuals();
    }
  }
}
Program: 120394
Project: 120394
Buggy source:
public ConnectionAnchor getSourceConnectionAnchor(Request request){
  return new ChopboxAnchor(getFigure());
}

Fixed version (ground truth):
@Override public ConnectionAnchor getSourceConnectionAnchor(Request request){
  return new ChopboxAnchor(getFigure());
}
Program: 120395
Project: 120395
Buggy source:
private void processItems(List<ItemVersionObject> objects,RepositoryNode node){
  if (node == null) {
    return;
  }
  if (node.getType() == ENodeType.REPOSITORY_ELEMENT) {
    if (node.getObject() != null) {
      Property property=node.getObject().getProperty();
      Item item=property.getItem();
      if (item != null && filterRepositoryNode(node)) {
        ItemVersionObject object=new ItemVersionObject(property,node,property.getVersion());
        objects.add(object);
      }
    }
  }
 else {
    for (    IRepositoryNode child : node.getChildren()) {
      processItems(objects,(RepositoryNode)child);
    }
  }
}

Fixed version (ground truth):
private void processItems(List<ItemVersionObject> objects,RepositoryNode node){
  if (node == null) {
    return;
  }
  IProjectRepositoryNode root=node.getRoot();
  if (root instanceof ProjectRepositoryNode) {
    ((ProjectRepositoryNode)root).initNode(node);
  }
  if (node.getType() == ENodeType.REPOSITORY_ELEMENT) {
    if (node.getObject() != null) {
      Property property=node.getObject().getProperty();
      Item item=property.getItem();
      if (item != null && filterRepositoryNode(node)) {
        ItemVersionObject object=new ItemVersionObject(property,node,property.getVersion());
        objects.add(object);
      }
    }
  }
 else {
    for (    IRepositoryNode child : node.getChildren()) {
      processItems(objects,(RepositoryNode)child);
    }
  }
}
Program: 120396
Project: 120396
Buggy source:
private void processItems(List<ItemVersionObject> objects,RepositoryNode node){
  if (node == null) {
    return;
  }
  if (node.getType() == ENodeType.REPOSITORY_ELEMENT) {
    if (node.getObject() != null) {
      Property property=node.getObject().getProperty();
      Item item=property.getItem();
      if (item != null && filterRepositoryNode(node)) {
        ItemVersionObject object=new ItemVersionObject(property,node,property.getVersion());
        objects.add(object);
      }
    }
  }
 else {
    for (    IRepositoryNode child : node.getChildren()) {
      processItems(objects,(RepositoryNode)child);
    }
  }
}

Fixed version (ground truth):
private void processItems(List<ItemVersionObject> objects,RepositoryNode node){
  if (node == null) {
    return;
  }
  IProjectRepositoryNode root=node.getRoot();
  if (root instanceof ProjectRepositoryNode) {
    ((ProjectRepositoryNode)root).initNode(node);
  }
  if (node.getType() == ENodeType.REPOSITORY_ELEMENT) {
    if (node.getObject() != null) {
      Property property=node.getObject().getProperty();
      Item item=property.getItem();
      if (item != null && filterRepositoryNode(node)) {
        ItemVersionObject object=new ItemVersionObject(property,node,property.getVersion());
        objects.add(object);
      }
    }
  }
 else {
    for (    IRepositoryNode child : node.getChildren()) {
      processItems(objects,(RepositoryNode)child);
    }
  }
}
Program: 120397
Project: 120397
Buggy source:
/** 
 * Disconnect the connection This function is used before delete or reconnect a connection.
 */
@Override public void disconnect(){
  if (isConnected) {
    INodeConnector sourceNodeConnector=getSourceNodeConnector();
    if (sourceNodeConnector != null && !sourceNodeConnector.isMultiSchema()) {
      if (lineStyle.hasConnectionCategory(IConnectionCategory.CUSTOM_NAME) || isInTypes(lineStyle,EConnectionType.ITERATE,EConnectionType.ON_COMPONENT_OK,EConnectionType.ON_COMPONENT_ERROR,EConnectionType.ON_SUBJOB_OK,EConnectionType.ON_SUBJOB_ERROR,EConnectionType.RUN_IF,EConnectionType.ROUTE,EConnectionType.ROUTE_TRY,EConnectionType.ROUTE_CATCH,EConnectionType.ROUTE_FINALLY,EConnectionType.ROUTE_ENDBLOCK,EConnectionType.ROUTE_WHEN,EConnectionType.ROUTE_OTHER,EConnectionType.STARTS)) {
        source.getProcess().removeUniqueConnectionName(uniqueName);
      }
    }
    source.removeOutput(this);
    target.removeInput(this);
    updateAllId();
    isConnected=false;
    if (lineStyle.equals(EConnectionType.SYNCHRONIZE)) {
      for (      IElementParameter param : target.getElementParameters()) {
        if (param.isBasedOnSubjobStarts()) {
          TableController.updateSubjobStarts(target,param);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Disconnect the connection This function is used before delete or reconnect a connection.
 */
@Override public void disconnect(){
  if (isConnected) {
    INodeConnector sourceNodeConnector=getSourceNodeConnector();
    if (source.getJobletNode() == null && sourceNodeConnector != null && !sourceNodeConnector.isMultiSchema()) {
      if (lineStyle.hasConnectionCategory(IConnectionCategory.CUSTOM_NAME) || isInTypes(lineStyle,EConnectionType.ITERATE,EConnectionType.ON_COMPONENT_OK,EConnectionType.ON_COMPONENT_ERROR,EConnectionType.ON_SUBJOB_OK,EConnectionType.ON_SUBJOB_ERROR,EConnectionType.RUN_IF,EConnectionType.ROUTE,EConnectionType.ROUTE_TRY,EConnectionType.ROUTE_CATCH,EConnectionType.ROUTE_FINALLY,EConnectionType.ROUTE_ENDBLOCK,EConnectionType.ROUTE_WHEN,EConnectionType.ROUTE_OTHER,EConnectionType.STARTS)) {
        source.getProcess().removeUniqueConnectionName(uniqueName);
      }
    }
    source.removeOutput(this);
    target.removeInput(this);
    updateAllId();
    isConnected=false;
    if (lineStyle.equals(EConnectionType.SYNCHRONIZE)) {
      for (      IElementParameter param : target.getElementParameters()) {
        if (param.isBasedOnSubjobStarts()) {
          TableController.updateSubjobStarts(target,param);
        }
      }
    }
  }
}
Program: 120401
Project: 120401
Buggy source:
private void exportJobInfo(Properties propertyFile){
  File jobInfoFile=new File(jobPropertyFile);
  try {
    if (!jobInfoFile.exists()) {
      jobInfoFile.createNewFile();
    }
    InputStream fis=new FileInputStream(jobInfoFile);
    propertyFile.load(fis);
    fis.close();
    OutputStream fos=new FileOutputStream(jobPropertyFile);
    setProperty(propertyFile);
    propertyFile.store(fos,"String_Node_Str");
  }
 catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
private void exportJobInfo(Properties propertyFile){
  File jobInfoFile=new File(jobPropertyFile);
  try {
    if (!jobInfoFile.exists()) {
      jobInfoFile.createNewFile();
    }
    InputStream fis=new FileInputStream(jobInfoFile);
    propertyFile.load(fis);
    fis.close();
    OutputStream fos=new FileOutputStream(jobPropertyFile);
    setProperty(propertyFile);
    propertyFile.store(fos,"String_Node_Str");
    fos.close();
  }
 catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 120402
Project: 120402
Buggy source:
private void exportJobInfo(Properties propertyFile){
  File jobInfoFile=new File(jobPropertyFile);
  try {
    if (!jobInfoFile.exists()) {
      jobInfoFile.createNewFile();
    }
    InputStream fis=new FileInputStream(jobInfoFile);
    propertyFile.load(fis);
    fis.close();
    OutputStream fos=new FileOutputStream(jobPropertyFile);
    setProperty(propertyFile);
    propertyFile.store(fos,"String_Node_Str");
  }
 catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
private void exportJobInfo(Properties propertyFile){
  File jobInfoFile=new File(jobPropertyFile);
  try {
    if (!jobInfoFile.exists()) {
      jobInfoFile.createNewFile();
    }
    InputStream fis=new FileInputStream(jobInfoFile);
    propertyFile.load(fis);
    fis.close();
    OutputStream fos=new FileOutputStream(jobPropertyFile);
    setProperty(propertyFile);
    propertyFile.store(fos,"String_Node_Str");
    fos.close();
  }
 catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 120403
Project: 120403
Buggy source:
/** 
 * dev Comment method "sortColumn".
 * @param columns
 * @return
 */
private static List<MetadataColumn> sortColumn(Collection<MetadataColumn> columns){
  List<MetadataColumn> sortColumns=new ArrayList<MetadataColumn>();
  List<MetadataColumn> sysColumns=new ArrayList<MetadataColumn>();
  List<MetadataColumn> grayColumns=new ArrayList<MetadataColumn>();
  List<MetadataColumn> divColumns=new ArrayList<MetadataColumn>();
  List<MetadataColumn> norColumns=new ArrayList<MetadataColumn>();
  for (  MetadataColumn column : columns) {
    if (column.isSynchronised()) {
      sysColumns.add(column);
      continue;
    }
    if (column.isDivergency()) {
      divColumns.add(column);
      continue;
    }
    if (column.getLabel() == null || "String_Node_Str".equals(column.getLabel())) {
      grayColumns.add(column);
      continue;
    }
    norColumns.add(column);
  }
  MetadataColumnComparator metadataColumnComparator=new MetadataColumnComparator();
  Collections.sort(norColumns,metadataColumnComparator);
  Collections.sort(sysColumns,metadataColumnComparator);
  Collections.sort(divColumns,metadataColumnComparator);
  Collections.sort(grayColumns,metadataColumnComparator);
  sortColumns.addAll(norColumns);
  sortColumns.addAll(sysColumns);
  sortColumns.addAll(divColumns);
  sortColumns.addAll(grayColumns);
  return sortColumns;
}

Fixed version (ground truth):
/** 
 * dev Comment method "sortColumn".
 * @param columns
 * @return
 */
private static List<MetadataColumn> sortColumn(Collection<MetadataColumn> columns){
  List<MetadataColumn> sortColumns=new ArrayList<MetadataColumn>();
  List<MetadataColumn> sysColumns=new ArrayList<MetadataColumn>();
  List<MetadataColumn> grayColumns=new ArrayList<MetadataColumn>();
  List<MetadataColumn> divColumns=new ArrayList<MetadataColumn>();
  List<MetadataColumn> norColumns=new ArrayList<MetadataColumn>();
  for (  MetadataColumn column : columns) {
    if (column.isSynchronised()) {
      sysColumns.add(column);
      continue;
    }
    if (column.isDivergency()) {
      divColumns.add(column);
      continue;
    }
    if (column.getLabel() == null || "String_Node_Str".equals(column.getLabel())) {
      grayColumns.add(column);
      continue;
    }
    norColumns.add(column);
  }
  MetadataColumnComparator metadataColumnComparator=new MetadataColumnComparator();
  Collections.sort(sysColumns,metadataColumnComparator);
  Collections.sort(divColumns,metadataColumnComparator);
  Collections.sort(grayColumns,metadataColumnComparator);
  sortColumns.addAll(norColumns);
  sortColumns.addAll(sysColumns);
  sortColumns.addAll(divColumns);
  sortColumns.addAll(grayColumns);
  return sortColumns;
}
Program: 120405
Project: 120405
Buggy source:
public void focusGained(FocusEvent e){
}

Fixed version (ground truth):
@Override public void focusGained(FocusEvent e){
}
Program: 120407
Project: 120407
Buggy source:
public void set(Parameter bean,Object value){
}

Fixed version (ground truth):
@Override public void set(Parameter bean,Object value){
}
Program: 120409
Project: 120409
Buggy source:
/** 
 * Sent when a control loses focus.
 * @param e an event containing information about the focus change
 */
public void focusLost(FocusEvent e){
  combo.dispose();
}

Fixed version (ground truth):
/** 
 * Sent when a control loses focus.
 * @param e an event containing information about the focus change
 */
@Override public void focusLost(FocusEvent e){
  combo.dispose();
}
Program: 120410
Project: 120410
Buggy source:
private void createCombo(final ListParameter list,TableItem item){
  final CCombo combo=new CCombo(table,SWT.NONE);
  combo.setItems(list.getValues());
  combo.setFocus();
  editor.setEditor(combo,item,eDITABLECOLUMN);
  combo.setText(list.getValue());
  Point size=combo.computeSize(SWT.DEFAULT,table.getItemHeight());
  editor.horizontalAlignment=SWT.LEFT;
  editor.minimumHeight=size.y;
  editor.minimumWidth=size.x;
  combo.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      list.setValue(combo.getText());
      viewer.refresh(list);
      ext.setChanged(true);
      rowGenTableEditor2.getTableViewerCreator().getTableViewer().refresh();
    }
  }
);
  combo.addFocusListener(new FocusListener(){
    public void focusGained(    FocusEvent e){
    }
    /** 
 * Sent when a control loses focus.
 * @param e an event containing information about the focus change
 */
    public void focusLost(    FocusEvent e){
      combo.dispose();
    }
  }
);
}

Fixed version (ground truth):
private void createCombo(final ListParameter list,TableItem item){
  final CCombo combo=new CCombo(table,SWT.NONE);
  combo.setItems(list.getValues());
  combo.setFocus();
  editor.setEditor(combo,item,eDITABLECOLUMN);
  combo.setText(list.getValue());
  Point size=combo.computeSize(SWT.DEFAULT,table.getItemHeight());
  editor.horizontalAlignment=SWT.LEFT;
  editor.minimumHeight=size.y;
  editor.minimumWidth=size.x;
  combo.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      list.setValue(combo.getText());
      viewer.refresh(list);
      ext.setChanged(true);
      rowGenTableEditor2.getTableViewerCreator().getTableViewer().refresh();
    }
  }
);
  combo.addFocusListener(new FocusListener(){
    @Override public void focusGained(    FocusEvent e){
    }
    /** 
 * Sent when a control loses focus.
 * @param e an event containing information about the focus change
 */
    @Override public void focusLost(    FocusEvent e){
      combo.dispose();
    }
  }
);
}
Program: 120411
Project: 120411
Buggy source:
public String get(Parameter bean){
  return bean.getComment();
}

Fixed version (ground truth):
@Override public String get(Parameter bean){
  return bean.getComment();
}
Program: 120416
Project: 120416
Buggy source:
@Override public void init(TreeViewer viewer,IStructuredSelection selection){
  repositoryNode=getRepositoryNode(selection);
  boolean enabled=false;
  if (repositoryNode != null) {
    ERepositoryObjectType nodeType=(ERepositoryObjectType)repositoryNode.getProperties(EProperties.CONTENT_TYPE);
    if (repositoryNode.getType() == RepositoryNode.ENodeType.SYSTEM_FOLDER || repositoryNode.getType() == RepositoryNode.ENodeType.SIMPLE_FOLDER) {
      if (nodeType == ERepositoryObjectType.BUSINESS_PROCESS) {
        enabled=true;
      }
      if (repositoryNode.getObject() != null && repositoryNode.getObject().getProperty().getItem().getState().isDeleted()) {
        enabled=false;
      }
    }
  }
  if (ProxyRepositoryFactory.getInstance().isUserReadOnlyOnCurrentProject()) {
    enabled=false;
  }
  if (enabled) {
    enabled=ProjectManager.getInstance().isInCurrentMainProject(repositoryNode);
  }
  setEnabled(enabled);
}

Fixed version (ground truth):
@Override public void init(TreeViewer viewer,IStructuredSelection selection){
  repositoryNode=getRepositoryNode(selection);
  boolean enabled=false;
  if (repositoryNode != null) {
    ERepositoryObjectType nodeType=(ERepositoryObjectType)repositoryNode.getProperties(EProperties.CONTENT_TYPE);
    if (repositoryNode.getType() == RepositoryNode.ENodeType.SYSTEM_FOLDER || repositoryNode.getType() == RepositoryNode.ENodeType.SIMPLE_FOLDER) {
      if (nodeType == ERepositoryObjectType.BUSINESS_PROCESS) {
        enabled=true;
      }
      if (repositoryNode.getObject() != null && repositoryNode.getObject().isDeleted()) {
        enabled=false;
      }
    }
  }
  if (ProxyRepositoryFactory.getInstance().isUserReadOnlyOnCurrentProject()) {
    enabled=false;
  }
  if (enabled) {
    enabled=ProjectManager.getInstance().isInCurrentMainProject(repositoryNode);
  }
  setEnabled(enabled);
}
Program: 120419
Project: 120419
Buggy source:
@Override public void init(TreeViewer viewer,IStructuredSelection selection){
  boolean canWork=!selection.isEmpty() && selection.size() == 1;
  IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  if (factory.isUserReadOnlyOnCurrentProject()) {
    canWork=false;
  }
  if (canWork) {
    Object o=selection.getFirstElement();
    RepositoryNode node=(RepositoryNode)o;
switch (node.getType()) {
case SIMPLE_FOLDER:
case SYSTEM_FOLDER:
      ERepositoryObjectType nodeType=(ERepositoryObjectType)node.getProperties(EProperties.CONTENT_TYPE);
    if (nodeType != ERepositoryObjectType.PROCESS) {
      canWork=false;
    }
  if (node.getObject() != null && node.getObject().getProperty().getItem().getState().isDeleted()) {
    canWork=false;
  }
break;
default :
canWork=false;
}
if (canWork && !ProjectManager.getInstance().isInCurrentMainProject(node)) {
canWork=false;
}
}
setEnabled(canWork);
}

Fixed version (ground truth):
@Override public void init(TreeViewer viewer,IStructuredSelection selection){
  boolean canWork=!selection.isEmpty() && selection.size() == 1;
  IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  if (factory.isUserReadOnlyOnCurrentProject()) {
    canWork=false;
  }
  if (canWork) {
    Object o=selection.getFirstElement();
    RepositoryNode node=(RepositoryNode)o;
switch (node.getType()) {
case SIMPLE_FOLDER:
case SYSTEM_FOLDER:
      ERepositoryObjectType nodeType=(ERepositoryObjectType)node.getProperties(EProperties.CONTENT_TYPE);
    if (nodeType != ERepositoryObjectType.PROCESS) {
      canWork=false;
    }
  if (node.getObject() != null && node.getObject().isDeleted()) {
    canWork=false;
  }
break;
default :
canWork=false;
}
if (canWork && !ProjectManager.getInstance().isInCurrentMainProject(node)) {
canWork=false;
}
}
setEnabled(canWork);
}
Program: 120420
Project: 120420
Buggy source:
@Override public void dispose(){
  this.disposed=true;
  this.unit=null;
  super.dispose();
}

Fixed version (ground truth):
@Override public void dispose(){
  this.disposed=true;
  this.unit=null;
  this.process=null;
  super.dispose();
}
Program: 120421
Project: 120421
Buggy source:
protected List getModelChildren(){
  return Collections.EMPTY_LIST;
}

Fixed version (ground truth):
@Override protected List getModelChildren(){
  return Collections.EMPTY_LIST;
}
Program: 120422
Project: 120422
Buggy source:
protected void createEditPolicies(){
  installEditPolicy(EditPolicy.COMPONENT_ROLE,new NodeEditPolicy());
}

Fixed version (ground truth):
@Override protected void createEditPolicies(){
  installEditPolicy(EditPolicy.COMPONENT_ROLE,new NodeEditPolicy());
}
Program: 120423
Project: 120423
Buggy source:
protected void refreshVisuals(){
  INodeReturn nr=((INodeReturn)getModel());
  setWidgetText(nr.getDisplayName() + "String_Node_Str" + nr.getName()+ "String_Node_Str"+ nr.getAvailability()+ "String_Node_Str");
}

Fixed version (ground truth):
@Override protected void refreshVisuals(){
  INodeReturn nr=((INodeReturn)getModel());
  setWidgetText(nr.getDisplayName() + "String_Node_Str" + nr.getName()+ "String_Node_Str"+ nr.getAvailability()+ "String_Node_Str");
}
Program: 120424
Project: 120424
Buggy source:
@Override public void deactivate(){
  super.deactivate();
  nodeTransferDragSourceListener.setEditPart(this);
  getViewer().removeDragSourceListener(nodeTransferDragSourceListener.getNodeTransferDragSourceListener());
}

Fixed version (ground truth):
@Override public void deactivate(){
  super.deactivate();
  nodeTransferDragSourceListener.setEditPart(null);
  getViewer().removeDragSourceListener(nodeTransferDragSourceListener.getNodeTransferDragSourceListener());
}
Program: 120425
Project: 120425
Buggy source:
public void propertyChange(final PropertyChangeEvent change){
  if (Node.RETURNS_CHANGED.equals(change.getPropertyName())) {
    refreshChildren();
    return;
  }
  Display.getDefault().syncExec(new Runnable(){
    public void run(){
      refreshVisuals();
    }
  }
);
}

Fixed version (ground truth):
@Override public void propertyChange(final PropertyChangeEvent change){
  if (Node.RETURNS_CHANGED.equals(change.getPropertyName())) {
    refreshChildren();
    return;
  }
  Display.getDefault().syncExec(new Runnable(){
    @Override public void run(){
      refreshVisuals();
    }
  }
);
}
Program: 120426
Project: 120426
Buggy source:
public void run(){
  refreshVisuals();
}

Fixed version (ground truth):
@Override public void run(){
  refreshVisuals();
}
Program: 120427
Project: 120427
Buggy source:
@Override public void deactivate(){
  ((Node)getModel()).removePropertyChangeListener(this);
  nodeTransferDragSourceListener.setEditPart(this);
  getViewer().removeDragSourceListener(nodeTransferDragSourceListener.getNodeTransferDragSourceListener());
  super.deactivate();
}

Fixed version (ground truth):
@Override public void deactivate(){
  ((Node)getModel()).removePropertyChangeListener(this);
  nodeTransferDragSourceListener.setEditPart(null);
  getViewer().removeDragSourceListener(nodeTransferDragSourceListener.getNodeTransferDragSourceListener());
  super.deactivate();
}
Program: 120428
Project: 120428
Buggy source:
protected List getModelChildren(){
  return ((Process)getModel()).getGraphicalNodes();
}

Fixed version (ground truth):
@Override protected List getModelChildren(){
  return ((Process)getModel()).getGraphicalNodes();
}
Program: 120429
Project: 120429
Buggy source:
public void activate(){
  super.activate();
  ((Process)getModel()).addPropertyChangeListener(this);
  nodeTransferDragSourceListener.setEditPart(this);
  getViewer().addDragSourceListener(nodeTransferDragSourceListener.getNodeTransferDragSourceListener());
}

Fixed version (ground truth):
@Override public void activate(){
  super.activate();
  ((Process)getModel()).addPropertyChangeListener(this);
  nodeTransferDragSourceListener.setEditPart(this);
  getViewer().addDragSourceListener(nodeTransferDragSourceListener.getNodeTransferDragSourceListener());
}
Program: 120430
Project: 120430
Buggy source:
public void propertyChange(final PropertyChangeEvent change){
  refreshChildren();
}

Fixed version (ground truth):
@Override public void propertyChange(final PropertyChangeEvent change){
  refreshChildren();
}
Program: 120431
Project: 120431
Buggy source:
public void deactivate(){
  ((Process)getModel()).removePropertyChangeListener(this);
  nodeTransferDragSourceListener.setEditPart(this);
  getViewer().removeDragSourceListener(nodeTransferDragSourceListener.getNodeTransferDragSourceListener());
  super.deactivate();
}

Fixed version (ground truth):
@Override public void deactivate(){
  ((Process)getModel()).removePropertyChangeListener(this);
  nodeTransferDragSourceListener.setEditPart(null);
  getViewer().removeDragSourceListener(nodeTransferDragSourceListener.getNodeTransferDragSourceListener());
  super.deactivate();
}
Program: 120432
Project: 120432
Buggy source:
@Override public void cleanDisplay(){
  tabFactory.setInput(null);
  tabFactory.setTitle(null,null);
  tabFactory.getTabbedPropertyComposite().setCompactViewVisible(false);
  if (tabFactory.getTabComposite() != null) {
    for (    Control curControl : tabFactory.getTabComposite().getChildren()) {
      curControl.dispose();
    }
  }
  this.element=null;
  cleaned=true;
  selectedPrimary=true;
}

Fixed version (ground truth):
@Override public void cleanDisplay(){
  tabFactory.setInput(null);
  tabFactory.setTitle(null,null);
  tabFactory.getTabbedPropertyComposite().setCompactViewVisible(false);
  if (tabFactory.getTabComposite() != null) {
    for (    Control curControl : tabFactory.getTabComposite().getChildren()) {
      curControl.dispose();
    }
  }
  this.element=null;
  cleaned=true;
  selectedPrimary=true;
  if (currentSelectedTab != null) {
    currentSelectedTab.setData(null);
    currentSelectedTab=null;
  }
}
Program: 120433
Project: 120433
Buggy source:
public void init(TreeViewer viewer,IStructuredSelection selection){
  boolean canWork=!selection.isEmpty() && selection.size() == 1;
  IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  if (factory.isUserReadOnlyOnCurrentProject()) {
    canWork=false;
  }
  if (canWork) {
    RepositoryNode node=(RepositoryNode)selection.getFirstElement();
switch (node.getType()) {
case SIMPLE_FOLDER:
case SYSTEM_FOLDER:
      ERepositoryObjectType nodeType=(ERepositoryObjectType)node.getProperties(EProperties.CONTENT_TYPE);
    if (nodeType != ERepositoryObjectType.DOCUMENTATION) {
      canWork=false;
    }
  if (node.getObject() != null && node.getObject().getProperty().getItem().getState().isDeleted()) {
    canWork=false;
  }
break;
default :
canWork=false;
}
if (canWork && !ProjectManager.getInstance().isInCurrentMainProject(node)) {
canWork=false;
}
}
setEnabled(canWork);
}

Fixed version (ground truth):
@Override public void init(TreeViewer viewer,IStructuredSelection selection){
  boolean canWork=!selection.isEmpty() && selection.size() == 1;
  IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  if (factory.isUserReadOnlyOnCurrentProject()) {
    canWork=false;
  }
  if (canWork) {
    RepositoryNode node=(RepositoryNode)selection.getFirstElement();
switch (node.getType()) {
case SIMPLE_FOLDER:
case SYSTEM_FOLDER:
      ERepositoryObjectType nodeType=(ERepositoryObjectType)node.getProperties(EProperties.CONTENT_TYPE);
    if (nodeType != ERepositoryObjectType.DOCUMENTATION) {
      canWork=false;
    }
  if (node.getObject() != null && node.getObject().isDeleted()) {
    canWork=false;
  }
break;
default :
canWork=false;
}
if (canWork && !ProjectManager.getInstance().isInCurrentMainProject(node)) {
canWork=false;
}
}
setEnabled(canWork);
}
Program: 120435
Project: 120435
Buggy source:
public void focusGained(FocusEvent e){
  updateBackground(false,true);
}

Fixed version (ground truth):
@Override public void focusGained(FocusEvent e){
  updateBackground(false,true);
}
Program: 120436
Project: 120436
Buggy source:
public void handleEvent(Event event){
  if (uiManager.getRowGenResponse() == SWT.NONE) {
    uiManager.closeRowGenerator(SWT.CANCEL,false);
  }
}

Fixed version (ground truth):
@Override public void handleEvent(Event event){
  if (uiManager.getRowGenResponse() == SWT.NONE) {
    uiManager.closeRowGenerator(SWT.CANCEL,false);
  }
}
Program: 120438
Project: 120438
Buggy source:
/** 
 * qzhang Comment method "addParentListeners".
 * @param uiManager
 * @param uiProperties
 */
private void addParentListeners(final UIManager uiManager,final ExternalRowGeneratorUiProperties uiProperties){
  rowGenUIParent.addDisposeListener(new DisposeListener(){
    public void widgetDisposed(    DisposeEvent e){
      release();
    }
  }
);
  rowGenUIParent.addListener(SWT.Close,new Listener(){
    public void handleEvent(    Event event){
      if (uiManager.getRowGenResponse() == SWT.NONE) {
        uiManager.closeRowGenerator(SWT.CANCEL,false);
      }
    }
  }
);
  rowGenUIParent.addFocusListener(new FocusListener(){
    public void focusGained(    FocusEvent e){
      updateBackground(false,true);
    }
    public void focusLost(    FocusEvent e){
    }
  }
);
  if (rowGenUIParent instanceof Shell) {
    ((Shell)rowGenUIParent).addControlListener(new ControlListener(){
      public void controlMoved(      ControlEvent e){
      }
      public void controlResized(      ControlEvent e){
        if (!((Shell)e.getSource()).getMaximized()) {
          ExternalRowGeneratorUiProperties.setBoundsRowGen(((Shell)e.getSource()).getBounds());
        }
      }
    }
);
  }
}

Fixed version (ground truth):
/** 
 * qzhang Comment method "addParentListeners".
 * @param uiManager
 * @param uiProperties
 */
private void addParentListeners(final UIManager uiManager,final ExternalRowGeneratorUiProperties uiProperties){
  rowGenUIParent.addListener(SWT.Close,new Listener(){
    @Override public void handleEvent(    Event event){
      if (uiManager.getRowGenResponse() == SWT.NONE) {
        uiManager.closeRowGenerator(SWT.CANCEL,false);
      }
    }
  }
);
  rowGenUIParent.addFocusListener(new FocusListener(){
    @Override public void focusGained(    FocusEvent e){
      updateBackground(false,true);
    }
    @Override public void focusLost(    FocusEvent e){
    }
  }
);
  if (rowGenUIParent instanceof Shell) {
    ((Shell)rowGenUIParent).addControlListener(new ControlListener(){
      @Override public void controlMoved(      ControlEvent e){
      }
      @Override public void controlResized(      ControlEvent e){
        if (!((Shell)e.getSource()).getMaximized()) {
          ExternalRowGeneratorUiProperties.setBoundsRowGen(((Shell)e.getSource()).getBounds());
        }
      }
    }
);
  }
}
Program: 120439
Project: 120439
Buggy source:
public void focusLost(FocusEvent e){
}

Fixed version (ground truth):
@Override public void focusLost(FocusEvent e){
}
Program: 120440
Project: 120440
Buggy source:
/** 
 * qzhang Comment method "addKeyListener".
 * @param uiManager
 * @param display
 */
private void addKeyListener(final UIManager uiManager,final Display display){
  Listener listener=new Listener(){
    public void handleEvent(    Event event){
      if (event.type == SWT.KeyUp || event.type == SWT.KeyDown) {
        boolean isPressed=event.type == SWT.KeyDown ? true : false;
        if (event.keyCode == SWT.CTRL) {
          uiManager.setCtrlPressed(isPressed);
        }
        if (event.keyCode == SWT.SHIFT) {
          uiManager.setShiftPressed(isPressed);
        }
      }
    }
  }
;
  display.addFilter(SWT.KeyUp,listener);
  display.addFilter(SWT.KeyDown,listener);
}

Fixed version (ground truth):
/** 
 * qzhang Comment method "addKeyListener".
 * @param uiManager
 * @param display
 */
private void addKeyListener(final UIManager uiManager,final Display display){
  final Listener listener=new Listener(){
    @Override public void handleEvent(    Event event){
      if (event.type == SWT.KeyUp || event.type == SWT.KeyDown) {
        boolean isPressed=event.type == SWT.KeyDown ? true : false;
        if (event.keyCode == SWT.CTRL) {
          uiManager.setCtrlPressed(isPressed);
        }
        if (event.keyCode == SWT.SHIFT) {
          uiManager.setShiftPressed(isPressed);
        }
      }
    }
  }
;
  display.addFilter(SWT.KeyUp,listener);
  display.addFilter(SWT.KeyDown,listener);
  rowGenUIParent.addDisposeListener(new DisposeListener(){
    @Override public void widgetDisposed(    DisposeEvent e){
      display.removeFilter(SWT.KeyUp,listener);
      display.removeFilter(SWT.KeyDown,listener);
      release();
    }
  }
);
}
Program: 120441
Project: 120441
Buggy source:
public void controlMoved(ControlEvent e){
}

Fixed version (ground truth):
@Override public void controlMoved(ControlEvent e){
}
Program: 120442
Project: 120442
Buggy source:
public void controlResized(ControlEvent e){
  if (!((Shell)e.getSource()).getMaximized()) {
    ExternalRowGeneratorUiProperties.setBoundsRowGen(((Shell)e.getSource()).getBounds());
  }
}

Fixed version (ground truth):
@Override public void controlResized(ControlEvent e){
  if (!((Shell)e.getSource()).getMaximized()) {
    ExternalRowGeneratorUiProperties.setBoundsRowGen(((Shell)e.getSource()).getBounds());
  }
}
Program: 120443
Project: 120443
Buggy source:
public void widgetDisposed(DisposeEvent e){
  release();
}

Fixed version (ground truth):
@Override public void widgetDisposed(DisposeEvent e){
  display.removeFilter(SWT.KeyUp,listener);
  display.removeFilter(SWT.KeyDown,listener);
  release();
}
Program: 120444
Project: 120444
Buggy source:
/** 
 * Set the process on wich we are selecting context.
 * @param process The process.
 */
public void setProcess(final IProcess2 process){
  if (process != null) {
    if (process.equals(this.process)) {
      if (checkIsSameContextParameter()) {
        return;
      }
    }
    this.process=process;
    contextComboViewer.getControl().setEnabled(true);
    getInformationsFromContextManager(process.getContextManager());
    contextListener=new IContextListener(){
      @Override public void contextsChanged(){
        if (!ProcessContextComposite.this.isDisposed()) {
          getInformationsFromContextManager(process.getContextManager());
        }
      }
    }
;
    this.process.getContextManager().addContextListener(contextListener);
    contextComboViewer.addSelectionChangedListener(contextComboListener);
  }
 else {
    if (this.process == null) {
      return;
    }
    if (this.process != null) {
      this.process.getContextManager().removeContextListener(contextListener);
      this.process=null;
    }
    contextComboViewer.getControl().setEnabled(false);
    contextComboViewer.removeSelectionChangedListener(contextComboListener);
    contextComboViewer.setInput(null);
    contextTableViewer.setInput(null);
  }
}

Fixed version (ground truth):
/** 
 * Set the process on wich we are selecting context.
 * @param process The process.
 */
public void setProcess(final IProcess2 process){
  if (process != null) {
    if (process.equals(this.process)) {
      if (checkIsSameContextParameter()) {
        return;
      }
    }
    if (this.process != null) {
      this.process.getContextManager().removeContextListener(contextListener);
      contextComboViewer.removeSelectionChangedListener(contextComboListener);
    }
    this.process=process;
    contextComboViewer.getControl().setEnabled(true);
    getInformationsFromContextManager(process.getContextManager());
    contextListener=new IContextListener(){
      @Override public void contextsChanged(){
        if (!ProcessContextComposite.this.isDisposed()) {
          getInformationsFromContextManager(process.getContextManager());
        }
      }
    }
;
    this.process.getContextManager().addContextListener(contextListener);
    contextComboViewer.addSelectionChangedListener(contextComboListener);
  }
 else {
    if (this.process == null) {
      return;
    }
    if (this.process != null) {
      this.process.getContextManager().removeContextListener(contextListener);
      this.process=null;
      contextListener=null;
    }
    contextComboViewer.getControl().setEnabled(false);
    contextComboViewer.removeSelectionChangedListener(contextComboListener);
    contextComboViewer.setInput(null);
    contextTableViewer.setInput(null);
  }
}
Program: 120445
Project: 120445
Buggy source:
@Override public void init(TreeViewer viewer,IStructuredSelection selection){
  super.init(viewer,selection);
  boolean canWork=!selection.isEmpty() && selection.size() == 1;
  IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  if (factory.isUserReadOnlyOnCurrentProject()) {
    canWork=false;
  }
  if (canWork) {
    Object o=selection.getFirstElement();
    RepositoryNode node=(RepositoryNode)o;
switch (node.getType()) {
case SIMPLE_FOLDER:
case SYSTEM_FOLDER:
      ERepositoryObjectType nodeType=(ERepositoryObjectType)node.getProperties(EProperties.CONTENT_TYPE);
    if (nodeType != ERepositoryObjectType.CONTEXT) {
      canWork=false;
    }
  if (node.getObject() != null && node.getObject().getProperty().getItem().getState().isDeleted()) {
    canWork=false;
  }
break;
default :
canWork=false;
}
if (canWork && !ProjectManager.getInstance().isInCurrentMainProject(node)) {
canWork=false;
}
}
setEnabled(canWork);
}

Fixed version (ground truth):
@Override public void init(TreeViewer viewer,IStructuredSelection selection){
  super.init(viewer,selection);
  boolean canWork=!selection.isEmpty() && selection.size() == 1;
  IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  if (factory.isUserReadOnlyOnCurrentProject()) {
    canWork=false;
  }
  if (canWork) {
    Object o=selection.getFirstElement();
    RepositoryNode node=(RepositoryNode)o;
switch (node.getType()) {
case SIMPLE_FOLDER:
case SYSTEM_FOLDER:
      ERepositoryObjectType nodeType=(ERepositoryObjectType)node.getProperties(EProperties.CONTENT_TYPE);
    if (nodeType != ERepositoryObjectType.CONTEXT) {
      canWork=false;
    }
  if (node.getObject() != null && node.getObject().isDeleted()) {
    canWork=false;
  }
break;
default :
canWork=false;
}
if (canWork && !ProjectManager.getInstance().isInCurrentMainProject(node)) {
canWork=false;
}
}
setEnabled(canWork);
}
Program: 120446
Project: 120446
Buggy source:
@Override public void init(TreeViewer viewer,IStructuredSelection selection){
  boolean canWork=!selection.isEmpty() && selection.size() == 1;
  IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  if (factory.isUserReadOnlyOnCurrentProject()) {
    canWork=false;
  }
  if (canWork) {
    Object o=selection.getFirstElement();
    RepositoryNode node=(RepositoryNode)o;
switch (node.getType()) {
case SIMPLE_FOLDER:
case SYSTEM_FOLDER:
      ERepositoryObjectType nodeType=(ERepositoryObjectType)node.getProperties(EProperties.CONTENT_TYPE);
    if (nodeType != ERepositoryObjectType.ROUTINES) {
      canWork=false;
    }
  if (node.getObject() != null && node.getObject().getProperty().getItem().getState().isDeleted()) {
    canWork=false;
  }
break;
default :
canWork=false;
}
if (canWork && !ProjectManager.getInstance().isInCurrentMainProject(node)) {
canWork=false;
}
}
setEnabled(canWork);
}

Fixed version (ground truth):
@Override public void init(TreeViewer viewer,IStructuredSelection selection){
  boolean canWork=!selection.isEmpty() && selection.size() == 1;
  IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  if (factory.isUserReadOnlyOnCurrentProject()) {
    canWork=false;
  }
  if (canWork) {
    Object o=selection.getFirstElement();
    RepositoryNode node=(RepositoryNode)o;
switch (node.getType()) {
case SIMPLE_FOLDER:
case SYSTEM_FOLDER:
      ERepositoryObjectType nodeType=(ERepositoryObjectType)node.getProperties(EProperties.CONTENT_TYPE);
    if (nodeType != ERepositoryObjectType.ROUTINES) {
      canWork=false;
    }
  if (node.getObject() != null && node.getObject().isDeleted()) {
    canWork=false;
  }
break;
default :
canWork=false;
}
if (canWork && !ProjectManager.getInstance().isInCurrentMainProject(node)) {
canWork=false;
}
}
setEnabled(canWork);
}