diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF
index a9d0e16b5b..63c8897139 100644
--- a/META-INF/MANIFEST.MF
+++ b/META-INF/MANIFEST.MF
@@ -28,8 +28,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.xtext.generator
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
-Export-Package: org.yakindu.sct.builder.nature,
- org.yakindu.sct.generator.core,
+Export-Package: org.yakindu.sct.generator.core,
org.yakindu.sct.generator.core.extensions,
org.yakindu.sct.generator.core.features,
org.yakindu.sct.generator.core.features.impl,
diff --git a/plugin.xml b/plugin.xml
index 3f904b5982..3f437af90d 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -78,74 +78,4 @@
generatorId="yakindu::generic">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/org/yakindu/sct/builder/SCTBuilder.java b/src/org/yakindu/sct/builder/SCTBuilder.java
deleted file mode 100644
index 219ae03403..0000000000
--- a/src/org/yakindu/sct/builder/SCTBuilder.java
+++ /dev/null
@@ -1,256 +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;
-
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.resources.IMarker;
-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.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.common.util.WrappedException;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.yakindu.sct.generator.core.GeneratorActivator;
-import org.yakindu.sct.generator.core.GeneratorExecutor;
-import org.yakindu.sct.model.sgen.GeneratorEntry;
-import org.yakindu.sct.model.sgen.GeneratorModel;
-import org.yakindu.sct.model.sgraph.Statechart;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Sets;
-
-/**
- *
- * @author andreas muelder - Initial contribution and API
- *
- */
-public class SCTBuilder extends IncrementalProjectBuilder {
-
- // TODO Remove dependency to fileextension and read referenced elements from
- // genmodels instead.
- private static final String SCT_FILE_EXTENSION = "sct";
- private static final String SGEN_FILE_EXTENSION = "sgen";
- public static final String BUILDER_ID = "org.yakindu.sct.builder.SCTBuilder";
-
- private final class ElementRefGenerator implements Predicate {
-
- private final URI uri;
-
- private ElementRefGenerator(EObject eobject) {
- if (EcoreUtil.getURI(eobject) != null) {
- uri = EcoreUtil.getURI(eobject);
- } else {
- uri = null;
- }
- }
-
- public boolean apply(GeneratorEntry input) {
- return uri != null && input.getElementRef() != null && !input.getElementRef().eIsProxy()
- && uri.equals(EcoreUtil.getURI(input.getElementRef()));
- }
- }
-
- class DeltaVisitor implements IResourceDeltaVisitor {
- private Set buildSgens = Sets.newHashSet();
-
- public boolean visit(IResourceDelta delta) throws CoreException {
- IResource resource = delta.getResource();
- switch (delta.getKind()) {
- case IResourceDelta.ADDED:
- // handle added resource
- doIt(resource, buildSgens);
- break;
- case IResourceDelta.REMOVED:
- // handle removed resource
- break;
- case IResourceDelta.CHANGED:
- // handle changed resource
- doIt(resource, buildSgens);
- break;
- }
- // return true to continue visiting children.
- return true;
- }
- }
-
- class SimpleResourceVisitor implements IResourceVisitor {
- private Set buildSgens = Sets.newHashSet();
-
- public boolean visit(IResource resource) {
- doIt(resource, buildSgens);
- // return true to continue visiting children.
- return true;
- }
- }
-
- @Override
- protected IProject[] build(int kind, @SuppressWarnings("rawtypes") Map args, IProgressMonitor monitor)
- throws CoreException {
-
- IPreferenceStore store = GeneratorActivator.getDefault().getPreferenceStore();
- boolean generateAutomatical = store.getBoolean(GeneratorActivator.PREF_GENERATE_AUTOMATICALLY);
-
- if (generateAutomatical) {
- if (kind == FULL_BUILD) {
- fullBuild(monitor);
- } else {
- IResourceDelta delta = getDelta(getProject());
- if (delta == null) {
- fullBuild(monitor);
- } else {
- incrementalBuild(delta, monitor);
- }
- }
- }
- return null;
- }
-
- protected void fullBuild(final IProgressMonitor monitor) throws CoreException {
- try {
- getProject().accept(new SimpleResourceVisitor());
- } catch (CoreException e) {
- }
- }
-
- protected void incrementalBuild(IResourceDelta delta, IProgressMonitor monitor) throws CoreException {
- delta.accept(new DeltaVisitor());
- }
-
- /**
- * Build the Statecharts inside this sgen-file or find all sgen-files for
- * the statechart in the resource and build them.
- *
- * @param changedResource
- * Resource to check, if it can be build.
- * @param buildSgens
- * Contains a set of already build sgen files. Accepted
- * sgen-files are added inside this method.
- */
- public void doIt(final IResource changedResource, final Set buildSgens) {
- if (changedResource.getType() != IResource.FILE) {
- return;
- }
- if (SGEN_FILE_EXTENSION.equals(changedResource.getFileExtension()) && !buildSgens.contains(changedResource)) {
- if (hasError(changedResource)) {
- logGenmodelError(changedResource.getFullPath().toString());
- } else {
- buildSgens.add(changedResource);
- executeGenmodelGenerator(changedResource);
- }
- } else if (SCT_FILE_EXTENSION.equals(changedResource.getFileExtension())) {
- // TODO rely on indexed genmodel and referenced objects uri
- final Statechart statechart = loadFromResource(changedResource);
- if (statechart == null)
- return;
- try {
- changedResource.getProject().accept(new IResourceVisitor() {
-
- public boolean visit(IResource resource) throws CoreException {
- if (IResource.FILE == resource.getType()
- && SGEN_FILE_EXTENSION.equals(resource.getFileExtension())
- && !buildSgens.contains(resource) && isGenmodelForStatechart(resource, statechart)) {
- // TODO: would be good to filter the config for the
- // statechart so only the sct that changed is
- // build
- if (hasError(changedResource)) {
- logStatechartError(changedResource.getFullPath().toString());
- } else {
- if (hasError(resource)) {
- logGenmodelError(resource.getFullPath().toString());
- } else {
- buildSgens.add(resource);
- executeGenmodelGenerator(resource);
- }
- }
- }
- return true;
- }
- });
- } catch (CoreException e) {
- e.printStackTrace();
- }
-
- }
- }
-
- private boolean hasError(IResource resource) {
- IMarker[] findMarkers = null;
- try {
- findMarkers = resource.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE);
- for (IMarker iMarker : findMarkers) {
- Integer attribute = (Integer) iMarker.getAttribute(IMarker.SEVERITY);
- if (attribute.intValue() == IMarker.SEVERITY_ERROR) {
- return true;
- }
- }
- } catch (CoreException e) {
- e.printStackTrace();
- }
- return false;
- }
-
- protected void executeGenmodelGenerator(IResource resource) {
- new GeneratorExecutor().executeGenerator(resource.getProject().getFile(resource.getProjectRelativePath()));
- }
-
- protected void logGenmodelError(String resource) {
- Status status = new Status(Status.ERROR, BUILDER_ID, String.format(
- "Cannot execute Genmodel %s. The file contains errors.", resource));
- Platform.getLog(GeneratorActivator.getDefault().getBundle()).log(status);
- }
-
- protected void logStatechartError(final String resource) {
- Status status = new Status(Status.ERROR, BUILDER_ID, String.format(
- "Cannot generate Code for Statechart %s. The file contains errors.", resource));
- Platform.getLog(GeneratorActivator.getDefault().getBundle()).log(status);
- }
-
- private boolean isGenmodelForStatechart(IResource genmodelResource, final Statechart statechart) {
- GeneratorModel genModel = loadFromResource(genmodelResource);
- return genModel != null && !genModel.getEntries().isEmpty()
- && Iterables.any(genModel.getEntries(), new ElementRefGenerator(statechart));
- }
-
- @SuppressWarnings("unchecked")
- private TYPE loadFromResource(IResource res) {
- URI uri = URI.createPlatformResourceURI(res.getFullPath().toString(), true);
- ResourceSet set = new ResourceSetImpl();
- Resource emfResource = null;
- try {
- emfResource = set.getResource(uri, true);
- } catch (WrappedException e) {
- Platform.getLog(GeneratorActivator.getDefault().getBundle()).log(
- new Status(IStatus.WARNING, GeneratorActivator.PLUGIN_ID, "Resource " + uri
- + " can not be loaded by builder", e));
- return null;
- }
- if (emfResource.getErrors().size() > 0 || emfResource.getContents().size() == 0)
- return null;
- return (TYPE) emfResource.getContents().get(0);
- }
-
-}
diff --git a/src/org/yakindu/sct/builder/nature/SCTNature.java b/src/org/yakindu/sct/builder/nature/SCTNature.java
deleted file mode 100644
index 0b4de95793..0000000000
--- a/src/org/yakindu/sct/builder/nature/SCTNature.java
+++ /dev/null
@@ -1,72 +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.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;
- }
-
-}
diff --git a/src/org/yakindu/sct/builder/nature/ToggleSCTNatureAction.java b/src/org/yakindu/sct/builder/nature/ToggleSCTNatureAction.java
deleted file mode 100644
index c20ce7c1ae..0000000000
--- a/src/org/yakindu/sct/builder/nature/ToggleSCTNatureAction.java
+++ /dev/null
@@ -1,96 +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.nature;
-
-import java.util.Iterator;
-import java.util.Map;
-
-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;
-import org.eclipse.ui.commands.IElementUpdater;
-import org.eclipse.ui.menus.UIElement;
-/**
- *
- * @author andreas muelder - Initial contribution and API
- *
- */
-public class ToggleSCTNatureAction implements IObjectActionDelegate,
- IElementUpdater {
-
- 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) {
- }
-
- public 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) {
- e.printStackTrace();
- }
- }
-
- public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
-
- }
-
-}
diff --git a/src/org/yakindu/sct/generator/core/AbstractWorkspaceGenerator.java b/src/org/yakindu/sct/generator/core/AbstractWorkspaceGenerator.java
index f5a875fac7..03dba3cc00 100644
--- a/src/org/yakindu/sct/generator/core/AbstractWorkspaceGenerator.java
+++ b/src/org/yakindu/sct/generator/core/AbstractWorkspaceGenerator.java
@@ -22,6 +22,7 @@
* @author holger willebrandt - Initial contribution and API
* @author Johannes Dicks - refactored because of EFS decoupling
*/
+@Deprecated
public abstract class AbstractWorkspaceGenerator extends AbstractSExecModelGenerator {
/**
diff --git a/src/org/yakindu/sct/generator/core/GeneratorExecutor.java b/src/org/yakindu/sct/generator/core/GeneratorExecutor.java
deleted file mode 100644
index d7ab995046..0000000000
--- a/src/org/yakindu/sct/generator/core/GeneratorExecutor.java
+++ /dev/null
@@ -1,108 +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.generator.core;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.yakindu.base.types.typesystem.AbstractTypeSystem;
-import org.yakindu.base.types.typesystem.ITypeSystem;
-import org.yakindu.sct.domain.extension.DomainRegistry;
-import org.yakindu.sct.domain.extension.IDomainDescriptor;
-import org.yakindu.sct.generator.core.extensions.GeneratorExtensions;
-import org.yakindu.sct.generator.core.extensions.IGeneratorDescriptor;
-import org.yakindu.sct.generator.core.impl.AbstractSGraphModelGenerator;
-import org.yakindu.sct.model.sgen.GeneratorEntry;
-import org.yakindu.sct.model.sgen.GeneratorModel;
-
-import com.google.inject.Injector;
-import com.google.inject.Module;
-
-/**
- *
- * @author andreas muelder - Initial contribution and API
- * @author holger willebrandt - refactoring
- * @author markus mühlbrandt - added executeGenerator for generator models
- */
-public class GeneratorExecutor {
-
- public void executeGenerator(IFile file) {
- Resource resource = loadResource(file);
- if (resource == null || resource.getContents().size() == 0 || resource.getErrors().size() > 0)
- return;
- final GeneratorModel model = (GeneratorModel) resource.getContents().get(0);
-
-
- Job generatorJob = new Job("Execute SCT Genmodel " + file.getName()) {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- executeGenerator(model);
- return Status.OK_STATUS;
- }
- };
- generatorJob.setRule(file.getProject().getWorkspace().getRuleFactory().buildRule());
- generatorJob.schedule();
- }
-
- public void executeGenerator(GeneratorModel model) {
-
- final EList entries = model.getEntries();
-
- for (GeneratorEntry generatorEntry : entries) {
- final ISCTGenerator generator = getGenerator(model, generatorEntry);
- generator.generate(generatorEntry);
- }
- }
-
- protected ISCTGenerator getGenerator(GeneratorModel model, GeneratorEntry entry) {
- String generatorId = model.getGeneratorId();
- IGeneratorDescriptor description = GeneratorExtensions.getGeneratorDescriptor(generatorId);
- if (description == null)
- throw new RuntimeException("No generator registered for ID: " + generatorId);
- final ISCTGenerator generator = description.createGenerator();
- if (generator == null)
- throw new RuntimeException("Failed to create Generator instance for ID:" + generatorId);
- IDomainDescriptor domainDescriptor = DomainRegistry.getDomainDescriptor(entry.getElementRef());
- Module overridesModule = null;
- if (generator instanceof AbstractSGraphModelGenerator) {
- overridesModule = ((AbstractSGraphModelGenerator) generator).getOverridesModule(entry);
- }
- Injector injector = domainDescriptor.getDomainInjectorProvider().getGeneratorInjector(model.getGeneratorId(),
- overridesModule);
- injector.injectMembers(generator);
-
- // TODO: refactor location for adding type system resource.
- ITypeSystem typeSystem = injector.getInstance(ITypeSystem.class);
- if (typeSystem instanceof AbstractTypeSystem) {
- ResourceSet set = entry.getElementRef().eResource().getResourceSet();
- set.getResources().add(((AbstractTypeSystem) typeSystem).getResource());
- EcoreUtil.resolveAll(set);
- }
-
- return generator;
- }
-
- protected Resource loadResource(IFile file) {
- Resource resource = null;
- URI uri = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
- resource = new ResourceSetImpl().getResource(uri, true);
- return resource;
- }
-
-}
diff --git a/src/org/yakindu/sct/generator/core/impl/GenericJavaBasedGenerator.java b/src/org/yakindu/sct/generator/core/impl/GenericJavaBasedGenerator.java
index e40665ea36..126138970d 100644
--- a/src/org/yakindu/sct/generator/core/impl/GenericJavaBasedGenerator.java
+++ b/src/org/yakindu/sct/generator/core/impl/GenericJavaBasedGenerator.java
@@ -37,6 +37,7 @@
*
* @author holger willebrandt - Initial contribution and API
*/
+@Deprecated
public class GenericJavaBasedGenerator extends AbstractSExecModelGenerator {
@Inject