blob: 3b7a810b70a06d873432298c4f31e02aa7a9bd66 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*******************************************************************************
* Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* Benjamin Muskalla <bmuskalla@eclipsesource.com> - [templates] new SWT templates - ToolBar and ToolItem - https://bugs.eclipse.org/bugs/show_bug.cgi?id=264052
* Lars Vogel <lars.vogel@gmail.com> - [templates] SWT templates - add SelectionListener - https://bugs.eclipse.org/387272
*******************************************************************************/
-->
<templates>
<!-- ************************************************** Basic SWT patterns ********************************************* -->
<template
name="mainloop"
description="%SWTTemplates.mainloop"
id="org.eclipse.jdt.ui.text.codetemplates.swt.mainloop"
context="swt-statements" enabled="true" autoinsert="false"
>${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
name="execute"
description="%SWTTemplates.execute"
id="org.eclipse.jdt.ui.text.codetemplates.swt.execute"
context="swt-statements" enabled="true" autoinsert="false"
>${display:var(org.eclipse.swt.widgets.Display)}.${kind:link(syncExec, asyncExec)}(new ${runnable:newType(java.lang.Runnable)}(){
public void run(){
${cursor}
}
});</template>
<template
name="addlistener"
description="%SWTTemplates.addlistener"
id="org.eclipse.jdt.ui.text.codetemplates.swt.addlistener"
context="swt-statements" enabled="true" autoinsert="false"
>${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
name="GridLayout"
description="%SWTTemplates.gridlayout"
id="org.eclipse.jdt.ui.text.codetemplates.swt.gridlayout"
context="swt-statements" enabled="true" autoinsert="false"
>${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
name="GridData"
description="%SWTTemplates.griddata"
id="org.eclipse.jdt.ui.text.codetemplates.swt.griddata"
context="swt-statements" enabled="true" autoinsert="false"
>${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>
<!-- ************************************************** Basic Widgets ************************************************** -->
<template
name="Label"
description="%SWTTemplates.label"
id="org.eclipse.jdt.ui.text.codetemplates.swt.label"
context="swt-statements" enabled="true" autoinsert="false"
>${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
name="Image"
description="%SWTTemplates.image"
id="org.eclipse.jdt.ui.text.codetemplates.swt.image"
context="swt-statements" enabled="true" autoinsert="false"
>${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
name="Button"
description="%SWTTemplates.button"
id="org.eclipse.jdt.ui.text.codetemplates.swt.button"
context="swt-statements" enabled="true" autoinsert="false"
>${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
name="Link"
description="%SWTTemplates.link"
id="org.eclipse.jdt.ui.text.codetemplates.swt.link"
context="swt-statements" enabled="true" autoinsert="false"
>${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
name="Combo"
description="%SWTTemplates.combo"
id="org.eclipse.jdt.ui.text.codetemplates.swt.combo"
context="swt-statements" enabled="true" autoinsert="false"
>${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
name="Scale"
description="%SWTTemplates.scale"
id="org.eclipse.jdt.ui.text.codetemplates.swt.scale"
context="swt-statements" enabled="true" autoinsert="false"
>${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
name="Spinner"
description="%SWTTemplates.spinner"
id="org.eclipse.jdt.ui.text.codetemplates.swt.spinner"
context="swt-statements" enabled="true" autoinsert="false"
>${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>
<!-- ************************************************** Advanced Widgets ************************************************** -->
<template
name="Browser"
description="%SWTTemplates.browser"
id="org.eclipse.jdt.ui.text.codetemplates.swt.browser"
context="swt-statements" enabled="true" autoinsert="false"
>${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.WEBKIT)});
${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
name="DateTime"
description="%SWTTemplates.datetime"
id="org.eclipse.jdt.ui.text.codetemplates.swt.datetime"
context="swt-statements" enabled="true" autoinsert="false"
>${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>
<!-- ************************************************** Containers ************************************************** -->
<template
name="Shell"
description="%SWTTemplates.shell"
id="org.eclipse.jdt.ui.text.codetemplates.swt.shell"
context="swt-statements" enabled="true" autoinsert="false"
>${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
name="Composite"
description="%SWTTemplates.composite"
id="org.eclipse.jdt.ui.text.codetemplates.swt.gridcomposite"
context="swt-statements" enabled="true" autoinsert="false"
>${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
name="ScrolledComposite"
description="%SWTTemplates.scrolledcomposite"
id="org.eclipse.jdt.ui.text.codetemplates.swt.scrolledcomposite"
context="swt-statements" enabled="true" autoinsert="false"
>${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
name="Group"
description="%SWTTemplates.group"
id="org.eclipse.jdt.ui.text.codetemplates.swt.group"
context="swt-statements" enabled="true" autoinsert="false"
>${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
name="SashForm"
description="%SWTTemplates.sashform"
id="org.eclipse.jdt.ui.text.codetemplates.swt.sashform"
context="swt-statements" enabled="true" autoinsert="false"
>${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>
<!-- ************************************************** Master-Slave Containers ************************************************** -->
<template
name="ExpandBar"
description="%SWTTemplates.expandbar"
id="org.eclipse.jdt.ui.text.codetemplates.swt.expandbar"
context="swt-statements" enabled="true" autoinsert="false"
>${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
name="ExpandItem"
description="%SWTTemplates.expanditem"
id="org.eclipse.jdt.ui.text.codetemplates.swt.expanditem"
context="swt-statements" enabled="true" autoinsert="false"
>${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
name="TabFolder"
description="%SWTTemplates.tabfolder"
id="org.eclipse.jdt.ui.text.codetemplates.swt.tabfolder"
context="swt-statements" enabled="true" autoinsert="false"
>${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
name="TabItem"
description="%SWTTemplates.tabitem"
id="org.eclipse.jdt.ui.text.codetemplates.swt.tabitem"
context="swt-statements" enabled="true" autoinsert="false"
>${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
name="ToolBar"
description="%SWTTemplates.toolbar"
id="org.eclipse.jdt.ui.text.codetemplates.swt.toolbar"
context="swt-statements" enabled="true" autoinsert="false"
>${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
name="ToolItem"
description="%SWTTemplates.toolitem"
id="org.eclipse.jdt.ui.text.codetemplates.swt.toolitem"
context="swt-statements" enabled="true" autoinsert="false"
>${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>
<!-- ************************************************** Text Viewers ************************************************** -->
<template
name="Text"
description="%SWTTemplates.text"
id="org.eclipse.jdt.ui.text.codetemplates.swt.text"
context="swt-statements" enabled="true" autoinsert="false"
>${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
name="StyledText"
description="%SWTTemplates.styledtext"
id="org.eclipse.jdt.ui.text.codetemplates.swt.styledtext"
context="swt-statements" enabled="true" autoinsert="false"
>${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
name="StyleRange"
description="%SWTTemplates.stylerange"
id="org.eclipse.jdt.ui.text.codetemplates.swt.stylerange"
context="swt-statements" enabled="true" autoinsert="false"
>${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>
<!-- ************************************************** Structured Viewers ************************************************** -->
<template
name="List"
description="%SWTTemplates.list"
id="org.eclipse.jdt.ui.text.codetemplates.swt.list"
context="swt-statements" enabled="true" autoinsert="false"
>${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
name="Table"
description="%SWTTemplates.table"
id="org.eclipse.jdt.ui.text.codetemplates.swt.table"
context="swt-statements" enabled="true" autoinsert="false"
>${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
name="TableColumn"
description="%SWTTemplates.tablecolumn"
id="org.eclipse.jdt.ui.text.codetemplates.swt.tablecolumn"
context="swt-statements" enabled="true" autoinsert="false"
>${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
name="TableItem"
description="%SWTTemplates.tableitem"
id="org.eclipse.jdt.ui.text.codetemplates.swt.tableitem"
context="swt-statements" enabled="true" autoinsert="false"
>${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
name="Tree"
description="%SWTTemplates.tree"
id="org.eclipse.jdt.ui.text.codetemplates.swt.tree"
context="swt-statements" enabled="true" autoinsert="false"
>${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
name="TreeColumn"
description="%SWTTemplates.treecolumn"
id="org.eclipse.jdt.ui.text.codetemplates.swt.treecolumn"
context="swt-statements" enabled="true" autoinsert="false"
>${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
name="TreeItem"
description="%SWTTemplates.treeitem"
id="org.eclipse.jdt.ui.text.codetemplates.swt.treeitem"
context="swt-statements" enabled="true" autoinsert="false"
>${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>
</templates>