Index: /applications/editors/josm/plugins/turnrestrictions/README
===================================================================
--- /applications/editors/josm/plugins/turnrestrictions/README	(revision 20383)
+++ /applications/editors/josm/plugins/turnrestrictions/README	(revision 20384)
@@ -4,14 +4,16 @@
 
 turnrestrictions plugin is a plugin for the open source map editor 
-JOSM. It allows to enter maintain information about turn restrictions
+JOSM. It allows to maintain information about turn restrictions
 in the OpenStreetMap database.                           
                          
-
+SEE ALSO
+========
+http://wiki.openstreetmap.org/wiki/JOSM/Plugins/turnrestrictions
+                         
 CREDIT
 ======
 Initial development of this plugin was sponsored by skobbler GmbH, see
-http://beta.skobbler.de/.
+http://www.skobbler.de/.
 
-Initial author: Karl Guggisberg
  
                          
Index: /applications/editors/josm/plugins/turnrestrictions/data/test-data-set-1.osm
===================================================================
--- /applications/editors/josm/plugins/turnrestrictions/data/test-data-set-1.osm	(revision 20384)
+++ /applications/editors/josm/plugins/turnrestrictions/data/test-data-set-1.osm	(revision 20384)
@@ -0,0 +1,161 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<osm version='0.6' generator='JOSM'>
+  <bounds minlat='46.9185552' minlon='7.3901081' maxlat='46.9271138' maxlon='7.4086475' origin='OpenStreetMap server' />
+  <node id='-86' action='modify' visible='true' lat='46.920401695281015' lon='7.392672484176534' />
+  <node id='-84' action='modify' visible='true' lat='46.91947481836078' lon='7.394608244994619' />
+  <node id='-82' visible='true' lat='46.91947481836078' lon='7.392692440473628' />
+  <node id='-81' visible='true' lat='46.9194611876982' lon='7.391036067814855' />
+  <node id='-71' visible='true' lat='46.920906018634135' lon='7.399118368137783' />
+  <node id='-69' visible='true' lat='46.921737460284035' lon='7.40135347341227' />
+  <node id='-67' visible='true' lat='46.921737460284035' lon='7.39909841184069' />
+  <node id='-66' visible='true' lat='46.921737460284035' lon='7.3971426947255114' />
+  <node id='-56' action='modify' visible='true' lat='46.92280059638277' lon='7.392991784930033' />
+  <node id='-54' action='modify' visible='true' lat='46.92175109036751' lon='7.394767895371367' />
+  <node id='-52' action='modify' visible='true' lat='46.92175109036752' lon='7.393011741227126' />
+  <node id='-51' action='modify' visible='true' lat='46.921737460284014' lon='7.390916330032293' />
+  <node id='-41' action='modify' visible='true' lat='46.92375467491946' lon='7.391245608934339' />
+  <node id='-40' action='modify' visible='true' lat='46.92378193405656' lon='7.394298922389664' />
+  <node id='-38' visible='true' lat='46.92450429613562' lon='7.394298922389665' />
+  <node id='-37' action='modify' visible='true' lat='46.924517925515175' lon='7.391285521528527' />
+  <node id='-28' visible='true' lat='46.925969434589156' lon='7.404077507965554' />
+  <node id='-26' visible='true' lat='46.925955805578894' lon='7.401802490096877' />
+  <node id='-25' visible='true' lat='46.925955805578894' lon='7.39940773444564' />
+  <node id='-12' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.92569685372496' lon='7.3913653467169' />
+  <node id='-10' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.92566959556225' lon='7.393261194940797' />
+  <node id='-8' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.92662362300419' lon='7.39328115123789' />
+  <node id='-6' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.9265827364623' lon='7.395296737244347' />
+  <node id='-4' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.9265827364623' lon='7.397511886221743' />
+  <node id='-2' timestamp='2010-03-09T09:06:53Z' visible='true' lat='46.925560562772716' lon='7.397471973627557' />
+  <way id='-88' action='modify' visible='true'>
+    <nd ref='-82' />
+    <nd ref='-84' />
+    <tag k='name' v='way 7.2' />
+  </way>
+  <way id='-87' visible='true'>
+    <nd ref='-82' />
+    <nd ref='-86' />
+  </way>
+  <way id='-83' action='modify' visible='true'>
+    <nd ref='-81' />
+    <nd ref='-82' />
+    <tag k='name' v='way 7.1' />
+  </way>
+  <way id='-73' visible='true'>
+    <nd ref='-67' />
+    <nd ref='-69' />
+  </way>
+  <way id='-72' action='modify' visible='true'>
+    <nd ref='-67' />
+    <nd ref='-71' />
+    <tag k='name' v='way 6.2' />
+  </way>
+  <way id='-68' action='modify' visible='true'>
+    <nd ref='-66' />
+    <nd ref='-67' />
+    <tag k='name' v='way 6.1' />
+  </way>
+  <way id='-59' visible='true'>
+    <nd ref='-52' />
+    <nd ref='-54' />
+  </way>
+  <way id='-57' action='modify' visible='true'>
+    <nd ref='-52' />
+    <nd ref='-56' />
+    <tag k='name' v='way 5.2' />
+  </way>
+  <way id='-53' action='modify' visible='true'>
+    <nd ref='-51' />
+    <nd ref='-52' />
+    <tag k='name' v='way 5.1' />
+  </way>
+  <way id='-44' visible='true'>
+    <nd ref='-38' />
+    <nd ref='-40' />
+  </way>
+  <way id='-42' action='modify' visible='true'>
+    <nd ref='-40' />
+    <nd ref='-41' />
+    <tag k='name' v='way 4.2' />
+  </way>
+  <way id='-39' action='modify' visible='true'>
+    <nd ref='-37' />
+    <nd ref='-38' />
+    <tag k='name' v='way 4.1' />
+  </way>
+  <way id='-30' action='modify' visible='true'>
+    <nd ref='-26' />
+    <nd ref='-28' />
+    <tag k='name' v='Weg 3.2' />
+  </way>
+  <way id='-27' action='modify' visible='true'>
+    <nd ref='-25' />
+    <nd ref='-26' />
+    <tag k='name' v='Weg 3.1' />
+  </way>
+  <way id='-20' action='modify' timestamp='2010-03-09T09:06:53Z' visible='true'>
+    <nd ref='-12' />
+    <nd ref='-10' />
+    <tag k='name' v='Weg 1.1' />
+  </way>
+  <way id='-18' action='modify' timestamp='2010-03-09T09:06:53Z' visible='true'>
+    <nd ref='-10' />
+    <nd ref='-8' />
+    <tag k='name' v='Weg 1.2' />
+  </way>
+  <way id='-16' action='modify' timestamp='2010-03-09T09:06:53Z' visible='true'>
+    <nd ref='-6' />
+    <nd ref='-4' />
+    <tag k='name' v='Weg 2.1' />
+  </way>
+  <way id='-14' action='modify' timestamp='2010-03-09T09:06:53Z' visible='true'>
+    <nd ref='-4' />
+    <nd ref='-2' />
+    <tag k='name' v='Weg 2.2' />
+  </way>
+  <relation id='-96' visible='true'>
+    <member type='way' ref='-83' role='from' />
+    <member type='way' ref='-88' role='to' />
+    <member type='node' ref='-82' role='via' />
+    <tag k='restriction' v='only_straight_on' />
+    <tag k='type' v='restriction' />
+  </relation>
+  <relation id='-80' visible='true'>
+    <member type='way' ref='-68' role='from' />
+    <member type='way' ref='-72' role='to' />
+    <member type='node' ref='-67' role='via' />
+    <tag k='restriction' v='only_right_turn' />
+    <tag k='type' v='restriction' />
+  </relation>
+  <relation id='-65' visible='true'>
+    <member type='way' ref='-53' role='from' />
+    <member type='way' ref='-57' role='to' />
+    <member type='node' ref='-52' role='via' />
+    <tag k='restriction' v='only_left_turn' />
+    <tag k='type' v='restriction' />
+  </relation>
+  <relation id='-48' visible='true'>
+    <member type='way' ref='-39' role='from' />
+    <member type='way' ref='-42' role='to' />
+    <member type='way' ref='-44' role='via' />
+    <tag k='restriction' v='no_u_turn' />
+    <tag k='type' v='restriction' />
+  </relation>
+  <relation id='-36' visible='true'>
+    <member type='way' ref='-27' role='from' />
+    <member type='way' ref='-30' role='to' />
+    <tag k='restriction' v='no_straight_on' />
+    <tag k='type' v='restriction' />
+  </relation>
+  <relation id='-24' timestamp='2010-03-09T09:06:53Z' visible='true'>
+    <member type='way' ref='-20' role='from' />
+    <member type='way' ref='-18' role='to' />
+    <tag k='restriction' v='no_left_turn' />
+    <tag k='type' v='restriction' />
+  </relation>
+  <relation id='-22' timestamp='2010-03-09T09:06:53Z' visible='true'>
+    <member type='way' ref='-16' role='from' />
+    <member type='way' ref='-14' role='to' />
+    <tag k='restriction' v='no_right_turn' />
+    <tag k='type' v='restriction' />
+  </relation>
+</osm>
Index: /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/AbstractTurnRestrictionsListView.java
===================================================================
--- /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/AbstractTurnRestrictionsListView.java	(revision 20384)
+++ /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/AbstractTurnRestrictionsListView.java	(revision 20384)
@@ -0,0 +1,34 @@
+package org.openstreetmap.josm.plugins.turnrestrictions;
+
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.event.ListSelectionListener;
+
+/**
+ * The abstract base class for two views of turn restriction lists.
+ * 
+ * @see TurnRestrictionsInSelectionView
+ * @see TurnRestrictionsInDatasetView
+ *
+ */
+abstract class AbstractTurnRestrictionsListView extends JPanel {
+	protected TurnRestrictionsListModel model;
+	protected JList lstTurnRestrictions;
+	
+	public TurnRestrictionsListModel getModel(){
+		return model;
+	}
+	
+	public JList getList() {
+		return lstTurnRestrictions;
+	}
+	
+	public void addListSelectionListener(ListSelectionListener listener) {
+		lstTurnRestrictions.addListSelectionListener(listener);
+	}
+	 
+	public void removeListSelectionListener(ListSelectionListener listener) {
+		lstTurnRestrictions.addListSelectionListener(listener);
+	}
+
+}
Index: /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionListCellRenderer.java
===================================================================
--- /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionListCellRenderer.java	(revision 20384)
+++ /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionListCellRenderer.java	(revision 20384)
@@ -0,0 +1,221 @@
+package org.openstreetmap.josm.plugins.turnrestrictions;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.swing.ImageIcon;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.ListCellRenderer;
+import javax.swing.UIManager;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
+import org.openstreetmap.josm.data.osm.Relation;
+import org.openstreetmap.josm.data.osm.RelationMember;
+import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.gui.DefaultNameFormatter;
+import org.openstreetmap.josm.gui.JMultilineLabel;
+import org.openstreetmap.josm.tools.ImageProvider;
+
+/**
+ * This the cell renderer for turn restrictions in the turn restriction list
+ * dialog.
+ *
+ */
+public class TurnRestrictionListCellRenderer extends JPanel implements ListCellRenderer{
+
+	/** the names of restriction types */
+	static private Set<String> RESTRICTION_TYPES = new HashSet<String>(
+			Arrays.asList(new String[] {
+					"no_left_turn",
+					"no_right_turn",
+					"no_straight_on",
+					"no_u_turn",
+					"only_left_turn",
+					"only_right_turn",
+					"only_straight_on"
+			})
+	);
+	
+	/** components used to render the turn restriction */
+	private JLabel icon;
+	private JLabel from;
+	private JLabel to;
+	
+	public TurnRestrictionListCellRenderer() {
+		build();
+	}
+
+	/**
+	 * Replies true if {@code restrictionType} is a valid restriction
+	 * type.
+	 * 
+	 * @param restrictionType the restriction type 
+	 * @return true if {@code restrictionType} is a valid restriction
+	 * type
+	 */
+	protected boolean isValidRestrictionType(String restrictionType) {
+		if (restrictionType == null) return false;
+		restrictionType = restrictionType.trim().toLowerCase();
+		return RESTRICTION_TYPES.contains(restrictionType);
+	}
+	
+	/**
+	 * Builds the icon name for a given restriction type 
+	 * 
+	 * @param restrictionType the restriction type 
+	 * @return the icon name 
+	 */
+	protected String buildImageName(String restrictionType) {
+		return "types/" + restrictionType;
+	}
+	
+	/**
+	 * Replies the icon for a given restriction type 
+	 * @param restrictionType the restriction type 
+	 * @return the icon 
+	 */
+	protected ImageIcon getIcon(String restrictionType) {
+		if (!isValidRestrictionType(restrictionType)) return null;
+		return ImageProvider.get(buildImageName(restrictionType));
+	}
+ 	
+	/**
+	 * Builds the UI used to render turn restrictions 
+	 */
+	protected void build() {
+		setLayout(new GridBagLayout());
+		GridBagConstraints gc = new GridBagConstraints();
+		
+		// the turn restriction icon 		
+		gc.fill = GridBagConstraints.HORIZONTAL;
+		gc.weightx = 0.0;
+		gc.gridheight = 2;
+		gc.anchor = GridBagConstraints.CENTER;
+		gc.insets = new Insets(0,2,0,2);
+		add(icon = new JLabel(), gc);
+		
+		
+		// the name of the way with role "from"
+		gc.anchor = GridBagConstraints.NORTHWEST;
+		gc.gridx = 1;
+		gc.gridheight = 1;
+		gc.weightx = 0.0;
+		gc.insets = new Insets(0,0,0,0);
+		add(new JMultilineLabel("<html><strong>From:</strong></html>"), gc);
+		
+		gc.gridx = 2;
+		gc.weightx = 1.0; 
+		add(from = new JLabel(), gc);
+		
+		// the name of the way with role "to"
+		gc.anchor = GridBagConstraints.NORTHWEST;
+		gc.gridx = 1;
+		gc.gridy = 1;
+		gc.weightx = 0.0;
+		add(new JMultilineLabel("<html><strong>To:</strong></html>"), gc);
+		
+		gc.gridx = 2;
+		gc.weightx = 1.0;
+		add(to = new JLabel(), gc);
+	}
+
+	/**
+	 * Renders the icon for the turn restriction  
+	 * 
+	 * @param tr the turn restriction
+	 */
+	protected void renderIcon(Relation tr) {
+		String restrictionType = tr.get("restriction");
+		if (!isValidRestrictionType(restrictionType)) {
+			icon.setIcon(null);
+			return;
+		}
+		icon.setIcon(getIcon(restrictionType));
+	}
+
+	/**
+	 * Replies a way participating in this turn restriction in a given role
+	 * 
+	 * @param tr the turn restriction 
+	 * @param role the role (either "from" or "to")
+	 * @return the participating way; null, if no way is participating in this role
+	 */
+	private Way getParticipatingWay(Relation tr, String role){
+		for(RelationMember rm: tr.getMembers()){
+			if (rm.getRole().trim().toLowerCase().equals(role) && rm.getType().equals(OsmPrimitiveType.WAY)) {
+				return (Way)rm.getMember();
+			}
+		}
+		return null;
+	}
+	
+	protected void renderFrom(Relation tr) {
+		Way from = getParticipatingWay(tr, "from");
+		if (from == null) {
+			// FIXME: render as warning/error (red background?)
+			this.from.setText(tr("no participating way with role ''from''"));
+			return;
+		} 
+		this.from.setText(DefaultNameFormatter.getInstance().format(from));
+	}
+
+	protected void renderTo(Relation tr) {
+		Way to = getParticipatingWay(tr, "to");
+		if (to == null) {
+			// FIXME: render as warning/error (red background?)
+			this.to.setText(tr("no participating way with role ''to''"));
+			return;
+		} 
+		this.to.setText(DefaultNameFormatter.getInstance().format(to));
+	}
+
+	/**
+	 * Renders the foreground and background color depending on whether
+	 * the turn restriction is selected
+	 * 
+	 * @param isSelected true if the turn restriction is selected; false,
+	 * otherwise
+	 */
+	protected void renderColor(boolean isSelected) {
+		Color bg;
+		Color fg;
+		if (isSelected) {
+			bg = UIManager.getColor("List.selectionBackground");
+			fg = UIManager.getColor("List.selectionForeground");
+		} else {
+			bg = UIManager.getColor("background");
+			fg = UIManager.getColor("foreground");
+		}
+		setBackground(bg);
+		this.icon.setBackground(bg);
+		this.from.setBackground(bg);
+		this.to.setBackground(bg);
+		
+		setForeground(fg);
+		this.icon.setForeground(fg);
+		this.from.setForeground(fg);
+		this.to.setForeground(fg);
+	}
+		
+	public Component getListCellRendererComponent(JList list, Object value,
+			int index, boolean isSelected, boolean cellHasFocus) {
+
+		renderColor(isSelected);
+		Relation tr = (Relation)value;
+		renderIcon(tr);
+		renderFrom(tr);
+		renderTo(tr);		
+		return this;
+	}	
+}
Index: /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionsInDatasetListModel.java
===================================================================
--- /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionsInDatasetListModel.java	(revision 20384)
+++ /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionsInDatasetListModel.java	(revision 20384)
@@ -0,0 +1,132 @@
+package org.openstreetmap.josm.plugins.turnrestrictions;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.logging.Logger;
+
+import javax.swing.DefaultListSelectionModel;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.Relation;
+import org.openstreetmap.josm.data.osm.event.AbstractDatasetChangedEvent;
+import org.openstreetmap.josm.data.osm.event.DataChangedEvent;
+import org.openstreetmap.josm.data.osm.event.DataSetListener;
+import org.openstreetmap.josm.data.osm.event.NodeMovedEvent;
+import org.openstreetmap.josm.data.osm.event.PrimitivesAddedEvent;
+import org.openstreetmap.josm.data.osm.event.PrimitivesRemovedEvent;
+import org.openstreetmap.josm.data.osm.event.RelationMembersChangedEvent;
+import org.openstreetmap.josm.data.osm.event.TagsChangedEvent;
+import org.openstreetmap.josm.data.osm.event.WayNodesChangedEvent;
+import org.openstreetmap.josm.gui.MapView.EditLayerChangeListener;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+
+/**
+ * This is the list model for the list of turn restrictions in the current data set.
+ * 
+ * The model is a {@see EditLayerChangeListener}. It initializes itself from the data set of
+ * the current edit layer.
+ * 
+ * The model is a {@see DataSetListener}. It updates itself to reflect the list of turn
+ * restrictions in the current data set. 
+ *
+ */
+public class TurnRestrictionsInDatasetListModel extends TurnRestrictionsListModel implements EditLayerChangeListener, DataSetListener {
+	private static final Logger logger = Logger.getLogger(TurnRestrictionsInDatasetListModel.class.getName());
+	
+	public TurnRestrictionsInDatasetListModel(
+			DefaultListSelectionModel selectionModel) {
+		super(selectionModel);
+	}
+	
+	/**
+	 * Filters the list of turn restrictions from a collection of OSM primitives.
+	 * 
+	 * @param primitives the primitives 
+	 * @return the list of turn restrictions 
+	 */
+	protected List<Relation> filterTurnRestrictions(Collection<? extends OsmPrimitive> primitives) {
+		List<Relation> ret = new LinkedList<Relation>();
+		if (primitives == null) return ret;
+		for(OsmPrimitive p: primitives){
+			if (!isTurnRestriction(p)) continue;
+			ret.add((Relation)p);
+		}
+		return ret;
+	}
+	
+	/* --------------------------------------------------------------------------- */
+	/* interface EditLayerChangeListener                                           */
+	/* --------------------------------------------------------------------------- */
+	public void editLayerChanged(OsmDataLayer oldLayer, OsmDataLayer newLayer) {
+		if (newLayer == null) {
+			setTurnRestrictions(null);
+			return;
+		}
+		List<Relation> turnRestrictions = new LinkedList<Relation>();
+		for (Relation r: newLayer.data.getRelations()) {
+			if (isValid(r) && isTurnRestriction(r)) {
+				turnRestrictions.add(r);
+			}
+		}
+		setTurnRestrictions(turnRestrictions);
+	}
+	
+	/* --------------------------------------------------------------------------- */
+	/* interface DataSetListener                                                   */
+	/* --------------------------------------------------------------------------- */	
+	public void dataChanged(DataChangedEvent event) {		
+		OsmDataLayer layer = Main.map.mapView.getEditLayer();
+		if (layer == null) {
+			setTurnRestrictions(null);
+		} else {
+			List<Relation> turnRestrictions = filterTurnRestrictions(layer.data.getRelations());
+			setTurnRestrictions(turnRestrictions);
+		}
+	}
+
+	public void primtivesAdded(PrimitivesAddedEvent event) {
+		List<Relation> turnRestrictions = filterTurnRestrictions(event.getPrimitives());
+		if (!turnRestrictions.isEmpty()) {
+			addTurnRestrictions(turnRestrictions);
+		}
+	}
+
+	public void primtivesRemoved(PrimitivesRemovedEvent event) {
+		List<Relation> turnRestrictions = filterTurnRestrictions(event.getPrimitives());
+		if (!turnRestrictions.isEmpty()) {
+			removeTurnRestrictions(turnRestrictions);
+		}
+	}
+
+	public void relationMembersChanged(RelationMembersChangedEvent event) {
+		List<Relation> turnRestrictions = filterTurnRestrictions(event.getPrimitives());
+		if (!turnRestrictions.isEmpty()) {
+			List<Relation> sel = getSelectedTurnRestrictions();
+			for(Relation tr: turnRestrictions) {	
+				// enforce a repaint of the respective turn restriction
+				int idx = getTurnRestrictionIndex(tr);
+				fireContentsChanged(this, idx,idx);
+			}
+			setSelectedTurnRestrictions(sel);
+		}
+	}
+
+	public void tagsChanged(TagsChangedEvent event) {
+		List<Relation> turnRestrictions = filterTurnRestrictions(event.getPrimitives());
+		if (!turnRestrictions.isEmpty()) {
+			List<Relation> sel = getSelectedTurnRestrictions();
+			for(Relation tr: turnRestrictions) {	
+				// enforce a repaint of the respective turn restriction
+				int idx = getTurnRestrictionIndex(tr);
+				fireContentsChanged(this, idx,idx);
+			}
+			setSelectedTurnRestrictions(sel);
+		}		
+	}
+
+	public void wayNodesChanged(WayNodesChangedEvent event) {/* ignore */}
+	public void nodeMoved(NodeMovedEvent event) {/* ignore */}
+	public void otherDatasetChange(AbstractDatasetChangedEvent event) {/* ignore */}
+}
Index: /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionsInDatasetView.java
===================================================================
--- /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionsInDatasetView.java	(revision 20384)
+++ /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionsInDatasetView.java	(revision 20384)
@@ -0,0 +1,50 @@
+package org.openstreetmap.josm.plugins.turnrestrictions;
+
+import java.awt.BorderLayout;
+
+import javax.swing.DefaultListSelectionModel;
+import javax.swing.JList;
+import javax.swing.JScrollPane;
+import javax.swing.ListSelectionModel;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.osm.event.DataSetListener;
+import org.openstreetmap.josm.data.osm.event.DatasetEventManager;
+import org.openstreetmap.josm.data.osm.event.DatasetEventManager.FireMode;
+import org.openstreetmap.josm.gui.MapView;
+import org.openstreetmap.josm.gui.MapView.EditLayerChangeListener;
+
+/**
+ * This is the view for the list of turn restrictions in the current data set.
+ */
+public class TurnRestrictionsInDatasetView extends AbstractTurnRestrictionsListView{	
+	protected void build() {
+		DefaultListSelectionModel selectionModel = new DefaultListSelectionModel();
+		model = new TurnRestrictionsInDatasetListModel(selectionModel);
+		lstTurnRestrictions = new JList(model);
+		lstTurnRestrictions.setSelectionModel(selectionModel);
+		lstTurnRestrictions.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
+		lstTurnRestrictions.setCellRenderer(new TurnRestrictionListCellRenderer());
+		
+		setLayout(new BorderLayout());
+		add(new JScrollPane(lstTurnRestrictions), BorderLayout.CENTER);
+	}
+
+	protected void registerAsListener() {
+		MapView.addEditLayerChangeListener((EditLayerChangeListener)model);
+		DatasetEventManager.getInstance().addDatasetListener((DataSetListener)model, FireMode.IN_EDT);
+		if (Main.main.getEditLayer() != null) {
+			model.setTurnRestrictions(Main.main.getEditLayer().data
+					.getRelations());
+		}
+	}
+
+	protected void unregisterAsListener() {
+		MapView.removeEditLayerChangeListener((EditLayerChangeListener)model);
+		DatasetEventManager.getInstance().removeDatasetListener((DataSetListener)model);
+	}
+
+	public TurnRestrictionsInDatasetView() {
+		build();
+	}
+}
Index: /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionsInSelectionListModel.java
===================================================================
--- /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionsInSelectionListModel.java	(revision 20384)
+++ /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionsInSelectionListModel.java	(revision 20384)
@@ -0,0 +1,63 @@
+package org.openstreetmap.josm.plugins.turnrestrictions;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.logging.Logger;
+
+import javax.swing.DefaultListSelectionModel;
+
+import org.openstreetmap.josm.data.SelectionChangedListener;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.Relation;
+import org.openstreetmap.josm.gui.MapView.EditLayerChangeListener;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+
+/**
+ * This is the list model for the list of turn restrictions related to OSM
+ * objects in the current selection.
+ */
+public class TurnRestrictionsInSelectionListModel extends TurnRestrictionsListModel implements EditLayerChangeListener, SelectionChangedListener {
+	private static final Logger logger = Logger.getLogger(TurnRestrictionsInSelectionListModel.class.getName());
+	
+	public TurnRestrictionsInSelectionListModel(
+			DefaultListSelectionModel selectionModel) {
+		super(selectionModel);
+	}
+	
+	/**
+	 * Initializes the model with the turn restrictions the primitives in 
+	 * {@code selection} participate.
+	 * 
+	 * @param selection the collection of selected primitives
+	 */
+	public void initFromSelection(Collection<? extends OsmPrimitive> selection) {
+		Set<Relation> turnRestrictions = new HashSet<Relation>();
+		if (selection == null) return;
+		for (OsmPrimitive p: selection) {
+			for (OsmPrimitive parent: p.getReferrers()) {
+				if (isTurnRestriction(parent))
+					turnRestrictions.add((Relation)parent);
+			}
+		}
+		setTurnRestrictions(turnRestrictions);
+	}
+
+	/* --------------------------------------------------------------------------- */
+	/* interface EditLayerChangeListener                                           */
+	/* --------------------------------------------------------------------------- */
+	public void editLayerChanged(OsmDataLayer oldLayer, OsmDataLayer newLayer) {
+		if (newLayer == null) {
+			setTurnRestrictions(null);
+			return;
+		}
+		initFromSelection(newLayer.data.getSelected());
+	}
+	
+	/* --------------------------------------------------------------------------- */
+	/* interface SelectionChangedListener                                          */
+	/* --------------------------------------------------------------------------- */	
+	public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
+		initFromSelection(newSelection);
+	}
+}
Index: /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionsInSelectionView.java
===================================================================
--- /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionsInSelectionView.java	(revision 20384)
+++ /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionsInSelectionView.java	(revision 20384)
@@ -0,0 +1,52 @@
+package org.openstreetmap.josm.plugins.turnrestrictions;
+
+import java.awt.BorderLayout;
+
+import javax.swing.DefaultListSelectionModel;
+import javax.swing.JList;
+import javax.swing.JScrollPane;
+import javax.swing.ListSelectionModel;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.SelectionChangedListener;
+import org.openstreetmap.josm.data.osm.event.SelectionEventManager;
+import org.openstreetmap.josm.data.osm.event.DatasetEventManager.FireMode;
+import org.openstreetmap.josm.gui.MapView;
+import org.openstreetmap.josm.gui.MapView.EditLayerChangeListener;
+
+/**
+ * This is the view for the list of turn restrictions related to objects in the 
+ * current selection.
+ * 
+ */
+public class TurnRestrictionsInSelectionView extends AbstractTurnRestrictionsListView {
+
+	protected void build() {
+		DefaultListSelectionModel selectionModel = new DefaultListSelectionModel();
+		model = new TurnRestrictionsInSelectionListModel(selectionModel);
+		lstTurnRestrictions = new JList(model);
+		lstTurnRestrictions.setSelectionModel(selectionModel);
+		lstTurnRestrictions.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
+		lstTurnRestrictions.setCellRenderer(new TurnRestrictionListCellRenderer());
+		
+		setLayout(new BorderLayout());
+		add(new JScrollPane(lstTurnRestrictions), BorderLayout.CENTER);
+	}
+
+	protected void registerAsListener() {
+		MapView.addEditLayerChangeListener((EditLayerChangeListener)model);
+		SelectionEventManager.getInstance().addSelectionListener((SelectionChangedListener)model, FireMode.IN_EDT_CONSOLIDATED);
+		if (Main.main.getEditLayer() != null) {
+			model.setTurnRestrictions(Main.main.getEditLayer().data.getRelations());
+		}
+	}
+
+	protected void unregisterAsListener() {
+		MapView.removeEditLayerChangeListener((EditLayerChangeListener)model);
+		SelectionEventManager.getInstance().removeSelectionListener((SelectionChangedListener)model);
+	}
+
+	public TurnRestrictionsInSelectionView() {
+		build();
+	}
+}
Index: /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionsListDialog.java
===================================================================
--- /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionsListDialog.java	(revision 20383)
+++ /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionsListDialog.java	(revision 20384)
@@ -12,4 +12,5 @@
 import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 import javax.swing.AbstractAction;
