nus-yam/ex-repair huggingface dataset:
Program: 121091
Project: 121091
Buggy source:
public ConvertRepositoryNodeToProcessNode(ConnectionItem connectionItem,IMetadataConnection convertedConnection,String tableName){
  databaseConnection=(DatabaseConnection)connectionItem.getConnection();
  IMetadataConnection iMetadataConnection=convertedConnection;
  String dbType=iMetadataConnection.getDbType();
  String username=iMetadataConnection.getUsername();
  String pwd=iMetadataConnection.getPassword();
  String dbVersion=iMetadataConnection.getDbVersionString();
  String url=iMetadataConnection.getUrl();
  String additionalParams=iMetadataConnection.getAdditionalParams();
  if (EDatabaseTypeName.GENERAL_JDBC.getDisplayName().equals(dbType)) {
    info=new DbInfo(dbType,username,pwd,dbVersion,url,iMetadataConnection.getDriverClass(),iMetadataConnection.getDriverJarPath(),additionalParams);
  }
 else {
    info=new DbInfo(dbType,username,pwd,dbVersion,url,additionalParams);
  }
  try {
    convertToProcessNode(connectionItem,tableName);
  }
 catch (  ProcessorException e) {
    ExceptionHandler.process(e);
  }
}

Fixed version (ground truth):
public ConvertRepositoryNodeToProcessNode(ConnectionItem connectionItem,IMetadataConnection convertedConnection,String tableName){
  databaseConnection=(DatabaseConnection)connectionItem.getConnection();
  IMetadataConnection iMetadataConnection=convertedConnection;
  String dbType=iMetadataConnection.getDbType();
  String username=iMetadataConnection.getUsername();
  String pwd=iMetadataConnection.getPassword();
  String dbVersion=iMetadataConnection.getDbVersionString();
  String url=iMetadataConnection.getUrl();
  String additionalParams=iMetadataConnection.getAdditionalParams();
  if (EDatabaseTypeName.GENERAL_JDBC.getDisplayName().equals(dbType)) {
    info=new DbInfo(dbType,username,pwd,dbVersion,url,iMetadataConnection.getDriverClass(),iMetadataConnection.getDriverJarPath(),additionalParams);
  }
 else   if (EDatabaseTypeName.HIVE.getDisplayName().equals(iMetadataConnection.getDbType())) {
    String jobTracker=TalendTextUtils.removeQuotes(String.valueOf(iMetadataConnection.getParameter(ConnParameterKeys.CONN_PARA_KEY_JOB_TRACKER_URL)));
    String nameNode=TalendTextUtils.removeQuotes(String.valueOf(iMetadataConnection.getParameter(ConnParameterKeys.CONN_PARA_KEY_NAME_NODE_URL)));
    String thrifturi=null;
    if (HiveConnVersionInfo.MODE_EMBEDDED.getKey().equals(iMetadataConnection.getDbVersionString())) {
      thrifturi="String_Node_Str" + iMetadataConnection.getServerName() + "String_Node_Str"+ iMetadataConnection.getPort();
    }
    info=new DbInfo(iMetadataConnection.getDbType(),iMetadataConnection.getUsername(),iMetadataConnection.getPassword(),iMetadataConnection.getDbVersionString(),iMetadataConnection.getUrl(),jobTracker,nameNode,thrifturi,iMetadataConnection.getDriverJarPath());
  }
 else {
    info=new DbInfo(dbType,username,pwd,dbVersion,url,additionalParams);
  }
  try {
    convertToProcessNode(connectionItem,tableName);
  }
 catch (  ProcessorException e) {
    ExceptionHandler.process(e);
  }
}
Program: 121093
Project: 121093
Buggy source:
private void generateDriverName(){
  driverClassName=ExtractMetaDataUtils.getDriverClassByDbType(dbType);
}

Fixed version (ground truth):
private void generateDriverName(){
  if (EDatabaseTypeName.HIVE.getDisplayName().equals(dbType)) {
    if (url.startsWith(DatabaseConnConstants.HIVE_2_URL_FORMAT)) {
      driverClassName=EDatabase4DriverClassName.HIVE2.getDriverClass();
    }
 else {
      driverClassName=EDatabase4DriverClassName.HIVE.getDriverClass();
    }
  }
  driverClassName=ExtractMetaDataUtils.getDriverClassByDbType(dbType);
}
Program: 121094
Project: 121094
Buggy source:
/** 
 * qzhang Comment method "checkConnection".
 * @param metadataConnection
 */
protected boolean checkConnection(IMetadataConnection metadataConnection){
  try {
    ConnectionStatus testConnection=ExtractMetaDataFromDataBase.testConnection(metadataConnection.getDbType(),metadataConnection.getUrl(),metadataConnection.getUsername(),metadataConnection.getPassword(),metadataConnection.getSchema(),metadataConnection.getDriverClass(),metadataConnection.getDriverJarPath(),metadataConnection.getDbVersionString(),metadataConnection.getAdditionalParams());
    connParameters.setConnectionComment(testConnection.getMessageException());
    return testConnection.getResult();
  }
 catch (  Exception e) {
    log.error("String_Node_Str" + "String_Node_Str" + e.toString());
  }
  return false;
}

Fixed version (ground truth):
/** 
 * qzhang Comment method "checkConnection".
 * @param metadataConnection
 */
protected boolean checkConnection(IMetadataConnection metadataConnection){
  try {
    if (EDatabaseTypeName.HIVE.getDisplayName().equals(metadataConnection.getDbType())) {
      ConnectionStatus connectionStatus=new ConnectionStatus();
      connectionStatus.setResult(false);
      try {
        if (HiveConnVersionInfo.MODE_EMBEDDED.getKey().equals(metadataConnection.getDbVersionString())) {
          JavaSqlFactory.doHivePreSetup((DatabaseConnection)metadataConnection.getCurrentConnection());
        }
        HiveConnectionManager.getInstance().checkConnection(metadataConnection);
        connectionStatus.setResult(true);
      }
 catch (      Exception e) {
        log.error("String_Node_Str" + "String_Node_Str" + e.toString());
      }
      return connectionStatus.getResult();
    }
    ConnectionStatus testConnection=ExtractMetaDataFromDataBase.testConnection(metadataConnection.getDbType(),metadataConnection.getUrl(),metadataConnection.getUsername(),metadataConnection.getPassword(),metadataConnection.getSchema(),metadataConnection.getDriverClass(),metadataConnection.getDriverJarPath(),metadataConnection.getDbVersionString(),metadataConnection.getAdditionalParams());
    connParameters.setConnectionComment(testConnection.getMessageException());
    return testConnection.getResult();
  }
 catch (  Exception e) {
    log.error("String_Node_Str" + "String_Node_Str" + e.toString());
  }
  return false;
}
Program: 121098
Project: 121098
Buggy source:
@Override public void init(TreeViewer viewer,IStructuredSelection selection){
  boolean canWork=!selection.isEmpty() && selection.size() == 1;
  if (canWork) {
    Object o=selection.getFirstElement();
    RepositoryNode node=(RepositoryNode)o;
    if (RepositoryManager.isOpenedItemInEditor(node.getObject())) {
      canWork=false;
    }
 else {
switch (node.getType()) {
case REPOSITORY_ELEMENT:
        if (node.getObjectType() != ERepositoryObjectType.PROCESS) {
          canWork=false;
        }
      break;
default :
    canWork=false;
}
}
}
setEnabled(canWork);
}

Fixed version (ground truth):
@Override public void init(TreeViewer viewer,IStructuredSelection selection){
  boolean canWork=!selection.isEmpty() && selection.size() == 1;
  if (canWork) {
    Object o=selection.getFirstElement();
    RepositoryNode node=(RepositoryNode)o;
    if (RepositoryManager.isOpenedItemInEditor(node.getObject())) {
      canWork=false;
    }
 else {
switch (node.getType()) {
case REPOSITORY_ELEMENT:
        if (node.getObjectType() != ERepositoryObjectType.PROCESS) {
          canWork=false;
        }
      break;
default :
    canWork=false;
}
}
if (canWork && node.getObject() != null && ProxyRepositoryFactory.getInstance().getStatus(node.getObject()) == ERepositoryStatus.LOCK_BY_USER) {
canWork=false;
}
}
setEnabled(canWork);
}
Program: 121099
Project: 121099
Buggy source:
public void init(TreeViewer viewer,IStructuredSelection selection){
  super.init(viewer,selection);
  boolean canWork=!selection.isEmpty() && selection.size() == 1;
  if (canWork) {
    RepositoryNode node=(RepositoryNode)selection.getFirstElement();
    if (node.getObjectType() != ERepositoryObjectType.ROUTINES) {
      canWork=false;
    }
  }
  setEnabled(canWork);
}

Fixed version (ground truth):
public void init(TreeViewer viewer,IStructuredSelection selection){
  super.init(viewer,selection);
  boolean canWork=!selection.isEmpty() && selection.size() == 1;
  if (canWork) {
    RepositoryNode node=(RepositoryNode)selection.getFirstElement();
    if (node.getObjectType() != ERepositoryObjectType.ROUTINES) {
      canWork=false;
    }
    if (canWork && node.getObject() != null && ProxyRepositoryFactory.getInstance().getStatus(node.getObject()) == ERepositoryStatus.LOCK_BY_USER) {
      canWork=false;
    }
  }
  setEnabled(canWork);
}
Program: 121100
Project: 121100
Buggy source:
protected ITableLabelProvider createLabelProvider(){
  return new ITableLabelProvider(){
    public Image getColumnImage(    Object element,    int columnIndex){
      return null;
    }
    public String getColumnText(    Object element,    int columnIndex){
      String value=((String)element);
      if (columnIndex == 0) {
        String trim=ARG_DELIMITER.trim();
        if (value.trim().startsWith(trim)) {
          return value;
        }
        return trim + value;
      }
      throw new IllegalStateException();
    }
    public void addListener(    ILabelProviderListener listener){
    }
    public void dispose(){
    }
    public boolean isLabelProperty(    Object element,    String property){
      return false;
    }
    public void removeListener(    ILabelProviderListener listener){
    }
  }
;
}

Fixed version (ground truth):
protected ITableLabelProvider createLabelProvider(){
  return new ITableLabelProvider(){
    public Image getColumnImage(    Object element,    int columnIndex){
      return null;
    }
    public String getColumnText(    Object element,    int columnIndex){
      String value=((String)element);
      if (columnIndex == 0) {
        return value;
      }
      throw new IllegalStateException();
    }
    public void addListener(    ILabelProviderListener listener){
    }
    public void dispose(){
    }
    public boolean isLabelProperty(    Object element,    String property){
      return false;
    }
    public void removeListener(    ILabelProviderListener listener){
    }
  }
;
}
Program: 121101
Project: 121101
Buggy source:
protected void editItem(ISelection sel){
  IStructuredSelection selection=(IStructuredSelection)sel;
  String existing=(String)selection.getFirstElement();
  String value=getExistingInputObject(existing);
  if (value != null) {
    int indexOf=list.indexOf(existing);
    list.remove(existing);
    list.add(indexOf,value);
    viewer.refresh();
    doSave();
  }
}

Fixed version (ground truth):
protected void editItem(ISelection sel){
  IStructuredSelection selection=(IStructuredSelection)sel;
  String existing=(String)selection.getFirstElement();
  String value=getExistingInputObject(existing);
  if (value != null) {
    int indexOf=list.indexOf(existing);
    list.remove(existing);
    list.add(indexOf,value.replaceAll("String_Node_Str","String_Node_Str"));
    viewer.refresh();
    doSave();
  }
}
Program: 121102
Project: 121102
Buggy source:
public String getColumnText(Object element,int columnIndex){
  String value=((String)element);
  if (columnIndex == 0) {
    String trim=ARG_DELIMITER.trim();
    if (value.trim().startsWith(trim)) {
      return value;
    }
    return trim + value;
  }
  throw new IllegalStateException();
}

Fixed version (ground truth):
public String getColumnText(Object element,int columnIndex){
  String value=((String)element);
  if (columnIndex == 0) {
    return value;
  }
  throw new IllegalStateException();
}
Program: 121103
Project: 121103
Buggy source:
protected List<String> readString(String stringList){
  if (stringList == null || "String_Node_Str".equals(stringList)) {
    return EMPTY_STRING_LIST;
  }
  ArrayList<String> result=new ArrayList<String>(50);
  for (  String tmp : stringList.split(ARG_DELIMITER)) {
    if (tmp != null && !"String_Node_Str".equals(tmp)) {
      result.add(tmp);
    }
  }
  return result;
}

