168 lines
14 KiB
XML
168 lines
14 KiB
XML
<?xml version="1.0" encoding="UTF-8"?><templates><template autoinsert="true" context="javadoc" deleted="false" description="<b></b>" enabled="true" id="org.eclipse.jdt.ui.templates.b_tag" name="<b>"><b>${word_selection}${cursor}</b></template><template autoinsert="true" context="javadoc" deleted="false" description="<code></code>" enabled="true" id="org.eclipse.jdt.ui.templates.code_tag" name="<code>"><code>${word_selection}${cursor}</code></template><template autoinsert="true" context="javadoc" deleted="false" description="<code>null</code>" enabled="true" name="<code>"><code>null</code></template><template autoinsert="true" context="javadoc" deleted="false" description="<i></i>" enabled="true" id="org.eclipse.jdt.ui.templates.i_tag" name="<i>"><i>${word_selection}${cursor}</i></template><template autoinsert="true" context="javadoc" deleted="false" description="<pre></pre>" enabled="true" id="org.eclipse.jdt.ui.templates.pre_tag" name="<pre>"><pre>${word_selection}${cursor}</pre></template><template autoinsert="true" context="javadoc" deleted="false" description="author name" enabled="true" id="org.eclipse.jdt.ui.templates.author" name="@author">@author ${user}</template><template autoinsert="true" context="java" deleted="false" description="Cache Get" enabled="true" name="cache">/**
|
|
* Get ${enclosing_type} from Cache
|
|
* @param ctx context
|
|
* @param _ID id
|
|
* @return ${enclosing_type}
|
|
*/
|
|
public static ${enclosing_type} get (Properties ctx, int _ID)
|
|
{
|
|
Integer key = new Integer (_ID);
|
|
${enclosing_type} retValue = (${enclosing_type})s_cache.get(key);
|
|
if (retValue != null)
|
|
return retValue;
|
|
retValue = new ${enclosing_type} (ctx, _ID, null);
|
|
if (retValue.get_ID() != 0)
|
|
s_cache.put(key, retValue);
|
|
return retValue;
|
|
} // get
|
|
|
|
/** Cache */
|
|
private static CCache<Integer,${enclosing_type}> s_cache = new CCache<Integer,${enclosing_type}>("", 20);</template><template autoinsert="false" context="java" deleted="false" description="dynamic cast" enabled="true" id="org.eclipse.jdt.ui.templates.cast" name="cast">${type} ${new_name} = (${type}) ${name};</template><template autoinsert="false" context="java" deleted="false" description="catch block" enabled="true" id="org.eclipse.jdt.ui.templates.catch" name="catch">catch (${Exception} e) {
|
|
${cursor}// ${todo}: handle exception
|
|
}</template><template autoinsert="true" context="java" deleted="false" description="Adempiere Header" enabled="true" name="Adempiere">/******************************************************************************
|
|
* Product: Adempiere ERP & CRM Smart Business Solution
|
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved.
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms version 2 of the GNU General Public License as published
|
|
* by the Free Software Foundation. This program is distributed in the hope
|
|
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
* See the GNU General Public License for more details.
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
|
* You may reach us at: ComPiere, Inc. - http://www.adempiere.org/license.html
|
|
* 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA or info@adempiere.org
|
|
*****************************************************************************/
|
|
</template><template autoinsert="false" context="java" deleted="false" description="do while statement" enabled="true" id="org.eclipse.jdt.ui.templates.do" name="do">do {
|
|
${line_selection}${cursor}
|
|
} while (${condition});</template><template autoinsert="false" context="java" deleted="false" description="else block" enabled="true" id="org.eclipse.jdt.ui.templates.else" name="else">else {
|
|
${cursor}
|
|
}</template><template autoinsert="false" context="java" deleted="false" description="else if block" enabled="true" id="org.eclipse.jdt.ui.templates.elseif" name="elseif">else if (${condition}) {
|
|
${cursor}
|
|
}</template><template autoinsert="true" context="javadoc" deleted="false" description="<code>false</code>" enabled="true" id="org.eclipse.jdt.ui.templates.code_tag_false" name="false"><code>false</code></template><template autoinsert="false" context="java" deleted="false" description="iterate over array" enabled="true" id="org.eclipse.jdt.ui.templates.for_array" name="for">for (int ${index} = 0; ${index} < ${array}.length; ${index}++) {
|
|
${line_selection}${cursor}
|
|
}</template><template autoinsert="false" context="java" deleted="false" description="iterate over array with temporary variable" enabled="true" id="org.eclipse.jdt.ui.templates.for_temp" name="for">for (int ${index} = 0; ${index} < ${array}.length; ${index}++) {
|
|
${array_type} ${array_element} = ${array}[${index}];
|
|
${cursor}
|
|
}</template><template autoinsert="false" context="java" deleted="false" description="iterate over collection" enabled="true" id="org.eclipse.jdt.ui.templates.for_collection" name="for">for (Iterator ${iterator} = ${collection}.iterator(); ${iterator}.hasNext(); ) {
|
|
${type} ${element} = (${type}) ${iterator}.next();
|
|
${cursor}
|
|
}</template><template autoinsert="false" context="java" deleted="false" description="iterate over an array or Iterable" enabled="true" id="org.eclipse.jdt.ui.templates.for_iterable" name="foreach">for (${iterable_type} ${iterable_element} : ${iterable}) {
|
|
${cursor}
|
|
}</template><template autoinsert="true" context="java" deleted="false" description="Get Lines" enabled="true" name="getLines">/** The Lines */
|
|
private ${array_type}[] m_lines = null;
|
|
|
|
/**
|
|
* Get Lines
|
|
* @param reload reload data
|
|
* @return array of lines
|
|
*/
|
|
public ${array_type}[] getLines (boolean reload)
|
|
{
|
|
if (m_lines != null && !reload)
|
|
return m_lines;
|
|
ArrayList list = new ArrayList();
|
|
${cursor}
|
|
|
|
//
|
|
m_lines = new ${array_type}[list.size()];
|
|
list.toArray(m_lines);
|
|
return m_lines;
|
|
} // getLines
|
|
</template><template autoinsert="false" context="java" deleted="false" description="if statement" enabled="true" id="org.eclipse.jdt.ui.templates.if" name="if">if (${condition}) {
|
|
${line_selection}${cursor}
|
|
}</template><template autoinsert="false" context="java" deleted="false" description="if else statement" enabled="true" id="org.eclipse.jdt.ui.templates.ifelse" name="ifelse">if (${condition}) {
|
|
${cursor}
|
|
} else {
|
|
|
|
}</template><template autoinsert="false" context="java" deleted="false" description="dynamic type test and cast" enabled="true" id="org.eclipse.jdt.ui.templates.instanceof" name="instanceof">if (${name} instanceof ${type}) {
|
|
${type} ${new_name} = (${type})${name};
|
|
${cursor}
|
|
}</template><template autoinsert="true" context="java" deleted="false" description="JDBC Query" enabled="true" name="jdbc">PreparedStatement pstmt = null;
|
|
try
|
|
{
|
|
pstmt = DB.prepareStatement(sql, get_trxName());
|
|
pstmt.setInt(1, x);
|
|
ResultSet rs = pstmt.executeQuery();
|
|
while (rs.next())
|
|
{
|
|
list.add (new XX (ctx, rs, get_trxName()));
|
|
}
|
|
rs.close();
|
|
pstmt.close();
|
|
pstmt = null;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
log.log(Level.SEVERE, sql, e);
|
|
}
|
|
try
|
|
{
|
|
if (pstmt != null)
|
|
pstmt.close();
|
|
pstmt = null;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
pstmt = null;
|
|
}</template><template autoinsert="false" context="java" deleted="false" description="lazy creation" enabled="true" id="org.eclipse.jdt.ui.templates.lazy" name="lazy">if (${name} == null) {
|
|
${name} = new ${type}(${arguments});
|
|
${cursor}
|
|
}
|
|
|
|
return ${name};</template><template autoinsert="true" context="java" deleted="false" description="Create Static" enabled="true" name="Logger">/** Logger */
|
|
private static CLogger log = CLogger.getCLogger(${enclosing_type}.class);
|
|
</template><template autoinsert="false" context="java" deleted="false" description="main method" enabled="true" id="org.eclipse.jdt.ui.templates.main" name="main">public static void main(String[] args) {
|
|
${cursor}
|
|
}</template><template autoinsert="false" context="java" deleted="false" description="create new object" enabled="true" id="org.eclipse.jdt.ui.templates.new" name="new">${type} ${name} = new ${type}(${arguments});</template><template autoinsert="false" context="java" deleted="false" description="non-externalized string marker" enabled="true" id="org.eclipse.jdt.ui.templates.non-nls" name="nls">//$$NON-NLS-${N}$$</template><template autoinsert="true" context="javadoc" deleted="false" description="<code>null</code>" enabled="true" id="org.eclipse.jdt.ui.templates.code_tag_null" name="null"><code>null</code></template><template autoinsert="true" context="java" deleted="false" description="private method" enabled="true" id="org.eclipse.jdt.ui.templates.private_method" name="private_method">private ${return_type} ${name}(${arguments}) {
|
|
${cursor}
|
|
}</template><template autoinsert="true" context="java" deleted="false" description="private static method" enabled="true" id="org.eclipse.jdt.ui.templates.private_static_method" name="private_static_method">private static ${return_type} ${name}(${arguments}) {
|
|
${cursor}
|
|
}</template><template autoinsert="true" context="java" deleted="false" description="protected method" enabled="true" id="org.eclipse.jdt.ui.templates.protected_method" name="protected_method">protected ${return_type} ${name}(${arguments}) {
|
|
${cursor}
|
|
}</template><template autoinsert="true" context="java" deleted="false" description="public method" enabled="true" id="org.eclipse.jdt.ui.templates.public_method" name="public_method">public ${return_type} ${name}(${arguments}) {
|
|
${cursor}
|
|
}</template><template autoinsert="false" context="java" deleted="false" description="runnable" enabled="true" id="org.eclipse.jdt.ui.templates.runnable" name="runnable">new Runnable() {
|
|
public void run() {
|
|
${line_selection}
|
|
}
|
|
}</template><template autoinsert="false" context="java" deleted="false" description="switch case statement" enabled="true" id="org.eclipse.jdt.ui.templates.switch" name="switch">switch (${key}) {
|
|
case ${value}:
|
|
${cursor}
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}</template><template autoinsert="false" context="java" deleted="false" description="synchronized block" enabled="true" id="org.eclipse.jdt.ui.templates.synchronized" name="synchronized">synchronized (${mutex}) {
|
|
${line_selection}
|
|
}</template><template autoinsert="true" context="java" deleted="false" description="print to standard error" enabled="true" id="org.eclipse.jdt.ui.templates.syserr" name="syserr">System.err.println(${word_selection}${cursor});</template><template autoinsert="true" context="java" deleted="false" description="print to standard out" enabled="true" id="org.eclipse.jdt.ui.templates.sysout" name="sysout">System.out.println(${word_selection}${cursor});</template><template autoinsert="true" context="java" deleted="false" description="print current method to standard out" enabled="true" id="org.eclipse.jdt.ui.templates.systrace" name="systrace">System.out.println("${enclosing_type}.${enclosing_method}()");</template><template autoinsert="false" context="java" deleted="false" description="test method" enabled="true" id="org.eclipse.jdt.ui.templates.test" name="test">public void test${name}() throws Exception {
|
|
${cursor}
|
|
}</template><template autoinsert="true" context="java" deleted="false" description="convert collection to array" enabled="true" id="org.eclipse.jdt.ui.templates.toarray" name="toarray">(${type}[]) ${collection}.toArray(new ${type}[${collection}.size()]);</template><template autoinsert="true" context="java" deleted="false" description="Create List & Convert to Array" enabled="true" name="toArray">ArrayList<{enclosing_type}> list = new ArrayList<{enclosing_type}>();
|
|
${cursor}
|
|
${enclosing_type}[] retValue = new ${enclosing_type}[list.size()];
|
|
list.toArray(retValue);
|
|
return retValue;</template><template autoinsert="true" context="java" deleted="false" description="String Representation" enabled="true" name="toString">/**
|
|
* String Representation
|
|
* @return info
|
|
*/
|
|
public String toString()
|
|
{
|
|
StringBuffer sb = new StringBuffer("${enclosing_type}[");
|
|
sb.append(getID())
|
|
.append("-").append(getName())
|
|
.append("]");
|
|
return sb.toString();
|
|
} // toString</template><template autoinsert="true" context="javadoc" deleted="false" description="<code>true</code>" enabled="true" id="org.eclipse.jdt.ui.templates.code_tag_true" name="true"><code>true</code></template><template autoinsert="false" context="java" deleted="false" description="try catch block" enabled="true" id="org.eclipse.jdt.ui.templates.try" name="try">try {
|
|
${line_selection}${cursor}
|
|
} catch (${Exception} e) {
|
|
// ${todo}: handle exception
|
|
}</template><template autoinsert="false" context="java" deleted="false" description="iterate with enumeration" enabled="true" id="org.eclipse.jdt.ui.templates.while_enumeration" name="while">while (${enumeration}.hasMoreElements()) {
|
|
${type} ${element} = (${type}) ${enumeration}.nextElement();
|
|
${cursor}
|
|
}</template><template autoinsert="false" context="java" deleted="false" description="iterate with iterator" enabled="true" id="org.eclipse.jdt.ui.templates.while_iterator" name="while">while (${iterator}.hasNext()) {
|
|
${type} ${element} = (${type}) ${iterator}.next();
|
|
${cursor}
|
|
}</template><template autoinsert="false" context="java" deleted="false" description="while loop with condition" enabled="true" id="org.eclipse.jdt.ui.templates.while_condition" name="while">while (${condition}) {
|
|
${line_selection}${cursor}
|
|
}</template></templates> |