^1640696286426
@
sname
FakeNewThingDialog
sNO_TRIM
false
sCLOSE
true
sTITLE
true
sMIN
true
sMAX
true
sBORDER
false
sRESIZE
false
sON_TOP
false
sTOOL
false
sNO_FOCUS
false
swidth
640
sheight
480
scenterScreen
true
spack
false
smaximized
false
sfullScreen
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
FakeNewThingDialog
scapture
false
senabled
true
sredraw
true
svisible
true
sdescriptors
xworker.swt.widgets.Shell
sinheritDescription
false
sth_createIndex
false
sth_registMyChilds
false
sth_mark
false
  @/@FillLayout
  sname
  FillLayout
  stype
  SWT.HORIZONTAL
  sdescriptors
  xworker.swt.Layouts/@FillLayout
  sinheritDescription
  false
  sth_createIndex
  false
  sth_registMyChilds
  false
  sth_mark
  false
  sid
  FillLayout
  @/@mainComposite
  sname
  mainComposite
  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
  shell
  scapture
  false
  senabled
  true
  sredraw
  true
  svisible
  true
  sdescriptors
  xworker.swt.Widgets/@Composite
  sinheritDescription
  false
  sth_createIndex
  false
  sth_registMyChilds
  false
  sth_mark
  false
  sid
  mainComposite
    @/@mainComposite/@resources
    sname
    resources
    sdescriptors
    xworker.swt.Widgets/@Resource
    sth_createIndex
    false
    sth_registMyChilds
    false
    sth_mark
    false
    sid
    resources
      @/@mainComposite/@resources/@folderImage
      sname
      folderImage
      stype
      Image
      simageFile
      icons/folder.png
      sdescriptors
      xworker.swt.util.Resource/@Image
      sth_createIndex
      false
      sth_registMyChilds
      false
      sth_mark
      false
      sid
      folderImage
    @/@mainComposite/@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
    @/@mainComposite/@dataObjectNameLabel
    sname
    dataObjectNameLabel
    sBORDER
    false
    stype
    HORIZONTAL
    sshadow
    SHADOW_OUT
    salignment
    LEFT
    stext
    res:res.w_exp:thingNameLabel:事物名：
    scapture
    false
    senabled
    true
    sredraw
    true
    svisible
    true
    slabel
    dataObjectNameLabel
    sdescriptors
    xworker.swt.Widgets/@Label
    sid
    dataObjectNameLabel
    @/@mainComposite/@dataObjectNameText
    sname
    dataObjectNameText
    sstyle
    SINGLE
    sH_SCROLL
    false
    sV_SCROLL
    false
    sWRAP
    false
    sREAD_ONLY
    false
    sPASSWORD
    false
    sSEARCH
    false
    sCANCEL
    false
    sBORDER
    true
    salign
    LEFT
    slabel
    dataObjectNameText
    sdescriptors
    xworker.swt.Widgets/@Text
    sid
    dataObjectNameText
      @/@mainComposite/@dataObjectNameText/@dataObjectNameTextGridData
      sname
      dataObjectNameTextGridData
      shorizontalIndent
      0
      swidth
      350
      sheight
      -1
      shorizontalAlignment
      BEGINNING
      sverticalAlignment
      CENTER
      shorizontalSpan
      2
      sverticalSpan
      1
      sgrabExcessHorizontalSpace
      false
      sgrabExcessVerticalSpace
      false
      slabel
      dataObjectNameTextGridData
      sdescriptors
      xworker.swt.Commons/@GridData
      sid
      dataObjectNameTextGridData
    @/@mainComposite/@deslabel
    sname
    deslabel
    sBORDER
    false
    stype
    HORIZONTAL
    sshadow
    SHADOW_OUT
    salignment
    LEFT
    stext
    res:res.w_exp:descriptorNameLabel:描述名：
    scapture
    false
    senabled
    true
    sredraw
    true
    svisible
    true
    slabel
    deslabel
    sdescriptors
    xworker.swt.Widgets/@Label
    sid
    deslabel
    @/@mainComposite/@descriptorText
    sname
    descriptorText
    sstyle
    SINGLE
    sH_SCROLL
    false
    sV_SCROLL
    false
    sWRAP
    false
    sREAD_ONLY
    false
    sPASSWORD
    false
    sSEARCH
    false
    sCANCEL
    false
    sBORDER
    true
    salign
    LEFT
    slabel
    descriptorText
    sdescriptors
    xworker.swt.Widgets/@Text
    sid
    descriptorText
      @/@mainComposite/@descriptorText/@descriptorTextGridData
      sname
      descriptorTextGridData
      sstyle
      FILL_HORIZONTAL
      shorizontalIndent
      0
      swidth
      300
      sheight
      -1
      shorizontalAlignment
      BEGINNING
      sverticalAlignment
      CENTER
      shorizontalSpan
      1
      sverticalSpan
      1
      sgrabExcessHorizontalSpace
      false
      sgrabExcessVerticalSpace
      false
      slabel
      descriptorTextGridData
      sdescriptors
      xworker.swt.Commons/@GridData
      sid
      descriptorTextGridData
    @/@mainComposite/@selectButton
    sname
    selectButton
    stext
    *
    stype
    SWT.PUSH
    sflat
    false
    sborder
    false
    sselected
    false
    scapture
    false
    senabled
    true
    sredraw
    true
    svisible
    true
    slabel
    selectButton
    sdescriptors
    xworker.swt.Widgets/@Button
    sid
    selectButton
      @/@mainComposite/@selectButton/@listeners
      sname
      listeners
      slabel
      listeners
      sdescriptors
      xworker.swt.events.Listeners/@listeners
      sid
      listeners
        @/@mainComposite/@selectButton/@listeners/@selectionButtonSelection
        sname
        selectionButtonSelection
        stype
        Selection
        slabel
        selectionButtonSelection
        sdescriptors
        xworker.swt.events.Listeners/@listeners/@Listener
        sid
        selectionButtonSelection
          @/@mainComposite/@selectButton/@listeners/@selectionButtonSelection/@GroovyAction
          sname
          GroovyAction
          slabel
          GroovyAction
          sisSynchronized
          false
          sthrowException
          false
          suseOtherAction
          false
          svarScope
          Local
          sdisableGlobalContext
          false
          Scode
