Procházet zdrojové kódy

moved project generator.base to archive

Andreas Mülder před 13 roky
rodič
revize
bfebf862c4
20 změnil soubory, kde provedl 0 přidání a 1288 odebrání
  1. 0 7
      plugins/org.yakindu.sct.generator.base/.classpath
  2. 0 28
      plugins/org.yakindu.sct.generator.base/.project
  3. 0 8
      plugins/org.yakindu.sct.generator.base/.settings/org.eclipse.jdt.core.prefs
  4. 0 25
      plugins/org.yakindu.sct.generator.base/META-INF/MANIFEST.MF
  5. 0 5
      plugins/org.yakindu.sct.generator.base/build.properties
  6. 0 47
      plugins/org.yakindu.sct.generator.base/plugin.xml
  7. 0 133
      plugins/org.yakindu.sct.generator.base/schema/org.yakindu.sct.builder.generator.exsd
  8. 0 109
      plugins/org.yakindu.sct.generator.base/schema/org.yakindu.sct.builder.subscriber.exsd
  9. 0 61
      plugins/org.yakindu.sct.generator.base/src/org/yakindu/sct/builder/BuilderActivator.java
  10. 0 103
      plugins/org.yakindu.sct.generator.base/src/org/yakindu/sct/builder/SCTBuilder.java
  11. 0 62
      plugins/org.yakindu.sct.generator.base/src/org/yakindu/sct/builder/nature/SCTNature.java
  12. 0 77
      plugins/org.yakindu.sct.generator.base/src/org/yakindu/sct/builder/nature/ToggleSCTNatureAction.java
  13. 0 19
      plugins/org.yakindu.sct.generator.base/src/org/yakindu/sct/builder/subscriber/IBuilderSubscriber.java
  14. 0 51
      plugins/org.yakindu.sct.generator.base/src/org/yakindu/sct/builder/subscriber/SubscriberExtensions.java
  15. 0 62
      plugins/org.yakindu.sct.generator.base/src/org/yakindu/sct/generator/base/AbstractSCTGenerator.java
  16. 0 50
      plugins/org.yakindu.sct.generator.base/src/org/yakindu/sct/generator/base/GeneratorActivator.java
  17. 0 59
      plugins/org.yakindu.sct.generator.base/src/org/yakindu/sct/generator/base/internal/GeneratorExtensions.java
  18. 0 200
      plugins/org.yakindu.sct.generator.base/src/org/yakindu/sct/generator/base/internal/SCTGenerator.java
  19. 0 53
      plugins/org.yakindu.sct.generator.base/src/org/yakindu/sct/generator/base/util/AbstractXpandCodeGeneratorSubscriber.java
  20. 0 129
      plugins/org.yakindu.sct.generator.base/src/org/yakindu/sct/generator/base/util/GeneratorBaseUtil.java

+ 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 @@
-#Thu Sep 22 14:49:19 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 - 25
plugins/org.yakindu.sct.generator.base/META-INF/MANIFEST.MF

@@ -1,25 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Builder
-Bundle-SymbolicName: org.yakindu.sct.generator.base;singleton:=true
-Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: org.yakindu.sct.builder.BuilderActivator
-Bundle-Vendor: YAKINDU
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.emf,
- org.eclipse.xtend,
- org.eclipse.xtend.typesystem.emf,
- org.eclipse.xpand,
- org.eclipse.core.resources;visibility:=reexport,
- org.yakindu.sct.model.sgraph;visibility:=reexport,
- org.yakindu.sct.model.sexec;visibility:=reexport,
- org.yakindu.sct.model.stext,
- org.yakindu.sct.model.sgen;bundle-version="1.0.0",
- com.google.inject,
- com.google.collect
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-ActivationPolicy: lazy
-Export-Package: org.yakindu.sct.builder.subscriber,
- org.yakindu.sct.generator.base,
- org.yakindu.sct.generator.base.util

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

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

+ 0 - 47
plugins/org.yakindu.sct.generator.base/plugin.xml

