Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Call validation on save
Call validation on save [message #761637] Tue, 06 December 2011 14:27 Go to next message
Eclipse UserFriend
there is a way to call validation of a model on save? i've tried with ValidationAction in the save method but it doesn't works....
Re: Call validation on save [message #761913 is a reply to message #761637] Wed, 07 December 2011 04:23 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

use this template:

«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
«EXTENSION xpt::editor::Utils»

«AROUND additions FOR gmfgen::GenEditorView-»
/**
	 * @generated
	 */
	@Override
	public void doSave(org.eclipse.core.runtime.IProgressMonitor progressMonitor) {
		xxx.diagram.part.ValidateAction.runValidation(this.getDiagram());
		
		super.doSave(progressMonitor);
	}
«ENDAROUND»

«AROUND doSaveAs FOR gmfgen::GenEditorView-»
	«EXPAND xpt::Common::generatedMemberComment»
public void doSaveAs() {
	xxx.diagram.part.ValidateAction.runValidation(this.getDiagram());
	
	performSaveAs(new org.eclipse.core.runtime.NullProgressMonitor());
}
«ENDAROUND»

I store the template in the folder: templates/aspects/xpt/Editor.xpt

Here you can find information on how to use templates: http://www.bonitasoft.org/blog/eclipse/customize-your-gmf-editor-by-customizing-templates/

You also might consider using the Epsilon Validation Language for validating you model.

Ralph
Re: Call validation on save [message #762083 is a reply to message #761913] Wed, 07 December 2011 09:21 Go to previous message
Eclipse UserFriend
Thanks! It Works Smile
Previous Topic:White-Papers\Article to GMF
Next Topic:Creating .gmfgen crashes!
Goto Forum:
  


Current Time: Sat Nov 08 21:05:48 EST 2025

Powered by FUDForum. Page generated in 0.03892 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top