Custom Validation Rules Not Working

Hello,
I have followed the tutorial to develop custom validation rules (
https://wiki.polarsys.org/Capella/Tutorials/Extensibility/Va lidation_Rules). When deploying my plugin, I can see the custom rule appear under Model Validation in Preferences, and everything looks fine.
However, when I run the model it does not pop up any of my custom messages, even when they are set to true at all times.
I have tried this with the source code provided in the tutorial, and the exact same thing happens. I have tried this on Capella 1.2.1 and 1.3.0 with Java 1.8.
Has anyone had this issue? Am I missing something crucial that is not stated in the tutorial?
Thanks,
Daniil

Hi Daniil,
in general custom rules work. I remember, that I had some issues after creating new category (they were not visible, new category as well), so I added them to existing category and they worked properly. Attached you will find exemplary screenshots and dropins for capella 1.2 as well as workspace for capella studio 1.2 - please review, maybe it will help in your case.
Jakub

Hello,
Thank you so much, it all works!!! I updated your files to 1.3 and it works on 1.3 as well!
It looks like my primary problem was that I was importing the namespaceURI package for Capella 1.1 since I didnt realize that the version number corresponded to capella version. Also, had some minor set up issues.
Thanks again, super helpful!
Best,
Daniil

Hello I have a small follow up regarding the quick fixes.
The built-in Capella quickfixes automatically delete the warning message when they execute. Is there a way to code custom quick-fixes in the same way so that the rule automatically dissapears when it successfully makes a change?
Thank you in advance,
Daniil

What do you mean with “the rule disappears”?

Sorry for being unclear. When I run a validation check, the errors will appear under the Information tab with the details about what went wrong, and for some rules a quick fix option. When I select a quick-fix for a built in rule and it executes, the error message line dissapears from under Infomration, since that error has been resolved.
My questions is: is there a way to have the error line dissapear for my custom validation rules/quick-fixes? I don’t want to rerun the validation every time to see the Information tab updated for fixed errors.
Thank you,
Daniil

Well, it’s the quickfix itself that deletes the ‘line’ (its marker) when it is run, and then the line should disappear automatically from the information view. So in your quickfix execution you get the marker as a parameter and when you can resolve the problem just call marker.delete() in the end and you should be good.

Hello,
Thanks for the tip, it works exactly as you said with the .delete() method! I had not realized what the marker actually represented before.
Best,
Daniil

Hello,
Apologies I have another question, this one about creation of new Capella validation categories. The only information I can seem to find about creating new categories is from the tutorial. But all it says is:
“Note: categories are <capella_source_code_tree> \core\plugins\org.polarsys.capella.core.validation\plugin.xm l
Modify this file to add new categories (they must be children of capella.category)”
I cannot seem to locate this plugin.xml file and cant find a way to create a new category.
Thank you in advance, any help will be appreciated.
Best,
Daniil

Hi Daniil,
you need to unzip this jar file:
As mentioned in my 1st post, this didn’t work for me. Added “MyRules” category:
doesn’t appear in Capella category tree:
No idea if a new category shall be registered somewhere else to be visible…

Hello,
Thank you for the response. I have also tried out several things based off of that and have not had any success with having it be represented unfortunately.
Hopefully this will be possible at some point.
Thanks,
Daniil

You don’t have to unzip anything. You can just create a new constraintProvider in your own plugin and then add a new category with an id like this:
capella.category/MyOwnStuff:

Hello,
This worked, very simple fix! Thank you!
Best,
Daniil

Copyright © Eclipse Capella, the Eclipse Capella logo, Eclipse and the Eclipse logo are Trademarks of The Eclipse Foundation.