^1651633301128
@
sname
ActionExample
slabel
ActionExample
sdescriptors
xworker.lang.MetaDescriptor3
smany
true
seditCols
2
sinitialization
false
smodifier
public
sinheritDescription
false
snotXmlAttribute
false
sth_createIndex
false
sth_registMyChilds
false
sth_registDisabled
false
sth_mark
false
  @/@actions
  sname
  actions
  sdescriptors
  xworker.lang.MetaDescriptor3/@actions
  sinheritDescription
  false
  sth_createIndex
  false
  sth_registMyChilds
  false
  sth_mark
  false
  sid
  actions
    @/@actions/@If
    sname
    run
    sinterpretationType
    Self
    sattributeTemplate
    false
    schildsAttributeTemplate
    false
    svarScope
    Local
    sisSynchronized
    false
    sthrowException
    true
    suseOtherAction
    false
    screateLocalVarScope
    false
    ssaveReturn
    false
    sdisableGlobalContext
    false
    sdescriptors
    xworker.lang.actions.Actions/@If
    sinheritDescription
    false
    sth_createIndex
    false
    sth_registMyChilds
    false
    sth_mark
    false
    sid
    If
      @/@actions/@If/@actions
      sname
      actions
      sdescriptors
      xworker.lang.actions.If/@actions
      sinheritDescription
      false
      sth_createIndex
      false
      sth_registMyChilds
      false
      sth_mark
      false
      sid
      actions
        @/@actions/@If/@actions/@condition
        sname
        condition
        sisSynchronized
        false
        sthrowException
        true
        suseOtherAction
        false
        svarScope
        Local
        sdisableGlobalContext
        false
        Scode
#$@text#$@
if(actionContext.get("args") == null){
    log.info("args is null, please input project name");
    return false;
}

return true;
#$@text#$@
        sinterpretationType
        Action
        screateLocalVarScope
        false
        ssaveReturn
        false
        sdescriptors
        xworker.lang.actions.Actions/@GroovyAction
        sinheritDescription
        false
        sth_createIndex
        false
        sth_registMyChilds
        false
        sth_mark
        false
        sid
        condition
      @/@actions/@If/@ChildAction
      sname
      Then
      sdescriptors
      xworker.lang.actions.If/@ChildAction
      sinheritDescription
      false
      sth_createIndex
      false
      sth_registMyChilds
      false
      sth_mark
      false
      sid
      ChildAction
        @/@actions/@If/@ChildAction/@init
        sname
        init
        sisSynchronized
        false
        sthrowException
        true
        suseOtherAction
        false
        svarScope
        Local
        sdisableGlobalContext
        false
        Scode
#$@text#$@
//当前变量上下文
def bindings = actionContext.getScope();
def projectName = args[2];

//在当前目录下创建项目目录
def dir = new File(projectName);
log.info("projectName=" + projectName);
dir.mkdirs();

def srcDir = new File(dir, "src");
srcDir.mkdirs();

def binDir = new File(dir, "bin");
binDir.mkdirs();

//获取xworker下的classPath
def xworkerFile = new File(world.getPath()).getAbsolutePath() ;
def classPath = world.getClassLoader().getClassPath();
def classPaths = classPath.split("[" + File.pathSeparator + "]");
def classPathList = [];
for(clPath in classPaths){
    def clFile = new File(clPath);
    if(clFile.isFile() && clFile.getAbsolutePath().startsWith(xworkerFile)){
        classPathList.add(clPath);
    }
}