#$@text#$@
import org.xmeta.ActionContext;

import xworker.swt.util.SwtDialog;

def dialogObject = world.getThing("xworker.swt.ide.worldexplorer.swt.tools.ThingSelector/@shell");
def treeItem = event.widget.getParent().getData();

ActionContext context = new ActionContext();
context.put("treeItem", treeItem);
context.put("parent", shell);
context.put("text", descriptorText);

def newShell = dialogObject.doAction("create", context);
SwtDialog dialog = new SwtDialog(shell, newShell, context);

def result = dialog.open();
if(result != null){
    descriptorText.setText(result);
}
#$@text#$@
          sinterpretationType
          Action
          screateLocalVarScope
          false
          ssaveReturn
          false
          sdescriptors
          xworker.lang.actions.Actions/@GroovyAction
          sid
          GroovyAction
    @/@mainComposite/@pathLabel
    sname
    pathLabel
    sBORDER
    false
    stype
    HORIZONTAL
    sshadow
    SHADOW_OUT
    salignment
    LEFT
    stext
    label:xworker.swt.ide.worldexplorer.swt.i18n.I18nResource/@newThingDialog/@path
    scapture
    false
    senabled
    true
    sredraw
    true
    svisible
    true
    slabel
    pathLabel
    sdescriptors
    xworker.swt.Widgets/@Label
    sid
    pathLabel
    @/@mainComposite/@pathText
    sname
    pathText
    sstyle
    SINGLE
    sH_SCROLL
    false
    sV_SCROLL
    false
    sWRAP
    false
    sREAD_ONLY
    false
    sPASSWORD
    false
    sSEARCH
    false
    sCANCEL
    false
    sBORDER
    true
    salign
    LEFT
    scapture
    false
    senabled
    false
    sredraw
    true
    svisible
    true
    slabel
    pathText
    sdescriptors
    xworker.swt.Widgets/@Text
    sid
    pathText
      @/@mainComposite/@pathText/@descriptorTextGridData
      sname
      descriptorTextGridData
      sstyle
      FILL_HORIZONTAL
      shorizontalIndent
      0
      swidth
      300
      sheight
      -1
      shorizontalAlignment
      BEGINNING
      sverticalAlignment
      CENTER
      shorizontalSpan
      1
      sverticalSpan
      1
      sgrabExcessHorizontalSpace
      false
      sgrabExcessVerticalSpace
      false
      slabel
      descriptorTextGridData
      sdescriptors
      xworker.swt.Commons/@GridData
      sid
      descriptorTextGridData
    @/@mainComposite/@pathSelectButton
    sname
    pathSelectButton
    stext
    *
    stype
    SWT.PUSH
    sflat
    false
    sborder
    false
    sselected
    false
    scapture
    false
    senabled
    false
    sredraw
    true
    svisible
    true
    slabel
    pathSelectButton
    sdescriptors
    xworker.swt.Widgets/@Button
    sid
    pathSelectButton
      @/@mainComposite/@pathSelectButton/@listeners
      sname
      listeners
      slabel
      listeners
      sdescriptors
      xworker.swt.events.Listeners/@listeners
      sid
      listeners
        @/@mainComposite/@pathSelectButton/@listeners/@selectionButtonSelection
        sname
        selectionButtonSelection
        stype
        Selection
        slabel
        selectionButtonSelection
        sdescriptors
        xworker.swt.events.Listeners/@listeners/@Listener
        sid
        selectionButtonSelection
          @/@mainComposite/@pathSelectButton/@listeners/@selectionButtonSelection/@GroovyAction
          sname
          GroovyAction
          slabel
          GroovyAction
          sisSynchronized
          false
          sthrowException
          false
          suseOtherAction
          false
          svarScope
          Global
          sdisableGlobalContext
          false
          Scode
#$@text#$@
import org.xmeta.ActionContext;

import xworker.swt.util.SwtDialog;

def dialogObject = world.getThing("xworker.swt.ide.worldexplorer.swt.tools.CategoryIndexSelector");
//def treeItem = event.widget.getParent().getData();

ActionContext context = new ActionContext();
//context.put("treeItem", treeItem);
context.put("parent", shell);
context.put("selectType", "category");
//context.put("text", pathText);

def newShell = dialogObject.doAction("create", context);
SwtDialog dialog = new SwtDialog(shell, newShell, context);

