^1640696289456
@
sname
NoteAndTemplateDialog
slabel
NoteAndTemplateDialog
sdescriptors
xworker.swt.widgets.Display
sid
NoteAndTemplateDialog
  @/@shell
  sname
  shell
  stext
  res:res.w_exp:assits辅助
  sNO_TRIM
  false
  sCLOSE
  true
  sTITLE
  true
  sMIN
  true
  sMAX
  true
  sBORDER
  false
  sRESIZE
  true
  sON_TOP
  false
  sTOOL
  false
  sNO_FOCUS
  false
  swidth
  800
  sheight
  600
  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
  scapture
  false
  senabled
  true
  sredraw
  true
  svisible
  true
  sdescriptors
  xworker.swt.widgets.Display/@Shell
  sid
  shell
    @/@shell/@shellGridLayout
    sname
    shellGridLayout
    smakeColumnsEqualWidth
    false
    smarginWidth
    5
    smarginHeight
    5
    smarginLeft
    0
    smarginTop
    0
    smarginRight
    0
    smarginBottom
    0
    shorizontalSpacing
    5
    sverticalSpacing
    5
    slabel
    shellGridLayout
    sdescriptors
    xworker.swt.Layouts/@GridLayout
    sid
    shellGridLayout
    @/@shell/@mainSash
    sname
    mainSash
    sstyle
    HORIZONTAL
    sSMOOTH
    false
    sweights
    30,70
    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
    mainSash
      @/@shell/@mainSash/@menuComposite
      sname
      menuComposite
      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
      menuComposite
        @/@shell/@mainSash/@menuComposite/@menuCompositeGridLayout
        sname
        menuCompositeGridLayout
        smakeColumnsEqualWidth
        false
        smarginWidth
        0
        smarginHeight
        0
        smarginLeft
        0
        smarginTop
        0
        smarginRight
        0
        smarginBottom
        0
        shorizontalSpacing
        5
        sverticalSpacing
        5
        slabel
        menuCompositeGridLayout
        sdescriptors
        xworker.swt.Layouts/@GridLayout
        sid
        menuCompositeGridLayout
        @/@shell/@mainSash/@menuComposite/@assitLabel
        sname
        assitLabel
        sBORDER
        false
        stype
        HORIZONTAL
        sshadow
        SHADOW_OUT
        salignment
        LEFT
        stext
        res:res.w_exp:assitLabel辅助：
        scapture
        false
        senabled
        true
        sredraw
        true
        svisible
        true
        slabel
        assitLabel
        sdescriptors
        xworker.swt.Widgets/@Label
        sid
        assitLabel
        @/@shell/@mainSash/@menuComposite/@menuTree
        sname
        menuTree
        sselectStyle
        SINGLE
        sV_SCROLL
        true
        sH_SCROLL
        true
        sCHECK
        false
        sFULL_SELECTION
        false
        sHIDE_SELECTION
        false
        sBORDER
        true
        slineVisible
        false
        smultipleColumns
        false
        sheaderVisible
        false
        ssortIndicator
        false
        smoveableColumns
        false
        sheadImages
        false
        ssubImages
        false
        slabel
        menuTree
        sdescriptors
        xworker.swt.Widgets/@Tree
        sid
        menuTree
          @/@shell/@mainSash/@menuComposite/@menuTree/@listeners
          sname
          listeners
          slabel
          listeners
          sdescriptors
          xworker.swt.events.Listeners/@listeners
          sid
          listeners
            @/@shell/@mainSash/@menuComposite/@menuTree/@listeners/@menuTreeSelection
            sname
            menuTreeSelection
            stype
            Selection
            slabel
            menuTreeSelection
            sdescriptors
            xworker.swt.events.Listeners/@listeners/@Listener
            sid
            menuTreeSelection
              @/@shell/@mainSash/@menuComposite/@menuTree/@listeners/@menuTreeSelection/@GroovyAction
              sname
              GroovyAction
              sisSynchronized
              false
              sthrowException
              true
              suseOtherAction
              false
              svarScope
              Global
              Scode
#$@text#$@
import org.xmeta.ActionContext;
import org.xmeta.Thing;

//获取当前选中的节点
def item = menuTree.getSelection()[0];

//获得节点中的数据
def data = item.getData();
if(data != null){
    if(data.value instanceof Thing){
        pathLabel.setText(data.value.metadata.path);
        pathLabel.update();
    }else{
        pathLabel.setText("");
        pathLabel.update();
    }
    
    if(data.type == "note"){
        openUrl("do?sc=xworker.web.thingNote.ThingNote/@index&path=" + data.value.metadata.path, false);
    }else if(data.type == "doc"){
        openUrl("do?sc=xworker.ide.worldexplorer.swt.http.ThingDoc/@view&thing=" + data.value.metadata.path, false);
    }else if(data.type == "templateDescription"){
        for(treeItem in listTree.getItems()){
            treeItem.dispose();
        }
        def context = [:];
        for(descriptor in thing.getAllDescriptors()){
            actions.doAction("initListTree", ["descriptor":descriptor, "type":"template", "context":context]);
        }
        
        leditExampleButton.setEnabled(false);
        leditButton.setEnabled(false);
        lopenButton.setEnabled(false);
        mainCompositeStackLayout.topControl = listComposite;
        mainComposite.layout();
    }else if(data.type == "template"){
        for(treeItem in listTree.getItems()){
            treeItem.dispose();
        }
        actions.doAction("initListTree", ["descriptor":data.value, "type":"template", "context":[:]]);
        leditExampleButton.setEnabled(false);
        leditButton.setEnabled(false);
        lopenButton.setEnabled(false);
        mainCompositeStackLayout.topControl = listComposite;
        mainComposite.layout();
    }else if(data.type == "guideDescription"){
        for(treeItem in listTree.getItems()){
            treeItem.dispose();
        }
        def context = [:];
        for(descriptor in thing.getAllDescriptors()){
            actions.doAction("initListTree", ["descriptor":descriptor, "type":"guide", "context":context]);
        }
        mainCompositeStackLayout.topControl = listComposite;
        mainComposite.layout();
    }else if(data.type == "guide"){
        for(treeItem in listTree.getItems()){
            treeItem.dispose();
        }
        actions.doAction("initListTree", ["descriptor":data.value, "type":"guide", "context":[:]]);
        mainCompositeStackLayout.topControl = listComposite;
        mainComposite.layout();
    }else if(data.type == "xworker.exampleAll"){
        for(treeItem in listTree.getItems()){
            treeItem.dispose();
        }
        def context = [:];
        for(descriptor in thing.getAllDescriptors()){
            actions.doAction("initListTree", ["descriptor":descriptor, "type":"xworker.example", "context":context]);
        }
        leditExampleButton.setEnabled(false);
        leditButton.setEnabled(false);
        lopenButton.setEnabled(false);
        mainCompositeStackLayout.topControl = listComposite;
        mainComposite.layout();
    }else if(data.type == "xworker.example"){
        for(treeItem in listTree.getItems()){
            treeItem.dispose();
        }        
        actions.doAction("initListTree", ["descriptor":data.value, "type":"xworker.example", "context":[:]]);
        leditExampleButton.setEnabled(false);
        leditButton.setEnabled(false);
        lopenButton.setEnabled(false);
        mainCompositeStackLayout.topControl = listComposite;
        mainComposite.layout();
    }else if(data.type == "noteDescription"){
        openUrl("do?sc=xworker.web.thingNote.ThingNote/@index", false);
    }else if(data.type == "docDescription"){
        openUrl("do?sc=xworker.ide.worldexplorer.swt.http.ThingDoc/@desc&thing=xworker.ide.worldexplorer.swt.http.ThingDoc/@view", false);
    }else if(data.type == "thingDesc"){
        openUrl("do?sc=xworker.ide.worldexplorer.swt.http.ThingDoc/@desc&thing=" + data.value.metadata.path, false);
    }
}else{
    mainCompositeStackLayout.topControl = blankComposite;
    mainComposite.layout();
}

