blob: f42d86df2d5dae458283574570567d8aee0ac035 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
package org.eclipse.emf.codegen.ecore.templates.editor;
import java.util.*;
import org.eclipse.emf.codegen.ecore.genmodel.*;
public class AppEngineWebXML
{
protected static String nl;
public static synchronized AppEngineWebXML create(String lineSeparator)
{
nl = lineSeparator;
AppEngineWebXML result = new AppEngineWebXML();
nl = null;
return result;
}
public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
protected final String TEXT_1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
protected final String TEXT_2 = NL;
protected final String TEXT_3 = "<!--";
protected final String TEXT_4 = NL + " ";
protected final String TEXT_5 = NL + "-->" + NL + "<appengine-web-app xmlns=\"http://appengine.google.com/ns/1.0\">" + NL + "\t<application>";
protected final String TEXT_6 = "-editor</application>" + NL + "\t<version>1</version>" + NL + "</appengine-web-app>";
protected final String TEXT_7 = NL;
public String generate(Object argument)
{
final StringBuffer stringBuffer = new StringBuffer();
/**
* Copyright (c) 2010 Ed Merks and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Ed Merks - Initial API and implementation
*/
GenModel genModel = (GenModel)argument; /* Trick to import java.util.* without warnings */Iterator.class.getName();
stringBuffer.append(TEXT_1);
stringBuffer.append(TEXT_2);
stringBuffer.append(TEXT_3);
{GenBase copyrightHolder = argument instanceof GenBase ? (GenBase)argument : argument instanceof Object[] && ((Object[])argument)[0] instanceof GenBase ? (GenBase)((Object[])argument)[0] : null;
if (copyrightHolder != null && copyrightHolder.hasCopyright()) {
stringBuffer.append(TEXT_4);
stringBuffer.append(copyrightHolder.getCopyright(copyrightHolder.getGenModel().getIndentation(stringBuffer)));
}}
stringBuffer.append(TEXT_5);
stringBuffer.append(genModel.getModelName().toLowerCase().replaceAll("\\s", "-"));
stringBuffer.append(TEXT_6);
stringBuffer.append(TEXT_7);
return stringBuffer.toString();
}
}
|