1 package org.eclipse.emf.codegen.ecore.templates.editor; 2 3 import java.util.*; 4 import org.eclipse.emf.codegen.ecore.genmodel.*; 5 6 public class ManifestMF 7 { 8 protected static String nl; 9 public static synchronized ManifestMF create(String lineSeparator) 10 { 11 nl = lineSeparator; 12 ManifestMF result = new ManifestMF(); 13 nl = null; 14 return result; 15 } 16 17 protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; 18 protected final String TEXT_1 = "Manifest-Version: 1.0" + NL + "Bundle-ManifestVersion: 2" + NL + "Bundle-Name: %pluginName" + NL + "Bundle-SymbolicName: "; 19 protected final String TEXT_2 = "; singleton:=true" + NL + "Bundle-Version: 1.0.0" + NL + "Bundle-ClassPath: "; 20 protected final String TEXT_3 = ".jar"; 21 protected final String TEXT_4 = "."; 22 protected final String TEXT_5 = NL + "Bundle-Activator: "; 23 protected final String TEXT_6 = "$Implementation" + NL + "Bundle-Vendor: %providerName" + NL + "Bundle-Localization: plugin"; 24 protected final String TEXT_7 = NL + "Export-Package: "; 25 protected final String TEXT_8 = ","; 26 protected final String TEXT_9 = NL + " "; 27 protected final String TEXT_10 = NL + "Require-Bundle: "; 28 protected final String TEXT_11 = ";visibility:=reexport"; 29 protected final String TEXT_12 = ","; 30 protected final String TEXT_13 = NL + " "; 31 protected final String TEXT_14 = ";visibility:=reexport"; 32 protected final String TEXT_15 = NL + "Eclipse-AutoStart: true"; 33 protected final String TEXT_16 = NL; 34 35 public String generate(Object argument) 36 { 37 StringBuffer stringBuffer = new StringBuffer (); 38 39 53 54 GenModel genModel = (GenModel)argument; 55 stringBuffer.append(TEXT_1); 56 stringBuffer.append(genModel.getEditorPluginID()); 57 stringBuffer.append(TEXT_2); 58 if (genModel.isRuntimeJar()) { 59 stringBuffer.append(genModel.getEditorPluginID()); 60 stringBuffer.append(TEXT_3); 61 }else{ 62 stringBuffer.append(TEXT_4); 63 } 64 stringBuffer.append(TEXT_5); 65 stringBuffer.append(genModel.getQualifiedEditorPluginClassName()); 66 stringBuffer.append(TEXT_6); 67 Iterator packagesIterator = genModel.getEditorQualifiedPackageNames().iterator(); if (packagesIterator.hasNext()) { String pack = (String )packagesIterator.next(); 68 stringBuffer.append(TEXT_7); 69 stringBuffer.append(pack); 70 while(packagesIterator.hasNext()) { pack = (String )packagesIterator.next(); 71 stringBuffer.append(TEXT_8); 72 stringBuffer.append(TEXT_9); 73 stringBuffer.append(pack); 74 } 75 } 76 Iterator requiredPluginIterator = genModel.getEditorRequiredPlugins().iterator(); if (requiredPluginIterator.hasNext()) { String pluginID = (String )requiredPluginIterator.next(); 77 stringBuffer.append(TEXT_10); 78 stringBuffer.append(pluginID); 79 if (!pluginID.startsWith("org.eclipse.core.runtime")){ 80 stringBuffer.append(TEXT_11); 81 } while(requiredPluginIterator.hasNext()) { pluginID = (String )requiredPluginIterator.next(); 82 stringBuffer.append(TEXT_12); 83 stringBuffer.append(TEXT_13); 84 stringBuffer.append(pluginID); 85 if (!pluginID.startsWith("org.eclipse.core.runtime")){ 86 stringBuffer.append(TEXT_14); 87 }} 88 } 89 stringBuffer.append(TEXT_15); 90 stringBuffer.append(TEXT_16); 91 return stringBuffer.toString(); 92 } 93 } 94 | Popular Tags |