EVL Validation on Diagram with references [message #777525] |
Tue, 10 January 2012 16:25 |
Snakebyte Missing name Messages: 130 Registered: November 2011 |
Senior Member |
|
|
Hello,
i got the following problem. I try to use validation like mentioned in the tutorial here :
http://www.eclipse.org/gmt/epsilon/doc/articles/evl-gmf-integration/
And it works well as long as i dont create referecences between two or more files.
I use only one model.
In my UseCase i have special nodes. These nodes can reference external nodes.
So i use the Load Resource Action to load an external resource to my local file and set the references of these nodes.
I do this to achieve a special kind of partitioning.
If i dont use these nodes, or simply dont set there reference everything works well.
But if i set one of these references and validate the diagram, i got the following exception :
!MESSAGE Validation failed
!STACK 0
java.lang.NullPointerException
at org.eclipse.epsilon.evl.emf.validation.EvlValidator.validate(EvlValidator.java:149)
at org.eclipse.epsilon.evl.emf.validation.EvlValidator.validate(EvlValidator.java:73)
at org.eclipse.epsilon.evl.emf.validation.CompositeEValidator.validate(CompositeEValidator.java:44)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:165)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:143)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:114)
at gsnModel.diagram.part.ValidateAction.runEMFValidator(ValidateAction.java:148)
at gsnModel.diagram.part.ValidateAction.validate(ValidateAction.java:163)
at gsnModel.diagram.part.ValidateAction.access$0(ValidateAction.java:156)
at gsnModel.diagram.part.ValidateAction$2.run(ValidateAction.java:132)
at gsnModel.diagram.providers.GsnModelValidationProvider$1.run(GsnModelValidationProvider.java:36)
at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.runExclusive(TransactionalEditingDomainImpl.java:328)
at gsnModel.diagram.providers.GsnModelValidationProvider.runWithConstraints(GsnModelValidationProvider.java:44)
at gsnModel.diagram.part.ValidateAction.runValidation(ValidateAction.java:129)
at gsnModel.diagram.part.ValidateAction$1.run(ValidateAction.java:75)
at org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation.execute(WorkspaceModifyDelegatingOperation.java:69)
at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118)
at gsnModel.diagram.part.ValidateAction.run(ValidateAction.java:78)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
I dont really know if this is the same issue like in the post here :
http://www.eclipse.org/forums/index.php/t/246423/
because this uses special kind of module instances doesnt starting with the root element.
My files all start with the root element.
I seems like the validation doesnt work correctly with these external references.
I doesn't work if the validation should work on several files.
This is a feature i dont really need. I only want to check the current file for itself.
Is that possible ?
[Updated on: Thu, 12 January 2012 17:46] Report message to a moderator
|
|
|
|
Re: EVL Validation on Diagram with references [message #778390 is a reply to message #778340] |
Thu, 12 January 2012 17:55 |
Snakebyte Missing name Messages: 130 Registered: November 2011 |
Senior Member |
|
|
OK i just realized i linked the wrong post, then its indeed not so easy to understand my question. I corrected the link in my first post and i will give some more information on what i did.
Here is a part of my metamodel.
@gmf.node(label="identifier", border.width="2", border.color="0,0,0", size="130,50", figure="rectangle", label.icon="false")
class Goal{
attr String identifier;
@gmf.link(target.decoration="filledclosedarrow", color="0,0,0")
ref AwayGoal[*] SupportingAwaySubgoalsOfGoal;
ref AwayGoal[*]#ReferencedGoal isReferencedByAwayGoals;
}
@gmf.node(label="identifier", border.width="1", border.color="0,0,0", size="130,50", label.icon="false", figure="rectangle")
class AwayGoal {
ref Goal[1]#isReferencedByAwayGoals ReferencedGoal;
attr String AwayGoalModuleIdentifier;
}
So i model a bidrectional connection between Goal und AwayGoal.
Now i create 2 Files.
File A contains the AwayGoal.
File B contains the Goal.
Then i open File A, choose the load resource action und load File B.
Then i set the reference ReferencedGoal to my Goal.
So i have a bidirectional reference between 2 files.
Now i created a new plugin, to use some validation on my models as shown in this tutorial.
http://www.eclipse.org/gmt/epsilon/doc/articles/evl-gmf-integration/
This evl file seems to work on single files and is defined with a simple rule like this:
context Goal {
constraint identifierIsSet {
check : self.identifier.isDefined()
message : 'Goal identifier is not set.'
}
And when doing some more investigation, this fails everytime when there is a validation rule error found in File B. When opening File A, load resource B (containing the AwayGoal) and start validation it crashes.
So it seems like the validation crashes, when referenced Files contain errors.
If the external files dont contain any errors the validation finished showing all error in the current file.
Is this a bug ?
How can i fix this?
I dont even need the validation to check my complete resource. I just want to check the current file.
Is this possible ?
[Updated on: Fri, 13 January 2012 02:09] Report message to a moderator
|
|
|
Re: EVL Validation on Diagram with references [message #778519 is a reply to message #778390] |
Fri, 13 January 2012 02:21 |
Snakebyte Missing name Messages: 130 Registered: November 2011 |
Senior Member |
|
|
I try debugging a little bit and im now here.
In EvlValidator.class there is a method :
protected ValidationResults validate(Resource resource)
This method uses the following in line 149
for (EvlUnsatisfiedConstraint unsatisfied : module.getContext().getUnsatisfiedConstraints()) {
results.get(unsatisfied.getInstance()).add(unsatisfied);
}
The UnsatisfiedConstraints contains all found constraints in all files.
This result map seems to contain only objects from the main file (File A) from which the validation started and so this returns null for any object in external files.
Is there any workaround about this ?
The best solution would be to make sure that the UnsatisfiedConstraints only contains Constraints from the current File. But im not sure on how to do this.
[Updated on: Fri, 13 January 2012 02:22] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05165 seconds