@@ -23,8 +24,10 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.actions.AutoScaleAction;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Relation;
 import org.openstreetmap.josm.data.osm.RelationMember;
 import org.openstreetmap.josm.gui.MapView;
+import org.openstreetmap.josm.gui.SideButton;
 import org.openstreetmap.josm.gui.MapView.EditLayerChangeListener;
 import org.openstreetmap.josm.gui.dialogs.ToggleDialog;
@@ -56,4 +59,6 @@
 	private EditAction actEdit;
 	private DeleteAction actDelete;	 
+	private SelectSelectedTurnRestrictions actSelectSelectedTurnRestrictions;
+	private ZoomToAction actZoomTo;
 	private SwitchListViewHandler switchListViewHandler;
 	
@@ -101,7 +106,10 @@
 		JPanel pnl = new JPanel(new FlowLayout(FlowLayout.LEFT,0,0));
 		pnl.setBorder(null);
-		pnl.add(new JButton(actNew = new NewAction()));
-		pnl.add(new JButton(actEdit = new EditAction()));
-		pnl.add(new JButton(actDelete = new DeleteAction()));
+		pnl.add(new SideButton(actNew = new NewAction(), false /* don't show the name */));
+		pnl.add(new SideButton(actEdit = new EditAction(), false /* don't show the name */));
+		pnl.add(new SideButton(actDelete = new DeleteAction(), false /* don't show the name */));
+		
+		actSelectSelectedTurnRestrictions = new SelectSelectedTurnRestrictions();
+		actZoomTo = new ZoomToAction();
 		return pnl;
 	}
