| 1 |
<%@ jet package="org.eclipse.emf.codegen.ecore.templates.model" imports="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;%> |
| 15 |
<%final boolean isJDK50 = genModel.getComplianceLevel().getValue() >= GenJDKLevel.JDK50;%> |
| 16 |
<%@ include file="../Header.javajetinc"%> |
| 17 |
package <%=genModel.getModelPluginPackageName()%>; |
| 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()%> model 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.getModelPluginClassName()%> 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.getModelPluginClassName()%> INSTANCE = new <%=genModel.getModelPluginClassName()%>(); |
| 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.getModelPluginClassName()%>() |
| 71 |
{ |
| 72 |
super(new ResourceLocator [] {}); |
| 73 |
} |
| 74 |
|
| 75 |
/** |
| 76 |
* Returns the singleton instance of the Eclipse plugin. |
| 77 |
* <!-- begin-user-doc --> |
| 78 |
* <!-- end-user-doc --> |
| 79 |
* @return the singleton instance. |
| 80 |
* @generated |
| 81 |
*/ |
| 82 |
<%if (genModel.useClassOverrideAnnotation()) {%> |
| 83 |
@Override |
| 84 |
<%}%> |
| 85 |
public ResourceLocator getPluginResourceLocator() |
| 86 |
{ |
| 87 |
<%if (genModel.getRuntimePlatform() == GenRuntimePlatform.GWT) {%> |
| 88 |
return null; |
| 89 |
<%} else {%> |
| 90 |
return plugin; |
| 91 |
<%}%> |
| 92 |
} |
| 93 |
|
| 94 |
<%if (genModel.getRuntimePlatform() != GenRuntimePlatform.GWT) {%> |
| 95 |
/** |
| 96 |
* Returns the singleton instance of the Eclipse plugin. |
| 97 |
* <!-- begin-user-doc --> |
| 98 |
* <!-- end-user-doc --> |
| 99 |
* @return the singleton instance. |
| 100 |
* @generated |
| 101 |
*/ |
| 102 |
public static Implementation getPlugin() |
| 103 |
{ |
| 104 |
return plugin; |
| 105 |
} |
| 106 |
|
| 107 |
/** |
| 108 |
* The actual implementation of the Eclipse <b>Plugin</b>. |
| 109 |
* <!-- begin-user-doc --> |
| 110 |
* <!-- end-user-doc --> |
| 111 |
* @generated |
| 112 |
*/ |
| 113 |
public static class Implementation extends EclipsePlugin |
| 114 |
{ |
| 115 |
/** |
| 116 |
* Creates an instance. |
| 117 |
* <!-- begin-user-doc --> |
| 118 |
* <!-- end-user-doc --> |
| 119 |
<%if (genModel.needsRuntimeCompatibility()) {%> |
| 120 |
* @param descriptor the description of the plugin. |
| 121 |
<%}%> |
| 122 |
* @generated |
| 123 |
*/ |
| 124 |
public Implementation(<%if (genModel.needsRuntimeCompatibility()) {%><%=genModel.getImportedName("org.eclipse.core.runtime.IPluginDescriptor")%> descriptor<%}%>) |
| 125 |
{ |
| 126 |
super(<%if (genModel.needsRuntimeCompatibility()) {%>descriptor<%}%>); |
| 127 |
|
| 128 |
// Remember the static instance. |
| 129 |
// |
| 130 |
plugin = this; |
| 131 |
} |
| 132 |
<%if (genModel.isOSGiCompatible()) {%> |
| 133 |
|
| 134 |
/** |
| 135 |
* The actual implementation of the purely OSGi-compatible <b>Bundle Activator</b>. |
| 136 |
* <!-- begin-user-doc --> |
| 137 |
* <!-- end-user-doc --> |
| 138 |
* @generated |
| 139 |
*/ |
| 140 |
public static final class Activator extends <%=genModel.getImportedName("org.eclipse.emf.common.EMFPlugin")%>.OSGiDelegatingBundleActivator |
| 141 |
{ |
| 142 |
<%if (genModel.useClassOverrideAnnotation()) {%> |
| 143 |
@Override |
| 144 |
<%}%> |
| 145 |
protected <%=genModel.getImportedName("org.osgi.framework.BundleActivator")%> createBundle() |
| 146 |
{ |
| 147 |
return new Implementation(); |
| 148 |
} |
| 149 |
} |
| 150 |
<%}%> |
| 151 |
} |
| 152 |
|
| 153 |
<%}%> |
| 154 |
} |
| 155 |
<%genModel.emitSortedImports();%> |