Index: /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/CreateOrEditTurnRestrictionAction.java
===================================================================
--- /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/CreateOrEditTurnRestrictionAction.java	(revision 20556)
+++ /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/CreateOrEditTurnRestrictionAction.java	(revision 20556)
@@ -0,0 +1,68 @@
+package org.openstreetmap.josm.plugins.turnrestrictions;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+import java.util.Collection;
+import java.util.logging.Logger;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.actions.JosmAction;
+import org.openstreetmap.josm.data.osm.Relation;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.plugins.turnrestrictions.editor.TurnRestrictionEditor;
+import org.openstreetmap.josm.plugins.turnrestrictions.editor.TurnRestrictionEditorManager;
+import org.openstreetmap.josm.plugins.turnrestrictions.editor.TurnRestrictionSelectionPopupPanel;
+import org.openstreetmap.josm.tools.Shortcut;
+
+/**
+ * This action is triggered by a global shortcut (default is Shift-Ctrl-T on windows). 
+ * Depending on the current selection it either launches an editor for a new turn
+ * restriction or a popup component from which one can choose a turn restriction to
+ * edit. 
+ *
+ */
+public class CreateOrEditTurnRestrictionAction extends JosmAction {
+	static private final Logger logger = Logger.getLogger(CreateOrEditTurnRestrictionAction.class.getName());
+	public CreateOrEditTurnRestrictionAction() {
+		super(
+		    tr("Create/Edit turn restriction..."),
+		    null,
+		    tr("Create or edit a turn restriction."),
+		    Shortcut.registerShortcut(
+					"turnrestrictions:create-or-edit", 
+					tr("Turnrestrictions: Create or Edit"),
+					// results in Shift-Ctrl-T on windows
+					KeyEvent.VK_T,
+					Shortcut.GROUPS_ALT1+Shortcut.GROUP_HOTKEY, 
+					Shortcut.SHIFT_DEFAULT
+			),
+			true /* register action */
+	    );
+	}	
+	
+	public void actionPerformed(ActionEvent e) {
+		OsmDataLayer layer = Main.main.getEditLayer();
+		if (layer == null) return;
+		Collection<Relation> trs = TurnRestrictionSelectionPopupPanel.getTurnRestrictionsParticipatingIn(layer.data.getSelected());
+		if (layer == null) return;
+		if (trs.isEmpty()){
+			// current selection isn't participating in turn restrictions. Launch
+			// an editor for a new turn restriction 
+			//
+			Relation tr = new TurnRestrictionBuilder().buildFromSelection(layer);
+			TurnRestrictionEditor editor = new TurnRestrictionEditor(Main.map.mapView,layer,tr);
+			TurnRestrictionEditorManager.getInstance().positionOnScreen(editor);
+			TurnRestrictionEditorManager.getInstance().register(layer, tr, editor);
+			editor.setVisible(true);
+		} else {
+			// let the user choose whether he wants to create a new turn restriction or
+			// edit one of the turn restrictions participating in the current selection 
+			TurnRestrictionSelectionPopupPanel pnl = new TurnRestrictionSelectionPopupPanel(
+					layer
+			);
+			pnl.launch();
+		}
+	}
+}
Index: /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionBuilder.java
===================================================================
--- /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionBuilder.java	(revision 20556)
+++ /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionBuilder.java	(revision 20556)
@@ -0,0 +1,156 @@
+package org.openstreetmap.josm.plugins.turnrestrictions;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
+import org.openstreetmap.josm.data.osm.Node;
+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.data.osm.Way;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.tools.CheckParameterUtil;
+
+public class TurnRestrictionBuilder {
+
+	private Way from;
+	private Way to;
+	private final ArrayList<OsmPrimitive> vias = new ArrayList<OsmPrimitive>();
+	
+	public TurnRestrictionBuilder(){
+	}
+	
+	/**
+	 * Initializes the 'from' leg. Proposes the  first element
+	 * in {@code primitives} as 'from' leg if this element is a
+	 * non-deleted, visible way.
+	 * 
+	 * @param primitives
+	 */
+	protected void initFromLeg(List<OsmPrimitive> primitives){
+		if (primitives == null || primitives.isEmpty()) return;
+		OsmPrimitive p = primitives.get(0);
+		if (! (p instanceof Way)) return;
+		Way fromLeg = (Way)p;
+		if (fromLeg.isDeleted() || ! fromLeg.isVisible()) return;
+		this.from = fromLeg;
+	}
+
+	/**
+	 * Initializes the 'to' leg. Proposes the last element 
+	 * in {@code primitives} as 'to' leg if this element is a
+	 * non-deleted, visible way.
+	 *
+	 * @param primitives
+	 */
+	protected void initToLeg(List<OsmPrimitive> primitives){
+		if (primitives == null || primitives.isEmpty()) return;
+		if (primitives.size() < 2) return;
+		OsmPrimitive p = primitives.get(primitives.size()-1);
+		if (! (p instanceof Way)) return;
+		Way toLeg = (Way)p;
+		if (toLeg.isDeleted() || ! toLeg.isVisible()) return;
+		this.to = toLeg;
+	}
+	
+	/**
+	 * Initializes the vias from the two turn restriction legs. The two
+	 * legs have to be defined, otherwise no via is proposed. This methods
+	 * proposes exactly one node as via, if the two turn restriction
+	 * legs intersect at exactly one node. 
+	 */
+	protected void initViaFromLegs(){
+		if (from == null || to == null) return;		
+		// check whether 'from' and 'to' have exactly one intersecting 
+		// node. This node is proposed as via node. The turn restriction
+		// node will also provide functionality to split either or both
+		// of 'from' and 'to' way if they aren't connected from tail to
+		// head
+		//
+		HashSet<Node> nodes = new HashSet<Node>();
+		nodes.addAll(from.getNodes());
+		nodes.retainAll(to.getNodes());
+		if (nodes.size() == 1){
+			vias.add(nodes.iterator().next());
+		}		
+	}
+	
+	/**
+	 * Initializes the vias with the primitives (1..size-2), provided
+	 * these primitives aren't relations and they are visible and non-deleted.
+	 * 
+	 * @param primitives
+	 */
+	protected void initViasFromPrimitives(List<OsmPrimitive> primitives) {
+		if (primitives == null || primitives.size() <=2) return;
+		// if we didn't find a from or a to way, we don't propose via objects
+		// either
+		if (from == null || to == null) return;
+		for(int i=1; i< primitives.size() -2;i++){
+			OsmPrimitive p = primitives.get(i);
+			if (p == null) continue;
+			if (p instanceof Relation) continue;
+			if (p.isDeleted() || ! p.isVisible()) continue;
+			vias.add(p);
+		}
+	}
+	
+	/**
+	 * Resets the builder 
+	 */
+	protected void reset() {
+		this.from = null;
+		this.to = null;
+		this.vias.clear();
+	}
+	
+	/**
+	 * Creates and initializes a new turn restriction based on the primitives
+	 * currently selected in layer {@code layer}.
+	 *  
+	 * @param layer the layer. Must not be null.
+	 * @return the new initialized turn restriction. The turn restriction isn't
+	 * added to the layer yet.
+	 * @throws IllegalArgumentException thrown if layer is null
+	 */
+	public synchronized Relation buildFromSelection(OsmDataLayer layer) {
+		CheckParameterUtil.ensureParameterNotNull(layer, "layer");
+		List<OsmPrimitive> selection = new ArrayList<OsmPrimitive>(layer.data.getSelected());
+		return build(selection);
+	}
+
+	/**
+	 * Creates and initializes a new turn restriction based on primitives 
+	 * in {@code primitives}.
+	 * 
+	 * @param primitives the primitives 
+	 * @return the new initialized turn restriction. The turn restriction isn't
+	 * added to the layer yet.
+	 */
+	public synchronized Relation build(List<OsmPrimitive> primitives){
+		Relation tr = new Relation();
+		tr.put("type", "restriction");
+		if (primitives == null || primitives.isEmpty()) return tr;
+		if (primitives.size() <=2){
+			initFromLeg(primitives);
+			initToLeg(primitives);
+			initViaFromLegs();
+		} else if (primitives.size() > 2) {
+			initFromLeg(primitives);
+			initToLeg(primitives);
+			initViasFromPrimitives(primitives);
+		}
+		
+		if (from != null){
+			tr.addMember(new RelationMember("from", from));
+		}
+		if (to != null){
+			tr.addMember(new RelationMember("to", to));
+		}
+		for(OsmPrimitive via: vias){
+			tr.addMember(new RelationMember("via", via));
+		}
+		return tr;
+	}		
+}
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 20555)
+++ /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionsPlugin.java	(revision 20556)
@@ -14,6 +14,9 @@
 public class TurnRestrictionsPlugin extends Plugin{
 	
+	private CreateOrEditTurnRestrictionAction actCreateOrEditTurnRestriction;
+	
 	public TurnRestrictionsPlugin(PluginInformation info) {
 		super(info);
+		actCreateOrEditTurnRestriction = new CreateOrEditTurnRestrictionAction();
 	}
 	
Index: /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditor.java
===================================================================
--- /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditor.java	(revision 20555)
+++ /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditor.java	(revision 20556)
@@ -12,4 +12,5 @@
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
+import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeSupport;
@@ -31,4 +32,5 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.actions.AutoScaleAction;
 import org.openstreetmap.josm.command.AddCommand;
 import org.openstreetmap.josm.command.ChangeCommand;
@@ -47,4 +49,5 @@
 import org.openstreetmap.josm.tools.ImageProvider;
 
+
 public class TurnRestrictionEditor extends JDialog {
 	final private static Logger logger = Logger.getLogger(TurnRestrictionEditor.class.getName());
@@ -160,4 +163,16 @@
         tb.setFloatable(false);
         tb.add(new ApplyAction());
+        tb.addSeparator();
+        DeleteAction actDelete = new DeleteAction();
+        tb.add(actDelete);
+        addPropertyChangeListener(actDelete);
+        tb.addSeparator();
+        SelectAction actSelect = new SelectAction();
+        tb.add(actSelect);
+        addPropertyChangeListener(actSelect);
+
+        ZoomToAction actZoomTo = new ZoomToAction();
+        tb.add(actZoomTo);
+        addPropertyChangeListener(actZoomTo);
         return tb;
     }
@@ -225,6 +240,5 @@
      * that owned by the layer {@see #getLayer()}
      */
-    protected void setTurnRestriction(Relation turnRestriction) {
-      
+    protected void setTurnRestriction(Relation turnRestriction) {      
         if (turnRestriction == null) {
         	editorModel.populate(new Relation());
@@ -237,7 +251,5 @@
         Relation oldValue = this.turnRestriction;
         this.turnRestriction = turnRestriction;
-        if (this.turnRestriction != oldValue) {
-            support.firePropertyChange(TURN_RESTRICION_PROP, oldValue, this.turnRestriction);
-        }
+        support.firePropertyChange(TURN_RESTRICION_PROP, null, this.turnRestriction);
         updateTitle();
     }
@@ -247,10 +259,10 @@
      */
     protected void updateTitle() {
-        if (getTurnRestriction() == null) {
-            setTitle(tr("Create new turn restriction in layer ''{0}''", layer.getName()));
+        if (getTurnRestriction() == null || getTurnRestriction().getDataSet() == null) {
+            setTitle(tr("Create a new turn restriction in layer ''{0}''", layer.getName()));
         } else if (getTurnRestriction().isNew()) {
-            setTitle(tr("Edit new turn restriction in layer ''{0}''", layer.getName()));
+            setTitle(tr("Edit a new turn restriction in layer ''{0}''", layer.getName()));
         } else {
-            setTitle(tr("Edit turn restriction #{0} in layer ''{1}''", Long.toString(turnRestriction.getId()), layer.getName()));
+            setTitle(tr("Edit turn restriction ''{0}'' in layer ''{1}''", Long.toString(turnRestriction.getId()), layer.getName()));
         }
     }
@@ -281,10 +293,7 @@
      * @param snapshot the snapshot
      */
-    protected void setTurnRestrictionSnapshot(Relation snapshot) {
-        Relation oldValue = turnRestrictionSnapshot;
+    protected void setTurnRestrictionSnapshot(Relation snapshot) {        
         turnRestrictionSnapshot = snapshot;
-        if (turnRestrictionSnapshot != oldValue) {
-            support.firePropertyChange(TURN_RESTRICION_SNAPSHOT_PROP, oldValue, turnRestrictionSnapshot);
-        }
+        support.firePropertyChange(TURN_RESTRICION_SNAPSHOT_PROP, null, turnRestrictionSnapshot);
     }
     
@@ -486,8 +495,13 @@
          * outside of the turn restriction editor.
          */
-        protected void applyExistingNonConflictingTurnRestriction() {
-        	Relation toUpdate = new Relation(getTurnRestriction());
-            editorModel.apply(toUpdate);
-            Main.main.undoRedo.add(new ChangeCommand(getTurnRestriction(), toUpdate));
+        protected void applyExistingNonConflictingTurnRestriction() {        	
+            if (getTurnRestriction().getDataSet() == null) {
+            	editorModel.apply(getTurnRestriction());
+            	Main.main.undoRedo.add(new AddCommand(getTurnRestriction()));
+            } else {
+            	Relation toUpdate = new Relation(getTurnRestriction());
+                editorModel.apply(toUpdate);            
+            	Main.main.undoRedo.add(new ChangeCommand(getTurnRestriction(), toUpdate));
+            }
             // this will refresh the snapshot and update the dialog title
             //
@@ -645,3 +659,89 @@
         }
     }
+    
+    class DeleteAction extends AbstractAction implements PropertyChangeListener{
+    	public DeleteAction() {
+    		putValue(NAME, tr("Delete"));
+    		putValue(SHORT_DESCRIPTION, tr(("Delete this turn restriction")));
+    		putValue(SMALL_ICON, ImageProvider.get("dialogs", "delete"));
+    		updateEnabledState();
+    	}
+    	
+    	protected void updateEnabledState() {    		
+    		Relation tr = getTurnRestriction();
+    		setEnabled(tr != null && tr.getDataSet() != null);
+    	}
+
+    	public void actionPerformed(ActionEvent e) {
+    		Relation tr = getTurnRestriction();
+    		if (tr == null || tr.getDataSet() == null) return;
+    		org.openstreetmap.josm.actions.mapmode.DeleteAction.deleteRelation(
+                    getLayer(),
+                    tr
+            );
+    		setVisible(false);
+		}
+
+		public void propertyChange(PropertyChangeEvent evt) {
+			if (evt.getPropertyName().equals(TURN_RESTRICION_PROP)){
+				updateEnabledState();
+			}
+		}
+    }
+    
+    class SelectAction extends AbstractAction implements PropertyChangeListener{
+    	public SelectAction() {
+    		putValue(NAME, tr("Select"));
+    		putValue(SHORT_DESCRIPTION, tr(("Select this turn restriction")));
+    		putValue(SMALL_ICON, ImageProvider.get("dialogs", "select"));
+    		updateEnabledState();
+    	}
+    	
+    	protected void updateEnabledState() {
+    		Relation tr = getTurnRestriction();
+    		setEnabled(tr != null && tr.getDataSet() != null);
+    	}
+
+    	public void actionPerformed(ActionEvent e) {
+    		Relation tr = getTurnRestriction();
+    		if (tr == null || tr.getDataSet() == null) return;
+    		getLayer().data.setSelected(tr);
+		}
+
+		public void propertyChange(PropertyChangeEvent evt) {
+			if (evt.getPropertyName().equals(TURN_RESTRICION_PROP)){
+				updateEnabledState();
+			}
+		}
+    }
+    
+    class ZoomToAction extends AbstractAction implements PropertyChangeListener{
+    	public ZoomToAction() {
+    		putValue(NAME, tr("Zoom to"));
+    		putValue(SHORT_DESCRIPTION, tr(("Activate the layer this turn restriction belongs to and zoom to it")));
+    		putValue(SMALL_ICON, ImageProvider.get("dialogs/autoscale", "data"));
+    		updateEnabledState();
+    	}
+    	
+    	protected void updateEnabledState() {
+    		Relation tr = getTurnRestriction();
+    		setEnabled(tr != null && tr.getDataSet() != null);
+    	}
+
+    	public void actionPerformed(ActionEvent e) {
+    		if (Main.main.getActiveLayer() != getLayer()){
+    			Main.map.mapView.setActiveLayer(getLayer());
+    		}
+    		Relation tr = getTurnRestriction();
+    		if (tr == null || tr.getDataSet() == null) return;
+    		getLayer().data.setSelected(tr);    		
+    		AutoScaleAction.zoomToSelection();
+		}
+
+		public void propertyChange(PropertyChangeEvent evt) {
+			if (evt.getPropertyName().equals(TURN_RESTRICION_PROP)){
+				updateEnabledState();
+			}
+		}
+    }
 }
Index: /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionSelectionPopupPanel.java
===================================================================
--- /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionSelectionPopupPanel.java	(revision 20556)
+++ /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionSelectionPopupPanel.java	(revision 20556)
@@ -0,0 +1,364 @@
+package org.openstreetmap.josm.plugins.turnrestrictions.editor;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.MouseInfo;
+import java.awt.Point;
+import java.awt.PointerInfo;
+import java.awt.event.ActionEvent;
+import java.awt.event.FocusAdapter;
+import java.awt.event.FocusEvent;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.logging.Logger;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.KeyStroke;
+import javax.swing.ListSelectionModel;
+import javax.swing.Popup;
+import javax.swing.PopupFactory;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.TableColumn;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.Relation;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.plugins.turnrestrictions.TurnRestrictionBuilder;
+import org.openstreetmap.josm.plugins.turnrestrictions.list.TurnRestrictionCellRenderer;
+import org.openstreetmap.josm.tools.CheckParameterUtil;
+import org.openstreetmap.josm.tools.ImageProvider;
+
+/**
+ * TurnRestrictionSelectionPopupPanel is displayed in a {@see Popup} to select whether
+ * the user wants to create a new turn restriction or whether he wants to edit one
+ * of a list of turn restrictions.
+ *
+ */
+public class TurnRestrictionSelectionPopupPanel extends JPanel{
+	static private final Logger logger = Logger.getLogger(TurnRestrictionSelectionPopupPanel.class.getName());
+
+	/** the parent popup */
+	private Popup parentPopup;
+	/** the button for creating a new turn restriction */
+	private JButton btnNew;
+	/** the table with the turn restrictions which can be edited */
+	private JTable tblTurnRestrictions;	
+	private OsmDataLayer layer;
+	
+	
+	
+	/**
+	 * Replies the collection of turn restrictions the primitives in {@code primitives}
+	 * currently participate in.
+	 * 
+	 * @param primitives the collection of primitives. May be null.
+	 * @return the collection of "parent" turn restrictions. 
+	 */
+	static public Collection<Relation> getTurnRestrictionsParticipatingIn(Collection<OsmPrimitive> primitives){
+		HashSet<Relation> ret = new HashSet<Relation>();
+		if (primitives == null) return ret;
+		for (OsmPrimitive p: primitives){
+			if (p == null) continue;
+			if (p.isDeleted() || !p.isVisible()) continue;
+			for (OsmPrimitive parent: p.getReferrers()){
+				if (!(parent instanceof Relation)) continue;
+				String type = parent.get("type");
+				if (type == null || ! type.equals("restriction")) continue;
+				if (parent.isDeleted() || ! parent.isVisible()) continue;
+				ret.add((Relation)parent);
+			}
+		}
+		return ret;
+	}
+	
+	/**
+	 * Registers 1..9 shortcuts for the first 9 turn restrictions to
+	 * edit
+	 * 
+	 * @param editCandiates the edit candidates 
+	 */
+	protected void registerEditShortcuts(Collection<Relation> editCandiates){
+		for(int i=1; i <= Math.min(editCandiates.size(),9);i++){
+			int vkey = 0;
+			switch(i){
+			case 1: vkey = KeyEvent.VK_1; break;
+			case 2: vkey = KeyEvent.VK_2; break;
+			case 3: vkey = KeyEvent.VK_3; break;
+			case 4: vkey = KeyEvent.VK_4; break;
+			case 5: vkey = KeyEvent.VK_5; break;
+			case 6: vkey = KeyEvent.VK_6; break;
+			case 7: vkey = KeyEvent.VK_7; break;
+			case 8: vkey = KeyEvent.VK_8; break;
+			case 9: vkey = KeyEvent.VK_9; break;
+			}
+			registerKeyboardAction(new EditTurnRestrictionAction(i-1), KeyStroke.getKeyStroke(vkey,0), WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+		}
+	}
+	/**
+	 * Builds the panel with the turn restrictions table 
+	 * 
+	 * @param editCandiates the list of edit candiates  
+	 * @return the panel 
+	 */
+	protected JPanel buildTurnRestrictionTablePanel(Collection<Relation> editCandiates) {
+		tblTurnRestrictions = new JTable(new TurnRestrictionTableModel(editCandiates), new TurnRestrictionTableColumnModel());
+		tblTurnRestrictions.setColumnSelectionAllowed(false);
+		tblTurnRestrictions.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
+		TurnRestrictionCellRenderer renderer = new TurnRestrictionCellRenderer();
+		tblTurnRestrictions.setRowHeight((int)renderer.getPreferredSize().getHeight());
+		
+		// create a scroll pane, remove the table header 
+		JScrollPane pane = new JScrollPane(tblTurnRestrictions);
+		pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+		pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
+		tblTurnRestrictions.setTableHeader(null);
+		pane.setColumnHeaderView(null);
+		
+		// respond to double click and ENTER 
+		EditSelectedTurnRestrictionAction action = new EditSelectedTurnRestrictionAction();
+		tblTurnRestrictions.addMouseListener(action);
+		tblTurnRestrictions.registerKeyboardAction(action, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0), WHEN_FOCUSED);
+		
+		tblTurnRestrictions.addFocusListener(new FocusHandler());
+		
+		JPanel pnl = new JPanel(new BorderLayout());
+		pnl.add(pane, BorderLayout.CENTER);
+		
+		pnl.setBackground(UIManager.getColor("Table.background"));
+		pane.setBackground(UIManager.getColor("Table.background"));
+		return pnl;		
+	}
+	
+	/**
+	 * Builds the panel 
+	 * 
+	 * @param editCandiates the edit candidates
+	 */
+	protected void build(Collection<Relation> editCandiates) {
+		setLayout(new BorderLayout());
+		add(btnNew = new JButton(new NewAction()), BorderLayout.NORTH);
+		btnNew.setFocusable(true);
+		btnNew.registerKeyboardAction(btnNew.getAction(), KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0), WHEN_FOCUSED);
+		registerKeyboardAction(new CloseAction(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,0), WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+		registerKeyboardAction(btnNew.getAction(), KeyStroke.getKeyStroke(KeyEvent.VK_N,0), WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+		
+		btnNew.addFocusListener(new FocusHandler());
+		
+		if (editCandiates != null && ! editCandiates.isEmpty()) {
+			add(buildTurnRestrictionTablePanel(editCandiates), BorderLayout.CENTER);	
+			registerEditShortcuts(editCandiates);
+		}
+		
+		setBackground(UIManager.getColor("Table.background"));		
+	}
+
+	
+	/**
+	 * Creates the panel
+	 * 
+	 * @param layer the reference OSM data layer. Must not be null.
+	 * @throws IllegalArgumentException thrown if {@code layer} is null
+	 */
+	public TurnRestrictionSelectionPopupPanel(OsmDataLayer layer) throws IllegalArgumentException {
+		CheckParameterUtil.ensureParameterNotNull(layer, "layer");
+		this.layer = layer;
+		build(getTurnRestrictionsParticipatingIn(layer.data.getSelected()));
+	}
+	
+	/**
+	 * Creates the panel
+	 * 
+	 * @param layer the reference OSM data layer. Must not be null.
+	 * @param editCandidates a collection of turn restrictions as edit candidates. May be null. 
+	 * @throws IllegalArgumentException thrown if {@code layer} is null
+	 */
+	public TurnRestrictionSelectionPopupPanel(OsmDataLayer layer, Collection<Relation> editCandiates) {
+		CheckParameterUtil.ensureParameterNotNull(layer, "layer");
+		this.layer = layer;
+		build(editCandiates);
+	}
+	
+	/**
+	 * Launches a popup with this panel as content 
+	 */
+	public void launch(){
+		PointerInfo info = MouseInfo.getPointerInfo();
+		Point pt = info.getLocation();
+		parentPopup = PopupFactory.getSharedInstance().getPopup(Main.map.mapView,this, pt.x, pt.y);
+		parentPopup.show();
+		btnNew.requestFocusInWindow();
+	}
+
+	@Override
+	public Dimension getPreferredSize() {
+		int bestheight = (int)btnNew.getPreferredSize().getHeight()
+		      + Math.min(2, tblTurnRestrictions.getRowCount()) * tblTurnRestrictions.getRowHeight()
+		      + 5;
+		return new Dimension(300, bestheight);
+	}
+	
+	/* --------------------------------------------------------------------------------------- */
+	/* inner classes                                                                           */
+	/* --------------------------------------------------------------------------------------- */
+	
+	private class NewAction extends AbstractAction {
+		public NewAction() {
+			putValue(NAME, tr("Create new turn restriction"));
+			putValue(SHORT_DESCRIPTION, tr("Launch the turn restriction editor to create a new turn restriction"));
+			putValue(SMALL_ICON, ImageProvider.get("new"));
+			putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_N, 0));
+		}
+
+		public void actionPerformed(ActionEvent e) {
+			Relation tr = new TurnRestrictionBuilder().buildFromSelection(layer);
+			TurnRestrictionEditor editor = new TurnRestrictionEditor(Main.map.mapView,layer,tr);
+			TurnRestrictionEditorManager.getInstance().positionOnScreen(editor);
+			TurnRestrictionEditorManager.getInstance().register(layer, tr, editor);
+			if (parentPopup != null){
+				parentPopup.hide();
+			}
+			editor.setVisible(true);
+		}
+	}
+	
+	abstract private  class AbstractEditTurnRestrictionAction extends AbstractAction {
+		protected void launchEditor(Relation tr){
+			TurnRestrictionEditorManager manager = TurnRestrictionEditorManager.getInstance();
+			TurnRestrictionEditor editor = manager.getEditorForRelation(layer, tr);
+			if (parentPopup != null){
+				parentPopup.hide();
+			}
+			if (editor != null) {
+				editor.setVisible(true);
+				editor.toFront();
+			} else {
+				editor = new TurnRestrictionEditor(Main.map.mapView, layer,tr);
+				manager.positionOnScreen(editor);
+				manager.register(layer, tr,editor);
+				editor.setVisible(true);
+			}
+		}
+	}
+	
+	private class EditTurnRestrictionAction extends AbstractEditTurnRestrictionAction {
+		private int idx;
+		
+		public EditTurnRestrictionAction(int idx){
+			this.idx = idx;
+		}
+		
+		public void actionPerformed(ActionEvent e) {
+			Relation tr = (Relation)tblTurnRestrictions.getModel().getValueAt(idx, 1);
+			launchEditor(tr);
+		}		
+	}
+	
+	private class EditSelectedTurnRestrictionAction extends AbstractEditTurnRestrictionAction implements MouseListener{
+		public void editTurnRestrictionAtRow(int row){
+			if (row < 0) return;
+			Relation tr = (Relation)tblTurnRestrictions.getModel().getValueAt(row, 1);
+			launchEditor(tr);
+		}
+		public void actionPerformed(ActionEvent e) {
+			int row = tblTurnRestrictions.getSelectedRow();
+			editTurnRestrictionAtRow(row);
+		}
+		public void mouseClicked(MouseEvent e) {
+			if (!(SwingUtilities.isLeftMouseButton(e) && e.getClickCount() >= 2)) return;
+			int row = tblTurnRestrictions.rowAtPoint(e.getPoint());
+			if (row < 0) return;
+			editTurnRestrictionAtRow(row);			
+		}
+		public void mouseEntered(MouseEvent e) {}
+		public void mouseExited(MouseEvent e) {}
+		public void mousePressed(MouseEvent e) {}
+		public void mouseReleased(MouseEvent e) {}
+	}
+	
+	private class CloseAction extends AbstractAction {
+		public void actionPerformed(ActionEvent e) {
+			if (parentPopup != null){
+				parentPopup.hide();
+			}
+		}		
+	}
+	
+	private static class TurnRestrictionTableModel extends AbstractTableModel {
+		private final ArrayList<Relation> turnrestrictions = new ArrayList<Relation>();
+
+		public TurnRestrictionTableModel(Collection<Relation> turnrestrictions){
+			this.turnrestrictions.clear();
+			if (turnrestrictions != null){
+				this.turnrestrictions.addAll(turnrestrictions);
+			}
+			fireTableDataChanged();
+		}
+		
+		public int getRowCount() {
+			return turnrestrictions.size();
+		}
+
+		public int getColumnCount() {
+			return 2;
+		}
+
+		public Object getValueAt(int rowIndex, int columnIndex) {
+			switch(columnIndex){
+			case 0:
+				if (rowIndex <=8 ) {
+					return Integer.toString(rowIndex+1);
+				} else {
+					return "";
+				}
+			case 1:
+				return turnrestrictions.get(rowIndex);
+			}
+			// should not happen
+			return null;
+		}
+	}
+	
+	private static class TurnRestrictionTableColumnModel extends DefaultTableColumnModel {		
+		public TurnRestrictionTableColumnModel() {			
+			// the idx column
+			TableColumn col = new TableColumn(0);			
+			col.setResizable(false);
+			col.setWidth(50);
+			addColumn(col);
+			
+			// the column displaying turn restrictions 
+			col = new TableColumn(1);			
+			col.setResizable(false);
+			col.setPreferredWidth(400);
+			col.setCellRenderer(new TurnRestrictionCellRenderer());
+			addColumn(col);			
+		}
+	}
+	
+	private class FocusHandler extends FocusAdapter {		
+		@Override
+		public void focusLost(FocusEvent e) {
+			// if we loose the focus to a component outside of the popup panel
+			// we hide the popup
+			if (!SwingUtilities.isDescendingFrom(e.getOppositeComponent(), TurnRestrictionSelectionPopupPanel.this)) {
+				if (parentPopup != null){
+					parentPopup.hide();
+				}
+			}
+		}
+	}
+}
Index: /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionCellRenderer.java
===================================================================
--- /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionCellRenderer.java	(revision 20556)
+++ /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionCellRenderer.java	(revision 20556)
@@ -0,0 +1,242 @@
+package org.openstreetmap.josm.plugins.turnrestrictions.list;
+
+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 java.util.logging.Logger;
+
+import javax.swing.ImageIcon;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JTable;
+import javax.swing.ListCellRenderer;
+import javax.swing.UIManager;
+import javax.swing.table.TableCellRenderer;
+
+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;
+import static org.openstreetmap.josm.tools.I18n.trc;
+
+/**
+ * This is a cell renderer for turn restrictions.
+ * 
+ * It can be used a cell renderer in lists of turn restrictions and as cell renderer in
+ * {@see JTable}s displaying turn restrictions. 
+ * 
+ */
+public class TurnRestrictionCellRenderer extends JPanel implements ListCellRenderer, TableCellRenderer{
+	static private final Logger logger = Logger.getLogger(TurnRestrictionCellRenderer.class.getName());
+	
+	/** 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 TurnRestrictionCellRenderer() {
+		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,0,2,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;
+		add(new JMultilineLabel("<html><strong>" + trc("turnrestrictions","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>" + trc("turnrestriction", "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);
+	}
+
+	/* ---------------------------------------------------------------------------------- */
+	/* interface ListCellRenderer                                                         */
+	/* ---------------------------------------------------------------------------------- */
+	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;
+	}
+
+	/* ---------------------------------------------------------------------------------- */
+	/* interface TableCellRenderer                                                        */
+	/* ---------------------------------------------------------------------------------- */
+	public Component getTableCellRendererComponent(JTable table, Object value,
+			boolean isSelected, boolean hasFocus, int row, int column) {
+		renderColor(isSelected);		
+		Relation tr = (Relation)value;
+		renderIcon(tr);
+		renderFrom(tr);
+		renderTo(tr);		
+		return this;
+	}	
+}
Index: plications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionListCellRenderer.java
===================================================================
--- /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionListCellRenderer.java	(revision 20555)
+++ 	(revision )
@@ -1,221 +1,0 @@
-package org.openstreetmap.josm.plugins.turnrestrictions.list;
-
-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/list/TurnRestrictionsInDatasetView.java
===================================================================
--- /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsInDatasetView.java	(revision 20555)
+++ /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsInDatasetView.java	(revision 20556)
@@ -25,5 +25,5 @@
 		lstTurnRestrictions.setSelectionModel(selectionModel);
 		lstTurnRestrictions.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
-		lstTurnRestrictions.setCellRenderer(new TurnRestrictionListCellRenderer());
+		lstTurnRestrictions.setCellRenderer(new TurnRestrictionCellRenderer());
 		
 		setLayout(new BorderLayout());
Index: /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsInSelectionView.java
===================================================================
--- /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsInSelectionView.java	(revision 20555)
+++ /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsInSelectionView.java	(revision 20556)
@@ -28,5 +28,5 @@
 		lstTurnRestrictions.setSelectionModel(selectionModel);
 		lstTurnRestrictions.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
-		lstTurnRestrictions.setCellRenderer(new TurnRestrictionListCellRenderer());
+		lstTurnRestrictions.setCellRenderer(new TurnRestrictionCellRenderer());
 		
 		setLayout(new BorderLayout());
Index: /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsListDialog.java
===================================================================
--- /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsListDialog.java	(revision 20555)
+++ /applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsListDialog.java	(revision 20556)
@@ -33,4 +33,5 @@
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher;
+import org.openstreetmap.josm.plugins.turnrestrictions.TurnRestrictionBuilder;
 import org.openstreetmap.josm.plugins.turnrestrictions.editor.TurnRestrictionEditor;
 import org.openstreetmap.josm.plugins.turnrestrictions.editor.TurnRestrictionEditorManager;
@@ -304,8 +305,8 @@
 
         public void run() {
-        	 Relation tr = new Relation();
         	 OsmDataLayer layer =  Main.main.getEditLayer();
         	 if (layer == null) return;
-        	 TurnRestrictionEditor editor = new TurnRestrictionEditor(TurnRestrictionsListDialog.this, layer);
+        	 Relation tr = new TurnRestrictionBuilder().buildFromSelection(layer);
+        	 TurnRestrictionEditor editor = new TurnRestrictionEditor(TurnRestrictionsListDialog.this, layer, tr);
              TurnRestrictionEditorManager.getInstance().positionOnScreen(editor);             
              TurnRestrictionEditorManager.getInstance().register(layer, tr, editor);
