Skip to content

Commit

Permalink
Updated AQL 8 and Sisiurs 7.4.1 updatesites.
Browse files Browse the repository at this point in the history
  • Loading branch information
ylussaud committed Jul 1, 2024
1 parent 18403bc commit be66335
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,6 @@ public class M2DocTemplateService extends AbstractService<Template> {
*/
private final int numberOfParameters;

/**
* The {@link Set} of returned {@link IType}.
*/
private final Set<IType> returnTypes;

/**
* The {@link List} of parameter {@link IType}.
*/
private final List<IType> parameterTypes;

/**
* {@link Exception} during initialization.
*/
Expand Down Expand Up @@ -142,19 +132,9 @@ public M2DocTemplateService(Template template, byte[] serializedDocument, M2DocE
this.numberOfParameters = template.getParameters().size();
this.serializedDocument = serializedDocument;

this.returnTypes = new HashSet<>();
returnTypes.add(new ClassType(m2docEnv.getQueryEnvironment(), GenerationResult.class));

this.parameterTypes = new ArrayList<>();
final AstValidator aqlValidator = new AstValidator(new ValidationServices(m2docEnv.getQueryEnvironment()));
for (Parameter parameter : template.getParameters()) {
final AstResult type = parameter.getType();
final IValidationResult validatationResult = aqlValidator.validate(EMPTY_VARIABLE_TYPES, type);
Set<IType> possibleTypes = aqlValidator.getDeclarationTypes(m2docEnv.getQueryEnvironment(),
validatationResult.getPossibleTypes(type.getAst()));
parameterTypes.add(possibleTypes.iterator().next());
}
this.shortSignature = computeShortSignature(template);
final List<Set<IType>> parameterTypes = getParameterTypes(m2docEnv.getQueryEnvironment());
final Object[] argumentTypes = parameterTypes.toArray(new Object[parameterTypes.size()]);
this.shortSignature = serviceShortSignature(argumentTypes);

if (serializedDocument != null) {
try {
Expand All @@ -167,19 +147,6 @@ public M2DocTemplateService(Template template, byte[] serializedDocument, M2DocE
}
}

/**
* Computes the {@link #getShortSignature() short signature}.
*
* @param t
* the {@link Template}
* @return the {@link #getShortSignature() short signature}
*/
private String computeShortSignature(Template t) {
final IType[] argumentTypes = parameterTypes.toArray(new IType[parameterTypes.size()]);

return serviceShortSignature(argumentTypes);
}

@Override
public String getName() {
return getOrigin().getName();
Expand All @@ -195,11 +162,6 @@ public String getLongSignature() {
return EcoreUtil.getURI(getOrigin()).toString() + " (" + getShortSignature() + ")";
}

@Override
public List<IType> getParameterTypes(IReadOnlyQueryEnvironment env) {
return parameterTypes;
}

@Override
public int getNumberOfParameters() {
return numberOfParameters;
Expand All @@ -211,13 +173,27 @@ public int getPriority() {
}

@Override
protected List<IType> computeParameterTypes(IReadOnlyQueryEnvironment queryEnvironment) {
return new ArrayList<>(computeType(queryEnvironment));
protected List<Set<IType>> computeParameterTypes(IReadOnlyQueryEnvironment queryEnvironment) {
final List<Set<IType>> res = new ArrayList<>();
final AstValidator aqlValidator = new AstValidator(new ValidationServices(queryEnvironment));
for (Parameter parameter : getOrigin().getParameters()) {
final AstResult type = parameter.getType();
final IValidationResult validatationResult = aqlValidator.validate(EMPTY_VARIABLE_TYPES, type);
Set<IType> possibleTypes = aqlValidator.getDeclarationTypes(m2docEnv.getQueryEnvironment(),
validatationResult.getPossibleTypes(type.getAst()));
res.add(possibleTypes);
}

return res;
}

@Override
protected Set<IType> computeType(IReadOnlyQueryEnvironment queryEnvironment) {
return returnTypes;
final Set<IType> res = new HashSet<>();

res.add(new ClassType(m2docEnv.getQueryEnvironment(), GenerationResult.class));

return res;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
<unit id="org.eclipse.sirius.table" version="0.0.0"/>
<unit id="org.eclipse.sirius.table.ui" version="0.0.0"/>
<unit id="org.eclipse.sirius.runtime.ide.ui.feature.group" version="0.0.0"/>
<repository location="https://download.eclipse.org/sirius/updates/stable/7.4.0-S20240124-123506/2023-03/"/>
<repository location="https://download.eclipse.org/sirius/updates/releases/7.4.1/2023-03/"/>
</location>
<location includeMode="planner" includeAllPlatforms="false" includeSource="false" includeConfigurePhase="false" type="InstallableUnit">
<unit id="org.eclipse.acceleo.query.feature.group" version="0.0.0"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ location GEF-Classic "https://download.eclipse.org/tools/gef/classic/releases/3
org.eclipse.draw2d.sdk.feature.group lazy
}

location "https://download.eclipse.org/sirius/updates/stable/7.4.0-S20240124-123506/2023-03/" {
location "https://download.eclipse.org/sirius/updates/releases/7.4.1/2023-03/" {
org.eclipse.sirius.runtime.feature.group lazy
org.eclipse.sirius lazy
org.eclipse.sirius.diagram lazy
Expand Down

0 comments on commit be66335

Please sign in to comment.