Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: bcfa0501864e78a0b0a92a57d76c3f9e2165a2e4 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<%@ jet package="org.eclipse.gmf.graphdef.codegen.standalone.templates" class="PluginActivatorGenerator"
	imports="org.eclipse.gmf.graphdef.codegen.* org.eclipse.gmf.common.codegen.ImportAssistant"%>
<%
final Object[] passedArgs = (Object[]) argument;
final StandaloneGenerator.Config config = (StandaloneGenerator.Config) passedArgs[0];
final ImportAssistant importManager = (ImportAssistant) passedArgs[1];

importManager.emitPackageStatement(stringBuffer);
%>

import org.eclipse.core.runtime.Plugin;

<%
if (config.needsMapMode()){
%>
import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeTypes;
<%
}
%>

import org.osgi.framework.BundleContext;
<%importManager.markImportLocation(stringBuffer);%>

/**
 * @generated
 */
public class <%=importManager.getCompilationUnitName()%> extends Plugin {

<%
if (config.needsMapMode()){
%>
	private IMapMode myMapMode = MapModeTypes.IDENTITY_MM;
<%
}
%>

	/**
	 * @generated
	 */
	public static final String ID = "<%=config.getPluginID()%>"; //$NON-NLS-1$

	/**
	 * @generated
	 */
	private static <%=config.getPluginActivatorClassName()%> ourInstance;

	/**
	 * @generated
	 */
	public <%=config.getPluginActivatorClassName()%>() {
	}

	/**
	 * @generated
	 */
	public void start(BundleContext context) throws Exception {
		super.start(context);
		if (ourInstance != null){
			throw new IllegalStateException("Plugin: " + ID + " already started");
		}
		ourInstance = this;
	}

	/**
	 * @generated
	 */
	public void stop(BundleContext context) throws Exception {
		if (ourInstance == null){
			throw new IllegalStateException("Plugin: " + ID + " is not started");
		}
		ourInstance = null;
		super.stop(context);
	}
	
<%
if (config.needsMapMode()){
%>
	/**
	 * @generated
	 */
	public void setMapMode(IMapMode mapMode) {
		myMapMode = mapMode;
		if (myMapMode == null){
			myMapMode = MapModeTypes.IDENTITY_MM;
		}
	}

	/**
	 * @generated
	 */
	public IMapMode getMapMode() {
		return myMapMode;
	}

<%
}
%>

	/**
	 * @generated
	 */
	public static <%=config.getPluginActivatorClassName()%> getDefault() {
		return ourInstance;
	}
}
<%importManager.emitSortedImports();%>

Back to the top