def openUrl(url, isOuterUrl){
    if(isOuterUrl){
        browser.setUrl(url);
    }else{
        def globalCfg = world.getThing("_local.xworker.config.GlobalConfig");
        browser.setUrl(globalCfg.webUrl + url);
    }
        
    mainCompositeStackLayout.topControl = browser;
    mainComposite.layout();
}
#$@text#$@
              sdescriptors
              xworker.lang.actions.Actions/@GroovyAction
              sid
              GroovyAction
          @/@shell/@mainSash/@menuComposite/@menuTree/@menuTreeGridData
          sname
          menuTreeGridData
          sstyle
          FILL_BOTH
          shorizontalIndent
          0
          swidth
          -1
          sheight
          -1
          shorizontalAlignment
          BEGINNING
          sverticalAlignment
          CENTER
          shorizontalSpan
          1
          sverticalSpan
          1
          sgrabExcessHorizontalSpace
          false
          sgrabExcessVerticalSpace
          false
          slabel
          menuTreeGridData
          sdescriptors
          xworker.swt.Commons/@GridData
          sid
          menuTreeGridData
      @/@shell/@mainSash/@mainPanel
      sname
      mainPanel
      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
      mainPanel
        @/@shell/@mainSash/@mainPanel/@mianPanelGridLayout
        sname
        mianPanelGridLayout
        snumColumns
        2
        smakeColumnsEqualWidth
        false
        smarginWidth
        0
        smarginHeight
        0
        smarginLeft
        0
        smarginTop
        0
        smarginRight
        0
        smarginBottom
        0
        shorizontalSpacing
        5
        sverticalSpacing
        5
        slabel
        mianPanelGridLayout
        sdescriptors
        xworker.swt.Layouts/@GridLayout
        sid
        mianPanelGridLayout
        @/@shell/@mainSash/@mainPanel/@pathInfoLabel
        sname
        pathInfoLabel
        sBORDER
        false
        stype
        HORIZONTAL
        sshadow
        SHADOW_OUT
        salignment
        LEFT
        stext
        res:res.w_exp:pathLabel路径：
        scapture
        false
        senabled
        true
        sredraw
        true
        svisible
        true
        slabel
        pathInfoLabel
        sdescriptors
        xworker.swt.Widgets/@Label
        sid
        pathInfoLabel
        @/@shell/@mainSash/@mainPanel/@pathLabel
        sname
        pathLabel
        sBORDER
        false
        stype
        HORIZONTAL
        sshadow
        SHADOW_OUT
        salignment
        LEFT
        stext
        "dd"
        scapture
        false
        senabled
        true
        sredraw
        true
        svisible
        true
        slabel
        pathLabel
        sdescriptors
        xworker.swt.Widgets/@Label
        sid
        pathLabel
          @/@shell/@mainSash/@mainPanel/@pathLabel/@pathLabelGridData
          sname
          pathLabelGridData
          sstyle
          FILL_HORIZONTAL
          shorizontalIndent
          0
          swidth
          -1
          sheight
          -1
          shorizontalAlignment
          BEGINNING
          sverticalAlignment
          CENTER
          shorizontalSpan
          1
          sverticalSpan
          1
          sgrabExcessHorizontalSpace
          false
          sgrabExcessVerticalSpace
          false
          slabel
          pathLabelGridData
          sdescriptors
          xworker.swt.layout.LayoutDatas/@GridData
          sid
          pathLabelGridData
        @/@shell/@mainSash/@mainPanel/@mainComposite
        sname
        mainComposite
        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
        mainComposite
          @/@shell/@mainSash/@mainPanel/@mainComposite/@mainCompositeGridData
          sname
          mainCompositeGridData
          sstyle
          FILL_BOTH
          shorizontalIndent
          0
          swidth
          -1
          sheight
          -1
          shorizontalAlignment
          BEGINNING
          sverticalAlignment
          CENTER
          shorizontalSpan
          2
          sverticalSpan
          1
          sgrabExcessHorizontalSpace
          false
          sgrabExcessVerticalSpace
          false
          slabel
          mainCompositeGridData
          sdescriptors
          xworker.swt.layout.LayoutDatas/@GridData
          sid
          mainCompositeGridData
          @/@shell/@mainSash/@mainPanel/@mainComposite/@mainCompositeStackLayout
          sname
          mainCompositeStackLayout
          stopControl
          browser
          slabel
          mainCompositeStackLayout
          sdescriptors
          xworker.swt.Layouts/@StackLayout
          sid
          mainCompositeStackLayout
          @/@shell/@mainSash/@mainPanel/@mainComposite/@browser
          sname
          browser
          sMOZILLA
          false
          slabel
          browser
          sdescriptors
          xworker.swt.Widgets/@Browser
          sid
          browser
          @/@shell/@mainSash/@mainPanel/@mainComposite/@blankComposite
          sname
          blankComposite
          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
          blankComposite
          @/@shell/@mainSash/@mainPanel/@mainComposite/@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
            @/@shell/@mainSash/@mainPanel/@mainComposite/@templateComposite/@templateGridLayout
            sname
            templateGridLayout
            smakeColumnsEqualWidth
            false
            smarginWidth
            5
            smarginHeight
            5
            smarginLeft
            0
            smarginTop
            0
            smarginRight
            0
            smarginBottom
            0
            shorizontalSpacing
            5
            sverticalSpacing
            5
            slabel
            templateGridLayout
            sdescriptors
            xworker.swt.Layouts/@GridLayout
            sid
            templateGridLayout
            @/@shell/@mainSash/@mainPanel/@mainComposite/@templateComposite/@templateWorldsComposite
            sname
            templateWordsComposite
            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
            templateWorldsComposite
              @/@shell/@mainSash/@mainPanel/@mainComposite/@templateComposite/@templateWorldsComposite/@templateWordsCompositeFillLayout
              sname
              templateWordsCompositeFillLayout
              stype
              SWT.HORIZONTAL
              slabel
              templateWordsCompositeFillLayout
              sdescriptors
              xworker.swt.Layouts/@FillLayout
              sid
              templateWordsCompositeFillLayout
              @/@shell/@mainSash/@mainPanel/@mainComposite/@templateComposite/@templateWorldsComposite/@templateWordsCompositeGridData
              sname
              templateWordsCompositeGridData
              sstyle
              FILL_BOTH
              shorizontalIndent
              0
              swidth
              -1
              sheight
              -1
              shorizontalAlignment
              BEGINNING
              sverticalAlignment
              CENTER
              shorizontalSpan
              1
              sverticalSpan
              1
              sgrabExcessHorizontalSpace
              false
              sgrabExcessVerticalSpace
              false
              slabel
              templateWordsCompositeGridData
              sdescriptors
              xworker.swt.layout.LayoutDatas/@GridData
              sid
              templateWordsCompositeGridData
            @/@shell/@mainSash/@mainPanel/@mainComposite/@templateComposite/@templateButtonComposite
            sname
            templateButtonComposite
            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
            templateButtonComposite
              @/@shell/@mainSash/@mainPanel/@mainComposite/@templateComposite/@templateButtonComposite/@templateButtonCompositeGridData
              sname
              templateButtonCompositeGridData
              sstyle
              FILL_HORIZONTAL
              shorizontalIndent
              0
              swidth
              -1
              sheight
              -1
              shorizontalAlignment
              END
              sverticalAlignment
              CENTER
              shorizontalSpan
              1
              sverticalSpan
              1
              sgrabExcessHorizontalSpace
              false
              sgrabExcessVerticalSpace
              false
              slabel
              templateButtonCompositeGridData
              sdescriptors
              xworker.swt.layout.LayoutDatas/@GridData
              sid
              templateButtonCompositeGridData
              @/@shell/@mainSash/@mainPanel/@mainComposite/@templateComposite/@templateButtonComposite/@templateButtonCompositeRowLayout
              sname
              templateButtonCompositeRowLayout
              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
              templateButtonCompositeRowLayout
              sdescriptors
              xworker.swt.Layouts/@RowLayout
              sid
              templateButtonCompositeRowLayout
              @/@shell/@mainSash/@mainPanel/@mainComposite/@templateComposite/@templateButtonComposite/@applyTemplateButton
              sname
              applyTemplateButton
              stext
              res:res.w_exp:applyButton应用（&A）
              stype
              SWT.PUSH
              sflat
              false
              sborder
              false
              sselected
              false
              scapture
              false
              senabled
              true
              sredraw
              true
              svisible
              true
              slabel
              applyTemplateButton
              sdescriptors
              xworker.swt.Widgets/@Button
              sid
              applyTemplateButton
                @/@shell/@mainSash/@mainPanel/@mainComposite/@templateComposite/@templateButtonComposite/@applyTemplateButton/@Listeners
                sname
                Listeners
                slabel
                Listeners
                sdescriptors
                xworker.swt.widgets.Widget/@Listeners
                sid
                Listeners
                  @/@shell/@mainSash/@mainPanel/@mainComposite/@templateComposite/@templateButtonComposite/@applyTemplateButton/@Listeners/@applyTemplateButtonSelection
                  sname
                  applyTemplateButtonSelection
                  stype
                  Selection
                  slabel
                  applyTemplateButtonSelection
                  sdescriptors
                  xworker.swt.events.Listeners/@listeners/@Listener
                  sid
                  applyTemplateButtonSelection
                    @/@shell/@mainSash/@mainPanel/@mainComposite/@templateComposite/@templateButtonComposite/@applyTemplateButton/@Listeners/@applyTemplateButtonSelection/@GroovyAction
                    sname
                    GroovyAction
                    sisSynchronized
                    false
                    sthrowException
                    false
                    suseOtherAction
                    false
                    svarScope
                    Global
                    sdisableGlobalContext
                    false
                    Scode