Fixed version (ground truth):
protected List<String> readString(String stringList){
  if (stringList == null || "String_Node_Str".equals(stringList)) {
    return EMPTY_STRING_LIST;
  }
  ArrayList<String> result=new ArrayList<String>(50);
  for (  String tmp : stringList.split("String_Node_Str")) {
    if (tmp != null && !"String_Node_Str".equals(tmp)) {
      result.add(tmp);
    }
  }
  return result;
}
Program: 121104
Project: 121104
Buggy source:
protected String writeString(List<String> items){
  int size=items.size();
  StringBuffer buf=new StringBuffer(size * 50);
  buf.append(ARG_DELIMITER);
  for (int i=0; i < size; i++) {
    buf.append(items.get(i));
    if (i != size - 1) {
      String trim=ARG_DELIMITER.trim();
      if (!items.get(i + 1).trim().startsWith(trim)) {
        buf.append(ARG_DELIMITER);
      }
 else {
        buf.append("String_Node_Str");
      }
    }
  }
  return buf.toString();
}

Fixed version (ground truth):
protected String writeString(List<String> items){
  int size=items.size();
  StringBuffer buf=new StringBuffer(size * 50);
  buf.append("String_Node_Str");
  for (int i=0; i < size; i++) {
    buf.append(items.get(i).replaceAll("String_Node_Str","String_Node_Str"));
    buf.append("String_Node_Str");
  }
  return buf.toString();
}
Program: 121106
Project: 121106
Buggy source:
private void judgeIsSimple(){
  if (this.loopPath.indexOf("String_Node_Str") >= 0 || this.loopPath.indexOf("String_Node_Str") >= 0) {
    this.isSimpleParse=false;
  }
  for (int i=0; i < nodePaths.length; i++) {
    if (nodePaths[i].indexOf("String_Node_Str") >= 0 || nodePaths[i].indexOf("String_Node_Str") >= 0) {
      this.isSimpleParse=false;
      break;
    }
  }
  if (this.isSimpleParse) {
    looper=new SimpleSAXLooper(loopPath,nodePaths,asXMLs);
  }
 else {
    looper=new ComplexSAXLooper(loopPath,nodePaths,asXMLs);
  }
}

Fixed version (ground truth):
private void judgeIsSimple(){
  isSimpleParse=isSimplePath(loopPath);
  for (  String path : nodePaths) {
    if (!isSimpleParse) {
      break;
    }
    isSimpleParse=isSimplePath(path);
  }
  if (this.isSimpleParse) {
    looper=new SimpleSAXLooper(loopPath,nodePaths,asXMLs);
  }
 else {
    looper=new ComplexSAXLooper(loopPath,nodePaths,asXMLs);
  }
}
Program: 121107
Project: 121107
Buggy source:
private void initLoopEntry(){
  bcache=DataBufferCache.getInstance();
  for (  XMLNode node : nodes.getNodes().values()) {
    String column=node.originPath;
    String resultCol=node.loopPath;
    String[] splits=column.split("String_Node_Str");
    for (    String tmp : splits) {
      if (tmp.equals("String_Node_Str")) {
        node.isDot=true;
      }
 else {
        resultCol+="String_Node_Str" + tmp;
      }
    }
    node.nodePath=resultCol;
  }
}