def result = dialog.open();
if(result != null){
    actionContext.getScope(0).put("index", result);
    pathText.setText(result.getPath());
}
#$@text#$@
          sinterpretationType
          Action
          screateLocalVarScope
          false
          ssaveReturn
          false
          sdebugLog
          false
          sdescriptors
          xworker.lang.actions.Actions/@GroovyAction
          sid
          GroovyAction
    @/@mainComposite/@typeLabel
    sname
    typeLabel
    sBORDER
    false
    stype
    HORIZONTAL
    sshadow
    SHADOW_OUT
    salignment
    LEFT
    stext
    CodecType
    scapture
    false
    senabled
    true
    sredraw
    true
    svisible
    true
    slabel
    typeLabel
    sdescriptors
    xworker.swt.Widgets/@Label
    sid
    typeLabel
    @/@mainComposite/@codecTypeCombo
    sname
    codecTypeCombo
    stype
    DROP_DOWN
    sREAD_ONLY
    false
    scapture
    false
    senabled
    true
    sredraw
    true
    svisible
    true
    slabel
    codecTypeCombo
    sdescriptors
    xworker.swt.Widgets/@Combo
    sid
    codecTypeCombo
      @/@mainComposite/@codecTypeCombo/@codecTypeComboGridData
      sname
      codecTypeComboGridData
      shorizontalIndent
      0
      swidth
      -1
      sheight
      -1
      shorizontalAlignment
      BEGINNING
      sverticalAlignment
      CENTER
      shorizontalSpan
      2
      sverticalSpan
      1
      sgrabExcessHorizontalSpace
      false
      sgrabExcessVerticalSpace
      false
      slabel
      codecTypeComboGridData
      sdescriptors
      xworker.swt.layout.LayoutDatas/@GridData
      sid
      codecTypeComboGridData
    @/@mainComposite/@historyComposite
    sname
    historyThingsComposite
    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
    historyThingsComposite
    scapture
    false
    senabled
    true
    sredraw
    true
    svisible
    true
    sdescriptors
    xworker.swt.Widgets/@Composite
    sid
    historyComposite
      @/@mainComposite/@historyComposite/@historyCompositeGridData
      sname
      historyCompositeGridData
      sstyle
      FILL_BOTH
      shorizontalIndent
      0
      swidth
      -1
      sheight
      -1
      shorizontalAlignment
      BEGINNING
      sverticalAlignment
      CENTER
      shorizontalSpan
      3
      sverticalSpan
      1
      sgrabExcessHorizontalSpace
      false
      sgrabExcessVerticalSpace
      false
      slabel
      historyCompositeGridData
      sdescriptors
      xworker.swt.Commons/@GridData
      sid
      historyCompositeGridData
      @/@mainComposite/@historyComposite/@thingsCompostie
      sname
      thingsCompostie
      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
      scapture
      false
      senabled
      true
      sredraw
      true
      svisible
      true
      sdescriptors
      xworker.swt.Widgets/@Composite
      sid
      thingsCompostie
        @/@mainComposite/@historyComposite/@thingsCompostie/@thingsCompositeGridLayout
        sname
        thingsCompositeGridLayout
        snumColumns
        1
        smakeColumnsEqualWidth
        false
        smarginWidth
        0
        smarginHeight
        5
        smarginLeft
        0
        smarginTop
        0
        smarginRight
        0
        smarginBottom
        0
        shorizontalSpacing
        5
        sverticalSpacing
        5
        slabel
        thingsCompositeGridLayout
        sdescriptors
        xworker.swt.Layouts/@GridLayout
        sid
        thingsCompositeGridLayout
        @/@mainComposite/@historyComposite/@thingsCompostie/@historyLabel
        sname
        historyLabel
        sBORDER
        false
        stype
        HORIZONTAL
        sshadow
        SHADOW_OUT
        salignment
        LEFT
        stext
        label:xworker.swt.ide.worldexplorer.swt.i18n.I18nResource/@newThingDialog/@historyLabel
        scapture
        false
        senabled
        true
        sredraw
        true
        svisible
        true
        slabel
        historyLabel
        sdescriptors
        xworker.swt.Widgets/@Label
        sid
        historyLabel
          @/@mainComposite/@historyComposite/@thingsCompostie/@historyLabel/@historyLabelGridData
          sname
          historyLabelGridData
          sstyle
          FILL_HORIZONTAL
          shorizontalIndent
          0
          swidth
          -1
          sheight
          -1
          shorizontalAlignment
          BEGINNING
          sverticalAlignment
          CENTER
          shorizontalSpan
          1
          sverticalSpan
          1
          sgrabExcessHorizontalSpace
          false
          sgrabExcessVerticalSpace
          false
          slabel
          historyLabelGridData
          sdescriptors
          xworker.swt.Commons/@GridData
          sid
          historyLabelGridData
        @/@mainComposite/@historyComposite/@thingsCompostie/@historySashForm
        sname
        historySashForm
        sstyle
        HORIZONTAL
        sSMOOTH
        false
        sweights
        40,60
        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
        historySashForm
        scapture
        false
        senabled
        true
        sredraw
        true
        svisible
        true
        sdescriptors
        xworker.swt.Widgets/@SashForm
        sid
        historySashForm
          @/@mainComposite/@historyComposite/@thingsCompostie/@historySashForm/@categoryTree
          sname
          categoryTree
          sselectStyle
          SINGLE
          sV_SCROLL
          true
          sH_SCROLL
          true
          sCHECK
          false
          sFULL_SELECTION
          false
          sHIDE_SELECTION
          true
          sBORDER
          true
          slineVisible
          false
          smultipleColumns
          false
          sheaderVisible
          false
          ssortIndicator
          true
          smoveableColumns
          true
          sheadImages
          false
          ssubImages
          false
          scheckSelection
          false
          slabel
          categoryTree
          sdescriptors
          xworker.swt.Widgets/@Tree
          sid
          categoryTree
            @/@mainComposite/@historyComposite/@thingsCompostie/@historySashForm/@categoryTree/@listeners
            sname
            listeners
            slabel
            listeners
            sdescriptors
            xworker.swt.events.Listeners/@listeners
            sid
            listeners
              @/@mainComposite/@historyComposite/@thingsCompostie/@historySashForm/@categoryTree/@listeners/@categoryTreeSelection
              sname
              categoryTreeSelection
              stype
              Selection
              slabel
              categoryTreeSelection
              sdescriptors
              xworker.swt.events.Listeners/@listeners/@Listener
              sid
              categoryTreeSelection
                @/@mainComposite/@historyComposite/@thingsCompostie/@historySashForm/@categoryTree/@listeners/@categoryTreeSelection/@GroovyAction
                sname
                GroovyAction
                sisSynchronized
                false
                sthrowException
                true
                suseOtherAction
                false
                svarScope
                Global
                sdisableGlobalContext
                false
                Scode
#$@text#$@
def item = categoryTree.getSelection()[0];

if(item.getData() == null){
    //历史记录
    actions.doAction("initHistory", actionContext);
}else{
    //历史记录
    actions.doAction("initCategoryThing", actionContext);
}
#$@text#$@
                sdescriptors
                xworker.lang.actions.Actions/@GroovyAction
                sid
                GroovyAction
          @/@mainComposite/@historyComposite/@thingsCompostie/@historySashForm/@descriptorSashForm
          sname
          descriptorSashForm
          sstyle
          VERTICAL
          sSMOOTH
          false
          sweights
          55,45
          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
          scapture
          false
          senabled
          true
          sredraw
          true
          svisible
          true
          sdescriptors
          xworker.swt.Widgets/@SashForm
          sid
          descriptorSashForm
            @/@mainComposite/@historyComposite/@thingsCompostie/@historySashForm/@descriptorSashForm/@historyTable
            sname
            historyTable
            sselectStyle
            SINGLE
            sV_SCROLL
            true
            sH_SCROLL
            true
            sCHECK
            false
            sFULL_SELECTION
            true
            sHIDE_SELECTION
            false
            sBORDER
            true
            slineVisible
            true
            smultipleColumns
            true
            sheaderVisible
            true
            ssortIndicator
            true
            smoveableColumns
            true
            sheadImages
            false
            ssubImages
            false
            sVIRTUAL
            false
            scolumnNames
            ["name", "lastVisit", "visitCount"] as String[]
            slabel
            historyTable
            sdescriptors
            xworker.swt.Widgets/@DataTable
            sid
            historyTable
              @/@mainComposite/@historyComposite/@thingsCompostie/@historySashForm/@descriptorSashForm/@historyTable/@nameItem
              sname
              nameItem
              stext
              res:res.w_exp:name:名称
              swidth
              400
              slabel
              nameItem
              sdescriptors
              xworker.swt.xworker.DataTable/@TableColumn
              sid
              nameItem
                @/@mainComposite/@historyComposite/@thingsCompostie/@historySashForm/@descriptorSashForm/@historyTable/@nameItem/@listeners
                sname
                listeners
                slabel
                listeners
                sdescriptors
                xworker.swt.events.Listeners/@listeners
                sid
                listeners
                  @/@mainComposite/@historyComposite/@thingsCompostie/@historySashForm/@descriptorSashForm/@historyTable/@nameItem/@listeners/@nameItemSelection
                  sname
                  nameItemSelection
                  stype
                  Selection
                  slabel
                  nameItemSelection
                  sdescriptors
                  xworker.swt.events.Listeners/@listeners/@Listener
                  sid
                  nameItemSelection
                    @/@mainComposite/@historyComposite/@thingsCompostie/@historySashForm/@descriptorSashForm/@historyTable/@nameItem/@listeners/@nameItemSelection/@GroovyAction
                    sname
                    GroovyAction
                    slabel
                    GroovyAction
                    sisSynchronized
                    false
                    sthrowException
                    false
                    suseOtherAction
                    false
                    svarScope
                    Global
                    sdisableGlobalContext
                    false
                    Scode
#$@text#$@
import org.eclipse.swt.SWT;

def sortColumn = historyTable.getSortColumn();
def currentColumn = event.widget;
int dir = historyTable.getSortDirection();
if (sortColumn == currentColumn) {
	dir = dir == SWT.UP ? SWT.DOWN : SWT.UP;
} else {
	historyTable.setSortColumn(currentColumn);
	switch(currentColumn){
	    case nameItem:
	    case lastVisitItem:
	    case visitCountItem:
	        dir = SWT.DOWN;
	        break;
	    default:
	        dir = SWT.UP;
	        break;
	}
}

historyTable.setSortDirection(dir);
def alist = historyTable.getData();
if(currentColumn == nameItem){
    if(dir == SWT.DOWN){
        alist = alist.sort{l,r -> return r.name <=> l.name};
    }else{
        alist = alist.sort{l,r -> return l.name <=> r.name};
    }
}
/*
if(currentColumn == lastVisitItem){
    if(dir == SWT.DOWN){
        alist = alist.sort{l,r -> return r.lastVisit <=> l.lastVisit};
    }else{
        alist = alist.sort{l,r -> return l.lastVisit <=> r.lastVisit};
    }
}
if(currentColumn == visitCountItem){
    if(dir == SWT.DOWN){
        alist = alist.sort{l,r -> return r.visitCount <=> l.visitCount};
    }else{
        alist = alist.sort{l,r -> return l.visitCount <=> r.visitCount};
    }
}
*/
historyTable.removeAll();
for(m in alist){
    historyTable.updateRow(null, -1, m);
}
#$@text#$@
                    sdescriptors
                    xworker.lang.actions.Actions/@GroovyAction
                    sid
                    GroovyAction
              @/@mainComposite/@historyComposite/@thingsCompostie/@historySashForm/@descriptorSashForm/@historyTable/@listeners
              sname
              listeners
              slabel
              listeners
              sdescriptors
              xworker.swt.events.Listeners/@listeners
              sid
              listeners
                @/@mainComposite/@historyComposite/@thingsCompostie/@historySashForm/@descriptorSashForm/@historyTable/@listeners/@historyTableSelection
                sname
                historyTableSelection
                stype
                Selection
                slabel
                historyTableSelection
                sdescriptors
                xworker.swt.events.Listeners/@listeners/@Listener
                sid
                historyTableSelection
                  @/@mainComposite/@historyComposite/@thingsCompostie/@historySashForm/@descriptorSashForm/@historyTable/@listeners/@historyTableSelection/@GroovyAction
                  sname
                  GroovyAction
                  slabel
                  GroovyAction
                  sisSynchronized
                  false
                  sthrowException
                  false
                  suseOtherAction
                  false
                  svarScope
                  Global
                  sdisableGlobalContext
                  false
                  Scode
#$@text#$@
def itemData = historyTable.getSelection()[0].getData();

def path = itemData.path;
def docPath = path;
def pathObj = world.getThing(path);

if(itemData.thingType == "template" && itemData.thingPath != null){
    okButton.setText(world.getThing("xworker.swt.ide.worldexplorer.swt.i18n.I18nResource/@newThingDialog/@useTemplateButton").metadata.label);
    okButton.setData("action", "useTemplate");    
    docPath = itemData.thingPath;
}else{
    //默认创建事物
    okButton.setText(world.getThing("xworker.swt.ide.worldexplorer.swt.i18n.I18nResource/@buttons/@okButton").metadata.label);
    okButton.setData("action", "createThing");
    cancelButton.setText(world.getThing("xworker.swt.ide.worldexplorer.swt.i18n.I18nResource/@buttons/@cancelButton").metadata.label);
    cancelButton.setData("action", "dispose");
}

