Skip to content

Instantly share code, notes, and snippets.

@jmfayard
Created February 2, 2015 17:01
Show Gist options
  • Save jmfayard/d7c0f5ac1b784272a7ce to your computer and use it in GitHub Desktop.
Save jmfayard/d7c0f5ac1b784272a7ce to your computer and use it in GitHub Desktop.
intellij14 live templates
<templateSet group="jmfayard">
<template name="key" value="private static final String KEY_$value$ = &quot;$value$&quot;;" description="Key for a bundle" toReformat="false" toShortenFQNames="true">
<variable name="value" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_DECLARATION" value="true" />
</context>
</template>
<template name="logd" value="private final org.apache.log4j.Logger _log = org.apache.log4j.Logger.getLogger(&quot;$class$&quot;);" description="Declaration with log4j" toReformat="true" toShortenFQNames="true">
<variable name="class" expression="className()" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_DECLARATION" value="true" />
</context>
</template>
<template name="logm" value="_log.info(&quot;$class$ &gt; $method$&quot;);&#10;_log.info(&quot;Params: &quot; + $params$);" description="log the current function" toReformat="true" toShortenFQNames="true">
<variable name="class" expression="className()" defaultValue="" alwaysStopAt="false" />
<variable name="method" expression="methodName()" defaultValue="" alwaysStopAt="false" />
<variable name="params" expression="groovyScript(&quot;'\&quot;' + _1.collect { it + ' = [\&quot; + ' + it + ' + \&quot;]'}.join(', ') + '\&quot;'&quot;, methodParameters()) " defaultValue="" alwaysStopAt="false" />
<context>
<option name="JAVA_EXPRESSION" value="true" />
</context>
</template>
<template name="logr" value="_log.info(&quot;Result: &quot; + $result$);" description="log the result of the current function" toReformat="true" toShortenFQNames="true">
<variable name="result" expression="" defaultValue="result" alwaysStopAt="true" />
<context>
<option name="JAVA_EXPRESSION" value="true" />
</context>
</template>
</templateSet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment