KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > codegen > ecore > templates > model > tests > PluginXML


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 JavaDoc nl;
9   public static synchronized PluginXML create(String JavaDoc lineSeparator)
10   {
11     nl = lineSeparator;
12     PluginXML result = new PluginXML();
13     nl = null;
14     return result;
15   }
16
17   protected final String JavaDoc NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
18   protected final String JavaDoc TEXT_1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + NL + "<?eclipse version=\"3.0\"?>" + NL;
19   protected final String JavaDoc TEXT_2 = NL;
20   protected final String JavaDoc TEXT_3 = "<!--" + NL + " <copyright>" + NL + " </copyright>" + NL;
21   protected final String JavaDoc TEXT_4 = NL + " ";
22   protected final String JavaDoc TEXT_5 = "Id";
23   protected final String JavaDoc TEXT_6 = NL + "-->" + NL + "" + NL + "<plugin";
24   protected final String JavaDoc TEXT_7 = ">";
25   protected final String JavaDoc TEXT_8 = NL + " name = \"%pluginName\"" + NL + " id = \"";
26   protected final String JavaDoc TEXT_9 = "\"" + NL + " version = \"1.0.0\"" + NL + " provider-name = \"%providerName\">" + NL + "" + NL + " <requires>";
27   protected final String JavaDoc TEXT_10 = NL + " <import plugin=\"";
28   protected final String JavaDoc TEXT_11 = "\" ";
29   protected final String JavaDoc TEXT_12 = "export=\"true\"";
30   protected final String JavaDoc TEXT_13 = "/>";
31   protected final String JavaDoc TEXT_14 = NL + " </requires>" + NL + "" + NL + " <runtime>";
32   protected final String JavaDoc TEXT_15 = NL + " <library name=\"";
33   protected final String JavaDoc TEXT_16 = ".jar\">";
34   protected final String JavaDoc TEXT_17 = NL + " <library name=\".\">";
35   protected final String JavaDoc TEXT_18 = NL + " <export name=\"*\"/>" + NL + " </library>" + NL + " </runtime>";
36   protected final String JavaDoc TEXT_19 = NL + "</plugin>" + NL;
37   protected final String JavaDoc TEXT_20 = NL;
38
39   public String JavaDoc generate(Object JavaDoc argument)
40   {
41     StringBuffer JavaDoc stringBuffer = new StringBuffer JavaDoc();
42     
43 /**
44  * <copyright>
45  *
46  * Copyright (c) 2005 IBM Corporation and others.
47  * All rights reserved. This program and the accompanying materials
48  * are made available under the terms of the Eclipse Public License v1.0
49  * which accompanies this distribution, and is available at
50  * http://www.eclipse.org/legal/epl-v10.html
51  *
52  * Contributors:
53  * IBM - Initial API and implementation
54  *
55  * </copyright>
56  */

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 JavaDoc pluginID = (String JavaDoc)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