@@ -155,12 +163,18 @@
 				currentListView.removeListSelectionListener(actEdit);
 				currentListView.removeListSelectionListener(actDelete);
+				currentListView.removeListSelectionListener(actSelectSelectedTurnRestrictions);
+				currentListView.removeListSelectionListener(actZoomTo);
 				pnlContent.remove(currentListView);
 			}
 			pnlContent.add(view,BorderLayout.CENTER);
+			currentListView = view;						
 			view.addListSelectionListener(actEdit);
 			view.addListSelectionListener(actDelete);
+			view.addListSelectionListener(actSelectSelectedTurnRestrictions);
+			view.addListSelectionListener(actZoomTo);
 			actEdit.updateEnabledState();
 			actDelete.updateEnabledState();
-			currentListView = view;
+			actSelectSelectedTurnRestrictions.updateEnabledState();
+			actZoomTo.updateEnabledState();
 			currentListView.revalidate();
 			currentListView.repaint();
@@ -188,4 +202,5 @@
             putValue(SHORT_DESCRIPTION,tr( "Open an editor for the selected turn restricion"));
             putValue(SMALL_ICON, ImageProvider.get("dialogs", "edit"));
+            putValue(NAME, tr("Edit"));
             setEnabled(false);
         }
@@ -210,5 +225,5 @@
             if (!isEnabled())
                 return;
