1 package org.eclipse.emf.codegen.ecore.templates.model.tests; 2 3 import java.util.*; 4 import org.eclipse.emf.codegen.ecore.genmodel.*; 5 6 public class PluginXML 7 { 8 protected static String nl; 9 public static synchronized PluginXML create(String lineSeparator) 10 { 11 nl = lineSeparator; 12 PluginXML result = new PluginXML(); 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 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + NL + "<?eclipse version=\"3.0\"?>" + NL; 19 protected final String TEXT_2 = NL; 20 protected final String TEXT_3 = "<!--" + NL + " <copyright>" + NL + " </copyright>" + NL; 21 protected final String TEXT_4 = NL + " "; 22 protected final String TEXT_5 = "Id"; 23 protected final String TEXT_6 = NL + "-->" + NL + "" + NL + "<plugin"; 24 protected final String TEXT_7 = ">"; 25 protected final String TEXT_8 = NL + " name = \"%pluginName\"" + NL + " id = \""; 26 protected final String TEXT_9 = "\"" + NL + " version = \"1.0.0\"" + NL + " provider-name = \"%providerName\">" + NL + "" + NL + " <requires>"; 27 protected final String TEXT_10 = NL + " <import plugin=\""; 28 protected final String TEXT_11 = "\" "; 29 protected final String TEXT_12 = "export=\"true\""; 30 protected final String TEXT_13 = "/>"; 31 protected final String TEXT_14 = NL + " </requires>" + NL + "" + NL + " <runtime>"; 32 protected final String TEXT_15 = NL + " <library name=\""; 33 protected final String TEXT_16 = ".jar\">"; 34 protected final String TEXT_17 = NL + " <library name=\".\">"; 35 protected final String TEXT_18 = NL + " <export name=\"*\"/>" + NL + " </library>" + NL + " </runtime>"; 36 protected final String TEXT_19 = NL + "</plugin>" + NL; 37 protected final String TEXT_20 = NL; 38 39 public String generate(Object argument) 40 { 41 StringBuffer stringBuffer = new StringBuffer (); 42 43 57 58 GenModel genModel = (GenModel)argument; 59 stringBuffer.append(TEXT_1); 60 stringBuffer.append(TEXT_2); 61 stringBuffer.append(TEXT_3); 62 stringBuffer.append(TEXT_4); 63 stringBuffer.append("$"); 64 stringBuffer.append(TEXT_5); 65 stringBuffer.append("$"); 66 stringBuffer.append(TEXT_6); 67 if (genModel.isBundleManifest()) { 68 stringBuffer.append(TEXT_7); 69 } else { 70 stringBuffer.append(TEXT_8); 71 stringBuffer.append(genModel.getTestsPluginID()); 72 stringBuffer.append(TEXT_9); 73 for (Iterator j=genModel.getTestsRequiredPlugins().iterator(); j.hasNext();) { String pluginID = (String )j.next(); 74 stringBuffer.append(TEXT_10); 75 stringBuffer.append(pluginID); 76 stringBuffer.append(TEXT_11); 77 if (!pluginID.startsWith("org.eclipse.core.runtime")) { 78 stringBuffer.append(TEXT_12); 79 } 80 stringBuffer.append(TEXT_13); 81 } 82 stringBuffer.append(TEXT_14); 83 if (genModel.isRuntimeJar()) { 84 stringBuffer.append(TEXT_15); 85 stringBuffer.append(genModel.getTestsPluginID()); 86 stringBuffer.append(TEXT_16); 87 } else { 88 stringBuffer.append(TEXT_17); 89 } 90 stringBuffer.append(TEXT_18); 91 } 92 stringBuffer.append(TEXT_19); 93 stringBuffer.append(TEXT_20); 94 return stringBuffer.toString(); 95 } 96 } 97 | Popular Tags |