Commit aca8c4c5 authored by Romain Bioteau's avatar Romain Bioteau
Browse files

remove xtext.ui dependencies

parent e509aae0
......@@ -37,7 +37,8 @@ Require-Bundle: org.bonitasoft.studio.model;bundle-version="1.0.0",
org.eclipse.core.databinding.property;bundle-version="1.4.200",
org.eclipse.gmf.runtime.diagram.ui.render;bundle-version="1.7.0",
org.eclipse.emf.edit.ui,
org.eclipse.jdt.core
org.eclipse.jdt.core,
org.eclipse.xtext.ui
Export-Package: org.bonitasoft.studio.engine,
org.bonitasoft.studio.engine.command,
org.bonitasoft.studio.engine.config,
......
......@@ -27,6 +27,7 @@ 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;
......@@ -40,9 +41,9 @@ 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.xtext.resource.SynchronizedXtextResourceSet;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.resource.XtextResourceSet;
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;
......@@ -113,7 +114,8 @@ public class ComparisonExpressionConverter implements IExpressionConverter {
final Injector injector = ConditionModelActivator.getInstance().getInjector(
ConditionModelActivator.ORG_BONITASOFT_STUDIO_CONDITION_CONDITIONMODEL);
final IResourceValidator xtextResourceChecker = injector.getInstance(IResourceValidator.class);
final XtextResourceSet resourceSet = new SynchronizedXtextResourceSet();
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());
......@@ -122,10 +124,6 @@ public class ComparisonExpressionConverter implements IExpressionConverter {
} catch (final IOException e1) {
BonitaStudioLog.error(e1);
}
final EList<EObject> contents = resource.getContents();
if (contents.isEmpty()) {
return null;
}
final ConditionModelGlobalScopeProvider globalScopeProvider = injector.getInstance(ConditionModelGlobalScopeProvider.class);
final List<String> accessibleObjects = new ArrayList<String>();
for (final Data d : ModelHelper.getAccessibleData(context)) {
......@@ -140,7 +138,11 @@ public class ComparisonExpressionConverter implements IExpressionConverter {
}
globalScopeProvider.setAccessibleEObjects(accessibleObjects);
xtextResourceChecker.validate(resource, CheckMode.FAST_ONLY, null);
return (Operation_Compare) resource.getContents().get(0);
final EList<EObject> contents = resource.getContents();
if (contents.isEmpty()) {
return null;
}
return (Operation_Compare) contents.get(0);
}
protected String getExpressionName(final Expression expression) {
......
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