Program: 127048
Project: 127048
Buggy source:
protected void fillMenu(Menu menu){
  IRepositoryView repositoryView=RepositoryManagerHelper.findRepositoryView();
  if (repositoryView == null) {
    return;
  }
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.PROCESS)) {
    IDesignerCoreService service=(IDesignerCoreService)GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
    addToMenu(menu,service.getCreateProcessAction(true),-1);
  }
  IExtensionRegistry registry=Platform.getExtensionRegistry();
  IConfigurationElement[] configurationElements=registry.getConfigurationElementsFor("String_Node_Str");
  for (  IConfigurationElement element : configurationElements) {
    try {
      AContextualAction action=(AContextualAction)element.createExecutableExtension("String_Node_Str");
      action.setToolbar(true);
      action.setWorkbenchPart(repositoryView);
      addToMenu(menu,action,-1);
    }
 catch (    CoreException e) {
      ExceptionHandler.process(e);
    }
  }
  addSeparator(menu);
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.BUSINESS_PROCESS)) {
    IRepositoryNode businessNode=repositoryView.getRoot().getRootRepositoryNode(ERepositoryObjectType.BUSINESS_PROCESS);
    List<IRepositoryNode> children=repositoryView.getRoot().getChildren();
    boolean flag=false;
    for (    IRepositoryNode node : children) {
      if (node.getLabel().equals(businessNode.getLabel())) {
        flag=true;
        break;
      }
    }
    if (flag) {
      IDiagramModelService service=(IDiagramModelService)GlobalServiceRegister.getDefault().getService(IDiagramModelService.class);
      addToMenu(menu,service.getCreateDiagramAction(true),-1);
      addSeparator(menu);
    }
  }
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.METADATA_CONNECTIONS)) {
    final CreateConnectionAction createConnectionAction=new CreateConnectionAction(true);
    createConnectionAction.setWorkbenchPart(repositoryView);
    addToMenu(menu,createConnectionAction,-1);
  }
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.METADATA_FILE_DELIMITED)) {
    final CreateFileDelimitedAction createFileDelimitedAction=new CreateFileDelimitedAction(true);
    createFileDelimitedAction.setWorkbenchPart(repositoryView);
    addToMenu(menu,createFileDelimitedAction,-1);
  }
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.METADATA_FILE_POSITIONAL)) {
    final CreateFilePositionalAction createFilePositionalAction=new CreateFilePositionalAction(true);
    createFilePositionalAction.setWorkbenchPart(repositoryView);
    addToMenu(menu,createFilePositionalAction,-1);
  }
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.METADATA_FILE_REGEXP)) {
    final CreateFileRegexpAction createFileRegexpAction=new CreateFileRegexpAction(true);
    createFileRegexpAction.setWorkbenchPart(repositoryView);
    addToMenu(menu,createFileRegexpAction,-1);
  }
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.METADATA_FILE_XML)) {
    final CreateFileXmlAction createFileXmlAction=new CreateFileXmlAction(true);
    createFileXmlAction.setWorkbenchPart(repositoryView);
    addToMenu(menu,createFileXmlAction,-1);
  }
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.METADATA_FILE_EXCEL)) {
    final CreateFileExcelAction createFileExcelAction=new CreateFileExcelAction(true);
    createFileExcelAction.setWorkbenchPart(repositoryView);
    addToMenu(menu,createFileExcelAction,-1);
  }
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.METADATA_FILE_LDIF)) {
    IRepositoryNode metadataNode=repositoryView.getRoot().getRootRepositoryNode(ERepositoryObjectType.METADATA);
    IRepositoryNode ldifNode=repositoryView.getRoot().getRootRepositoryNode(ERepositoryObjectType.METADATA_FILE_LDIF);
    List<IRepositoryNode> children=repositoryView.getRoot().getChildren();
    boolean flag1=false;
    IRepositoryNode metadata=null;
    for (    IRepositoryNode node : children) {
      if (node.getLabel().equals(metadataNode.getLabel())) {
        flag1=true;
        metadata=node;
        break;
      }
    }
    if (flag1) {
      List<IRepositoryNode> metadataChild=metadata.getChildren();
      boolean flag2=false;
      for (      IRepositoryNode node : metadataChild) {
        if (node.getLabel().equals(ldifNode.getLabel())) {
          flag2=true;
          break;
        }
      }
      if (flag2) {
        final CreateFileLdifAction createFileLdifAction=new CreateFileLdifAction(true);
        createFileLdifAction.setWorkbenchPart(repositoryView);
        addToMenu(menu,createFileLdifAction,-1);
      }
    }
  }
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.METADATA_LDAP_SCHEMA)) {
    IRepositoryNode metadataNode=repositoryView.getRoot().getRootRepositoryNode(ERepositoryObjectType.METADATA);
    IRepositoryNode ldapNode=repositoryView.getRoot().getRootRepositoryNode(ERepositoryObjectType.METADATA_LDAP_SCHEMA);
    List<IRepositoryNode> children=repositoryView.getRoot().getChildren();
    boolean flag1=false;
    IRepositoryNode metadata=null;
    for (    IRepositoryNode node : children) {
      if (node.getLabel().equals(metadataNode.getLabel())) {
        flag1=true;
        metadata=node;
        break;
      }
    }
    if (flag1) {
      List<IRepositoryNode> metadataChild=metadata.getChildren();
      boolean flag2=false;
      for (      IRepositoryNode node : metadataChild) {
        if (node.getLabel().equals(ldapNode.getLabel())) {
          flag2=true;
          break;
        }
      }
      if (flag2) {
        final CreateLDAPSchemaAction createLDAPSchemaAction=new CreateLDAPSchemaAction(true);
        createLDAPSchemaAction.setWorkbenchPart(repositoryView);
        addToMenu(menu,createLDAPSchemaAction,-1);
      }
    }
  }
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.METADATA_SALESFORCE_SCHEMA)) {
    final CreateSalesforceSchemaAction createSalesforceModulesAction=new CreateSalesforceSchemaAction(true);
    createSalesforceModulesAction.setWorkbenchPart(repositoryView);
    addToMenu(menu,createSalesforceModulesAction,-1);
  }
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.METADATA_GENERIC_SCHEMA)) {
    final CreateGenericSchemaAction createGenericSchemaAction=new CreateGenericSchemaAction(true);
    createGenericSchemaAction.setWorkbenchPart(repositoryView);
    addToMenu(menu,createGenericSchemaAction,-1);
  }
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.METADATA_WSDL_SCHEMA)) {
    final CreateWSDLSchemaAction createWSDLSchemaAction=new CreateWSDLSchemaAction(true);
    createWSDLSchemaAction.setWorkbenchPart(repositoryView);
    addToMenu(menu,createWSDLSchemaAction,-1);
  }
  addSeparator(menu);
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.ROUTINES)) {
    IRepositoryService service=(IRepositoryService)GlobalServiceRegister.getDefault().getService(IRepositoryService.class);
    addToMenu(menu,service.getCreateRoutineAction(repositoryView),-1);
  }
}

