/**
* <copyright>
* </copyright>
*
*
*/
package ssl.resource.ssl.mopp;
public class SslNewFileContentProvider {
public ssl.resource.ssl.ISslMetaInformation getMetaInformation() {
return new ssl.resource.ssl.mopp.SslMetaInformation();
}
public String getNewFileContent(String newFileName) {
return getExampleContent(new org.eclipse.emf.ecore.EClass[] {
ssl.SslPackage.eINSTANCE.getSpecification(),
}, getMetaInformation().getClassesWithSyntax(), newFileName);
}
protected String getExampleContent(org.eclipse.emf.ecore.EClass[] startClasses, org.eclipse.emf.ecore.EClass[] allClassesWithSyntax, String newFileName) {
String content = "";
for (org.eclipse.emf.ecore.EClass next : startClasses) {
content = getExampleContent(next, allClassesWithSyntax, newFileName);
if (content.trim().length() > 0) {
break;
}
}
return content;
}
protected String getExampleContent(org.eclipse.emf.ecore.EClass eClass, org.eclipse.emf.ecore.EClass[] allClassesWithSyntax, String newFileName) {
// create a minimal model
org.eclipse.emf.ecore.EObject root = new ssl.resource.ssl.util.SslMinimalModelHelper().getMinimalModel(eClass, allClassesWithSyntax, newFileName);
// use printer to get text for model
java.io.ByteArrayOutputStream buffer = new java.io.ByteArrayOutputStream();
ssl.resource.ssl.ISslTextPrinter printer = getPrinter(buffer);
try {
printer.print(root);
} catch (java.io.IOException e) {
ssl.resource.ssl.mopp.SslPlugin.logError("Exception while generating example content.", e);
}
return buffer.toString();
}
public ssl.resource.ssl.ISslTextPrinter getPrinter(java.io.OutputStream outputStream) {
return getMetaInformation().createPrinter(outputStream, new ssl.resource.ssl.mopp.SslResource());
}
}