Custom validation rules plugin not loading [message #1829434] |
Fri, 03 July 2020 11:01 |
Fábio Guarita Messages: 64 Registered: December 2019 |
Member |
|
|
Hi.
I just created a plugin for a custom validation rule using the Tutorial at https://wiki.eclipse.org/Capella/Tutorials/Extensibility/Validation_Rules
After meddling with the Capella Studio settings I was able to have a project free of errors and warnings and generate the .zip with the .jar plugin file.
I installed it in the Capella 1.4.0\eclipse\dropins\plugins folder as stated in the Tutorial.
Tried to check in Capella but it doesn't load the plugin. I checked the Validation rules to see if the rule was added and it wasn't there. I checked the Error log and couldn't find anything related to the plugin. I searched for my plugin on the list in About Capella > Installation Details > Plug-ins tab and nothing. It seems to be completely ignored.
I'd like to know if there's any way I can make Capella load (or try to load) the plug-in I created....
[Updated on: Fri, 03 July 2020 11:02] Report message to a moderator
|
|
|
Re: Custom validation rules plugin not loading [message #1829439 is a reply to message #1829434] |
Fri, 03 July 2020 14:04 |
Fábio Guarita Messages: 64 Registered: December 2019 |
Member |
|
|
I'll add more information to help people engage in this post :D
About the project I built in Capella Studio (KitAlpha):
MANIFEST.MF file contents:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Sample_Validation_Rule_Project
Bundle-SymbolicName: Sample_Validation_Rule_Project;singleton:=true
Bundle-Version: 1.0.0.qualifier
Automatic-Module-Name: Sample_Validation_Rule_Project
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.polarsys.capella.core.validation;bundle-version="1.4.0",
org.eclipse.emf.validation.doc;bundle-version="1.3.0",
org.eclipse.emf.validation.examples;bundle-version="1.3.0",
org.eclipse.emf.validation.ocl;bundle-version="1.4.0",
org.eclipse.emf.validation.ocl.source;bundle-version="1.4.0",
org.eclipse.emf.validation.source;bundle-version="1.8.0",
org.eclipse.emf.validation.ui;bundle-version="1.7.0",
org.eclipse.emf.validation.ui.ide;bundle-version="1.3.0",
org.eclipse.emf.validation.ui.ide.source;bundle-version="1.3.0",
org.eclipse.emf.validation.ui.source;bundle-version="1.7.0",
org.polarsys.capella.core.validation.commandline;bundle-version="1.4.0",
org.polarsys.capella.core.validation.commandline.source;bundle-version="1.4.0",
org.polarsys.capella.core.validation.source;bundle-version="1.4.0",
org.polarsys.capella.core.validation.ui;bundle-version="1.4.0",
org.polarsys.capella.core.validation.ui.ide;bundle-version="1.4.0",
org.polarsys.capella.core.validation.ui.ide.source;bundle-version="1.4.0",
org.polarsys.capella.core.validation.ui.source;bundle-version="1.4.0"
Export-Package: myfirstvalidationrule
The CapellaTutorialValidationRule.java file contents:
package myfirstvalidationrule;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.validation.IValidationContext;
import org.polarsys.capella.common.data.modellingcore.AbstractNamedElement;
import org.polarsys.capella.core.data.pa.PhysicalFunction;
import org.polarsys.capella.core.validation.rule.AbstractValidationRule;
public class CapellaTutorialValidationRule extends AbstractValidationRule {
/**
* {@inheritDoc}
*/
@Override
public IStatus validate(IValidationContext ctx) {
EObject eObj = ctx.getTarget();
if (eObj instanceof PhysicalFunction) {
PhysicalFunction capellaElt = (PhysicalFunction) eObj;
String desc = capellaElt.getDescription();
String summary = capellaElt.getSummary();
if (desc == null || desc.isEmpty() || summary == null || summary.isEmpty()) {
if (capellaElt instanceof AbstractNamedElement) {
AbstractNamedElement namedElt = (AbstractNamedElement) capellaElt;
return ctx.createFailureStatus(new Object[] {capellaElt.eClass().getName(), namedElt.getName()});
}
return ctx.createFailureStatus(new Object[] {capellaElt.eClass().getName(), "<unnamed>"});
}
}
return ctx.createSuccessStatus();
}
}
My plugin.xml file contents:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension point="org.eclipse.emf.validation.constraintProviders">
<constraintProvider>
<package namespaceUri="http://www.polarsys.org/capella/core/pa/1.4.0"/>
<constraints categories="capella.category/design/well-formedness/data">
<constraint
class="myfirstvalidationrule.CapellaTutorialValidationRule"
id="DWF_PA_99"
isEnabledByDefault="true"
lang="Java"
mode="Batch"
name="DWF_PA_99 - Physical Architecture Functions Description and Summary"
severity="ERROR"
statusCode="1">
<message>
The function {1} has either no description or no summary!
</message>
<target class="PhysicalFunction"/>
<description>
This validation rule checks that all Functions in Physical Architecture have a description and a summary.
</description>
</constraint>
</constraints>
</constraintProvider>
</extension>
</plugin>
My build.properties file contents:
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml
Can anyone see a problem here? Using Capella [Studio] v1.4.0
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04871 seconds