-            List<Relation> toEdit = pnlTurnRestrictionsInDataSet.getModel().getSelectedTurnRestrictions();
+            List<Relation> toEdit = currentListView.getModel().getSelectedTurnRestrictions();
             if (toEdit.size() != 1) return;
             launchEditor(toEdit.get(0));
@@ -216,5 +231,5 @@
 
         public void updateEnabledState() {
-        	setEnabled(pnlTurnRestrictionsInDataSet.getModel().getSelectedTurnRestrictions().size() == 1);
+        	setEnabled(currentListView!= null && currentListView.getModel().getSelectedTurnRestrictions().size() == 1);
         }
         
@@ -234,4 +249,5 @@
             putValue(SHORT_DESCRIPTION,tr("Delete the selected turn restriction"));
             putValue(SMALL_ICON, ImageProvider.get("dialogs", "delete"));
+            putValue(NAME, tr("Delete"));
             setEnabled(false);
         }
@@ -248,5 +264,5 @@
         public void actionPerformed(ActionEvent e) {
             if (!isEnabled()) return;
-            List<Relation> toDelete = pnlTurnRestrictionsInDataSet.getModel().getSelectedTurnRestrictions();
+            List<Relation> toDelete = currentListView.getModel().getSelectedTurnRestrictions();
             for (Relation r: toDelete) {
                 deleteRelation(r);
@@ -255,5 +271,5 @@
         
         public void updateEnabledState() {
-        	setEnabled(!pnlTurnRestrictionsInDataSet.getModel().getSelectedTurnRestrictions().isEmpty());
+        	setEnabled(currentListView != null && !currentListView.getModel().getSelectedTurnRestrictions().isEmpty());
         }
 
@@ -270,5 +286,6 @@
         public NewAction() {
             putValue(SHORT_DESCRIPTION,tr("Create a new turn restriction"));
-            putValue(SMALL_ICON, ImageProvider.get("dialogs", "addrelation"));
+            putValue(SMALL_ICON, ImageProvider.get("new"));
+            putValue(NAME, tr("New"));
             updateEnabledState();
         }
@@ -290,4 +307,71 @@
             updateEnabledState();
 		}
+    }
+    
+    /**
+     * Sets the selection of the current data set to the currently selected 
+     * turn restrictions.
+     *
+     */
+    class SelectSelectedTurnRestrictions extends AbstractAction implements ListSelectionListener {
+        class AbortException extends Exception {}
+
+        public SelectSelectedTurnRestrictions() {
+            putValue(SHORT_DESCRIPTION,tr("Set the current JOSM selection to the selected turn restrictions"));
+            putValue(SMALL_ICON, ImageProvider.get("selectall"));
+            putValue(NAME, tr("Select in current data layer"));
+            setEnabled(false);
+        }
+
+        public void actionPerformed(ActionEvent e) {
+            if (!isEnabled()) return;
+            List<Relation> toSelect = currentListView.getModel().getSelectedTurnRestrictions();
+            if (toSelect.isEmpty()) return;
+            OsmDataLayer layer= Main.main.getEditLayer();
+            if (layer == null) return;
+            layer.data.setSelected(toSelect);
+        }
+        
+        public void updateEnabledState() {
+        	setEnabled(currentListView != null && !currentListView.getModel().getSelectedTurnRestrictions().isEmpty());
+        }
+
+        public void valueChanged(ListSelectionEvent e) {
+        	updateEnabledState();
+        }
+    }
+    
+    /**
+     * Sets the selection of the current data set to the currently selected 
+     * turn restrictions.
+     *
+     */
+    class ZoomToAction extends AbstractAction implements ListSelectionListener {
+        class AbortException extends Exception {}
+
+        public ZoomToAction() {
+            putValue(SHORT_DESCRIPTION,tr("Zoom to the currently selected turn restrictions"));
+            putValue(SMALL_ICON, ImageProvider.get("dialogs/autoscale/selection"));
+            putValue(NAME, tr("Zoom to"));
+            setEnabled(false);
+        }
+
+        public void actionPerformed(ActionEvent e) {
+            if (!isEnabled()) return;
+            List<Relation> toSelect = currentListView.getModel().getSelectedTurnRestrictions();
+            if (toSelect.isEmpty()) return;
+            OsmDataLayer layer= Main.main.getEditLayer();
+            if (layer == null) return;
+            layer.data.setSelected(toSelect);
+            new AutoScaleAction("selection").autoScale();
+        }
+        
+        public void updateEnabledState() {
+        	setEnabled(currentListView != null && !currentListView.getModel().getSelectedTurnRestrictions().isEmpty());
+        }
+
+        public void valueChanged(ListSelectionEvent e) {
+        	updateEnabledState();
+        }
     }
     