if(path != null){
    descriptorText.setText(path);
    //def cfg = world.getThing("xworker.ide.config.globalConfig/@html");
    //String html = cfg.getString("head") + pathObj.getString("description") + cfg.getString("bottom"); 
    
    def globalConfig = world.getThing("_local.xworker.config.GlobalConfig");
    def webUrl = globalConfig.getString("webUrl");
    historyBorwser.setUrl(webUrl + "do?sc=xworker.ide.worldexplorer.swt.http.ThingDoc/@desc&thing=" + docPath);
    /*String html = pathObj.getString("description");
    if(html == null){
        html = "";
    }
    historyBorwser.setText(html);*/
}else{
    descriptorText.setText("");
    historyBorwser.setText("");
}
#$@text#$@
                  sdescriptors
                  xworker.lang.actions.Actions/@GroovyAction
                  sid
                  GroovyAction
            @/@mainComposite/@historyComposite/@thingsCompostie/@historySashForm/@descriptorSashForm/@browserComposite
            sname
            browserComposite
            sBORDER
            true
            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
            scapture
            false
            senabled
            true
            sredraw
            true
            svisible
            true
            sdescriptors
            xworker.swt.Widgets/@Composite
            sid
            browserComposite
              @/@mainComposite/@historyComposite/@thingsCompostie/@historySashForm/@descriptorSashForm/@browserComposite/@historyBorwser
              sname
              historyBorwser
              sMOZILLA
              false
              slabel
              historyBorwser
              sdescriptors
              xworker.swt.Widgets/@Browser
              sid
              historyBorwser
                @/@mainComposite/@historyComposite/@thingsCompostie/@historySashForm/@descriptorSashForm/@browserComposite/@historyBorwser/@historyBrowserUtil
                sname
                historyBrowserUtil
                sdescriptors
                xworker.swt.browser.Browser/@UtilBrowser
                sid
                historyBrowserUtil
              @/@mainComposite/@historyComposite/@thingsCompostie/@historySashForm/@descriptorSashForm/@browserComposite/@browserCompositeFillLayout
              sname
              browserCompositeFillLayout
              stype
              SWT.HORIZONTAL
              slabel
              browserCompositeFillLayout
              sdescriptors
              xworker.swt.Layouts/@FillLayout
              sid
              browserCompositeFillLayout
          @/@mainComposite/@historyComposite/@thingsCompostie/@historySashForm/@historySashFormgridData
          sname
          historySashFormgridData
          sstyle
          FILL_BOTH
          shorizontalIndent
          0
          swidth
          -1
          sheight
          -1
          shorizontalAlignment
          BEGINNING
          sverticalAlignment
          CENTER
          shorizontalSpan
          1
          sverticalSpan
          1
          sgrabExcessHorizontalSpace
          false
          sgrabExcessVerticalSpace
          false
          slabel
          historySashFormgridData
          sdescriptors
          xworker.swt.layout.LayoutDatas/@GridData
          sid
          historySashFormgridData
      @/@mainComposite/@historyComposite/@templateComposite
      sname
      templateComposite
      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
      scapture
      false
      senabled
      true
      sredraw
      true
      svisible
      true
      sdescriptors
      xworker.swt.Widgets/@Composite
      sid
      templateComposite
        @/@mainComposite/@historyComposite/@templateComposite/@thingsCompositeGridLayout
        sname
        thingsCompositeGridLayout
        snumColumns
        1
        smakeColumnsEqualWidth
        false
        smarginWidth
        0
        smarginHeight
        5
        smarginLeft
        0
        smarginTop
        0
        smarginRight
        0
        smarginBottom
        0
        shorizontalSpacing
        5
        sverticalSpacing
        5
        slabel
        thingsCompositeGridLayout
        sdescriptors
        xworker.swt.Layouts/@GridLayout
        sid
        thingsCompositeGridLayout
        @/@mainComposite/@historyComposite/@templateComposite/@historyLabel
        sname
        historyLabel
        sBORDER
        false
        stype
        HORIZONTAL
        sshadow
        SHADOW_OUT
        salignment
        LEFT
        stext
        编辑模板数据：
        scapture
        false
        senabled
        true
        sredraw
        true
        svisible
        true
        slabel
        historyLabel
        sdescriptors
        xworker.swt.Widgets/@Label
        sid
        historyLabel
          @/@mainComposite/@historyComposite/@templateComposite/@historyLabel/@historyLabelGridData
          sname
          historyLabelGridData
          sstyle
          FILL_HORIZONTAL
          shorizontalIndent
          0
          swidth
          -1
          sheight
          -1
          shorizontalAlignment
          BEGINNING
          sverticalAlignment
          CENTER
          shorizontalSpan
          1
          sverticalSpan
          1
          sgrabExcessHorizontalSpace
          false
          sgrabExcessVerticalSpace
          false
          slabel
          historyLabelGridData
          sdescriptors
          xworker.swt.Commons/@GridData
          sid
          historyLabelGridData
        @/@mainComposite/@historyComposite/@templateComposite/@templateComp
        sname
        templateComp
        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
        scapture
        false
        senabled
        true
        sredraw
        true
        svisible
        true
        sdescriptors
        xworker.swt.Widgets/@Composite
        sid
        templateComp
          @/@mainComposite/@historyComposite/@templateComposite/@templateComp/@tempalteCompGridData
          sname
          tempalteCompGridData
          sstyle
          FILL_BOTH
          shorizontalIndent
          0
          swidth
          -1
          sheight
          -1
          shorizontalAlignment
          BEGINNING
          sverticalAlignment
          CENTER
          shorizontalSpan
          1
          sverticalSpan
          1
          sgrabExcessHorizontalSpace
          false
          sgrabExcessVerticalSpace
          false
          slabel
          tempalteCompGridData
          sdescriptors
          xworker.swt.layout.LayoutDatas/@GridData
          sid
          tempalteCompGridData
      @/@mainComposite/@historyComposite/@historyCompositeStackLayotu
      sname
      historyCompositeStackLayotu
      stopControl
      templateComposite
      slabel
      historyCompositeStackLayotu
      sdescriptors
      xworker.swt.Layouts/@StackLayout
      sid
      historyCompositeStackLayotu
    @/@mainComposite/@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
    scapture
    false
    senabled
    true
    sredraw
    true
    svisible
    true
    sdescriptors
    xworker.swt.Widgets/@Composite
    sid
    buttonCell
      @/@mainComposite/@buttonCell/@buttonCellGridData
      sname
      buttonCellGridData
      sstyle
      FILL_HORIZONTAL
      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
      @/@mainComposite/@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
      @/@mainComposite/@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
        @/@mainComposite/@buttonCell/@okButton/@RowData
        sname
        RowData
        sexclude
        false
        swidth
        120
        sheight
        -1
        slabel
        RowData
        sdescriptors
        xworker.swt.layout.LayoutDatas/@RowData
        sid
        RowData
      @/@mainComposite/@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
        @/@mainComposite/@buttonCell/@cancelButton/@RowData
        sname
        RowData
        sexclude
        false
        swidth
        120
        sheight
        -1
        slabel
        RowData
        sdescriptors
        xworker.swt.layout.LayoutDatas/@RowData
        sid
        RowData
    @/@mainComposite/@Models
    sname
    Models
    slabel
    Models
    sdescriptors
    xworker.swt.Widgets/@Models
    sid
    Models
      @/@mainComposite/@Models/@model
      sname
      model
      sdataType
      Map
      svalidate
      true
      sfocus
      false
      sfocusColor
      "#E8FAFF"
      LvalidateOnBlur
      false
      LallowDecimals
      false
      LallowNegative
      false
      slabel
      model
      sdescriptors
      xworker.swt.model.Models/@Model
      sid
      model
        @/@mainComposite/@Models/@model/@name
        sname
        name
        sswtControl
        dataObjectNameText
        spropertyName
        name
        svalidate
        true
        sfocus
        false
        sfocusColor
        "#E8FAFF"
        LvalidateOnBlur
        false
        LallowDecimals
        false
        LallowNegative
        false
        slabel
        name
        sdescriptors
        xworker.swt.model.Model/@Model
        sid
        name
        @/@mainComposite/@Models/@model/@descriptors
        sname
        descriptors
        sswtControl
        descriptorText
        spropertyName
        descriptors
        svalidate
        true
        sfocus
        false
        sfocusColor
        "#E8FAFF"
        LvalidateOnBlur
        false
        LallowDecimals
        false
        LallowNegative
        false
        slabel
        descriptors
        sdescriptors
        xworker.swt.model.Model/@Model
        sid
        descriptors
        @/@mainComposite/@Models/@model/@path
        sname
        path
        sswtControl
        pathText
        svalidate
        true
        sfocus
        false
        sfocusColor
        "#E8FAFF"
        LvalidateOnBlur
        false
        LallowDecimals
        false
        LallowNegative
        false
        slabel
        path
        sdescriptors
        xworker.swt.model.Model/@Model
        sid
        path
        @/@mainComposite/@Models/@model/@codecType
        sname
        codecType
        sswtControl
        codecTypeCombo
        svalidate
        true
        sfocus
        false
        sfocusColor
        "#E8FAFF"
        svalidateAllowBlank
        true
        LvalidateOnBlur
        true
        LallowDecimals
        true
        LallowNegative
        true
        slabel
        codecType
        sdescriptors
        xworker.swt.model.Model/@Model
        sid
        codecType
    @/@mainComposite/@actions
    sname
    actions
    slabel
    actions
    sdescriptors
    xworker.swt.Widgets/@actions
    sid
    actions
      @/@mainComposite/@actions/@initHistory
      sname
      initHistory
      sisSynchronized
      false
      sthrowException
      true
      suseOtherAction
      false
      svarScope
      Global
      sdisableGlobalContext
      false
      Scode
