diff --git a/org.eclipse.jdt.ui/templates/default-swttemplates.xml b/org.eclipse.jdt.ui/templates/default-swttemplates.xml index 1d0c57a..b5e1982 100644 --- a/org.eclipse.jdt.ui/templates/default-swttemplates.xml +++ b/org.eclipse.jdt.ui/templates/default-swttemplates.xml @@ -11,6 +11,7 @@ * Contributors: * IBM Corporation - initial API and implementation * Benjamin Muskalla - [templates] new SWT templates - ToolBar and ToolItem - https://bugs.eclipse.org/bugs/show_bug.cgi?id=264052 + * Lars Vogel - Bug 387272 *******************************************************************************/ --> @@ -165,8 +166,14 @@ >${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}${}); -${imp:import(org.eclipse.swt.SWT)}${cursor} +${button}.setText("${word_selection}${}"); +${button}.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + ${cursor} + } + }); +${imp:import(org.eclipse.swt.SWT, org.eclipse.swt.events.SelectionAdapter, org.eclipse.swt.events.SelectionEvent)}