浏览代码

rename sct.statechart.builder to sct.generator.base

holger.willebrandt@gmail.com 13 年之前
父节点
当前提交
fdfdb9e4ef

+ 0 - 7
plugins/org.yakindu.sct.generator.base/.classpath

@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
-	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="output" path="bin"/>
-</classpath>

+ 0 - 28
plugins/org.yakindu.sct.generator.base/.project

@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>org.yakindu.sct.generator.base</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.eclipse.jdt.core.javabuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.pde.ManifestBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.pde.SchemaBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.eclipse.pde.PluginNature</nature>
-		<nature>org.eclipse.jdt.core.javanature</nature>
-	</natures>
-</projectDescription>

+ 0 - 8
plugins/org.yakindu.sct.generator.base/.settings/org.eclipse.jdt.core.prefs

@@ -1,8 +0,0 @@
-#Mon Sep 05 10:20:01 CEST 2011
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5

+ 0 - 23
plugins/org.yakindu.sct.generator.base/META-INF/MANIFEST.MF

@@ -1,23 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Yakindu SCT Generator
-Bundle-SymbolicName: org.yakindu.sct.generator.base
-Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: org.yakindu.sct.generator.base.GeneratorActivator
-Bundle-Vendor: YAKINDU
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.yakindu.sct.model.sgraph;visibility:=reexport,
- org.yakindu.sct.model.sexec;visibility:=reexport,
- com.google.inject,
- org.eclipse.xpand,
- org.eclipse.core.resources;visibility:=reexport,
- org.eclipse.xtend,
- org.eclipse.emf,
- org.eclipse.xtend.typesystem.emf,
- org.yakindu.sct.model.stext,
- org.yakindu.sct.statechart.builder;visibility:=reexport
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-ActivationPolicy: lazy
-Export-Package: org.yakindu.sct.generator.base,
- org.yakindu.sct.generator.base.util

+ 0 - 4
plugins/org.yakindu.sct.generator.base/build.properties

@@ -1,4 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
-               .

+ 0 - 50
plugins/org.yakindu.sct.generator.base/src/org/yakindu/sct/generator/base/GeneratorActivator.java