#$@text#$@
import org.xmeta.Thing;

historyTable.removeAll();

def memory = world.getThing("_local.xworker.worldExplorer.CreateThingMemory");
if(memory == null){
    memory = new Thing("xworker.ide.worldexplorer.swt.memory.CreateThingMemory/@struct");
    memory.saveAs("_local", "_local.xworker.worldExplorer.CreateThingMemory");

    memory = world.getThing("_local.xworker.worldExplorer.CreateThingMemory");
}
def ms = memory.childs;

def alist = [];
for(m in ms){
    alist.add(m);
}

alist = alist.sort{ l,r -> return r.lastVisit <=> l.lastVisit};
historyTable.setData(alist);
for(m in alist){    
    historyTable.updateRow(null, -1, m);
}
#$@text#$@
      sinterpretationType
      Action
      screateLocalVarScope
      false
      ssaveReturn
      false
      sdescriptors
      xworker.lang.actions.Actions/@GroovyAction
      sid
      initHistory
      @/@mainComposite/@actions/@initCategoryThing
      sname
      initCategoryThing
      sisSynchronized
      false
      sthrowException
      true
      suseOtherAction
      false
      svarScope
      Global
      sdisableGlobalContext
      false
      Scode
#$@text#$@
historyTable.removeAll();

def item = categoryTree.getSelection()[0];

def globalConfig = world.getThing("_local.xworker.config.GlobalConfig");
def webUrl = globalConfig.getString("webUrl");
historyBorwser.setUrl(webUrl + "do?sc=xworker.ide.worldexplorer.swt.http.ThingDoc/@desc&thing=" + item.getData().metadata.path);
    
def alist = [];
for(child in item.getData().getAllChilds()){
    if(child.thingName == "Thing"){
        def t = [:];
        t.name = child.metadata.label;
        t.path = child.getString("descriptor");
        t.lastVisit = "";
        t.visitCount = "";
        t.thingType = child.thingType;
        t.thingPath = child.thingPath;
        alist.add(t);
    }
}