@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
-   <extension-point id="org.yakindu.sct.builder.subscriber" name="Builder Subscriber" schema="schema/org.yakindu.sct.builder.subscriber.exsd"/>
-   <extension-point id="org.yakindu.sct.builder.generator" name="SCT Generator" schema="schema/org.yakindu.sct.builder.generator.exsd"/>
-
-   <extension
-         id="org.yakindu.sct.builder.SCTBuilder"
-         name="YAKINDU HMI Builder"
-         point="org.eclipse.core.resources.builders">
-      <builder
-            hasNature="true">
-         <run
-               class="org.yakindu.sct.builder.SCTBuilder">
-         </run>
-      </builder>
-   </extension>
-   <extension
-         id="org.yakindu.sct.builder.SCTNature"
-         name="YAKINDU SCT Project Nature"
-         point="org.eclipse.core.resources.natures">
-      <runtime>
-         <run
-               class="org.yakindu.sct.builder.nature.SCTNature">
-         </run>
-      </runtime>
-      <builder
-            id="org.yakindu.sct.builder.SCTBuilder">
-      </builder>
-   </extension>
-   <extension
-         point="org.eclipse.ui.popupMenus">
-      <objectContribution
-            adaptable="true"
-            objectClass="org.eclipse.core.resources.IProject"
-            nameFilter="*"
-            id="org.yakindu.sct.builder.contribution1">
-         <action
-               label="Add/Remove YAKINDU SCT Nature"
-               class="org.yakindu.sct.builder.nature.ToggleSCTNatureAction"
-               menubarPath="additions"
-               enablesFor="+"
-               id="org.yakindu.sct.builder.addRemoveNatureAction">
-         </action>
-      </objectContribution>
-   </extension>
-</plugin>

+ 0 - 133
plugins/org.yakindu.sct.generator.base/schema/org.yakindu.sct.builder.generator.exsd