@@ -320,4 +404,7 @@
             add(actEdit);
             add(actDelete);
+            addSeparator();
+            add(actSelectSelectedTurnRestrictions);
+            add(actZoomTo);
         }
     }
Index: /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionsListModel.java
===================================================================
--- /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionsListModel.java	(revision 20384)
+++ /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionsListModel.java	(revision 20384)
@@ -0,0 +1,232 @@
+package org.openstreetmap.josm.plugins.turnrestrictions;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.swing.AbstractListModel;
+import javax.swing.DefaultListSelectionModel;
+
+import org.openstreetmap.josm.data.osm.NameFormatter;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.Relation;
+import org.openstreetmap.josm.gui.DefaultNameFormatter;
+
+/**
+ * This is a list model for a list of turn restrictions.
+ * 
+ */
+public class TurnRestrictionsListModel extends AbstractListModel {
+    private final ArrayList<Relation> turnrestrictions = new ArrayList<Relation>();
+    private DefaultListSelectionModel selectionModel;
+
+    /**
+     * Creates the model
+     * 
+     * @param selectionModel the selection model used in the turn restriction list
+     */
+    public TurnRestrictionsListModel(DefaultListSelectionModel selectionModel) {
+        this.selectionModel = selectionModel;
+    }
+
+    /**
+     * Replies the turn restriction at position {@code idx} in the list.
+     * 
+     * @param idx the index 
+     * @return the turn restriction at position {@code idx} in the list.
+     */
+    public Relation getTurnRestriction(int idx) {
+        return turnrestrictions.get(idx);
+    }
+
+    /**
+     * Sorts the turn restrictions in this model 
+     */
+    public void sort() {
+        Collections.sort(
+                turnrestrictions,
+                new Comparator<Relation>() {
+                    NameFormatter formatter = DefaultNameFormatter.getInstance();
+
+                    public int compare(Relation r1, Relation r2) {
+                        return r1.getDisplayName(formatter).compareTo(r2.getDisplayName(formatter));
+                    }
+                }
+        );
+    }
+
+    protected boolean isValid(Relation r) {
+        return !r.isDeleted() && r.isVisible() && !r.isIncomplete();
+    }
+    
+    /**
+     * Replies true if the primitive {@code primitive} represents
+     * an OSM turn restriction.  
+     * 
+     * @param primitive the primitive 
+     * @return true if the primitive {@code primitive} represents
+     * an OSM turn restriction; false, otherwise
+     */
+    protected boolean isTurnRestriction(OsmPrimitive primitive) {
+    	if (primitive == null) return false;
+    	if (! (primitive instanceof Relation)) return false;
+    	String type = primitive.get("type");
+    	if (type == null || ! type.equals("restriction")) return false;
+    	return true;
+    }
+    
+    /**
+     * Populates the model with the turn restrictions in {@code turnrestrictions}.
+     * 
+     * @param turnrestrictions the turn restrictions 
+     */
+    public void setTurnRestrictions(Collection<Relation> turnrestrictions) {
+        List<Relation> sel =  getSelectedTurnRestrictions();
+        this.turnrestrictions.clear();
+        if (turnrestrictions == null) {
+            selectionModel.clearSelection();
+            fireContentsChanged(this,0,getSize());
+            return;
+        }
+        for (Relation r: turnrestrictions) {
+            if (isValid(r) && isTurnRestriction(r)) {
+                this.turnrestrictions.add(r);
+            }
+        }
+        sort();
+        fireIntervalAdded(this, 0, getSize());
+        setSelectedTurnRestrictions(sel);
+    }
+
+    /**
+     * Add all turn restrictions in <code>addedPrimitives</code> to the model for the
+     * relation list dialog
+     *
+     * @param addedPrimitives the collection of added primitives. May include nodes,
+     * ways, and relations.
+     */
+    public void addTurnRestrictions(Collection<? extends OsmPrimitive> addedPrimitives) {
+        boolean added = false;
+        for (OsmPrimitive p: addedPrimitives) {
+            if (! isTurnRestriction(p)) {
+                continue;
+            }
+
+            Relation r = (Relation)p;
+            if (!isValid(r)) continue;
+            if (turnrestrictions.contains(r)) {
+                continue;
+            }
+			turnrestrictions.add(r);
+			added = true;
+        }
+        if (added) {
+            List<Relation> sel = getSelectedTurnRestrictions();
+            sort();
+            fireIntervalAdded(this, 0, getSize());
+            setSelectedTurnRestrictions(sel);
+        }
+    }
+
+    /**
+     * Removes all turn restrictions in <code>removedPrimitives</code> from the model
+     *
+     * @param removedPrimitives the removed primitives. May include nodes, ways,
+     *   and relations
+     */
+    public void removeTurnRestrictions(Collection<? extends OsmPrimitive> removedPrimitives) {
+        if (removedPrimitives == null) return;
+        Set<Relation> removedTurnRestrictions = new HashSet<Relation>();
+        for (OsmPrimitive p: removedPrimitives) {
+        	if (!isTurnRestriction(p)) continue;
+            removedTurnRestrictions.add((Relation)p);
+        }
+        if (removedTurnRestrictions.isEmpty())return;
+        int size = turnrestrictions.size();
+        turnrestrictions.removeAll(removedTurnRestrictions);
+        if (size != turnrestrictions.size()) {
+            List<Relation> sel = getSelectedTurnRestrictions();
+            sort();
+            fireContentsChanged(this, 0, getSize());
+            setSelectedTurnRestrictions(sel);
+        }
+    }
+
+    public Object getElementAt(int index) {
+        return turnrestrictions.get(index);
+    }
+
+    public int getSize() {
+        return turnrestrictions.size();
+    }
+
+    /**
+     * Replies the list of selected, non-new relations. Empty list,
+     * if there are no selected, non-new relations.
+     *
+     * @return the list of selected, non-new relations.
+     */
+    public List<Relation> getSelectedNonNewRelations() {
+        ArrayList<Relation> ret = new ArrayList<Relation>();
+        for (int i=0; i<getSize();i++) {
+            if (!selectionModel.isSelectedIndex(i)) {
+                continue;
+            }
+            if (turnrestrictions.get(i).isNew()) {
+                continue;
+            }
+            ret.add(turnrestrictions.get(i));
+        }
+        return ret;
+    }
+
+    /**
+     * Replies the list of selected turn restrictions. Empty list,
+     * if there are no selected turn restrictions.
+     *
+     * @return the list of selected turn restrictions
+     */
+    public List<Relation> getSelectedTurnRestrictions() {
+        ArrayList<Relation> ret = new ArrayList<Relation>();
+        for (int i=0; i<getSize();i++) {
+            if (!selectionModel.isSelectedIndex(i)) {
+                continue;
+            }
+            ret.add(turnrestrictions.get(i));
+        }
+        return ret;
+    }
+
+    /**
+     * Sets the selected turn restrictions
+     *
+     * @return sel the list of selected turn restrictions
+     */
+    public void setSelectedTurnRestrictions(List<Relation> sel) {
+        selectionModel.clearSelection();
+        if (sel == null || sel.isEmpty())
+            return;
+        for (Relation r: sel) {
+            int i = turnrestrictions.indexOf(r);
+            if (i<0) {
+                continue;
+            }
+            selectionModel.addSelectionInterval(i,i);
+        }
+    }
+
+    /**
+     * Returns the index of a turn restriction 
+     *
+     * @return index of relation (-1, if not found)
+     */
+    public int getTurnRestrictionIndex(Relation tr) {
+        int i = turnrestrictions.indexOf(tr);
+        if (i<0)return -1;
+        return i;
+    }
+}
Index: /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionsPlugin.java
===================================================================
--- /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionsPlugin.java	(revision 20383)
+++ /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionsPlugin.java	(revision 20384)
@@ -2,8 +2,15 @@
 
 import org.openstreetmap.josm.gui.MapFrame;
