Loading plugins/org.etsi.mts.tdl.constraints.ui/META-INF/MANIFEST.MF +0 −9 Original line number Diff line number Diff line Loading @@ -12,15 +12,6 @@ Require-Bundle: org.eclipse.ui, org.eclipse.ui.ide;bundle-version="3.5.0", org.eclipse.ui.workbench, org.etsi.mts.tdl.constraints, org.eclipse.epsilon.common, org.eclipse.epsilon.emc.emf, org.eclipse.epsilon.eol.engine, org.eclipse.epsilon.erl.engine, org.eclipse.epsilon.evl.engine, org.eclipse.epsilon.evl.emf.validation, org.eclipse.epsilon.etl.engine, org.eclipse.epsilon.profiling, org.eclipse.epsilon.eol.tools, org.eclipse.ocl.xtext.completeocl.ui, org.eclipse.ocl.xtext.essentialocl.ui, com.google.inject, Loading plugins/org.etsi.mts.tdl.constraints.ui/src/org/etsi/mts/tdl/constraints/ui/handlers/ToggleValidationHandler.java +33 −33 Original line number Diff line number Diff line Loading @@ -10,14 +10,14 @@ import org.eclipse.core.runtime.preferences.InstanceScope; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EValidator; import org.eclipse.emf.ecore.util.EObjectValidator; import org.eclipse.epsilon.evl.emf.validation.CompositeEValidator; import org.eclipse.epsilon.evl.emf.validation.EvlValidator; //import org.eclipse.epsilon.evl.emf.validation.CompositeEValidator; //import org.eclipse.epsilon.evl.emf.validation.EvlValidator; import org.eclipse.ui.preferences.ScopedPreferenceStore; import org.etsi.mts.tdl.tdlPackage; public class ToggleValidationHandler extends AbstractHandler { private static boolean initialised; private static EvlValidator evlValidator; // private static EvlValidator evlValidator; //TODO: for some reason seems to hang now.. @Override Loading Loading @@ -47,21 +47,21 @@ public class ToggleValidationHandler extends AbstractHandler { public static void stop() { EPackage ePackage = tdlPackage.eINSTANCE; EValidator existingValidator = EValidator.Registry.INSTANCE.getEValidator(ePackage); if (existingValidator instanceof CompositeEValidator) { //TODO: check for evl validators? ((CompositeEValidator) existingValidator).getDelegates().remove(evlValidator); Collection<EValidator> delegates = ((CompositeEValidator) existingValidator).getDelegates(); //TODO: make more robust delegates.removeIf(d -> d instanceof EvlValidator); } else { if (existingValidator == null) { existingValidator = EObjectValidator.INSTANCE; } CompositeEValidator newValidator = new CompositeEValidator(); newValidator.getDelegates().add(existingValidator); newValidator.getDelegates().add(evlValidator); EValidator.Registry.INSTANCE.put(ePackage, newValidator); } // if (existingValidator instanceof CompositeEValidator) { // //TODO: check for evl validators? // ((CompositeEValidator) existingValidator).getDelegates().remove(evlValidator); // Collection<EValidator> delegates = ((CompositeEValidator) existingValidator).getDelegates(); // //TODO: make more robust // delegates.removeIf(d -> d instanceof EvlValidator); // } else { // if (existingValidator == null) { // existingValidator = EObjectValidator.INSTANCE; // } // CompositeEValidator newValidator = new CompositeEValidator(); // newValidator.getDelegates().add(existingValidator); // newValidator.getDelegates().add(evlValidator); // EValidator.Registry.INSTANCE.put(ePackage, newValidator); // } } Loading @@ -85,10 +85,10 @@ public class ToggleValidationHandler extends AbstractHandler { //TODO: try out extension point integration //TODO: try out fixes -> can they be in a separate module? //TODO: add other constraints for TO/TC evlValidator = new EvlValidator( evlScriptURI, modelName , ePackage.getNsURI(), bundleId); evlValidator.setShowErrorDialog(false); // evlValidator = new EvlValidator( // evlScriptURI, modelName , ePackage.getNsURI(), bundleId); // // evlValidator.setShowErrorDialog(false); //TODO: extract to optional on demand / auto validation //TODO: this brings all the epsilon dependencies here as well //-> effectively requires constraints to be installed.. shall be plugged in ideally.. Loading @@ -101,17 +101,17 @@ public class ToggleValidationHandler extends AbstractHandler { //TODO: reorganise and reuse (from TDLtxValidator, shall migrate local Validator as well) private static void registerValidator(EPackage ePackage) { EValidator existingValidator = EValidator.Registry.INSTANCE.getEValidator(ePackage); if (existingValidator instanceof CompositeEValidator) { ((CompositeEValidator) existingValidator).getDelegates().add(evlValidator); } else { if (existingValidator == null) { existingValidator = EObjectValidator.INSTANCE; } CompositeEValidator newValidator = new CompositeEValidator(); newValidator.getDelegates().add(existingValidator); newValidator.getDelegates().add(evlValidator); EValidator.Registry.INSTANCE.put(ePackage, newValidator); } // if (existingValidator instanceof CompositeEValidator) { // ((CompositeEValidator) existingValidator).getDelegates().add(evlValidator); // } else { // if (existingValidator == null) { // existingValidator = EObjectValidator.INSTANCE; // } // CompositeEValidator newValidator = new CompositeEValidator(); // newValidator.getDelegates().add(existingValidator); // newValidator.getDelegates().add(evlValidator); // EValidator.Registry.INSTANCE.put(ePackage, newValidator); // } } } plugins/org.etsi.mts.tdl.constraints.ui/src/org/etsi/mts/tdl/constraints/ui/handlers/ValidationHandler.java +15 −16 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.epsilon.evl.execute.UnsatisfiedConstraint; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; Loading Loading @@ -83,22 +82,22 @@ public class ValidationHandler extends AbstractHandler { Validator validator = new Validator(); String messages = ""; try { List<UnsatisfiedConstraint> violations = validator.validate(r); for (UnsatisfiedConstraint v : violations) { messages += v.getMessage()+"\n"; //TODO: this can only work with XtextResources if (((EObject) v.getInstance()).eResource() instanceof XtextResource) { ICompositeNode node = NodeModelUtils.findActualNodeFor((EObject) v.getInstance()); String text = "\tLine "+node.getStartLine()+"-"+node.getEndLine()+ ":\n\t"+node.getText().trim(); messages += " "+text+"\n\n"; } else { //TODO: dump tree-based representation? } } if (violations.size() == 0) { messages = "No violations!"; } // List<UnsatisfiedConstraint> violations = validator.validate(r); // for (UnsatisfiedConstraint v : violations) { // messages += v.getMessage()+"\n"; // //TODO: this can only work with XtextResources // if (((EObject) v.getInstance()).eResource() instanceof XtextResource) { // ICompositeNode node = NodeModelUtils.findActualNodeFor((EObject) v.getInstance()); // String text = "\tLine "+node.getStartLine()+"-"+node.getEndLine()+ ":\n\t"+node.getText().trim(); // messages += " "+text+"\n\n"; // } else { // //TODO: dump tree-based representation? // } // } // if (violations.size() == 0) { // messages = "No violations!"; // } } catch (Exception e) { messages = "An error occurred:" + e.getMessage().replaceAll("\n.+epsilon/", "\n at (epsilon/"); Loading plugins/org.etsi.mts.tdl.constraints/META-INF/MANIFEST.MF +0 −10 Original line number Diff line number Diff line Loading @@ -4,21 +4,11 @@ Bundle-Name: Constraints Bundle-SymbolicName: org.etsi.mts.tdl.constraints;singleton:=true Bundle-Version: 1.0.0.qualifier Require-Bundle: org.eclipse.emf.common, org.eclipse.epsilon.common, org.eclipse.epsilon.emc.emf, org.eclipse.epsilon.eol.engine, org.eclipse.epsilon.erl.engine, org.eclipse.epsilon.evl.engine, org.eclipse.epsilon.evl.emf.validation, org.eclipse.epsilon.etl.engine, org.eclipse.epsilon.profiling, org.eclipse.epsilon.eol.tools, org.eclipse.core.runtime, org.eclipse.emf.ecore;visibility:=reexport, org.eclipse.emf.ecore.xmi, org.etsi.mts.tdl.model, org.etsi.mts.tdl.common, org.eclipse.xtext, org.eclipse.epsilon.common.dt, org.eclipse.ocl.xtext.completeocl Export-Package: org.etsi.mts.tdl.constraints.evl plugins/org.etsi.mts.tdl.constraints/plugin.xml +2 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.4"?> <plugin> <!-- <extension point="org.eclipse.epsilon.common.dt.tool"> <tool Loading @@ -8,5 +9,6 @@ defaultName="XtextBridge"> </tool> </extension> --> </plugin> Loading
plugins/org.etsi.mts.tdl.constraints.ui/META-INF/MANIFEST.MF +0 −9 Original line number Diff line number Diff line Loading @@ -12,15 +12,6 @@ Require-Bundle: org.eclipse.ui, org.eclipse.ui.ide;bundle-version="3.5.0", org.eclipse.ui.workbench, org.etsi.mts.tdl.constraints, org.eclipse.epsilon.common, org.eclipse.epsilon.emc.emf, org.eclipse.epsilon.eol.engine, org.eclipse.epsilon.erl.engine, org.eclipse.epsilon.evl.engine, org.eclipse.epsilon.evl.emf.validation, org.eclipse.epsilon.etl.engine, org.eclipse.epsilon.profiling, org.eclipse.epsilon.eol.tools, org.eclipse.ocl.xtext.completeocl.ui, org.eclipse.ocl.xtext.essentialocl.ui, com.google.inject, Loading
plugins/org.etsi.mts.tdl.constraints.ui/src/org/etsi/mts/tdl/constraints/ui/handlers/ToggleValidationHandler.java +33 −33 Original line number Diff line number Diff line Loading @@ -10,14 +10,14 @@ import org.eclipse.core.runtime.preferences.InstanceScope; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EValidator; import org.eclipse.emf.ecore.util.EObjectValidator; import org.eclipse.epsilon.evl.emf.validation.CompositeEValidator; import org.eclipse.epsilon.evl.emf.validation.EvlValidator; //import org.eclipse.epsilon.evl.emf.validation.CompositeEValidator; //import org.eclipse.epsilon.evl.emf.validation.EvlValidator; import org.eclipse.ui.preferences.ScopedPreferenceStore; import org.etsi.mts.tdl.tdlPackage; public class ToggleValidationHandler extends AbstractHandler { private static boolean initialised; private static EvlValidator evlValidator; // private static EvlValidator evlValidator; //TODO: for some reason seems to hang now.. @Override Loading Loading @@ -47,21 +47,21 @@ public class ToggleValidationHandler extends AbstractHandler { public static void stop() { EPackage ePackage = tdlPackage.eINSTANCE; EValidator existingValidator = EValidator.Registry.INSTANCE.getEValidator(ePackage); if (existingValidator instanceof CompositeEValidator) { //TODO: check for evl validators? ((CompositeEValidator) existingValidator).getDelegates().remove(evlValidator); Collection<EValidator> delegates = ((CompositeEValidator) existingValidator).getDelegates(); //TODO: make more robust delegates.removeIf(d -> d instanceof EvlValidator); } else { if (existingValidator == null) { existingValidator = EObjectValidator.INSTANCE; } CompositeEValidator newValidator = new CompositeEValidator(); newValidator.getDelegates().add(existingValidator); newValidator.getDelegates().add(evlValidator); EValidator.Registry.INSTANCE.put(ePackage, newValidator); } // if (existingValidator instanceof CompositeEValidator) { // //TODO: check for evl validators? // ((CompositeEValidator) existingValidator).getDelegates().remove(evlValidator); // Collection<EValidator> delegates = ((CompositeEValidator) existingValidator).getDelegates(); // //TODO: make more robust // delegates.removeIf(d -> d instanceof EvlValidator); // } else { // if (existingValidator == null) { // existingValidator = EObjectValidator.INSTANCE; // } // CompositeEValidator newValidator = new CompositeEValidator(); // newValidator.getDelegates().add(existingValidator); // newValidator.getDelegates().add(evlValidator); // EValidator.Registry.INSTANCE.put(ePackage, newValidator); // } } Loading @@ -85,10 +85,10 @@ public class ToggleValidationHandler extends AbstractHandler { //TODO: try out extension point integration //TODO: try out fixes -> can they be in a separate module? //TODO: add other constraints for TO/TC evlValidator = new EvlValidator( evlScriptURI, modelName , ePackage.getNsURI(), bundleId); evlValidator.setShowErrorDialog(false); // evlValidator = new EvlValidator( // evlScriptURI, modelName , ePackage.getNsURI(), bundleId); // // evlValidator.setShowErrorDialog(false); //TODO: extract to optional on demand / auto validation //TODO: this brings all the epsilon dependencies here as well //-> effectively requires constraints to be installed.. shall be plugged in ideally.. Loading @@ -101,17 +101,17 @@ public class ToggleValidationHandler extends AbstractHandler { //TODO: reorganise and reuse (from TDLtxValidator, shall migrate local Validator as well) private static void registerValidator(EPackage ePackage) { EValidator existingValidator = EValidator.Registry.INSTANCE.getEValidator(ePackage); if (existingValidator instanceof CompositeEValidator) { ((CompositeEValidator) existingValidator).getDelegates().add(evlValidator); } else { if (existingValidator == null) { existingValidator = EObjectValidator.INSTANCE; } CompositeEValidator newValidator = new CompositeEValidator(); newValidator.getDelegates().add(existingValidator); newValidator.getDelegates().add(evlValidator); EValidator.Registry.INSTANCE.put(ePackage, newValidator); } // if (existingValidator instanceof CompositeEValidator) { // ((CompositeEValidator) existingValidator).getDelegates().add(evlValidator); // } else { // if (existingValidator == null) { // existingValidator = EObjectValidator.INSTANCE; // } // CompositeEValidator newValidator = new CompositeEValidator(); // newValidator.getDelegates().add(existingValidator); // newValidator.getDelegates().add(evlValidator); // EValidator.Registry.INSTANCE.put(ePackage, newValidator); // } } }
plugins/org.etsi.mts.tdl.constraints.ui/src/org/etsi/mts/tdl/constraints/ui/handlers/ValidationHandler.java +15 −16 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.epsilon.evl.execute.UnsatisfiedConstraint; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; Loading Loading @@ -83,22 +82,22 @@ public class ValidationHandler extends AbstractHandler { Validator validator = new Validator(); String messages = ""; try { List<UnsatisfiedConstraint> violations = validator.validate(r); for (UnsatisfiedConstraint v : violations) { messages += v.getMessage()+"\n"; //TODO: this can only work with XtextResources if (((EObject) v.getInstance()).eResource() instanceof XtextResource) { ICompositeNode node = NodeModelUtils.findActualNodeFor((EObject) v.getInstance()); String text = "\tLine "+node.getStartLine()+"-"+node.getEndLine()+ ":\n\t"+node.getText().trim(); messages += " "+text+"\n\n"; } else { //TODO: dump tree-based representation? } } if (violations.size() == 0) { messages = "No violations!"; } // List<UnsatisfiedConstraint> violations = validator.validate(r); // for (UnsatisfiedConstraint v : violations) { // messages += v.getMessage()+"\n"; // //TODO: this can only work with XtextResources // if (((EObject) v.getInstance()).eResource() instanceof XtextResource) { // ICompositeNode node = NodeModelUtils.findActualNodeFor((EObject) v.getInstance()); // String text = "\tLine "+node.getStartLine()+"-"+node.getEndLine()+ ":\n\t"+node.getText().trim(); // messages += " "+text+"\n\n"; // } else { // //TODO: dump tree-based representation? // } // } // if (violations.size() == 0) { // messages = "No violations!"; // } } catch (Exception e) { messages = "An error occurred:" + e.getMessage().replaceAll("\n.+epsilon/", "\n at (epsilon/"); Loading
plugins/org.etsi.mts.tdl.constraints/META-INF/MANIFEST.MF +0 −10 Original line number Diff line number Diff line Loading @@ -4,21 +4,11 @@ Bundle-Name: Constraints Bundle-SymbolicName: org.etsi.mts.tdl.constraints;singleton:=true Bundle-Version: 1.0.0.qualifier Require-Bundle: org.eclipse.emf.common, org.eclipse.epsilon.common, org.eclipse.epsilon.emc.emf, org.eclipse.epsilon.eol.engine, org.eclipse.epsilon.erl.engine, org.eclipse.epsilon.evl.engine, org.eclipse.epsilon.evl.emf.validation, org.eclipse.epsilon.etl.engine, org.eclipse.epsilon.profiling, org.eclipse.epsilon.eol.tools, org.eclipse.core.runtime, org.eclipse.emf.ecore;visibility:=reexport, org.eclipse.emf.ecore.xmi, org.etsi.mts.tdl.model, org.etsi.mts.tdl.common, org.eclipse.xtext, org.eclipse.epsilon.common.dt, org.eclipse.ocl.xtext.completeocl Export-Package: org.etsi.mts.tdl.constraints.evl
plugins/org.etsi.mts.tdl.constraints/plugin.xml +2 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.4"?> <plugin> <!-- <extension point="org.eclipse.epsilon.common.dt.tool"> <tool Loading @@ -8,5 +9,6 @@ defaultName="XtextBridge"> </tool> </extension> --> </plugin>