Program: 126929
Project: 126929
Buggy source:
@Override public void init(TreeViewer viewer,IStructuredSelection selection){
  boolean enabled=true;
  Object targetObject=selection.getFirstElement();
  if (!(targetObject instanceof RepositoryNode)) {
    setEnabled(false);
    return;
  }
  RepositoryNode target=(RepositoryNode)targetObject;
  if (!(LocalSelectionTransfer.getTransfer().getSelection() instanceof TreeSelection)) {
    setEnabled(false);
    return;
  }
  if (target.isBin()) {
    setEnabled(false);
    return;
  }
  if (target.getObject() != null && target.getObject().getProperty() != null && target.getObject().getProperty().getItem() != null) {
    Item item=target.getObject().getProperty().getItem();
    if (item.getState() != null && item.getState().isDeleted()) {
      setEnabled(false);
      return;
    }
  }
  TreeSelection selectionInClipboard=(TreeSelection)LocalSelectionTransfer.getTransfer().getSelection();
  IProxyRepositoryFactory proxyFactory=ProxyRepositoryFactory.getInstance();
  IRepositoryViewObject object=target.getObject();
  if (target.getContentType() == ERepositoryObjectType.JOBS || target.getContentType() == ERepositoryObjectType.JOBLETS || target.getContentType() == ERepositoryObjectType.GENERATED || target.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.JOB_DOC || target.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.JOBLET_DOC || target.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.REFERENCED_PROJECTS) {
    visible=false;
    enabled=false;
  }
 else   if (object != null) {
    if (target != null && proxyFactory.getStatus(object) == ERepositoryStatus.READ_ONLY) {
      enabled=false;
      visible=false;
    }
 else     if (target != null && object instanceof Folder && enabled) {
      visible=true;
    }
  }
 else   if (isReferencedProject(target)) {
    visible=false;
    enabled=false;
  }
  if (enabled && selectionInClipboard != null && !((StructuredSelection)selectionInClipboard).isEmpty()) {
    visible=true;
    ERepositoryObjectType objectType=null;
    for (    Object obj : ((StructuredSelection)selectionInClipboard).toArray()) {
      if (enabled) {
        if (!(obj instanceof RepositoryNode)) {
          enabled=false;
          break;
        }
        RepositoryNode sourceNode=(RepositoryNode)obj;
        ERepositoryObjectType type=sourceNode.getObjectType();
        if (objectType != null && objectType != type) {
          enabled=false;
          break;
        }
 else {
          objectType=type;
        }
        if (CopyObjectAction.getInstance().validateAction(sourceNode,target)) {
          enabled=true;
        }
 else {
          enabled=false;
        }
      }
 else {
        break;
      }
    }
  }
 else {
    enabled=false;
    visible=false;
  }
  if (GlobalServiceRegister.getDefault().isServiceRegistered(ICDCProviderService.class)) {
    ICDCProviderService cdcService=(ICDCProviderService)GlobalServiceRegister.getDefault().getService(ICDCProviderService.class);
    if (cdcService != null && cdcService.isSubscriberTableNode(target)) {
      enabled=false;
      visible=false;
    }
  }
  setEnabled(enabled);
}

Fixed version (ground truth):
@Override public void init(TreeViewer viewer,IStructuredSelection selection){
  boolean enabled=true;
  Object targetObject=selection.getFirstElement();
  if (!(targetObject instanceof RepositoryNode)) {
    setEnabled(false);
    return;
  }
  RepositoryNode target=(RepositoryNode)targetObject;
  if (!(LocalSelectionTransfer.getTransfer().getSelection() instanceof TreeSelection)) {
    setEnabled(false);
    return;
  }
  if (target.isBin()) {
    setEnabled(false);
    return;
  }
  if (target.getObject() != null && target.getObject().getProperty() != null && target.getObject().getProperty().getItem() != null) {
    Item item=target.getObject().getProperty().getItem();
    if (item.getState() != null && item.getState().isDeleted()) {
      setEnabled(false);
      return;
    }
  }
  TreeSelection selectionInClipboard=(TreeSelection)LocalSelectionTransfer.getTransfer().getSelection();
  IProxyRepositoryFactory proxyFactory=ProxyRepositoryFactory.getInstance();
  IRepositoryViewObject object=target.getObject();
  if (target.getContentType() == ERepositoryObjectType.JOBS || target.getContentType() == ERepositoryObjectType.JOBLETS || target.getContentType() == ERepositoryObjectType.GENERATED || target.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.JOB_DOC || target.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.JOBLET_DOC || target.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.REFERENCED_PROJECTS || (target.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.METADATA_VALIDATION_RULES && target.getParent().getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.METADATA_VALIDATIONS_RULES_FOLDER)) {
    visible=false;
    enabled=false;
  }
 else   if (object != null) {
    if (target != null && proxyFactory.getStatus(object) == ERepositoryStatus.READ_ONLY) {
      enabled=false;
      visible=false;
    }
 else     if (target != null && object instanceof Folder && enabled) {
      visible=true;
    }
  }
 else   if (isReferencedProject(target)) {
    visible=false;
    enabled=false;
  }
  if (enabled && selectionInClipboard != null && !((StructuredSelection)selectionInClipboard).isEmpty()) {
    visible=true;
    ERepositoryObjectType objectType=null;
    for (    Object obj : ((StructuredSelection)selectionInClipboard).toArray()) {
      if (enabled) {
        if (!(obj instanceof RepositoryNode)) {
          enabled=false;
          break;
        }
        RepositoryNode sourceNode=(RepositoryNode)obj;
        ERepositoryObjectType type=sourceNode.getObjectType();
        if (objectType != null && objectType != type) {
          enabled=false;
          break;
        }
 else {
          objectType=type;
        }
        if (CopyObjectAction.getInstance().validateAction(sourceNode,target)) {
          enabled=true;
        }
 else {
          enabled=false;
        }
      }
 else {
        break;
      }
    }
  }
 else {
    enabled=false;
    visible=false;
  }
  if (GlobalServiceRegister.getDefault().isServiceRegistered(ICDCProviderService.class)) {
    ICDCProviderService cdcService=(ICDCProviderService)GlobalServiceRegister.getDefault().getService(ICDCProviderService.class);
    if (cdcService != null && cdcService.isSubscriberTableNode(target)) {
      enabled=false;
      visible=false;
    }
  }
  setEnabled(enabled);
}