//保存变量
bindings.put("projectName", projectName);
bindings.put("xworkerPath", world.getPath());
bindings.put("classPaths", classPathList);
#$@text#$@
        sinterpretationType
        Action
        screateLocalVarScope
        false
        ssaveReturn
        false
        sdescriptors
        xworker.lang.actions.Actions/@GroovyAction
        sinheritDescription
        false
        sth_createIndex
        false
        sth_registMyChilds
        false
        sth_mark
        false
        sid
        init
        @/@actions/@If/@ChildAction/@generateProject
        sname
        generateProject
        stype
        overwrite
        sfilePath
        ${projectName}/.project
        sfileEncoding
        UTF-8
        slog
        true
        sinterpretationType
        Self
        sattributeTemplate
        false
        schildsAttributeTemplate
        false
        svarScope
        Local
        sisSynchronized
        false
        sthrowException
        true
        suseOtherAction
        false
        screateLocalVarScope
        false
        ssaveReturn
        false
        sdisableGlobalContext
        false
        sdescriptors
        xworker.lang.actions.Actions/@CodeGenerator
        sinheritDescription
        false
        sth_createIndex
        false
        sth_registMyChilds
        false
        sth_mark
        false
        sid
        generateProject
          @/@actions/@If/@ChildAction/@generateProject/@Contents
          sname
          Contents
          sdescriptors
          xworker.core.actions.code.CodeGenerator/@Contents
          sinheritDescription
          false
          sth_createIndex
          false
          sth_registMyChilds
          false
          sth_mark
          false
          sid
          Contents
            @/@actions/@If/@ChildAction/@generateProject/@Contents/@FreemarkerContent
            sname
            FreemarkerContent
            Scode
#$@text#$@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
	<name>${projectName?if_exists}</name>
	<comment></comment>
	<projects>
	</projects>
	<buildSpec>
		<buildCommand>
			<name>org.eclipse.jdt.core.javabuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
	</buildSpec>
	<natures>
		<nature>org.eclipse.jdt.core.javanature</nature>
	</natures>
</projectDescription>
#$@text#$@
            sdescriptors
            xworker.core.actions.code.CodeGenerator/@Contents/@FreemarkerContent
            sinheritDescription
            false
            sth_createIndex
            false
            sth_registMyChilds
            false
            sth_mark
            false
            sid
            FreemarkerContent
        @/@actions/@If/@ChildAction/@generateClassPath
        sname
        generateClassPath
        stype
        overwrite
        sfilePath
        ${projectName}/.classpath
        sfileEncoding
        UTF-8
        slog
        true
        sinterpretationType
        Self
        sattributeTemplate
        false
        schildsAttributeTemplate
        false
        svarScope
        Local
        sisSynchronized
        false
        sthrowException
        true
        suseOtherAction
        false
        screateLocalVarScope
        false
        ssaveReturn
        false
        sdisableGlobalContext
        false
        sdescriptors
        xworker.lang.actions.Actions/@CodeGenerator
        sinheritDescription
        false
        sth_createIndex
        false
        sth_registMyChilds
        false
        sth_mark
        false
        sid
        generateClassPath
          @/@actions/@If/@ChildAction/@generateClassPath/@Contents
          sname
          Contents
          sdescriptors
          xworker.core.actions.code.CodeGenerator/@Contents
          sinheritDescription
          false
          sth_createIndex
          false
          sth_registMyChilds
          false
          sth_mark
          false
          sid
          Contents
            @/@actions/@If/@ChildAction/@generateClassPath/@Contents/@FreemarkerContent
            sname
            FreemarkerContent
            Scode
#$@text#$@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="src" path="src"/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
    <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JDK_TOOLS"/>
	<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/SWT"/>
<#list classPaths as classPath>
	<classpathentry kind="lib" path="${classPath}"/>
</#list>	
	<classpathentry kind="output" path="bin"/>
