blob: ddd9f4b111def366bc6fed000453f8379dc17317 [file] [log] [blame]
<%@ jet package="org.eclipse.emf.refactor" class="RefactoringDataManagement"
imports="org.eclipse.emf.refactor.refactoring.henshin.generator.HenshinRefactoringInfo org.eclipse.emf.refactor.refactoring.generator.core.*"%>
<%HenshinRefactoringInfo info = (HenshinRefactoringInfo) argument; %>
/**
* <copyright>
* </copyright>
*
* $Id: RefactoringDataManagementHenshin.javajet,v 1.2 2012/11/26 15:39:38 tarendt Exp $
*/
package <%=info.getPackageName()%>;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.refactor.refactoring.core.Port;
import org.eclipse.emf.refactor.refactoring.henshin.interfaces.IHenshinDataManagement;
import org.eclipse.emf.refactor.refactoring.henshin.interfaces.IHenshinInformation;
import org.eclipse.emf.refactor.refactoring.runtime.DataManagementAdapter;
/**
* Class for specific data concerning a model refactoring.
* @generated
*/
public class RefactoringDataManagement extends DataManagementAdapter
implements IHenshinDataManagement {
private final String SELECTEDEOBJECT = "selectedEObject";
<% if (! info.getCheckInitialFileName().isEmpty()) { %>
private final String INITIALFILENAME = "<%=info.getCheckInitialFileName()%>";
<% } %>
<% if (! info.getCheckFinalFileName().isEmpty()) { %>
private final String FINALFILENAME = "<%=info.getCheckFinalFileName()%>";
<% } %>
private final String CHANGEFILENAME = "<%=info.getCreateChangeFileName()%>";
/**
* HenshinInformation object used for checking the initial
* conditions of the EMF model refactoring.
* @generated
*/
private RefactoringInformation initialConditionsInformation =
new RefactoringInformation(this);
/**
* HenshinInformation object used for checking the final
* conditions of the EMF model refactoring.
* @generated
*/
private RefactoringInformation finalConditionsInformation =
new RefactoringInformation(this);
/**
* HenshinInformation object used for executing the EMF
* model refactoring.
* @generated
*/
private RefactoringInformation createChangeInformation =
new RefactoringInformation(this);
/**
* Default constructor.
* @generated
*/
public RefactoringDataManagement() {
this.addPorts();
this.addInformation();
}
/**
* Adds the ports to the data management used for parameter passing.
* @generated
*/
private void addPorts(){
this.inPorts.add
(new Port<<%=info.getSelectedEObjectClass()%>>
(SELECTEDEOBJECT, <%=info.getSelectedEObjectClass()%>.class));
<% for (ParameterInfo pi : info.getParameters()) { %>
this.inPorts.add
(new Port<String>
("<%=pi.getName()%>", String.class, "unspecified"));
<% } %>
}
/**
* Adds the Henshin informations to the data management.
* @generated
*/
private void addInformation() {
<% if (! info.getCheckInitialFileName().isEmpty()) { %>
this.initialConditionsInformation.setTransformationFileName(INITIALFILENAME);
<% } %>
<% if (! info.getCheckFinalFileName().isEmpty()) { %>
this.finalConditionsInformation.setTransformationFileName(FINALFILENAME);
<% } %>
this.createChangeInformation.setTransformationFileName(CHANGEFILENAME);
}
/**
* @see org.eclipse.emf.refactor.refactoring.henshin.interfaces.IHenshinDataManagement#
* getCreateChangeHenshinInformation()
* @generated
*/
@Override
public IHenshinInformation getCreateChangeHenshinInformation() {
return this.createChangeInformation;
}
/**
* @see org.eclipse.emf.refactor.refactoring.henshin.interfaces.IHenshinDataManagement#
* getFinalConditionsHenshinInformation()
* @generated
*/
@Override
public IHenshinInformation getFinalConditionsHenshinInformation() {
return this.finalConditionsInformation;
}
/**
* @see org.eclipse.emf.refactor.refactoring.henshin.interfaces.IHenshinDataManagement#
* getInitialConditionsHenshinInformation()
* @generated
*/
@Override
public IHenshinInformation getInitialConditionsHenshinInformation() {
return this.initialConditionsInformation;
}
/**
* @see org.eclipse.emf.refactor.refactoring.interfaces.IDataManagement#
* preselect(java.util.List)
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void preselect(List<EObject> selection) {
getInPortByName(SELECTEDEOBJECT).
setValue((<%=info.getSelectedEObjectClass()%>) selection.get(0));
}
}