Skip to content
Snippets Groups Projects
Commit b1c789e9 authored by Kevin Kassin's avatar Kevin Kassin
Browse files

Commit 9.9 22:55

changed java version in build path and manifest to java 1.8,
integrated first version of transformation (not fully working yet)
parent 9743e0f3
Branches
Tags
No related merge requests found
...@@ -29,4 +29,5 @@ Import-Package: de.ovgu.featureide.fm.ui.editors.configuration, ...@@ -29,4 +29,5 @@ Import-Package: de.ovgu.featureide.fm.ui.editors.configuration,
org.eclipse.graphiti.features;version="0.13.2", org.eclipse.graphiti.features;version="0.13.2",
org.framed.iorm.featuremodel, org.framed.iorm.featuremodel,
org.framed.iorm.model, org.framed.iorm.model,
org.framed.iorm.model.provider org.framed.iorm.model.provider,
org.framed.orm.transformation
package org.framed.iorm.ui.multipage; package org.framed.iorm.ui.multipage;
import java.io.IOException;
import java.util.Collections;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource; 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.graphiti.features.ICreateFeature; import org.eclipse.graphiti.features.ICreateFeature;
import org.eclipse.graphiti.features.context.impl.CreateContext; import org.eclipse.graphiti.features.context.impl.CreateContext;
import org.eclipse.graphiti.mm.pictograms.Diagram; import org.eclipse.graphiti.mm.pictograms.Diagram;
...@@ -41,6 +50,7 @@ import org.framed.iorm.ui.util.PropertyUtil; ...@@ -41,6 +50,7 @@ import org.framed.iorm.ui.util.PropertyUtil;
import org.framed.iorm.ui.providers.DiagramTypeProvider; //*import for javadoc link import org.framed.iorm.ui.providers.DiagramTypeProvider; //*import for javadoc link
import org.framed.iorm.ui.providers.ToolBehaviorProvider; import org.framed.iorm.ui.providers.ToolBehaviorProvider;
import org.framed.iorm.ui.wizards.RoleModelWizard; //*import for javadoc link import org.framed.iorm.ui.wizards.RoleModelWizard; //*import for javadoc link
import org.framed.orm.transformation.TransformationExecutor;
/** /**
* This class is creates the overall editor to edit the role model. * This class is creates the overall editor to edit the role model.
...@@ -362,6 +372,9 @@ public class MultipageEditor extends FormEditor implements ISelectionListener, I ...@@ -362,6 +372,9 @@ public class MultipageEditor extends FormEditor implements ISelectionListener, I
if(editorFeatures != null) if(editorFeatures != null)
editorFeatures.synchronizeConfigurationEditorAndModelConfiguration(); editorFeatures.synchronizeConfigurationEditorAndModelConfiguration();
refreshFile(); refreshFile();
//TEST AREA
transformModel();
//TEST AREA
MultipageEditorSynchronizationService.synchronize(); MultipageEditorSynchronizationService.synchronize();
} }
} }
...@@ -389,6 +402,26 @@ public class MultipageEditor extends FormEditor implements ISelectionListener, I ...@@ -389,6 +402,26 @@ public class MultipageEditor extends FormEditor implements ISelectionListener, I
} else throw new NullPointerException(MUTLIPAGE_EDITOR_ERROR_NULLPOINTER_ON_FILE_EDITOR_INPUT); } else throw new NullPointerException(MUTLIPAGE_EDITOR_ERROR_NULLPOINTER_ON_FILE_EDITOR_INPUT);
} }
//TODO
public void transformModel() {
Resource diagram_resource = EditorInputUtil.getResourceFromEditorInput(getEditorInput());
URI sourceURI = diagram_resource.getURI();
sourceURI = sourceURI.trimFileExtension();
sourceURI = sourceURI.appendFileExtension("crom");
Path path = new Path(sourceURI.toFileString());
IFile iFile = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path);
URI targetURI = URI.createPlatformResourceURI(iFile.getFullPath().toString(), true);
ResourceSet set = new ResourceSetImpl();
Resource crom_resource = set.createResource(targetURI);
TransformationExecutor exe = new TransformationExecutor();
exe.setSourceModelFile(diagram_resource);
exe.setTargetModelFile(crom_resource);
try {
crom_resource.save(Collections.EMPTY_MAP);
exe.execute();
} catch (Exception e) { e.printStackTrace(); }
}
/** /**
* informs the user that there are unsaved changes in multipage editors different to the active one * informs the user that there are unsaved changes in multipage editors different to the active one
* after a selection change * after a selection change
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="target/classes"/> <classpathentry kind="output" path="target/classes"/>
</classpath> </classpath>
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.compiler.source=1.8
...@@ -11,6 +11,6 @@ Require-Bundle: org.eclipse.ui, ...@@ -11,6 +11,6 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.epsilon.eol.dt;bundle-version="1.2.0", org.eclipse.epsilon.eol.dt;bundle-version="1.2.0",
org.eclipse.epsilon.etl.engine, org.eclipse.epsilon.etl.engine,
org.rosi.crom.metamodel;bundle-version="0.1.0" org.rosi.crom.metamodel;bundle-version="0.1.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Export-Package: org.framed.orm.transformation Export-Package: org.framed.orm.transformation
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* It is assumed that source and target reference are valid, i.e., are of the same type and correspond * It is assumed that source and target reference are valid, i.e., are of the same type and correspond
* to the inheritance. For instance, a NaturalInheritance has source and target elements of type NaturalType. * to the inheritance. For instance, a NaturalInheritance has source and target elements of type NaturalType.
*/ */
operation Any transformInheritance(s : source!Relation, t : target!Inheritance) { operation transformInheritance(s : source!Relation, t : target!Inheritance) {
var relationSource = s.getSource.equivalent(); var relationSource = s.getSource.equivalent();
var relationTarget = s.getTarget.equivalent(); var relationTarget = s.getTarget.equivalent();
......
...@@ -102,7 +102,7 @@ operation source!Shape addOperations(n : target!Type) { ...@@ -102,7 +102,7 @@ operation source!Shape addOperations(n : target!Type) {
* Searches the source model for a shape element with the given name and returns the equivalent target model element * Searches the source model for a shape element with the given name and returns the equivalent target model element
* if a shape of given name was found, or null otherwise. * if a shape of given name was found, or null otherwise.
*/ */
operation Any findTypeForName(str : String) : target!Type { operation findTypeForName(str : String) : target!Type {
var shape = source!Shape.allInstances().select(s|s.name = str).first; var shape = source!Shape.allInstances().select(s|s.name = str).first;
if (shape.isDefined()) { if (shape.isDefined()) {
return shape.equivalent(); return shape.equivalent();
......
...@@ -62,7 +62,7 @@ public class TransformationExecutor extends EpsilonStandalone { ...@@ -62,7 +62,7 @@ public class TransformationExecutor extends EpsilonStandalone {
List<IModel> models = new ArrayList<IModel>(); List<IModel> models = new ArrayList<IModel>();
EmfModel emfModel = new EmfModel(); EmfModel emfModel = new EmfModel();
emfModel.setMetamodelUri("http://orm/1.0"); emfModel.setMetamodelUri("http://iorm/1.0");
emfModel.setModelFileUri(sourceModelFile.getURI()); emfModel.setModelFileUri(sourceModelFile.getURI());
emfModel.setReadOnLoad(true); emfModel.setReadOnLoad(true);
emfModel.setStoredOnDisposal(true); emfModel.setStoredOnDisposal(true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment