Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2006-03-02 13:16:15 +0000
committeratikhomirov2006-03-02 13:16:15 +0000
commit1e39c59995ac3431357387f1fccc937d2839d981 (patch)
tree9ae1febddb30c5293cf15630261516c650d4c545 /plugins/org.eclipse.gmf.graphdef.codegen/templates
parente8480b6522d370b673e9481a690ea7048c7638cf (diff)
downloadorg.eclipse.gmf-tooling-1e39c59995ac3431357387f1fccc937d2839d981.tar.gz
org.eclipse.gmf-tooling-1e39c59995ac3431357387f1fccc937d2839d981.tar.xz
org.eclipse.gmf-tooling-1e39c59995ac3431357387f1fccc937d2839d981.zip
[mgolubev] #128779 generate figures as standalone plugin
#129362 - respect plug-in dependencies imposed by figure fqn switch
Diffstat (limited to 'plugins/org.eclipse.gmf.graphdef.codegen/templates')
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/Plugin.javajet107
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/build.propertiesjet4
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/manifest.mfjet50
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/plugin.propertiesjet7
4 files changed, 168 insertions, 0 deletions
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/Plugin.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/Plugin.javajet
new file mode 100644
index 000000000..42709b1f0
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/Plugin.javajet
@@ -0,0 +1,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 <%=config.getPluginActivatorClassName()%> 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();%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/build.propertiesjet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/build.propertiesjet
new file mode 100644
index 000000000..c5ce43ca4
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/build.propertiesjet
@@ -0,0 +1,4 @@
+<%@ jet package="org.eclipse.gmf.graphdef.codegen.standalone.templates" class="BuildPropertiesGenerator"%>
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/manifest.mfjet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/manifest.mfjet
new file mode 100644
index 000000000..93e6e8b8e
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/manifest.mfjet
@@ -0,0 +1,50 @@
+<%@ jet package="org.eclipse.gmf.graphdef.codegen.standalone.templates" class="ManifestMFGenerator"
+ imports="java.util.* org.eclipse.gmf.graphdef.codegen.*"%>
+<%
+final Object[] passedArgs = (Object[]) argument;
+final StandaloneGenerator.Config config = (StandaloneGenerator.Config) passedArgs[0];
+final String[] requiredBundles = (String[]) passedArgs[1];
+
+
+class ListComposer {
+ public String composeList(Collection strings){
+ StringBuffer result = new StringBuffer();
+ for (Iterator it = strings.iterator(); it.hasNext();){
+ result.append(" "); //do not miss required space here
+ result.append(it.next());
+ if (it.hasNext()){
+ result.append(", " + NL);
+ }
+ }
+ return result.toString();
+ }
+}
+
+final ListComposer listComposer = new ListComposer();
+%>
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: <%=config.getPluginID()%>; singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+<%
+ HashSet exportedPackages = new HashSet();
+ exportedPackages.add(config.getMainPackageName());
+ exportedPackages.add(config.getPluginActivatorPackageName());
+%>
+Export-Package: <%=listComposer.composeList(exportedPackages)%>
+<%
+final Set allRequiredBundles = new LinkedHashSet();
+allRequiredBundles.add("org.eclipse.gef");
+allRequiredBundles.add("org.eclipse.draw2d");
+allRequiredBundles.add("org.eclipse.osgi");
+allRequiredBundles.add("org.eclipse.core.runtime");
+allRequiredBundles.addAll(java.util.Arrays.asList(requiredBundles));
+if (config.needsMapMode()) {
+ allRequiredBundles.add("org.eclipse.gmf.runtime.draw2d.ui");
+}
+%>
+Require-Bundle: <%=listComposer.composeList(allRequiredBundles)%>
+Eclipse-LazyStart: true
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/plugin.propertiesjet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/plugin.propertiesjet
new file mode 100644
index 000000000..b58cc057f
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/plugin.propertiesjet
@@ -0,0 +1,7 @@
+<%@ jet package="org.eclipse.gmf.graphdef.codegen.standalone.templates" class="PluginPropertiesGenerator"
+ imports="org.eclipse.gmf.graphdef.codegen.*"%>
+<%
+final StandaloneGenerator.Config config = (StandaloneGenerator.Config) argument;
+%>
+pluginName = <%=config.getPluginFriendlyName()%>
+providerName = <%=config.getPluginProviderName()%>

Back to the top