@@ -1,133 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.yakindu.sct.statechart.builder" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
-      <appinfo>
-         <meta.schema plugin="org.yakindu.sct.statechart.builder" id="org.yakindu.sct.builder.generator" name="Generator"/>
-      </appinfo>
-      <documentation>
-         [Enter description of this extension point.]
-      </documentation>
-   </annotation>
-
-   <element name="extension">
-      <annotation>
-         <appinfo>
-            <meta.element />
-         </appinfo>
-      </annotation>
-      <complexType>
-         <sequence>
-            <element ref="SCTGenerator"/>
-         </sequence>
-         <attribute name="point" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="id" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="name" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-               <appinfo>
-                  <meta.attribute translatable="true"/>
-               </appinfo>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <element name="SCTGenerator">
-      <complexType>
-         <attribute name="class" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-               <appinfo>
-                  <meta.attribute kind="java" basedOn="org.yakindu.sct.generator.base.util.AbstractSCTGenerator:"/>
-               </appinfo>
-            </annotation>
-         </attribute>
-         <attribute name="resourceExtension" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="icon" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-               <appinfo>
-                  <meta.attribute kind="resource"/>
-               </appinfo>
-            </annotation>
-         </attribute>
-         <attribute name="name" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="description" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="since"/>
-      </appinfo>
-      <documentation>
-         [Enter the first release in which this extension point appears.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="examples"/>
-      </appinfo>
-      <documentation>
-         [Enter extension point usage example here.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="apiinfo"/>
-      </appinfo>
-      <documentation>
-         [Enter API information here.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="implementation"/>
-      </appinfo>
-      <documentation>
-         [Enter information about supplied implementation of this extension point.]
-      </documentation>
-   </annotation>
-
-
-</schema>

+ 0 - 109
plugins/org.yakindu.sct.generator.base/schema/org.yakindu.sct.builder.subscriber.exsd

@@ -1,109 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.yakindu.sct.builder" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
-      <appinfo>
-         <meta.schema plugin="org.yakindu.sct.builder" id="org.yakindu.sct.builder.subscriber" name="Builder Subscriber"/>
-      </appinfo>
-      <documentation>
-         [Enter description of this extension point.]
-      </documentation>
-   </annotation>
-
-   <element name="extension">
-      <annotation>
-         <appinfo>
-            <meta.element />
-         </appinfo>
-      </annotation>
-      <complexType>
-         <sequence>
-            <element ref="BuilderSubscriber"/>
-         </sequence>
-         <attribute name="point" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="id" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="name" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-               <appinfo>
-                  <meta.attribute translatable="true"/>
-               </appinfo>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <element name="BuilderSubscriber">
-      <complexType>
-         <attribute name="class" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-               <appinfo>
-                  <meta.attribute kind="java" basedOn=":org.yakindu.sct.builder.subscriber.IBuilderSubscriber"/>
-               </appinfo>
-            </annotation>
-         </attribute>
-         <attribute name="resourceExtension" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="since"/>
-      </appinfo>
-      <documentation>
-         [Enter the first release in which this extension point appears.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="examples"/>
-      </appinfo>
-      <documentation>
-         [Enter extension point usage example here.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="apiinfo"/>
-      </appinfo>
-      <documentation>
-         [Enter API information here.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="implementation"/>
-      </appinfo>
-      <documentation>
-         [Enter information about supplied implementation of this extension point.]
-      </documentation>
-   </annotation>
-
-
-</schema>

+ 0 - 61
plugins/org.yakindu.sct.generator.base/src/org/yakindu/sct/builder/BuilderActivator.java

@@ -1,61 +0,0 @@
-package org.yakindu.sct.builder;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class BuilderActivator extends AbstractUIPlugin {
-
-	// The plug-in ID
-	public static final String PLUGIN_ID = "org.yakindu.sct.builder"; //$NON-NLS-1$
-
-	// The shared instance
-	private static BuilderActivator plugin;
-	
-	/**
-	 * The constructor
-	 */
-	public BuilderActivator() {
-	}
-
-	/*
-	 * (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 BuilderActivator getDefault() {
-		return plugin;
-	}
-
-	/**
-	 * Returns an image descriptor for the image file at the given
-	 * plug-in relative path
-	 *
-	 * @param path the path
-	 * @return the image descriptor
-	 */
-	public static ImageDescriptor getImageDescriptor(String path) {
-		return imageDescriptorFromPlugin(PLUGIN_ID, path);
-	}
-}

+ 0 - 103
plugins/org.yakindu.sct.generator.base/src/org/yakindu/sct/builder/SCTBuilder.java

@@ -1,103 +0,0 @@
-package org.yakindu.sct.builder;
-
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.resources.IResourceVisitor;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.yakindu.sct.builder.subscriber.IBuilderSubscriber;
-import org.yakindu.sct.builder.subscriber.SubscriberExtensions;
-
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public class SCTBuilder extends IncrementalProjectBuilder {
-
-	class DeltaVisitor implements IResourceDeltaVisitor {
-		public boolean visit(IResourceDelta delta) throws CoreException {
-			IResource resource = delta.getResource();
-			switch (delta.getKind()) {
-			case IResourceDelta.ADDED:
-				// handle added resource
-				doIt(resource);
-				break;
-			case IResourceDelta.REMOVED:
-				// handle removed resource
-				break;
-			case IResourceDelta.CHANGED:
-				// handle changed resource
-				doIt(resource);
-				break;
-			}
-			// return true to continue visiting children.
-			return true;
-		}
-	}
-
-	class SampleResourceVisitor implements IResourceVisitor {
-		public boolean visit(IResource resource) {
-			doIt(resource);
-			// return true to continue visiting children.
-			return true;
-		}
-	}
-
-	public static final String BUILDER_ID = "org.yakindu.sct.builder.SCTBuilder";
-
-	@Override
-	protected IProject[] build(int kind,
-			@SuppressWarnings("rawtypes") Map args, IProgressMonitor monitor)
-			throws CoreException {
-		if (kind == FULL_BUILD) {
-			fullBuild(monitor);
-		} else {
-			IResourceDelta delta = getDelta(getProject());
-			if (delta == null) {
-				fullBuild(monitor);
-			} else {
-				incrementalBuild(delta, monitor);
-			}
-		}
-		return null;
-	}
-
-	public void doIt(IResource resource) {
-		List<IBuilderSubscriber> subscriber = SubscriberExtensions
-				.getSubscriber(resource.getLocation().toOSString());
-		// System.out.println("try to build: " + resource.getLocationURI());
-		for (IBuilderSubscriber builderSubscriber : subscriber) {
-			try {
-				builderSubscriber.doBuild(resource);
-			} catch (Exception e) {
-				e.printStackTrace();
-			}
-		}
-		// try {
-		// new SCTGenerator().doBuild(resource);
-		// } catch (CoreException e) {
-		// // TODO Auto-generated catch block
-		// e.printStackTrace();
-		// }
-	}
-
-	protected void fullBuild(final IProgressMonitor monitor)
-			throws CoreException {
-		try {
-			getProject().accept(new SampleResourceVisitor());
-		} catch (CoreException e) {
-		}
-	}
-
-	protected void incrementalBuild(IResourceDelta delta,
-			IProgressMonitor monitor) throws CoreException {
-		delta.accept(new DeltaVisitor());
-	}
-}

+ 0 - 62
plugins/org.yakindu.sct.generator.base/src/org/yakindu/sct/builder/nature/SCTNature.java

@@ -1,62 +0,0 @@
-package org.yakindu.sct.builder.nature;
-
-import org.eclipse.core.resources.ICommand;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IProjectNature;
-import org.eclipse.core.runtime.CoreException;
-import org.yakindu.sct.builder.SCTBuilder;
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- *
- */
-public class SCTNature implements IProjectNature {
-
-	public static final String NATURE_ID = "org.yakindu.sct.builder.SCTNature";
-
-	private IProject project;
-
-	public void configure() throws CoreException {
-		IProjectDescription desc = project.getDescription();
-		ICommand[] commands = desc.getBuildSpec();
-		for (int i = 0; i < commands.length; ++i) {
-			if (commands[i].getBuilderName().equals(SCTBuilder.BUILDER_ID)) {
-				return;
-			}
-		}
-
-		ICommand[] newCommands = new ICommand[commands.length + 1];
-		System.arraycopy(commands, 0, newCommands, 0, commands.length);
-		ICommand command = desc.newCommand();
-		command.setBuilderName(SCTBuilder.BUILDER_ID);
-		newCommands[newCommands.length - 1] = command;
-		desc.setBuildSpec(newCommands);
-		project.setDescription(desc, null);
-	}
-
-	public void deconfigure() throws CoreException {
-		IProjectDescription description = getProject().getDescription();
-		ICommand[] commands = description.getBuildSpec();
-		for (int i = 0; i < commands.length; ++i) {
-			if (commands[i].getBuilderName().equals(SCTBuilder.BUILDER_ID)) {
-				ICommand[] newCommands = new ICommand[commands.length - 1];
-				System.arraycopy(commands, 0, newCommands, 0, i);
-				System.arraycopy(commands, i + 1, newCommands, i,
-						commands.length - i - 1);
-				description.setBuildSpec(newCommands);
-				project.setDescription(description, null);			
-				return;
-			}
-		}
-	}
-
-	public IProject getProject() {
-		return project;
-	}
-
-	public void setProject(IProject project) {
-		this.project = project;
-	}
-
-}

+ 0 - 77
plugins/org.yakindu.sct.generator.base/src/org/yakindu/sct/builder/nature/ToggleSCTNatureAction.java

@@ -1,77 +0,0 @@
-package org.yakindu.sct.builder.nature;
-
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- *
- */
-public class ToggleSCTNatureAction implements IObjectActionDelegate {
-
-	private ISelection selection;
-
-	public void run(IAction action) {
-		if (selection instanceof IStructuredSelection) {
-			for (Iterator<?> it = ((IStructuredSelection) selection).iterator(); it
-					.hasNext();) {
-				Object element = it.next();
-				IProject project = null;
-				if (element instanceof IProject) {
-					project = (IProject) element;
-				} else if (element instanceof IAdaptable) {
-					project = (IProject) ((IAdaptable) element)
-							.getAdapter(IProject.class);
-				}
-				if (project != null) {
-					toggleNature(project);
-				}
-			}
-		}
-	}
-
-	public void selectionChanged(IAction action, ISelection selection) {
-		this.selection = selection;
-	}
-
-	public void setActivePart(IAction action, IWorkbenchPart targetPart) {
-	}
-
-	private void toggleNature(IProject project) {
-		try {
-			IProjectDescription description = project.getDescription();
-			String[] natures = description.getNatureIds();
-
-			for (int i = 0; i < natures.length; ++i) {
-				if (SCTNature.NATURE_ID.equals(natures[i])) {
-					// Remove the nature
-					String[] newNatures = new String[natures.length - 1];
-					System.arraycopy(natures, 0, newNatures, 0, i);
-					System.arraycopy(natures, i + 1, newNatures, i,
-							natures.length - i - 1);
-					description.setNatureIds(newNatures);
-					project.setDescription(description, null);
-					return;
-				}
-			}
-
-			// Add the nature
-			String[] newNatures = new String[natures.length + 1];
-			System.arraycopy(natures, 0, newNatures, 0, natures.length);
-			newNatures[natures.length] = SCTNature.NATURE_ID;
-			description.setNatureIds(newNatures);
-			project.setDescription(description, null);
-		} catch (CoreException e) {
-		}
-	}
-
-}

+ 0 - 19
plugins/org.yakindu.sct.generator.base/src/org/yakindu/sct/builder/subscriber/IBuilderSubscriber.java

@@ -1,19 +0,0 @@
-package org.yakindu.sct.builder.subscriber;
-
-import java.io.IOException;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-@Deprecated
-public interface IBuilderSubscriber {
-
-	@Deprecated
-	public void doBuild(IResource resource) throws IOException, CoreException;
-
-}

+ 0 - 51
plugins/org.yakindu.sct.generator.base/src/org/yakindu/sct/builder/subscriber/SubscriberExtensions.java

@@ -1,51 +0,0 @@
-/**
- * Copyright (c) 2011 committers of YAKINDU and others.
- * 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:
- * 	committers of YAKINDU - initial API and implementation
- * 
- */
-
-package org.yakindu.sct.builder.subscriber;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-@Deprecated
-public class SubscriberExtensions {
-
-	private static final String extensionPointId = "org.yakindu.sct.builder.subscriber";
-
-	public static List<IBuilderSubscriber> getSubscriber(String resourceUri) {
-		List<IBuilderSubscriber> providers = new ArrayList<IBuilderSubscriber>();
-		IConfigurationElement[] configurationElements = Platform
-				.getExtensionRegistry().getConfigurationElementsFor(
-						extensionPointId);
-		for (IConfigurationElement configurationElement : configurationElements) {
-			try {
-				String resourceExtension = configurationElement
-						.getAttribute("resourceExtension");
-				if (resourceUri.endsWith(resourceExtension)) {
-					IBuilderSubscriber provider = (IBuilderSubscriber) configurationElement
-							.createExecutableExtension("class");
-					providers.add(provider);
-				}
-			} catch (CoreException e) {
-				e.printStackTrace();
-			}
-		}
-		return providers;
-	}
-}

+ 0 - 62
plugins/org.yakindu.sct.generator.base/src/org/yakindu/sct/generator/base/AbstractSCTGenerator.java

@@ -1,62 +0,0 @@
-package org.yakindu.sct.generator.base;
-
-import static com.google.common.collect.Iterables.getOnlyElement;
-import static org.yakindu.sct.generator.base.util.GeneratorBaseUtil.resourceSimpleName;
-
-import org.eclipse.core.resources.IResource;
-import org.yakindu.sct.model.sgen.GeneratorConfiguration;
-import org.yakindu.sct.model.sgen.GeneratorModel;
-import org.yakindu.sct.model.sgen.OutletConfiguration;
-
-import com.google.common.collect.Iterables;
-
-/**
- * 
- * 
- * @author holger willebrandt - Initial contribution and API
- */
-public abstract class AbstractSCTGenerator<GENMODEL extends GeneratorModel> {
-
-	public final void processModels(
-			Iterable<GeneratorModel> genModelsForStatechart, IResource resource) {
-
-		for (GeneratorModel generatorModel : genModelsForStatechart) {
-
-			GeneratorConfiguration configuration = generatorModel
-					.getConfiguration();
-
-			if (configuration != null) {
-
-				OutletConfiguration outletConfiguration = getOnlyElement(Iterables
-						.filter(configuration.getConfigurations(),
-								OutletConfiguration.class));
-				executeOutlet(outletConfiguration, resource);
-
-				@SuppressWarnings("unchecked")
-				GENMODEL genmodel = (GENMODEL) generatorModel;
-				generate(genmodel);
-			}
-		}
-	}
-
-	protected void executeOutlet(OutletConfiguration outletConfiguration,
-			IResource resource) {
-		String path = outletConfiguration.getPath();
-
-		String realPath = resolvePlacholders(path,
-
-		resourceSimpleName(resource));
-		System.out.println("outlet path is " + realPath);
-		/*
-		 * TODO perform necessary filesystem opertations
-		 */
-
-	}
-
-	public abstract void generate(GENMODEL genmodel);
-
-	private String resolvePlacholders(String input, String statechartName) {
-		return input.replaceAll("%statechartname", statechartName);
-	}
-
-}

+ 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 - 59
plugins/org.yakindu.sct.generator.base/src/org/yakindu/sct/generator/base/internal/GeneratorExtensions.java

@@ -1,59 +0,0 @@
-package org.yakindu.sct.generator.base.internal;
-
-import static com.google.common.collect.Iterables.transform;
-import static com.google.common.collect.Lists.newArrayList;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.yakindu.sct.generator.base.AbstractSCTGenerator;
-
-import com.google.common.base.Function;
-
-/**
- * 
- * 
- * @author holger willebrandt - Initial contribution and API
- */
-public class GeneratorExtensions {
-
-	private static final String EXTENSION_POINT_ID = "org.yakindu.sct.builder.generator";
-	private static final String ATTRIBUTE_CLASS = "class";
-	private static final String ATTRIBUTE_RESOURCE_EXTENSION = "resourceExtension";
-
-	public static class GeneratorDescriptor {
-		private final IConfigurationElement configElement;
-
-		GeneratorDescriptor(IConfigurationElement configElement) {
-			this.configElement = configElement;
-		}
-
-		public AbstractSCTGenerator<?> getGenerator() throws CoreException {
-			return (AbstractSCTGenerator<?>) configElement
-					.createExecutableExtension(ATTRIBUTE_CLASS);
-		}
-
-		public String getResourceExtension() {
-			return configElement.getAttribute(ATTRIBUTE_RESOURCE_EXTENSION);
-		}
-	}
-
-	public static Iterable<GeneratorDescriptor> getGeneratorDescriptors() {
-		IConfigurationElement[] configurationElements = Platform
-				.getExtensionRegistry().getConfigurationElementsFor(
-						EXTENSION_POINT_ID);
-		return transform(newArrayList(configurationElements),
-				new CreateGeneratorDescritor());
-	}
-
-	private static final class CreateGeneratorDescritor implements
-			Function<IConfigurationElement, GeneratorDescriptor> {
-		CreateGeneratorDescritor() {
-		}
-
-		public GeneratorDescriptor apply(IConfigurationElement from) {
-			return new GeneratorDescriptor(from);
-		}
-	}
-
-}

+ 0 - 200
plugins/org.yakindu.sct.generator.base/src/org/yakindu/sct/generator/base/internal/SCTGenerator.java

@@ -1,200 +0,0 @@
-package org.yakindu.sct.generator.base.internal;
-
-import static com.google.common.base.Predicates.compose;
-import static com.google.common.base.Predicates.equalTo;
-import static com.google.common.collect.Iterables.any;
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.transform;
-import static org.yakindu.sct.generator.base.util.GeneratorBaseUtil.resourceSimpleName;
-
-import java.util.Set;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceVisitor;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.yakindu.sct.generator.base.AbstractSCTGenerator;
-import org.yakindu.sct.generator.base.internal.GeneratorExtensions.GeneratorDescriptor;
-import org.yakindu.sct.generator.base.util.GeneratorBaseUtil;
-import org.yakindu.sct.model.sgen.GeneratorModel;
-import org.yakindu.sct.model.sgen.SGenPackage;
-import org.yakindu.sct.model.sgen.StatechartReferences;
-import org.yakindu.sct.model.sgraph.Statechart;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Sets;
-
-/**
- * 
- * 
- * @author holger willebrandt - Initial contribution and API
- */
-public class SCTGenerator {
-
-	private static final String STATECHART_FILE_EXTENSION = "sct";
-
-	public void doBuild(IResource statechartResource) throws CoreException {
-
-		if (!isStatechartResource(statechartResource)) {
-			return;
-		}
-
-		final Iterable<GeneratorDescriptor> generatorDescriptors = GeneratorExtensions
-				.getGeneratorDescriptors();
-
-		final Iterable<String> genmodelExtensions = Iterables.transform(
-				generatorDescriptors, new GetResourceExtension());
-
-		final Set<IResource> genModelResources = findAllGenModels(
-				statechartResource, genmodelExtensions);
-
-		for (GeneratorDescriptor generatorDescriptor : generatorDescriptors) {
-			String resourceExtension = generatorDescriptor
-					.getResourceExtension();
-
-			Iterable<GeneratorModel> genModelsForStatechart = findGenmodelsForStatechart(
-					genModelResources, statechartResource, resourceExtension);
-
-			if (!Iterables.isEmpty(genModelsForStatechart)) {
-
-				AbstractSCTGenerator<?> generator = generatorDescriptor
-						.getGenerator();
-
-				generator.processModels(genModelsForStatechart,
-						statechartResource);
-			}
-
-		}
-	}
-
-	private Iterable<GeneratorModel> findGenmodelsForStatechart(
-			final Set<IResource> genModelResources,
-			IResource statechartResource, String resourceExtension) {
-		Predicate<IResource> isResourceExtension = compose(
-				equalTo(resourceExtension), new GetFileExtension());
-
-		Iterable<GeneratorModel> genModelsForStatechart = filter(
-				transform(filter(genModelResources, isResourceExtension),
-						new CreateGeneratorModel()),
-				new IsConfigurationForStatechart(statechartResource));
-		return genModelsForStatechart;
-	}
-
-	private boolean isStatechartResource(IResource statechartResource) {
-		return STATECHART_FILE_EXTENSION.matches(statechartResource
-				.getFileExtension());
-	}
-
-	private Set<IResource> findAllGenModels(IResource resource,
-			final Iterable<String> resourceExtensions) throws CoreException {
-		final Set<IResource> resources = Sets.newHashSet();
-		resource.getProject().accept(
-				new ResourceVisitor(resourceExtensions, resources));
-		return resources;
-	}
-
-	private static final class ResourceVisitor implements IResourceVisitor {
-		private final Iterable<String> resourceExtensions;
-		private final Set<IResource> resources;
-
-		ResourceVisitor(Iterable<String> resourceExtensions,
-				Set<IResource> resources) {
-			this.resourceExtensions = resourceExtensions;
-			this.resources = resources;
-		}
-
-		public boolean visit(IResource resource) throws CoreException {
-			int resourceType = resource.getType();
-			if (any(resourceExtensions, equalTo(resource.getFileExtension()))) {
-				resources.add(resource);
-				return false;
-			}
-			return resourceType == IResource.FOLDER
-					|| resourceType == IResource.PROJECT;
-		}
-	}
-
-	private static final class GetStatechartName implements
-			Function<Statechart, String> {
-		GetStatechartName() {
-		}
-
-		public String apply(Statechart from) {
-			Assert.isNotNull(from,
-					String.format("Null Input in %s", getClass()));
-			return from.getName();
-		}
-	}
-
-	private static final class IsConfigurationForStatechart implements
-			Predicate<GeneratorModel> {
-
-		private final IResource resource;
-
-		public IsConfigurationForStatechart(IResource resource) {
-			this.resource = resource;
-		}
-
-		public boolean apply(GeneratorModel input) {
-			Assert.isNotNull(input,
-					String.format("Null Input in %s", getClass()));
-			StatechartReferences references = input.getStatechartReferences();
-			boolean isMatch = references != null
-					&& any(references.getStatecharts(),
-							compose(equalTo(resourceSimpleName(resource)),
-									new GetStatechartName()));
-			return isMatch;
-		}
-	}
-
-	private static final class CreateGeneratorModel implements
-			Function<IResource, GeneratorModel> {
-		CreateGeneratorModel() {
-		}
-
-		public GeneratorModel apply(IResource inputResource) {
-			URI uri = URI.createPlatformResourceURI(inputResource.getFullPath()
-					.toString(), true);
-
-			Resource emfResource = GeneratorBaseUtil.loadResource(uri);
-
-			GeneratorModel genmodel = (GeneratorModel) EcoreUtil
-					.getObjectByType(emfResource.getContents(),
-							SGenPackage.Literals.GENERATOR_MODEL);
-			Assert.isNotNull(genmodel, String.format(
-					"Could not load GeneratorModel from resource %s",
-					inputResource));
-			return genmodel;
-		}
-	}
-
-	private static final class GetFileExtension implements
-			Function<IResource, String> {
-		GetFileExtension() {
-		}
-
-		public String apply(IResource from) {
-			Assert.isNotNull(from,
-					String.format("Null Input in %s", getClass()));
-			return from.getFileExtension();
-		}
-	}
-
-	private static final class GetResourceExtension implements
-			Function<GeneratorDescriptor, String> {
-		GetResourceExtension() {
-		}
-
-		public String apply(GeneratorDescriptor from) {
-			Assert.isNotNull(from,
-					String.format("Null Input in %s", getClass()));
-			return from.getResourceExtension();
-		}
-	}
-
-}

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

@@ -1,53 +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.eclipse.core.runtime.IPath;
-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) {
-		System.out.println(getClass() + ".doBuild()");
-		try {
-			IProject project = resource.getProject();
-			Statechart statechart;
-			if (resource == null || !resource.exists()) {
-				return;
-			}
-			statechart = GeneratorBaseUtil.loadStatechart(resource);
-
-			ExecutionFlow executionFlow = GeneratorBaseUtil
-					.createExecutionFlowModel(statechart);
-			IPath location = project.getRawLocation();
-			if (location == null) {
-				location = project.getLocation();
-			}
-			String absoluteTargetFolder = location.toOSString()
-					+ File.separator + getOutletPath(resource);
-			GeneratorBaseUtil.generate(executionFlow, getTemplatePath(),
-					project, absoluteTargetFolder);
-		} catch (CoreException e) {
-			e.printStackTrace();
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
-
-	}
-}

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

@@ -1,129 +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());
-	}
-
-	public static String resourceSimpleName(IResource resource) {
-		if (resource != null) {
-			String name = resource.getName();
-			String extension = resource.getFileExtension();
-			return name.substring(0, name.length() - extension.length() - 1);
-		}
-		return null;
-	}
-}