private IStatus adjustManifest(final File manifest,final File... manifestFragments){
  if (Arrays2.isEmpty(manifestFragments)) {
    return statusHelper.OK();
  }
  final URI manifestURI=URI.createFileURI(manifest.getAbsolutePath());
  ProjectDescription pd=null;
  for (int i=0; i < manifestFragments.length; i++) {
    File fragment=manifestFragments[i];
    if (fragment.exists() && fragment.isFile()) {
      URI manifestFragmentURI=URI.createFileURI(fragment.getAbsolutePath());
      pd=manifestMerger.mergeContent(manifestFragmentURI,manifestURI);
      fragment.delete();
    }
 else {
      LOGGER.warn("Broken manifest fragment: " + fragment + ".");
    }
  }
  if (pd != null) {
    ResourceSet resourceSet=resourceSetProvider.get();
    Resource resource=resourceSet.getResource(manifestURI,true);
    List<EObject> contents=resource.getContents();
    contents.clear();
    contents.add(pd);
    try {
      resource.save(null);
      return statusHelper.OK();
    }
 catch (    IOException e) {
      final String message="Error while trying to write N4 manifest content for: " + manifestURI + ".";
      LOGGER.error(message,e);
      return statusHelper.createError(message,e);
    }
  }
 else {
    final String message="Failed to merge N4 manifest fragments into '" + manifestURI + "'.";
    LOGGER.error(message);
    return statusHelper.createError(message);
  }
}

private IStatus adjustManifest ( final File manifest , final File ... manifestFragments ) { if ( Arrays2 . isEmpty ( manifestFragments ) ) { return statusHelper . OK ( ) ; } final URI manifestURI = URI . createFileURI ( manifest . getAbsolutePath ( ) ) ; ProjectDescription pd = null ; for ( int i = 0 ; i < manifestFragments . length ; i ++ ) { File fragment = manifestFragments [ i ] ; if ( fragment . exists ( ) && fragment . isFile ( ) ) { URI manifestFragmentURI = URI . createFileURI ( fragment . getAbsolutePath ( ) ) ; pd = manifestMerger . mergeContent ( manifestFragmentURI , manifestURI ) ; fragment . delete ( ) ; } else { LOGGER . warn ( "Broken manifest fragment: " + fragment + "." ) ; } } if ( pd != null ) { ResourceSet resourceSet = resourceSetProvider . get ( ) ; Resource resource = resourceSet . getResource ( manifestURI , true ) ; List < EObject > contents = resource . getContents ( ) ; contents . clear ( ) ; contents . add ( pd ) ; try { resource . save ( null ) ; return statusHelper . OK ( ) ; } catch ( IOException e ) { final String message = "Error while trying to write N4 manifest content for: " + manifestURI + "." ; LOGGER . error ( message , e ) ; return statusHelper . createError ( message , e ) ; } } else { final String message = "Failed to merge N4 manifest fragments into '" + manifestURI + "'." ; LOGGER . error ( message ) ; return statusHelper . createError ( message ) ; } }
adjust manifests based on provided manifest fragments .
