^1639983259727
@
sname
NewThingManagerDialog
slabel
NewFactoryDialog
sdescriptors
xworker.swt.widgets.Display
  @/@shellt
  sname
  shell
  stext
  新建项目
  sstyle
  APPLICATION_MODAL
  sNO_TRIM
  false
  sCLOSE
  true
  sTITLE
  true
  sMIN
  false
  sMAX
  false
  sBORDER
  false
  sRESIZE
  false
  sON_TOP
  false
  sTOOL
  false
  sNO_FOCUS
  false
  swidth
  -1
  sheight
  -1
  scenterScreen
  true
  spack
  true
  smaximized
  false
  sfullScreen
  false
  sdesign
  true
  sisIde
  false
  sdesignDefaultOpen
  false
  sH_SCROLL
  false
  sV_SCROLL
  false
  sNO_BACKGROUND
  false
  sNO_MERGE_PAINTS
  false
  sNO_REDRAW_RESIZE
  false
  sNO_RADIO_GROUP
  false
  sEMBEDDED
  false
  sDOUBLE_BUFFERED
  false
  slabel
  shell
  scapture
  false
  senabled
  true
  sredraw
  true
  svisible
  true
  sdescriptors
  xworker.swt.widgets.Display/@Shell
  sid
  shellt
    @/@shellt/@shellGridLaout
    sname
    shellGridLaout
    snumColumns
    3
    smakeColumnsEqualWidth
    false
    smarginWidth
    5
    smarginHeight
    5
    smarginLeft
    0
    smarginTop
    0
    smarginRight
    0
    smarginBottom
    0
    shorizontalSpacing
    5
    sverticalSpacing
    5
    slabel
    shellGridLaout
    sdescriptors
    xworker.swt.Layouts/@GridLayout
    sid
    shellGridLaout
    @/@shellt/@helpBrowser
    sname
    helpBrowser
    sMOZILLA
    false
    sWEBKIT
    false
    sjavascriptEnabled
    true
    sdescriptors
    xworker.swt.Widgets/@Browser
    sinheritDescription
    false
    sth_createIndex
    false
    sth_registMyChilds
    false
    sth_mark
    false
    sid
    helpBrowser
      @/@shellt/@helpBrowser/@helpBrowserGridData
      sname
      helpBrowserGridData
      sstyle
      FILL_HORIZONTAL
      shorizontalIndent
      0
      swidth
      600
      sheight
      180
      shorizontalAlignment
      BEGINNING
      sverticalAlignment
      CENTER
      shorizontalSpan
      3
      sverticalSpan
      1
      sgrabExcessHorizontalSpace
      false
      sgrabExcessVerticalSpace
      false
      sdescriptors
      xworker.swt.layout.LayoutDatas/@GridData
      sinheritDescription
      false
      sth_createIndex
      false
      sth_registMyChilds
      false
      sth_mark
      false
      sid
      helpBrowserGridData
    @/@shellt/@thingForm
    sname
    thingForm
    scolumn
    1
    sH_SCROLL
    false
    sV_SCROLL
    false
    sNO_BACKGROUND
    false
    sNO_FOCUS
    false
    sNO_MERGE_PAINTS
    false
    sNO_REDRAW_RESIZE
    false
    sNO_RADIO_GROUP
    false
    sEMBEDDED
    false
    sDOUBLE_BUFFERED
    false
    sdescriptors
    xworker.swt.Widgets/@ThingForm
    sinheritDescription
    false
    sth_createIndex
    false
    sth_registMyChilds
    false
    sth_mark
    false
    sid
    thingForm
      @/@shellt/@thingForm/@thingFormGridData
      sname
      thingFormGridData
      sstyle
      FILL_HORIZONTAL
      shorizontalIndent
      0
      swidth
      -1
      sheight
      -1
      shorizontalAlignment
      BEGINNING
      sverticalAlignment
      CENTER
      shorizontalSpan
      3
      sverticalSpan
      1
      sgrabExcessHorizontalSpace
      false
      sgrabExcessVerticalSpace
      false
      sdescriptors
      xworker.swt.layout.LayoutDatas/@GridData
      sinheritDescription
      false
      sth_createIndex
      false
      sth_registMyChilds
      false
      sth_mark
      false
      sid
      thingFormGridData
      @/@shellt/@thingForm/@Thing
      sname
      Thing
      sdescriptors
      xworker.swt.xworker.ThingForm/@Thing
      smany
      true
      seditCols
      2
      sinitialization
      false
      smodifier
      public
      sinheritDescription
      false
      snotXmlAttribute
      false
      sth_createIndex
      false
      sth_registMyChilds
      false
      sth_mark
      false
      sid
      Thing
        @/@shellt/@thingForm/@Thing/@name
        sname
        name
        slabel
        事物管理器名称
        sshowLabel
        true
        sreadOnly
        false
        sinheritDescription
        false
        svalidateAllowBlank
        false
        sblankText
        事物管理器的名称不能为空？
        LvalidateOnBlur
        true
        LallowDecimals
        true
        LallowNegative
        true
        snotXmlAttribute
        false
        sdescriptors
        xworker.lang.MetaDescriptor3/@attribute
        sth_createIndex
        false
        sth_registMyChilds
        false
        sth_mark
        false
        sid
        name
        @/@shellt/@thingForm/@Thing/@saveDir
        sname
        saveDir
        slabel
        存放目录
        sinputtype
        filePath
        ssize
        60
        sshowLabel
        true
        sreadOnly
        false
        sinheritDescription
        false
        svalidateAllowBlank
        true
        LvalidateOnBlur
        true
        LallowDecimals
        true
        LallowNegative
        true
        snotXmlAttribute
        false
        sdescriptors
        xworker.lang.MetaDescriptor3/@attribute
        sth_createIndex
        false
        sth_registMyChilds
        false
        sth_mark
        false
        sid
        saveDir
    @/@shellt/@buttonCell
    sname
    buttonCell
    sBORDER
    false
    sH_SCROLL
    false
    sV_SCROLL
    false
    sNO_BACKGROUND
    false
    sNO_FOCUS
    false
    sNO_MERGE_PAINTS
    false
    sNO_REDRAW_RESIZE
    false
    sNO_RADIO_GROUP
    false
    sEMBEDDED
    false
    sDOUBLE_BUFFERED
    false
    slabel
    buttonCell
    sdescriptors
    xworker.swt.Widgets/@Composite
    sid
    buttonCell
      @/@shellt/@buttonCell/@buttonCellGridData
      sname
      buttonCellGridData
      sstyle
      FILL_BOTH
      shorizontalIndent
      0
      swidth
      -1
      sheight
      -1
      shorizontalAlignment
      END
      sverticalAlignment
      CENTER
      shorizontalSpan
      3
      sverticalSpan
      1
      sgrabExcessHorizontalSpace
      false
      sgrabExcessVerticalSpace
      false
      slabel
      buttonCellGridData
      sdescriptors
      xworker.swt.Commons/@GridData
      sid
      buttonCellGridData
      @/@shellt/@buttonCell/@buttonCellRowLayout
      sname
      buttonCellRowLayout
      sfill
      false
      sjustify
      false
      smarginWidth
      0
      smarginHeight
      0
      smarginLeft
      3
      smarginTop
      3
      smarginRight
      3
      smarginBottom
      3
      spack
      true
      sspacing
      3
      stype
      SWT.HORIZONTAL
      swrap
      true
      slabel
      buttonCellRowLayout
      sdescriptors
      xworker.swt.Layouts/@RowLayout
      sid
      buttonCellRowLayout
      @/@shellt/@buttonCell/@okButton
      sname
      okButton
      stext
      res:res.w_exp:okButton:确定（&O）
      stype
      SWT.PUSH
      sflat
      false
      sborder
      false
      sselected
      false
      scapture
      false
      senabled
      true
      sredraw
      true
      svisible
      true
      slabel
      okButton
      sdescriptors
      xworker.swt.Widgets/@Button
      sid
      okButton
        @/@shellt/@buttonCell/@okButton/@listeners
        sname
        listeners
        slabel
        listeners
        sdescriptors
        xworker.swt.events.Listeners/@listeners
        sid
        listeners
          @/@shellt/@buttonCell/@okButton/@listeners/@okButtonSelection
          sname
          okButtonSelection
          stype
          Selection
          slabel
          okButtonSelection
          sdescriptors
          xworker.swt.events.Listeners/@listeners/@Listener
          sid
          okButtonSelection
            @/@shellt/@buttonCell/@okButton/@listeners/@okButtonSelection/@GroovyAction
            sname
            GroovyAction
            slabel
            GroovyAction
            sisSynchronized
            false
            sthrowException
            false
            suseOtherAction
            false
            svarScope
            Global
            sdisableGlobalContext
            false
            Scode
