Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 365847

Summary: Add support to genmodel for validate on save
Product: [Modeling] GMF-Tooling Reporter: Ralph Gerbig <ralphgerbig>
Component: CoreAssignee: Project Inbox <gmp.gmf-tooling-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: borlander, pierre-charles.david
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Ralph Gerbig CLA 2011-12-07 04:29:48 EST
Hi all,

I is often asked for automated validation on saving a diagram. We could add such a boolean property to the genmodel. I think of GenEditor or GenDiagram. I did not take a closer look on how the modified templates would look like, but I could do so if this is of interest. The templates should not be to hard to change to this case. I currently have this custom template running.

«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 think this would be needed to be extended to ask for the flag in the genmodel and the package for the Validation action will be needed to be retrieved dynamically.

Ralph