diff options
Diffstat (limited to 'plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin')
8 files changed, 135 insertions, 172 deletions
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/Activator.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/Activator.xpt new file mode 100644 index 000000000..05d0b8b1c --- /dev/null +++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/Activator.xpt @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2006 Borland Software Corporation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Artem Tikhomirov (Borland) - initial API and implementation + */ +«IMPORT "http://www.eclipse.org/emf/2002/Ecore"» +«IMPORT "templates"» + +«DEFINE Init(String packageName, String pluginActivatorClassName, String pluginID) FOR Object-» +package «packageName»; + +/** + * @generated + */ +public class «pluginActivatorClassName» extends org.eclipse.core.runtime.Plugin { + + /** + * @generated + */ + public static final String ID = "«pluginID»"; //\u0024NON-NLS-1\u0024 XXX FIXME DollarSign support + + /** + * @generated + */ + private static «pluginActivatorClassName» ourInstance; + + /** + * @generated + */ + public «pluginActivatorClassName»() { + } + + /** + * @generated + */ + public void start(org.osgi.framework.BundleContext context) throws Exception { + super.start(context); + ourInstance = this; + } + + /** + * @generated + */ + public void stop(org.osgi.framework.BundleContext context) throws Exception { + ourInstance = null; + super.stop(context); + } + + /** + * @generated + */ + public static «pluginActivatorClassName» getDefault() { + return ourInstance; + } +«EXPAND MapMode::Activator-» +} +«ENDDEFINE»
\ No newline at end of file diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/BuildProperties.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/BuildProperties.xpt new file mode 100644 index 000000000..3781d4419 --- /dev/null +++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/BuildProperties.xpt @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2006 Borland Software Corporation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Artem Tikhomirov (Borland) - initial API and implementation + */ + +«DEFINE Init FOR Object-» +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ +«ENDDEFINE»
\ No newline at end of file diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/Manifest.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/Manifest.xpt new file mode 100644 index 000000000..d5eb87bb3 --- /dev/null +++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/Manifest.xpt @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2006 Borland Software Corporation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Artem Tikhomirov (Borland) - initial API and implementation + */ + +«DEFINE Init(String pluginID, String pluginActivatorQualifiedName, List[String] exportedPackages, List[String] requiredBundles) FOR Object-» +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: «pluginID»; singleton:=true +Bundle-Version: 1.0.0 +Bundle-Vendor: %providerName +Bundle-Activator: «pluginActivatorQualifiedName» +Bundle-Localization: plugin +Export-Package:«EXPAND exportPackageHeader FOR exportedPackages» +«LET requiredBundles.union({"org.eclipse.core.runtime","org.eclipse.draw2d"}) AS s-» +Require-Bundle:«EXPAND requireBundleHeader FOR s» +«ENDLET-» +Eclipse-LazyStart: true +«ENDDEFINE» + +«DEFINE exportPackageHeader FOR List[String]-» +«EXPAND print FOREACH this SEPARATOR ",\n"-» +«ENDDEFINE» + +«REM»FIXME Set[String] - improve union recognition«ENDREM» +«DEFINE requireBundleHeader FOR Set[Object]-» +«EXPAND print FOREACH this.typeSelect(String) SEPARATOR ",\n"-» +«ENDDEFINE» + +«DEFINE print FOR string» «this»«ENDDEFINE»
\ No newline at end of file diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/Plugin.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/Plugin.javajet deleted file mode 100644 index bcfa05018..000000000 --- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/Plugin.javajet +++ /dev/null @@ -1,107 +0,0 @@ -<%@ 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();%> diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/PluginProperties.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/PluginProperties.xpt new file mode 100644 index 000000000..17aa50af1 --- /dev/null +++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/PluginProperties.xpt @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2006 Borland Software Corporation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Artem Tikhomirov (Borland) - initial API and implementation + */ + +«DEFINE Init(String pluginName, String providerName) FOR Object-» +pluginName = «pluginName» +providerName = «providerName» +«ENDDEFINE»
\ No newline at end of file diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/build.propertiesjet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/build.propertiesjet deleted file mode 100644 index a1fead957..000000000 --- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/build.propertiesjet +++ /dev/null @@ -1,5 +0,0 @@ -<%@ 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 deleted file mode 100644 index 8b9fd5290..000000000 --- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/manifest.mfjet +++ /dev/null @@ -1,53 +0,0 @@ -<%@ 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-Activator: <%=config.getPluginActivatorPackageName()%>.<%=config.getPluginActivatorClassName()%> -Bundle-Localization: plugin -<% - HashSet exportedPackages = new HashSet(); - if (config.getMainPackageName() != null && config.getMainPackageName().trim().length() > 0) { - 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 deleted file mode 100644 index b58cc057f..000000000 --- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/plugin/plugin.propertiesjet +++ /dev/null @@ -1,7 +0,0 @@ -<%@ 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()%> |