Using the Eclipse plug-in

1.Basic knowledge

1.1.XWorker project directory

    In Eclipse, you use XWorker plug-ins to edit the model. The model must have two ways to set up XWorker items under the XWorker project directory.


    In a directory in Eclipse, a file named .dml can be created to make the directory a project directory of the XWorker, which can be created in the directory and subdirectory.

1.1.2.Project name

    In .dml, you can set projectName properties, such as projectName=Test, which means the project name is Test.

    The project name can be empty, and the directory name is used as the project name. Because the name of the project can not be repeated, it is recommended that the directory be used as the project name.

1.2.XWorker's project is global

    Because the dynamic model engine is designed as a global single state, even in different projects of Eclipse, the path of the thing still cannot be repeated, and the path of each thing must be unique, otherwise the editor will only edit the first thing that is in line with the path.

2.The way to create things

2.1.Use a new thing Guide

  Enter a new thing guide.


    Create a thing.


2.2.Create a *.dml file

    You can create a file with suffix DML directly in the directory, and then double-click to create the edit, but this model is not described at this time.

3.Edit things

    Double click to open the thing under the directory, if the text editor opens, select the open mode for ThingEditor, or the default editor of *.dml, *.xer, *.xer.txt, *.xer.xml in the Window->Preferences->General->Editors->File Associations to be set to ThingEditor.


4.Run things

    Because there is only one instance of XWorker in Eclipse, it has nothing to do with the specific Eclipse project, so the running model in the editor does not use the Eclipse's project configuration, so if the model does not depend on the other configuration of the project, you can run it directly, otherwise you can run the model in the Java code.  

    Such as:

import org.xmeta.ActionContext;
import org.xmeta.Thing;
import org.xmeta.World;
public class RunEditor {
    public static void main(String args[]){
            World world = World.getInstance();          
            Thing thingEditor = world.getThing("xworker.swt.xwidgets.prototypes.SimpleThingEditor");
            ActionContext actionContext = new ActionContext();
            thingEditor.doAction("run", actionContext);
        }catch(Exception e){


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