#$@text#$@
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.MessageBox;

def data = [:];
if(actionContext.get("templateModel") != null){
    data = templateModel.doAction("getValue", templateContext);
}

//取模板
def item = menuTree.getSelection()[0];
def templateThing = listTree.getSelection()[0].getData().value;
//log.info(templateThing.metadata.path);
def proccessedThing = templateThing.doAction("process", actionContext, ["data":data]);

if(proccessedThing != null){
    thing.paste(proccessedThing);
    thing.save();
        
    thingContext.actions.doAction("selectThing", ["thing":thing]);

    //刷新编辑概要树
    def action = world.getAction("xworker.swt.ide.worldexplorer.swt.dataExplorerParts.ThingEditor/@outlineTree/@popMenu/@refreshMenuItem/@listeners/@refreshMenuSelection/@GroovyAction");
    action.run(thingContext);
    
    MessageBox box = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION);
    box.setText("操作信息");
    box.setMessage("模板应用成功！");
    box.open();
}else{
    MessageBox box = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION);
    box.setText("操作信息");
    box.setMessage("模板为空，没有粘贴数据！");
    box.open();
}
#$@text#$@
                    sdescriptors
                    xworker.lang.actions.Actions/@GroovyAction
                    sid
                    GroovyAction
              @/@shell/@mainSash/@mainPanel/@mainComposite/@templateComposite/@templateButtonComposite/@cancelTemplateButton
              sname
              cancelTemplateButton
              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
              cancelTemplateButton
              sdescriptors
              xworker.swt.Widgets/@Button
              sid
              cancelTemplateButton
                @/@shell/@mainSash/@mainPanel/@mainComposite/@templateComposite/@templateButtonComposite/@cancelTemplateButton/@Listeners
                sname
                Listeners
                slabel
                Listeners
                sdescriptors
                xworker.swt.widgets.Widget/@Listeners
                sid
                Listeners
                  @/@shell/@mainSash/@mainPanel/@mainComposite/@templateComposite/@templateButtonComposite/@cancelTemplateButton/@Listeners/@cancelTemplateButtonSelection
                  sname
                  cancelTemplateButtonSelection
                  stype
                  Selection
                  slabel
                  cancelTemplateButtonSelection
                  sdescriptors
                  xworker.swt.events.Listeners/@listeners/@Listener
                  sid
                  cancelTemplateButtonSelection
                    @/@shell/@mainSash/@mainPanel/@mainComposite/@templateComposite/@templateButtonComposite/@cancelTemplateButton/@Listeners/@cancelTemplateButtonSelection/@GroovyAction
                    sname
                    GroovyAction
                    sisSynchronized
                    false
                    sthrowException
                    true
                    suseOtherAction
                    false
                    svarScope
                    Global
                    Scode
