summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2013-04-29 11:26:21 (EDT)
committer Dani Megert2013-04-29 11:26:21 (EDT)
commitcf4a6483b2973f177218ad73eb61797eee47e0e5 (patch)
treea6e084417164e31f0b9ca0d159a2d185d948f5b4
parent932cf1260a5fe3600fe1dc38685d32c7d862c1d6 (diff)
downloadeclipse.jdt.ui-cf4a6483b2973f177218ad73eb61797eee47e0e5.zip
eclipse.jdt.ui-cf4a6483b2973f177218ad73eb61797eee47e0e5.tar.gz
eclipse.jdt.ui-cf4a6483b2973f177218ad73eb61797eee47e0e5.tar.bz2
Fixed bug 387272: [templates] SWT templates - add SelectionListener
-rw-r--r--org.eclipse.jdt.ui/templates/default-swttemplates.xml20
1 files changed, 17 insertions, 3 deletions
diff --git a/org.eclipse.jdt.ui/templates/default-swttemplates.xml b/org.eclipse.jdt.ui/templates/default-swttemplates.xml
index 1d0c57a..9968091 100644
--- a/org.eclipse.jdt.ui/templates/default-swttemplates.xml
+++ b/org.eclipse.jdt.ui/templates/default-swttemplates.xml
@@ -2,7 +2,7 @@
<!--
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2013 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
@@ -11,6 +11,7 @@
* 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 and put selection into quotes - https://bugs.eclipse.org/387272
*******************************************************************************/
-->
@@ -166,7 +167,13 @@ ${imp:import(org.eclipse.swt.SWT)}${cursor}</template>
>${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}</template>
+${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"
@@ -177,7 +184,13 @@ ${imp:import(org.eclipse.swt.SWT)}${cursor}</template>
>${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}${});
-${imp:import(org.eclipse.swt.SWT)}${cursor}</template>
+${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"
@@ -254,6 +267,7 @@ ${shell}.setLayout(new ${layoutType:newType(org.eclipse.swt.layout.GridLayout)}(
${imp:import(org.eclipse.swt.SWT)}${cursor}
${shell}.pack();
+
${shell}.open();</template>
<template