#$@text#$@
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.TreeItem;

import org.xmeta.Thing;
import org.xmeta.util.UtilString;
import org.xmeta.index.WorkingSetIndex;
import org.xmeta.index.ThingManagerIndex;

//校验数据输入
if(!thingForm.doAction("validate", actionContext)) return;

//创建新的对象
def values = thingForm.doAction("getValues", actionContext);
def manager = world.getThingManager(values.name);

//保存新的对象
if(manager != null){
    MessageBox box = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
    box.setText(UtilString.getString("res:res.w_exp:commonBoxTitle:操作信息", actionContext));
    box.setMessage(UtilString.getString("res:res.w_exp:alertThingManagerExists:事物管理器已经存在！", actionContext));
    box.open();
    return;
}else{    
    if(actionContext.get("treeItem") == null){
        actionContext.getScope(0).put("result", values);
        shell.dispose();
        return;
    }
    try{
        if(values.link != null && values.link != ""){
            def linkFile = new File(values.link);
            if(!linkFile.exists()){
                MessageBox box = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
                box.setText(UtilString.getString("res:res.w_exp:commonBoxTitle:操作信息", actionContext));
                box.setMessage("Link file not exists, link=" + link);
                box.open();
                return;
            }else if(linkFile.isFile()){
                String linkName = linkFile.getName().toLowerCase();
   			    if((linkName.endsWith(".jar") || linkName.endsWith(".zip"))){
   			    }else{
   			        MessageBox box = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
                    box.setText(UtilString.getString("res:res.w_exp:commonBoxTitle:操作信息", actionContext));
                    box.setMessage("Unsuppored link file type, link=" + link);
                    box.open();
                    return;
   			    }
            }
        }
        
        if(values.saveDir != null && values.saveDir != ""){
            def rootFile = new File(new File(values.saveDir), values.name);
            world.createThingManager(values.name, rootFile, values.link);
            
            //添加到项目中
            def projectSet = world.getThing("_local.xworker.worldExplorer.ProjectSet");
            if(projectSet == null){
                projectSet = new Thing("xworker.ide.worldexplorer.things.ProjectSet");
                projectSet.saveAs("_local", "_local.xworker.worldExplorer.ProjectSet");
            }
            projectSet.doAction("addProject", actionContext, ["projectFile": rootFile, "isWorkspace": false]);
        }else{
            world.createThingManager(values.name, values.link);
        }
        def tree = treeItem.getParent();

        if(treeItem.getData() instanceof ThingManagerIndex){
            if(treeItem.getParentItem() != null){
                treeItem = treeItem.getParentItem();
            }else{ 
                treeItem = treeItem.getParent();
            }            
        }        
        
        def parentIndex = treeItem.getData();        
        if(parentIndex instanceof WorkingSetIndex){
            def workingSet = world.getThing(parentIndex.getPath());
            def thingManageerSet = new Thing("xworker.ide.worldexplorer.things.WorkingSet/@ThingManager");
            thingManageerSet.set("name", values.name);
            workingSet.addChild(thingManageerSet);
            workingSet.save();
        } 
        
        treeItem.getData().refresh();
        def projectIndex = null;
        for(index in treeItem.getData().childs){
            if(index.name == values.name){
                 projectIndex = index;
                 break;
            }
        }
        //查找插入的位置
        int index = 0;
        for(item in treeItem.getItems()){
            if(item.getData().name >= values.name){         
                break;
            }
            
            index ++;
        }
        
        
        def res = tree.getData("resources");
    
        TreeItem citem = new TreeItem(treeItem, SWT.NONE, index);
        citem.setText(projectIndex.getName());
        citem.setData(projectIndex);
        citem.setImage(res.factoryImage);
    
        shell.dispose();
    }catch(Exception e){
        log.error("Create ThingManager error", e);
        MessageBox box = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
        box.setText(UtilString.getString("res:res.w_exp:commonBoxTitle:操作信息", actionContext));
        box.setMessage("Create ThingManager error, " + e.getMessage());
        box.open();
    }
}
#$@text#$@
            sinterpretationType
            Action
            screateLocalVarScope
            false
            ssaveReturn
            false
            sdescriptors
            xworker.lang.actions.Actions/@GroovyAction
            sid
            GroovyAction
      @/@shellt/@buttonCell/@cancelButton
      sname
      cancelButton
      stext
      res:res.w_exp:cancelButton:取消（&C）
      stype
      SWT.PUSH
      sflat
      false
      sborder
      false
      sselected
      false
      scapture
      false
      senabled
      true
      sredraw
      true
      svisible
      true
      slabel
      cancelButton
      sdescriptors
      xworker.swt.Widgets/@Button
      sid
      cancelButton
        @/@shellt/@buttonCell/@cancelButton/@listeners
        sname
        listeners
        slabel
        listeners
        sdescriptors
        xworker.swt.events.Listeners/@listeners
        sid
        listeners
          @/@shellt/@buttonCell/@cancelButton/@listeners/@cancelButtonSelection
          sname
          cancelButtonSelection
          stype
          Selection
          slabel
          cancelButtonSelection
          sdescriptors
          xworker.swt.events.Listeners/@listeners/@Listener
          sid
          cancelButtonSelection
            @/@shellt/@buttonCell/@cancelButton/@listeners/@cancelButtonSelection/@GroovyAction
            sname
            GroovyAction
            slabel
            GroovyAction
            sisSynchronized
            false
            sthrowException
            false
            suseOtherAction
            false
            scode
            shell.dispose();
            sdescriptors
            xworker.lang.actions.Actions/@GroovyAction
            sid
            GroovyAction
    @/@shellt/@Models
    sname
    Models
    slabel
    Models
    sdescriptors
    xworker.swt.Widgets/@Models
    sid
    Models
      @/@shellt/@Models/@model
      sname
      model
      sdataType
      Map
      svalidate
      true
      sfocus
      false
      sfocusColor
      "#E8FAFF"
      sdefaultSelection
      okButtonSelection
      LvalidateOnBlur
      false
      LallowDecimals
      false
      LallowNegative
      false
      slabel
      model
      sdescriptors
      xworker.swt.model.Models/@Model
      sid
      model
        @/@shellt/@Models/@model/@name
        sname
        name
        sswtControl
        factoryNameText
        spropertyName
        name
        svalidate
        true
        sfocus
        true
        sfocusColor
        "#E8FAFF"
        sdefaultSelection
        okButtonSelection
        LvalidateOnBlur
        false
        LallowDecimals
        false
        LallowNegative
        false
        slabel
        name
        sdescriptors
        xworker.swt.model.Model/@Model
        sid
        name
        @/@shellt/@Models/@model/@link
        sname
        link
        sswtControl
        linkText
        spropertyName
        link
        svalidate
        true
        sfocus
        false
        sfocusColor
        "#E8FAFF"
        svalidateAllowBlank
        true
        LvalidateOnBlur
        true
        LallowDecimals
        true
        LallowNegative
        true
        sdescriptors
        xworker.swt.model.Model/@Model
        sth_createIndex
        false
        sid
        link
    @/@shellt/@init
    sname
    init
    sisSynchronized
    false
    sthrowException
    true
    suseOtherAction
    false
    svarScope
    Local
    sdisableGlobalContext
    false
    Scode