</classpath>
#$@text#$@
            sdescriptors
            xworker.core.actions.code.CodeGenerator/@Contents/@FreemarkerContent
            sinheritDescription
            false
            sth_createIndex
            false
            sth_registMyChilds
            false
            sth_mark
            false
            sid
            FreemarkerContent
        @/@actions/@If/@ChildAction/@generateSettings
        sname
        generateSettings
        stype
        overwrite
        sfilePath
        ${projectName}/.settings/org.eclipse.jdt.core.prefs
        sfileEncoding
        UTF-8
        slog
        true
        sinterpretationType
        Self
        sattributeTemplate
        false
        schildsAttributeTemplate
        false
        svarScope
        Local
        sisSynchronized
        false
        sthrowException
        true
        suseOtherAction
        false
        screateLocalVarScope
        false
        ssaveReturn
        false
        sdisableGlobalContext
        false
        sdescriptors
        xworker.lang.actions.Actions/@CodeGenerator
        sinheritDescription
        false
        sth_createIndex
        false
        sth_registMyChilds
        false
        sth_mark
        false
        sid
        generateSettings
          @/@actions/@If/@ChildAction/@generateSettings/@Contents
          sname
          Contents
          sdescriptors
          xworker.core.actions.code.CodeGenerator/@Contents
          sinheritDescription
          false
          sth_createIndex
          false
          sth_registMyChilds
          false
          sth_mark
          false
          sid
          Contents
            @/@actions/@If/@ChildAction/@generateSettings/@Contents/@FreemarkerContent
            sname
            FreemarkerContent
            Scode
#$@text#$@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
#$@text#$@
            sdescriptors
            xworker.core.actions.code.CodeGenerator/@Contents/@FreemarkerContent
            sinheritDescription
            false
            sth_createIndex
            false
            sth_registMyChilds
            false
            sth_mark
            false
            sid
            FreemarkerContent
        @/@actions/@If/@ChildAction/@generateStartXWorkerJava
        sname
        generateStartXWorkerJava
        stype
        overwrite
        sfilePath
        ${projectName}/src/xworker/StartXWorker.java
        sfileEncoding
        UTF-8
        slog
        true
        sinterpretationType
        Self
        sattributeTemplate
        false
        schildsAttributeTemplate
        false
        svarScope
        Local
        sisSynchronized
        false
        sthrowException
        true
        suseOtherAction
        false
        screateLocalVarScope
        false
        ssaveReturn
        false
        sdisableGlobalContext
        false
        sdescriptors
        xworker.lang.actions.Actions/@CodeGenerator
        sinheritDescription
        false
        sth_createIndex
        false
        sth_registMyChilds
        false
        sth_mark
        false
        sid
        generateStartXWorkerJava
          @/@actions/@If/@ChildAction/@generateStartXWorkerJava/@Contents
          sname
          Contents
          sdescriptors
          xworker.core.actions.code.CodeGenerator/@Contents
          sinheritDescription
          false
          sth_createIndex
          false
          sth_registMyChilds
          false
          sth_mark
          false
          sid
          Contents
            @/@actions/@If/@ChildAction/@generateStartXWorkerJava/@Contents/@FreemarkerContent
            sname
            FreemarkerContent
            Scode
#$@text#$@
package xworker;

import org.xmeta.Thing;
import org.xmeta.World;

import java.io.File;

