diff options
Diffstat (limited to 'plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/expressions/RegexpExpressionFactory.xtend')
-rw-r--r-- | plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/expressions/RegexpExpressionFactory.xtend | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/expressions/RegexpExpressionFactory.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/expressions/RegexpExpressionFactory.xtend index 9b4368333f4..45035b3b7db 100644 --- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/expressions/RegexpExpressionFactory.xtend +++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/expressions/RegexpExpressionFactory.xtend @@ -1,17 +1,18 @@ /******************************************************************************* * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ - * + * * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Dmitry Stadnik (Borland) - initial API and implementation * Michael Golubev (Montages) - API extracted to GMF-T runtime, migrated to Xtend2 * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174 + * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : L1.2 clean up *****************************************************************************/ package xpt.expressions @@ -23,7 +24,7 @@ import xpt.Common @com.google.inject.Singleton class RegexpExpressionFactory { @Inject extension Common; - @Inject AbstractExpression xptAbstractExpression + @Inject ExpressionAbstractExpression xptAbstractExpression @Inject OCLExpressionFactory xptOCLExpressionFactory; def className(GenExpressionInterpreter it) '''«it.className»''' @@ -37,28 +38,28 @@ import xpt.Common def RegexpExpressionFactory(GenExpressionInterpreter it) ''' «copyright(it.container.editorGen)» package «packageName(it)»; - + «generatedClassComment» public class «className(it)» { - + «xptOCLExpressionFactory.initInterpreterFactory(it)» - + «generatedMemberComment» public static «xptAbstractExpression.qualifiedClassName(it.container.editorGen.diagram)» getExpression(String body, org.eclipse.emf.ecore.EClassifier context, java.util.Map<String, org.eclipse.emf.ecore.EClassifier> environment) { return new Expression(body, context, environment); } - + «generatedMemberComment('This method will become private in the next release')»/* FIXME [MG] private or completely remove in the next release */ public static «xptAbstractExpression.qualifiedClassName(it.container.editorGen.diagram)» getExpression(String body, org.eclipse.emf.ecore.EClassifier context) { return getExpression(body, context, java.util.Collections.<String, org.eclipse.emf.ecore.EClassifier>emptyMap()); } - + «generatedMemberComment» private static class Expression extends «xptAbstractExpression.qualifiedClassName(it.container.editorGen.diagram)» { - + «generatedMemberComment» private final java.util.regex.Pattern pattern; - + «generatedMemberComment» @SuppressWarnings("rawtypes") public Expression(String body, org.eclipse.emf.ecore.EClassifier context, java.util.Map environment) { @@ -72,7 +73,7 @@ import xpt.Common } this.pattern = p; } - + «generatedMemberComment» @SuppressWarnings("rawtypes") protected Object doEvaluate(Object contextInstance, java.util.Map env) { @@ -80,17 +81,13 @@ import xpt.Common return null; } if (context() instanceof org.eclipse.emf.ecore.EDataType) { - contextInstance = org.eclipse.emf.ecore.util.EcoreUtil.convertToString( - (org.eclipse.emf.ecore.EDataType) context(), contextInstance); + contextInstance = org.eclipse.emf.ecore.util.EcoreUtil.convertToString((org.eclipse.emf.ecore.EDataType) context(), contextInstance); } java.util.regex.Matcher matcher = this.pattern.matcher(String.valueOf(contextInstance)); return Boolean.valueOf(«IF language == GenLanguage::NREGEXP_LITERAL»!«ENDIF»matcher.matches()); } } - «additions(it)» } ''' - def additions(GenExpressionInterpreter it) '''''' - } |