Program Issues

Current issues:

How to do Model to Model Mapping

This program contains two Xtext generated models (spad and euclid) and I don't know how to choose the best way to map between them (to convert a program in one model to a program in the other model)

euclideanspace program components

(this design is explained more fully on this page under 'Application Design' section).

Should I translate files between these two models using either:

I'm not sure what the criteria is for choosing between these methods but this things may be significant:

Does Not Yet Create 'source' Folders

The SPAD new project wizard has the option to initialise a file structure from SPAD source files. This creates two top level folders 'src' and 'src-gen'. These folders are created as ordinary local folders but the Xtext documentation says "Now simply create a new source folder src-gen in the that project and see how the compiler will pick up your sample Entities and generate Java code for them."

    public IFolder createFolder(String name,IFolder parent) {
	  IFolder folder = null;
	  try {
	    if (parent == null) {
	        //String folderFullPath = project.getStringProperty(INewJavaClassDataModelProperties.SOURCE_FOLDER);
	    	//folder = project.getFolder(new Path(folderFullPath));
	    	folder = project.getFolder(name);
	    else folder = parent.getFolder(name);
	    if (!folder.exists()) {
	      folder.create(false,true, null);
	    IPackageFragmentRoot srcRoot = project.getPackageFragmentRoot(folder);
	    IClasspathEntry[] oldEntries = project.getRawClasspath();
	    IClasspathEntry[] newEntries = new IClasspathEntry[oldEntries.length + 1];
	    System.arraycopy(oldEntries, 0, newEntries, 0, oldEntries.length);
	    newEntries[oldEntries.length] = JavaCore.newSourceEntry(srcRoot.getPath());
	    project.setRawClasspath(newEntries, null);
      } catch (CoreException e) {
	  return folder;
import org.eclipse.jdt.core.IPackageFragmentRoot;

metadata block
see also:

Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.


This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2021 Martin John Baker - All rights reserved - privacy policy.