@@ -1,50 +0,0 @@
-package org.yakindu.sct.generator.base;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class GeneratorActivator extends AbstractUIPlugin {
-
-	// The plug-in ID
-	public static final String PLUGIN_ID = "org.yakindu.sct.generator.base"; //$NON-NLS-1$
-
-	// The shared instance
-	private static GeneratorActivator plugin;
-	
-	/**
-	 * The constructor
-	 */
-	public GeneratorActivator() {
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
-	 */
-	public void start(BundleContext context) throws Exception {
-		super.start(context);
-		plugin = this;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
-	 */
-	public void stop(BundleContext context) throws Exception {
-		plugin = null;
-		super.stop(context);
-	}
-
-	/**
-	 * Returns the shared instance
-	 *
-	 * @return the shared instance
-	 */
-	public static GeneratorActivator getDefault() {
-		return plugin;
-	}
-
-}

+ 0 - 45
plugins/org.yakindu.sct.generator.base/src/org/yakindu/sct/generator/base/util/AbstractXpandCodeGeneratorSubscriber.java

@@ -1,45 +0,0 @@
-package org.yakindu.sct.generator.base.util;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.yakindu.sct.builder.subscriber.IBuilderSubscriber;
-import org.yakindu.sct.model.sexec.ExecutionFlow;
-import org.yakindu.sct.model.sgraph.Statechart;
-
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public abstract class AbstractXpandCodeGeneratorSubscriber implements
-		IBuilderSubscriber {
-
-	public abstract String getTemplatePath();
-
-	public abstract String getOutletPath(IResource resource);
-
-	public void doBuild(IResource resource) {
-		try {
-			IProject project = resource.getProject();
-			Statechart statechart;
-			if (resource == null || !resource.exists())
-				return;
-			statechart = GeneratorBaseUtil.loadStatechart(resource);
-
-			ExecutionFlow executionFlow = GeneratorBaseUtil
-					.createExecutionFlowModel(statechart);
-			String absoluteTargetFolder = project.getRawLocation().toOSString() + File.separator + getOutletPath(resource);
-			GeneratorBaseUtil.generate(executionFlow, getTemplatePath(),
-					project, absoluteTargetFolder);
-		} catch (CoreException e) {
-			e.printStackTrace();
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
-
-	}
-}

+ 0 - 120
plugins/org.yakindu.sct.generator.base/src/org/yakindu/sct/generator/base/util/GeneratorBaseUtil.java

@@ -1,120 +0,0 @@
-package org.yakindu.sct.generator.base.util;
-
-import java.io.IOException;
-import java.util.Collections;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EcorePackage;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.Resource.Factory;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceFactoryRegistryImpl;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.xpand2.XpandExecutionContextImpl;
-import org.eclipse.xpand2.XpandFacade;
-import org.eclipse.xpand2.output.Outlet;
-import org.eclipse.xpand2.output.OutputImpl;
-import org.eclipse.xtend.expression.Variable;
-import org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel;
-import org.yakindu.sct.model.sexec.ExecutionFlow;
-import org.yakindu.sct.model.sexec.SexecPackage;
-import org.yakindu.sct.model.sexec.transformation.ModelSequencer;
-import org.yakindu.sct.model.sexec.transformation.SequencerModule;
-import org.yakindu.sct.model.sgraph.SGraphPackage;
-import org.yakindu.sct.model.sgraph.Statechart;
-import org.yakindu.sct.model.stext.stext.StextPackage;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public class GeneratorBaseUtil {
-
-	/**
-	 * Loads a {@link Statechart} model via the registered resource for a given
-	 * {@link URI}
-	 */
-	public static Statechart loadStatechart(IResource resource)
-			throws IOException {
-		URI uri = URI.createPlatformResourceURI(resource.getFullPath()
-				.toString(), true);
-		return loadStatechart(uri);
-	}
-
-	/**
-	 * Loads a {@link Statechart} model via the registered resource for a given
-	 * {@link URI}
-	 */
-	public static Statechart loadStatechart(URI uri) {
-		Resource resource = loadResource(uri);
-		Statechart statechart = (Statechart) resource.getContents().get(0);
-		Assert.isNotNull(statechart);
-		return statechart;
-	}
-
-	public static Resource loadResource(URI uri) {
-		Factory factory = ResourceFactoryRegistryImpl.INSTANCE.getFactory(uri);
-		ResourceSet resourceSet = new ResourceSetImpl();
-		Resource resource = factory.createResource(uri);
-		resourceSet.getResources().add(resource);
-		try {
-			resource.load(Collections.emptyMap());
-		} catch (IOException e) {
-			e.printStackTrace();
-			return null;
-		}
-		return resource;
-	}
-
-	/**
-	 * Transforms the {@link Statechart} model to a {@link ExecutionFlow} model
-	 */
-	public static ExecutionFlow createExecutionFlowModel(Statechart statechart) {
-		Injector injector = Guice.createInjector(new SequencerModule());
-		ModelSequencer sequencer = injector.getInstance(ModelSequencer.class);
-		ExecutionFlow flow = sequencer.transform(statechart);
-		Assert.isNotNull(flow);
-		return flow;
-	}
-
-	/**
-	 * Invokes the Template engine to generate resources
-	 */
-	public static void generate(ExecutionFlow flow, String templatePath,
-			IProject project, String targetFolder) throws CoreException {
-
-		OutputImpl output = new OutputImpl();
-		Outlet outlet = new Outlet(targetFolder);
-		outlet.setOverwrite(true);
-		output.addOutlet(outlet);
-
-		XpandExecutionContextImpl execCtx = new XpandExecutionContextImpl(
-				output, null, Collections.<String, Variable> emptyMap(), null,
-				null);
-		EmfRegistryMetaModel metamodel = new EmfRegistryMetaModel() {
-			@Override
-			protected EPackage[] allPackages() {
-				return new EPackage[] { SGraphPackage.eINSTANCE,
-						StextPackage.eINSTANCE, EcorePackage.eINSTANCE,
-						SexecPackage.eINSTANCE };
-			}
-		};
-		execCtx.registerMetaModel(metamodel);
-		// generate
-		XpandFacade facade = XpandFacade.create(execCtx);
-		facade.evaluate(templatePath, flow);
-		// refresh the project to get external updates:
-		project.refreshLocal(IResource.DEPTH_INFINITE,
-				new NullProgressMonitor());
-	}
-}