diff options
author | Jean-Baptiste Queru <jbq@google.com> | 2013-01-08 11:11:20 -0800 |
---|---|---|
committer | Jean-Baptiste Queru <jbq@google.com> | 2013-01-08 11:11:20 -0800 |
commit | b56ea2a18f232d79481e778085fd64e8ae486fc3 (patch) | |
tree | 44e1f6eb4864a45033f865b74fe783e3d784dd6a /resources/src/liveTemplates/other.xml | |
download | idea-b56ea2a18f232d79481e778085fd64e8ae486fc3.tar.gz |
Snapshot of commit d5ec1d5018ed24f1b4f32b1d09df6dbd7e2fc425
from branch master of git://git.jetbrains.org/idea/community.git
Diffstat (limited to 'resources/src/liveTemplates/other.xml')
-rw-r--r-- | resources/src/liveTemplates/other.xml | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/resources/src/liveTemplates/other.xml b/resources/src/liveTemplates/other.xml new file mode 100644 index 000000000000..98025efceb01 --- /dev/null +++ b/resources/src/liveTemplates/other.xml @@ -0,0 +1,105 @@ +<?xml version="1.0" encoding="UTF-8"?> +<templateSet group="other"> + <template resource-bundle="messages.CodeInsightBundle" key="livetemplate.description.inst" + name="inst" toReformat="true" toShortenFQNames="true" value="if ($EXPR$ instanceof $TYPE$) { $TYPE$ $VAR1$ = ($TYPE$)$EXPR$; $END$ }"> + <variable alwaysStopAt="true" defaultValue="expr" expression="variableOfType("Object")" name="EXPR" /> + <variable alwaysStopAt="true" defaultValue="" expression=""Object"" name="TYPE" /> + <variable alwaysStopAt="true" defaultValue="" expression="suggestVariableName()" name="VAR1" /> + <context> + <option name="JAVA_CODE" value="false" /> + <option name="JAVA_STATEMENT" value="true" /> + <option name="GROOVY" value="false" /> + <option name="GROOVY_STATEMENT" value="true" /> + </context> + </template> + <template resource-bundle="messages.CodeInsightBundle" key="livetemplate.description.lst" + name="lst" toReformat="true" toShortenFQNames="true" value="$ARRAY$[$ARRAY$.length - 1]"> + <variable alwaysStopAt="true" defaultValue="array" expression="arrayVariable()" name="ARRAY" /> + <context> + <option name="JAVA_CODE" value="false" /> + <option name="JAVA_EXPRESSION" value="true" /> + <option name="GROOVY" value="false" /> + <option name="GROOVY_EXPRESSION" value="true" /> + </context> + </template> + <template resource-bundle="messages.CodeInsightBundle" key="livetemplate.description.mn" + name="mn" toReformat="true" toShortenFQNames="true" value="$VAR$ = Math.min($VAR$, $END$);"> + <variable alwaysStopAt="true" defaultValue="" expression="variableOfType("double")" name="VAR" /> + <context> + <option name="JAVA_CODE" value="false" /> + <option name="JAVA_STATEMENT" value="true" /> + <option name="GROOVY" value="false" /> + <option name="GROOVY_STATEMENT" value="true" /> + </context> + </template> + <template resource-bundle="messages.CodeInsightBundle" key="livetemplate.description.mx" + name="mx" toReformat="true" toShortenFQNames="true" value="$VAR$ = Math.max($VAR$, $END$);"> + <variable alwaysStopAt="true" defaultValue="" expression="variableOfType("double")" name="VAR" /> + <context> + <option name="JAVA_CODE" value="false" /> + <option name="JAVA_STATEMENT" value="true" /> + <option name="GROOVY" value="false" /> + <option name="GROOVY_STATEMENT" value="true" /> + </context> + </template> + <template resource-bundle="messages.CodeInsightBundle" key="livetemplate.description.psvm" + name="psvm" toReformat="true" toShortenFQNames="true" value="public static void main(String[] args){ $END$ }"> + <context> + <option name="JAVA_CODE" value="false" /> + <option name="JAVA_DECLARATION" value="true" /> + <option name="GROOVY" value="false" /> + <option name="GROOVY_DECLARATION" value="true" /> + </context> + </template> + <template resource-bundle="messages.CodeInsightBundle" key="livetemplate.description.toar" + name="toar" toReformat="true" toShortenFQNames="true" value="$COLLECTION$.toArray(new $COMPONENT_TYPE$[$COLLECTION$.size()])$END$"> + <variable alwaysStopAt="true" defaultValue=""Object"" expression="componentTypeOf(expectedType())" name="COMPONENT_TYPE" /> + <variable alwaysStopAt="true" defaultValue="collection" expression="variableOfType("java.util.Collection")" name="COLLECTION" /> + <context> + <option name="JAVA_CODE" value="false" /> + <option name="JAVA_EXPRESSION" value="true" /> + </context> + </template> + <template resource-bundle="messages.CodeInsightBundle" key="livetemplate.description.lazy" + name="lazy" value="if ($VAR$ == null) { $VAR$ = new $TYPE$($END$); }" toReformat="true" toShortenFQNames="true"> + <variable name="VAR" expression="variableOfType("java.lang.Object")" defaultValue="" alwaysStopAt="true" /> + <variable name="TYPE" expression="subtypes(typeOfVariable(VAR))" defaultValue="" alwaysStopAt="true" /> + <context> + <option name="JAVA_CODE" value="false" /> + <option name="JAVA_STATEMENT" value="true" /> + <option name="GROOVY" value="false" /> + <option name="GROOVY_STATEMENT" value="true" /> + </context> + </template> + <template resource-bundle="messages.CodeInsightBundle" key="livetemplate.description.if.not.null" + name="inn" value="if ($VAR$ != null) { $END$ }" toReformat="true" toShortenFQNames="true"> + <variable name="VAR" expression="suggestFirstVariableName("Object")" defaultValue="var" alwaysStopAt="true" /> + <context> + <option name="JAVA_CODE" value="false" /> + <option name="JAVA_STATEMENT" value="true" /> + <option name="GROOVY" value="false" /> + <option name="GROOVY_STATEMENT" value="true" /> + </context> + </template> + <template resource-bundle="messages.CodeInsightBundle" key="livetemplate.description.if.null" + name="ifn" value="if ($VAR$ == null) { $END$ }" toReformat="true" toShortenFQNames="true"> + <variable name="VAR" expression="suggestFirstVariableName("Object")" defaultValue="var" alwaysStopAt="true" /> + <context> + <option name="JAVA_CODE" value="false" /> + <option name="JAVA_STATEMENT" value="true" /> + <option name="GROOVY" value="false" /> + <option name="GROOVY_STATEMENT" value="true" /> + </context> + </template> + <template resource-bundle="messages.CodeInsightBundle" key="livetemplate.description.geti" + name="geti" toReformat="true" toShortenFQNames="true" value="public static $CLASS_NAME$ getInstance() { return $VALUE$; }"> + <variable name="CLASS_NAME" expression="className" defaultValue="" alwaysStopAt="false"/> + <variable name="VALUE" expression="variableOfType(CLASS_NAME)" defaultValue="null" alwaysStopAt="true"/> + <context> + <option name="JAVA_CODE" value="false" /> + <option name="JAVA_DECLARATION" value="true" /> + <option name="GROOVY" value="false" /> + <option name="GROOVY_DECLARATION" value="true" /> + </context> + </template> +</templateSet> |