#$@text#$@
mainCompositeStackLayout.topControl = listComposite;
mainComposite.layout();
#$@text#$@
                    sdescriptors
                    xworker.lang.actions.Actions/@GroovyAction
                    sid
                    GroovyAction
          @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite
          sname
          listComposite
          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
          listComposite
            @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listCompositeGridLayout
            sname
            listCompositeGridLayout
            smakeColumnsEqualWidth
            false
            smarginWidth
            5
            smarginHeight
            5
            smarginLeft
            0
            smarginTop
            0
            smarginRight
            0
            smarginBottom
            0
            shorizontalSpacing
            5
            sverticalSpacing
            5
            slabel
            listCompositeGridLayout
            sdescriptors
            xworker.swt.Layouts/@GridLayout
            sid
            listCompositeGridLayout
            @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listSashFrom
            sname
            listSashFrom
            sstyle
            VERTICAL
            sSMOOTH
            false
            sweights
            50,50
            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
            listSashFrom
              @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listSashFrom/@listSashFormGridData
              sname
              listSashFormGridData
              sstyle
              FILL_BOTH
              shorizontalIndent
              0
              swidth
              -1
              sheight
              -1
              shorizontalAlignment
              BEGINNING
              sverticalAlignment
              CENTER
              shorizontalSpan
              1
              sverticalSpan
              1
              sgrabExcessHorizontalSpace
              false
              sgrabExcessVerticalSpace
              false
              slabel
              listSashFormGridData
              sdescriptors
              xworker.swt.layout.LayoutDatas/@GridData
              sid
              listSashFormGridData
              @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listSashFrom/@listTree
              sname
              listTree
              sselectStyle
              SINGLE
              sV_SCROLL
              true
              sH_SCROLL
              true
              sCHECK
              false
              sFULL_SELECTION
              true
              sHIDE_SELECTION
              true
              sBORDER
              false
              slineVisible
              true
              smultipleColumns
              true
              sheaderVisible
              true
              ssortIndicator
              true
              smoveableColumns
              true
              sheadImages
              false
              ssubImages
              false
              scheckSelection
              false
              slabel
              listTree
              sdescriptors
              xworker.swt.Widgets/@Tree
              sid
              listTree
                @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listSashFrom/@listTree/@labelColumn
                sname
                labelColumn
                stext
                "标签"
                swidth
                200
                slabel
                labelColumn
                sdescriptors
                xworker.swt.widgets.Tree/@TreeColumn
                sid
                labelColumn
                @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listSashFrom/@listTree/@pathColumn
                sname
                pathColumn
                stext
                "路径"
                swidth
                400
                slabel
                pathColumn
                sdescriptors
                xworker.swt.widgets.Tree/@TreeColumn
                sid
                pathColumn
                @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listSashFrom/@listTree/@listeners
                sname
                listeners
                slabel
                listeners
                sdescriptors
                xworker.swt.events.Listeners/@listeners
                sid
                listeners
                  @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listSashFrom/@listTree/@listeners/@listTreeDefaultSelection
                  sname
                  listTreeDefaultSelection
                  stype
                  DefaultSelection
                  slabel
                  listTreeDefaultSelection
                  sdescriptors
                  xworker.swt.events.Listeners/@listeners/@Listener
                  sid
                  listTreeDefaultSelection
                    @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listSashFrom/@listTree/@listeners/@listTreeDefaultSelection/@GroovyAction
                    sname
                    GroovyAction
                    sisSynchronized
                    false
                    sthrowException
                    true
                    suseOtherAction
                    false
                    svarScope
                    Global
                    sdisableGlobalContext
                    false
                    Scode
#$@text#$@
import org.xmeta.ActionContext;
import org.xmeta.Thing;

