Пример #1
0
  public static void init(ActionContext actionContext) {
    World world = World.getInstance();
    // import xworker.util.ThingOgnlAccessor;

    // 初始化Ognl读Thing的类
    // ThingOgnlAccessor.init();

    System.out.println("init world=" + world);

    // 重新设置元事物,Java代码中定义的元事物是最简单的,有更多功能的更好一些
    Thing metaThing = world.getThing("xworker.lang.MetaThing").detach();
    // 保留元事物的路径
    metaThing.getMetadata().setPath("xworker.lang.MetaThing");
    metaThing.initChildPath();
    world.metaThing = metaThing;

    // 检查全局配置是否存在
    Thing globalConfig = world.getThing("_local.xworker.config.GlobalConfig");
    if (globalConfig == null) {
      globalConfig = new Thing("xworker.ide.config.decriptors.GlobalConfig");
      globalConfig.put("name", "GlobalConfig");
      globalConfig.copyTo("_local", "_local.xworker.config");
    }

    // 注册事物
    ThingRegistor.regist(
        "_xworker_thing_attribute_editor_config", "xworker.lang.attributeEditors.EditorConfig");
    ThingRegistor.regist(
        "_xworker_thing_attribute_editor_CodeEditor", "xworker.swt.xworker.CodeEditor");
    ThingRegistor.regist("_xworker_thing_attribute_editor_GridData", "xworker.swt.layout.GridData");
    ThingRegistor.regist(
        "_xworker_thing_attribute_editor_CodeEditor", "xworker.swt.xworker.CodeEditor");
    ThingRegistor.regist(
        "_xworker_thing_attribute_editor_HtmlEditor", "xworker.swt.xworker.HtmlEditor");
    ThingRegistor.regist(
        "_xworker_thing_attribute_editor_openDataListener",
        "xworker.ide.worldExplorer.swt.shareScript.ThingEditor/@scripts/@openDataListener");

    ThingRegistor.regist("_xworker.swt_model", "xworker.swt.model.Model");
    ThingRegistor.regist("_xworker_globalConfig", "_local.xworker.config.GlobalConfig");
    // log.info("ThingRegister regiseted all");
    // log.info("ThingRegister class=" + ThingRegistor.getThings());

    // 执行其他项目的初始化
    World.getInstance().runActionAsync("xworker.ide.config.Project/@actions/@initBackground", null);
  }