Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » UML validation from org.eclipse.emf.validation.examples.general(validate UML model using the code provided from the examples of EMF Validation)
UML validation from org.eclipse.emf.validation.examples.general [message #490962] Mon, 12 October 2009 11:30 Go to next message
--alex--  is currently offline --alex--
Messages: 26
Registered: October 2009
Junior Member
Hi,
i'm trying to develop a UML validator plugin to create and validate contraints for a certain UML profile.

As a total beginner with eclipse plugin technology and emf in general and thus I'm very confused. So I've decided to start from the org.eclipse.emf.validation.examples.general example to see what I can get.

What I need is a button (or a method to override the "Validate" button in the UML editor) which allows me to do some constraint checks for my particular UML profile. For simplicity, at the moment it's enough that I succeed in validate a plain UML model without a profile.

Unfortunately I'm not succeeded in the modification of such example, as I get a button "Validation_1" in the menu of UML editor which doesn't call the constraint I've defined.

The steps of my modification are described as follows:
1- in the plugin.xml I've added (I know that it's not what I want since in this way I get a menu and a button but it's not a big problem now)
<extension point="org.eclipse.ui.editorActions">

<editorContribution
targetID="org.eclipse.uml2.uml.editor.presentation.UMLEditorID "
id="org.eclipse.uml2.examples.uml.ui.UMLEditorContributionID ">
<menu
label="Validation_1"
path="org.eclipse.uml2.umlMenuID/additions-end"
id="Validation_1">
<separator name="additions"/>
</menu>
<action
label="Validation_1"
icon="$nl$/icons/elcl16/validate_co.gif"
class=" org.eclipse.emf.validation.examples.general.actions.BatchVal idationDelegate "
menubarPath="org.eclipse.uml2.umlMenuID/Validation_1/additions "
id="Validation_1Action"/>
</editorContribution>
</extension>

2- in the plugin.xml I've modified the line
<package namespaceUri=" http:///org/eclipse/emf/metamodel/example/pde/library.ecore/ 1.0.0"/>
in
<package namespaceUri="http://www.eclipse.org/uml2/2.1.0/UML"/>

3- in the file "BatchValidationDelegate.java" I've modified the type of the type of the editor reference from "EXTLibraryEditor" to "UMLEditor" (and the relative cast in the "setActiveEditor" method)

4- in the definition of the example of constraint in "NonEmptyNamesConstraint.java" I've just added a debug message to see if whenever I press the "Validation_1" button I get the message in the console (with the line "ConsoleUtil.printError("DEBUG", "Constraint Processing");")

When I start the example as an eclipse plugin and I press the Validation_1 button the message "Constraint Processing" doesn't not appear even if the action of the button (BatchValidationDelegate) is called correctly. It seems I've missed something in the ragistration of the constraint for the UML model but I can't see other places to modify in order to get the example working.

Can somebody tells me the correct way to proceed?
Re: UML validation from org.eclipse.emf.validation.examples.general [message #491128 is a reply to message #490962] Tue, 13 October 2009 08:30 Go to previous message
Vlad Varnica is currently offline Vlad Varnica
Messages: 546
Registered: July 2009
Location: Milton Keynes - UK
Senior Member
Hi Alex,

I was reading your post and tried to add a constraints at metamodel level directly. The model validation is successful. For me the problem is during the transformation stage.
This is not therefore a UML tools question but more related to EMF transformation, I think Rolling Eyes

As I always say" The best transformation is no TRANSFORMATION at ALL"

Concerning Profiles using stereotypes and constraints please not that if you were working at metamodel level this project would be finished in one day. You just need to create a profile and extend the property to your project.
It immediately works Shocked

[Updated on: Tue, 13 October 2009 08:35]

Report message to a moderator

Previous Topic:Re: Problem load model
Next Topic:UML validation from org.eclipse.emf.validation.examples.general
Goto Forum:
  


Current Time: Fri Aug 29 22:26:23 EDT 2014

Powered by FUDForum. Page generated in 0.03256 seconds