historyTable.setData(alist);
for(m in alist){    
    historyTable.updateRow(null, -1, m);
}
#$@text#$@
      sdescriptors
      xworker.lang.actions.Actions/@GroovyAction
      sid
      initCategoryThing
      @/@mainComposite/@actions/@userTemplate
      sname
      useTemplate
      sisSynchronized
      false
      sthrowException
      true
      suseOtherAction
      false
      svarScope
      Global
      sdisableGlobalContext
      false
      Scode
#$@text#$@
import org.xmeta.Thing;
import org.eclipse.swt.widgets.Control;

//编辑模板数据
def itemData = historyTable.getSelection()[0].getData();
def templateThing = world.getThing(itemData.thingPath);
def descriptor = templateThing.get("InputThing@0");
templateThingData = new Thing(descriptor.metadata.path);
editorActions.doAction("setThing", actionContext, ["thing":templateThingData]);

okButton.setText("确定");
okButton.setData("action", "applyTemplate");
cancelButton.setText("取消模板");
cancelButton.setData("action", "cancelUseTemplate");
    
//显示模板
historyCompositeStackLayotu.topControl =templateComposite;
historyThingsComposite.layout();
#$@text#$@
      sdescriptors
      xworker.lang.actions.Actions/@GroovyAction
      sid
      userTemplate
      @/@mainComposite/@actions/@cancelUseTemplate
      sname
      cancelUseTemplate
      sisSynchronized
      false
      sthrowException
      true
      suseOtherAction
      false
      svarScope
      Global
      sdisableGlobalContext
      false
      Scode
#$@text#$@
//显示模板
historyCompositeStackLayotu.topControl = thingsCompostie;
historyThingsComposite.layout();

okButton.setText("确定");
okButton.setData("action", "createThing");
cancelButton.setText("取消");
cancelButton.setData("action", "dispose");
#$@text#$@
      sdescriptors
      xworker.lang.actions.Actions/@GroovyAction
      sid
      cancelUseTemplate
      @/@mainComposite/@actions/@applyTemplate
      sname
      applyTemplate
      sisSynchronized
      false
      sthrowException
      true
      suseOtherAction
      false
      svarScope
      Global
      sdisableGlobalContext
      false
      Scode
#$@text#$@
import org.xmeta.Thing;
import org.xmeta.Category;
import org.xmeta.ThingManager;
import org.xmeta.Project;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.TreeItem;

import org.xmeta.util.UtilString;

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

def category = world.get(pathText.getText());
if(category != null && (category instanceof Category || category instanceof ThingManager)){
     if(category instanceof ThingManager){
         category = category.getCategory("");
     }
}else{
    MessageBox box = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
    box.setText(UtilString.getString("res:res.w_exp:commonBoxTitle|操作信息", actionContext));
    box.setMessage(UtilString.getString("请选择正确的路径！", actionContext));
    box.open();
    return;
}

def values = model.doAction("getValue", actionContext);
//判断数据对象是否存在
if(category.getThing(values.name) != 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:alertThingExists事物已经已经存在！", actionContext));
    box.open();
    return;
}else{
    //创建新的对象    
    Thing object = new Thing(values.name, values.name, values.descriptors, false);
    object.metadata.setCategory(category);
    object.metadata.initPath();
    category.getThingManager().save(object);
    
    Thing thing = world.getThing(object.metadata.path);
    if(actionContext.get("treeItem") != null){
        //如果是从事物浏览器创建的，会带一个treeItem过来
        treeItem.getData().refresh();
    }
        
    def itemData = historyTable.getSelection()[0].getData();
    def templateThing = world.getThing(itemData.thingPath);
    def data = editorActions.doAction("getThing");
    def proccessedThing = templateThing.doAction("process", actionContext, ["data":data]);
    if(proccessedThing != null){
        thing.paste(proccessedThing);
        thing.save();
    }
    
    //explorerActions.doAction("openPackageViewer", ["index":treeItem.getData(), "refresh":true]);
    //开打事物
    explorerActions.doAction("openThing", ["thing":thing]);
    
    //保存对描述的历史记录
    def descPath = values.descriptors;
    def descObj = world.getThing(descPath);
    if(descObj == null) return;
    
    def memory = world.getThing("_local.xworker.worldExplorer.CreateThingMemory/@memorys");
    def have = false;
    for(dataObj in memory.childs){
        if(dataObj.path == descPath){
            dataObj.name = descObj.metadata.name;
            dataObj.lastVisit = new Date();
            dataObj.visitCount ++;
            dataObj.save();
            have = true;
        }
    }
    
    if(!have){
        def vd = new Thing(descObj.metadata.name, descObj.metadata.name, "_local.xworker.worldExplorer.CreateThingMemory/@struct", false);        
        vd.path = descPath;
        vd.lastVisit = new Date();
        vd.visitCount = 1;
        memory.addChild(vd);
        memory.save();
    }

    shell.dispose();
}
#$@text#$@
      sdescriptors
      xworker.lang.actions.Actions/@GroovyAction
      sid
      applyTemplate
      @/@mainComposite/@actions/@createThing
      sname
      createThing
      sisSynchronized
      false
      sthrowException
      true
      suseOtherAction
      false
      svarScope
      Global
      sdisableGlobalContext
      false
      Scode
#$@text#$@
import org.xmeta.Thing;
import org.xmeta.Category;
import org.xmeta.ThingManager;
import org.xmeta.cache.ThingCache;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.TreeItem;

import org.xmeta.util.UtilString;
import xworker.lang.util.XWorkerUtils;

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

if(actionContext.get("index") == null){
    def box = new MessageBox(okButton.getShell(), SWT.ICON_WARNING | SWT.OK);
    box.setText("创建新事物");
    box.setMessage("请选择保存事物的路径！");
    box.open();
    return;
}
//def index = treeItem.getData();
def category = null;

if(index.type == "thingManager"){
    category = index.getIndexObject().getCategory(null);;
}else{
    category = index.getIndexObject();
}