public class StartXWorker {
	public static void main(String[] args){
		try{
			World world = World.getInstance();			
			world.init("${xworkerPath?js_string}");

			//如果当前目录是XWorker项目，那么加入
			File xworkerProperties = new File("xworker.properties");
			if(xworkerProperties.exists()){
				world.initThingManager(new File("."));
			}
			
			//启动编辑器
			Thing worldExplorer = World.getInstance().getThing("xworker.swt.ide.worldexplorer.swt.SimpleExplorerRunner");			
			worldExplorer.doAction("run");
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}
#$@text#$@
            sdescriptors
            xworker.core.actions.code.CodeGenerator/@Contents/@FreemarkerContent
            sinheritDescription
            false
            sth_createIndex
            false
            sth_registMyChilds
            false
            sth_mark
            false
            sid
            FreemarkerContent
        @/@actions/@If/@ChildAction/@geneateLog4jProperties
        sname
        geneateLog4jProperties
        stype
        overwrite
        sfilePath
        ${projectName}/src/log4j.properties
        sfileEncoding
        UTF-8
        slog
        true
        sinterpretationType
        Self
        sattributeTemplate
        false
        schildsAttributeTemplate
        false
        svarScope
        Local
        sisSynchronized
        false
        sthrowException
        true
        suseOtherAction
        false
        screateLocalVarScope
        false
        ssaveReturn
        false
        sdisableGlobalContext
        false
        sdescriptors
        xworker.lang.actions.Actions/@CodeGenerator
        sinheritDescription
        false
        sth_createIndex
        false
        sth_registMyChilds
        false
        sth_mark
        false
        sid
        geneateLog4jProperties
          @/@actions/@If/@ChildAction/@geneateLog4jProperties/@Contents
          sname
          Contents
          sdescriptors
          xworker.core.actions.code.CodeGenerator/@Contents
          sinheritDescription
          false
          sth_createIndex
          false
          sth_registMyChilds
          false
          sth_mark
          false
          sid
          Contents
            @/@actions/@If/@ChildAction/@geneateLog4jProperties/@Contents/@FreemarkerContent
            sname
            FreemarkerContent
            Scode
#$@text#$@
#
# Log4J Settings for log4j 1.2.x (via jakarta-commons-logging)
#
# The five logging levels used by Log are (in order):
#
#   1. DEBUG (the least serious)
#   2. INFO
#   3. WARN
#   4. ERROR
#   5. FATAL (the most serious)


# Set root logger level to WARN and append to stdout
log4j.rootLogger=INFO, ROLLING_FILE, stdout

#log4j.appender.stdout=org.xworker.core.util.Log4jConsoleAppender
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%d %5p (%c:%L) - %m%n

log4j.appender.ROLLING_FILE=org.apache.log4j.RollingFileAppender 
log4j.appender.ROLLING_FILE.Threshold=ERROR 
log4j.appender.ROLLING_FILE.File=log/xworker.log 
log4j.appender.ROLLING_FILE.Append=true 
log4j.appender.ROLLING_FILE.MaxFileSize=100KB 
log4j.appender.ROLLING_FILE.MaxBackupIndex=1 
log4j.appender.ROLLING_FILE.layout=org.apache.log4j.PatternLayout 
log4j.appender.ROLLING_FILE.layout.ConversionPattern=[framework] %d - %c -%-4r [%t] %-5p %c %x - %m%n 


# Print only messages of level INFO or above in the package noModule.
log4j.logger.noModule=INFO
log4j.logger.org.xmeta=INFO
log4j.logger.xworker=INFO
log4j.logger.core=INFO
#$@text#$@
            sdescriptors
            xworker.core.actions.code.CodeGenerator/@Contents/@FreemarkerContent
            sinheritDescription
            false
            sth_createIndex
            false
            sth_registMyChilds
            false
            sth_mark
            false
            sid
            FreemarkerContent
        @/@actions/@If/@ChildAction/@generateXWorkerProperties
        sname
        generateXWorkerProperties
        stype
        overwrite
        sfilePath
        ${projectName}/xworker.properties
        sfileEncoding
        UTF-8
        slog
        true
        sinterpretationType
        Self
        sattributeTemplate
        false
        schildsAttributeTemplate
        false
        svarScope
        Local
        sisSynchronized
        false
        sthrowException
        true
        suseOtherAction
        false
        screateLocalVarScope
        false
        ssaveReturn
        false
        sdisableGlobalContext
        false
        sdescriptors
        xworker.lang.actions.Actions/@CodeGenerator
        sinheritDescription
        false
        sth_createIndex
        false
        sth_registMyChilds
        false
        sth_mark
        false
        sid
        generateXWorkerProperties
          @/@actions/@If/@ChildAction/@generateXWorkerProperties/@Contents
          sname
          Contents
          sdescriptors
          xworker.core.actions.code.CodeGenerator/@Contents
          sinheritDescription
          false
          sth_createIndex
          false
          sth_registMyChilds
          false
          sth_mark
          false
          sid
          Contents
            @/@actions/@If/@ChildAction/@generateXWorkerProperties/@Contents/@FreemarkerContent
            sname
            FreemarkerContent
            scode
            projectName=${projectName?if_exists}
            sdescriptors
            xworker.core.actions.code.CodeGenerator/@Contents/@FreemarkerContent
            sinheritDescription
            false
            sth_createIndex
            false
            sth_registMyChilds
            false
            sth_mark
            false
            sid
            FreemarkerContent
        @/@actions/@If/@ChildAction/@generateSettings1
        sname
        generateXWorkerCmd
        stype
        overwrite
        sfilePath
        ${projectName}/xworker.cmd
        sfileEncoding
        UTF-8
        slog
        true
        sinterpretationType
        Self
        sattributeTemplate
        false
        schildsAttributeTemplate
        false
        svarScope
        Local
        sisSynchronized
        false
        sthrowException
        true
        suseOtherAction
        false
        screateLocalVarScope
        false
        ssaveReturn
        false
        sdisableGlobalContext
        false
        sdebugLog
        false
        sdescriptors
        xworker.lang.actions.Actions/@CodeGenerator
        sinheritDescription
        false
        sth_createIndex
        false
        sth_registMyChilds
        false
        sth_mark
        false
        sid
        generateSettings1
          @/@actions/@If/@ChildAction/@generateSettings1/@Contents
          sname
          Contents
          sdescriptors
          xworker.core.actions.code.CodeGenerator/@Contents
          sinheritDescription
          false
          sth_createIndex
          false
          sth_registMyChilds
          false
          sth_mark
          false
          sid
          Contents
            @/@actions/@If/@ChildAction/@generateSettings1/@Contents/@FreemarkerContent
            sname
            FreemarkerContent
            scode
            xer.cmd
            sdescriptors
            xworker.core.actions.code.CodeGenerator/@Contents/@FreemarkerContent
            sinheritDescription
            false
            sth_createIndex
            false
            sth_registMyChilds
            false
            sth_mark
            false
            sid
            FreemarkerContent
        @/@actions/@If/@ChildAction/@generateSettings2
        sname
        generateXWorkerSh
        stype
        overwrite
        sfilePath
        ${projectName}/xworker.sh
        sfileEncoding
        UTF-8
        slog
        true
        sinterpretationType
        Self
        sattributeTemplate
        false
        schildsAttributeTemplate
        false
        svarScope
        Local
        sisSynchronized
        false
        sthrowException
        true
        suseOtherAction
        false
        screateLocalVarScope
        false
        ssaveReturn
        false
        sdisableGlobalContext
        false
        sdebugLog
        false
        sdescriptors
        xworker.lang.actions.Actions/@CodeGenerator
        sinheritDescription
        false
        sth_createIndex
        false
        sth_registMyChilds
        false
        sth_mark
        false
        sid
        generateSettings2
          @/@actions/@If/@ChildAction/@generateSettings2/@Contents
          sname
          Contents
          sdescriptors
          xworker.core.actions.code.CodeGenerator/@Contents
          sinheritDescription
          false
          sth_createIndex
          false
          sth_registMyChilds
          false
          sth_mark
          false
          sid
          Contents
            @/@actions/@If/@ChildAction/@generateSettings2/@Contents/@FreemarkerContent
            sname
            FreemarkerContent
            scode
            xer.cmd
            sdescriptors
            xworker.core.actions.code.CodeGenerator/@Contents/@FreemarkerContent
            sinheritDescription
            false
            sth_createIndex
            false
            sth_registMyChilds
            false
            sth_mark
            false
            sid
            FreemarkerContent
        @/@actions/@If/@ChildAction/@Log
        sname
        Log
        slevel
        info
        smessage
        porject created
        sinterpretationType
        Self
        sattributeTemplate
        false
        schildsAttributeTemplate
        false
        svarScope
        Local
        sisSynchronized
        false
        sthrowException
        true
        suseOtherAction
        false
        screateLocalVarScope
        false
        ssaveReturn
        false
        sdisableGlobalContext
        false
        sdescriptors
        xworker.lang.actions.Actions/@Log
        sinheritDescription
        false
        sth_createIndex
        false
        sth_registMyChilds
        false
        sth_mark
        false
        sid
        Log
