Search in sources :

Example 1 with Transformation

use of fr.gouv.mindef.safran.database.transfo.Transformation in project InformationSystem by ObeoNetwork.

the class ScaffoldingOperation method execute.

@Override
protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
    if (scaffoldInfo.eResource() == null) {
        // We have to create a scaffold model
        Resource scaffoldResource = createScaffoldResource();
        EObject newInfo = scaffoldResource.getContents().get(0);
        if (newInfo instanceof ScaffoldInfo) {
            scaffoldInfo = (ScaffoldInfo) newInfo;
        }
    }
    final Transformation transformation = createTransformation();
    try {
        RecordingCommand transformCommand = new RecordingCommand(session.getTransactionalEditingDomain(), "Scaffolding transformation") {

            @Override
            protected void doExecute() {
                success = transformation.transform(scaffoldInfo, scaffoldType);
            }
        };
        session.getTransactionalEditingDomain().getCommandStack().execute(transformCommand);
    } catch (RuntimeException e) {
        logError("An error occured during the transformation", e);
        return;
    }
}
Also used : Transformation(fr.gouv.mindef.safran.database.transfo.Transformation) RecordingCommand(org.eclipse.emf.transaction.RecordingCommand) EObject(org.eclipse.emf.ecore.EObject) IResource(org.eclipse.core.resources.IResource) Resource(org.eclipse.emf.ecore.resource.Resource) CDOResource(org.eclipse.emf.cdo.eresource.CDOResource) ScaffoldInfo(fr.gouv.mindef.safran.database.scaffold.ScaffoldInfo)

Aggregations

ScaffoldInfo (fr.gouv.mindef.safran.database.scaffold.ScaffoldInfo)1 Transformation (fr.gouv.mindef.safran.database.transfo.Transformation)1 IResource (org.eclipse.core.resources.IResource)1 CDOResource (org.eclipse.emf.cdo.eresource.CDOResource)1 EObject (org.eclipse.emf.ecore.EObject)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 RecordingCommand (org.eclipse.emf.transaction.RecordingCommand)1