KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.eclipse.emf.codegen.ecore.templates.model;
2
3 import org.eclipse.emf.codegen.ecore.genmodel.*;
4
5 public class ResourceClass
6 {
7   protected static String JavaDoc nl;
8   public static synchronized ResourceClass create(String JavaDoc lineSeparator)
9   {
10     nl = lineSeparator;
11     ResourceClass result = new ResourceClass();
12     nl = null;
13     return result;
14   }
15
16   protected final String JavaDoc NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
17   protected final String JavaDoc TEXT_1 = "";
18   protected final String JavaDoc TEXT_2 = "/**" + NL + " * <copyright>" + NL + " * </copyright>" + NL + " *" + NL + " * ";
19   protected final String JavaDoc TEXT_3 = "Id";
20   protected final String JavaDoc TEXT_4 = NL + " */" + NL + "package ";
21   protected final String JavaDoc TEXT_5 = ";" + NL;
22   protected final String JavaDoc TEXT_6 = NL + NL + "/**" + NL + " * <!-- begin-user-doc -->" + NL + " * The <b>Resource </b> associated with the package." + NL + " * <!-- end-user-doc -->" + NL + " * @see ";
23   protected final String JavaDoc TEXT_7 = NL + " * @generated" + NL + " */" + NL + "public class ";
24   protected final String JavaDoc TEXT_8 = " extends ";
25   protected final String JavaDoc TEXT_9 = NL + "{";
26   protected final String JavaDoc TEXT_10 = NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final ";
27   protected final String JavaDoc TEXT_11 = " copyright = \"";
28   protected final String JavaDoc TEXT_12 = "\";";
29   protected final String JavaDoc TEXT_13 = NL;
30   protected final String JavaDoc TEXT_14 = NL + "\t/**" + NL + "\t * Creates an instance of the resource." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @param uri the URI of the new resource." + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
31   protected final String JavaDoc TEXT_15 = "(URI uri)" + NL + "\t{" + NL + "\t\tsuper(uri);";
32   protected final String JavaDoc TEXT_16 = NL + "\t}" + NL + "" + NL + "} //";
33   protected final String JavaDoc TEXT_17 = NL;
34
35   public String JavaDoc generate(Object JavaDoc argument)
36   {
37     StringBuffer JavaDoc stringBuffer = new StringBuffer JavaDoc();
38     
39 /**
40  * <copyright>
41  *
42  * Copyright (c) 2002-2004 IBM Corporation and others.
43  * All rights reserved. This program and the accompanying materials
44  * are made available under the terms of the Eclipse Public License v1.0
45  * which accompanies this distribution, and is available at
46  * http://www.eclipse.org/legal/epl-v10.html
47  *
48  * Contributors:
49  * IBM - Initial API and implementation
50  *
51  * </copyright>
52  */

53
54     GenPackage genPackage = (GenPackage)argument; GenModel genModel=genPackage.getGenModel();
55     stringBuffer.append(TEXT_1);
56     stringBuffer.append(TEXT_2);
57     stringBuffer.append("$");
58     stringBuffer.append(TEXT_3);
59     stringBuffer.append("$");
60     stringBuffer.append(TEXT_4);
61     stringBuffer.append(genPackage.getUtilitiesPackageName());
62     stringBuffer.append(TEXT_5);
63     genModel.getImportedName("org.eclipse.emf.common.util.URI");
64     genModel.markImportLocation(stringBuffer);
65     stringBuffer.append(TEXT_6);
66     stringBuffer.append(genPackage.getQualifiedResourceFactoryClassName());
67     stringBuffer.append(TEXT_7);
68     stringBuffer.append(genPackage.getResourceClassName());
69     stringBuffer.append(TEXT_8);
70     stringBuffer.append(genPackage.getImportedResourceBaseClassName());
71     stringBuffer.append(TEXT_9);
72     if (genModel.getCopyrightText() != null) {
73     stringBuffer.append(TEXT_10);
74     stringBuffer.append(genModel.getImportedName("java.lang.String"));
75     stringBuffer.append(TEXT_11);
76     stringBuffer.append(genModel.getCopyrightText());
77     stringBuffer.append(TEXT_12);
78     stringBuffer.append(genModel.getNonNLS());
79     stringBuffer.append(TEXT_13);
80     }
81     stringBuffer.append(TEXT_14);
82     stringBuffer.append(genPackage.getResourceClassName());
83     stringBuffer.append(TEXT_15);
84     if (genPackage.getResource() == GenResourceKind.XML_LITERAL) {
85     }
86     stringBuffer.append(TEXT_16);
87     stringBuffer.append(genPackage.getResourceClassName());
88     genModel.emitSortedImports();
89     stringBuffer.append(TEXT_17);
90     return stringBuffer.toString();
91   }
92 }
93
Popular Tags