Commit 92641bb3 authored by Romain Bioteau's avatar Romain Bioteau
Browse files

fix sp bar builder

parent aca8c4c5
/**
* Copyright (C) 2014 BonitaSoft S.A.
* BonitaSoft, 32 rue Gustave Eiffel - 38000 Grenoble
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2.0 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.bonitasoft.studio.condition.ui.expression;
/**
* @author Romain Bioteau
*
*/
public class ComparisonExpressionLoadException extends Exception {
private static final long serialVersionUID = -710621557176386449L;
public ComparisonExpressionLoadException(final String message, final Throwable e) {
super(message, e);
}
public ComparisonExpressionLoadException(final String message) {
super(message);
}
}
/**
* Copyright (C) 2014 BonitaSoft S.A.
* BonitaSoft, 32 rue Gustave Eiffel - 38000 Grenoble
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2.0 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.bonitasoft.studio.condition.ui.expression;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import org.bonitasoft.studio.common.emf.tools.ModelHelper;
import org.bonitasoft.studio.common.repository.RepositoryManager;
import org.bonitasoft.studio.condition.conditionModel.Operation_Compare;
import org.bonitasoft.studio.condition.scoping.ConditionModelGlobalScopeProvider;
import org.bonitasoft.studio.model.parameter.Parameter;
import org.bonitasoft.studio.model.process.AbstractProcess;
import org.bonitasoft.studio.model.process.Data;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.xtext.EcoreUtil2;
import org.eclipse.xtext.ui.resource.XtextResourceSetProvider;
import org.eclipse.xtext.util.CancelIndicator;
import org.eclipse.xtext.util.StringInputStream;
import com.google.inject.Injector;
/**
* @author Romain Bioteau
*
*/
public class XtextComparisonExpressionLoader {
private final Injector injector;
public XtextComparisonExpressionLoader(final Injector injector) {
this.injector = injector;
}
public Operation_Compare loadConditionExpression(final String comparisonExpression, final EObject context) throws ComparisonExpressionLoadException {
final XtextResourceSetProvider xtextResourceSetProvider = injector.getInstance(XtextResourceSetProvider.class);
final IProject project = RepositoryManager.getInstance().getCurrentRepository().getProject();
final ResourceSet resourceSet = xtextResourceSetProvider.get(project);
IFile file;
try {
file = createTmpFile(comparisonExpression, project);
} catch (final UnsupportedEncodingException e) {
throw new ComparisonExpressionLoadException("Failed to create a temporary file for comparison expression " + comparisonExpression, e);
} catch (final CoreException e) {
throw new ComparisonExpressionLoadException("Failed to create a temporary file for comparison expression " + comparisonExpression, e);
}
final Resource resource = resourceSet.getResource(URI.createPlatformResourceURI(file.getFullPath().toOSString(), true), true);
final ConditionModelGlobalScopeProvider globalScopeProvider = injector.getInstance(ConditionModelGlobalScopeProvider.class);
globalScopeProvider.setAccessibleEObjects(getAccessibleReferences(context));
//Resolve reference proxies
EcoreUtil2.resolveLazyCrossReferences(resource, CancelIndicator.NullImpl);
final EList<EObject> contents = resource.getContents();
if (contents.isEmpty()) {
throw new ComparisonExpressionLoadException("Failed to laod comparison expression " + comparisonExpression);
}
return (Operation_Compare) contents.get(0);
}
protected IFile createTmpFile(final String content, final IProject project) throws UnsupportedEncodingException, CoreException {
final IFile file = project.getFile("somefile" + System.currentTimeMillis() + ".cmodel");
if (file.exists()) {
file.delete(true, null);
}
final InputStream is = new StringInputStream(content, "UTF-8");
file.create(is, true, null);
return file;
}
protected List<String> getAccessibleReferences(final EObject context) {
final List<String> accessibleObjects = new ArrayList<String>();
for (final Data d : ModelHelper.getAccessibleData(context)) {
accessibleObjects.add(ModelHelper.getEObjectID(d));
}
final AbstractProcess process = ModelHelper.getParentProcess(context);
if (process != null) {
for (final Parameter p : process.getParameters()) {
accessibleObjects.add(ModelHelper.getEObjectID(p));
}
}
return accessibleObjects;
}
}
......@@ -20,14 +20,12 @@ import org.bonitasoft.studio.model.process.JavaObjectData;
import org.bonitasoft.studio.model.process.LongType;
import org.bonitasoft.studio.model.process.StringType;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
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.emf.ecore.util.EcoreUtil;
import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
import org.eclipse.xtext.EcoreUtil2;
import org.eclipse.xtext.nodemodel.INode;
import org.eclipse.xtext.nodemodel.impl.RootNode;
......@@ -35,7 +33,6 @@ import org.eclipse.xtext.validation.Check;
public class ConditionModelJavaValidator extends AbstractConditionModelJavaValidator {
private ResourceSet rSet;
public static final String INVALID_EQUALITY_SIGN = "org.bonitasoft.studio.condition.quickfix.InvalidEqualitySign";
@Check
......@@ -186,7 +183,7 @@ public class ConditionModelJavaValidator extends AbstractConditionModelJavaValid
protected EObject resolveProxyReferenceOnCurrentResourceSet(
final Expression_ProcessRef e) {
final EObject proxy = (EObject) e.eGet(ConditionModelPackage.Literals.EXPRESSION_PROCESS_REF__VALUE , false);
rSet = getCurrentResourceSet(proxy);
final ResourceSet rSet = getCurrentResourceSet(proxy);
final EObject data = EcoreUtil2.resolve(proxy, rSet);
e.setValue(data);
if (rSet != null) {
......@@ -195,37 +192,14 @@ public class ConditionModelJavaValidator extends AbstractConditionModelJavaValid
return data;
}
/**
* @param proxy
* @return
*/
private ResourceSet getCurrentResourceSet(final EObject proxy) {
rSet = null;
if (proxy.eIsProxy() && EcoreUtil.getURI(proxy).lastSegment().endsWith(".proc")) {
if(PlatformUI.isWorkbenchRunning()){
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
final DiagramEditor editor = (DiagramEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().getActiveEditor();
if (editor != null) {
final DiagramEditPart diagramEditPart = editor.getDiagramEditPart();
if (diagramEditPart != null) {
final EObject resolveSemanticElement = diagramEditPart.resolveSemanticElement();
if (resolveSemanticElement != null) {
final Resource eResource = resolveSemanticElement.eResource();
if (eResource != null) {
rSet = eResource.getResourceSet();
}
}
}
}
}
});
}
private ResourceSet getCurrentResourceSet(final EObject proxy) {
final ResourceSetImpl resourceSetImpl = new ResourceSetImpl();
final URI uri = EcoreUtil.getURI(proxy);
if (uri != null && uri.toString().contains(".proc")) {
final Resource resource = resourceSetImpl.getResource(uri.trimFragment(), true);
return resource.getResourceSet();
}
return rSet;
return null;
}
}
......@@ -17,9 +17,10 @@
package org.bonitasoft.studio.engine.export.expression.converter.comparison;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.when;
import org.bonitasoft.engine.expression.ExpressionType;
import org.bonitasoft.engine.expression.InvalidExpressionException;
import org.bonitasoft.studio.common.ExpressionConstants;
import org.bonitasoft.studio.condition.conditionModel.ConditionModelFactory;
import org.bonitasoft.studio.condition.conditionModel.Expression_ProcessRef;
......@@ -27,6 +28,8 @@ import org.bonitasoft.studio.condition.conditionModel.Operation_Compare;
import org.bonitasoft.studio.condition.conditionModel.Operation_Less_Equals;
import org.bonitasoft.studio.condition.conditionModel.Operation_NotUnary;
import org.bonitasoft.studio.condition.conditionModel.Operation_Unary;
import org.bonitasoft.studio.condition.ui.expression.ComparisonExpressionLoadException;
import org.bonitasoft.studio.condition.ui.expression.XtextComparisonExpressionLoader;
import org.bonitasoft.studio.model.expression.Expression;
import org.bonitasoft.studio.model.expression.builders.ExpressionBuilder;
import org.bonitasoft.studio.model.parameter.Parameter;
......@@ -40,7 +43,7 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Spy;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
......@@ -51,8 +54,11 @@ import org.mockito.runners.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class ComparisonExpressionConverterTest {
@Spy
private ComparisonExpressionConverter comparisonExpressionConverter;
@Mock
private XtextComparisonExpressionLoader loader;
private Data variable;
private Parameter parameter;
private Expression binaryExpression;
......@@ -66,6 +72,7 @@ public class ComparisonExpressionConverterTest {
*/
@Before
public void setUp() throws Exception {
comparisonExpressionConverter = new ComparisonExpressionConverter(loader);
variable = DataBuilder.createDataBuilder().withName("amount").havingDataType(DoubleDataTypeBuilder.create()).build();
validVariable = DataBuilder.createDataBuilder().withName("valid").havingDataType(BooleanDataTypeBuilder.create()).build();
parameter = ParameterBuilder.create().withName("commission").withType(Double.class.getName()).build();
......@@ -104,21 +111,26 @@ public class ComparisonExpressionConverterTest {
}
@Test
public void should_convert_a_studio_expression_into_an_engine_expression_returns_null_if_parsing_fail() throws Exception {
doReturn(null).when(comparisonExpressionConverter).parseConditionExpression(binaryExpression.getContent(), null);
public void should_convert_a_studio_expression_into_an_engine_expression_returns_null_if_parsing_return_null() throws Exception {
when(loader.loadConditionExpression(binaryExpression.getContent(), null)).thenReturn(null);
assertThat(comparisonExpressionConverter.convert(binaryExpression)).isNull();
doReturn(ConditionModelFactory.eINSTANCE.createOperation_Compare()).when(comparisonExpressionConverter).parseConditionExpression(
binaryExpression.getContent(), null);
when(loader.loadConditionExpression(binaryExpression.getContent(), null)).thenReturn(ConditionModelFactory.eINSTANCE.createOperation_Compare());
assertThat(comparisonExpressionConverter.convert(binaryExpression)).isNull();
final Operation_Compare compare = ConditionModelFactory.eINSTANCE.createOperation_Compare();
compare.setOp(ConditionModelFactory.eINSTANCE.createExpression_Integer());
doReturn(compare).when(comparisonExpressionConverter).parseConditionExpression(
binaryExpression.getContent(), null);
when(loader.loadConditionExpression(binaryExpression.getContent(), null)).thenReturn(compare);
assertThat(comparisonExpressionConverter.convert(binaryExpression)).isNull();
}
@Test(expected=InvalidExpressionException.class)
public void should_convert_a_studio_expression_into_an_engine_expression_returns_null_if_parsing_fail() throws Exception {
when(loader.loadConditionExpression(binaryExpression.getContent(), null)).thenThrow(new ComparisonExpressionLoadException(""));
comparisonExpressionConverter.convert(binaryExpression);
}
@Test
public void should_convert_a_studio_expression_into_an_engine_expression_for_binary_operation() throws Exception {
final Operation_Compare binaryOperation = ConditionModelFactory.eINSTANCE.createOperation_Compare();
......@@ -130,7 +142,9 @@ public class ComparisonExpressionConverterTest {
param_Ref.setValue(EcoreUtil.copy(parameter));
less_Equals.setRight(param_Ref);
binaryOperation.setOp(less_Equals);
doReturn(binaryOperation).when(comparisonExpressionConverter).parseConditionExpression(binaryExpression.getContent(), null);
when(loader.loadConditionExpression(binaryExpression.getContent(), null)).thenReturn(binaryOperation);
final org.bonitasoft.engine.expression.Expression engineExpression = comparisonExpressionConverter.convert(binaryExpression);
assertThat(engineExpression).isNotNull();
assertThat(engineExpression.getExpressionType()).isEqualTo(ExpressionType.TYPE_CONDITION.name());
......@@ -154,7 +168,9 @@ public class ComparisonExpressionConverterTest {
processRef.setValue(EcoreUtil.copy(validVariable));
unaryOperation.setValue(processRef);
operation_Compare.setOp(unaryOperation);
doReturn(operation_Compare).when(comparisonExpressionConverter).parseConditionExpression(notUnaryExpression.getContent(), null);
when(loader.loadConditionExpression(notUnaryExpression.getContent(), null)).thenReturn(operation_Compare);
final org.bonitasoft.engine.expression.Expression engineExpression = comparisonExpressionConverter.convert(notUnaryExpression);
assertThat(engineExpression).isNotNull();
assertThat(engineExpression.getExpressionType()).isEqualTo(ExpressionType.TYPE_CONDITION.name());
......@@ -174,7 +190,8 @@ public class ComparisonExpressionConverterTest {
processRef.setValue(EcoreUtil.copy(validVariable));
unaryOperation.setValue(processRef);
operation_Compare.setOp(unaryOperation);
doReturn(operation_Compare).when(comparisonExpressionConverter).parseConditionExpression(unaryExpression.getContent(), null);
when(loader.loadConditionExpression(unaryExpression.getContent(), null)).thenReturn(operation_Compare);
final org.bonitasoft.engine.expression.Expression engineExpression = comparisonExpressionConverter.convert(unaryExpression);
assertThat(engineExpression).isNotNull();
assertThat(engineExpression.getExpressionType()).isEqualTo(ExpressionType.TYPE_VARIABLE.name());
......
......@@ -30,6 +30,8 @@ import org.bonitasoft.studio.common.DatasourceConstants;
import org.bonitasoft.studio.common.ExpressionConstants;
import org.bonitasoft.studio.common.emf.tools.WidgetHelper;
import org.bonitasoft.studio.common.log.BonitaStudioLog;
import org.bonitasoft.studio.condition.ui.expression.XtextComparisonExpressionLoader;
import org.bonitasoft.studio.condition.ui.internal.ConditionModelActivator;
import org.bonitasoft.studio.connector.model.definition.Output;
import org.bonitasoft.studio.engine.EnginePlugin;
import org.bonitasoft.studio.engine.export.expression.converter.IExpressionConverter;
......@@ -53,10 +55,7 @@ import org.eclipse.emf.ecore.util.EcoreUtil;
public class EngineExpressionUtil {
private static List<IExpressionConverter> converters;
static {
converters = new ArrayList<IExpressionConverter>();
converters.add(new ComparisonExpressionConverter());
}
public static org.bonitasoft.engine.operation.Operation createOperation(final Operation operation) {
return createOperation(operation, createLeftOperand(operation.getLeftOperand()));
......@@ -458,6 +457,13 @@ public class EngineExpressionUtil {
}
private static IExpressionConverter getConverter(final org.bonitasoft.studio.model.expression.Expression expression) {
if (converters == null) {
converters = new ArrayList<IExpressionConverter>();
if (ConditionModelActivator.getInstance() != null) {
converters.add(new ComparisonExpressionConverter(new XtextComparisonExpressionLoader(ConditionModelActivator.getInstance().getInjector(
ConditionModelActivator.ORG_BONITASOFT_STUDIO_CONDITION_CONDITIONMODEL))));
}
}
for (final IExpressionConverter converter : converters) {
if (converter.appliesTo(expression)) {
return converter;
......
......@@ -16,39 +16,17 @@
*/
package org.bonitasoft.studio.engine.export.expression.converter.comparison;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.bonitasoft.engine.expression.ExpressionBuilder;
import org.bonitasoft.engine.expression.InvalidExpressionException;
import org.bonitasoft.studio.common.ExpressionConstants;
import org.bonitasoft.studio.common.emf.tools.ModelHelper;
import org.bonitasoft.studio.common.log.BonitaStudioLog;
import org.bonitasoft.studio.common.repository.RepositoryManager;
import org.bonitasoft.studio.condition.conditionModel.Operation_Compare;
import org.bonitasoft.studio.condition.conditionModel.Operation_NotUnary;
import org.bonitasoft.studio.condition.conditionModel.Unary_Operation;
import org.bonitasoft.studio.condition.scoping.ConditionModelGlobalScopeProvider;
import org.bonitasoft.studio.condition.ui.internal.ConditionModelActivator;
import org.bonitasoft.studio.condition.ui.expression.ComparisonExpressionLoadException;
import org.bonitasoft.studio.condition.ui.expression.XtextComparisonExpressionLoader;
import org.bonitasoft.studio.engine.export.expression.converter.IExpressionConverter;
import org.bonitasoft.studio.model.expression.Expression;
import org.bonitasoft.studio.model.parameter.Parameter;
import org.bonitasoft.studio.model.process.AbstractProcess;
import org.bonitasoft.studio.model.process.Data;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.ui.resource.XtextResourceSetProvider;
import org.eclipse.xtext.util.StringInputStream;
import org.eclipse.xtext.validation.CheckMode;
import org.eclipse.xtext.validation.IResourceValidator;
import com.google.inject.Injector;
/**
* @author Romain Bioteau
......@@ -56,6 +34,11 @@ import com.google.inject.Injector;
*/
public class ComparisonExpressionConverter implements IExpressionConverter {
private final XtextComparisonExpressionLoader expressionLoader;
public ComparisonExpressionConverter(final XtextComparisonExpressionLoader expressionLoader) {
this.expressionLoader = expressionLoader;
}
@Override
public boolean appliesTo(final Expression expression) {
......@@ -67,7 +50,12 @@ public class ComparisonExpressionConverter implements IExpressionConverter {
final ExpressionBuilder expressionBuilder = new ExpressionBuilder();
final String name = getExpressionName(expression);
final String content = expression.getContent();
final Operation_Compare compare = parseConditionExpression(content, expression.eContainer());
Operation_Compare compare;
try {
compare = expressionLoader.loadConditionExpression(content, expression.eContainer());
} catch (final ComparisonExpressionLoadException e) {
throw new InvalidExpressionException("Failed to load comparison expression");
}
if (compare != null && compare.getOp() != null) {
final EObject op = compare.getOp();
if (op instanceof Unary_Operation) {
......@@ -103,6 +91,9 @@ public class ComparisonExpressionConverter implements IExpressionConverter {
final ExpressionBuilder expressionBuilder, final String name, final EObject op) throws InvalidExpressionException {
final org.bonitasoft.studio.condition.conditionModel.Expression conditionExp = ((Unary_Operation) op).getValue();
final org.bonitasoft.engine.expression.Expression engineExpression = new ExpressionConditionModelSwitch(expression).doSwitch(conditionExp);
if (engineExpression == null) {
throw new InvalidExpressionException("Condition expression " + name + " convertion has failed");
}
if (op instanceof Operation_NotUnary) {
return expressionBuilder.createLogicalComplementExpression(name, engineExpression);
} else {
......@@ -110,41 +101,6 @@ public class ComparisonExpressionConverter implements IExpressionConverter {
}
}
public Operation_Compare parseConditionExpression(final String content, final EObject context) {
final Injector injector = ConditionModelActivator.getInstance().getInjector(
ConditionModelActivator.ORG_BONITASOFT_STUDIO_CONDITION_CONDITIONMODEL);
final IResourceValidator xtextResourceChecker = injector.getInstance(IResourceValidator.class);
final XtextResourceSetProvider xtextResourceSetProvider = injector.getInstance(XtextResourceSetProvider.class);
final ResourceSet resourceSet = xtextResourceSetProvider.get(RepositoryManager.getInstance().getCurrentRepository().getProject());
final XtextResource resource = (XtextResource) resourceSet.createResource(URI.createURI("somefile.cmodel"));
try {
resource.load(new StringInputStream(content, "UTF-8"), Collections.emptyMap());
} catch (final UnsupportedEncodingException e1) {
BonitaStudioLog.error(e1);
} catch (final IOException e1) {
BonitaStudioLog.error(e1);
}
final ConditionModelGlobalScopeProvider globalScopeProvider = injector.getInstance(ConditionModelGlobalScopeProvider.class);
final List<String> accessibleObjects = new ArrayList<String>();
for (final Data d : ModelHelper.getAccessibleData(context)) {
accessibleObjects.add(ModelHelper.getEObjectID(d));
}
final AbstractProcess process = ModelHelper.getParentProcess(context);
if (process != null) {
for (final Parameter p : process.getParameters()) {
accessibleObjects.add(ModelHelper.getEObjectID(p));
}
}
globalScopeProvider.setAccessibleEObjects(accessibleObjects);
xtextResourceChecker.validate(resource, CheckMode.FAST_ONLY, null);
final EList<EObject> contents = resource.getContents();
if (contents.isEmpty()) {
return null;
}
return (Operation_Compare) contents.get(0);
}
protected String getExpressionName(final Expression expression) {
String name = expression.getName();
if (name == null || name.isEmpty()) {
......
......@@ -19,7 +19,9 @@ package org.bonitasoft.studio.validation.constraints.process;
import org.bonitasoft.studio.common.ExpressionConstants;
import org.bonitasoft.studio.condition.conditionModel.Operation_Compare;
import org.bonitasoft.studio.engine.export.expression.converter.comparison.ComparisonExpressionConverter;
import org.bonitasoft.studio.condition.ui.expression.ComparisonExpressionLoadException;
import org.bonitasoft.studio.condition.ui.expression.XtextComparisonExpressionLoader;
import org.bonitasoft.studio.condition.ui.internal.ConditionModelActivator;
import org.bonitasoft.studio.model.expression.Expression;
import org.bonitasoft.studio.model.process.SequenceFlow;
import org.bonitasoft.studio.model.process.diagram.providers.ProcessMarkerNavigationProvider;
......@@ -37,7 +39,7 @@ import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
*/
public class ConditionExpressionConstraint extends AbstractLiveValidationMarkerConstraint {
private final ComparisonExpressionConverter comparisonExpressionConverter = new ComparisonExpressionConverter();
@Override
protected IStatus performLiveValidation(final IValidationContext ctx) {
......@@ -73,8 +75,13 @@ public class ConditionExpressionConstraint extends AbstractLiveValidationMarkerC
}
protected Operation_Compare getCompareOperation(final Expression conditionExpression) {
return comparisonExpressionConverter.parseConditionExpression(
conditionExpression.getContent(), conditionExpression);
final XtextComparisonExpressionLoader comparisonExpressionConverter = new XtextComparisonExpressionLoader(ConditionModelActivator.getInstance()
.getInjector(ConditionModelActivator.ORG_BONITASOFT_STUDIO_CONDITION_CONDITIONMODEL));
try {
return comparisonExpressionConverter.loadConditionExpression(conditionExpression.getContent(), conditionExpression);
} catch (final ComparisonExpressionLoadException e) {
return null;
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment