summaryrefslogtreecommitdiff
path: root/resources/src/liveTemplates/other.xml
blob: 98025efceb0121dc4444f26d3831b4a614b6ff0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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$) {&#13;&#10;  $TYPE$ $VAR1$ = ($TYPE$)$EXPR$;&#13;&#10;  $END$&#13;&#10;}">
    <variable alwaysStopAt="true" defaultValue="expr" expression="variableOfType(&quot;Object&quot;)" name="EXPR" />
    <variable alwaysStopAt="true" defaultValue="" expression="&quot;Object&quot;" 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(&quot;double&quot;)" 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(&quot;double&quot;)" 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){&#13;&#10;  $END$&#13;&#10;}">
    <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="&quot;Object&quot;" expression="componentTypeOf(expectedType())" name="COMPONENT_TYPE" />
    <variable alwaysStopAt="true" defaultValue="collection" expression="variableOfType(&quot;java.util.Collection&quot;)" 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) {&#10;  $VAR$ = new $TYPE$($END$);&#10;}" toReformat="true" toShortenFQNames="true">
    <variable name="VAR" expression="variableOfType(&quot;java.lang.Object&quot;)" 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) {&#10;$END$&#10;}" toReformat="true" toShortenFQNames="true">
    <variable name="VAR" expression="suggestFirstVariableName(&quot;Object&quot;)" 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) {&#10;$END$&#10;}" toReformat="true" toShortenFQNames="true">
    <variable name="VAR" expression="suggestFirstVariableName(&quot;Object&quot;)" 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() {&#13;&#10;  return $VALUE$;&#13;&#10;}">
    <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>