#$@text#$@
import xworker.lang.util.XWorkerUtils;

helpBrowser.setUrl(XWorkerUtils.getThingDescUrl("xworker.swt.ide.worldexplorer.swt.dialogs.NewThingManagerDialog/@helpHtml"));
#$@text#$@
    sinterpretationType
    Action
    screateLocalVarScope
    false
    ssaveReturn
    false
    sdescriptors
    xworker.swt.Widgets/@Code
    sinheritDescription
    false
    sth_createIndex
    false
    sth_registMyChilds
    false
    sth_mark
    false
    sid
    init
  @/@helpHtml
  sname
  helpHtml
  sdescriptors
  xworker.lang.MetaThing/@thing
  sinheritDescription
  false
  sth_createIndex
  false
  sth_registMyChilds
  false
  Sdescription
#$@text#$@
<p>事物管理器也称为项目，是对事物归类的一个方法，把事物放在不同的项目下容易区分和查找。</p>

<p><strong>参数说明</strong></p>

<ul>
	<li><strong>事物管理名称</strong><br />
	项目名称，创建后也是文件夹的名称。</li>
	<li><strong>存放目录</strong><br />
	项目会在存放目录下再以事物名创建一个目录，不填默认存放在World的路径下的projects目录下。</li>
</ul>

<p><strong>其他</strong></p>

<ul>
	<li><strong>config.properties</strong><br />
	项目创建后可以修改项目目录下的config.properties文件增加其他配置信息，比如引用其他项目或使用其他事物管理器的实现类等。</li>
</ul>

<p><strong>config.properties的参数</strong></p>

<ul>
	<li><strong>projectName</strong><br />
	项目名称，默认是目录名。<br />
	&nbsp;</li>
	<li><strong>class&nbsp;</strong><br />
	&nbsp;事物管理器的类名，为空使用默认的FileThingManager。<br />
	&nbsp;</li>
	<li><strong>link</strong><br />
	如果不为空表示连接到一个目录，这个目录是一个项目。<br />
	&nbsp;</li>
	<li><strong>其他参数</strong><br />
	其他参数是指具体的事物管理器所需的参数，具体参看所使用的事物管理器的文档。</li>
</ul>

<p>&nbsp;</p>
#$@text#$@
  sth_mark
  false
  sid
  helpHtml