def data = listTree.getSelection()[0].getData();
if(data.value != null){
    if(data.type == "xworker.example"){
        def globalCfg = world.getThing("_local.xworker.config.GlobalConfig");
        explorerActions.doAction("openUrl", ["url":globalCfg.getString("webUrl") + "do?sc=" + 
                data.value.getString("xworker.exampleThing")]);
    }else if(data.type == "template"){    
        for(child in templateWordsComposite.getChildren()){
            child.dispose();
            templateWordsComposite.removeControl(child);
        }
            
        //设置模板的词汇节点
        def thing = data.value;
        if(thing.getBoolean("isNode")){
            return;
        }
        def worldDescriptor = thing.getThing("InputThing@0");
        if(worldDescriptor != null){
            Thing structForm = new Thing();
            structForm.put("descriptors", "xworker.swt.xworker.ThingDescritporForm");
            structForm.name = "contentForm";
            structForm.descriptorPath = worldDescriptor.metadata.path;
            structForm.H_SCROLL = "true";
            structForm.V_SCROLL = "true";

            ActionContext newContext = new ActionContext();
            newContext.put("explorerActions", explorerActions);
            newContext.put("explorerContext", explorerContext);
            newContext.put("thingContext", actionContext);
            newContext.put("parent", templateWordsComposite);
            newContext.put("utilBrowser", utilBrowser);

            def structFormObj = structForm.doAction("create", newContext);      
            newContext = structFormObj.getData();       
            newContext.contentFormModel.doAction("init", newContext);
            newContext.contentFormModel.doAction("setValue", newContext);
            
            templateWordsComposite.layout();
            
            actionContext.put("templateModel", newContext.contentFormModel);  
            actionContext.put("templateContext", newContext);          
        }else{
            actionContext.put("templateModel", null); 
        }

        mainCompositeStackLayout.topControl = templateComposite;
        mainComposite.layout();
    }
}
#$@text#$@
                    sdescriptors
                    xworker.lang.actions.Actions/@GroovyAction
                    sid
                    GroovyAction
                  @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listSashFrom/@listTree/@listeners/@listTreeSelection
                  sname
                  listTreeSelection
                  stype
                  Selection
                  slabel
                  listTreeSelection
                  sdescriptors
                  xworker.swt.events.Listeners/@listeners/@Listener
                  sid
                  listTreeSelection
                    @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listSashFrom/@listTree/@listeners/@listTreeSelection/@GroovyAction
                    sname
                    GroovyAction
                    sisSynchronized
                    false
                    sthrowException
                    true
                    suseOtherAction
                    false
                    svarScope
                    Global
                    sdisableGlobalContext
                    false
                    Scode
#$@text#$@
import org.xmeta.ActionContext;
import org.xmeta.Thing;

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

descTree.removeAll();

def data = listTree.getSelection()[0].getData();
if(data.value != null){
    if(data.value instanceof Thing){
        openUrl("do?sc=xworker.ide.worldexplorer.swt.http.ThingDoc/@desc&thing=" + data.value.metadata.path, false);
        
        initDescTree(data.value, descTree, [:]);
    }
}

leditButton.setEnabled(true);
if(data.value != null && data.value.getBoolean("isNode")){
    lopenButton.setEnabled(false);
}else{
    lopenButton.setEnabled(true);
}

if(data.type == "xworker.example"){
    leditExampleButton.setEnabled(true);
}    
     
def initDescTree(thing, item, context){
    if(context.get(thing) != null){
        return;
    }
    
    context.put(thing, thing);
    def treeItem = new TreeItem(item, SWT.NONE);
    treeItem.setText(thing.metadata.label + " (" + thing.getThingName() + ")");
    treeItem.setData(thing);
    
    for(child in thing.getAllChilds()){
        initDescTree(child, treeItem, context);
    }
    treeItem.expanded = true;
}
   
def openUrl(url, isOuterUrl){
    //log.info(url);
    if(isOuterUrl){
        browser.setUrl(url);
    }else{
        def globalCfg = world.getThing("_local.xworker.config.GlobalConfig");
        descBrowser.setUrl(globalCfg.webUrl + url);
    }
}
#$@text#$@
                    sdescriptors
                    xworker.lang.actions.Actions/@GroovyAction
                    sid
                    GroovyAction
              @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listSashFrom/@descSashFrom
              sname
              descSashFrom
              sstyle
              HORIZONTAL
              sSMOOTH
              false
              sweights
              50,50
              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
              descSashFrom
                @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listSashFrom/@descSashFrom/@descBrowser
                sname
                descBrowser
                sMOZILLA
                false
                slabel
                descBrowser
                sdescriptors
                xworker.swt.Widgets/@Browser
                sid
                descBrowser
                @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listSashFrom/@descSashFrom/@descTree
                sname
                descTree
                sselectStyle
                SINGLE
                sV_SCROLL
                true
                sH_SCROLL
                true
                sCHECK
                false
                sFULL_SELECTION
                false
                sHIDE_SELECTION
                false
                sBORDER
                false
                slineVisible
                false
                smultipleColumns
                false
                sheaderVisible
                false
                ssortIndicator
                false
                smoveableColumns
                false
                sheadImages
                false
                ssubImages
                false
                scheckSelection
                false
                slabel
                descTree
                sdescriptors
                xworker.swt.Widgets/@Tree
                sid
                descTree
                  @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listSashFrom/@descSashFrom/@descTree/@listeners
                  sname
                  listeners
                  slabel
                  listeners
                  sdescriptors
                  xworker.swt.events.Listeners/@listeners
                  sid
                  listeners
                    @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listSashFrom/@descSashFrom/@descTree/@listeners/@descTreeSelection
                    sname
                    descTreeDefaultSelection
                    stype
                    DefaultSelection
                    slabel
                    descTreeDefaultSelection
                    sdescriptors
                    xworker.swt.events.Listeners/@listeners/@Listener
                    sid
                    descTreeSelection
                      @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listSashFrom/@descSashFrom/@descTree/@listeners/@descTreeSelection/@GroovyAction
                      sname
                      GroovyAction
                      sisSynchronized
                      false
                      sthrowException
                      true
                      suseOtherAction
                      false
                      svarScope
                      Global
                      sdisableGlobalContext
                      false
                      Scode