def values = model.doAction("getValue", actionContext);
//判断数据对象是否存在
if(category.getThing(values.name) != 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:alertThingExists:事物已经已经存在！", actionContext));
    box.open();
    return;
}else if(values.name == null || values.name.trim() == "" || values.name.indexOf(".") != -1 || values.name.indexOf(":") != -1){
    MessageBox box = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
    box.setText(UtilString.getString("res:res.w_exp:commonBoxTitle|操作信息", actionContext));
    box.setMessage(UtilString.getString("请输入正确的事物名！事物名不能为空和包含符号'.'和':'。", actionContext));
    box.open();
    return;
}else{
    //创建新的对象    
    if(values.descriptors == null || values.descriptors == ""){
        values.descriptors = "xworker.lang.MetaDescriptor3";
    }
    Thing object = new Thing(values.name, values.name, values.descriptors, false);
    object.metadata.setCategory(category);
    object.metadata.initPath();
    object.metadata.setCoderType(values.codecType);
    
    //初始化数据
    if(actionContext.get("thingInitValues") != null){
        object.putAll(thingInitValues);
    }
    category.getThingManager().save(object);
    
    //放入缓存
    ThingCache.put(object.metadata.path, object);
            
    if(actionContext.get("treeItem") != null){
        //如果是从事物浏览器创建的，会带一个treeItem过来
        treeItem.getData().refresh();
    }
        
    //explorerActions.doAction("openPackageViewer", ["index":treeItem.getData(), "refresh":true]);
    //开打事物
    Thing thing = object;//world.getThing(object.metadata.path);
    //explorerActions.doAction("openThing", ["thing":thing]);
    XWorkerUtils.ideOpenThing(thing);
    
    //保存对描述的历史记录
    def descPath = values.descriptors;
    def descObj = world.getThing(descPath);
    if(descObj == null) return;
    
    def memory = world.getThing("_local.xworker.worldExplorer.CreateThingMemory");
    if(memory == null){
         memory = new Thing();
         memory.saveAs("_local", "_local.xworker.worldExplorer.CreateThingMemory");
    }
    def have = false;
    for(dataObj in memory.childs){
        if(dataObj.path == descPath){
            dataObj.name = descObj.metadata.name;
            dataObj.lastVisit = new Date();
            dataObj.visitCount ++;
            dataObj.save();
            have = true;
        }
    }
    
    if(!have){
        def vd = new Thing(descObj.metadata.name, descObj.metadata.name, "xworker.ide.worldexplorer.swt.memory.CreateThingMemory/@struct", false);        
        vd.path = descPath;
        vd.lastVisit = new Date();
        vd.visitCount = 1;
        memory.addChild(vd);
        memory.save();
    }

    shell.dispose();
    
    actionContext.getScope(0).put("result", thing);
    return thing;
}
#$@text#$@
      sinterpretationType
      Action
      screateLocalVarScope
      false
      ssaveReturn
      false
      sdebugLog
      false
      sdescriptors
      xworker.lang.actions.Actions/@GroovyAction
      sid
      createThing
      @/@mainComposite/@actions/@dispose
      sname
      dispose
      sisSynchronized
      false
      sthrowException
      true
      suseOtherAction
      false
      svarScope
      Global
      sdisableGlobalContext
      false
      scode
      shell.dispose();
      sdescriptors
      xworker.lang.actions.Actions/@GroovyAction
      sid
      dispose
    @/@mainComposite/@InitCode
    sname
    InitCode
    slabel
    InitCode
    sisSynchronized
    false
    sthrowException
    true
    suseOtherAction
    false
    svarScope
    Global
    sdisableGlobalContext
    false
    Scode
#$@text#$@
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.TreeItem;

//目录
if(actionContext.get("categoryPath") != null){
    pathText.setText(categoryPath);
}

//历史记录
actions.doAction("initHistory", actionContext);

//目录树
def item = new TreeItem(categoryTree, SWT.NONE);
item.setText(world.getThing("xworker.swt.ide.worldexplorer.swt.i18n.I18nResource/@newThingDialog/@historyRecord").metadata.label);
item.setImage(folderImage);
       
def coreThings = world.getThing("xworker.ide.config.Things");
initThings(categoryTree, coreThings);

for(thingManager in world.getThingManagers()){
    def rootCategory = thingManager.getCategory(null);
    for(lv1Category in rootCategory.getCategorys()){
        for(lv2Category in lv1Category.getCategorys()){
            String project = lv1Category.getSimpleName() + "." + lv2Category.getSimpleName();
            def things = world.getThing(project + ".config.Things");
            if(things != null){
                 if(project == "xworker.ide"){                    
                 }else{
                     initThings(categoryTree, things);
                 }
            }
        }
    }
}

for(thingCoder in world.getThingCoders()){
    codecTypeCombo.add(thingCoder.getType());
}
codecTypeCombo.select(0);
/*
for(project in world.getProjects()){
    for(thingManager in project.getThingManagers()){
        def things = world.getThing(project.getName() + ":" + thingManager.getName() + ":config.Things");
        if(things != null){
             if(project.name == "xworker" && thingManager.name == "core"){                    
             }else{
                 initThings(categoryTree, things);
             }
        }
    }
}
*/

//为解决模板bug，事物定义是先显示模板，正常启动后切换到事物选择
historyCompositeStackLayotu.topControl = thingsCompostie;
historyThingsComposite.layout();

def initThings(treeItem, things){
    for(child in things.getAllChilds()){
        if(child.thingName == "Category"){
            def item = new TreeItem(treeItem, SWT.NONE);
            item.setText(child.metadata.label);
            item.setData(child);
            item.setImage(folderImage);
            
            initThings(item, child);
        }
    }
    
    if(treeItem instanceof TreeItem){
        //treeItem.setExpanded(true);
    }
}
#$@text#$@
    sinterpretationType
    Action
    screateLocalVarScope
    false
    ssaveReturn
    false
    sdescriptors
    xworker.swt.Widgets/@Code
    sid
    InitCode
