use of org.eclipse.xtext.util.MergeableManifest2 in project xtext-xtend by eclipse.
the class AbstractLibClasspathAdder method addToPluginManifest.
protected boolean addToPluginManifest(IProject project, IProgressMonitor monitor) throws IOException, CoreException {
IResource manifestFile = project.findMember("META-INF/MANIFEST.MF");
if (manifestFile != null && manifestFile.isAccessible() && !manifestFile.getResourceAttributes().isReadOnly() && manifestFile instanceof IFile) {
OutputStream output = null;
InputStream input = null;
try {
MergeableManifest2 manifest = createMergableManifest(manifestFile);
manifest.addRequiredBundles(getBundleIds());
ByteArrayOutputStream out = new ByteArrayOutputStream();
output = new BufferedOutputStream(out);
manifest.write(output);
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
input = new BufferedInputStream(in);
((IFile) manifestFile).setContents(input, true, true, monitor);
return true;
} finally {
if (output != null)
output.close();
if (input != null)
input.close();
}
}
return false;
}
Aggregations