Skip to content

Instantly share code, notes, and snippets.

@sleroy

sleroy/templates.xml

Created Nov 10, 2015
Embed
What would you like to do?
My Java Code templates for Eclipse
<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><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="javadoc" deleted="false" description="&lt;b&gt;&lt;/b&gt;" enabled="true" id="org.eclipse.jdt.ui.templates.b_tag" name="&lt;b&gt;">&lt;b&gt;${word_selection}${}&lt;/b&gt;${cursor}</template><template autoinsert="true" context="javadoc" deleted="false" description="&lt;code&gt;&lt;/code&gt;" enabled="true" id="org.eclipse.jdt.ui.templates.code_tag" name="&lt;code&gt;">&lt;code&gt;${word_selection}${}&lt;/code&gt;${cursor}</template><template autoinsert="true" context="javadoc" deleted="false" description="&lt;i&gt;&lt;/i&gt;" enabled="true" id="org.eclipse.jdt.ui.templates.i_tag" name="&lt;i&gt;">&lt;i&gt;${word_selection}${}&lt;/i&gt;${cursor}</template><template autoinsert="true" context="javadoc" deleted="false" description="&lt;pre&gt;&lt;/pre&gt;" enabled="true" id="org.eclipse.jdt.ui.templates.pre_tag" name="&lt;pre&gt;">&lt;pre&gt;${word_selection}${}&lt;/pre&gt;${cursor}</template><template autoinsert="true" context="java-members" deleted="false" description="Insert @After method" enabled="true" id="junit.extensions.eclipse.quick.after" name="A">@${testType:newType(org.junit.After)}
public void ${after}() throws Exception {
${cursor}
}</template><template autoinsert="true" context="java-members" deleted="false" description="Insert @AfterClass method (Quick JUnit)" enabled="true" id="junit.extensions.eclipse.quick.afterClass" name="AC">@${testType:newType(org.junit.AfterClass)}
public static void ${afterClass}() throws Exception {
${cursor}
}</template><template autoinsert="true" context="javadoc" deleted="false" description="active task" enabled="true" id="org.eclipse.mylyn.ide.ui.template.activeTask" name="active_task">${activeTaskPrefix}${activeTaskKey}</template><template autoinsert="false" context="swt-statements" deleted="false" description="add a listener to a Widget " enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.addlistener" name="addlistener">${control:var(org.eclipse.swt.widgets.Widget)}.addListener(${type:link(
SWT.Activate,
SWT.Arm,
SWT.Close,
SWT.Collapse,
SWT.Deactivate,
SWT.DefaultSelection,
SWT.Deiconify,
SWT.Dispose,
SWT.DragDetect,
SWT.EraseItem,
SWT.Expand,
SWT.FocusIn,
SWT.FocusOut,
SWT.HardKeyDown,
SWT.HardKeyUp,
SWT.Help,
SWT.Hide,
SWT.Iconify,
SWT.ImeComposition,
SWT.KeyDown,
SWT.KeyUp,
SWT.MeasureItem,
SWT.MenuDetect,
SWT.Modify,
SWT.MouseDoubleClick,
SWT.MouseDown,
SWT.MouseEnter,
SWT.MouseExit,
SWT.MouseHover,
SWT.MouseMove,
SWT.MouseUp,
SWT.MouseWheel,
SWT.Move,
SWT.Paint,
SWT.PaintItem,
SWT.Resize,
SWT.Selection,
SWT.SetData,
SWT.Settings,
SWT.Show,
SWT.Traverse,
SWT.Verify)}, new ${listener:newType(org.eclipse.swt.widgets.Listener)}(){
public void handleEvent(${event:newType(org.eclipse.swt.widgets.Event)} e) {
${imp:import(org.eclipse.swt.SWT)}${cursor}
}
});</template><template autoinsert="true" context="aspectj" deleted="false" description="adviceexecution pointcut (AspectJ)" enabled="true" name="adviceexecution">adviceexecution()</template><template autoinsert="true" context="java-members" deleted="false" description="junit after method" enabled="true" name="after">${:import (org.junit.After)}&#13;
@After&#13;
public void tearDown() {&#13;
${cursor}&#13;
}</template><template autoinsert="true" context="aspectj" deleted="false" description="after returning advice (AspectJ)" enabled="true" name="after_returning">after(${args}) returning() : ${pointcut_expression} {}</template><template autoinsert="true" context="aspectj" deleted="false" description="after throwing advice (AspectJ)" enabled="true" name="after_throwing">after(${args}) throwing() : ${pointcut_expression} {}</template><template autoinsert="true" context="java-members" deleted="false" description="junit afterclass method" enabled="true" name="afterclass">${:import (org.junit.AfterClass)}&#13;
@AfterClass&#13;
public static void oneTimeTearDown() {&#13;
// one-time cleanup code&#13;
${cursor}&#13;
}</template><template autoinsert="true" context="aspectj" deleted="false" description="around advice (AspectJ)" enabled="true" name="around">around(${args}) : ${pointcut_expression} {}</template><template autoinsert="false" context="java-statements" deleted="false" description="Creates an String array with test data" enabled="true" id="org.eclipse.jdt.ui.templates.arrayexample" name="array-string-with-test-data">
String[] ${myvar:newName(values)} =
new String[]{"Windows 7", "MacOS", "Debian", "Ubuntu", "Redhat",
"Android", "iPhone", "Suse", "Windows XP", "Windows Mobile", "OS/2",
"WebOS"};
</template><template autoinsert="false" context="java-statements" deleted="false" description="creates default ArrayAdaper" enabled="true" id="org.eclipse.jdt.ui.templates.arrayadaper" name="arrayadaper">
ArrayAdapter adapter = new ArrayAdapter(this,
android.R.layout.simple_list_item_1, values);
</template><template autoinsert="false" context="java-statements" deleted="false" description="add an element to an array" enabled="true" id="org.eclipse.jdt.ui.templates.arrayadd" name="arrayadd">${array_type}[] ${result:newName(array)} = new ${array_type}[${array}.length + 1];
System.arraycopy(${array}, 0, ${result}, 0, ${array}.length);
${result}[${array}.length]= ${var};</template><template autoinsert="false" context="java-statements" deleted="false" description="merge two arrays into one" enabled="true" id="org.eclipse.jdt.ui.templates.arraymerge" name="arraymerge">${array_type}[] ${result:newName(array1)} = new ${array_type}[${array1:array}.length + ${array}.length];
System.arraycopy(${array1}, 0, ${result}, 0, ${array1}.length);
System.arraycopy(${array}, 0, ${result}, ${array1}.length, ${array}.length);</template><template autoinsert="true" context="java-statements" deleted="false" description="Insert assertThat method (Quick JUnit)" enabled="true" id="junit.extensions.eclipse.quick.template.assertThat" name="AT">${junit:importStatic('org.junit.Assert.assertThat')}assertThat(${:localVar(java.lang.Object)}${cursor},${hamcrest:importStatic('org.hamcrest.CoreMatchers.is')}is(${expected}));</template><template autoinsert="true" context="java-members" deleted="false" description="Insert @Before method (Quick JUnit)" enabled="true" id="junit.extensions.eclipse.quick.before" name="B">@${testType:newType(org.junit.Before)}
public void ${before}() throws Exception {
${cursor}
}</template><template autoinsert="true" context="java-members" deleted="false" description="Insert @BeforeClass method (Quick JUnit)" enabled="true" id="junit.extensions.eclipse.quick.template.beforeClass" name="BC">@${testType:newType(org.junit.BeforeClass)}
public static void ${beforeClass}() throws Exception {
${cursor}
}</template><template autoinsert="true" context="java-members" deleted="false" description="Stub out a new @Bean method" enabled="true" id="org.springframework.ide.eclipse.beans.ui.editor.templates.contextType.beanMethod" name="beanmethod">${x:import(org.springframework.context.annotation.Bean)}@Bean
public ${bean_type} ${bean_name}() {
// TODO Auto generated method stub
${cursor}return null;
}</template><template autoinsert="true" context="aspectj" deleted="false" description="before advice (AspectJ)" enabled="true" name="before">before(${args}) : ${pointcut_expression} {}</template><template autoinsert="true" context="java-members" deleted="false" description="junit before method" enabled="true" name="before">${:import (org.junit.Before)}&#13;
@Before&#13;
public void setUp() {&#13;
${cursor}&#13;
}</template><template autoinsert="true" context="java-members" deleted="false" description="junit beforeclass method" enabled="true" name="beforeclass">${:import (org.junit.BeforeClass)}&#13;
@BeforeClass&#13;
public static void oneTimeSetUp() {&#13;
// one-time initialization code&#13;
${cursor}&#13;
}</template><template autoinsert="false" context="swt-statements" deleted="false" description="new Browser" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.browser" name="Browser">${browserType:newType(org.eclipse.swt.browser.Browser)} ${browser:newName(org.eclipse.swt.browser.Browser)}= new ${browserType}(${parent:var(org.eclipse.swt.widgets.Composite)}, ${style:link(SWT.NONE, SWT.MOZILLA)});
${browser}.setLayoutData(new ${gridDataType:newType(org.eclipse.swt.layout.GridData)}(SWT.${horizontal:link(FILL, BEGINNING, CENTER, END)}, SWT.${vertical:link(FILL, TOP, CENTER, BOTTOM)}, ${hex:link(true, false)}, ${vex:link(true, false)}));
${browser}.setUrl(${word_selection}${});
${imp:import(org.eclipse.swt.SWT)}${cursor}</template><template autoinsert="false" context="swt-statements" deleted="false" description="new Button" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.button" name="Button">${buttonType:newType(org.eclipse.swt.widgets.Button)} ${button:newName(org.eclipse.swt.widgets.Button)}= new ${buttonType}(${parent:var(org.eclipse.swt.widgets.Composite)}, ${style:link(SWT.PUSH, SWT.TOGGLE, SWT.RADIO, SWT.CHECK, SWT.FLAT)});
${button}.setLayoutData(new ${type:newType(org.eclipse.swt.layout.GridData)}(SWT.${horizontal:link(BEGINNING, CENTER, END, FILL)}, SWT.${vertical:link(CENTER, TOP, BOTTOM, FILL)}, ${hex:link(false, true)}, ${vex:link(false, true)}));
${button}.setText(${word_selection}${});
${button}.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
${listener:link('')}
}
});
${imp:import(org.eclipse.swt.SWT, org.eclipse.swt.events.SelectionAdapter, org.eclipse.swt.events.SelectionEvent)}${cursor}</template><template autoinsert="true" context="aspectj" deleted="false" description="call constructor pointcut (AspectJ)" enabled="true" name="call_cons">call(${modifier_pattern} ${type_pattern}.new(..))</template><template autoinsert="true" context="aspectj" deleted="false" description="call method declaration (AspectJ)" enabled="true" name="call_method">call(${modifiers_pattern} ${ret_type_pattern} ${type_pattern}.${id_pattern}(..))</template><template autoinsert="false" context="java-statements" 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-statements" deleted="false" description="catch block" enabled="true" id="org.eclipse.jdt.ui.templates.catch" name="catch">catch (${Exception} ${exception_variable_name}) {
${cursor}// ${todo}: handle exception
}</template><template autoinsert="true" context="aspectj" deleted="false" description="cflow pointcut (AspectJ)" enabled="true" name="cflow">cflow(${pointcut_expression})</template><template autoinsert="true" context="aspectj" deleted="false" description="cflowbelow pointcut (AspectJ)" enabled="true" name="cflowbelow">cflowbelow(${pointcut_expression})</template><template autoinsert="false" context="swt-statements" deleted="false" description="new Combo" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.combo" name="Combo">${comboType:newType(org.eclipse.swt.widgets.Combo)} ${combo:newName(org.eclipse.swt.widgets.Combo)}= new ${comboType}(${parent:var(org.eclipse.swt.widgets.Composite)}, ${style:link(SWT.DROP_DOWN, 'SWT.DROP_DOWN | SWT.READ_ONLY')});
${combo}.setLayoutData(new ${gridDataType:newType(org.eclipse.swt.layout.GridData)}(SWT.${horizontal:link(FILL, BEGINNING, CENTER, END)}, SWT.${vertical:link(CENTER, TOP, BOTTOM, FILL)}, ${hex:link(true, false)}, ${vex:link(false, true)}));
${combo}.setItems(${word_selection}${});
${imp:import(org.eclipse.swt.SWT)}${cursor}</template><template autoinsert="false" context="swt-statements" deleted="false" description="new Composite with GridLayout" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.gridcomposite" name="Composite">${compositeType:newType(org.eclipse.swt.widgets.Composite)} ${composite:newName(org.eclipse.swt.widgets.Composite)}= new ${compositeType}(${parent:var(org.eclipse.swt.widgets.Composite)}, ${style:link(SWT.NONE, SWT.BORDER)});
${composite}.setLayoutData(new ${gridDataType:newType(org.eclipse.swt.layout.GridData)}(SWT.${horizontal:link(FILL, BEGINNING, CENTER, END)}, SWT.${vertical:link(FILL, TOP, CENTER, BOTTOM)}, ${hex:link(true, false)}, ${vex:link(true, false)}));
${composite}.setLayout(new ${layoutType:newType(org.eclipse.swt.layout.GridLayout)}(${numberColumns:link(1, 2, 3, 4, 5)}, ${equalColumns:link(false, true)}));
${imp:import(org.eclipse.swt.SWT)}${cursor}</template><template autoinsert="true" context="java" deleted="false" description="" enabled="true" name="const">private static final ${type} ${name} = new ${type} ${cursor};</template><template autoinsert="false" context="swt-statements" deleted="false" description="new DateTime" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.datetime" name="DateTime">${dateType:newType(org.eclipse.swt.widgets.DateTime)} ${dateTime:newName(org.eclipse.swt.widgets.DateTime)}= new ${dateType}(${parent:var(org.eclipse.swt.widgets.Composite)}, ${style:link('SWT.CALENDAR | SWT.SHORT', 'SWT.CALENDAR | SWT.MEDIUM', 'SWT.CALENDAR | SWT.LONG', 'SWT.TIME | SWT.SHORT', 'SWT.TIME | SWT.MEDIUM', 'SWT.TIME | SWT.LONG', 'SWT.DATE | SWT.SHORT', 'SWT.DATE | SWT.MEDIUM', 'SWT.DATE | SWT.LONG')});
${dateTime}.setLayoutData(new ${gridDataType:newType(org.eclipse.swt.layout.GridData)}(SWT.${horizontal:link(FILL, BEGINNING, CENTER, END)}, SWT.${vertical:link(FILL, TOP, CENTER, BOTTOM)}, ${hex:link(true, false)}, ${vex:link(true, false)}));
${imp:import(org.eclipse.swt.SWT)}${cursor}</template><template autoinsert="true" context="aspectj" deleted="false" description="declare error (AspectJ)" enabled="true" name="dece">declare error : ${pointcut_expression} : "";</template><template autoinsert="true" context="aspectj" deleted="false" description="declare parents (AspectJ)" enabled="true" name="decp_extends">declare parents : ${type_pattern} extends ${type};</template><template autoinsert="true" context="aspectj" deleted="false" description="declare parents (AspectJ)" enabled="true" name="decp_implements">declare parents : ${type_pattern} implements ${type};</template><template autoinsert="true" context="aspectj" deleted="false" description="declare soft (AspectJ)" enabled="true" name="decs">declare soft : ${exception_type} : ${pointcut_expression};</template><template autoinsert="true" context="aspectj" deleted="false" description="declare warning (AspectJ)" enabled="true" name="decw">declare warning : ${pointcut_expression} : "";</template><template autoinsert="false" context="java-statements" deleted="false" description="do while statement" enabled="true" id="org.eclipse.jdt.ui.templates.do" name="do">do {
${line_selection}${cursor}
} while (${condition:var(boolean)});</template><template autoinsert="false" context="java-statements" deleted="false" description="else block" enabled="true" id="org.eclipse.jdt.ui.templates.else" name="else">else {
${cursor}
}</template><template autoinsert="false" context="java-statements" deleted="false" description="else if block" enabled="true" id="org.eclipse.jdt.ui.templates.elseif" name="elseif">else if (${condition:var(boolean)}) {
${cursor}
}</template><template autoinsert="true" context="java-members" deleted="false" description="Exception handling method" enabled="true" id="com.springsource.sts.quickfix.exceptionHandler" name="ExceptionHandler method">${:import(org.springframework.web.bind.annotation.ExceptionHandler)}@ExceptionHandler(${Exception}.class)
public ${void} ${handleException}(${Exception} ${exception}) {
${line_selection}${cursor}
}</template><template autoinsert="false" context="swt-statements" deleted="false" description="execute a runnable in the UI thread" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.execute" name="execute">${display:var(org.eclipse.swt.widgets.Display)}.${kind:link(syncExec, asyncExec)}(new ${runnable:newType(java.lang.Runnable)}(){
public void run(){
${cursor}
}
});</template><template autoinsert="true" context="aspectj" deleted="false" description="execution of a constructor pointcut (AspectJ)" enabled="true" name="execution_cons">execution(${modifier_pattern} ${type_pattern}.new(..))</template><template autoinsert="true" context="aspectj" deleted="false" description="execution of a method pointcut (AspectJ)" enabled="true" name="execution_method">execution(${modifier_pattern} ${ret_type_pattern} ${type_pattern}.${id_pattern}(..))</template><template autoinsert="false" context="swt-statements" deleted="false" description="new ExpandBar" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.expandbar" name="ExpandBar">${type:newType(org.eclipse.swt.widgets.ExpandBar)} ${bar:newName(org.eclipse.swt.widgets.ExpandBar)}= new ${type}(${parent:var(org.eclipse.swt.widgets.Composite)}, ${style:link(SWT.V_SCROLL, SWT.NONE)});
${bar}.setLayoutData(new ${gridDataType:newType(org.eclipse.swt.layout.GridData)}(SWT.${horizontal:link(FILL, BEGINNING, CENTER, END)}, SWT.${vertical:link(FILL, TOP, CENTER, BOTTOM)}, ${hex:link(true, false)}, ${vex:link(true, false)}));
${imp:import(org.eclipse.swt.SWT)}${cursor}</template><template autoinsert="false" context="swt-statements" deleted="false" description="new ExpandItem for an ExpandBar" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.expanditem" name="ExpandItem">${type:newType(org.eclipse.swt.widgets.ExpandItem)} ${item:newName(org.eclipse.swt.widgets.ExpandItem)}= new ${type}(${parent:var(org.eclipse.swt.widgets.ExpandBar)}, SWT.NONE);
${item}.setText(${word_selection}${});
${imp:import(org.eclipse.swt.SWT)}${cursor}
${item}.setControl(${control});
${item}.setHeight(${control}.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);</template><template autoinsert="false" context="java-statements" deleted="false" description="$FALL-THROUGH$ marker" enabled="true" id="org.eclipse.jdt.ui.templates.fall-through" name="fall-through">//$$FALL-THROUGH$$</template><template autoinsert="true" context="javadoc" deleted="false" description="&lt;code&gt;false&lt;/code&gt;" enabled="true" id="org.eclipse.jdt.ui.templates.code_tag_false" name="false">&lt;code&gt;false&lt;/code&gt;</template><template autoinsert="false" context="java-statements" deleted="false" description="finally block" enabled="true" id="org.eclipse.jdt.ui.templates.finally" name="finally">finally {
${cursor}
}</template><template autoinsert="false" context="java-statements" deleted="false" description="Creates the finally block for closing a stream" enabled="true" id="org.eclipse.jdt.ui.templates.finallyclosestream" name="finallyCloseStream">
finally {
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
</template><template autoinsert="false" context="java-statements" deleted="false" description="findviewbyiD" enabled="true" id="org.eclipse.jdt.ui.templates.android.findviewbyid_list" name="findViewById">
${viewtype:link(EditText, ImageView, Button)} ${myvar:newName(view)} = (${viewtype:link(EditText, ImageView, Button)}) findViewById(R.id.${cursor});
</template><template autoinsert="false" context="java-statements" deleted="false" description="findView by ID for Button" enabled="true" id="org.eclipse.jdt.ui.templates.android.findviewbyidbutton" name="findViewById - Button">
${type:newType(android.view.Button)} ${myvar:newName(button)} = (Button) findViewById(R.id.${cursor});
</template><template autoinsert="false" context="java-statements" deleted="false" description="findView by ID for EditText" enabled="true" id="org.eclipse.jdt.ui.templates.android.findviewbyidedittext" name="findViewById - EditText">
${type:newType(android.view.EditText)} ${myvar:newName(editText)} = (EditText) findViewById(R.id.${cursor});
String s = ${myvar:newName(editText)}.getText().toString();
</template><template autoinsert="false" context="java-statements" deleted="false" description="findView by ID for TextView" enabled="true" id="org.eclipse.jdt.ui.templates.android.findviewbyidtextview" name="findViewById - TextView">
${type:newType(android.view.TextView)} ${myvar:newName(textView)} = (TextView) findViewById(R.id.${cursor});
${myvar:newName(textView)}.setText("");
</template><template autoinsert="false" context="java-statements" deleted="false" description="findViewById" enabled="true" id="org.eclipse.jdt.ui.templates.android.findviewbyid" name="findViewById - View">
${type:newType(android.view.TextView)} ${myvar:newName(textView)} = (TextView) findViewById(R.id.${cursor});
</template><template autoinsert="false" context="java-statements" deleted="false" description="iterate over array" enabled="true" id="org.eclipse.jdt.ui.templates.for_array" name="for">for (int ${index} = 0; ${index} &lt; ${array}.length; ${index}++) {
${line_selection}${cursor}
}</template><template autoinsert="false" context="java-statements" 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} &lt; ${array}.length; ${index}++) {
${array_type} ${array_element} = ${array}[${index}];
${cursor}
}</template><template autoinsert="false" context="java-statements" deleted="false" description="iterate over collection" enabled="true" id="org.eclipse.jdt.ui.templates.for_collection" name="for">for (${iteratorType:newType(java.util.Iterator)} ${iterator} = ${collection}.iterator(); ${iterator}.hasNext(); ) {
${type:elemType(collection)} ${name:newName(type)} = (${type}) ${iterator}.next();
${cursor}
}</template><template autoinsert="true" context="java-statements" deleted="false" description="iterate over map" enabled="true" name="for">${:import(java.util.Map.Entry)}&#13;
for(Entry&lt;${key:argType(map,0)},${value:argType(map,1)}&gt; entry :&#13;
${map:var(java.util.Map)}.entrySet()) {&#13;
${key} key = entry.getKey();&#13;
${value} value = entry.getValue();&#13;
${cursor}&#13;
}</template><template autoinsert="false" context="java-statements" 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="aspectj" deleted="false" description="get pointcut (AspectJ)" enabled="true" name="get">get(${modifier_pattern} ${ret_type_pattern} ${type_pattern}.${id_pattern})</template><template autoinsert="true" context="java-members" deleted="false" description="GET HTTP method" enabled="true" id="com.springsource.sts.quickfix.getHandler" name="GET method">${x:import(org.springframework.web.bind.annotation.RequestMapping, org.springframework.web.bind.annotation.RequestMethod)}@RequestMapping(value="${cursor}${path}", method = RequestMethod.GET)
public ${String} ${get}(${Object} ${model}) {
// TODO Auto generated method stub
return null;
}</template><template autoinsert="false" context="swt-statements" deleted="false" description="new GridData for a Control" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.griddata" name="GridData">${gridData:newType(org.eclipse.swt.layout.GridData)} ${layoutData:newName(org.eclipse.swt.layout.GridData)} = new ${gridData}(SWT.${horizontal:link(FILL, BEGINNING, CENTER, END)}, SWT.${vertical:link(FILL, TOP, CENTER, BOTTOM)}, ${hex:link(true, false)}, ${vex:link(false, true)});
${layoutData}.widthHint= ${width:link(SWT.DEFAULT)};
${layoutData}.heightHint= ${height:link(SWT.DEFAULT)};
${parent:var(org.eclipse.swt.widgets.Control)}.setLayoutData(${layoutData});
${imp:import(org.eclipse.swt.SWT)}${cursor}</template><template autoinsert="false" context="swt-statements" deleted="false" description="new GridLayout for a Composites" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.gridlayout" name="GridLayout">${gridLayout:newType(org.eclipse.swt.layout.GridLayout)} ${layout:newName(org.eclipse.swt.layout.GridLayout)} = new ${gridLayout}(${columns:link(1, 2, 3, 4, 5)}, ${width:link(false, true)});
${layout}.marginWidth = ${marginW:link(5, 0)};
${layout}.marginHeight = ${marginH:link(5, 0)};
${layout}.verticalSpacing = ${vSpacing:link(0, 5)};
${layout}.horizontalSpacing = ${hSpacing:link(0, 5)};
${parent:var(org.eclipse.swt.widgets.Composite)}.setLayout(${layout});
${cursor}</template><template autoinsert="false" context="swt-statements" deleted="false" description="new Group with GridLayout" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.group" name="Group">${groupType:newType(org.eclipse.swt.widgets.Group)} ${group:newName(org.eclipse.swt.widgets.Group)}= new ${groupType}(${parent:var(org.eclipse.swt.widgets.Composite)}, ${style:link(SWT.NONE, SWT.SHADOW_ETCHED_IN, SWT.SHADOW_ETCHED_OUT, SWT.SHADOW_IN, SWT.SHADOW_OUT, SWT.SHADOW_NONE)});
${group}.setLayoutData(new ${gridDataType:newType(org.eclipse.swt.layout.GridData)}(SWT.${horizontal:link(FILL, BEGINNING, CENTER, END)}, SWT.${vertical:link(FILL, TOP, CENTER, BOTTOM)}, ${hex:link(true, false)}, ${vex:link(false, true)}));
${group}.setLayout(new ${layoutType:newType(org.eclipse.swt.layout.GridLayout)}(${numberColumns:link(1, 2, 3, 4, 5)}, ${equalColumns:link(false, true)}));
${group}.setText(${word_selection}${});
${imp:import(org.eclipse.swt.SWT)}${cursor}</template><template autoinsert="true" context="aspectj" deleted="false" description="handler pointcut (AspectJ)" enabled="true" name="handler">handler(${type_pattern})</template><template autoinsert="false" context="java-statements" deleted="false" description="if statement" enabled="true" id="org.eclipse.jdt.ui.templates.if" name="if">if (${condition:var(boolean)}) {
${line_selection}${cursor}
}</template><template autoinsert="true" context="java-statements" deleted="false" description="if not null" enabled="true" name="if">if (${var} != null){&#13;
${cursor}&#13;
}&#13;
</template><template autoinsert="true" context="java-statements" deleted="false" description="if null" enabled="true" name="if">if (${var} == null){&#13;
${cursor}&#13;
}&#13;
</template><template autoinsert="false" context="java-statements" deleted="false" description="if else statement" enabled="true" id="org.eclipse.jdt.ui.templates.ifelse" name="ifelse">if (${condition:var(boolean)}) {
${cursor}
} else {
}</template><template autoinsert="false" context="java-statements" deleted="false" description="If not null" enabled="true" id="org.eclipse.jdt.ui.templates.ifnotnull" name="ifnotnull">
if (${myvar:newName(variable)}!=null) {
${cursor}
}
</template><template autoinsert="false" context="java-statements" deleted="false" description="If null" enabled="true" id="org.eclipse.jdt.ui.templates.iftnull" name="ifnull">
if (${myvar:newName(variable)}==null) {
${cursor}
}
</template><template autoinsert="true" context="java" deleted="false" description="" enabled="true" name="illarg">throw new IllegalArgumentException("Invalid ${var} " + ${var}); </template><template autoinsert="false" context="swt-statements" deleted="false" description="new Image" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.image" name="Image">${labelType:newType(org.eclipse.swt.widgets.Label)} ${image:newName(org.eclipse.swt.widgets.Label)}= new ${labelType}(${parent:var(org.eclipse.swt.widgets.Composite)}, ${style:link(SWT.NONE, SWT.BORDER)});
${image}.setLayoutData(new ${type:newType(org.eclipse.swt.layout.GridData)}(SWT.${horizontal:link(BEGINNING, CENTER, END, FILL)}, SWT.${vertical:link(CENTER, TOP, BOTTOM, FILL)}, ${hex:link(false, true)}, ${vex:link(false, true)}));
${image}.setImage(${word_selection}${});
${imp:import(org.eclipse.swt.SWT)}${cursor}</template><template autoinsert="true" context="java-members" deleted="false" description="Create method that initializes the WebDataBinder which will be used for populating command and form object arguments of annotated handler methods" enabled="true" id="com.springsource.sts.quickfix.initBinder" name="InitBinder method">${:import(org.springframework.web.bind.annotation.InitBinder, org.springframework.web.bind.WebDataBinder)}@InitBinder
public void ${initBinder}(WebDataBinder ${binder}) {
${line_selection}${cursor}
}</template><template autoinsert="true" context="aspectj" deleted="false" description="initialization pointcut (AspectJ)" enabled="true" name="initialization">initialization(${modifier_pattern} ${type_pattern}.new(..))</template><template autoinsert="false" context="java-statements" deleted="false" description="dynamic type test and cast" enabled="true" id="org.eclipse.jdt.ui.templates.instanceof" name="instanceof">if (${name:var} instanceof ${type}) {
${type} ${new_name} = (${type})${name};
${cursor}
}</template><template autoinsert="false" context="java-statements" deleted="false" description="Pick an Image" enabled="true" id="org.eclipse.jdt.ui.templates.android.intent.pickimage" name="intent-pickimage">
${type:newType(android.content.Intent)} intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
</template><template autoinsert="false" context="java-statements" deleted="false" description="Share Intent" enabled="true" id="org.eclipse.jdt.ui.templates.android.intent.share" name="intent-share">
${type:newType(android.content.Intent)} intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, "Message");
</template><template autoinsert="false" context="swt-statements" deleted="false" description="new Label" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.label" name="Label">${labelType:newType(org.eclipse.swt.widgets.Label)} ${label:newName(org.eclipse.swt.widgets.Label)}= new ${labelType}(${parent:var(org.eclipse.swt.widgets.Composite)}, ${style:link(SWT.NONE, SWT.WRAP, 'SWT.SEPARATOR | SWT.HORIZONTAL', 'SWT.SEPARATOR | SWT.VERTICAL')});
${label}.setLayoutData(new ${type:newType(org.eclipse.swt.layout.GridData)}(SWT.${horizontal:link(BEGINNING, CENTER, END, FILL)}, SWT.${vertical:link(CENTER, TOP, BOTTOM, FILL)}, ${hex:link(false, true)}, ${vex:link(false, true)}));
${label}.setText(${word_selection}${});
${imp:import(org.eclipse.swt.SWT)}${cursor}</template><template autoinsert="false" context="java-statements" deleted="false" description="lazy creation" enabled="true" id="org.eclipse.jdt.ui.templates.lazy" name="lazy">if (${name:var} == null) {
${name} = new ${type}(${arguments});
${cursor}
}
return ${name};</template><template autoinsert="false" context="swt-statements" deleted="false" description="new Link" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.link" name="Link">${linkType:newType(org.eclipse.swt.widgets.Link)} ${link:newName(org.eclipse.swt.widgets.Link)}= new ${linkType}(${parent:var(org.eclipse.swt.widgets.Composite)}, SWT.NONE);
${link}.setLayoutData(new ${type:newType(org.eclipse.swt.layout.GridData)}(SWT.${horizontal:link(BEGINNING, CENTER, END, FILL)}, SWT.${vertical:link(CENTER, TOP, BOTTOM, FILL)}, ${hex:link(false, true)}, ${vex:link(false, true)}));
${link}.setText(${word_selection}${});
${link}.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
${listener:link('')}
}
});
${imp:import(org.eclipse.swt.SWT, org.eclipse.swt.events.SelectionAdapter, org.eclipse.swt.events.SelectionEvent)}${cursor}</template><template autoinsert="false" context="java-statements" deleted="false" description="Creates an List" enabled="true" id="org.eclipse.jdt.ui.templates.list" name="list">
${imp:import(java.util.List, java.util.ArrayList)}List&lt;Object&gt; ${myvar:newName(values)} =
new ArrayList&lt;&gt;();
</template><template autoinsert="true" context="java" deleted="false" description="Create a new generic ArrayList" enabled="true" name="list">${:import(java.util.List,
java.util.ArrayList)}
List&lt;${argType}&gt; ${newName} = new ArrayList&lt;${argType}&gt;(); </template><template autoinsert="false" context="swt-statements" deleted="false" description="new List" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.list" name="List">${type:newType(org.eclipse.swt.widgets.List)} ${list:newName(org.eclipse.swt.widgets.List)}= new ${type}(${parent:var(org.eclipse.swt.widgets.Composite)}, ${style:link('SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL', 'SWT.MULTI | SWT.V_SCROLL', SWT.MULTI, 'SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL', 'SWT.SINGLE | SWT.V_SCROLL', SWT.SINGLE)});
${list}.setLayoutData(new ${gridDataType:newType(org.eclipse.swt.layout.GridData)}(SWT.${horizontal:link(FILL, BEGINNING, CENTER, END)}, SWT.${vertical:link(FILL, TOP, CENTER, BOTTOM)}, ${hex:link(true, false)}, ${vex:link(true, false)}));
${list}.setItems(${word_selection}${});
${imp:import(org.eclipse.swt.SWT)}${cursor}</template><template autoinsert="false" context="java-statements" deleted="false" description="Local Variable" enabled="true" id="org.eclipse.jdt.ui.templates.localvariable" name="localvariable">
${variabletype} ${myvar:newName(var)}= new ${variabletype}(${cursor});
</template><template autoinsert="false" context="java-statements" deleted="false" description="explicit lock aquisition" enabled="true" id="org.eclipse.jdt.ui.templates.lock" name="lock">${lock:var(java.util.concurrent.locks.Lock)}.lock();
try {
${line_selection}${cursor}
} finally {
${lock}.unlock();
}</template><template autoinsert="true" context="java-statements" deleted="false" description="logger debug" enabled="true" name="logd">if(LOGGER.isDebugEnabled())&#13;
LOGGER.debug(${word_selection}${});&#13;
${cursor}&#13;
</template><template autoinsert="true" context="java-statements" deleted="false" description="logger error" enabled="true" name="logerr">LOGGER.error(${word_selection}${}, ${exception_variable_name});&#13;
${cursor}&#13;
</template><template autoinsert="true" context="java-members" deleted="false" description="create new logger" enabled="true" name="logger">${:import(org.slf4j.Logger,&#13;
org.slf4j.LoggerFactory)}&#13;
private static final Logger LOGGER =&#13;
LoggerFactory.getLogger(${enclosing_type}.class);&#13;
</template><template autoinsert="true" context="java" deleted="false" description="Logger setup" enabled="true" name="logger">${:import(org.apache.commons.logging.Log,
org.apache.commons.logging.LogFactory)}
private static final Log log = LogFactory.getLog(${enclosing_type}.class);</template><template autoinsert="true" context="java-statements" deleted="false" description="logger info" enabled="true" name="logi">LOGGER.info(${word_selection}${});&#13;
${cursor}&#13;
</template><template autoinsert="true" context="java" deleted="false" description="Log with specified level" enabled="true" name="loglevel">${:import(java.util.logging.Level)}
if(${log:var(java.util.logging.Logger)}.isLoggable(Level.${LEVEL})) {
${log:var(java.util.logging.Logger)}.${level}(${});
}
${cursor}</template><template autoinsert="true" context="java-statements" deleted="false" description="log error and throw exception" enabled="true" name="logthrow">LOGGER.error(${word_selection}${}, ${exception_variable_name});&#13;
throw ${exception_variable_name};&#13;
${cursor}&#13;
</template><template autoinsert="false" context="java-members" 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="swt-statements" deleted="false" description="new top level Shell with event loop" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.mainloop" name="mainloop">${displayType:newType(org.eclipse.swt.widgets.Display)} ${display:newName(org.eclipse.swt.widgets.Display)} = new ${displayType}();
${shellType:newType(org.eclipse.swt.widgets.Shell)} ${shell:newName(org.eclipse.swt.widgets.Shell)} = new ${shellType}(${display});
${shell}.setLayout(new ${layoutType:newType(org.eclipse.swt.layout.GridLayout)}(${numberColumns:link(1, 2, 3, 4, 5)}, ${equalColumns:link(false, true)}));
${cursor}
${shell}.pack();
${shell}.open();
while (!${shell}.isDisposed()) {
if (!${display}.readAndDispatch ())
${display}.sleep();
}
${display}.dispose();</template><template autoinsert="true" context="java" deleted="false" description="Create a new generic HashMap" enabled="true" name="map">${:import(java.util.Map,
java.util.HashMap)}
Map&lt;${argType},${argType}&gt; ${newName} = new HashMap&lt;${argType},${argType}&gt;(); </template><template autoinsert="true" context="java" deleted="false" description="Iterate through a map, print the keys and values" enabled="true" name="map-iterate">${:import(java.util.Iterator,
java.util.Map)}
for (Iterator&lt;Map.Entry&lt;${type},${type2}&gt;&gt; it = ${collection}.entrySet().iterator(); it.hasNext();) {
Map.Entry&lt;${type},${type2}&gt; entry = it.next();
${type} key = entry.getKey();
${type2} value = entry.getValue();
// do something with the key and the value
}
</template><template autoinsert="false" context="java-members" deleted="false" description="Creates public method" enabled="true" id="org.eclipse.jdt.ui.templates.methodpublic" name="method-public">public void ${name}(${}) {
${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}(${});</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="&lt;code&gt;null&lt;/code&gt;" enabled="true" id="org.eclipse.jdt.ui.templates.code_tag_null" name="null">&lt;code&gt;null&lt;/code&gt;</template><template autoinsert="false" context="java-members" deleted="false" description="OptionMenu" enabled="true" id="org.eclipse.jdt.ui.templates.android.onActivityResult" name="onActivityResult">
@Override
protected void onActivityResult(int requestCode, int resultCode, ${type:newType(android.content.Intent)} data) {
if (resultCode == Activity.RESULT_OK){
${cursor}
}
}
</template><template autoinsert="false" context="java-members" deleted="false" description="Create onClickMethod" enabled="true" id="org.eclipse.jdt.ui.templates.android.onclick" name="onClick">
${imp:import(android.view.View)}public void onClick(View view) {
}
</template><template autoinsert="false" context="java-members" deleted="false" description="OnTouch Method" enabled="true" id="org.eclipse.jdt.ui.templates.android.ontouch" name="onTouchDraw">
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
float x = event.getX();
float y = event.getY();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
break;
case MotionEvent.ACTION_MOVE:
break;
default:
break;
}
return true;
}
</template><template autoinsert="false" context="java-statements" deleted="false" description="Create Paint configuration" enabled="true" id="org.eclipse.jdt.ui.templates.android.paintconfig" name="paintconfig">
paint.setAntiAlias(true);
paint.setColor(Color.WHITE);
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeJoin(Paint.Join.ROUND);
paint.setStrokeWidth(5f);
</template><template autoinsert="true" context="java" deleted="false" description="Parse a time using SimpleDateFormat" enabled="true" name="parsetime">${:import(java.text.DateFormat,
java.text.ParseException,
java.text.SimpleDateFormat,
java.util.Date)}
try {
DateFormat formatter = new SimpleDateFormat("hh.mm.ss a");
Date date = (Date)formatter.parse("02.36.33 PM");
} catch (ParseException e) {
throw e;
}
</template><template autoinsert="true" context="aspectj" deleted="false" description="pointcut declaration (AspectJ)" enabled="true" name="pc">pointcut ${name}() : ${pointcut_expression};</template><template autoinsert="true" context="aspectj" deleted="false" description="percflow (AspectJ)" enabled="true" name="percflow">percflow(${pointcut_expression})</template><template autoinsert="true" context="aspectj" deleted="false" description="percflowbelow (AspectJ)" enabled="true" name="percflowbelow">percflowbelow(${pointcut_expression})</template><template autoinsert="true" context="aspectj" deleted="false" description="pertarget (AspectJ)" enabled="true" name="pertarget">pertarget(${pointcut_expression})</template><template autoinsert="true" context="aspectj" deleted="false" description="perthis (AspectJ)" enabled="true" name="perthis">perthis(${pointcut_expression})</template><template autoinsert="true" context="aspectj" deleted="false" description="pertypewithin (AspectJ)" enabled="true" name="pertypewithin">pertypewithin(${type_pattern})</template><template autoinsert="true" context="aspectj" deleted="false" description="pointcut (AspectJ)" enabled="true" name="pointcut">pointcut ${name}(${args}) : ${pointcut_expression};</template><template autoinsert="true" context="java-members" deleted="false" description="POST HTTP method" enabled="true" id="com.springsource.sts.quickfix.postHandler" name="POST method">${x:import(org.springframework.web.bind.annotation.RequestMapping, org.springframework.web.bind.annotation.RequestMethod, org.springframework.validation.BindingResult)}@RequestMapping(value="${cursor}${path}", method = RequestMethod.POST)
public ${String} ${post}(${Object} ${formObject}, ${BindingResult} ${bindingResult}) {
// TODO Auto generated method stub
return null;
}</template><template autoinsert="true" context="aspectj" deleted="false" description="preinitialization pointcut (AspectJ)" enabled="true" name="preinitialization">preinitialization(${modifier_pattern} ${type_pattern}.new(..))</template><template autoinsert="false" context="java-members" deleted="false" description="private method" enabled="true" id="org.eclipse.jdt.ui.templates.private_method" name="private_method">private ${return_type} ${name}(${}) {
${cursor}
}</template><template autoinsert="false" context="java-members" 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}(${}) {
${cursor}
}</template><template autoinsert="false" context="java-members" deleted="false" description="protected method" enabled="true" id="org.eclipse.jdt.ui.templates.protected_method" name="protected_method">protected ${return_type} ${name}(${}) {
${cursor}
}</template><template autoinsert="false" context="java-members" deleted="false" description="public method" enabled="true" id="org.eclipse.jdt.ui.templates.public_method" name="public_method">public ${return_type} ${name}(${}) {
${cursor}
}</template><template autoinsert="false" context="java-members" deleted="false" description="public static method" enabled="true" id="org.eclipse.jdt.ui.templates.public_static_method" name="public_static_method">public static ${return_type} ${name}(${}) {
${cursor}
}</template><template autoinsert="true" context="java-members" deleted="false" description="PUT HTTP method" enabled="true" id="com.springsource.sts.quickfix.putHandler" name="PUT method">${x:import(org.springframework.web.bind.annotation.RequestMapping, org.springframework.web.bind.annotation.RequestMethod, org.springframework.validation.BindingResult)}@RequestMapping(value="${cursor}${path}", method = RequestMethod.PUT)
public ${String} ${post}(${Object} ${formObject}, ${BindingResult} ${bindingResult}) {
// TODO Auto generated method stub
return null;
}</template><template autoinsert="true" context="java-members" deleted="false" description="Insert Test method(Quick JUnit)" enabled="true" id="junit.extensions.eclipse.quick" name="Q">@${testType:newType(org.junit.Test)}
public void ${testname}() throws Exception {
${junit:importStatic('org.junit.Assert.*')}${cursor}
}</template><template autoinsert="true" context="java-statements" deleted="false" description="iterate over lines in file" enabled="true" name="readfile">${:import(java.nio.file.Files,&#13;
java.nio.file.Paths,&#13;
java.nio.charset.Charset,&#13;
java.io.IOException,&#13;
java.io.BufferedReader)}&#13;
try (BufferedReader in = Files.newBufferedReader(Paths.get(${fileName:var(String)}),&#13;
Charset.forName("UTF-8"))) {&#13;
String line = null;&#13;
while ((line = in.readLine()) != null) {&#13;
${cursor}&#13;
}&#13;
} catch (IOException e) {&#13;
// ${todo}: handle exception&#13;
}</template><template autoinsert="true" context="java-statements" deleted="false" description="read all lines from file as a list" enabled="true" name="readfile">${:import(java.nio.file.Files,&#13;
java.nio.file.Paths,&#13;
java.nio.charset.Charset,&#13;
java.util.List,&#13;
java.util.ArrayList)}&#13;
List&lt;String&gt; lines = new ArrayList&lt;&gt;();&#13;
try{&#13;
lines = Files.readAllLines(Paths.get(${fileName:var(String)}),&#13;
Charset.forName("UTF-8"));&#13;
}catch (IOException e) {&#13;
// ${todo}: handle exception&#13;
}&#13;
${cursor}</template><template autoinsert="true" context="java" deleted="false" description="Read a file line by line" enabled="true" name="readfile">${:import(java.io.BufferedReader,
java.io.FileNotFoundException,
java.io.FileReader,
java.io.IOException)}
BufferedReader in = null;
try {
in = new BufferedReader(new FileReader(${fileName}));
String line;
while ((line = in.readLine()) != null) {
${process}
}
}
catch (FileNotFoundException e) {
logger.error(e) ;
}
catch (IOException e) {
logger.error(e) ;
} finally {
if(in != null) in.close();
}
${cursor}
</template><template autoinsert="true" context="java" deleted="false" description="Log and rethrow a caught exception" enabled="true" name="rethrow">log.error("${cursor}");
throw ${exception_variable_name};</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="swt-statements" deleted="false" description="new SashForm" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.sashform" name="SashForm">${type:newType(org.eclipse.swt.custom.SashForm)} ${sash:newName(org.eclipse.swt.custom.SashForm)}= new ${type}(${parent:var(org.eclipse.swt.widgets.Composite)}, ${style:link(SWT.HORIZONTAL, SWT.VERTICAL)});
${sash}.setLayoutData(new ${gridDataType:newType(org.eclipse.swt.layout.GridData)}(SWT.${horizontal:link(FILL, BEGINNING, CENTER, END)}, SWT.${vertical:link(FILL, TOP, CENTER, BOTTOM)}, ${hex:link(true, false)}, ${vex:link(true, false)}));
${imp:import(org.eclipse.swt.SWT)}${cursor}
${sash}.setWeights(new int[] {1, 1});</template><template autoinsert="false" context="swt-statements" deleted="false" description="new Scale" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.scale" name="Scale">${scaleType:newType(org.eclipse.swt.widgets.Scale)} ${scale:newName(org.eclipse.swt.widgets.Scale)}= new ${scaleType}(${parent:var(org.eclipse.swt.widgets.Composite)}, ${style:link(SWT.HORIZONTAL, SWT.VERTICAL)});
${scale}.setLayoutData(new ${gridDataType:newType(org.eclipse.swt.layout.GridData)}(SWT.${horizontal:link(BEGINNING, FILL, CENTER, END)}, SWT.${vertical:link(CENTER, TOP, BOTTOM, FILL)}, ${hex:link(false, true)}, ${vex:link(false, true)}));
${scale}.setMaximum(${max:link(100)});
${scale}.setIncrement(${inc:link(5)});
${imp:import(org.eclipse.swt.SWT)}${cursor}</template><template autoinsert="false" context="swt-statements" deleted="false" description="new ScrolledComposite" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.scrolledcomposite" name="ScrolledComposite">${compositeType:newType(org.eclipse.swt.custom.ScrolledComposite)} ${scrolled:newName(org.eclipse.swt.custom.ScrolledComposite)} = new ${compositeType}(${parent:var(org.eclipse.swt.widgets.Composite)}, ${style:link('SWT.H_SCROLL | SWT.V_SCROLL', SWT.H_SCROLL, SWT.V_SCROLL)});
${scrolled}.setLayoutData(new ${gridDataType:newType(org.eclipse.swt.layout.GridData)}(SWT.${horizontal:link(FILL, BEGINNING, CENTER, END)}, SWT.${vertical:link(FILL, TOP, CENTER, BOTTOM)}, ${hex:link(true, false)}, ${vex:link(true, false)}));
${scrolled}.setExpandVertical(${exV:link(false, true)});
${scrolled}.setExpandHorizontal(${exH:link(false, true)});
${imp:import(org.eclipse.swt.SWT)}${cursor}
${scrolled}.setContent(${content});
Point ${contentSize:newName(org.eclipse.swt.graphics.Point)} = ${content}.computeSize(SWT.DEFAULT, SWT.DEFAULT);
${content}.setSize(${contentSize});
${scrolled}.setMinSize(${contentSize});</template><template autoinsert="true" context="aspectj" deleted="false" description="set pointcut (AspectJ)" enabled="true" name="set">set(${modifier_pattern} ${ret_type_pattern} ${type_pattern}.${id_pattern})</template><template autoinsert="false" context="swt-statements" deleted="false" description="new Shell" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.shell" name="Shell">${shellType:newType(org.eclipse.swt.widgets.Shell)} ${shell:newName(org.eclipse.swt.widgets.Shell)} = new ${shellType}(${parent:var(org.eclipse.swt.widgets.Shell)}, ${style:link('SWT.DIALOG_TRIM | SWT.PRIMARY_MODAL', 'SWT.DIALOG_TRIM | SWT.MODELESS', 'SWT.SHELL_TRIM | SWT.MODELESS', 'SWT.SHELL_TRIM | SWT.PRIMARY_MODAL')});
${shell}.setLayout(new ${layoutType:newType(org.eclipse.swt.layout.GridLayout)}(${numberColumns:link(1, 2, 3, 4, 5)}, ${equalColumns:link(false, true)}));
${imp:import(org.eclipse.swt.SWT)}${cursor}
${shell}.pack();
${shell}.open();</template><template autoinsert="true" context="java-statements" deleted="false" description="" enabled="true" name="slf4j">${:import(org.slf4j.Logger,org.slf4j.LoggerFactory)}
private static final Logger LOGGER = LoggerFactory.getLogger(${enclosing_type}.class);</template><template autoinsert="false" context="swt-statements" deleted="false" description="new Spinner" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.spinner" name="Spinner">${spinnerType:newType(org.eclipse.swt.widgets.Spinner)} ${spinner:newName(org.eclipse.swt.widgets.Spinner)}= new ${spinnerType}(${parent:var(org.eclipse.swt.widgets.Composite)}, ${style:link(SWT.BORDER, 'SWT.WRAP | SWT.BORDER', 'SWT.READ_ONLY | SWT.BORDER', 'SWT.READ_ONLY | SWT.WRAP | SWT.BORDER', SWT.WRAP, SWT.READ_ONLY)});
${spinner}.setLayoutData(new ${gridDataType:newType(org.eclipse.swt.layout.GridData)}(SWT.${horizontal:link(BEGINNING, CENTER, END, FILL)}, SWT.${vertical:link(CENTER, TOP, BOTTOM, FILL)}, ${hex:link(false, true)}, ${vex:link(false, true)}));
${spinner}.setMaximum(${max:link(10)});
${spinner}.setIncrement(${inc:link(1)});
${imp:import(org.eclipse.swt.SWT)}${cursor}</template><template autoinsert="false" context="java-members" deleted="false" description="static final field" enabled="true" id="org.eclipse.jdt.ui.templates.static_final" name="static_final">${visibility:link(public,protected,private)} static final ${type} ${NAME} = ${word_selection}${};</template><template autoinsert="true" context="aspectj" deleted="false" description="staticinitialization pointcut (AspectJ)" enabled="true" name="staticinitialization">staticinitialization(${type_pattern})</template><template autoinsert="true" context="java" deleted="false" description="format string" enabled="true" name="strf">String.format("${word_selection}${}",${var}${cursor})</template><template autoinsert="false" context="java-statements" deleted="false" description="String (empty)" enabled="true" id="org.eclipse.jdt.ui.templates.emptystring" name="string">
String ${myvar:newName(var)}= "";
</template><template autoinsert="false" context="swt-statements" deleted="false" description="new StyledText " enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.styledtext" name="StyledText">${type:newType(org.eclipse.swt.custom.StyledText)} ${text:newName(org.eclipse.swt.custom.StyledText)}= new ${type}(${parent:var(org.eclipse.swt.widgets.Composite)}, ${style:link('SWT.V_SCROLL | SWT.H_SCROLL', 'SWT.V_SCROLL | SWT.H_SCROLL | SWT.READ_ONLY', 'SWT.WRAP | SWT.V_SCROLL', SWT.NONE, SWT.BORDER, SWT.FULL_SELECTION)});
${text}.setLayoutData(new ${gridDataType:newType(org.eclipse.swt.layout.GridData)}(SWT.${horizontal:link(FILL, BEGINNING, CENTER, END)}, SWT.${vertical:link(FILL, TOP, CENTER, BOTTOM)}, ${hex:link(true, false)}, ${vex:link(true, false)}));
${text}.setText(${word_selection}${});
${imp:import(org.eclipse.swt.SWT)}${cursor}</template><template autoinsert="false" context="swt-statements" deleted="false" description="new StyleRange for a StyledText" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.stylerange" name="StyleRange">${type:newType(org.eclipse.swt.custom.StyleRange)} ${range:newName(org.eclipse.swt.custom.StyleRange)}= new ${type}();
${range}.start= ${start:link(0)};
${range}.length= ${length:link(0)};
${range}.foreground= ${fColor:link(null, 'Display.getDefault().getSystemColor(SWT.COLOR_BLACK)', 'Display.getDefault().getSystemColor(SWT.COLOR_WHITE)', 'Display.getDefault().getSystemColor(SWT.COLOR_RED)', 'Display.getDefault().getSystemColor(SWT.COLOR_BLUE)', 'Display.getDefault().getSystemColor(SWT.COLOR_GREEN)')};
${range}.background= ${bColor:link(null, 'Display.getDefault().getSystemColor(SWT.COLOR_BLACK)', 'Display.getDefault().getSystemColor(SWT.COLOR_WHITE)', 'Display.getDefault().getSystemColor(SWT.COLOR_RED)', 'Display.getDefault().getSystemColor(SWT.COLOR_BLUE)', 'Display.getDefault().getSystemColor(SWT.COLOR_GREEN)')};
${range}.fontStyle= ${fStyle:link(SWT.NORMAL, SWT.ITALIC, SWT.BOLD)};
${text:var(org.eclipse.swt.custom.StyledText)}.setStyleRange(${range});
${imp:import(org.eclipse.swt.SWT, org.eclipse.swt.widgets.Display)}${cursor}</template><template autoinsert="false" context="java-statements" 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-statements" deleted="false" description="synchronized block" enabled="true" id="org.eclipse.jdt.ui.templates.synchronized" name="synchronized">synchronized (${mutex:var}) {
${line_selection}
}</template><template autoinsert="true" context="java-statements" 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-statements" deleted="false" description="print formatted string to standard out" enabled="true" name="sysf">System.out.printf("${word_selection}${}",${var}${cursor});&#13;
</template><template autoinsert="true" context="java-statements" 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-statements" 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="swt-statements" deleted="false" description="new TabFolder" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.tabfolder" name="TabFolder">${type:newType(org.eclipse.swt.widgets.TabFolder)} ${folder:newName(org.eclipse.swt.widgets.TabFolder)}= new ${type}(${parent:var(org.eclipse.swt.widgets.Composite)}, ${style:link(SWT.TOP, SWT.BOTTOM)});
${folder}.setLayoutData(new ${gridDataType:newType(org.eclipse.swt.layout.GridData)}(SWT.${horizontal:link(FILL, BEGINNING, CENTER, END)}, SWT.${vertical:link(FILL, TOP, CENTER, BOTTOM)}, ${hex:link(true, false)}, ${vex:link(true, false)}));
${imp:import(org.eclipse.swt.SWT)}${cursor}</template><template autoinsert="false" context="swt-statements" deleted="false" description="new TabItem for a TabFolder" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.tabitem" name="TabItem">${type:newType(org.eclipse.swt.widgets.TabItem)} ${item:newName(org.eclipse.swt.widgets.TabItem)}= new ${type}(${parent:var(org.eclipse.swt.widgets.TabFolder)}, SWT.NONE);
${item}.setText(${word_selection}${});
${imp:import(org.eclipse.swt.SWT)}${cursor}
${item}.setControl(${control});</template><template autoinsert="false" context="swt-statements" deleted="false" description="new Table" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.table" name="Table">${type:newType(org.eclipse.swt.widgets.Table)} ${table:newName(org.eclipse.swt.widgets.Table)}= new ${type}(${parent:var(org.eclipse.swt.widgets.Composite)}, ${style:link('SWT.SINGLE | SWT.FULL_SELECTION', 'SWT.MULTI | SWT.FULL_SELECTION', SWT.CHECK, SWT.NONE, SWT.VIRTUAL)});
${table}.setLayoutData(new ${gridDataType:newType(org.eclipse.swt.layout.GridData)}(SWT.${horizontal:link(FILL, BEGINNING, CENTER, END)}, SWT.${vertical:link(FILL, TOP, CENTER, BOTTOM)}, ${hex:link(true, false)}, ${vex:link(true, false)}));
${table}.setLinesVisible(${line:link(true, false)});
${table}.setHeaderVisible(${header:link(true, false)});
${imp:import(org.eclipse.swt.SWT)}${cursor}
for (int ${index} = 0; ${index} &lt; ${table}.getColumnCount(); ${index}++) {
${table}.getColumn(${index}).pack();
}</template><template autoinsert="false" context="swt-statements" deleted="false" description="new TableColumn for a Table " enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.tablecolumn" name="TableColumn">${type:newType(org.eclipse.swt.widgets.TableColumn)} ${column:newName(org.eclipse.swt.widgets.TableColumn)}= new ${type}(${parent:var(org.eclipse.swt.widgets.Table)}, ${style:link(SWT.LEAD, SWT.CENTER, SWT.TRAIL)});
${column}.setText(${word_selection}${});
${imp:import(org.eclipse.swt.SWT)}${cursor}</template><template autoinsert="false" context="swt-statements" deleted="false" description="new TableItem for a Table" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.tableitem" name="TableItem">${type:newType(org.eclipse.swt.widgets.TableItem)} ${item:newName(org.eclipse.swt.widgets.TableItem)}= new ${type}(${parent:var(org.eclipse.swt.widgets.Table)}, SWT.NONE);
${item}.setText(${count:link(0, 1, 2, 3, 4, 5)}, ${word_selection}${});
${imp:import(org.eclipse.swt.SWT)}${cursor}</template><template autoinsert="false" context="jface-statements" deleted="false" description="Creates a default JFace TableViewer" enabled="true" id="org.eclipse.jdt.ui.templates.jfacetableviewer" name="TableViewer">
TableViewer tableViewer = new TableViewer(parent);
Table table = tableViewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
tableViewer.setContentProvider(ArrayContentProvider.getInstance());
tableViewer
.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
ISelection selection = event.getSelection();
if (selection instanceof IStructuredSelection) {
selectionService.setSelection(((IStructuredSelection)selection).toList());
}
}
});
TableViewerColumn viewerColumn = new TableViewerColumn(tableViewer,
SWT.NONE);
viewerColumn.getColumn().setWidth(200);
viewerColumn.getColumn().setText("Name");
viewerColumn.setLabelProvider(new ColumnLabelProvider());
IObservableList input = new WritableList();
ViewerSupport.bind(
tableViewer,
input,
PojoProperties.values(new String[] { "name" }));
</template><template autoinsert="false" context="java-members" deleted="false" description="Creates a class tag for logging" enabled="true" id="org.vogella.saneclipse.tag" name="tag">
private static final String TAG = ${enclosing_type}.class.getSimpleName();
</template><template autoinsert="false" context="java-members" deleted="false" description="test method (JUnit 4)" enabled="true" id="org.eclipse.jdt.ui.templates.test_junit4" name="test">@${testType:newType(org.junit.Test)}
public void ${testName}() throws Exception {
${staticImport:importStatic('org.junit.Assert.*')}${cursor}
}</template><template autoinsert="false" context="java-members" deleted="false" description="test method (JUnit 3)" enabled="true" id="org.eclipse.jdt.ui.templates.test" name="test3">public void test${name}() throws Exception {
${cursor}
}</template><template autoinsert="false" context="swt-statements" deleted="false" description="new Text" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.text" name="Text">${type:newType(org.eclipse.swt.widgets.Text)} ${text:newName(org.eclipse.swt.widgets.Text)}= new ${type}(${parent:var(org.eclipse.swt.widgets.Composite)}, ${style:link('SWT.SINGLE | SWT.LEAD | SWT.BORDER', 'SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY | SWT.BORDER', 'SWT.SINGLE | SWT.LEAD | SWT.PASSWORD | SWT.BORDER', 'SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.BORDER', 'SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER')});
${text}.setLayoutData(new ${gridDataType:newType(org.eclipse.swt.layout.GridData)}(SWT.${horizontal:link(FILL, BEGINNING, CENTER, END)}, SWT.${vertical:link(CENTER, TOP, BOTTOM, FILL)}, ${hex:link(true, false)}, ${vex:link(false, true)}));
${text}.setText(${word_selection}${});
${imp:import(org.eclipse.swt.SWT)}${cursor}</template><template autoinsert="true" context="aspectj" deleted="false" description="thisJoinPoint (AspectJ)" enabled="true" name="thisJoinPoint">thisJoinPoint</template><template autoinsert="true" context="aspectj" deleted="false" description="thisJoinPointStaticPart (AspectJ)" enabled="true" name="thisJoinPointStaticPart">thisJoinPointStaticPart</template><template autoinsert="true" context="java" deleted="false" description="Print execution time of a block of code" enabled="true" name="time">long start = System.currentTimeMillis();
//TODO: Insert code here
${cursor}
long end = System.currentTimeMillis();
System.out.println("Operation took "+(end-start)+ "ms");</template><template autoinsert="true" context="java" deleted="false" description="Create periodic Timer" enabled="true" name="timer">${:import(java.util.Timer,
java.util.TimerTask)}
int delay = 5000; // delay for 5 sec.
int period = 1000; // repeat every sec.
Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
public void run() {
//TODO: Insert code to execute here
${cursor}
}
}, delay, period);</template><template autoinsert="false" context="java" deleted="false" description="convert collection to array" enabled="true" id="org.eclipse.jdt.ui.templates.toarray" name="toarray">(${type:elemType(collection)}[]) ${collection}.toArray(new ${type}[${collection}.size()])</template><template autoinsert="false" context="java-statements" deleted="false" description="Creates a toast" enabled="true" id="org.eclipse.jdt.ui.templates.android.toast" name="toast">
${imp:import(android.widget.Toast)}Toast.makeText(this, "${cursor}", Toast.LENGTH_SHORT).show();
</template><template autoinsert="false" context="swt-statements" deleted="false" description="new ToolBar" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.toolbar" name="ToolBar">${type:newType(org.eclipse.swt.widgets.ToolBar)} ${bar:newName(org.eclipse.swt.widgets.ToolBar)}= new ${type}(${parent:var(org.eclipse.swt.widgets.Composite)}, ${style:link(SWT.FLAT, SWT.WRAP, SWT.RIGHT, SWT.HORIZONTAL, SWT.VERTICAL, SWT.SHADOW_OUT)});
${bar}.setLayoutData(new ${gridDataType:newType(org.eclipse.swt.layout.GridData)}(SWT.${horizontal:link(FILL, BEGINNING, CENTER, END)}, SWT.${vertical:link(FILL, TOP, CENTER, BOTTOM)}, ${hex:link(true, false)}, ${vex:link(true, false)}));
${imp:import(org.eclipse.swt.SWT)}${cursor}</template><template autoinsert="false" context="swt-statements" deleted="false" description="new ToolItem for a ToolBar" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.toolitem" name="ToolItem">${type:newType(org.eclipse.swt.widgets.ToolItem)} ${item:newName(org.eclipse.swt.widgets.ToolItem)}= new ${type}(${parent:var(org.eclipse.swt.widgets.ToolBar)}, ${style:link(SWT.PUSH, SWT.CHECK, SWT.RADIO, SWT.SEPARATOR, SWT.DROP_DOWN)});
${item}.setText(${word_selection}${});
${imp:import(org.eclipse.swt.SWT)}${cursor}</template><template autoinsert="true" context="java" deleted="false" description="" enabled="true" name="traceout">System.out.println("${enclosing_type}.${enclosing_method}()");
</template><template autoinsert="false" context="swt-statements" deleted="false" description="new Tree" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.tree" name="Tree">${type:newType(org.eclipse.swt.widgets.Tree)} ${tree:newName(org.eclipse.swt.widgets.Tree)}= new ${type}(${parent:var(org.eclipse.swt.widgets.Composite)}, ${style:link('SWT.SINGLE | SWT.FULL_SELECTION', 'SWT.MULTI | SWT.FULL_SELECTION', SWT.CHECK, SWT.NONE, SWT.VIRTUAL)});
${tree}.setLayoutData(new ${gridDataType:newType(org.eclipse.swt.layout.GridData)}(SWT.${horizontal:link(FILL, BEGINNING, CENTER, END)}, SWT.${vertical:link(FILL, TOP, CENTER, BOTTOM)}, ${hex:link(true, false)}, ${vex:link(true, false)}));
${tree}.setLinesVisible(${line:link(true, false)});
${tree}.setHeaderVisible(${header:link(true, false)});
${imp:import(org.eclipse.swt.SWT)}${cursor}
for (int ${index} = 0; ${index} &lt; ${tree}.getColumnCount(); ${index}++) {
${tree}.getColumn(${index}).pack();
}</template><template autoinsert="false" context="swt-statements" deleted="false" description="new TreeColumn for a Tree " enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.treecolumn" name="TreeColumn">${type:newType(org.eclipse.swt.widgets.TreeColumn)} ${column:newName(org.eclipse.swt.widgets.TreeColumn)}= new ${type}(${parent:var(org.eclipse.swt.widgets.Tree)}, ${style:link(SWT.LEAD, SWT.CENTER, SWT.TRAIL)});
${column}.setText(${word_selection}${});
${imp:import(org.eclipse.swt.SWT)}${cursor}</template><template autoinsert="false" context="swt-statements" deleted="false" description="new TreeItem for a Tree" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.swt.treeitem" name="TreeItem">${type:newType(org.eclipse.swt.widgets.TreeItem)} ${item:newName(org.eclipse.swt.widgets.TreeItem)}= new ${type}(${parent:var(org.eclipse.swt.widgets.Tree, org.eclipse.swt.widgets.TreeItem)}, SWT.NONE);
${item}.setText(${count:link(0, 1, 2, 3, 4, 5)}, ${word_selection}${});
${imp:import(org.eclipse.swt.SWT)}${cursor}</template><template autoinsert="true" context="javadoc" deleted="false" description="&lt;code&gt;true&lt;/code&gt;" enabled="true" id="org.eclipse.jdt.ui.templates.code_tag_true" name="true">&lt;code&gt;true&lt;/code&gt;</template><template autoinsert="false" context="java-statements" deleted="false" description="try catch block" enabled="true" id="org.eclipse.jdt.ui.templates.try" name="try_catch">try {
${line_selection}${cursor}
} catch (${Exception} ${exception_variable_name}) {
// ${todo}: handle exception
}</template><template autoinsert="false" context="java-statements" deleted="false" description="try finally block" enabled="true" id="org.eclipse.jdt.ui.templates.tryfinally" name="try_finally">try {
${line_selection}${cursor}
} finally {
// ${todo}: handle finally clause
}</template><template autoinsert="false" context="java-statements" deleted="false" description="iterate with enumeration" enabled="true" id="org.eclipse.jdt.ui.templates.while_enumeration" name="while">while (${en:var(java.util.Enumeration)}.hasMoreElements()) {
${type:argType(en)} ${elem:newName(type)} = (${type}) ${en}.nextElement();
${cursor}
}</template><template autoinsert="false" context="java-statements" deleted="false" description="iterate with iterator" enabled="true" id="org.eclipse.jdt.ui.templates.while_iterator" name="while">while (${it:var(java.util.Iterator)}.hasNext()) {
${type:argType(it)} ${elem:newName(type)} = (${type}) ${it}.next();
${cursor}
}</template><template autoinsert="false" context="java-statements" deleted="false" description="while loop with condition" enabled="true" id="org.eclipse.jdt.ui.templates.while_condition" name="while">while (${condition:var(boolean)}) {
${line_selection}${cursor}
}</template><template autoinsert="true" context="aspectj" deleted="false" description="within pointcut (AspectJ)" enabled="true" name="within">within(${type_pattern})</template><template autoinsert="true" context="aspectj" deleted="false" description="withincode of a constructor pointcut (AspectJ)" enabled="true" name="withincode_cons">withincode(${modifier_pattern} ${type_pattern}.new(..))</template><template autoinsert="true" context="aspectj" deleted="false" description="withincode of a method pointcut (AspectJ)" enabled="true" name="withincode_method">withincode(${modifier_pattern} ${ret_type_pattern} ${type_pattern}.${id_pattern}(..))</template><template autoinsert="true" context="java-statements" deleted="false" description="write text to a file" enabled="true" name="writefile">${:import(java.nio.file.Files,&#13;
java.nio.file.Paths,&#13;
java.nio.charset.Charset,&#13;
java.io.IOException,&#13;
java.io.BufferedWriter)}&#13;
try (BufferedWriter out = Files.newBufferedWriter(Paths.get(${fileName:var(String)}),&#13;
Charset.forName("UTF-8"))) {&#13;
out.write(${string:var(String)});&#13;
out.newLine();&#13;
${cursor}&#13;
} catch (IOException e) {&#13;
// ${todo}: handle exception&#13;
}&#13;
</template><template autoinsert="true" context="java" deleted="false" description="Write a String to a file" enabled="true" name="writefile">${:import(java.io.BufferedWriter,
java.io.FileWriter,
java.io.IOException)}
try {
BufferedWriter out = new BufferedWriter(new FileWriter(${cursor}"fileName"));
out.write("aString");
out.close();
} catch (IOException e) {
throw e;
}
</template><template autoinsert="true" context="java-statements" deleted="false" description="parse xml file as Document" enabled="true" name="xml">${:import(org.w3c.dom.Document,&#13;
javax.xml.parsers.DocumentBuilderFactory,&#13;
java.io.File,&#13;
java.io.IOException,&#13;
javax.xml.parsers.ParserConfigurationException,&#13;
org.xml.sax.SAXException)}&#13;
Document doc = null;&#13;
try {&#13;
doc = DocumentBuilderFactory.newInstance()&#13;
.newDocumentBuilder()&#13;
.parse(new File(${filename:var(String)}));&#13;
} catch (SAXException | IOException | ParserConfigurationException e) {&#13;
// ${todo}: handle exception&#13;
}&#13;
${cursor}</template><template autoinsert="true" context="java-statements" deleted="false" description="parse xml string as Document" enabled="true" name="xml">${:import(org.w3c.dom.Document,&#13;
javax.xml.parsers.DocumentBuilderFactory,&#13;
org.xml.sax.InputSource,&#13;
java.io.StringReader,&#13;
java.io.IOException,&#13;
javax.xml.parsers.ParserConfigurationException,&#13;
org.xml.sax.SAXException)}&#13;
Document doc = null;&#13;
try {&#13;
doc = DocumentBuilderFactory.newInstance()&#13;
.newDocumentBuilder()&#13;
.parse(new InputSource(new StringReader(${str:var(String)})));&#13;
} catch (SAXException | IOException | ParserConfigurationException e) {&#13;
// ${todo}: handle exception&#13;
}&#13;
${cursor}</template></templates>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.