^1639983259497
@
sname
ThingToCodeByTemplateViewer
slabel
ThingToCodeByTemplateViewer
sdescriptors
xworker.lang.MetaDescriptor3
sextends
xworker.lang.actions.SelfAction
smany
true
seditCols
2
sinitialization
false
sgroup
xworker.ide
smodifier
public
sinheritDescription
false
sdescription
<p>把指定的事物通过模板转化为代码并显示。</p>
sth_createIndex
true
sth_registThing
child|xworker.lang.actions.Actions
sth_mark
false
sid
ThingToCodeByTemplateViewer
  @/@actions
  sname
  actions
  sdescriptors
  xworker.lang.MetaDescriptor3/@actions
  sth_createIndex
  false
  sth_mark
  false
  sid
  actions
    @/@actions/@run
    sname
    run
    sisSynchronized
    false
    sthrowException
    true
    suseOtherAction
    false
    svarScope
    Local
    sdisableGlobalContext
    false
    Scode
#$@text#$@
import ognl.Ognl;
import org.eclipse.swt.widgets.Display;

import org.xmeta.ActionContext;
import xworker.lang.util.UtilTemplate;

def thing = world.getThing(self.thingPath);
if(thing == null){
    thing = Ognl.getValue(self.thingVar, actionContext);
}

if(thing == null){
    log.warn("thing is null, can not show code, thing=" + self.metadata.path);
    return;
}

try{

    def ac = new ActionContext(actionContext);
    ac.put("thing", thing);
    ac.put("parent", Display.getCurrent().getActiveShell());
    def shellThing = world.getThing("xworker.swt.ide.worldexplorer.swt.dialogs.CodeViewer");
    def shell = shellThing.doAction("create", ac);
    
    String code = UtilTemplate.process(ac, self.templatePath, "freemarker");
    ac.actions.doAction("setCode", ac, ["code": code, "codeType": self.codeType]);
    shell.open();
    
}finally{
}
#$@text#$@
    sinterpretationType
    Action
    screateLocalVarScope
    false
    ssaveReturn
    false
    sdescriptors
    xworker.lang.actions.Actions/@GroovyAction
    sth_createIndex
    false
    sth_mark
    false
    sid
    run
  @/@name
  sname
  name
  sreadOnly
  false
  sinheritDescription
  false
  svalidateAllowBlank
  true
  LvalidateOnBlur
  true
  LallowDecimals
  true
  LallowNegative
  true
  sdescriptors
  xworker.lang.MetaDescriptor3/@attribute
  sth_createIndex
  false
  sth_mark
  false
  sid
  name
  @/@label
  sname
  label
  sreadOnly
  false
  sinheritDescription
  false
  svalidateAllowBlank
  true
  LvalidateOnBlur
  true
  LallowDecimals
  true
  LallowNegative
  true
  sdescriptors
  xworker.lang.MetaDescriptor3/@attribute
  sth_createIndex
  false
  sth_mark
  false
  sid
  label
  @/@thingPath
  sname
  thingPath
  sinputtype
  dataSelector
  ssize
  60
  sreadOnly
  false
  sinheritDescription
  false
  svalidateAllowBlank
  true
  LvalidateOnBlur
  true
  LallowDecimals
  true
  LallowNegative
  true
  sdescriptors
  xworker.lang.MetaDescriptor3/@attribute
  sth_createIndex
  false
  sth_mark
  false
  sid
  thingPath
  @/@thingVar
  sname
  thingVar
  sreadOnly
  false
  sinheritDescription
  false
  svalidateAllowBlank
  true
  LvalidateOnBlur
  true
  LallowDecimals
  true
  LallowNegative
  true
  sdescriptors
  xworker.lang.MetaDescriptor3/@attribute
  sth_createIndex
  false
  sth_mark
  false
  sid
  thingVar
  @/@templatePath
  sname
  templatePath
  ssize
  60
  sreadOnly
  false
  sinheritDescription
  false
  svalidateAllowBlank
  true
  LvalidateOnBlur
  true
  LallowDecimals
  true
  LallowNegative
  true
  sdescriptors
  xworker.lang.MetaDescriptor3/@attribute
  sth_createIndex
  false
  sth_mark
  false
  sid
  templatePath
  @/@codeType
  sname
  codeType
  sinputtype
  inputSelect
  sreadOnly
  false
  sinheritDescription
  false
  svalidateAllowBlank
  true
  LvalidateOnBlur
  true
  LallowDecimals
  true
  LallowNegative
  true
  sdescriptors
  xworker.lang.MetaDescriptor3/@attribute
  sth_createIndex
  false
  sth_mark
  false
  sid
  codeType
    @/@codeType/@java
    sname
    java
    slabel
    java
    svalue
    java.java
    sdescriptors
    xworker.lang.MetaDescriptor3/@attribute/@value
    sth_createIndex
    false
    sth_mark
    false
    sid
    java
    @/@codeType/@js
    sname
    js
    slabel
    js
    svalue
    js.js
    sdescriptors
    xworker.lang.MetaDescriptor3/@attribute/@value
    sth_createIndex
    false
    sth_mark
    false
    sid
    js
    @/@codeType/@xml
    sname
    xml
    slabel
    xml
    svalue
    xml.xml
    sdescriptors
    xworker.lang.MetaDescriptor3/@attribute/@value
    sth_createIndex
    false
    sth_mark
    false
    sid
    xml