#$@text#$@
def items = descTree.getSelection();
if(items != null && items.length > 0){
    def item = items[0];
    
    explorerActions.doAction("openThing", ["thing":item.getData()]);
}
#$@text#$@
                      sdescriptors
                      xworker.lang.actions.Actions/@GroovyAction
                      sid
                      GroovyAction
            @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listButtonComposite
            sname
            listButtonComposite
            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
            listButtonComposite
              @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listButtonComposite/@listbuttonComGridData
              sname
              listbuttonComGridData
              sstyle
              FILL_HORIZONTAL
              shorizontalIndent
              0
              swidth
              -1
              sheight
              -1
              shorizontalAlignment
              END
              sverticalAlignment
              CENTER
              shorizontalSpan
              1
              sverticalSpan
              1
              sgrabExcessHorizontalSpace
              false
              sgrabExcessVerticalSpace
              false
              slabel
              listbuttonComGridData
              sdescriptors
              xworker.swt.layout.LayoutDatas/@GridData
              sid
              listbuttonComGridData
              @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listButtonComposite/@listButtonRwLayout
              sname
              listButtonRwLayout
              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
              listButtonRwLayout
              sdescriptors
              xworker.swt.Layouts/@RowLayout
              sid
              listButtonRwLayout
              @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listButtonComposite/@lopenButton
              sname
              lopenButton
              stext
              res:res.w_exp:openButton打开（&O）
              stype
              SWT.PUSH
              sflat
              false
              sborder
              false
              sselected
              false
              scapture
              false
              senabled
              true
              sredraw
              true
              svisible
              true
              slabel
              lopenButton
              sdescriptors
              xworker.swt.Widgets/@Button
              sid
              lopenButton
                @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listButtonComposite/@lopenButton/@Listeners
                sname
                Listeners
                slabel
                Listeners
                sdescriptors
                xworker.swt.widgets.Widget/@Listeners
                sid
                Listeners
                  @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listButtonComposite/@lopenButton/@Listeners/@lopenButtonSelection
                  sname
                  lopenButtonSelection
                  stype
                  Selection
                  slabel
                  lopenButtonSelection
                  sdescriptors
                  xworker.swt.events.Listeners/@listeners/@Listener
                  sid
                  lopenButtonSelection
                    @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listButtonComposite/@lopenButton/@Listeners/@lopenButtonSelection/@GroovyAction
                    sname
                    GroovyAction
                    sisSynchronized
                    false
                    sthrowException
                    true
                    suseOtherAction
                    false
                    svarScope
                    Global
                    Scode
#$@text#$@
if(listTree.getSelection().length == 0) return;

listTreeDefaultSelection.handleEvent(null);
#$@text#$@
                    sdescriptors
                    xworker.lang.actions.Actions/@GroovyAction
                    sid
                    GroovyAction
              @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listButtonComposite/@leditButton
              sname
              leditButton
              stext
              res:res.w_exp:editButton编辑（&E）
              stype
              SWT.PUSH
              sflat
              false
              sborder
              false
              sselected
              false
              scapture
              false
              senabled
              true
              sredraw
              true
              svisible
              true
              slabel
              leditButton
              sdescriptors
              xworker.swt.Widgets/@Button
              sid
              leditButton
                @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listButtonComposite/@leditButton/@Listeners
                sname
                Listeners
                slabel
                Listeners
                sdescriptors
                xworker.swt.widgets.Widget/@Listeners
                sid
                Listeners
                  @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listButtonComposite/@leditButton/@Listeners/@leditButtonSelection
                  sname
                  leditButtonSelection
                  stype
                  Selection
                  slabel
                  leditButtonSelection
                  sdescriptors
                  xworker.swt.events.Listeners/@listeners/@Listener
                  sid
                  leditButtonSelection
                    @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listButtonComposite/@leditButton/@Listeners/@leditButtonSelection/@GroovyAction
                    sname
                    GroovyAction
                    sisSynchronized
                    false
                    sthrowException
                    true
                    suseOtherAction
                    false
                    svarScope
                    Global
                    Scode
#$@text#$@
import org.xmeta.Thing;

if(listTree.getSelection().length == 0) return;

def data = listTree.getSelection()[0].getData();
if(data.value != null){
    if(data.value instanceof Thing){
        explorerActions.doAction("openThing", ["thing":data.value]);
    }
}
#$@text#$@
                    sdescriptors
                    xworker.lang.actions.Actions/@GroovyAction
                    sid
                    GroovyAction
              @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listButtonComposite/@leditExampleButton
              sname
              leditExampleButton
              stext
              res:res.w_exp:editExampleButton编辑示例
              stype
              SWT.PUSH
              sflat
              false
              sborder
              false
              sselected
              false
              scapture
              false
              senabled
              true
              sredraw
              true
              svisible
              true
              slabel
              leditExampleButton
              sdescriptors
              xworker.swt.Widgets/@Button
              sid
              leditExampleButton
                @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listButtonComposite/@leditExampleButton/@Listeners
                sname
                Listeners
                slabel
                Listeners
                sdescriptors
                xworker.swt.widgets.Widget/@Listeners
                sid
                Listeners
                  @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listButtonComposite/@leditExampleButton/@Listeners/@leditExampleSelection
                  sname
                  leditExampleSelection
                  stype
                  Selection
                  slabel
                  leditExampleSelection
                  sdescriptors
                  xworker.swt.events.Listeners/@listeners/@Listener
                  sid
                  leditExampleSelection
                    @/@shell/@mainSash/@mainPanel/@mainComposite/@listComposite/@listButtonComposite/@leditExampleButton/@Listeners/@leditExampleSelection/@GroovyAction
                    sname
                    GroovyAction
                    sisSynchronized
                    false
                    sthrowException
                    true
                    suseOtherAction
                    false
                    svarScope
                    Global
                    Scode
#$@text#$@
import org.xmeta.Thing;

if(listTree.getSelection().length == 0) return;

