Debian Codegraph @

plugins/org.eclipse.emf.codegen.ecore/templates/editor/Plugin.javajet

raw
1 <%@ jet package="org.eclipse.emf.codegen.ecore.templates.editor" imports="java.util.* org.eclipse.emf.codegen.ecore.genmodel.*" class="Plugin"%>
2 <%
3 /**
4 * Copyright (c) 2002-2004 IBM Corporation and others.
5 * All rights reserved. This program and the accompanying materials
6 * are made available under the terms of the Eclipse Public License v2.0
7 * which accompanies this distribution, and is available at
8 * http://www.eclipse.org/legal/epl-v20.html
9 *
10 * Contributors:
11 * IBM - Initial API and implementation
12 */
13 %>
14 <%GenModel genModel = (GenModel)argument; /* Trick to import java.util.* without warnings */Iterator.class.getName();%>
15 <%final boolean isJDK50 = genModel.getComplianceLevel().getValue() >= GenJDKLevel.JDK50;%>
16 <%@ include file="../Header.javajetinc"%>
17 package <%=genModel.getEditorPluginPackageName()%>;
18
19 <%genModel.addImport("org.eclipse.emf.common.EMFPlugin");%>
20 <%genModel.addImport("org.eclipse.emf.common.util.ResourceLocator");%>
21 <%genModel.markImportLocation(stringBuffer);%>
22
23 /**
24 * This is the central singleton for the <%=genModel.getModelName()%> editor plugin.
25 * <!-- begin-user-doc -->
26 * <!-- end-user-doc -->
27 <%if (genModel.hasAPITags()) {%>
28 * <%=genModel.getAPITags(genModel.getIndentation(stringBuffer))%>
29 <%}%>
30 * @generated
31 */
32 <%if (isJDK50 && genModel.hasAPIDeprecatedTag()) {%>
33 @Deprecated
34 <%}%>
35 public final class <%=genModel.getEditorPluginClassName()%> extends EMFPlugin
36 {
37 <%if (genModel.hasCopyrightField()) {%>
38 /**
39 * <!-- begin-user-doc -->
40 * <!-- end-user-doc -->
41 * @generated
42 */
43 public static final <%=genModel.getImportedName("java.lang.String")%> copyright = <%=genModel.getCopyrightFieldLiteral()%>;<%=genModel.getNonNLS()%>
44
45 <%}%>
46 /**
47 * Keep track of the singleton.
48 * <!-- begin-user-doc -->
49 * <!-- end-user-doc -->
50 * @generated
51 */
52 public static final <%=genModel.getEditorPluginClassName()%> INSTANCE = new <%=genModel.getEditorPluginClassName()%>();
53
54 <%if (genModel.getRuntimePlatform() != GenRuntimePlatform.GWT) {%>
55 /**
56 * Keep track of the singleton.
57 * <!-- begin-user-doc -->
58 * <!-- end-user-doc -->
59 * @generated
60 */
61 private static Implementation plugin;
62
63 <%}%>
64 /**
65 * Create the instance.
66 * <!-- begin-user-doc -->
67 * <!-- end-user-doc -->
68 * @generated
69 */
70 public <%=genModel.getEditorPluginClassName()%>()
71 {
72 super
73 (new ResourceLocator []
74 {
75 <%for (String pluginClassName : genModel.getEditResourceDelegateImportedPluginClassNames()) {%>
76 <%=pluginClassName%>.INSTANCE,
77 <%}%>
78 });
79 }
80
81 /**
82 * Returns the singleton instance of the Eclipse plugin.
83 * <!-- begin-user-doc -->
84 * <!-- end-user-doc -->
85 * @return the singleton instance.
86 * @generated
87 */
88 <%if (genModel.useClassOverrideAnnotation()) {%>
89 @Override
90 <%}%>
91 public ResourceLocator getPluginResourceLocator()
92 {
93 <%if (genModel.getRuntimePlatform() == GenRuntimePlatform.GWT) {%>
94 return null;
95 <%} else {%>
96 return plugin;
97 <%}%>
98 }
99
100 <%if (genModel.getRuntimePlatform() != GenRuntimePlatform.GWT) {%>
101 /**
102 * Returns the singleton instance of the Eclipse plugin.
103 * <!-- begin-user-doc -->
104 * <!-- end-user-doc -->
105 * @return the singleton instance.
106 * @generated
107 */
108 public static Implementation getPlugin()
109 {
110 return plugin;
111 }
112
113 /**
114 * The actual implementation of the Eclipse <b>Plugin</b>.
115 * <!-- begin-user-doc -->
116 * <!-- end-user-doc -->
117 * @generated
118 */
119 public static class Implementation extends <%=genModel.getImportedName("org.eclipse.emf.common.ui.EclipseUIPlugin")%>
120 {
121 /**
122 * Creates an instance.
123 * <!-- begin-user-doc -->
124 * <!-- end-user-doc -->
125 <%if (genModel.needsRuntimeCompatibility()) {%>
126 * @param descriptor the description of the plugin.
127 <%}%>
128 * @generated
129 */
130 public Implementation(<%if (genModel.needsRuntimeCompatibility()) {%><%=genModel.getImportedName("org.eclipse.core.runtime.IPluginDescriptor")%> descriptor<%}%>)
131 {
132 super(<%if (genModel.needsRuntimeCompatibility()) {%>descriptor<%}%>);
133
134 // Remember the static instance.
135 //
136 plugin = this;
137 }
138 }
139
140 <%}%>
141 }
142 <%genModel.emitSortedImports();%>