Skip to content

Commit 9a526ba

Browse files
committed
EDIT: Applied scope on class exposer.
1 parent 0e1bfee commit 9a526ba

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/main/java/jce/JavaCodeEcorification.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ private void buildFactories(GeneratedEcoreMetamodel metamodel, IProject project)
9999
new DefaultConstructorGenerator(properties, metamodel.getIntermediateModel()).manipulate(project);
100100
new EcoreFactoryGenerator(properties).buildFactories(metamodel, project);
101101
new PackageImplFactoryCorrector(metamodel, properties).manipulate(project);
102-
new ClassExposer(properties).manipulate(project);
102+
new ClassExposer(metamodel.getIntermediateModel(), properties).manipulate(project);
103103
}
104104

105105
/**

src/main/java/jce/codemanipulation/origin/ClassExposer.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import org.eclipse.jdt.core.ICompilationUnit;
44
import org.eclipse.jdt.core.JavaModelException;
55

6+
import eme.model.IntermediateModel;
67
import jce.codemanipulation.AbstractCodeManipulator;
78
import jce.properties.BinaryProperty;
89
import jce.properties.EcorificationProperties;
@@ -15,18 +16,22 @@
1516
* @author Timur Saglam
1617
*/
1718
public class ClassExposer extends AbstractCodeManipulator {
19+
private final IntermediateModel model;
1820

1921
/**
2022
* Simple constructor that sets the properties.
2123
* @param properties are the {@link EcorificationProperties}.
24+
* @param model is the {@link IntermediateModel} needed for the Ecorification
25+
* scope.
2226
*/
23-
public ClassExposer(EcorificationProperties properties) {
27+
public ClassExposer(IntermediateModel model, EcorificationProperties properties) {
2428
super(properties, properties.get(TextProperty.ECORE_PACKAGE), properties.get(TextProperty.WRAPPER_PACKAGE));
29+
this.model = model;
2530
}
2631

2732
@Override
2833
protected void manipulate(ICompilationUnit unit) throws JavaModelException {
29-
if (properties.get(BinaryProperty.EXPOSE_CLASSES)) { // TODO (HIGH) Apply scope here to be minimally intrusive
34+
if (properties.get(BinaryProperty.EXPOSE_CLASSES) && model.isTypeSelected(getPackageMemberName(unit))) { // only apply on origin type in scope
3035
ASTUtil.applyVisitorModifications(unit, new ClassExpositionVisitor(properties), monitor);
3136
}
3237
}

src/main/java/jce/generators/WrapperRepresentation.xtend

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ class WrapperRepresentation {
213213
}
214214
«ENDIF»
215215
«ENDFOR»
216-
''' // TODO (HIGH) replace raw type parameter and add imports
216+
'''
217217
218218
def private String getGenericArguments(EStructuralFeature feature) {
219219
var String result = ""

0 commit comments

Comments
 (0)