def data = listTree.getSelection()[0].getData();
if(data.value != null){
    if(data.value instanceof Thing){
        def thing = world.getThing(data.value.getString("xworker.exampleThing"));
        explorerActions.doAction("openThing", ["thing":thing]);
    }
}
#$@text#$@
                    sdescriptors
                    xworker.lang.actions.Actions/@GroovyAction
                    sid
                    GroovyAction
      @/@shell/@mainSash/@mainSashGridData
      sname
      mainSashGridData
      sstyle
      FILL_BOTH
      shorizontalIndent
      0
      swidth
      -1
      sheight
      -1
      shorizontalAlignment
      BEGINNING
      sverticalAlignment
      CENTER
      shorizontalSpan
      1
      sverticalSpan
      1
      sgrabExcessHorizontalSpace
      false
      sgrabExcessVerticalSpace
      false
      slabel
      mainSashGridData
      sdescriptors
      xworker.swt.layout.LayoutDatas/@GridData
      sid
      mainSashGridData
    @/@shell/@buttonComposite
    sname
    buttonComposite
    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
    buttonComposite
      @/@shell/@buttonComposite/@buttonCompositeGridData
      sname
      buttonCompositeGridData
      sstyle
      FILL_HORIZONTAL
      shorizontalIndent
      0
      swidth
      -1
      sheight
      -1
      shorizontalAlignment
      END
      sverticalAlignment
      CENTER
      shorizontalSpan
      1
      sverticalSpan
      1
      sgrabExcessHorizontalSpace
      false
      sgrabExcessVerticalSpace
      false
      slabel
      buttonCompositeGridData
      sdescriptors
      xworker.swt.layout.LayoutDatas/@GridData
      sid
      buttonCompositeGridData
      @/@shell/@buttonComposite/@bottomCompositeGridLayout
      sname
      bottomCompositeGridLayout
      snumColumns
      1
      smakeColumnsEqualWidth
      false
      smarginWidth
      5
      smarginHeight
      5
      smarginLeft
      0
      smarginTop
      0
      smarginRight
      0
      smarginBottom
      0
      shorizontalSpacing
      5
      sverticalSpacing
      5
      slabel
      bottomCompositeGridLayout
      sdescriptors
      xworker.swt.Layouts/@GridLayout
      sid
      bottomCompositeGridLayout
      @/@shell/@buttonComposite/@cancelButton
      sname
      cancelButton
      stext
      res:res.w_exp:closeButton关闭（&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
        @/@shell/@buttonComposite/@cancelButton/@Listeners
        sname
        Listeners
        slabel
        Listeners
        sdescriptors
        xworker.swt.widgets.Widget/@Listeners
        sid
        Listeners
          @/@shell/@buttonComposite/@cancelButton/@Listeners/@cancelButtonSelection
          sname
          cancelButtonSelection
          stype
          Selection
          slabel
          cancelButtonSelection
          sdescriptors
          xworker.swt.events.Listeners/@listeners/@Listener
          sid
          cancelButtonSelection
            @/@shell/@buttonComposite/@cancelButton/@Listeners/@cancelButtonSelection/@GroovyAction
            sname
            GroovyAction
            sisSynchronized
            false
            sthrowException
            true
            suseOtherAction
            false
            svarScope
            Global
            scode
            shell.dispose();
            sdescriptors
            xworker.lang.actions.Actions/@GroovyAction
            sid
            GroovyAction
        @/@shell/@buttonComposite/@cancelButton/@cancelButtonGridDAta
        sname
        cancelButtonGridDAta
        sstyle
        FILL_HORIZONTAL
        shorizontalIndent
        0
        swidth
        -1
        sheight
        -1
        shorizontalAlignment
        END
        sverticalAlignment
        CENTER
        shorizontalSpan
        1
        sverticalSpan
        1
        sgrabExcessHorizontalSpace
        false
        sgrabExcessVerticalSpace
        false
        slabel
        cancelButtonGridDAta
        sdescriptors
        xworker.swt.layout.LayoutDatas/@GridData
        sid
        cancelButtonGridDAta
    @/@shell/@actions
    sname
    actions
    slabel
    actions
    sdescriptors
    xworker.swt.Widgets/@actions
    sid
    actions
      @/@shell/@actions/@setThing
      sname
      setThing
      sisSynchronized
      false
      sthrowException
      true
      suseOtherAction
      false
      svarScope
      Global
      Scode
#$@text#$@
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.TreeItem;

//浏览器绑定脚本
browser.addStatusTextListener(utilBrowser);
descBrowser.addStatusTextListener(utilBrowser);

actions.doAction("selectThing", ["thing":thing]);
//def rootThing = thing.getRoot();
//initOutline(rootThing, null, thing);

//保存事物变量
//actionContext.getScope(0).put("thing", thing);

def initOutline(thing, treeItem, defaultThing){
    def item = null;
    if(treeItem == null){
        item = new TreeItem(outlineTree, SWT.NONE);
    }else{
        item = new TreeItem(treeItem, SWT.NONE);
    }
    
    item.setText(thing.metadata.label + "(" + thing.getDescriptors()[0].metadata.name + ")");
    item.setData(thing);
    
    for(child in thing.getChilds()){
        initOutline(child, item, defaultThing);
    }
    
    if(thing == defaultThing){
        outlineTree.setSelection(item);
        
        actions.doAction("selectThing", actionContext, ["thing":thing]);
    }
}
#$@text#$@
      sdescriptors
      xworker.lang.actions.Actions/@GroovyAction
      sid
      setThing
      @/@shell/@actions/@selectThing
      sname
      selectThing
      sisSynchronized
      false
      sthrowException
      true
      suseOtherAction
      false
      svarScope
      Global
      sdisableGlobalContext
      false
      Scode
#$@text#$@
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.TreeItem;

import org.xmeta.util.UtilString;

//首先清理Menutree
for(item in menuTree.getItems()){
    item.dispose();
}

//保存事物变量
actionContext.getScope(0).put("thing", thing);

//获得所有的描述者
def descriptors = thing.getAllDescriptors();

//模板节点 
TreeItem templateTreeItem = new TreeItem(menuTree, SWT.NONE);
templateTreeItem.setText(UtilString.getString("res:res.w_exp:template模板", actionContext));
templateTreeItem.setData(["type":"templateDescription"]);

for(descriptor in descriptors){
    def descriptorTreeItem = new TreeItem(templateTreeItem, SWT.NONE);
    descriptorTreeItem.setText(descriptor.metadata.label);
    descriptorTreeItem.setData(["type":"template", "value":descriptor]);
    
    /*
    def templates = descriptor.get("templates@0/template@");
    for(template in templates){
        initTemplate(template, descriptorTreeItem);
    }*/
}