Fixed version (ground truth):
protected void fillMenu(Menu menu){
  IRepositoryView repositoryView=RepositoryManagerHelper.findRepositoryView();
  if (repositoryView == null) {
    return;
  }
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.PROCESS)) {
    IDesignerCoreService service=(IDesignerCoreService)GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
    addToMenu(menu,service.getCreateProcessAction(true),-1);
  }
  IExtensionRegistry registry=Platform.getExtensionRegistry();
  IConfigurationElement[] configurationElements=registry.getConfigurationElementsFor("String_Node_Str");
  for (  IConfigurationElement element : configurationElements) {
    try {
      AContextualAction action=(AContextualAction)element.createExecutableExtension("String_Node_Str");
      action.setToolbar(true);
      action.setWorkbenchPart(repositoryView);
      addToMenu(menu,action,-1);
    }
 catch (    CoreException e) {
      ExceptionHandler.process(e);
    }
  }
  addSeparator(menu);
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.BUSINESS_PROCESS)) {
    TreeItem[] items=((TreeViewer)repositoryView.getViewer()).getTree().getItems();
    NavigatorContentServiceContentProvider provider=(NavigatorContentServiceContentProvider)((TreeViewer)repositoryView.getViewer()).getContentProvider();
    Object[] objects=provider.getElements(repositoryView.getRoot());
    boolean flag=containsType(objects,ERepositoryObjectType.BUSINESS_PROCESS);
    if (flag) {
      IDiagramModelService service=(IDiagramModelService)GlobalServiceRegister.getDefault().getService(IDiagramModelService.class);
      addToMenu(menu,service.getCreateDiagramAction(true),-1);
      addSeparator(menu);
    }
  }
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.METADATA_CONNECTIONS)) {
    final CreateConnectionAction createConnectionAction=new CreateConnectionAction(true);
    createConnectionAction.setWorkbenchPart(repositoryView);
    addToMenu(menu,createConnectionAction,-1);
  }
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.METADATA_FILE_DELIMITED)) {
    final CreateFileDelimitedAction createFileDelimitedAction=new CreateFileDelimitedAction(true);
    createFileDelimitedAction.setWorkbenchPart(repositoryView);
    addToMenu(menu,createFileDelimitedAction,-1);
  }
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.METADATA_FILE_POSITIONAL)) {
    final CreateFilePositionalAction createFilePositionalAction=new CreateFilePositionalAction(true);
    createFilePositionalAction.setWorkbenchPart(repositoryView);
    addToMenu(menu,createFilePositionalAction,-1);
  }
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.METADATA_FILE_REGEXP)) {
    final CreateFileRegexpAction createFileRegexpAction=new CreateFileRegexpAction(true);
    createFileRegexpAction.setWorkbenchPart(repositoryView);
    addToMenu(menu,createFileRegexpAction,-1);
  }
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.METADATA_FILE_XML)) {
    final CreateFileXmlAction createFileXmlAction=new CreateFileXmlAction(true);
    createFileXmlAction.setWorkbenchPart(repositoryView);
    addToMenu(menu,createFileXmlAction,-1);
  }
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.METADATA_FILE_EXCEL)) {
    final CreateFileExcelAction createFileExcelAction=new CreateFileExcelAction(true);
    createFileExcelAction.setWorkbenchPart(repositoryView);
    addToMenu(menu,createFileExcelAction,-1);
  }
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.METADATA_FILE_LDIF)) {
    TreeItem[] items=((TreeViewer)repositoryView.getViewer()).getTree().getItems();
    NavigatorContentServiceContentProvider provider=(NavigatorContentServiceContentProvider)((TreeViewer)repositoryView.getViewer()).getContentProvider();
    Object[] objects=provider.getElements(repositoryView.getRoot().getRootRepositoryNode(ERepositoryObjectType.METADATA));
    boolean flag=containsType(objects,ERepositoryObjectType.METADATA_FILE_LDIF);
    if (flag) {
      final CreateFileLdifAction createFileLdifAction=new CreateFileLdifAction(true);
      createFileLdifAction.setWorkbenchPart(repositoryView);
      addToMenu(menu,createFileLdifAction,-1);
    }
  }
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.METADATA_LDAP_SCHEMA)) {
    TreeItem[] items=((TreeViewer)repositoryView.getViewer()).getTree().getItems();
    NavigatorContentServiceContentProvider provider=(NavigatorContentServiceContentProvider)((TreeViewer)repositoryView.getViewer()).getContentProvider();
    Object[] objects=provider.getElements(repositoryView.getRoot().getRootRepositoryNode(ERepositoryObjectType.METADATA));
    boolean flag=containsType(objects,ERepositoryObjectType.METADATA_LDAP_SCHEMA);
    if (flag) {
      final CreateLDAPSchemaAction createLDAPSchemaAction=new CreateLDAPSchemaAction(true);
      createLDAPSchemaAction.setWorkbenchPart(repositoryView);
      addToMenu(menu,createLDAPSchemaAction,-1);
    }
  }
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.METADATA_SALESFORCE_SCHEMA)) {
    final CreateSalesforceSchemaAction createSalesforceModulesAction=new CreateSalesforceSchemaAction(true);
    createSalesforceModulesAction.setWorkbenchPart(repositoryView);
    addToMenu(menu,createSalesforceModulesAction,-1);
  }
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.METADATA_GENERIC_SCHEMA)) {
    final CreateGenericSchemaAction createGenericSchemaAction=new CreateGenericSchemaAction(true);
    createGenericSchemaAction.setWorkbenchPart(repositoryView);
    addToMenu(menu,createGenericSchemaAction,-1);
  }
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.METADATA_WSDL_SCHEMA)) {
    final CreateWSDLSchemaAction createWSDLSchemaAction=new CreateWSDLSchemaAction(true);
    createWSDLSchemaAction.setWorkbenchPart(repositoryView);
    addToMenu(menu,createWSDLSchemaAction,-1);
  }
  addSeparator(menu);
  if (repositoryView.containsRepositoryType(ERepositoryObjectType.ROUTINES)) {
    IRepositoryService service=(IRepositoryService)GlobalServiceRegister.getDefault().getService(IRepositoryService.class);
    addToMenu(menu,service.getCreateRoutineAction(repositoryView),-1);
  }
}