Fixed version (ground truth):
private void initLoopEntry(){
  bcache=DataBufferCache.getInstance();
  for (  XMLNode node : nodes.getNodes().values()) {
    String column=node.originPath;
    String resultCol=node.loopPath;
    String[] splits=column.split("String_Node_Str");
    for (    String tmp : splits) {
      if (tmp.equals("String_Node_Str")) {
        resultCol=resultCol.substring(0,resultCol.lastIndexOf("String_Node_Str"));
        node.setAttrOutOfLoop(true);
      }
 else       if (tmp.equals("String_Node_Str")) {
        node.isDot=true;
      }
 else {
        resultCol+="String_Node_Str" + tmp;
      }
    }
    node.nodePath=resultCol;
  }
}
Program: 121108
Project: 121108
Buggy source:
private boolean dropVarsEntryIsValid(TableItem tableItemTarget){
  Table table=tableItemTarget.getParent();
  TableItem[] tableItems=table.getItems();
  for (int i=0; i < tableItems.length; i++) {
    if (tableItemTarget == tableItems[i]) {
      break;
    }
    if (tableItemSource == tableItems[i]) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean dropVarsEntryIsValid(TableItem tableItemTarget){
  Table table=tableItemTarget.getParent();
  TableItem[] tableItems=table.getItems();
  for (  TableItem tableItem : tableItems) {
    if (tableItemTarget == tableItem) {
      break;
    }
    if (tableItemSource == tableItem) {
      return true;
    }
  }
  return false;
}
Program: 121110
Project: 121110
Buggy source:
@Override public void setElement(Element elem){
  if (currentSelectedTab != null && currentSelectedTab.getData().equals(elem) && !cleaned) {
    return;
  }
  EComponentCategory[] categories=getCategories(elem);
  final List<TalendPropertyTabDescriptor> descriptors=new ArrayList<TalendPropertyTabDescriptor>();
  for (  EComponentCategory category : categories) {
    TalendPropertyTabDescriptor d=new TalendPropertyTabDescriptor(category);
    d.setData(elem);
    descriptors.add(d);
  }
  tabFactory.setInput(descriptors);
  setPropertiesViewerTitle(elem);
  cleaned=false;
  tabFactory.setSelection(new IStructuredSelection(){
    @Override public Object getFirstElement(){
      return null;
    }
    @Override public Iterator iterator(){
      return null;
    }
    @Override public int size(){
      return 0;
    }
    @Override public Object[] toArray(){
      return null;
    }
    @Override public List toList(){
      List<TalendPropertyTabDescriptor> d=new ArrayList<TalendPropertyTabDescriptor>();
      if (descriptors.size() > 0) {
        if (currentSelectedTab != null) {
          for (          TalendPropertyTabDescriptor ds : descriptors) {
            if (ds.getCategory() == currentSelectedTab.getCategory()) {
              d.add(ds);
              return d;
            }
          }
        }
        d.add(descriptors.get(0));
      }
      return d;
    }
    @Override public boolean isEmpty(){
      return false;
    }
  }
);
}

Fixed version (ground truth):
@Override public void setElement(Element elem){
  if (currentSelectedTab != null && currentSelectedTab.getData().equals(elem) && !cleaned) {
    updatePropertiesViewerTitle();
    return;
  }
  EComponentCategory[] categories=getCategories(elem);
  final List<TalendPropertyTabDescriptor> descriptors=new ArrayList<TalendPropertyTabDescriptor>();
  for (  EComponentCategory category : categories) {
    TalendPropertyTabDescriptor d=new TalendPropertyTabDescriptor(category);
    d.setData(elem);
    descriptors.add(d);
  }
  tabFactory.setInput(descriptors);
  setPropertiesViewerTitle(elem);
  cleaned=false;
  tabFactory.setSelection(new IStructuredSelection(){
    @Override public Object getFirstElement(){
      return null;
    }
    @Override public Iterator iterator(){
      return null;
    }
    @Override public int size(){
      return 0;
    }
    @Override public Object[] toArray(){
      return null;
    }
    @Override public List toList(){
      List<TalendPropertyTabDescriptor> d=new ArrayList<TalendPropertyTabDescriptor>();
      if (descriptors.size() > 0) {
        if (currentSelectedTab != null) {
          for (          TalendPropertyTabDescriptor ds : descriptors) {
            if (ds.getCategory() == currentSelectedTab.getCategory()) {
              d.add(ds);
              return d;
            }
          }
        }
        d.add(descriptors.get(0));
      }
      return d;
    }
    @Override public boolean isEmpty(){
      return false;
    }
  }
);
}
Program: 121111
Project: 121111
Buggy source:
public void init(TreeViewer viewer,IStructuredSelection selection){
  super.init(viewer,selection);
  boolean canWork=!selection.isEmpty() && selection.size() == 1;
  if (canWork) {
    RepositoryNode node=(RepositoryNode)selection.getFirstElement();
    if (node.getObjectType() != ERepositoryObjectType.ROUTINES) {
      canWork=false;
    }
  }
  setEnabled(canWork);
}

Fixed version (ground truth):
public void init(TreeViewer viewer,IStructuredSelection selection){
  super.init(viewer,selection);
  boolean canWork=!selection.isEmpty() && selection.size() == 1;
  if (canWork) {
    RepositoryNode node=(RepositoryNode)selection.getFirstElement();
    if (node.getObjectType() != ERepositoryObjectType.ROUTINES) {
      canWork=false;
    }
    if (canWork && node.getObject() != null && ProxyRepositoryFactory.getInstance().getStatus(node.getObject()) == ERepositoryStatus.LOCK_BY_USER) {
      canWork=false;
    }
  }
  setEnabled(canWork);
}
Program: 121112
Project: 121112
Buggy source:
@Override public void setElement(Element elem){
  if (currentSelectedTab != null && currentSelectedTab.getData().equals(elem) && !cleaned) {
    return;
  }
  EComponentCategory[] categories=getCategories(elem);
  final List<TalendPropertyTabDescriptor> descriptors=new ArrayList<TalendPropertyTabDescriptor>();
  for (  EComponentCategory category : categories) {
    TalendPropertyTabDescriptor d=new TalendPropertyTabDescriptor(category);
    d.setData(elem);
    descriptors.add(d);
  }
  tabFactory.setInput(descriptors);
  setPropertiesViewerTitle(elem);
  cleaned=false;
  tabFactory.setSelection(new IStructuredSelection(){
    @Override public Object getFirstElement(){
      return null;
    }
    @Override public Iterator iterator(){
      return null;
    }
    @Override public int size(){
      return 0;
    }
    @Override public Object[] toArray(){
      return null;
    }
    @Override public List toList(){
      List<TalendPropertyTabDescriptor> d=new ArrayList<TalendPropertyTabDescriptor>();
      if (descriptors.size() > 0) {
        if (currentSelectedTab != null) {
          for (          TalendPropertyTabDescriptor ds : descriptors) {
            if (ds.getCategory() == currentSelectedTab.getCategory()) {
              d.add(ds);
              return d;
            }
          }
        }
        d.add(descriptors.get(0));
      }
      return d;
    }
    @Override public boolean isEmpty(){
      return false;
    }
  }
);
}

Fixed version (ground truth):
@Override public void setElement(Element elem){
  if (currentSelectedTab != null && currentSelectedTab.getData().equals(elem) && !cleaned) {
    updatePropertiesViewerTitle();
    return;
  }
  EComponentCategory[] categories=getCategories(elem);
  final List<TalendPropertyTabDescriptor> descriptors=new ArrayList<TalendPropertyTabDescriptor>();
  for (  EComponentCategory category : categories) {
    TalendPropertyTabDescriptor d=new TalendPropertyTabDescriptor(category);
    d.setData(elem);
    descriptors.add(d);
  }
  tabFactory.setInput(descriptors);
  setPropertiesViewerTitle(elem);
  cleaned=false;
  tabFactory.setSelection(new IStructuredSelection(){
    @Override public Object getFirstElement(){
      return null;
    }
    @Override public Iterator iterator(){
      return null;
    }
    @Override public int size(){
      return 0;
    }
    @Override public Object[] toArray(){
      return null;
    }
    @Override public List toList(){
      List<TalendPropertyTabDescriptor> d=new ArrayList<TalendPropertyTabDescriptor>();
      if (descriptors.size() > 0) {
        if (currentSelectedTab != null) {
          for (          TalendPropertyTabDescriptor ds : descriptors) {
            if (ds.getCategory() == currentSelectedTab.getCategory()) {
              d.add(ds);
              return d;
            }
          }
        }
        d.add(descriptors.get(0));
      }
      return d;
    }
    @Override public boolean isEmpty(){
      return false;
    }
  }
);
}
Program: 121113
Project: 121113
Buggy source:
@Override public void init(TreeViewer viewer,IStructuredSelection selection){
  boolean canWork=!selection.isEmpty() && selection.size() == 1;
  if (canWork) {
    Object o=selection.getFirstElement();
    RepositoryNode node=(RepositoryNode)o;
    if (RepositoryManager.isOpenedItemInEditor(node.getObject())) {
      canWork=false;
    }
 else {
switch (node.getType()) {
case REPOSITORY_ELEMENT:
        if (node.getObjectType() != ERepositoryObjectType.PROCESS) {
          canWork=false;
        }
      break;
default :
    canWork=false;
}
}
}
setEnabled(canWork);
}

Fixed version (ground truth):
@Override public void init(TreeViewer viewer,IStructuredSelection selection){
  boolean canWork=!selection.isEmpty() && selection.size() == 1;
  if (canWork) {
    Object o=selection.getFirstElement();
    RepositoryNode node=(RepositoryNode)o;
    if (RepositoryManager.isOpenedItemInEditor(node.getObject())) {
      canWork=false;
    }
 else {
switch (node.getType()) {
case REPOSITORY_ELEMENT:
        if (node.getObjectType() != ERepositoryObjectType.PROCESS) {
          canWork=false;
        }
      break;
default :
    canWork=false;
}
}
if (canWork && node.getObject() != null && ProxyRepositoryFactory.getInstance().getStatus(node.getObject()) == ERepositoryStatus.LOCK_BY_USER) {
canWork=false;
}
}
setEnabled(canWork);
}
Program: 121115
Project: 121115
Buggy source:
@Override public void run(){
  FOXTreeNode node=(FOXTreeNode)this.getStructuredSelection().getFirstElement();
  if (createChildNode(node)) {
    foxui.redrawLinkers();
  }
}

Fixed version (ground truth):
@Override public void run(){
  FOXTreeNode node=(FOXTreeNode)this.getStructuredSelection().getFirstElement();
  if (node != null && createChildNode(node)) {
    foxui.redrawLinkers();
  }
}
Program: 121120
Project: 121120
Buggy source:
public void undo(){
  connection.setName(oldName);
  IElementParameter elementParameter=connection.getElementParameter(EParameterName.UNIQUE_NAME.getName());
  if (elementParameter != null) {
    if ("String_Node_Str".equals(connection.getConnectorName())) {
      connection.setPropertyValue(EParameterName.UNIQUE_NAME.getName(),oldMetaName);
    }
 else {
      connection.setPropertyValue(EParameterName.UNIQUE_NAME.getName(),oldName);
    }
  }
  if (connection.getLineStyle().hasConnectionCategory(IConnectionCategory.UNIQUE_NAME)) {
    connection.getSource().getProcess().removeUniqueConnectionName(newName);
    connection.getSource().getProcess().addUniqueConnectionName(oldName);
  }
  IExternalNode externalNode=connection.getTarget().getExternalNode();
  if (externalNode != null) {
    externalNode.renameInputConnection(newName,oldName);
  }
  externalNode=connection.getSource().getExternalNode();
  if (externalNode != null) {
    externalNode.renameOutputConnection(newName,oldName);
  }
  ((Process)connection.getSource().getProcess()).checkProcess();
}

Fixed version (ground truth):
public void undo(){
  connection.setName(oldName);
  IElementParameter elementParameter=connection.getElementParameter(EParameterName.UNIQUE_NAME.getName());
  if (elementParameter != null) {
    if ("String_Node_Str".equals(connection.getConnectorName())) {
      connection.setPropertyValue(EParameterName.UNIQUE_NAME.getName(),oldMetaName);
    }
 else {
      connection.setPropertyValue(EParameterName.UNIQUE_NAME.getName(),oldName);
    }
  }
  if (connection.getLineStyle().hasConnectionCategory(IConnectionCategory.UNIQUE_NAME)) {
    connection.getSource().getProcess().removeUniqueConnectionName(newName);
    connection.getSource().getProcess().addUniqueConnectionName(oldName);
  }
  ConnectionListController.renameConnectionInElement(newName,oldName,connection.getSource());
  IExternalNode externalNode=connection.getTarget().getExternalNode();
  if (externalNode != null) {
    externalNode.renameInputConnection(newName,oldName);
  }
  externalNode=connection.getSource().getExternalNode();
  if (externalNode != null) {
    externalNode.renameOutputConnection(newName,oldName);
  }
  ((Process)connection.getSource().getProcess()).checkProcess();
}
Program: 121121
Project: 121121
Buggy source:
/** 
 * DOC ycbai Get default util classpath entries.
 * @return
 */
private List<IClasspathEntry> getDefaultUtilClasspathEntries(){
  List<IClasspathEntry> ces=new ArrayList<IClasspathEntry>();
  addLibClasspathEntries(ces,"String_Node_Str");
  addLibClasspathEntries(ces,"String_Node_Str");
  addLibClasspathEntries(ces,"String_Node_Str");
  addLibClasspathEntries(ces,"String_Node_Str");
  addLibClasspathEntries(ces,"String_Node_Str");
  return ces;
}

Fixed version (ground truth):
/** 
 * DOC ycbai Get default util classpath entries.
 * @return
 */
private List<IClasspathEntry> getDefaultUtilClasspathEntries(){
  List<IClasspathEntry> ces=new ArrayList<IClasspathEntry>();
  addLibClasspathEntries(ces,"String_Node_Str");
  addLibClasspathEntries(ces,"String_Node_Str");
  addLibClasspathEntries(ces,"String_Node_Str");
  addLibClasspathEntries(ces,"String_Node_Str");
  return ces;
}
Program: 121123
Project: 121123
Buggy source:
public void run(IProgressMonitor monitor) throws InvocationTargetException {
  monitor.beginTask("String_Node_Str",4);
  try {
    IJavaProject javaProject=JavaCore.create(project);
    JavaUtils.addJavaNature(project,new SubProgressMonitor(monitor,1));
    initializeClasspath(javaProject,new SubProgressMonitor(monitor,3));
  }
 catch (  OperationCanceledException e) {
    e.printStackTrace();
  }
catch (  CoreException e) {
    e.printStackTrace();
  }
 finally {
    monitor.done();
  }
}

Fixed version (ground truth):
@Override public void run(IProgressMonitor monitor) throws InvocationTargetException {
  monitor.beginTask("String_Node_Str",4);
  try {
    IJavaProject javaProject=JavaCore.create(project);
    JavaUtils.addJavaNature(project,new SubProgressMonitor(monitor,1));
    initializeClasspath(javaProject,new SubProgressMonitor(monitor,3));
  }
 catch (  OperationCanceledException e) {
    e.printStackTrace();
  }
catch (  CoreException e) {
    e.printStackTrace();
  }
 finally {
    monitor.done();
  }
}
Program: 121124
Project: 121124
Buggy source:
/** 
 * DOC ycbai Convert the project to java project and initialize its classpath.
 * @param project
 * @param shell
 */
public void configProject(final IProject project,Shell shell){
  IRunnableWithProgress op=new IRunnableWithProgress(){
    public void run(    IProgressMonitor monitor) throws InvocationTargetException {
      monitor.beginTask("String_Node_Str",4);
      try {
        IJavaProject javaProject=JavaCore.create(project);
        JavaUtils.addJavaNature(project,new SubProgressMonitor(monitor,1));
        initializeClasspath(javaProject,new SubProgressMonitor(monitor,3));
      }
 catch (      OperationCanceledException e) {
        e.printStackTrace();
      }
catch (      CoreException e) {
        e.printStackTrace();
      }
 finally {
        monitor.done();
      }
    }
  }
;
  try {
    ProgressUI.popProgressDialog(op,shell);
  }
 catch (  InvocationTargetException e) {
    e.printStackTrace();
  }
catch (  InterruptedException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * DOC ycbai Convert the project to java project and initialize its classpath.
 * @param project
 * @param shell
 */
public void configProject(final IProject project,Shell shell){
  IRunnableWithProgress op=new IRunnableWithProgress(){
    @Override public void run(    IProgressMonitor monitor) throws InvocationTargetException {
      monitor.beginTask("String_Node_Str",4);
      try {
        IJavaProject javaProject=JavaCore.create(project);
        JavaUtils.addJavaNature(project,new SubProgressMonitor(monitor,1));
        initializeClasspath(javaProject,new SubProgressMonitor(monitor,3));
      }
 catch (      OperationCanceledException e) {
        e.printStackTrace();
      }
catch (      CoreException e) {
        e.printStackTrace();
      }
 finally {
        monitor.done();
      }
    }
  }
;
  try {
    ProgressUI.popProgressDialog(op,shell);
  }
 catch (  InvocationTargetException e) {
    e.printStackTrace();
  }
catch (  InterruptedException e) {
    e.printStackTrace();
  }
}
Program: 121125
Project: 121125
Buggy source:
/** 
 * DOC ycbai Initialize classpath of project.
 * @param project
 * @param monitor
 * @throws OperationCanceledException
 * @throws CoreException
 */
private void initializeClasspath(IJavaProject project,IProgressMonitor monitor) throws OperationCanceledException, CoreException {
  if (monitor != null && monitor.isCanceled()) {
    throw new OperationCanceledException();
  }
  if (project == null)   return;
  IClasspathEntry[] entries=null;
  List<IClasspathEntry> cpEntries=new ArrayList<IClasspathEntry>();
  cpEntries.addAll(Arrays.asList(getDefaultJREClasspathEntries()));
  cpEntries.addAll(getDefaultUtilClasspathEntries());
  entries=(IClasspathEntry[])cpEntries.toArray(new IClasspathEntry[cpEntries.size()]);
  if (monitor != null)   monitor.worked(1);
  IPath output=getOutputLocation();
  IProgressMonitor subProgressMonitor=monitor == null ? new NullProgressMonitor() : new SubProgressMonitor(monitor,2);
  project.setRawClasspath(entries,output,subProgressMonitor);
}

Fixed version (ground truth):
/** 
 * DOC ycbai Initialize classpath of project.
 * @param project
 * @param monitor
 * @throws OperationCanceledException
 * @throws CoreException
 */
private void initializeClasspath(IJavaProject project,IProgressMonitor monitor) throws OperationCanceledException, CoreException {
  if (monitor != null && monitor.isCanceled()) {
    throw new OperationCanceledException();
  }
  if (project == null) {
    return;
  }
  IClasspathEntry[] entries=null;
  List<IClasspathEntry> cpEntries=new ArrayList<IClasspathEntry>();
  cpEntries.addAll(Arrays.asList(getDefaultJREClasspathEntries()));
  cpEntries.addAll(getDefaultUtilClasspathEntries());
  entries=cpEntries.toArray(new IClasspathEntry[cpEntries.size()]);
  if (monitor != null) {
    monitor.worked(1);
  }
  IPath output=getOutputLocation();
  IProgressMonitor subProgressMonitor=monitor == null ? new NullProgressMonitor() : new SubProgressMonitor(monitor,2);
  project.setRawClasspath(entries,output,subProgressMonitor);
}
Program: 121128
Project: 121128
Buggy source:
private void judegeMultiIsSimple(){
  if (this.rootPath.indexOf("String_Node_Str") >= 0 || this.rootPath.indexOf("String_Node_Str") >= 0) {
    this.isSimpleParse=false;
  }
  for (int i=0; isSimpleParse && i < arrOrigLoopPath.length; i++) {
    if (arrOrigLoopPath[i].indexOf("String_Node_Str") >= 0 || arrOrigLoopPath[i].indexOf("String_Node_Str") >= 0) {
      this.isSimpleParse=false;
      break;
    }
  }
  for (int i=0; isSimpleParse && i < arrNodePaths.length; i++) {
    for (int j=0; j < arrNodePaths[i].length; j++) {
      if (arrNodePaths[i][j].indexOf("String_Node_Str") >= 0 || arrNodePaths[i][j].indexOf("String_Node_Str") >= 0) {
        this.isSimpleParse=false;
        break;
      }
    }
  }
  this.isSimpleParse=false;
  if (this.isSimpleParse) {
    looper=new SimpleSAXLooper(rootPath,arrOrigLoopPath,arrNodePaths);
  }
 else {
    looper=new ComplexSAXLooper(rootPath,arrOrigLoopPath,arrNodePaths);
  }
}

Fixed version (ground truth):
private void judegeMultiIsSimple(){
  isSimpleParse=isSimplePath(rootPath);
  for (  String path : arrOrigLoopPath) {
    if (!isSimpleParse) {
      break;
    }
    isSimpleParse=isSimplePath(path);
  }
  for (  String[] arrNodePath : arrNodePaths) {
    for (    String path : arrNodePath) {
      if (!isSimpleParse) {
        break;
      }
      isSimpleParse=isSimplePath(path);
    }
    if (!isSimpleParse) {
      break;
    }
  }
  if (this.isSimpleParse) {
    looper=new SimpleSAXLooper(rootPath,arrOrigLoopPath,arrNodePaths);
  }
 else {
    looper=new ComplexSAXLooper(rootPath,arrOrigLoopPath,arrNodePaths);
  }
}
Program: 121129
Project: 121129
Buggy source:
protected void performApply(){
  super.performApply();
}

Fixed version (ground truth):
@Override protected void performApply(){
  super.performApply();
}
Program: 121130
Project: 121130
Buggy source:
public boolean performOk(){
  ComponentDesigenerPlugin.getDefault().creatComponentProj(filePathTemp.getStringValue());
  return super.performOk();
}

Fixed version (ground truth):
@Override public boolean performOk(){
  ComponentDesigenerPlugin.getDefault().creatComponentProj(filePathTemp.getStringValue());
  return super.performOk();
}
Program: 121131
Project: 121131
Buggy source:
public void init(IWorkbench workbench){
}

Fixed version (ground truth):
@Override public void init(IWorkbench workbench){
}
Program: 121132
Project: 121132
Buggy source:
public void createFieldEditors(){
  Label l=new Label(getFieldEditorParent(),SWT.NONE);
  l.setText(Messages.getString("String_Node_Str"));
  GridData gd=new GridData();
  gd.horizontalSpan=3;
  l.setLayoutData(gd);
  filePathTemp=new DirectoryFieldEditor(PluginConstant.PROJECT_URL,Messages.getString("String_Node_Str"),getFieldEditorParent());
  addField(filePathTemp);
}

Fixed version (ground truth):
@Override public void createFieldEditors(){
  Label l=new Label(getFieldEditorParent(),SWT.NONE);
  l.setText(Messages.getString("String_Node_Str"));
  GridData gd=new GridData();
  gd.horizontalSpan=3;
  l.setLayoutData(gd);
  filePathTemp=new DirectoryFieldEditor(PluginConstant.PROJECT_URL,Messages.getString("String_Node_Str"),getFieldEditorParent());
  addField(filePathTemp);
  filePathTemp.getTextControl(getFieldEditorParent()).addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      String newPath=filePathTemp.getTextControl(getFieldEditorParent()).getText();
      File file=new File(newPath);
      if (!file.exists() && !"String_Node_Str".equals(newPath)) {
        filePathTemp.showErrorMessage();
        setValid(false);
      }
 else {
        setValid(true);
      }
    }
  }
);
}
Program: 121133
Project: 121133
Buggy source:
public void propertyChange(PropertyChangeEvent event){
  super.propertyChange(event);
  MessageDialog warningMessageDialog=new MessageDialog(getFieldEditorParent().getShell(),Messages.getString("String_Node_Str"),null,Messages.getString("String_Node_Str"),MessageDialog.WARNING,new String[]{Messages.getString("String_Node_Str")},0);
  warningMessageDialog.open();
}

Fixed version (ground truth):
@Override public void propertyChange(PropertyChangeEvent event){
  super.propertyChange(event);
  MessageDialog warningMessageDialog=new MessageDialog(getFieldEditorParent().getShell(),Messages.getString("String_Node_Str"),null,Messages.getString("String_Node_Str"),MessageDialog.WARNING,new String[]{Messages.getString("String_Node_Str")},0);
  warningMessageDialog.open();
}
Program: 121135
Project: 121135
Buggy source:
@Override public void contributeToToolBar(final IToolBarManager toolBarManager){
  toolBarManager.add(getAction(ActionFactory.UNDO.getId()));
  toolBarManager.add(getAction(ActionFactory.REDO.getId()));
  toolBarManager.add(getAction(ToggleSubjobsAction.ID));
  String[] zoomStrings=new String[]{ZoomManager.FIT_ALL,ZoomManager.FIT_HEIGHT,ZoomManager.FIT_WIDTH};
  toolBarManager.add(new ZoomComboContributionItem(getPage(),zoomStrings));
}

Fixed version (ground truth):
@Override public void contributeToToolBar(final IToolBarManager toolBarManager){
  toolBarManager.add(getAction(ActionFactory.UNDO.getId()));
  toolBarManager.add(getAction(ActionFactory.REDO.getId()));
  toolBarManager.add(getAction(ToggleSubjobsAction.ID));
  String[] zoomStrings=new String[]{ZoomManager.FIT_ALL,ZoomManager.FIT_HEIGHT,ZoomManager.FIT_WIDTH};
  item=new ZoomComboContributionItem(getPage(),zoomStrings);
  toolBarManager.add(item);
}
Program: 121136
Project: 121136
Buggy source:
public void init(IWorkbench workbench){
}

Fixed version (ground truth):
@Override public void init(IWorkbench workbench){
}
Program: 121137
Project: 121137
Buggy source:
public void createFieldEditors(){
  final Composite parent=getFieldEditorParent();
  filePathTemp=new DirectoryFieldEditor(IComponentPreferenceConstant.USER_COMPONENTS_FOLDER,Messages.getString("String_Node_Str"),parent);
  addField(filePathTemp);
  filePathTemp.getTextControl(parent).addModifyListener(new ModifyListener(){
    String oldPath=getPreferenceStore().getString(IComponentPreferenceConstant.USER_COMPONENTS_FOLDER);
    public void modifyText(    ModifyEvent e){
      String newPath=filePathTemp.getTextControl(parent).getText();
      File file=new File(newPath);
      if (!file.exists()) {
        filePathTemp.showErrorMessage();
        setValid(false);
      }
 else {
        setValid(true);
      }
    }
  }
);
  if (PluginChecker.isPreviewPluginLoaded()) {
    createForDataViewer(parent);
  }
  createForMapper(parent);
  createFortRunJob(parent);
  if (PluginChecker.isJobLetPluginLoaded()) {
    createForJoblet(parent);
  }
  parent.pack();
}

Fixed version (ground truth):
@Override public void createFieldEditors(){
  final Composite parent=getFieldEditorParent();
  filePathTemp=new DirectoryFieldEditor(IComponentPreferenceConstant.USER_COMPONENTS_FOLDER,Messages.getString("String_Node_Str"),parent);
  addField(filePathTemp);
  filePathTemp.getTextControl(parent).addModifyListener(new ModifyListener(){
    String oldPath=getPreferenceStore().getString(IComponentPreferenceConstant.USER_COMPONENTS_FOLDER);
    @Override public void modifyText(    ModifyEvent e){
      String newPath=filePathTemp.getTextControl(parent).getText();
      File file=new File(newPath);
      if (!file.exists() && !"String_Node_Str".equals(newPath)) {
        filePathTemp.showErrorMessage();
        setValid(false);
      }
 else {
        setValid(true);
      }
    }
  }
);
  if (PluginChecker.isPreviewPluginLoaded()) {
    createForDataViewer(parent);
  }
  createForMapper(parent);
  createFortRunJob(parent);
  if (PluginChecker.isJobLetPluginLoaded()) {
    createForJoblet(parent);
  }
  parent.pack();
}
Program: 121138
Project: 121138
Buggy source:
public void run(){
  IComponentsFactory components=ComponentsFactoryProvider.getInstance();
  components.loadUserComponentsFromComponentsProviderExtension();
  CorePlugin.getDefault().getLibrariesService().syncLibraries(monitor);
  monitor.worked(50);
  CorePlugin.getDefault().getLibrariesService().resetModulesNeeded();
  ComponentUtilities.updatePalette();
  ICodeGeneratorService service=(ICodeGeneratorService)GlobalServiceRegister.getDefault().getService(ICodeGeneratorService.class);
  service.refreshTemplates();
  monitor.worked(100);
  monitor.done();
}

Fixed version (ground truth):
@Override public void run(){
  IComponentsFactory components=ComponentsFactoryProvider.getInstance();
  components.loadUserComponentsFromComponentsProviderExtension();
  CorePlugin.getDefault().getLibrariesService().syncLibraries(monitor);
  monitor.worked(50);
  CorePlugin.getDefault().getLibrariesService().resetModulesNeeded();
  ComponentUtilities.updatePalette();
  ICodeGeneratorService service=(ICodeGeneratorService)GlobalServiceRegister.getDefault().getService(ICodeGeneratorService.class);
  service.refreshTemplates();
  monitor.worked(100);
  monitor.done();
}
Program: 121139
Project: 121139
Buggy source:
/** 
 * @see org.eclipse.jface.preference.FieldEditor#refreshValidState()
 */
protected void refreshValidState(){
  super.refreshValidState();
}

Fixed version (ground truth):
/** 
 * @see org.eclipse.jface.preference.FieldEditor#refreshValidState()
 */
@Override protected void refreshValidState(){
  super.refreshValidState();
}
Program: 121141
Project: 121141
Buggy source:
public void modifyText(ModifyEvent e){
  String newPath=filePathTemp.getTextControl(parent).getText();
  File file=new File(newPath);
  if (!file.exists()) {
    filePathTemp.showErrorMessage();
    setValid(false);
  }
 else {
    setValid(true);
  }
}

Fixed version (ground truth):
@Override public void modifyText(ModifyEvent e){
  String newPath=filePathTemp.getTextControl(parent).getText();
  File file=new File(newPath);
  if (!file.exists() && !"String_Node_Str".equals(newPath)) {
    filePathTemp.showErrorMessage();
    setValid(false);
  }
 else {
    setValid(true);
  }
}
Program: 121142
Project: 121142
Buggy source:
public void propertyChange(PropertyChangeEvent event){
  if (event.getSource() == filePathTemp) {
  }
 else {
    Object nValue=event.getNewValue();
    if (event.getProperty().equals(FieldEditor.IS_VALID)) {
      boolean newValue=((Boolean)nValue).booleanValue();
      if (newValue) {
        checkState();
      }
 else {
        super.propertyChange(event);
      }
    }
 else {
      super.propertyChange(event);
    }
  }
}

Fixed version (ground truth):
@Override public void propertyChange(PropertyChangeEvent event){
  if (event.getSource() == filePathTemp) {
  }
 else {
    Object nValue=event.getNewValue();
    if (event.getProperty().equals(FieldEditor.IS_VALID)) {
      boolean newValue=((Boolean)nValue).booleanValue();
      if (newValue) {
        checkState();
      }
 else {
        super.propertyChange(event);
      }
    }
 else {
      super.propertyChange(event);
    }
  }
}
Program: 121143
Project: 121143
Buggy source:
/** 
 * Clears the error message from the message line if the error message is the error message from this field editor.
 */
protected void clearErrorMessage(){
  if (canClearErrorMessage()) {
    super.clearErrorMessage();
  }
}

Fixed version (ground truth):
/** 
 * Clears the error message from the message line if the error message is the error message from this field editor.
 */
@Override protected void clearErrorMessage(){
  if (canClearErrorMessage()) {
    super.clearErrorMessage();
  }
}
Program: 121144
Project: 121144
Buggy source:
private void judegeMultiIsSimple(){
  if (this.rootPath.indexOf("String_Node_Str") >= 0 || this.rootPath.indexOf("String_Node_Str") >= 0) {
    this.isSimpleParse=false;
  }
  for (int i=0; isSimpleParse && i < arrOrigLoopPath.length; i++) {
    if (arrOrigLoopPath[i].indexOf("String_Node_Str") >= 0 || arrOrigLoopPath[i].indexOf("String_Node_Str") >= 0) {
      this.isSimpleParse=false;
      break;
    }
  }
  for (int i=0; isSimpleParse && i < arrNodePaths.length; i++) {
    for (int j=0; j < arrNodePaths[i].length; j++) {
      if (arrNodePaths[i][j].indexOf("String_Node_Str") >= 0 || arrNodePaths[i][j].indexOf("String_Node_Str") >= 0) {
        this.isSimpleParse=false;
        break;
      }
    }
  }
  this.isSimpleParse=false;
  if (this.isSimpleParse) {
    looper=new SimpleSAXLooper(rootPath,arrOrigLoopPath,arrNodePaths);
  }
 else {
    looper=new ComplexSAXLooper(rootPath,arrOrigLoopPath,arrNodePaths);
  }
}

Fixed version (ground truth):
private void judegeMultiIsSimple(){
  isSimpleParse=isSimplePath(rootPath);
  for (  String path : arrOrigLoopPath) {
    if (!isSimpleParse) {
      break;
    }
    isSimpleParse=isSimplePath(path);
  }
  for (  String[] arrNodePath : arrNodePaths) {
    for (    String path : arrNodePath) {
      if (!isSimpleParse) {
        break;
      }
      isSimpleParse=isSimplePath(path);
    }
    if (!isSimpleParse) {
      break;
    }
  }
  if (this.isSimpleParse) {
    looper=new SimpleSAXLooper(rootPath,arrOrigLoopPath,arrNodePaths);
  }
 else {
    looper=new ComplexSAXLooper(rootPath,arrOrigLoopPath,arrNodePaths);
  }
}
Program: 121147
Project: 121147
Buggy source:
@Override protected boolean calculateEnabled(){
  List objects=getSelectedObjects();
  if (!objects.isEmpty()) {
    for (    Object o : objects) {
      if (o instanceof ConnLabelEditPart) {
        return false;
      }
    }
  }
  return getCommandStack().canRedo();
}

Fixed version (ground truth):
@Override protected boolean calculateEnabled(){
  List objects=getSelectedObjects();
  if (!objects.isEmpty()) {
    for (    Object o : objects) {
      if (o instanceof ConnLabelEditPart) {
        return false;
      }
      if (o instanceof NoteEditPart) {
        return false;
      }
      if (o instanceof NodeLabelEditPart) {
        return false;
      }
    }
  }
  return getCommandStack().canRedo();
}
Program: 121148
Project: 121148
Buggy source:
@Override protected boolean calculateEnabled(){
  List objects=getSelectedObjects();
  if (!objects.isEmpty()) {
    for (    Object o : objects) {
      if (o instanceof ConnLabelEditPart) {
        return true;
      }
    }
  }
  return getCommandStack().canUndo();
}

Fixed version (ground truth):
@Override protected boolean calculateEnabled(){
  List objects=getSelectedObjects();
  if (!objects.isEmpty()) {
    for (    Object o : objects) {
      if (o instanceof ConnLabelEditPart) {
        return false;
      }
      if (o instanceof NoteEditPart) {
        return false;
      }
      if (o instanceof NodeLabelEditPart) {
        return false;
      }
    }
  }
  return getCommandStack().canUndo();
}