//向导节点
TreeItem guideTreeItem = new TreeItem(menuTree, SWT.NONE);
guideTreeItem.setText(UtilString.getString("res:res.w_exp:guide向导", actionContext));
guideTreeItem.setData(["type":"guideDescription"]);

for(descriptor in descriptors){
    def descriptorTreeItem = new TreeItem(guideTreeItem, SWT.NONE);
    descriptorTreeItem.setText(descriptor.metadata.label);
    descriptorTreeItem.setData(["type":"guide", "value":descriptor]);

    /*def guides = descriptor.get("guides@0/guide@");
    for(guide in guides){
        def treeItem = new TreeItem(descriptorTreeItem, SWT.NONE);
        treeItem.setText(guide.metadata.label);
        treeItem.setData(["type":"guide", "value":guide]);
    }*/
}

//示例节点
TreeItem xworker.exampleTreeItem = new TreeItem(menuTree, SWT.NONE);
xworker.exampleTreeItem.setText(UtilString.getString("res:res.w_exp:xworker.example示例", actionContext));
xworker.exampleTreeItem.setData(["type":"xworker.exampleAll"]);

for(descriptor in descriptors){
    def descriptorTreeItem = new TreeItem(xworker.exampleTreeItem, SWT.NONE);
    descriptorTreeItem.setText(descriptor.metadata.label);
    descriptorTreeItem.setData(["type":"xworker.example", "value":descriptor]);
}

for(extend_ in thing.getAllExtends()){
    def descriptorTreeItem = new TreeItem(xworker.exampleTreeItem, SWT.NONE);
    descriptorTreeItem.setText(extend_.metadata.label);
    descriptorTreeItem.setData(["type":"xworker.example", "value":extend_]);
}

//笔记节点
TreeItem noteTreeItem = new TreeItem(menuTree, SWT.NONE);
noteTreeItem.setText(UtilString.getString("res:res.w_exp:note笔记", actionContext));
noteTreeItem.setData(["type":"noteDescription"]);

def selfNoteTreeItem = new TreeItem(noteTreeItem, SWT.NONE);
selfNoteTreeItem.setText(thing.metadata.label);
selfNoteTreeItem.setData(["type":"note", "value":thing]);

for(descriptor in descriptors){
    def descriptorTreeItem = new TreeItem(noteTreeItem, SWT.NONE);
    descriptorTreeItem.setText(descriptor.metadata.label);
    descriptorTreeItem.setData(["type":"note", "value":descriptor]);
}

//文档节点
TreeItem docTreeItem = new TreeItem(menuTree, SWT.NONE);
docTreeItem.setText(UtilString.getString("res:res.w_exp:document文档", actionContext));
docTreeItem.setData(["type":"docDescription"]);

def selfDocTreeItem = new TreeItem(docTreeItem, SWT.NONE);
selfDocTreeItem.setText(thing.metadata.label);
selfDocTreeItem.setData(["type":"doc", "value":thing]);

for(descriptor in descriptors){
    def descriptorTreeItem = new TreeItem(docTreeItem, SWT.NONE);
    descriptorTreeItem.setText(descriptor.metadata.label);
    descriptorTreeItem.setData(["type":"doc", "value":descriptor]);
}

for(extend_ in thing.getAllExtends()){
    def descriptorTreeItem = new TreeItem(docTreeItem, SWT.NONE);
    descriptorTreeItem.setText(extend_.metadata.label);
    descriptorTreeItem.setData(["type":"doc", "value":extend_]);
}

//模板是树形结构的
def initTemplate(template, parentTreeItem){
    def treeItem = new TreeItem(parentTreeItem, SWT.NONE);
    treeItem.setText(template.metadata.label);
    treeItem.setData(["type":"template", "value":template]);
    
    for(child in template.getAllChilds("ThingTemplate")){
        initTemplate(child, treeItem);
    }
}
#$@text#$@
      sdescriptors
      xworker.lang.actions.Actions/@GroovyAction
      sid
      selectThing
      @/@shell/@actions/@initListTree
      sname
      initListTree
      sisSynchronized
      false
      sthrowException
      true
      suseOtherAction
      false
      svarScope
      Global
      Scode
#$@text#$@
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.TreeItem;

if(type == "template"){
    def templates = descriptor.get("templates@0/template@");
    for(template in templates){
        initTemplate(template, listTree, context);
    }
}else if(type == "xworker.example"){
    def xworker.examples = descriptor.get("xworker.examples@0/Example@");
    for(xworker.example in xworker.examples){
        if(checkAdded(xworker.example, context)){
            continue;
        }
        def treeItem = new TreeItem(listTree, SWT.NONE);
        treeItem.setText([xworker.example.metadata.label, xworker.example.metadata.path] as String[]);
        treeItem.setData(["type":"xworker.example", "value":xworker.example]);
    }
}else if(type == "guide"){
    def guides = descriptor.get("guides@0/Guide@");
    for(duide in guides){
        if(checkAdded(duide, context)){
            continue;
        }
        def treeItem = new TreeItem(listTree, SWT.NONE);
        treeItem.setText([duide.metadata.label, duide.metadata.path] as String[]);
        treeItem.setData(["type":"duide", "value":duide]);
    }
}

def checkAdded(thing, context){
    if(context.get(thing.metadata.path) != null){
        return true;
    }else{
        context.put(thing.metadata.path, thing);
        return false;
    }
}

//模板是树形结构的
def initTemplate(template, parentTreeItem, context){    
    if(checkAdded(template, context)){
        return;
    }
    
    def treeItem = new TreeItem(parentTreeItem, SWT.NONE);
    treeItem.setText([template.metadata.label, template.metadata.path] as String[]);
    treeItem.setData(["type":"template", "value":template]);
    
    for(child in template.getAllChilds("ThingCreator")){
        initTemplate(child, treeItem, context);
    }
}
#$@text#$@
      Sdescription
#$@text#$@
<p>传入一个描述者及其类型，然后初始化列表树。</p>
<p>不负责删除已有的树节点。</p>
#$@text#$@
      sdescriptors
      xworker.lang.actions.Actions/@GroovyAction
      sid
      initListTree