+import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
 import org.openstreetmap.josm.plugins.Plugin;
 import org.openstreetmap.josm.plugins.PluginInformation;
+import org.openstreetmap.josm.plugins.turnrestrictions.preferences.PreferenceEditor;
 
+/**
+ * This is the main class for the turnrestriction plugin.
+ * 
+ */
 public class TurnRestrictionsPlugin extends Plugin{
+	
 	public TurnRestrictionsPlugin(PluginInformation info) {
 		super(info);
@@ -21,3 +28,8 @@
 		}
 	}
+
+	@Override
+	public PreferenceSetting getPreferenceSetting() {
+		return new PreferenceEditor();
+	}
 }
Index: /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/PreferenceEditor.java
===================================================================
--- /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/PreferenceEditor.java	(revision 20384)
+++ /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/PreferenceEditor.java	(revision 20384)
@@ -0,0 +1,112 @@
+package org.openstreetmap.josm.plugins.turnrestrictions.preferences;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import java.awt.BorderLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+import javax.swing.BorderFactory;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTabbedPane;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkListener;
+
+import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
+import org.openstreetmap.josm.gui.preferences.PreferenceTabbedPane;
+import org.openstreetmap.josm.gui.widgets.HtmlPanel;
+import org.openstreetmap.josm.tools.GBC;
+import org.openstreetmap.josm.tools.ImageProvider;
+import org.openstreetmap.josm.tools.OpenBrowser;
+
+/**
+ * This is the preference editor for the turn restrictions plugin.
+ *
+ */
+public class PreferenceEditor extends JPanel implements PreferenceSetting{
+
+	/**
+	 * builds the panel with the sponsoring information 
+	 * 
+	 * @return
+	 */
+	protected JPanel buildCreditPanel() {
+		JPanel pnl = new JPanel(new GridBagLayout());
+		pnl.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
+		GridBagConstraints gc = new GridBagConstraints();
+		gc.anchor = GridBagConstraints.NORTHWEST;
+		gc.fill = GridBagConstraints.HORIZONTAL;
+		gc.insets = new Insets(0, 0,0, 5);
+		gc.weightx = 0.0;
+		JLabel lbl = new JLabel();
+		pnl.add(lbl, gc);
+		lbl.setIcon(ImageProvider.get("skobbler-logo"));
+		
+		gc.gridx = 1;
+		gc.weightx = 1.0;
+		HtmlPanel msg  =new HtmlPanel();
+		msg.setText("<html><body>Development of the turn restriction plugin was sponsored " 
+				+ "by <a href=\"http://www.skobbler.de\">skobbler GmbH</a>.</body></html>");
+		pnl.add(msg, gc);
+		
+		// filler - grab remaining space 
+		gc.gridy = 1;
+		gc.gridx = 0;
+		gc.gridwidth = 2;
+		gc.weightx = 1.0;
+		gc.weighty = 1.0;
+		pnl.add(new JPanel(), gc);
+		
+		SkobblerUrlLauncher urlLauncher = new SkobblerUrlLauncher();
+		msg.getEditorPane().addHyperlinkListener(urlLauncher);
+		lbl.addMouseListener(urlLauncher);
+		return pnl;
+	}
+
+	
+	protected void build() {
+		setLayout(new BorderLayout());
+		JTabbedPane tp = new JTabbedPane();
+		tp.add(buildCreditPanel());
+		tp.setTitleAt(0, tr("Sponsor"));
+		add(tp, BorderLayout.CENTER);
+	}
+	
+	public PreferenceEditor() {
+		build();
+	}
+	
+	public void addGui(PreferenceTabbedPane gui) {
+		String description = tr("An OSM plugin for editing turn restrictions.");
+		JPanel tab = gui.createPreferenceTab("turnrestrictions", tr("Turn Restrictions"), description);
+        tab.add(this, GBC.eol().fill(GBC.BOTH));
+	}
+
+	public boolean ok() {
+		return false;
+	}
+	
+	/**
+	 * Launches an external browser with the sponsors home page 
+	 */
+	class SkobblerUrlLauncher extends MouseAdapter implements HyperlinkListener {
+		protected void launchBrowser() {
+			OpenBrowser.displayUrl("http://www.skobbler.de");
+		}
+		
+		public void hyperlinkUpdate(HyperlinkEvent e) {
+			if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
+				launchBrowser();
+			}
+		}
+
+		@Override
+		public void mouseClicked(MouseEvent e) {
+			launchBrowser();
+		}
+	}
+}
