Editing Model

1.Thing Manager

   The XWorker Model Editor is called the Thing Manager and can be used to edit the model.

2.Markup Model Directory

    Like Java, dynamic models have the concept of packages. Just as you specify the root directory of a source file in a Java editor, you need to let the model editor know that that directory is the root directory of the model.

    The method is to create a file named .dml (or dml.properties) in the root directory of the model. The content can be empty, or the content can be name=<projectName>, where projectName is the name of the model project.

3.Start the Model Editor

    You can start the model editor with Java code.

package dataobject.example;

import org.xmeta.Thing;
import org.xmeta.World;

/**
 * Here you start the Things Manager.
 *
 */
public class SimpleThingEditor {
	public static void main(String[] args){
        try{
            //X-Meta engines are single-instance
            World world = World.getInstance();          
             
            //Initialization engine, parameter is the model library directory (XWorker),
            //If null, get the location of the model library through XMETA_HOME or XWORKER_HOME environment variables
            world.init(null);

            Thread.currentThread().setContextClassLoader(world.getClassLoader());
 
            //Start the Things Manager
            Thing worldExplorer = World.getInstance().
            		getThing("xworker.swt.xwidgets.prototypes.SimpleThingEditor");       
            worldExplorer.doAction("run");
        }catch(Exception e){
            e.printStackTrace();
        }
    }
}

 

 

Copyright ©  2007-2019 XWorker.org  版权所有  沪ICP备08000575号