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 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/CreateOrEditTurnRestrictionAction.java	(revision 23192)
@@ -29,93 +29,93 @@
  */
 public class CreateOrEditTurnRestrictionAction extends JosmAction {
-	static private final Logger logger = Logger.getLogger(CreateOrEditTurnRestrictionAction.class.getName());
-	
-	/**
-	 * Installs the global key stroke with which creating/editing a turn restriction
-	 * is triggered.
-	 * 
-	 * @param keyStroke the key stroke 
-	 */
-	static public void install(KeyStroke keyStroke){
-		InputMap im = Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
-		Object actionMapKey = im.get(keyStroke);
-		if (actionMapKey != null && !actionMapKey.toString().equals("turnrestrictions:create-or-edit")) {
-			System.out.println(tr("Warning: turnrestrictions plugin replaces already existing action ''{0}'' behind shortcut ''{1}'' by action ''{2}''", actionMapKey.toString(), keyStroke.toString(), "turnrestrictions:create-or-edit"));			
-		}
-		KeyStroke[] keys = im.keys();
-		if (keys != null){
-			for(KeyStroke ks: im.keys()){
-				if (im.get(ks).equals("turnrestrictions:create-or-edit")) {
-					im.remove(ks);
-				}
-			}
-		}
-		im.put(keyStroke, "turnrestrictions:create-or-edit");
-		ActionMap am = Main.contentPane.getActionMap();
-		am.put("turnrestrictions:create-or-edit", getInstance());
-	}
-	
-	/**
-	 * Installs  global key stroke configured in the preferences.
-	 * 
-	 * @param keyStroke the key stroke 
-	 */
-	static public void install(){
-		String value = Main.pref.get(PreferenceKeys.EDIT_SHORTCUT, "shift ctrl T");
-		KeyStroke key = KeyStroke.getKeyStroke(value);
-		if (key == null){
-			System.out.println(tr("Warning: illegal value ''{0}'' for preference key ''{1}''. Falling back to default value ''shift ctrl T''.", value, PreferenceKeys.EDIT_SHORTCUT));
-			key = KeyStroke.getKeyStroke("shift ctrl T");
-		}
-		install(key);
-	}
-	
-	/** the singleton instance of this action */
-	private static CreateOrEditTurnRestrictionAction instance;
-	
-	/**
-	 * Replies the unique instance of this action
-	 * 
-	 * @return
-	 */
-	public static CreateOrEditTurnRestrictionAction getInstance() {
-		if (instance == null){
-			instance = new CreateOrEditTurnRestrictionAction();
-		}
-		return instance;
-	}
-	
-	protected CreateOrEditTurnRestrictionAction() {
-		super(
-		    tr("Create/Edit turn restriction..."),
-		    null,
-		    tr("Create or edit a turn restriction."),
-		    null, // shortcut is going to be registered later 
-			false 
-	    );
-	}	
-	
-	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();
-		}
-	}
+    static private final Logger logger = Logger.getLogger(CreateOrEditTurnRestrictionAction.class.getName());
+    
+    /**
+     * Installs the global key stroke with which creating/editing a turn restriction
+     * is triggered.
+     * 
+     * @param keyStroke the key stroke 
+     */
+    static public void install(KeyStroke keyStroke){
+        InputMap im = Main.contentPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
+        Object actionMapKey = im.get(keyStroke);
+        if (actionMapKey != null && !actionMapKey.toString().equals("turnrestrictions:create-or-edit")) {
+            System.out.println(tr("Warning: turnrestrictions plugin replaces already existing action ''{0}'' behind shortcut ''{1}'' by action ''{2}''", actionMapKey.toString(), keyStroke.toString(), "turnrestrictions:create-or-edit"));            
+        }
+        KeyStroke[] keys = im.keys();
+        if (keys != null){
+            for(KeyStroke ks: im.keys()){
+                if (im.get(ks).equals("turnrestrictions:create-or-edit")) {
+                    im.remove(ks);
+                }
+            }
+        }
+        im.put(keyStroke, "turnrestrictions:create-or-edit");
+        ActionMap am = Main.contentPane.getActionMap();
+        am.put("turnrestrictions:create-or-edit", getInstance());
+    }
+    
+    /**
+     * Installs  global key stroke configured in the preferences.
+     * 
+     * @param keyStroke the key stroke 
+     */
+    static public void install(){
+        String value = Main.pref.get(PreferenceKeys.EDIT_SHORTCUT, "shift ctrl T");
+        KeyStroke key = KeyStroke.getKeyStroke(value);
+        if (key == null){
+            System.out.println(tr("Warning: illegal value ''{0}'' for preference key ''{1}''. Falling back to default value ''shift ctrl T''.", value, PreferenceKeys.EDIT_SHORTCUT));
+            key = KeyStroke.getKeyStroke("shift ctrl T");
+        }
+        install(key);
+    }
+    
+    /** the singleton instance of this action */
+    private static CreateOrEditTurnRestrictionAction instance;
+    
+    /**
+     * Replies the unique instance of this action
+     * 
+     * @return
+     */
+    public static CreateOrEditTurnRestrictionAction getInstance() {
+        if (instance == null){
+            instance = new CreateOrEditTurnRestrictionAction();
+        }
+        return instance;
+    }
+    
+    protected CreateOrEditTurnRestrictionAction() {
+        super(
+            tr("Create/Edit turn restriction..."),
+            null,
+            tr("Create or edit a turn restriction."),
+            null, // shortcut is going to be registered later 
+            false 
+        );
+    }   
+    
+    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 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionBuilder.java	(revision 23192)
@@ -21,142 +21,142 @@
 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;
-	}
+    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);
-	}
+    /**
+     * 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;
-	}		
+    /**
+     * 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 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/TurnRestrictionsPlugin.java	(revision 23192)
@@ -13,25 +13,25 @@
  */
 public class TurnRestrictionsPlugin extends Plugin{
-	
-	public TurnRestrictionsPlugin(PluginInformation info) {
-		super(info);		
-	}
-	
-	/**
-	 * Called when the JOSM map frame is created or destroyed. 
-	 */
-	@Override
-	public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {				
-		if (oldFrame == null && newFrame != null) { // map frame added
-			TurnRestrictionsListDialog dialog  = new TurnRestrictionsListDialog();
-			// add the dialog
-			newFrame.addToggleDialog(dialog);
-			CreateOrEditTurnRestrictionAction.install();
-		}
-	}
+    
+    public TurnRestrictionsPlugin(PluginInformation info) {
+        super(info);        
+    }
+    
+    /**
+     * Called when the JOSM map frame is created or destroyed. 
+     */
+    @Override
+    public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {             
+        if (oldFrame == null && newFrame != null) { // map frame added
+            TurnRestrictionsListDialog dialog  = new TurnRestrictionsListDialog();
+            // add the dialog
+            newFrame.addToggleDialog(dialog);
+            CreateOrEditTurnRestrictionAction.install();
+        }
+    }
 
-	@Override
-	public PreferenceSetting getPreferenceSetting() {
-		return new PreferenceEditor();
-	}
+    @Override
+    public PreferenceSetting getPreferenceSetting() {
+        return new PreferenceEditor();
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/dnd/PrimitiveIdListProvider.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/dnd/PrimitiveIdListProvider.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/dnd/PrimitiveIdListProvider.java	(revision 23192)
@@ -5,10 +5,10 @@
 import org.openstreetmap.josm.data.osm.PrimitiveId;;
 public interface PrimitiveIdListProvider {
-	/**
-	 * Replies the list of currently selected primitive IDs. Replies an empty list if no primitive IDs
-	 * are selected.
-	 * 
-	 * @return the list of currently selected primitive IDs
-	 */
-	List<PrimitiveId> getSelectedPrimitiveIds();
+    /**
+     * Replies the list of currently selected primitive IDs. Replies an empty list if no primitive IDs
+     * are selected.
+     * 
+     * @return the list of currently selected primitive IDs
+     */
+    List<PrimitiveId> getSelectedPrimitiveIds();
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/dnd/PrimitiveIdListTransferHandler.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/dnd/PrimitiveIdListTransferHandler.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/dnd/PrimitiveIdListTransferHandler.java	(revision 23192)
@@ -20,44 +20,44 @@
  */
 public class PrimitiveIdListTransferHandler extends TransferHandler {
-	static private final Logger logger = Logger.getLogger(PrimitiveIdListTransferHandler.class.getName());
-	private PrimitiveIdListProvider provider;
-	
-	/**
-	 * Replies true if {@code transferFlavors} includes the data flavor {@see PrimitiveIdTransferable#PRIMITIVE_ID_LIST_FLAVOR}.
+    static private final Logger logger = Logger.getLogger(PrimitiveIdListTransferHandler.class.getName());
+    private PrimitiveIdListProvider provider;
+    
+    /**
+     * Replies true if {@code transferFlavors} includes the data flavor {@see PrimitiveIdTransferable#PRIMITIVE_ID_LIST_FLAVOR}.
 
-	 * @param transferFlavors an array of transferFlavors
-	 * @return true if {@code transferFlavors} includes the data flavor {@see PrimitiveIdTransferable#PRIMITIVE_ID_LIST_FLAVOR}.
-	 */
-	public static boolean isSupportedFlavor(DataFlavor[] transferFlavors) {
-		for (DataFlavor df: transferFlavors) {
-			if (df.equals(PrimitiveIdTransferable.PRIMITIVE_ID_LIST_FLAVOR)) return true;
-		}
-		return false;
-	}
-	
-	/**
-	 * Creates the transfer handler 
-	 * 
-	 * @param provider the provider of the primitive IDs. Must not be null.
-	 * @throws IllegalArgumentException thrown if provider is null.
-	 */
-	public PrimitiveIdListTransferHandler(PrimitiveIdListProvider provider) throws IllegalArgumentException{
-		CheckParameterUtil.ensureParameterNotNull(provider, "provider");
-		this.provider = provider;
-	}
+     * @param transferFlavors an array of transferFlavors
+     * @return true if {@code transferFlavors} includes the data flavor {@see PrimitiveIdTransferable#PRIMITIVE_ID_LIST_FLAVOR}.
+     */
+    public static boolean isSupportedFlavor(DataFlavor[] transferFlavors) {
+        for (DataFlavor df: transferFlavors) {
+            if (df.equals(PrimitiveIdTransferable.PRIMITIVE_ID_LIST_FLAVOR)) return true;
+        }
+        return false;
+    }
+    
+    /**
+     * Creates the transfer handler 
+     * 
+     * @param provider the provider of the primitive IDs. Must not be null.
+     * @throws IllegalArgumentException thrown if provider is null.
+     */
+    public PrimitiveIdListTransferHandler(PrimitiveIdListProvider provider) throws IllegalArgumentException{
+        CheckParameterUtil.ensureParameterNotNull(provider, "provider");
+        this.provider = provider;
+    }
 
-	
-	
-	protected Transferable createTransferable(JComponent c) {
-		return new PrimitiveIdTransferable(provider.getSelectedPrimitiveIds());			
-	}
+    
+    
+    protected Transferable createTransferable(JComponent c) {
+        return new PrimitiveIdTransferable(provider.getSelectedPrimitiveIds());         
+    }
 
-	public int getSourceActions(JComponent c) {
-		return COPY;
-	}
+    public int getSourceActions(JComponent c) {
+        return COPY;
+    }
 
-	@Override
-	public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) {
-		return isSupportedFlavor(transferFlavors);	
-	}	
+    @Override
+    public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) {
+        return isSupportedFlavor(transferFlavors);  
+    }   
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/dnd/PrimitiveIdTransferable.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/dnd/PrimitiveIdTransferable.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/dnd/PrimitiveIdTransferable.java	(revision 23192)
@@ -18,84 +18,84 @@
  */
 public class PrimitiveIdTransferable implements Transferable{
-	
-	/** the data flower for the set of of primitive ids */
-	static public final DataFlavor PRIMITIVE_ID_LIST_FLAVOR = 
-		new DataFlavor(Set.class, "a set of OSM primitive ids");
-	
-	/** 
-	 * this transferable supports two flavors: (1) {@see #PRIMITIVE_ID_LIST_FLAVOR} and
-	 * (2) {@see DataFlavor#stringFlavor}.
-	 * 
-	 * See also {@see #getPrimitiveIds()} and {@see #getAsString()}
-	 */
-	static public final DataFlavor[] SUPPORTED_FLAVORS = new DataFlavor[] {
-		PRIMITIVE_ID_LIST_FLAVOR,
-		DataFlavor.stringFlavor
-	};
+    
+    /** the data flower for the set of of primitive ids */
+    static public final DataFlavor PRIMITIVE_ID_LIST_FLAVOR = 
+        new DataFlavor(Set.class, "a set of OSM primitive ids");
+    
+    /** 
+     * this transferable supports two flavors: (1) {@see #PRIMITIVE_ID_LIST_FLAVOR} and
+     * (2) {@see DataFlavor#stringFlavor}.
+     * 
+     * See also {@see #getPrimitiveIds()} and {@see #getAsString()}
+     */
+    static public final DataFlavor[] SUPPORTED_FLAVORS = new DataFlavor[] {
+        PRIMITIVE_ID_LIST_FLAVOR,
+        DataFlavor.stringFlavor
+    };
 
-	
-	private List<PrimitiveId> ids = new ArrayList<PrimitiveId>();
-	
-	/**
-	 * Creates a transferable from a collection of {@see PrimitiveId}s
-	 * 
-	 * @param ids
-	 */
-	public PrimitiveIdTransferable(List<PrimitiveId> ids) {
-		if (ids == null) return;
-		for(PrimitiveId id: ids) {
-			this.ids.add(new SimplePrimitiveId(id.getUniqueId(), id.getType()));
-		}
-	}
-	
-	/**
-	 * If flavor is {@see #PRIMITIVE_ID_SET_FLAVOR}, replies a the list of
-	 * transferred {@see PrimitiveId}s 
-	 * 
-	 * If flavor is {@see DataFlavor#stringFlavor}, replies a string representation
-	 * of the list of transferred {@see PrimitiveId}s
-	 */
-	public Object getTransferData(DataFlavor flavor)
-			throws UnsupportedFlavorException, IOException {
-		if (PRIMITIVE_ID_LIST_FLAVOR.equals(flavor)) {
-			return getPrimitiveIds();
-		} else if (DataFlavor.stringFlavor.equals(flavor)) {
-			return getAsString();
-		}
-		throw new UnsupportedFlavorException(flavor);
-	}
-	
-	/**
-	 * Replies the list of OSM primitive ids
-	 * 
-	 * @return the list of OSM primitive ids
-	 */
-	public List<PrimitiveId> getPrimitiveIds() {
-		return ids;
-	}
-	
-	/**
-	 * Replies a string representation of the list of OSM primitive ids
-	 *  
-	 * @return a string representation of the list of OSM primitive ids
-	 */
-	public String getAsString() {
-		StringBuffer sb = new StringBuffer();
-		for(PrimitiveId id: ids) {
-			if (sb.length() > 0) sb.append(",");
-			sb.append(id.getType().getAPIName()).append("/").append(id.getUniqueId());
-		}
-		return sb.toString();
-	}
+    
+    private List<PrimitiveId> ids = new ArrayList<PrimitiveId>();
+    
+    /**
+     * Creates a transferable from a collection of {@see PrimitiveId}s
+     * 
+     * @param ids
+     */
+    public PrimitiveIdTransferable(List<PrimitiveId> ids) {
+        if (ids == null) return;
+        for(PrimitiveId id: ids) {
+            this.ids.add(new SimplePrimitiveId(id.getUniqueId(), id.getType()));
+        }
+    }
+    
+    /**
+     * If flavor is {@see #PRIMITIVE_ID_SET_FLAVOR}, replies a the list of
+     * transferred {@see PrimitiveId}s 
+     * 
+     * If flavor is {@see DataFlavor#stringFlavor}, replies a string representation
+     * of the list of transferred {@see PrimitiveId}s
+     */
+    public Object getTransferData(DataFlavor flavor)
+            throws UnsupportedFlavorException, IOException {
+        if (PRIMITIVE_ID_LIST_FLAVOR.equals(flavor)) {
+            return getPrimitiveIds();
+        } else if (DataFlavor.stringFlavor.equals(flavor)) {
+            return getAsString();
+        }
+        throw new UnsupportedFlavorException(flavor);
+    }
+    
+    /**
+     * Replies the list of OSM primitive ids
+     * 
+     * @return the list of OSM primitive ids
+     */
+    public List<PrimitiveId> getPrimitiveIds() {
+        return ids;
+    }
+    
+    /**
+     * Replies a string representation of the list of OSM primitive ids
+     *  
+     * @return a string representation of the list of OSM primitive ids
+     */
+    public String getAsString() {
+        StringBuffer sb = new StringBuffer();
+        for(PrimitiveId id: ids) {
+            if (sb.length() > 0) sb.append(",");
+            sb.append(id.getType().getAPIName()).append("/").append(id.getUniqueId());
+        }
+        return sb.toString();
+    }
 
-	public DataFlavor[] getTransferDataFlavors() {
-		return SUPPORTED_FLAVORS;
-	}
+    public DataFlavor[] getTransferDataFlavors() {
+        return SUPPORTED_FLAVORS;
+    }
 
-	public boolean isDataFlavorSupported(DataFlavor flavor) {
-		for(DataFlavor df: SUPPORTED_FLAVORS) {
-			if (df.equals(flavor)) return true;
-		}
-		return false;
-	}			
+    public boolean isDataFlavorSupported(DataFlavor flavor) {
+        for(DataFlavor df: SUPPORTED_FLAVORS) {
+            if (df.equals(flavor)) return true;
+        }
+        return false;
+    }           
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/AdvancedEditorPanel.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/AdvancedEditorPanel.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/AdvancedEditorPanel.java	(revision 23192)
@@ -23,100 +23,100 @@
  */
 public class AdvancedEditorPanel extends JPanel {
-	private static final Logger logger = Logger.getLogger(AdvancedEditorPanel.class.getName());
+    private static final Logger logger = Logger.getLogger(AdvancedEditorPanel.class.getName());
 
-	private TurnRestrictionEditorModel model;
-	private TagEditorPanel pnlTagEditor; 
-	private JPanel pnlRelationMemberEditor;
-	private JTable tblRelationMemberEditor;
-	private JSplitPane spEditors;
-	
-	/**
-	 * Creates the panel with the tag editor 
-	 * 
-	 * @return
-	 */
-	protected JPanel buildTagEditorPanel() {
-		JPanel pnl = new JPanel(new BorderLayout());
-		HtmlPanel msg = new HtmlPanel();
-		msg.setText("<html><body>" + 
-				tr("In the following table you can edit the <strong>raw tags</strong>"
-			  + " of the OSM relation representing this turn restriction.")
-			  + "</body></html>"
-		);
-		pnl.add(msg, BorderLayout.NORTH);
-		pnlTagEditor = new TagEditorPanel(model.getTagEditorModel());	
-		pnlTagEditor.initAutoCompletion(model.getLayer());
-		pnl.add(pnlTagEditor, BorderLayout.CENTER);
-		return pnl;
-	}
-	
-	/**
-	 * Builds the panel with the table for editing relation members
-	 * 
-	 * @return
-	 */
-	protected JPanel buildMemberEditorPanel() {
-		JPanel pnl = new JPanel(new BorderLayout());
-		HtmlPanel msg = new HtmlPanel();
-		msg.setText("<html><body>"  
-			  + tr("In the following table you can edit the <strong>raw members</strong>"
-			  + " of the OSM relation representing this turn restriction.") + "</body></html>"
-		);
-		pnl.add(msg, BorderLayout.NORTH);
-		
-		tblRelationMemberEditor = new RelationMemberTable(model);
-		JScrollPane pane = new JScrollPane(tblRelationMemberEditor);
-		pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
-		pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
-		pnl.add(pane);
-		return pnl;
-	}
-	
-	/**
-	 * Creates the main split panel 
-	 * @return
-	 */
-	protected JSplitPane buildSplitPane() {
-		spEditors = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
-		spEditors.setTopComponent(buildTagEditorPanel());
-		spEditors.setBottomComponent(buildMemberEditorPanel());
-		spEditors.setOneTouchExpandable(false);
-		spEditors.setDividerSize(5);
-		spEditors.addHierarchyListener(new SplitPaneDividerInitializer());
-		return spEditors;
-	}
-	
-	/**
-	 * Builds the user interface
-	 */
-	protected void build() {
-		setLayout(new BorderLayout());
-		add(buildSplitPane(), BorderLayout.CENTER);
-	}
-	
-	/**
-	 * Creates the advanced editor
-	 * 
-	 * @param model the editor model. Must not be null.
-	 * @throws IllegalArgumentException thrown if model is null
-	 */
-	public AdvancedEditorPanel(TurnRestrictionEditorModel model) throws IllegalArgumentException{
-		CheckParameterUtil.ensureParameterNotNull(model, "model");
-		this.model = model;
-		build();
-		HelpUtil.setHelpContext(this, HelpUtil.ht("/Plugins/turnrestrictions#AdvancedEditor"));
-	}
-	
-	/**
-	 * Initializes the divider location when the components becomes visible the
-	 * first time 
-	 */
-	class SplitPaneDividerInitializer implements HierarchyListener {
-		public void hierarchyChanged(HierarchyEvent e) {
-			if (isShowing()) {
-				spEditors.setDividerLocation(0.5);
-				spEditors.removeHierarchyListener(this);
-			}			
-		}		
-	}
+    private TurnRestrictionEditorModel model;
+    private TagEditorPanel pnlTagEditor; 
+    private JPanel pnlRelationMemberEditor;
+    private JTable tblRelationMemberEditor;
+    private JSplitPane spEditors;
+    
+    /**
+     * Creates the panel with the tag editor 
+     * 
+     * @return
+     */
+    protected JPanel buildTagEditorPanel() {
+        JPanel pnl = new JPanel(new BorderLayout());
+        HtmlPanel msg = new HtmlPanel();
+        msg.setText("<html><body>" + 
+                tr("In the following table you can edit the <strong>raw tags</strong>"
+              + " of the OSM relation representing this turn restriction.")
+              + "</body></html>"
+        );
+        pnl.add(msg, BorderLayout.NORTH);
+        pnlTagEditor = new TagEditorPanel(model.getTagEditorModel());   
+        pnlTagEditor.initAutoCompletion(model.getLayer());
+        pnl.add(pnlTagEditor, BorderLayout.CENTER);
+        return pnl;
+    }
+    
+    /**
+     * Builds the panel with the table for editing relation members
+     * 
+     * @return
+     */
+    protected JPanel buildMemberEditorPanel() {
+        JPanel pnl = new JPanel(new BorderLayout());
+        HtmlPanel msg = new HtmlPanel();
+        msg.setText("<html><body>"  
+              + tr("In the following table you can edit the <strong>raw members</strong>"
+              + " of the OSM relation representing this turn restriction.") + "</body></html>"
+        );
+        pnl.add(msg, BorderLayout.NORTH);
+        
+        tblRelationMemberEditor = new RelationMemberTable(model);
+        JScrollPane pane = new JScrollPane(tblRelationMemberEditor);
+        pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
+        pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+        pnl.add(pane);
+        return pnl;
+    }
+    
+    /**
+     * Creates the main split panel 
+     * @return
+     */
+    protected JSplitPane buildSplitPane() {
+        spEditors = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
+        spEditors.setTopComponent(buildTagEditorPanel());
+        spEditors.setBottomComponent(buildMemberEditorPanel());
+        spEditors.setOneTouchExpandable(false);
+        spEditors.setDividerSize(5);
+        spEditors.addHierarchyListener(new SplitPaneDividerInitializer());
+        return spEditors;
+    }
+    
+    /**
+     * Builds the user interface
+     */
+    protected void build() {
+        setLayout(new BorderLayout());
+        add(buildSplitPane(), BorderLayout.CENTER);
+    }
+    
+    /**
+     * Creates the advanced editor
+     * 
+     * @param model the editor model. Must not be null.
+     * @throws IllegalArgumentException thrown if model is null
+     */
+    public AdvancedEditorPanel(TurnRestrictionEditorModel model) throws IllegalArgumentException{
+        CheckParameterUtil.ensureParameterNotNull(model, "model");
+        this.model = model;
+        build();
+        HelpUtil.setHelpContext(this, HelpUtil.ht("/Plugins/turnrestrictions#AdvancedEditor"));
+    }
+    
+    /**
+     * Initializes the divider location when the components becomes visible the
+     * first time 
+     */
+    class SplitPaneDividerInitializer implements HierarchyListener {
+        public void hierarchyChanged(HierarchyEvent e) {
+            if (isShowing()) {
+                spEditors.setDividerLocation(0.5);
+                spEditors.removeHierarchyListener(this);
+            }           
+        }       
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/BasicEditorPanel.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/BasicEditorPanel.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/BasicEditorPanel.java	(revision 23192)
@@ -28,152 +28,152 @@
 public class BasicEditorPanel extends VerticallyScrollablePanel {
 
-	/** the turn restriction model */
-	private TurnRestrictionEditorModel model;
-	
-	/** the UI widgets */
-	private TurnRestrictionLegEditor fromEditor;
-	private TurnRestrictionLegEditor toEditor;
-	private ViaList lstVias;
-	private JLabel lblVias;
-	private JScrollPane spVias;
-	private TurnRestrictionComboBox cbTurnRestrictions;
-	private VehicleExceptionEditor vehicleExceptionsEditor;
-	
-	/**
-	 * builds the UI
-	 */
-	protected void build() {
-		setLayout(new GridBagLayout());
-		GridBagConstraints gc = new GridBagConstraints();
-		gc.anchor = GridBagConstraints.WEST;
-		gc.fill = GridBagConstraints.HORIZONTAL;
-		gc.weightx = 0.0;
-		
-		// the editor for selecting the 'from' leg
-	    gc.insets = new Insets(0,0,5,5);	
-	    add(new JLabel(tr("Type:")), gc);
-	    
-	    gc.gridx = 1;
-	    gc.weightx = 1.0;
-	    add(cbTurnRestrictions = new TurnRestrictionComboBox(new TurnRestrictionComboBoxModel(model)), gc);
+    /** the turn restriction model */
+    private TurnRestrictionEditorModel model;
+    
+    /** the UI widgets */
+    private TurnRestrictionLegEditor fromEditor;
+    private TurnRestrictionLegEditor toEditor;
+    private ViaList lstVias;
+    private JLabel lblVias;
+    private JScrollPane spVias;
+    private TurnRestrictionComboBox cbTurnRestrictions;
+    private VehicleExceptionEditor vehicleExceptionsEditor;
+    
+    /**
+     * builds the UI
+     */
+    protected void build() {
+        setLayout(new GridBagLayout());
+        GridBagConstraints gc = new GridBagConstraints();
+        gc.anchor = GridBagConstraints.WEST;
+        gc.fill = GridBagConstraints.HORIZONTAL;
+        gc.weightx = 0.0;
+        
+        // the editor for selecting the 'from' leg
+        gc.insets = new Insets(0,0,5,5);    
+        add(new JLabel(tr("Type:")), gc);
+        
+        gc.gridx = 1;
+        gc.weightx = 1.0;
+        add(cbTurnRestrictions = new TurnRestrictionComboBox(new TurnRestrictionComboBoxModel(model)), gc);
 
-		// the editor for selecting the 'from' leg
-	    gc.gridx = 0;
-	    gc.gridy = 1;	
-	    gc.weightx = 0.0;
-	    add(new JLabel(tr("From:")), gc);
-	    
-	    gc.gridx = 1;
-	    gc.weightx = 1.0;
-	    add(fromEditor = new TurnRestrictionLegEditor(model, TurnRestrictionLegRole.FROM),gc);
+        // the editor for selecting the 'from' leg
+        gc.gridx = 0;
+        gc.gridy = 1;   
+        gc.weightx = 0.0;
+        add(new JLabel(tr("From:")), gc);
+        
+        gc.gridx = 1;
+        gc.weightx = 1.0;
+        add(fromEditor = new TurnRestrictionLegEditor(model, TurnRestrictionLegRole.FROM),gc);
 
-	    // the editor for selecting the 'to' leg
-	    gc.gridx = 0;
-	    gc.gridy = 2;
-		gc.weightx = 0.0;
-	    gc.insets = new Insets(0,0,5,5);	
-	    add(new JLabel(tr("To:")), gc);
-	    
-	    gc.gridx = 1;
-	    gc.weightx = 1.0;
-	    add(toEditor = new TurnRestrictionLegEditor(model, TurnRestrictionLegRole.TO),gc);
-	    
-	    // the editor for selecting the 'vias' 
-	    gc.gridx = 0;
-	    gc.gridy = 3;
-		gc.weightx = 0.0;
-	    gc.insets = new Insets(0,0,5,5);	
-	    add(lblVias = new JLabel(tr("Vias:")), gc);
-	    
-	    gc.gridx = 1;
-	    gc.weightx = 1.0;
-	    DefaultListSelectionModel selectionModel = new DefaultListSelectionModel();
-	    add(spVias = new JScrollPane(lstVias = new ViaList(new ViaListModel(model, selectionModel), selectionModel)),gc);
-	    if (!Main.pref.getBoolean(PreferenceKeys.SHOW_VIAS_IN_BASIC_EDITOR, false)) {
-	    	lblVias.setVisible(false);
-	    	spVias.setVisible(false);
-	    }
-	    
-	    // the editor for vehicle exceptions
-	    vehicleExceptionsEditor = new VehicleExceptionEditor(model);
-	    gc.gridx = 0;
-	    gc.gridy = 4;
-		gc.weightx = 1.0;
-		gc.gridwidth = 2;
-	    gc.insets = new Insets(0,0,5,5);	
-	    add(vehicleExceptionsEditor, gc);
-	    
-	    // just a filler - grabs remaining space 
-	    gc.gridx = 0;
-	    gc.gridy = 5;
-	    gc.gridwidth = 2;
-	    gc.weighty = 1.0;
-	    gc.fill = GridBagConstraints.BOTH;
-	    add(new JPanel(), gc);
-	   	    
-	    setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
-	}
-	
-	
-	/**
-	 * Creates the panel. 
-	 * 
-	 * @param model the editor model. Must not be null.
-	 * @throws IllegalArgumentException thrown if model is null
-	 */
-	public BasicEditorPanel(TurnRestrictionEditorModel model) {
-		CheckParameterUtil.ensureParameterNotNull(model, "model");
-		this.model = model;
-		build();
-		HelpUtil.setHelpContext(this, HelpUtil.ht("/Plugins/turnrestrictions#BasicEditor"));
-	}
-	
-	/**
-	 * Requests the focus on one of the input widgets for turn
-	 * restriction data.
-	 * 
-	 * @param focusTarget the target component to request focus for.
-	 * Ignored if null.
-	 */
-	public void requestFocusFor(BasicEditorFokusTargets focusTarget){
-		if (focusTarget == null) return;
-		switch(focusTarget){
-		case RESTRICION_TYPE:
-			cbTurnRestrictions.requestFocusInWindow();
-			break;
-		case FROM:
-			fromEditor.requestFocusInWindow();
-			break;
-		case TO:
-			toEditor.requestFocusInWindow();
-			break;
-		case VIA:
-			lstVias.requestFocusInWindow();
-			break;
-		}
-	}	
-	
-	/**
-	 * Initializes the set of icons used from the preference key
-	 * {@see PreferenceKeys#ROAD_SIGNS}.
-	 * 
-	 * @param prefs the JOSM preferences 
-	 */
-	public void initIconSetFromPreferences(Preferences prefs){		
-		cbTurnRestrictions.initIconSetFromPreferences(prefs);
-	}
-	
-	/**
-	 * Initializes the visibility of the list of via-objects depending
-	 * on values in the JOSM preferences
-	 * 
-	 * @param prefs the JOSM preferences
-	 */
-	public void initViasVisibilityFromPreferences(Preferences prefs){
-		boolean value = prefs.getBoolean(PreferenceKeys.SHOW_VIAS_IN_BASIC_EDITOR, false);
-		if (value != lblVias.isVisible()){
-			lblVias.setVisible(value);
-			spVias.setVisible(value);
-		}
-	}
+        // the editor for selecting the 'to' leg
+        gc.gridx = 0;
+        gc.gridy = 2;
+        gc.weightx = 0.0;
+        gc.insets = new Insets(0,0,5,5);    
+        add(new JLabel(tr("To:")), gc);
+        
+        gc.gridx = 1;
+        gc.weightx = 1.0;
+        add(toEditor = new TurnRestrictionLegEditor(model, TurnRestrictionLegRole.TO),gc);
+        
+        // the editor for selecting the 'vias' 
+        gc.gridx = 0;
+        gc.gridy = 3;
+        gc.weightx = 0.0;
+        gc.insets = new Insets(0,0,5,5);    
+        add(lblVias = new JLabel(tr("Vias:")), gc);
+        
+        gc.gridx = 1;
+        gc.weightx = 1.0;
+        DefaultListSelectionModel selectionModel = new DefaultListSelectionModel();
+        add(spVias = new JScrollPane(lstVias = new ViaList(new ViaListModel(model, selectionModel), selectionModel)),gc);
+        if (!Main.pref.getBoolean(PreferenceKeys.SHOW_VIAS_IN_BASIC_EDITOR, false)) {
+            lblVias.setVisible(false);
+            spVias.setVisible(false);
+        }
+        
+        // the editor for vehicle exceptions
+        vehicleExceptionsEditor = new VehicleExceptionEditor(model);
+        gc.gridx = 0;
+        gc.gridy = 4;
+        gc.weightx = 1.0;
+        gc.gridwidth = 2;
+        gc.insets = new Insets(0,0,5,5);    
+        add(vehicleExceptionsEditor, gc);
+        
+        // just a filler - grabs remaining space 
+        gc.gridx = 0;
+        gc.gridy = 5;
+        gc.gridwidth = 2;
+        gc.weighty = 1.0;
+        gc.fill = GridBagConstraints.BOTH;
+        add(new JPanel(), gc);
+            
+        setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
+    }
+    
+    
+    /**
+     * Creates the panel. 
+     * 
+     * @param model the editor model. Must not be null.
+     * @throws IllegalArgumentException thrown if model is null
+     */
+    public BasicEditorPanel(TurnRestrictionEditorModel model) {
+        CheckParameterUtil.ensureParameterNotNull(model, "model");
+        this.model = model;
+        build();
+        HelpUtil.setHelpContext(this, HelpUtil.ht("/Plugins/turnrestrictions#BasicEditor"));
+    }
+    
+    /**
+     * Requests the focus on one of the input widgets for turn
+     * restriction data.
+     * 
+     * @param focusTarget the target component to request focus for.
+     * Ignored if null.
+     */
+    public void requestFocusFor(BasicEditorFokusTargets focusTarget){
+        if (focusTarget == null) return;
+        switch(focusTarget){
+        case RESTRICION_TYPE:
+            cbTurnRestrictions.requestFocusInWindow();
+            break;
+        case FROM:
+            fromEditor.requestFocusInWindow();
+            break;
+        case TO:
+            toEditor.requestFocusInWindow();
+            break;
+        case VIA:
+            lstVias.requestFocusInWindow();
+            break;
+        }
+    }   
+    
+    /**
+     * Initializes the set of icons used from the preference key
+     * {@see PreferenceKeys#ROAD_SIGNS}.
+     * 
+     * @param prefs the JOSM preferences 
+     */
+    public void initIconSetFromPreferences(Preferences prefs){      
+        cbTurnRestrictions.initIconSetFromPreferences(prefs);
+    }
+    
+    /**
+     * Initializes the visibility of the list of via-objects depending
+     * on values in the JOSM preferences
+     * 
+     * @param prefs the JOSM preferences
+     */
+    public void initViasVisibilityFromPreferences(Preferences prefs){
+        boolean value = prefs.getBoolean(PreferenceKeys.SHOW_VIAS_IN_BASIC_EDITOR, false);
+        if (value != lblVias.isVisible()){
+            lblVias.setVisible(value);
+            spVias.setVisible(value);
+        }
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/ExceptValueModel.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/ExceptValueModel.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/ExceptValueModel.java	(revision 23192)
@@ -14,200 +14,200 @@
  */
 public class ExceptValueModel {
-	/**
-	 * The set of standard vehicle types which can be used in the
-	 * 'except' tag 
-	 */
-	static public final Set<String> STANDARD_VEHICLE_EXCEPTION_VALUES;
-	static {
-		HashSet<String> s = new HashSet<String>();
-		s.add("psv");
-		s.add("hgv");
-		s.add("bicycle");
-		s.add("motorcar");
-		STANDARD_VEHICLE_EXCEPTION_VALUES = Collections.unmodifiableSet(s);
-	}
-	
-	/**
-	 * Replies true, if {@code v} is a standard vehicle type. Replies
-	 * false if {@code v} is null
-	 * 
-	 * @param v the vehicle type. 
-	 * @return true, if {@code v} is a standard vehicle type.
-	 */
-	static public boolean isStandardVehicleExceptionValue(String v){
-		if (v == null) return false;
-		v = v.trim().toLowerCase();
-		return STANDARD_VEHICLE_EXCEPTION_VALUES.contains(v);
-	}
-		
-	private String value = "";
-	private boolean isStandard = true;
-	private final Set<String> vehicleExceptions = new HashSet<String>();
-	
-	
-	protected void parseValue(String value) {
-		if (value == null || value.trim().equals("")) value = "";
-		this.value = value;
-		isStandard = true;
-		vehicleExceptions.clear();
-		if (value.equals("")) return;
-		String[] values = value.split(";");
-		for (String v: values){
-			v = v.trim().toLowerCase();
-			if (isStandardVehicleExceptionValue(v)) {
-				vehicleExceptions.add(v);
-			} else {
-				isStandard = false;
-			}
-		}
-	}
-	
-	/**
-	 * Creates a new model for an empty standard value 
-	 */
-	public ExceptValueModel() {}
-	
-	/**
-	 * Creates a new model for the tag value {@code value}. 
-	 * 
-	 * @param value the tag value
-	 * @see #parseValue(String)
-	 */
-	public ExceptValueModel(String value){
-		if (value == null || value.trim().equals("")) 
-			return;
-		parseValue(value);
-	}
-
-	/**
-	 * Replies the tag value representing the state of this model.
-	 * 
-	 * @return 
-	 */
-	public String getValue() {
-		if (isStandard){
-			StringBuffer sb = new StringBuffer();
-			// we use an ordered list because equals()
-			// is based on getValue()
-			//
-			List<String> values = new ArrayList<String>(vehicleExceptions);
-			Collections.sort(values);
-			for (String v: values){
-				if (sb.length() > 0) {
-					sb.append(";");
-				}
-				sb.append(v);
-			}
-			return sb.toString();
-		} else {
-			return value;
-		}
-	}
-
-	/**
-	 * Sets the value in this model
-	 * 
-	 * @param value
-	 */
-	public void setValue(String value) {
-		parseValue(value);
-	}
-
-	/**
-	 * Replies true if this model currently holds a standard 'except' value
-	 * 
-	 * @return
-	 */
-	public boolean isStandard() {
-		return isStandard;
-	}	
-	
-	/**
-	 * Tells this model to use standard values only.
-	 * 
-	 */
-	public void setStandard(boolean isStandard) {
-		this.isStandard = isStandard;
-	}
-	
-	/**
-	 * Replies true if {@code vehicleType} is currently set as exception in this
-	 * model.
-	 * 
-	 * @param vehicleType one of the standard vehicle types from {@see #STANDARD_VEHICLE_EXCEPTION_VALUES}
-	 * @return true if {@code vehicleType} is currently set as exception in this
-	 * model.
-	 * @exception IllegalArgumentException thrown if {@code vehicleType} isn't a standard vehicle type 
-	 */
-	public boolean isVehicleException(String vehicleType) throws IllegalArgumentException{
-		if (vehicleType == null) return false;
-		if (!isStandardVehicleExceptionValue(vehicleType)) {
-			throw new IllegalArgumentException(MessageFormat.format("vehicleType ''{0}'' isn''t a valid standard vehicle type", vehicleType));
-		}
-		vehicleType = vehicleType.trim().toLowerCase();
-		return vehicleExceptions.contains(vehicleType);
-	}
-	
-	/**
-	 * Sets the {@code vehicleType} as exception in this turn restriction.
-	 * 
-	 * @param vehicleType one of the standard vehicle types from {@see #STANDARD_VEHICLE_EXCEPTION_VALUES}
-	 * @exception IllegalArgumentException thrown if {@code vehicleType} isn't a standard vehicle type 
-	 */
-	public void setVehicleException(String vehicleType) throws IllegalArgumentException{
-		if (!isStandardVehicleExceptionValue(vehicleType)) {
-			throw new IllegalArgumentException(MessageFormat.format("vehicleType ''{0}'' isn''t a valid standard vehicle type", vehicleType));
-		}
-		vehicleExceptions.add(vehicleType.trim().toLowerCase());
-	}
-	
-
-	/**
-	 * Sets or removes the {@code vehicleType} as exception in this turn restriction, depending
-	 * on whether {@code setOrRemove} is true or false, respectively.
-	 * 
-	 * @param vehicleType one of the standard vehicle types from {@see #STANDARD_VEHICLE_EXCEPTION_VALUES}
-	 * @param setOrRemove if true, the exception is set; otherwise, it is removed
-	 * @exception IllegalArgumentException thrown if {@code vehicleType} isn't a standard vehicle type 
-	 */
-	public void setVehicleException(String vehicleType, boolean setOrRemove) throws IllegalArgumentException{
-		if (setOrRemove){
-			setVehicleException(vehicleType);
-		} else {
-			removeVehicleException(vehicleType);
-		}
-	}
-	
-	/**
-	 * Removes the {@code vehicleType} as exception in this turn restriction
-	 * 
-	 * @param vehicleType one of the standard vehicle types from {@see #STANDARD_VEHICLE_EXCEPTION_VALUES}
-	 * @exception IllegalArgumentException thrown if {@code vehicleType} isn't a standard vehicle type 
-	 */
-	public void removeVehicleException(String vehicleType) throws IllegalArgumentException{
-		if (!isStandardVehicleExceptionValue(vehicleType)) {
-			throw new IllegalArgumentException(MessageFormat.format("vehicleType ''{0}'' isn''t a valid standard vehicle type", vehicleType));
-		}
-		vehicleExceptions.remove(vehicleType.trim().toLowerCase());
-	}
-
-	@Override
-	public int hashCode() {
-		final int prime = 31;
-		int result = 1;
-		result = prime * result + getValue().hashCode();
-		return result;
-	}
-
-	@Override
-	public boolean equals(Object obj) {
-		if (this == obj)
-			return true;
-		if (obj == null)
-			return false;
-		if (getClass() != obj.getClass())
-			return false;
-		ExceptValueModel other = (ExceptValueModel) obj;
-		return getValue().equals(other.getValue());
-	}		
+    /**
+     * The set of standard vehicle types which can be used in the
+     * 'except' tag 
+     */
+    static public final Set<String> STANDARD_VEHICLE_EXCEPTION_VALUES;
+    static {
+        HashSet<String> s = new HashSet<String>();
+        s.add("psv");
+        s.add("hgv");
+        s.add("bicycle");
+        s.add("motorcar");
+        STANDARD_VEHICLE_EXCEPTION_VALUES = Collections.unmodifiableSet(s);
+    }
+    
+    /**
+     * Replies true, if {@code v} is a standard vehicle type. Replies
+     * false if {@code v} is null
+     * 
+     * @param v the vehicle type. 
+     * @return true, if {@code v} is a standard vehicle type.
+     */
+    static public boolean isStandardVehicleExceptionValue(String v){
+        if (v == null) return false;
+        v = v.trim().toLowerCase();
+        return STANDARD_VEHICLE_EXCEPTION_VALUES.contains(v);
+    }
+        
+    private String value = "";
+    private boolean isStandard = true;
+    private final Set<String> vehicleExceptions = new HashSet<String>();
+    
+    
+    protected void parseValue(String value) {
+        if (value == null || value.trim().equals("")) value = "";
+        this.value = value;
+        isStandard = true;
+        vehicleExceptions.clear();
+        if (value.equals("")) return;
+        String[] values = value.split(";");
+        for (String v: values){
+            v = v.trim().toLowerCase();
+            if (isStandardVehicleExceptionValue(v)) {
+                vehicleExceptions.add(v);
+            } else {
+                isStandard = false;
+            }
+        }
+    }
+    
+    /**
+     * Creates a new model for an empty standard value 
+     */
+    public ExceptValueModel() {}
+    
+    /**
+     * Creates a new model for the tag value {@code value}. 
+     * 
+     * @param value the tag value
+     * @see #parseValue(String)
+     */
+    public ExceptValueModel(String value){
+        if (value == null || value.trim().equals("")) 
+            return;
+        parseValue(value);
+    }
+
+    /**
+     * Replies the tag value representing the state of this model.
+     * 
+     * @return 
+     */
+    public String getValue() {
+        if (isStandard){
+            StringBuffer sb = new StringBuffer();
+            // we use an ordered list because equals()
+            // is based on getValue()
+            //
+            List<String> values = new ArrayList<String>(vehicleExceptions);
+            Collections.sort(values);
+            for (String v: values){
+                if (sb.length() > 0) {
+                    sb.append(";");
+                }
+                sb.append(v);
+            }
+            return sb.toString();
+        } else {
+            return value;
+        }
+    }
+
+    /**
+     * Sets the value in this model
+     * 
+     * @param value
+     */
+    public void setValue(String value) {
+        parseValue(value);
+    }
+
+    /**
+     * Replies true if this model currently holds a standard 'except' value
+     * 
+     * @return
+     */
+    public boolean isStandard() {
+        return isStandard;
+    }   
+    
+    /**
+     * Tells this model to use standard values only.
+     * 
+     */
+    public void setStandard(boolean isStandard) {
+        this.isStandard = isStandard;
+    }
+    
+    /**
+     * Replies true if {@code vehicleType} is currently set as exception in this
+     * model.
+     * 
+     * @param vehicleType one of the standard vehicle types from {@see #STANDARD_VEHICLE_EXCEPTION_VALUES}
+     * @return true if {@code vehicleType} is currently set as exception in this
+     * model.
+     * @exception IllegalArgumentException thrown if {@code vehicleType} isn't a standard vehicle type 
+     */
+    public boolean isVehicleException(String vehicleType) throws IllegalArgumentException{
+        if (vehicleType == null) return false;
+        if (!isStandardVehicleExceptionValue(vehicleType)) {
+            throw new IllegalArgumentException(MessageFormat.format("vehicleType ''{0}'' isn''t a valid standard vehicle type", vehicleType));
+        }
+        vehicleType = vehicleType.trim().toLowerCase();
+        return vehicleExceptions.contains(vehicleType);
+    }
+    
+    /**
+     * Sets the {@code vehicleType} as exception in this turn restriction.
+     * 
+     * @param vehicleType one of the standard vehicle types from {@see #STANDARD_VEHICLE_EXCEPTION_VALUES}
+     * @exception IllegalArgumentException thrown if {@code vehicleType} isn't a standard vehicle type 
+     */
+    public void setVehicleException(String vehicleType) throws IllegalArgumentException{
+        if (!isStandardVehicleExceptionValue(vehicleType)) {
+            throw new IllegalArgumentException(MessageFormat.format("vehicleType ''{0}'' isn''t a valid standard vehicle type", vehicleType));
+        }
+        vehicleExceptions.add(vehicleType.trim().toLowerCase());
+    }
+    
+
+    /**
+     * Sets or removes the {@code vehicleType} as exception in this turn restriction, depending
+     * on whether {@code setOrRemove} is true or false, respectively.
+     * 
+     * @param vehicleType one of the standard vehicle types from {@see #STANDARD_VEHICLE_EXCEPTION_VALUES}
+     * @param setOrRemove if true, the exception is set; otherwise, it is removed
+     * @exception IllegalArgumentException thrown if {@code vehicleType} isn't a standard vehicle type 
+     */
+    public void setVehicleException(String vehicleType, boolean setOrRemove) throws IllegalArgumentException{
+        if (setOrRemove){
+            setVehicleException(vehicleType);
+        } else {
+            removeVehicleException(vehicleType);
+        }
+    }
+    
+    /**
+     * Removes the {@code vehicleType} as exception in this turn restriction
+     * 
+     * @param vehicleType one of the standard vehicle types from {@see #STANDARD_VEHICLE_EXCEPTION_VALUES}
+     * @exception IllegalArgumentException thrown if {@code vehicleType} isn't a standard vehicle type 
+     */
+    public void removeVehicleException(String vehicleType) throws IllegalArgumentException{
+        if (!isStandardVehicleExceptionValue(vehicleType)) {
+            throw new IllegalArgumentException(MessageFormat.format("vehicleType ''{0}'' isn''t a valid standard vehicle type", vehicleType));
+        }
+        vehicleExceptions.remove(vehicleType.trim().toLowerCase());
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + getValue().hashCode();
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        ExceptValueModel other = (ExceptValueModel) obj;
+        return getValue().equals(other.getValue());
+    }       
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/JosmSelectionListModel.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/JosmSelectionListModel.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/JosmSelectionListModel.java	(revision 23192)
@@ -40,6 +40,6 @@
  */
 public class JosmSelectionListModel extends AbstractListModel implements EditLayerChangeListener, SelectionChangedListener, DataSetListener, PrimitiveIdListProvider{
-	static private final Logger logger = Logger.getLogger(JosmSelectionListModel.class.getName());
-	
+    static private final Logger logger = Logger.getLogger(JosmSelectionListModel.class.getName());
+    
     private final List<OsmPrimitive> selection = new ArrayList<OsmPrimitive>();
     private DefaultListSelectionModel selectionModel;
@@ -55,7 +55,7 @@
      */
     public JosmSelectionListModel(OsmDataLayer layer, DefaultListSelectionModel selectionModel) {
-    	CheckParameterUtil.ensureParameterNotNull(selectionModel, "selectionModel");
-    	CheckParameterUtil.ensureParameterNotNull(layer, "layer");
-    	this.layer = layer;
+        CheckParameterUtil.ensureParameterNotNull(selectionModel, "selectionModel");
+        CheckParameterUtil.ensureParameterNotNull(layer, "layer");
+        this.layer = layer;
         this.selectionModel = selectionModel;
         setJOSMSelection(layer.data.getSelected());
@@ -115,5 +115,5 @@
      */
     public void setJOSMSelection(Collection<? extends OsmPrimitive> selection) {
-    	Collection<OsmPrimitive> sel = getSelected();
+        Collection<OsmPrimitive> sel = getSelected();
         this.selection.clear();
         if (selection == null) {
@@ -150,10 +150,10 @@
     public void editLayerChanged(OsmDataLayer oldLayer, OsmDataLayer newLayer) {
         if (newLayer == null) {
-        	// don't show a JOSM selection if we don't have a data layer 
+            // don't show a JOSM selection if we don't have a data layer 
             setJOSMSelection(null);
         } else if (newLayer != layer){
-        	// don't show a JOSM selection if this turn restriction editor doesn't
-        	// manipulate data in the current data layer
-        	setJOSMSelection(null);
+            // don't show a JOSM selection if this turn restriction editor doesn't
+            // manipulate data in the current data layer
+            setJOSMSelection(null);
         } else {
             setJOSMSelection(newLayer.data.getSelected());
@@ -165,9 +165,9 @@
     /* ------------------------------------------------------------------------ */
     public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
-    	// only update the JOSM selection if it is changed in the same data layer
-    	// this turn restriction editor is working on
-    	OsmDataLayer layer = Main.main.getEditLayer();
-    	if(layer == null) return;
-    	if (layer != this.layer) return;
+        // only update the JOSM selection if it is changed in the same data layer
+        // this turn restriction editor is working on
+        OsmDataLayer layer = Main.main.getEditLayer();
+        if(layer == null) return;
+        if (layer != this.layer) return;
         setJOSMSelection(newSelection);
     }
@@ -184,5 +184,5 @@
         if (event.getDataset() != layer.data) return;
         // may influence the display name of primitives, update the data
-    	update(event.getPrimitives());
+        update(event.getPrimitives());
     }
 
@@ -217,12 +217,12 @@
     /* interface PrimitiveIdListProvider                                        */
     /* ------------------------------------------------------------------------ */
-	public List<PrimitiveId> getSelectedPrimitiveIds() {
-		List<PrimitiveId> ret = new ArrayList<PrimitiveId>(getSelected().size());
-		for(int i=0; i< selection.size(); i++) {
-			if (selectionModel.isSelectedIndex(i)) {
-				ret.add(selection.get(i).getPrimitiveId());
-			}
-		}
-		return ret;
-	}
+    public List<PrimitiveId> getSelectedPrimitiveIds() {
+        List<PrimitiveId> ret = new ArrayList<PrimitiveId>(getSelected().size());
+        for(int i=0; i< selection.size(); i++) {
+            if (selectionModel.isSelectedIndex(i)) {
+                ret.add(selection.get(i).getPrimitiveId());
+            }
+        }
+        return ret;
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/JosmSelectionPanel.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/JosmSelectionPanel.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/JosmSelectionPanel.java	(revision 23192)
@@ -42,105 +42,105 @@
  */
 public class JosmSelectionPanel extends JPanel {
-	/**  the list view */
-	private JList lstSelection;
-	/** the model managing the selection */
-	private JosmSelectionListModel model;
-	
-	private CopyAction actCopy;
-	private TransferHandler transferHandler;
-	
-	/**
-	 * builds the UI for the panel 
-	 */
-	protected void build(OsmDataLayer layer) {
-		setLayout(new BorderLayout());
-		DefaultListSelectionModel selectionModel = new DefaultListSelectionModel();
-		model = new JosmSelectionListModel(layer,selectionModel);
-		lstSelection = new JList(model);
-		lstSelection.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
-		lstSelection.setSelectionModel(selectionModel);
-		lstSelection.setCellRenderer(new OsmPrimitivRenderer());
-		lstSelection.setTransferHandler(transferHandler = new JosmSelectionTransferHandler(model));
-		lstSelection.setDragEnabled(true);
-		
-		add(new JScrollPane(lstSelection), BorderLayout.CENTER);
-		add(new JLabel(tr("Selection")), BorderLayout.NORTH);
-		
-		setBorder(BorderFactory.createEmptyBorder(5,5,5,5));		
-		actCopy = new CopyAction();
-		lstSelection.addMouseListener(new PopupLauncher());
-	}
-	
-	/**
-	 * Creates the JOSM selection panel for the selection in an OSM data layer
-	 * 
-	 * @param layer the data layer. Must not be null.
-	 * @exception IllegalArgumentException thrown if {@code layer} is null
-	 */
-	public JosmSelectionPanel(OsmDataLayer layer) throws IllegalArgumentException{
-		CheckParameterUtil.ensureParameterNotNull(layer, "layer");
-		build(layer); 
-	}
-	
-	/**
-	 * wires the UI as listener to global event sources 
-	 */
-	public void wireListeners() {
-		MapView.addEditLayerChangeListener(model);
-		DatasetEventManager.getInstance().addDatasetListener(model, FireMode.IN_EDT);
-		SelectionEventManager.getInstance().addSelectionListener(model, FireMode.IN_EDT_CONSOLIDATED);
-	}
-	
-	/**
-	 * removes the UI as listener to global event sources 
-	 */
-	public void unwireListeners() {
-		MapView.removeEditLayerChangeListener(model);
-		DatasetEventManager.getInstance().removeDatasetListener(model);
-		SelectionEventManager.getInstance().removeSelectionListener(model);		
-	}
-	
-	class PopupLauncher extends PopupMenuLauncher {
-		@Override
-		public void launch(MouseEvent evt) {
-			new PopupMenu().show(lstSelection, evt.getX(), evt.getY());
-		}		
-	}
-	
-	class PopupMenu extends JPopupMenu {
-		public PopupMenu() {
-			JMenuItem item = add(actCopy);
-			item.setTransferHandler(transferHandler);
-			actCopy.setEnabled(!model.getSelected().isEmpty());
-		}
-	}
+    /**  the list view */
+    private JList lstSelection;
+    /** the model managing the selection */
+    private JosmSelectionListModel model;
+    
+    private CopyAction actCopy;
+    private TransferHandler transferHandler;
+    
+    /**
+     * builds the UI for the panel 
+     */
+    protected void build(OsmDataLayer layer) {
+        setLayout(new BorderLayout());
+        DefaultListSelectionModel selectionModel = new DefaultListSelectionModel();
+        model = new JosmSelectionListModel(layer,selectionModel);
+        lstSelection = new JList(model);
+        lstSelection.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
+        lstSelection.setSelectionModel(selectionModel);
+        lstSelection.setCellRenderer(new OsmPrimitivRenderer());
+        lstSelection.setTransferHandler(transferHandler = new JosmSelectionTransferHandler(model));
+        lstSelection.setDragEnabled(true);
+        
+        add(new JScrollPane(lstSelection), BorderLayout.CENTER);
+        add(new JLabel(tr("Selection")), BorderLayout.NORTH);
+        
+        setBorder(BorderFactory.createEmptyBorder(5,5,5,5));        
+        actCopy = new CopyAction();
+        lstSelection.addMouseListener(new PopupLauncher());
+    }
+    
+    /**
+     * Creates the JOSM selection panel for the selection in an OSM data layer
+     * 
+     * @param layer the data layer. Must not be null.
+     * @exception IllegalArgumentException thrown if {@code layer} is null
+     */
+    public JosmSelectionPanel(OsmDataLayer layer) throws IllegalArgumentException{
+        CheckParameterUtil.ensureParameterNotNull(layer, "layer");
+        build(layer); 
+    }
+    
+    /**
+     * wires the UI as listener to global event sources 
+     */
+    public void wireListeners() {
+        MapView.addEditLayerChangeListener(model);
+        DatasetEventManager.getInstance().addDatasetListener(model, FireMode.IN_EDT);
+        SelectionEventManager.getInstance().addSelectionListener(model, FireMode.IN_EDT_CONSOLIDATED);
+    }
+    
+    /**
+     * removes the UI as listener to global event sources 
+     */
+    public void unwireListeners() {
+        MapView.removeEditLayerChangeListener(model);
+        DatasetEventManager.getInstance().removeDatasetListener(model);
+        SelectionEventManager.getInstance().removeSelectionListener(model);     
+    }
+    
+    class PopupLauncher extends PopupMenuLauncher {
+        @Override
+        public void launch(MouseEvent evt) {
+            new PopupMenu().show(lstSelection, evt.getX(), evt.getY());
+        }       
+    }
+    
+    class PopupMenu extends JPopupMenu {
+        public PopupMenu() {
+            JMenuItem item = add(actCopy);
+            item.setTransferHandler(transferHandler);
+            actCopy.setEnabled(!model.getSelected().isEmpty());
+        }
+    }
 
-	class CopyAction extends AbstractAction {
-		private Action delegate;
-		
-		public CopyAction(){
-			putValue(NAME, tr("Copy"));
-			putValue(SHORT_DESCRIPTION, tr("Copy to the clipboard"));
-			putValue(SMALL_ICON, ImageProvider.get("copy"));
-			putValue(ACCELERATOR_KEY, Shortcut.getCopyKeyStroke());
-			delegate = lstSelection.getActionMap().get("copy");
-		}
+    class CopyAction extends AbstractAction {
+        private Action delegate;
+        
+        public CopyAction(){
+            putValue(NAME, tr("Copy"));
+            putValue(SHORT_DESCRIPTION, tr("Copy to the clipboard"));
+            putValue(SMALL_ICON, ImageProvider.get("copy"));
+            putValue(ACCELERATOR_KEY, Shortcut.getCopyKeyStroke());
+            delegate = lstSelection.getActionMap().get("copy");
+        }
 
-		public void actionPerformed(ActionEvent e) {
-			delegate.actionPerformed(e);
-		}
-	}
-	
-	static private class JosmSelectionTransferHandler extends PrimitiveIdListTransferHandler {
-		public JosmSelectionTransferHandler(PrimitiveIdListProvider provider) {
-			super(provider);
-		}
+        public void actionPerformed(ActionEvent e) {
+            delegate.actionPerformed(e);
+        }
+    }
+    
+    static private class JosmSelectionTransferHandler extends PrimitiveIdListTransferHandler {
+        public JosmSelectionTransferHandler(PrimitiveIdListProvider provider) {
+            super(provider);
+        }
 
-		@Override
-		public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) {
-			// the JOSM selection list is read-only. Don't allow to drop or paste
-			// data on it
-			return false;
-		}
-	}
+        @Override
+        public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) {
+            // the JOSM selection list is read-only. Don't allow to drop or paste
+            // data on it
+            return false;
+        }
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/NavigationControler.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/NavigationControler.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/NavigationControler.java	(revision 23192)
@@ -2,12 +2,12 @@
 
 public interface NavigationControler {
-	public enum BasicEditorFokusTargets {
-		RESTRICION_TYPE,
-		FROM,
-		TO,
-		VIA
-	}	
-	void gotoBasicEditor();	
-	void gotoAdvancedEditor();
-	void gotoBasicEditor(BasicEditorFokusTargets focusTarget);	
+    public enum BasicEditorFokusTargets {
+        RESTRICION_TYPE,
+        FROM,
+        TO,
+        VIA
+    }   
+    void gotoBasicEditor(); 
+    void gotoAdvancedEditor();
+    void gotoBasicEditor(BasicEditorFokusTargets focusTarget);  
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/RelationMemberColumnModel.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/RelationMemberColumnModel.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/RelationMemberColumnModel.java	(revision 23192)
@@ -14,34 +14,34 @@
  */
 public class RelationMemberColumnModel extends DefaultTableColumnModel{
-	protected void build() {
-		TableColumn col = new TableColumn();
-		
-		 // the role column
-		 col.setHeaderValue(tr("Role"));
-		 col.setResizable(true);
-		 col.setPreferredWidth(100);	
-		 col.setCellEditor(new MemberRoleCellEditor());
-		 col.setCellRenderer(new RelationMemberRoleCellRenderer());
-		 addColumn(col);
-		 
-		  // column 1 - the member
-	      col = new TableColumn(1);
-	      col.setHeaderValue(tr("Refers to"));
-	      col.setResizable(true);
-	      col.setPreferredWidth(300);
-	      col.setCellRenderer(new RelationMemberTargetCellRenderer());
-	      addColumn(col);	      
-	}
-	
-	/**
-	 * Creates the column model with a given column selection model.
-	 * 
-	 * @param colSelectionModel the column selection model. Must not be null.
-	 * @throws IllegalArgumentException thrown if {@code colSelectionModel} is null
-	 */
-	public RelationMemberColumnModel(DefaultListSelectionModel colSelectionModel) throws IllegalArgumentException{
-		CheckParameterUtil.ensureParameterNotNull(colSelectionModel, "colSelectionModel");
-		setSelectionModel(colSelectionModel);
-		build();
-	}
+    protected void build() {
+        TableColumn col = new TableColumn();
+        
+         // the role column
+         col.setHeaderValue(tr("Role"));
+         col.setResizable(true);
+         col.setPreferredWidth(100);    
+         col.setCellEditor(new MemberRoleCellEditor());
+         col.setCellRenderer(new RelationMemberRoleCellRenderer());
+         addColumn(col);
+         
+          // column 1 - the member
+          col = new TableColumn(1);
+          col.setHeaderValue(tr("Refers to"));
+          col.setResizable(true);
+          col.setPreferredWidth(300);
+          col.setCellRenderer(new RelationMemberTargetCellRenderer());
+          addColumn(col);         
+    }
+    
+    /**
+     * Creates the column model with a given column selection model.
+     * 
+     * @param colSelectionModel the column selection model. Must not be null.
+     * @throws IllegalArgumentException thrown if {@code colSelectionModel} is null
+     */
+    public RelationMemberColumnModel(DefaultListSelectionModel colSelectionModel) throws IllegalArgumentException{
+        CheckParameterUtil.ensureParameterNotNull(colSelectionModel, "colSelectionModel");
+        setSelectionModel(colSelectionModel);
+        build();
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/RelationMemberEditorModel.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/RelationMemberEditorModel.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/RelationMemberEditorModel.java	(revision 23192)
@@ -24,469 +24,469 @@
 import org.openstreetmap.josm.tools.CheckParameterUtil;
 
-public class RelationMemberEditorModel extends AbstractTableModel{	
-	static private final Logger logger = Logger.getLogger(RelationMemberEditorModel.class.getName());
-	private final ArrayList<RelationMemberModel> members = new ArrayList<RelationMemberModel>();
-	private OsmDataLayer layer;
-	private DefaultListSelectionModel rowSelectionModel;
-	private DefaultListSelectionModel colSelectionModel;
-	
-	/**
-	 * Creates a new model in the context of an {@see OsmDataLayer}. Internally allocates
-	 * a row and a column selection model, see {@see #getRowSelectionModel()} and 
-	 * {@see #getColSelectionModel()}.
-	 * 
-	 * @param layer the data layer. Must not be null.
-	 * @exception IllegalArgumentException thrown if layer is null
-	 */
-	public RelationMemberEditorModel(OsmDataLayer layer) throws IllegalArgumentException{
-		CheckParameterUtil.ensureParameterNotNull(layer, "layer");
-		this.layer = layer;
-		rowSelectionModel = new DefaultListSelectionModel();
-		colSelectionModel = new DefaultListSelectionModel();
-	}
-
-	/**
-	 *  Creates a new model in the context of an {@see OsmDataLayer}
-	 *  
-	 * @param layer layer the data layer. Must not be null.
-	 * @param rowSelectionModel the row selection model. Must not be null.
-	 * @param colSelectionModel the column selection model. Must not be null.
-	 * @throws IllegalArgumentException thrown if layer is null
-	 * @throws IllegalArgumentException thrown if rowSelectionModel is null
-	 * @throws IllegalArgumentException thrown if colSelectionModel is null
-	 */
-	public RelationMemberEditorModel(OsmDataLayer layer, DefaultListSelectionModel rowSelectionModel, DefaultListSelectionModel colSelectionModel) throws IllegalArgumentException{
-		CheckParameterUtil.ensureParameterNotNull(layer, "layer");
-		CheckParameterUtil.ensureParameterNotNull(rowSelectionModel, "rowSelectionModel");
-		CheckParameterUtil.ensureParameterNotNull(colSelectionModel, "colSelectionModel");
-		this.layer = layer;
-		this.rowSelectionModel = rowSelectionModel;
-		this.colSelectionModel = colSelectionModel;
-	}
-
-	/**
-	 * Replies the row selection model used in this table model.
-	 * 
-	 * @return the row selection model 
-	 */
-	public DefaultListSelectionModel getRowSelectionModel() {
-		return rowSelectionModel;
-	}
-	
-	/**
-	 * Replies the column selection model used in this table model.
-	 * 
-	 * @return the col selection model
-	 */
-	public DefaultListSelectionModel getColSelectionModel() {
-		return colSelectionModel;
-	}
-	
-	/**
-	 * Replies the set of {@see OsmPrimitive}s with the role {@code role}. If no
-	 * such primitives exists, the empty set is returned.
-	 * 
-	 * @return the set of {@see OsmPrimitive}s with the role {@code role}
-	 */
-	protected Set<OsmPrimitive> getPrimitivesWithRole(String role) {
-		HashSet<OsmPrimitive> ret = new HashSet<OsmPrimitive>();
-		for (RelationMemberModel rm: members){
-			if (rm.getRole().equals(role)){
-				OsmPrimitive p = layer.data.getPrimitiveById(rm.getTarget());
-				if (p != null){
-					ret.add(p);
-				}
-			}
-		}
-		return ret;
-	}
-	
-	/**
-	 * Replies the list of {@see RelationMemberModel}s with the role {@code role}. If no
-	 * such primitives exists, the empty set is returned.
-	 * 
-	 * @return the set of {@see RelationMemberModel}s with the role {@code role}
-	 */
-	protected List<RelationMemberModel> getRelationMembersWithRole(String role) {
-		ArrayList<RelationMemberModel> ret = new ArrayList<RelationMemberModel>();
-		for (RelationMemberModel rm: members){
-			if (rm.getRole().equals(role)){
-				ret.add(rm);
-			}
-		}
-		return ret;
-	}
-	
-	/**
-	 * Removes all members with role {@code role}.
-	 * 
-	 * @param role the role. Ignored if null.
-	 * @return true if the list of members was modified; false, otherwise
-	 */
-	protected boolean removeMembersWithRole(String role){
-		if (role == null) return false;
-		boolean isChanged = false;
-		for(Iterator<RelationMemberModel> it = members.iterator(); it.hasNext(); ){
-			RelationMemberModel rm = it.next();
-			if (rm.getRole().equals(role)) {
-				it.remove();
-				isChanged = true;
-			}
-		}
-		return isChanged;
-	}
-		
-	/**
-	 * Replies the set of {@see OsmPrimitive}s with the role 'from'. If no
-	 * such primitives exists, the empty set is returned.
-	 * 
-	 * @return the set of {@see OsmPrimitive}s with the role 'from'
-	 */
-	public Set<OsmPrimitive> getFromPrimitives() {
-		return getPrimitivesWithRole("from");		
-	}
-	
-	/**
-	 * Replies the set of {@see OsmPrimitive}s with the role 'to'. If no
-	 * such primitives exists, the empty set is returned.
-	 * 
-	 * @return the set of {@see OsmPrimitive}s with the role 'from'
-	 */
-	public Set<OsmPrimitive> getToPrimitives() {
-		return getPrimitivesWithRole("to");
-	}
-	
-	/**
-	 * Replies the list of 'via' objects in the order they occur in the
-	 * member list. Replies an empty list if no vias exist
-	 * 
-	 * @return 
-	 */
-	public List<OsmPrimitive> getVias() {
-		ArrayList<OsmPrimitive> ret = new ArrayList<OsmPrimitive>();
-		for (RelationMemberModel rm: getRelationMembersWithRole("via")){
-			ret.add(layer.data.getPrimitiveById(rm.getTarget()));
-		}
-		return ret;
-	}
-	
-	/**
-	 * Sets the list of vias. Removes all 'vias' if {@code vias} is null.
-	 * 
-	 * null vias are skipped. A via must belong to the dataset of the layer in whose context
-	 * this editor is working, otherwise an {@see IllegalArgumentException} is thrown.
-	 * 
-	 * @param vias the vias.
-	 * @exception IllegalArgumentException thrown if a via doesn't belong to the dataset of the layer
-	 * in whose context this editor is working 
-	 */
-	public void setVias(List<OsmPrimitive> vias) throws IllegalArgumentException{
-		boolean viasDeleted = removeMembersWithRole("via");
-		if (vias == null || vias.isEmpty()){
-			if (viasDeleted){
-				fireTableDataChanged();
-			}
-			return;
-		}
-		// check vias 
-		for (OsmPrimitive via: vias) {
-			if (via == null) continue;
-			if (via.getDataSet() == null || via.getDataSet() != layer.data){
-				throw new IllegalArgumentException(MessageFormat.format("via object ''{0}'' must belong to dataset of layer ''{1}''", via.getDisplayName(DefaultNameFormatter.getInstance()), layer.getName()));
-			}
-		}
-		// add vias 
-		for (OsmPrimitive via: vias) {
-			if (via == null) continue;
-			RelationMemberModel model = new RelationMemberModel("via", via);
-			members.add(model);
-		}
-		fireTableDataChanged();
-	}
-	
-	/**
-	 * Sets the turn restriction member with role {@code role}. Removes all
-	 * members with role {@code role} if {@code id} is null.
-	 * 
-	 * @param id the id 
-	 * @return true if the model was modified; false, otherwise
-	 */
-	protected boolean setPrimitiveWithRole(PrimitiveId id, String role){
-		if (id == null){
-			return removeMembersWithRole(role);
-		}
-		
-		List<RelationMemberModel> fromMembers = getRelationMembersWithRole(role);
-		if (fromMembers.isEmpty()){
-			RelationMemberModel rm = new RelationMemberModel(role, id);
-			members.add(rm);
-			return true;
-		} else if (fromMembers.size() == 1){
-			RelationMemberModel rm = fromMembers.get(0);
-			if (!rm.getTarget().equals(id)){
-				rm.setTarget(id);
-				return true;
-			}
-			return false;
-		} else {
-			removeMembersWithRole(role);
-			RelationMemberModel rm = new RelationMemberModel(role, id);
-			members.add(rm);
-			return true;
-		}
-	}
-	
-	/**
-	 * Sets the turn restriction member with role 'from'. Removes all
-	 * members with role 'from' if {@code id} is null.
-	 * 
-	 * @param id the id 
-	 */
-	public void setFromPrimitive(PrimitiveId id){
-		if (setPrimitiveWithRole(id, "from")) {
-			fireTableDataChanged();
-		}
-	}
-	
-	/**
-	 * Sets the turn restriction member with role 'to'. Removes all
-	 * members with role 'to' if {@code id} is null.
-	 * 
-	 * @param id the id 
-	 */
-	public void setToPrimitive(PrimitiveId id){
-		if (setPrimitiveWithRole(id, "to")) {
-			fireTableDataChanged();
-		}
-	}
-	
-	/**
-	 * Replies the set of {@see OsmPrimitive}s referred to by members in
-	 * this model.
-	 * 
-	 * @return the set of {@see OsmPrimitive}s referred to by members in
-	 * this model.
-	 */
-	public Set<OsmPrimitive> getMemberPrimitives() {
-		Set<OsmPrimitive> ret = new HashSet<OsmPrimitive>();
-		for (RelationMemberModel rm: members){
-			OsmPrimitive p = layer.data.getPrimitiveById(rm.getTarget());
-			if (p != null) ret.add(p);
-		}
-		return ret;
-	}
-	
-	/**
-	 * Populates the model with the relation member of a turn restriction. Clears
-	 * the model if {@code tr} is null. 
-	 * 
-	 * @param tr the turn restriction
-	 */
-	public void populate(Relation tr){
-		members.clear();
-		if (tr == null){
-			fireTableDataChanged();
-			return;
-		}
-		for(RelationMember rm: tr.getMembers()){
-			members.add(new RelationMemberModel(rm));
-		}
-		fireTableDataChanged();
-	}
-	
-	/**
-	 * Replaces the member of turn restriction {@code tr} by the relation members currently
-	 * edited in this model.
-	 * 
-	 * @param tr the turn restriction. Ignored if null.
-	 */
-	public void applyTo(Relation tr){
-		if (tr == null) return;
-		List<RelationMember> newMembers = new ArrayList<RelationMember>();
-		for(RelationMemberModel model: members){
-			RelationMember rm = new RelationMember(model.getRole(), layer.data.getPrimitiveById(model.getTarget()));
-			newMembers.add(rm);
-		}
-		tr.setMembers(newMembers);
-	}
-	
-	/**
-	 * Clears the roles of all relation members currently selected in the 
-	 * table.
-	 */
-	protected void clearSelectedRoles(){
-		for(int i=0; i < getRowCount();i++){
-			if (rowSelectionModel.isSelectedIndex(i)) {
-				members.get(i).setRole("");
-			}
-		}		
-	}
-	
-	/**
-	 * Removes the currently selected rows from the model 
-	 */
-	protected void removedSelectedMembers() {
-		for(int i=getRowCount()-1; i >= 0;i--){
-			if (rowSelectionModel.isSelectedIndex(i)) {
-				members.remove(i);
-			}
-		}
-	}
-	
-	/**
-	 * Deletes the current selection.
-	 * 
-	 * If only cells in the first column are selected, the roles of the selected
-	 * members are reset to the empty string. Otherwise the selected members are
-	 * removed from the model. 
-	 * 
-	 */
-	public void deleteSelected() {
-		if (colSelectionModel.isSelectedIndex(0) && !colSelectionModel.isSelectedIndex(1)) {
-			clearSelectedRoles();
-		} else if (rowSelectionModel.getMinSelectionIndex() >= 0){
-			removedSelectedMembers();
-		}
-		fireTableDataChanged();
-	}
-	
-	protected List<Integer> getSelectedIndices() {
-		ArrayList<Integer> ret = new ArrayList<Integer>();
-		for(int i =0; i < members.size(); i++){
-			if (rowSelectionModel.isSelectedIndex(i)) 
-				ret.add(i);
-		}
-		return ret;
-	}
-	
-	public boolean canMoveUp() {
-		List<Integer> sel = getSelectedIndices();
-		if (sel.isEmpty()) return false;
-		return sel.get(0) > 0;
-	}
-	
-	public boolean canMoveDown() {
-		List<Integer> sel = getSelectedIndices();
-		if (sel.isEmpty()) return false;
-		return sel.get(sel.size()-1) < members.size()-1;
-	}
-	
-	public void moveUpSelected() {
-		if (!canMoveUp()) return;
-		List<Integer> sel = getSelectedIndices();
-		for (int idx: sel){
-			RelationMemberModel m = members.remove(idx);
-			members.add(idx-1, m);
-		}
-		fireTableDataChanged();
-		rowSelectionModel.clearSelection();
-		colSelectionModel.setSelectionInterval(0, 1);
-		for (int idx: sel){
-			rowSelectionModel.addSelectionInterval(idx-1, idx-1);
-		}
-	}
-	
-	public void moveDownSelected() {
-		if (!canMoveDown()) return;
-		List<Integer> sel = getSelectedIndices();
-		for (int i = sel.size()-1; i>=0;i--){
-			int idx = sel.get(i);
-			RelationMemberModel m = members.remove(idx);
-			members.add(idx+1, m);
-		}
-		fireTableDataChanged();
-		rowSelectionModel.clearSelection();
-		colSelectionModel.setSelectionInterval(0, 1);
-		for (int idx: sel){
-			rowSelectionModel.addSelectionInterval(idx+1, idx+1);
-		}
-	}
-	
-	/**
-	 * Inserts a list of new relation members with the empty role for the primitives
-	 * with id in {@code ids}. Inserts the new primitives at the position of the first
-	 * selected row. If no row is selected, at the end of the list. 
-	 * 
-	 *  null values are skipped. If there is an id for which there is no primitive in the context 
-	 *  layer, if the primitive is deleted or invisible, an {@see IllegalArgumentException}
-	 *  is thrown and nothing is inserted. 
-	 * 
-	 * @param ids the list of ids. Ignored if null.
-	 * @throws IllegalArgumentException thrown if one of the ids can't be inserted
-	 */
-	public void insertMembers(Collection<PrimitiveId> ids) throws IllegalArgumentException {
-		if (ids == null) return;	
-		ArrayList<RelationMemberModel> newMembers = new ArrayList<RelationMemberModel>();
-		for (PrimitiveId id: ids){
-			OsmPrimitive p = layer.data.getPrimitiveById(id);
-			if (p == null){
-				throw new IllegalArgumentException(tr("Cannot find object with id ''{0}'' in layer ''{1}''", id.toString(), layer.getName()));
-			}
-			if (p.isDeleted() || ! p.isVisible()) {
-				throw new IllegalArgumentException(tr("Cannot add object ''{0}'' as relation member because it is deleted or invisible in layer ''{1}''", p.getDisplayName(DefaultNameFormatter.getInstance()), layer.getName()));				
-			}
-			newMembers.add(new RelationMemberModel("",id));
-		}
-		if (newMembers.isEmpty()) return;
-		int insertPos = rowSelectionModel.getMinSelectionIndex();
-		if ( insertPos >=0){
-			members.addAll(insertPos, newMembers);
-		} else {
-			members.addAll(newMembers);
-		}
-		fireTableDataChanged();
-		if (insertPos < 0) insertPos = 0;		
-		colSelectionModel.setSelectionInterval(0, 1); // select both columns
-		rowSelectionModel.setSelectionInterval(insertPos, insertPos + newMembers.size()-1);
-	}
-
-	public int getColumnCount() {
-		return 2;
-	}
-
-	public int getRowCount() {
-		if (members.size() > 0) return members.size();
-		
-		// we display an empty row if the model is empty because otherwise
-		// we can't drag/drop into the empty table.
-		// FIXME: use JTable.setFillsViewportHeight(boolean) after the migration
-		// to Java 6.
-		return 1;
-	}
-
-	public Object getValueAt(int rowIndex, int columnIndex) {
-		if (members.size() == 0 && rowIndex == 0){
-			// we display an empty row if the model is empty because otherwise
-			// we can't drag/drop into the empty table.
-			// FIXME: use JTable.setFillsViewportHeight(boolean) after the migration
-			// to Java 6.
-			return null;
-		}
-		switch(columnIndex){
-		case 0: return members.get(rowIndex).getRole();
-		case 1: return layer.data.getPrimitiveById(members.get(rowIndex).getTarget());
-		}
-		return null;
-	}
-
-	@Override
-	public boolean isCellEditable(int rowIndex, int columnIndex) {
-		// we display an empty row if the model is empty because otherwise
-		// we can't drag/drop into the empty table. This row isn't editable
-		// FIXME: use JTable.setFillsViewportHeight(boolean) after the migration
-		// to Java 6.
-		if (members.size() == 0 && rowIndex == 0) return false;
-		
-		// otherwise only the column with the member roles is editable
-		return columnIndex == 0;
-	}
-
-	@Override
-	public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
-		if (columnIndex !=0)return;
-		String role = (String)aValue;
-		RelationMemberModel model = members.get(rowIndex);
-		model.setRole(role);
-		fireTableCellUpdated(rowIndex, columnIndex);
-	}
+public class RelationMemberEditorModel extends AbstractTableModel{  
+    static private final Logger logger = Logger.getLogger(RelationMemberEditorModel.class.getName());
+    private final ArrayList<RelationMemberModel> members = new ArrayList<RelationMemberModel>();
+    private OsmDataLayer layer;
+    private DefaultListSelectionModel rowSelectionModel;
+    private DefaultListSelectionModel colSelectionModel;
+    
+    /**
+     * Creates a new model in the context of an {@see OsmDataLayer}. Internally allocates
+     * a row and a column selection model, see {@see #getRowSelectionModel()} and 
+     * {@see #getColSelectionModel()}.
+     * 
+     * @param layer the data layer. Must not be null.
+     * @exception IllegalArgumentException thrown if layer is null
+     */
+    public RelationMemberEditorModel(OsmDataLayer layer) throws IllegalArgumentException{
+        CheckParameterUtil.ensureParameterNotNull(layer, "layer");
+        this.layer = layer;
+        rowSelectionModel = new DefaultListSelectionModel();
+        colSelectionModel = new DefaultListSelectionModel();
+    }
+
+    /**
+     *  Creates a new model in the context of an {@see OsmDataLayer}
+     *  
+     * @param layer layer the data layer. Must not be null.
+     * @param rowSelectionModel the row selection model. Must not be null.
+     * @param colSelectionModel the column selection model. Must not be null.
+     * @throws IllegalArgumentException thrown if layer is null
+     * @throws IllegalArgumentException thrown if rowSelectionModel is null
+     * @throws IllegalArgumentException thrown if colSelectionModel is null
+     */
+    public RelationMemberEditorModel(OsmDataLayer layer, DefaultListSelectionModel rowSelectionModel, DefaultListSelectionModel colSelectionModel) throws IllegalArgumentException{
+        CheckParameterUtil.ensureParameterNotNull(layer, "layer");
+        CheckParameterUtil.ensureParameterNotNull(rowSelectionModel, "rowSelectionModel");
+        CheckParameterUtil.ensureParameterNotNull(colSelectionModel, "colSelectionModel");
+        this.layer = layer;
+        this.rowSelectionModel = rowSelectionModel;
+        this.colSelectionModel = colSelectionModel;
+    }
+
+    /**
+     * Replies the row selection model used in this table model.
+     * 
+     * @return the row selection model 
+     */
+    public DefaultListSelectionModel getRowSelectionModel() {
+        return rowSelectionModel;
+    }
+    
+    /**
+     * Replies the column selection model used in this table model.
+     * 
+     * @return the col selection model
+     */
+    public DefaultListSelectionModel getColSelectionModel() {
+        return colSelectionModel;
+    }
+    
+    /**
+     * Replies the set of {@see OsmPrimitive}s with the role {@code role}. If no
+     * such primitives exists, the empty set is returned.
+     * 
+     * @return the set of {@see OsmPrimitive}s with the role {@code role}
+     */
+    protected Set<OsmPrimitive> getPrimitivesWithRole(String role) {
+        HashSet<OsmPrimitive> ret = new HashSet<OsmPrimitive>();
+        for (RelationMemberModel rm: members){
+            if (rm.getRole().equals(role)){
+                OsmPrimitive p = layer.data.getPrimitiveById(rm.getTarget());
+                if (p != null){
+                    ret.add(p);
+                }
+            }
+        }
+        return ret;
+    }
+    
+    /**
+     * Replies the list of {@see RelationMemberModel}s with the role {@code role}. If no
+     * such primitives exists, the empty set is returned.
+     * 
+     * @return the set of {@see RelationMemberModel}s with the role {@code role}
+     */
+    protected List<RelationMemberModel> getRelationMembersWithRole(String role) {
+        ArrayList<RelationMemberModel> ret = new ArrayList<RelationMemberModel>();
+        for (RelationMemberModel rm: members){
+            if (rm.getRole().equals(role)){
+                ret.add(rm);
+            }
+        }
+        return ret;
+    }
+    
+    /**
+     * Removes all members with role {@code role}.
+     * 
+     * @param role the role. Ignored if null.
+     * @return true if the list of members was modified; false, otherwise
+     */
+    protected boolean removeMembersWithRole(String role){
+        if (role == null) return false;
+        boolean isChanged = false;
+        for(Iterator<RelationMemberModel> it = members.iterator(); it.hasNext(); ){
+            RelationMemberModel rm = it.next();
+            if (rm.getRole().equals(role)) {
+                it.remove();
+                isChanged = true;
+            }
+        }
+        return isChanged;
+    }
+        
+    /**
+     * Replies the set of {@see OsmPrimitive}s with the role 'from'. If no
+     * such primitives exists, the empty set is returned.
+     * 
+     * @return the set of {@see OsmPrimitive}s with the role 'from'
+     */
+    public Set<OsmPrimitive> getFromPrimitives() {
+        return getPrimitivesWithRole("from");       
+    }
+    
+    /**
+     * Replies the set of {@see OsmPrimitive}s with the role 'to'. If no
+     * such primitives exists, the empty set is returned.
+     * 
+     * @return the set of {@see OsmPrimitive}s with the role 'from'
+     */
+    public Set<OsmPrimitive> getToPrimitives() {
+        return getPrimitivesWithRole("to");
+    }
+    
+    /**
+     * Replies the list of 'via' objects in the order they occur in the
+     * member list. Replies an empty list if no vias exist
+     * 
+     * @return 
+     */
+    public List<OsmPrimitive> getVias() {
+        ArrayList<OsmPrimitive> ret = new ArrayList<OsmPrimitive>();
+        for (RelationMemberModel rm: getRelationMembersWithRole("via")){
+            ret.add(layer.data.getPrimitiveById(rm.getTarget()));
+        }
+        return ret;
+    }
+    
+    /**
+     * Sets the list of vias. Removes all 'vias' if {@code vias} is null.
+     * 
+     * null vias are skipped. A via must belong to the dataset of the layer in whose context
+     * this editor is working, otherwise an {@see IllegalArgumentException} is thrown.
+     * 
+     * @param vias the vias.
+     * @exception IllegalArgumentException thrown if a via doesn't belong to the dataset of the layer
+     * in whose context this editor is working 
+     */
+    public void setVias(List<OsmPrimitive> vias) throws IllegalArgumentException{
+        boolean viasDeleted = removeMembersWithRole("via");
+        if (vias == null || vias.isEmpty()){
+            if (viasDeleted){
+                fireTableDataChanged();
+            }
+            return;
+        }
+        // check vias 
+        for (OsmPrimitive via: vias) {
+            if (via == null) continue;
+            if (via.getDataSet() == null || via.getDataSet() != layer.data){
+                throw new IllegalArgumentException(MessageFormat.format("via object ''{0}'' must belong to dataset of layer ''{1}''", via.getDisplayName(DefaultNameFormatter.getInstance()), layer.getName()));
+            }
+        }
+        // add vias 
+        for (OsmPrimitive via: vias) {
+            if (via == null) continue;
+            RelationMemberModel model = new RelationMemberModel("via", via);
+            members.add(model);
+        }
+        fireTableDataChanged();
+    }
+    
+    /**
+     * Sets the turn restriction member with role {@code role}. Removes all
+     * members with role {@code role} if {@code id} is null.
+     * 
+     * @param id the id 
+     * @return true if the model was modified; false, otherwise
+     */
+    protected boolean setPrimitiveWithRole(PrimitiveId id, String role){
+        if (id == null){
+            return removeMembersWithRole(role);
+        }
+        
+        List<RelationMemberModel> fromMembers = getRelationMembersWithRole(role);
+        if (fromMembers.isEmpty()){
+            RelationMemberModel rm = new RelationMemberModel(role, id);
+            members.add(rm);
+            return true;
+        } else if (fromMembers.size() == 1){
+            RelationMemberModel rm = fromMembers.get(0);
+            if (!rm.getTarget().equals(id)){
+                rm.setTarget(id);
+                return true;
+            }
+            return false;
+        } else {
+            removeMembersWithRole(role);
+            RelationMemberModel rm = new RelationMemberModel(role, id);
+            members.add(rm);
+            return true;
+        }
+    }
+    
+    /**
+     * Sets the turn restriction member with role 'from'. Removes all
+     * members with role 'from' if {@code id} is null.
+     * 
+     * @param id the id 
+     */
+    public void setFromPrimitive(PrimitiveId id){
+        if (setPrimitiveWithRole(id, "from")) {
+            fireTableDataChanged();
+        }
+    }
+    
+    /**
+     * Sets the turn restriction member with role 'to'. Removes all
+     * members with role 'to' if {@code id} is null.
+     * 
+     * @param id the id 
+     */
+    public void setToPrimitive(PrimitiveId id){
+        if (setPrimitiveWithRole(id, "to")) {
+            fireTableDataChanged();
+        }
+    }
+    
+    /**
+     * Replies the set of {@see OsmPrimitive}s referred to by members in
+     * this model.
+     * 
+     * @return the set of {@see OsmPrimitive}s referred to by members in
+     * this model.
+     */
+    public Set<OsmPrimitive> getMemberPrimitives() {
+        Set<OsmPrimitive> ret = new HashSet<OsmPrimitive>();
+        for (RelationMemberModel rm: members){
+            OsmPrimitive p = layer.data.getPrimitiveById(rm.getTarget());
+            if (p != null) ret.add(p);
+        }
+        return ret;
+    }
+    
+    /**
+     * Populates the model with the relation member of a turn restriction. Clears
+     * the model if {@code tr} is null. 
+     * 
+     * @param tr the turn restriction
+     */
+    public void populate(Relation tr){
+        members.clear();
+        if (tr == null){
+            fireTableDataChanged();
+            return;
+        }
+        for(RelationMember rm: tr.getMembers()){
+            members.add(new RelationMemberModel(rm));
+        }
+        fireTableDataChanged();
+    }
+    
+    /**
+     * Replaces the member of turn restriction {@code tr} by the relation members currently
+     * edited in this model.
+     * 
+     * @param tr the turn restriction. Ignored if null.
+     */
+    public void applyTo(Relation tr){
+        if (tr == null) return;
+        List<RelationMember> newMembers = new ArrayList<RelationMember>();
+        for(RelationMemberModel model: members){
+            RelationMember rm = new RelationMember(model.getRole(), layer.data.getPrimitiveById(model.getTarget()));
+            newMembers.add(rm);
+        }
+        tr.setMembers(newMembers);
+    }
+    
+    /**
+     * Clears the roles of all relation members currently selected in the 
+     * table.
+     */
+    protected void clearSelectedRoles(){
+        for(int i=0; i < getRowCount();i++){
+            if (rowSelectionModel.isSelectedIndex(i)) {
+                members.get(i).setRole("");
+            }
+        }       
+    }
+    
+    /**
+     * Removes the currently selected rows from the model 
+     */
+    protected void removedSelectedMembers() {
+        for(int i=getRowCount()-1; i >= 0;i--){
+            if (rowSelectionModel.isSelectedIndex(i)) {
+                members.remove(i);
+            }
+        }
+    }
+    
+    /**
+     * Deletes the current selection.
+     * 
+     * If only cells in the first column are selected, the roles of the selected
+     * members are reset to the empty string. Otherwise the selected members are
+     * removed from the model. 
+     * 
+     */
+    public void deleteSelected() {
+        if (colSelectionModel.isSelectedIndex(0) && !colSelectionModel.isSelectedIndex(1)) {
+            clearSelectedRoles();
+        } else if (rowSelectionModel.getMinSelectionIndex() >= 0){
+            removedSelectedMembers();
+        }
+        fireTableDataChanged();
+    }
+    
+    protected List<Integer> getSelectedIndices() {
+        ArrayList<Integer> ret = new ArrayList<Integer>();
+        for(int i =0; i < members.size(); i++){
+            if (rowSelectionModel.isSelectedIndex(i)) 
+                ret.add(i);
+        }
+        return ret;
+    }
+    
+    public boolean canMoveUp() {
+        List<Integer> sel = getSelectedIndices();
+        if (sel.isEmpty()) return false;
+        return sel.get(0) > 0;
+    }
+    
+    public boolean canMoveDown() {
+        List<Integer> sel = getSelectedIndices();
+        if (sel.isEmpty()) return false;
+        return sel.get(sel.size()-1) < members.size()-1;
+    }
+    
+    public void moveUpSelected() {
+        if (!canMoveUp()) return;
+        List<Integer> sel = getSelectedIndices();
+        for (int idx: sel){
+            RelationMemberModel m = members.remove(idx);
+            members.add(idx-1, m);
+        }
+        fireTableDataChanged();
+        rowSelectionModel.clearSelection();
+        colSelectionModel.setSelectionInterval(0, 1);
+        for (int idx: sel){
+            rowSelectionModel.addSelectionInterval(idx-1, idx-1);
+        }
+    }
+    
+    public void moveDownSelected() {
+        if (!canMoveDown()) return;
+        List<Integer> sel = getSelectedIndices();
+        for (int i = sel.size()-1; i>=0;i--){
+            int idx = sel.get(i);
+            RelationMemberModel m = members.remove(idx);
+            members.add(idx+1, m);
+        }
+        fireTableDataChanged();
+        rowSelectionModel.clearSelection();
+        colSelectionModel.setSelectionInterval(0, 1);
+        for (int idx: sel){
+            rowSelectionModel.addSelectionInterval(idx+1, idx+1);
+        }
+    }
+    
+    /**
+     * Inserts a list of new relation members with the empty role for the primitives
+     * with id in {@code ids}. Inserts the new primitives at the position of the first
+     * selected row. If no row is selected, at the end of the list. 
+     * 
+     *  null values are skipped. If there is an id for which there is no primitive in the context 
+     *  layer, if the primitive is deleted or invisible, an {@see IllegalArgumentException}
+     *  is thrown and nothing is inserted. 
+     * 
+     * @param ids the list of ids. Ignored if null.
+     * @throws IllegalArgumentException thrown if one of the ids can't be inserted
+     */
+    public void insertMembers(Collection<PrimitiveId> ids) throws IllegalArgumentException {
+        if (ids == null) return;    
+        ArrayList<RelationMemberModel> newMembers = new ArrayList<RelationMemberModel>();
+        for (PrimitiveId id: ids){
+            OsmPrimitive p = layer.data.getPrimitiveById(id);
+            if (p == null){
+                throw new IllegalArgumentException(tr("Cannot find object with id ''{0}'' in layer ''{1}''", id.toString(), layer.getName()));
+            }
+            if (p.isDeleted() || ! p.isVisible()) {
+                throw new IllegalArgumentException(tr("Cannot add object ''{0}'' as relation member because it is deleted or invisible in layer ''{1}''", p.getDisplayName(DefaultNameFormatter.getInstance()), layer.getName()));              
+            }
+            newMembers.add(new RelationMemberModel("",id));
+        }
+        if (newMembers.isEmpty()) return;
+        int insertPos = rowSelectionModel.getMinSelectionIndex();
+        if ( insertPos >=0){
+            members.addAll(insertPos, newMembers);
+        } else {
+            members.addAll(newMembers);
+        }
+        fireTableDataChanged();
+        if (insertPos < 0) insertPos = 0;       
+        colSelectionModel.setSelectionInterval(0, 1); // select both columns
+        rowSelectionModel.setSelectionInterval(insertPos, insertPos + newMembers.size()-1);
+    }
+
+    public int getColumnCount() {
+        return 2;
+    }
+
+    public int getRowCount() {
+        if (members.size() > 0) return members.size();
+        
+        // we display an empty row if the model is empty because otherwise
+        // we can't drag/drop into the empty table.
+        // FIXME: use JTable.setFillsViewportHeight(boolean) after the migration
+        // to Java 6.
+        return 1;
+    }
+
+    public Object getValueAt(int rowIndex, int columnIndex) {
+        if (members.size() == 0 && rowIndex == 0){
+            // we display an empty row if the model is empty because otherwise
+            // we can't drag/drop into the empty table.
+            // FIXME: use JTable.setFillsViewportHeight(boolean) after the migration
+            // to Java 6.
+            return null;
+        }
+        switch(columnIndex){
+        case 0: return members.get(rowIndex).getRole();
+        case 1: return layer.data.getPrimitiveById(members.get(rowIndex).getTarget());
+        }
+        return null;
+    }
+
+    @Override
+    public boolean isCellEditable(int rowIndex, int columnIndex) {
+        // we display an empty row if the model is empty because otherwise
+        // we can't drag/drop into the empty table. This row isn't editable
+        // FIXME: use JTable.setFillsViewportHeight(boolean) after the migration
+        // to Java 6.
+        if (members.size() == 0 && rowIndex == 0) return false;
+        
+        // otherwise only the column with the member roles is editable
+        return columnIndex == 0;
+    }
+
+    @Override
+    public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
+        if (columnIndex !=0)return;
+        String role = (String)aValue;
+        RelationMemberModel model = members.get(rowIndex);
+        model.setRole(role);
+        fireTableCellUpdated(rowIndex, columnIndex);
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/RelationMemberModel.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/RelationMemberModel.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/RelationMemberModel.java	(revision 23192)
@@ -16,99 +16,99 @@
  */
 public class RelationMemberModel implements Serializable{
-	private String role;
-	private SimplePrimitiveId target;
-	
-	/**
-	 * Creates a new relation member model
-	 * 
-	 * @param role the member role. Reset to "" if null.
-	 * @param target the id of the target object. Must not be null.
-	 * @throws IllegalArgumentException thrown if {@code target} is null
-	 */
-	public RelationMemberModel(String role, PrimitiveId target) throws IllegalArgumentException {
-		CheckParameterUtil.ensureParameterNotNull(target, "target");
-		this.role = role == null? "" : role;
-		this.target = new SimplePrimitiveId(target.getUniqueId(), target.getType());
-	}
-	
-	/**
-	 * Creates a new relation member model from a relation member 
-	 * 
-	 * @param member the relation member. Must not be null.
-	 * @throws IllegalArgumentException thrown if {@code member} is null
-	 */
-	public RelationMemberModel(RelationMember member) throws IllegalArgumentException{
-		CheckParameterUtil.ensureParameterNotNull(member, "member");
-		this.role = member.getRole();
-		setTarget(member.getMember().getPrimitiveId());
-	}
+    private String role;
+    private SimplePrimitiveId target;
+    
+    /**
+     * Creates a new relation member model
+     * 
+     * @param role the member role. Reset to "" if null.
+     * @param target the id of the target object. Must not be null.
+     * @throws IllegalArgumentException thrown if {@code target} is null
+     */
+    public RelationMemberModel(String role, PrimitiveId target) throws IllegalArgumentException {
+        CheckParameterUtil.ensureParameterNotNull(target, "target");
+        this.role = role == null? "" : role;
+        this.target = new SimplePrimitiveId(target.getUniqueId(), target.getType());
+    }
+    
+    /**
+     * Creates a new relation member model from a relation member 
+     * 
+     * @param member the relation member. Must not be null.
+     * @throws IllegalArgumentException thrown if {@code member} is null
+     */
+    public RelationMemberModel(RelationMember member) throws IllegalArgumentException{
+        CheckParameterUtil.ensureParameterNotNull(member, "member");
+        this.role = member.getRole();
+        setTarget(member.getMember().getPrimitiveId());
+    }
 
-	/**
-	 * Replies the current role in this model. Never null.
-	 * 
-	 * @return the current role in this model
-	 */
-	public String getRole() {
-		return role;
-	}
+    /**
+     * Replies the current role in this model. Never null.
+     * 
+     * @return the current role in this model
+     */
+    public String getRole() {
+        return role;
+    }
 
-	/**
-	 * Sets the current role in this model. 
-	 * 
-	 * @param role the role. Reset to "" if null.
-	 */
-	public void setRole(String role) {
-		this.role = role == null? "" : role;
-	}
+    /**
+     * Sets the current role in this model. 
+     * 
+     * @param role the role. Reset to "" if null.
+     */
+    public void setRole(String role) {
+        this.role = role == null? "" : role;
+    }
 
-	/**
-	 * Replies the id of the target object of this relation member.
-	 * 
-	 * @return the id of the target object of this relation member.
-	 */
-	public PrimitiveId getTarget() {
-		return target;
-	}
+    /**
+     * Replies the id of the target object of this relation member.
+     * 
+     * @return the id of the target object of this relation member.
+     */
+    public PrimitiveId getTarget() {
+        return target;
+    }
 
-	/**
-	 * Sets the id of the target object.  
-	 * 
-	 * @param target the id of the target object. Must not be null.
-	 * @throws IllegalArgumentException thrown if {@code target} is null
-	 */
-	public void setTarget(PrimitiveId target) throws IllegalArgumentException{
-		CheckParameterUtil.ensureParameterNotNull(target, "target");
-		this.target = new SimplePrimitiveId(target.getUniqueId(), target.getType());
-	}
-	
-	@Override
-	public int hashCode() {
-		final int prime = 31;
-		int result = 1;
-		result = prime * result + ((role == null) ? 0 : role.hashCode());
-		result = prime * result + ((target == null) ? 0 : target.hashCode());
-		return result;
-	}
+    /**
+     * Sets the id of the target object.  
+     * 
+     * @param target the id of the target object. Must not be null.
+     * @throws IllegalArgumentException thrown if {@code target} is null
+     */
+    public void setTarget(PrimitiveId target) throws IllegalArgumentException{
+        CheckParameterUtil.ensureParameterNotNull(target, "target");
+        this.target = new SimplePrimitiveId(target.getUniqueId(), target.getType());
+    }
+    
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((role == null) ? 0 : role.hashCode());
+        result = prime * result + ((target == null) ? 0 : target.hashCode());
+        return result;
+    }
 
-	@Override
-	public boolean equals(Object obj) {
-		if (this == obj)
-			return true;
-		if (obj == null)
-			return false;
-		if (getClass() != obj.getClass())
-			return false;
-		RelationMemberModel other = (RelationMemberModel) obj;
-		if (role == null) {
-			if (other.role != null)
-				return false;
-		} else if (!role.equals(other.role))
-			return false;
-		if (target == null) {
-			if (other.target != null)
-				return false;
-		} else if (!target.equals(other.target))
-			return false;
-		return true;
-	}
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        RelationMemberModel other = (RelationMemberModel) obj;
+        if (role == null) {
+            if (other.role != null)
+                return false;
+        } else if (!role.equals(other.role))
+            return false;
+        if (target == null) {
+            if (other.target != null)
+                return false;
+        } else if (!target.equals(other.target))
+            return false;
+        return true;
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/RelationMemberRoleCellRenderer.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/RelationMemberRoleCellRenderer.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/RelationMemberRoleCellRenderer.java	(revision 23192)
@@ -10,29 +10,29 @@
 public class RelationMemberRoleCellRenderer extends DefaultTableCellRenderer{
 private JLabel mockCell;
-	
-	public RelationMemberRoleCellRenderer() {
-		mockCell = new JLabel();
-		mockCell.setText("");
-		mockCell.setOpaque(true);
-	}
-	
-	public Component getTableCellRendererComponent(JTable table, Object value,
-			boolean isSelected, boolean hasFocus, int row, int column) {
-		if (value != null){
-			return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
-		}
-		
-		// FIXME: required to always draw a mock row, even if the table is empty.
-		// Otherwise, drag and drop onto the table fails.
-		// Replace with JTable.setFillsViewportHeight(boolean) after the migration
-		// to Java 6.
-		if (isSelected){
-			mockCell.setBackground(UIManager.getColor("Table.selectionBackground"));
-			mockCell.setForeground(UIManager.getColor("Table.selectionForeground"));
-		} else {
-			mockCell.setBackground(UIManager.getColor("Panel.background"));
-			mockCell.setForeground(UIManager.getColor("Panel.foreground"));
-		}		
-		return mockCell;
-	}
+    
+    public RelationMemberRoleCellRenderer() {
+        mockCell = new JLabel();
+        mockCell.setText("");
+        mockCell.setOpaque(true);
+    }
+    
+    public Component getTableCellRendererComponent(JTable table, Object value,
+            boolean isSelected, boolean hasFocus, int row, int column) {
+        if (value != null){
+            return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+        }
+        
+        // FIXME: required to always draw a mock row, even if the table is empty.
+        // Otherwise, drag and drop onto the table fails.
+        // Replace with JTable.setFillsViewportHeight(boolean) after the migration
+        // to Java 6.
+        if (isSelected){
+            mockCell.setBackground(UIManager.getColor("Table.selectionBackground"));
+            mockCell.setForeground(UIManager.getColor("Table.selectionForeground"));
+        } else {
+            mockCell.setBackground(UIManager.getColor("Panel.background"));
+            mockCell.setForeground(UIManager.getColor("Panel.foreground"));
+        }       
+        return mockCell;
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/RelationMemberTable.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/RelationMemberTable.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/RelationMemberTable.java	(revision 23192)
@@ -46,314 +46,314 @@
  */
 public class RelationMemberTable extends JTable {
-	static private final Logger logger = Logger.getLogger(RelationMemberTable.class.getName());
-	
-	private TurnRestrictionEditorModel model;
-	private DeleteAction actDelete;
-	private PasteAction actPaste;
-	private MoveUpAction actMoveUp;
-	private MoveDownAction actMoveDown;
-	private TransferHandler transferHandler;
-	
-	public RelationMemberTable(TurnRestrictionEditorModel model) {
-		super(
-				model.getRelationMemberEditorModel(),
-				new RelationMemberColumnModel(model.getRelationMemberEditorModel().getColSelectionModel()),
-				model.getRelationMemberEditorModel().getRowSelectionModel()
-		);
-		this.model = model;
-		setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
+    static private final Logger logger = Logger.getLogger(RelationMemberTable.class.getName());
+    
+    private TurnRestrictionEditorModel model;
+    private DeleteAction actDelete;
+    private PasteAction actPaste;
+    private MoveUpAction actMoveUp;
+    private MoveDownAction actMoveDown;
+    private TransferHandler transferHandler;
+    
+    public RelationMemberTable(TurnRestrictionEditorModel model) {
+        super(
+                model.getRelationMemberEditorModel(),
+                new RelationMemberColumnModel(model.getRelationMemberEditorModel().getColSelectionModel()),
+                model.getRelationMemberEditorModel().getRowSelectionModel()
+        );
+        this.model = model;
+        setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
         setRowSelectionAllowed(true);
         setColumnSelectionAllowed(true);
 
-		// register the popup menu launcher
-		addMouseListener(new TablePopupLauncher());
-		
-		// transfer handling
-		setDragEnabled(true);
-		setTransferHandler(new RelationMemberTransferHandler());
-		setDropTarget(new RelationMemberTableDropTarget());
-		
-		// initialize the delete action
-		//
-		actDelete = new DeleteAction();
-		model.getRelationMemberEditorModel().getRowSelectionModel().addListSelectionListener(actDelete);
-		registerKeyboardAction(actDelete, KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,0), WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
-		
-		// initialize the paste action (will be used in the popup, the action map already includes
-		// the standard paste action for transfer handling) 
-		actPaste = new PasteAction();
-		
-		actMoveUp = new MoveUpAction();
-		model.getRelationMemberEditorModel().getRowSelectionModel().addListSelectionListener(actMoveUp);
-		registerKeyboardAction(actMoveUp,actMoveUp.getKeyStroke(), WHEN_FOCUSED);
-		
-		actMoveDown = new MoveDownAction();
-		model.getRelationMemberEditorModel().getRowSelectionModel().addListSelectionListener(actMoveDown);
-		registerKeyboardAction(actMoveDown, actMoveDown.getKeyStroke(), WHEN_FOCUSED);
-	}
-
-	/**
-	 * The action for deleting the selected table cells 
-	 * 
-	 */
-	class DeleteAction extends AbstractAction implements ListSelectionListener{
-		public DeleteAction() {
-			putValue(NAME, tr("Delete"));
-			putValue(SHORT_DESCRIPTION, tr("Clear the selected roles or delete the selected members"));
-			putValue(SMALL_ICON, ImageProvider.get("deletesmall"));
-			putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,0));
-			updateEnabledState();
-		}
-		
-		public void updateEnabledState() {
-			setEnabled(model.getRelationMemberEditorModel().getRowSelectionModel().getMinSelectionIndex()>=0);
-		}
-
-		public void actionPerformed(ActionEvent e) {
-			model.getRelationMemberEditorModel().deleteSelected();
-		}
-
-		public void valueChanged(ListSelectionEvent e) {
-			updateEnabledState();
-		}
-	}	
-	
-	/**
-	 * The action for pasting into the relation member table
-	 * 
-	 */
-	class PasteAction extends AbstractAction{		
-		public PasteAction() {
-			putValue(NAME, tr("Paste"));
-			putValue(SHORT_DESCRIPTION, tr("Insert new relation members from object in the clipboard"));
-			putValue(SMALL_ICON, ImageProvider.get("paste"));
-			putValue(ACCELERATOR_KEY, Shortcut.getPasteKeyStroke());
-			updateEnabledState();
-		}
-		
-		public void updateEnabledState() {
-			DataFlavor[] flavors = Toolkit.getDefaultToolkit().getSystemClipboard().getAvailableDataFlavors();
-			setEnabled(PrimitiveIdListTransferHandler.isSupportedFlavor(flavors));
-		}
-
-		public void actionPerformed(ActionEvent evt) {
-			// tried to delegate to 'paste' action in the action map of the
-			// table, but didn't work. Now duplicating the logic of importData(...) in
-			// the transfer handler.
-			//
-			Clipboard cp = Toolkit.getDefaultToolkit().getSystemClipboard();
-			if (!PrimitiveIdListTransferHandler.isSupportedFlavor(cp.getAvailableDataFlavors())) return;
-			try {
-				List<PrimitiveId> ids;
-				ids = (List<PrimitiveId>)cp.getData(PrimitiveIdTransferable.PRIMITIVE_ID_LIST_FLAVOR);
-				try {
-					model.getRelationMemberEditorModel().insertMembers(ids);
-				} catch(IllegalArgumentException e){
-					e.printStackTrace();
-					// FIXME: provide user feedback
-				}
-			} catch(IOException e){
-				e.printStackTrace();
-			} catch(UnsupportedFlavorException e){
-				e.printStackTrace();
-			} 
-		}
-	}	
-
-	class MoveDownAction extends AbstractAction implements ListSelectionListener{	
-		private KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.ALT_DOWN_MASK);
-		public MoveDownAction(){
-			putValue(NAME, tr("Move down"));
-			putValue(SHORT_DESCRIPTION, tr("Move the selected relation members down by one position"));
-			putValue(ACCELERATOR_KEY,keyStroke);
-			putValue(SMALL_ICON, ImageProvider.get("dialogs", "movedown"));
-			updateEnabledState();
-		}
-		
-		public void actionPerformed(ActionEvent e) {
-			model.getRelationMemberEditorModel().moveDownSelected();
-		}
-
-		public void updateEnabledState(){
-			setEnabled(model.getRelationMemberEditorModel().canMoveDown());
-		}
-		
-		public void valueChanged(ListSelectionEvent e) {
-			updateEnabledState();			
-		}
-		public KeyStroke getKeyStroke() {
-			return keyStroke;
-		}
-	}
-	
-	class MoveUpAction extends AbstractAction implements ListSelectionListener{
-		private KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.ALT_DOWN_MASK);
-
-		public MoveUpAction() {
-			putValue(NAME, tr("Move up"));
-			putValue(SHORT_DESCRIPTION, tr("Move the selected relation members up by one position"));
-			putValue(ACCELERATOR_KEY,keyStroke);
-			putValue(SMALL_ICON, ImageProvider.get("dialogs", "moveup"));
-			updateEnabledState();
-		}
-		
-		public void actionPerformed(ActionEvent e) {
-			model.getRelationMemberEditorModel().moveUpSelected();
-		}
-
-		public void updateEnabledState(){
-			setEnabled(model.getRelationMemberEditorModel().canMoveUp());
-		}
-		
-		public void valueChanged(ListSelectionEvent e) {
-			updateEnabledState();			
-		}
-		public KeyStroke getKeyStroke() {
-			return keyStroke;
-		}
-	}
-	
-	class TablePopupLauncher extends PopupMenuLauncher {
-		@Override
-		public void launch(MouseEvent evt) {
-			int row = rowAtPoint(evt.getPoint());
-			if (getSelectionModel().getMinSelectionIndex() < 0 && row >=0){
-				getSelectionModel().setSelectionInterval(row, row);
-				getColumnModel().getSelectionModel().setSelectionInterval(0, 1);
-			}
-			new PopupMenu().show(RelationMemberTable.this, evt.getX(), evt.getY());
-		}		
-	}
-	
-	class PopupMenu extends JPopupMenu {
-		public PopupMenu() {
-			JMenuItem item = add(actPaste);
-			item.setTransferHandler(transferHandler);
-			actPaste.updateEnabledState();
-			addSeparator();
-			add(actDelete);
-			addSeparator();
-			add(actMoveUp);
-			add(actMoveDown);
-		}
-	}
-	
-	/**
-	 * The transfer handler for the relation member table. 
-	 *
-	 */
-	class RelationMemberTransferHandler extends TransferHandler {
-		
-		@Override
-		public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) {
-			return PrimitiveIdListTransferHandler.isSupportedFlavor(transferFlavors);
-		}
-
-		@Override
-		public boolean importData(JComponent comp, Transferable t) {
-			try {
-				List<PrimitiveId> ids;
-				ids = (List<PrimitiveId>)t.getTransferData(PrimitiveIdTransferable.PRIMITIVE_ID_LIST_FLAVOR);
-				try {
-					model.getRelationMemberEditorModel().insertMembers(ids);
-				} catch(IllegalArgumentException e){
-					e.printStackTrace();
-					// FIXME: provide user feedback
-					return false;
-				}
-				return true;
-			} catch(IOException e){
-				e.printStackTrace();
-			} catch(UnsupportedFlavorException e){
-				e.printStackTrace();
-			} 
-			return false;
-		}
-
-		@Override
-		public int getSourceActions(JComponent c) {
-			return  COPY_OR_MOVE;
-		}
-	}
-	
-	/**
-	 * A custom drop target for the relation member table. During dragging we need to
-	 * disable colum selection model.  
-	 *
-	 */
-	class RelationMemberTableDropTarget extends DropTarget{		
-		private boolean dropAccepted = false;	
-		
-		/**
-		 * Replies true if {@code transferFlavors} includes the data flavor {@see PrimitiveIdTransferable#PRIMITIVE_ID_LIST_FLAVOR}.
-
-		 * @param transferFlavors an array of transferFlavors
-		 * @return
-		 */
-		protected boolean isSupportedFlavor(DataFlavor[] transferFlavors) {
-			for (DataFlavor df: transferFlavors) {
-				if (df.equals(PrimitiveIdTransferable.PRIMITIVE_ID_LIST_FLAVOR)) return true;
-			}
-			return false;
-		}		
-		
-		public synchronized void dragEnter(DropTargetDragEvent dtde) {
-			if (isSupportedFlavor(dtde.getCurrentDataFlavors())) {
-				if ((dtde.getSourceActions() & DnDConstants.ACTION_COPY_OR_MOVE) != 0){
-					dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);		
-					setColumnSelectionAllowed(false);
-					dropAccepted  = true;
-				} else {
-					dtde.rejectDrag();
-				}
-			} else {
-				dtde.rejectDrag();
-			}
-		}
-		
-		public synchronized void dragExit(DropTargetEvent dte) {
-			setColumnSelectionAllowed(true);
-			dropAccepted = false;
-		}
-		
-		@Override
-		public synchronized void dragOver(DropTargetDragEvent dtde) {
-			int row = rowAtPoint(dtde.getLocation());
-			int selectedRow = getSelectionModel().getMinSelectionIndex();
-			if (row >= 0 && row != selectedRow){
-				getSelectionModel().setSelectionInterval(row, row);
-			}			
-		}
-
-		public synchronized void drop(DropTargetDropEvent dtde) {
-			try {
-				if (!dropAccepted) return; 
-				if ((dtde.getSourceActions() & DnDConstants.ACTION_COPY_OR_MOVE) == 0) {
-					return;
-				}
-				List<PrimitiveId> ids;
-				ids = (List<PrimitiveId>)dtde.getTransferable().getTransferData(PrimitiveIdTransferable.PRIMITIVE_ID_LIST_FLAVOR);
-				try {
-					model.getRelationMemberEditorModel().insertMembers(ids);
-				} catch(IllegalArgumentException e){
-					e.printStackTrace();
-					// FIXME: provide user feedback
-				}
-			} catch(IOException e){
-				e.printStackTrace();
-			} catch(UnsupportedFlavorException e){
-				e.printStackTrace();
-			} finally {
-				setColumnSelectionAllowed(true);
-			}
-		}
-		
-		public synchronized void dropActionChanged(DropTargetDragEvent dtde) {
-			if ((dtde.getSourceActions() & DnDConstants.ACTION_COPY_OR_MOVE) == 0) {
-				dtde.rejectDrag();
-			} else {
-				dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);
-			}
-		}
-	}
+        // register the popup menu launcher
+        addMouseListener(new TablePopupLauncher());
+        
+        // transfer handling
+        setDragEnabled(true);
+        setTransferHandler(new RelationMemberTransferHandler());
+        setDropTarget(new RelationMemberTableDropTarget());
+        
+        // initialize the delete action
+        //
+        actDelete = new DeleteAction();
+        model.getRelationMemberEditorModel().getRowSelectionModel().addListSelectionListener(actDelete);
+        registerKeyboardAction(actDelete, KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,0), WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+        
+        // initialize the paste action (will be used in the popup, the action map already includes
+        // the standard paste action for transfer handling) 
+        actPaste = new PasteAction();
+        
+        actMoveUp = new MoveUpAction();
+        model.getRelationMemberEditorModel().getRowSelectionModel().addListSelectionListener(actMoveUp);
+        registerKeyboardAction(actMoveUp,actMoveUp.getKeyStroke(), WHEN_FOCUSED);
+        
+        actMoveDown = new MoveDownAction();
+        model.getRelationMemberEditorModel().getRowSelectionModel().addListSelectionListener(actMoveDown);
+        registerKeyboardAction(actMoveDown, actMoveDown.getKeyStroke(), WHEN_FOCUSED);
+    }
+
+    /**
+     * The action for deleting the selected table cells 
+     * 
+     */
+    class DeleteAction extends AbstractAction implements ListSelectionListener{
+        public DeleteAction() {
+            putValue(NAME, tr("Delete"));
+            putValue(SHORT_DESCRIPTION, tr("Clear the selected roles or delete the selected members"));
+            putValue(SMALL_ICON, ImageProvider.get("deletesmall"));
+            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,0));
+            updateEnabledState();
+        }
+        
+        public void updateEnabledState() {
+            setEnabled(model.getRelationMemberEditorModel().getRowSelectionModel().getMinSelectionIndex()>=0);
+        }
+
+        public void actionPerformed(ActionEvent e) {
+            model.getRelationMemberEditorModel().deleteSelected();
+        }
+
+        public void valueChanged(ListSelectionEvent e) {
+            updateEnabledState();
+        }
+    }   
+    
+    /**
+     * The action for pasting into the relation member table
+     * 
+     */
+    class PasteAction extends AbstractAction{       
+        public PasteAction() {
+            putValue(NAME, tr("Paste"));
+            putValue(SHORT_DESCRIPTION, tr("Insert new relation members from object in the clipboard"));
+            putValue(SMALL_ICON, ImageProvider.get("paste"));
+            putValue(ACCELERATOR_KEY, Shortcut.getPasteKeyStroke());
+            updateEnabledState();
+        }
+        
+        public void updateEnabledState() {
+            DataFlavor[] flavors = Toolkit.getDefaultToolkit().getSystemClipboard().getAvailableDataFlavors();
+            setEnabled(PrimitiveIdListTransferHandler.isSupportedFlavor(flavors));
+        }
+
+        public void actionPerformed(ActionEvent evt) {
+            // tried to delegate to 'paste' action in the action map of the
+            // table, but didn't work. Now duplicating the logic of importData(...) in
+            // the transfer handler.
+            //
+            Clipboard cp = Toolkit.getDefaultToolkit().getSystemClipboard();
+            if (!PrimitiveIdListTransferHandler.isSupportedFlavor(cp.getAvailableDataFlavors())) return;
+            try {
+                List<PrimitiveId> ids;
+                ids = (List<PrimitiveId>)cp.getData(PrimitiveIdTransferable.PRIMITIVE_ID_LIST_FLAVOR);
+                try {
+                    model.getRelationMemberEditorModel().insertMembers(ids);
+                } catch(IllegalArgumentException e){
+                    e.printStackTrace();
+                    // FIXME: provide user feedback
+                }
+            } catch(IOException e){
+                e.printStackTrace();
+            } catch(UnsupportedFlavorException e){
+                e.printStackTrace();
+            } 
+        }
+    }   
+
+    class MoveDownAction extends AbstractAction implements ListSelectionListener{   
+        private KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.ALT_DOWN_MASK);
+        public MoveDownAction(){
+            putValue(NAME, tr("Move down"));
+            putValue(SHORT_DESCRIPTION, tr("Move the selected relation members down by one position"));
+            putValue(ACCELERATOR_KEY,keyStroke);
+            putValue(SMALL_ICON, ImageProvider.get("dialogs", "movedown"));
+            updateEnabledState();
+        }
+        
+        public void actionPerformed(ActionEvent e) {
+            model.getRelationMemberEditorModel().moveDownSelected();
+        }
+
+        public void updateEnabledState(){
+            setEnabled(model.getRelationMemberEditorModel().canMoveDown());
+        }
+        
+        public void valueChanged(ListSelectionEvent e) {
+            updateEnabledState();           
+        }
+        public KeyStroke getKeyStroke() {
+            return keyStroke;
+        }
+    }
+    
+    class MoveUpAction extends AbstractAction implements ListSelectionListener{
+        private KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.ALT_DOWN_MASK);
+
+        public MoveUpAction() {
+            putValue(NAME, tr("Move up"));
+            putValue(SHORT_DESCRIPTION, tr("Move the selected relation members up by one position"));
+            putValue(ACCELERATOR_KEY,keyStroke);
+            putValue(SMALL_ICON, ImageProvider.get("dialogs", "moveup"));
+            updateEnabledState();
+        }
+        
+        public void actionPerformed(ActionEvent e) {
+            model.getRelationMemberEditorModel().moveUpSelected();
+        }
+
+        public void updateEnabledState(){
+            setEnabled(model.getRelationMemberEditorModel().canMoveUp());
+        }
+        
+        public void valueChanged(ListSelectionEvent e) {
+            updateEnabledState();           
+        }
+        public KeyStroke getKeyStroke() {
+            return keyStroke;
+        }
+    }
+    
+    class TablePopupLauncher extends PopupMenuLauncher {
+        @Override
+        public void launch(MouseEvent evt) {
+            int row = rowAtPoint(evt.getPoint());
+            if (getSelectionModel().getMinSelectionIndex() < 0 && row >=0){
+                getSelectionModel().setSelectionInterval(row, row);
+                getColumnModel().getSelectionModel().setSelectionInterval(0, 1);
+            }
+            new PopupMenu().show(RelationMemberTable.this, evt.getX(), evt.getY());
+        }       
+    }
+    
+    class PopupMenu extends JPopupMenu {
+        public PopupMenu() {
+            JMenuItem item = add(actPaste);
+            item.setTransferHandler(transferHandler);
+            actPaste.updateEnabledState();
+            addSeparator();
+            add(actDelete);
+            addSeparator();
+            add(actMoveUp);
+            add(actMoveDown);
+        }
+    }
+    
+    /**
+     * The transfer handler for the relation member table. 
+     *
+     */
+    class RelationMemberTransferHandler extends TransferHandler {
+        
+        @Override
+        public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) {
+            return PrimitiveIdListTransferHandler.isSupportedFlavor(transferFlavors);
+        }
+
+        @Override
+        public boolean importData(JComponent comp, Transferable t) {
+            try {
+                List<PrimitiveId> ids;
+                ids = (List<PrimitiveId>)t.getTransferData(PrimitiveIdTransferable.PRIMITIVE_ID_LIST_FLAVOR);
+                try {
+                    model.getRelationMemberEditorModel().insertMembers(ids);
+                } catch(IllegalArgumentException e){
+                    e.printStackTrace();
+                    // FIXME: provide user feedback
+                    return false;
+                }
+                return true;
+            } catch(IOException e){
+                e.printStackTrace();
+            } catch(UnsupportedFlavorException e){
+                e.printStackTrace();
+            } 
+            return false;
+        }
+
+        @Override
+        public int getSourceActions(JComponent c) {
+            return  COPY_OR_MOVE;
+        }
+    }
+    
+    /**
+     * A custom drop target for the relation member table. During dragging we need to
+     * disable colum selection model.  
+     *
+     */
+    class RelationMemberTableDropTarget extends DropTarget{     
+        private boolean dropAccepted = false;   
+        
+        /**
+         * Replies true if {@code transferFlavors} includes the data flavor {@see PrimitiveIdTransferable#PRIMITIVE_ID_LIST_FLAVOR}.
+
+         * @param transferFlavors an array of transferFlavors
+         * @return
+         */
+        protected boolean isSupportedFlavor(DataFlavor[] transferFlavors) {
+            for (DataFlavor df: transferFlavors) {
+                if (df.equals(PrimitiveIdTransferable.PRIMITIVE_ID_LIST_FLAVOR)) return true;
+            }
+            return false;
+        }       
+        
+        public synchronized void dragEnter(DropTargetDragEvent dtde) {
+            if (isSupportedFlavor(dtde.getCurrentDataFlavors())) {
+                if ((dtde.getSourceActions() & DnDConstants.ACTION_COPY_OR_MOVE) != 0){
+                    dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);      
+                    setColumnSelectionAllowed(false);
+                    dropAccepted  = true;
+                } else {
+                    dtde.rejectDrag();
+                }
+            } else {
+                dtde.rejectDrag();
+            }
+        }
+        
+        public synchronized void dragExit(DropTargetEvent dte) {
+            setColumnSelectionAllowed(true);
+            dropAccepted = false;
+        }
+        
+        @Override
+        public synchronized void dragOver(DropTargetDragEvent dtde) {
+            int row = rowAtPoint(dtde.getLocation());
+            int selectedRow = getSelectionModel().getMinSelectionIndex();
+            if (row >= 0 && row != selectedRow){
+                getSelectionModel().setSelectionInterval(row, row);
+            }           
+        }
+
+        public synchronized void drop(DropTargetDropEvent dtde) {
+            try {
+                if (!dropAccepted) return; 
+                if ((dtde.getSourceActions() & DnDConstants.ACTION_COPY_OR_MOVE) == 0) {
+                    return;
+                }
+                List<PrimitiveId> ids;
+                ids = (List<PrimitiveId>)dtde.getTransferable().getTransferData(PrimitiveIdTransferable.PRIMITIVE_ID_LIST_FLAVOR);
+                try {
+                    model.getRelationMemberEditorModel().insertMembers(ids);
+                } catch(IllegalArgumentException e){
+                    e.printStackTrace();
+                    // FIXME: provide user feedback
+                }
+            } catch(IOException e){
+                e.printStackTrace();
+            } catch(UnsupportedFlavorException e){
+                e.printStackTrace();
+            } finally {
+                setColumnSelectionAllowed(true);
+            }
+        }
+        
+        public synchronized void dropActionChanged(DropTargetDragEvent dtde) {
+            if ((dtde.getSourceActions() & DnDConstants.ACTION_COPY_OR_MOVE) == 0) {
+                dtde.rejectDrag();
+            } else {
+                dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);
+            }
+        }
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/RelationMemberTargetCellRenderer.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/RelationMemberTargetCellRenderer.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/RelationMemberTargetCellRenderer.java	(revision 23192)
@@ -11,32 +11,32 @@
 
 public class RelationMemberTargetCellRenderer extends OsmPrimitivRenderer{
-	static private final Logger logger = Logger.getLogger(RelationMemberTargetCellRenderer.class.getName());
-	private JLabel mockCell;
-	
-	public RelationMemberTargetCellRenderer() {
-		mockCell = new JLabel();
-		mockCell.setText("");
-		mockCell.setOpaque(true);
-	}
-	
-	@Override
-	public Component getTableCellRendererComponent(JTable table, Object value,
-			boolean isSelected, boolean hasFocus, int row, int column) {
-		if (value != null){
-			return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
-		}
-		
-		// FIXME: required to always draw a mock row, even if the table is empty.
-		// Otherwise, drag and drop onto the table fails.
-		// Replace with JTable.setFillsViewportHeight(boolean) after the migration
-		// to Java 6.
-		if (isSelected){
-			mockCell.setBackground(UIManager.getColor("Table.selectionBackground"));
-			mockCell.setForeground(UIManager.getColor("Table.selectionForeground"));
-		} else {
-			mockCell.setBackground(UIManager.getColor("Panel.background"));
-			mockCell.setForeground(UIManager.getColor("Panel.foreground"));
-		}		
-		return mockCell;		
-	}
+    static private final Logger logger = Logger.getLogger(RelationMemberTargetCellRenderer.class.getName());
+    private JLabel mockCell;
+    
+    public RelationMemberTargetCellRenderer() {
+        mockCell = new JLabel();
+        mockCell.setText("");
+        mockCell.setOpaque(true);
+    }
+    
+    @Override
+    public Component getTableCellRendererComponent(JTable table, Object value,
+            boolean isSelected, boolean hasFocus, int row, int column) {
+        if (value != null){
+            return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+        }
+        
+        // FIXME: required to always draw a mock row, even if the table is empty.
+        // Otherwise, drag and drop onto the table fails.
+        // Replace with JTable.setFillsViewportHeight(boolean) after the migration
+        // to Java 6.
+        if (isSelected){
+            mockCell.setBackground(UIManager.getColor("Table.selectionBackground"));
+            mockCell.setForeground(UIManager.getColor("Table.selectionForeground"));
+        } else {
+            mockCell.setBackground(UIManager.getColor("Panel.background"));
+            mockCell.setForeground(UIManager.getColor("Panel.foreground"));
+        }       
+        return mockCell;        
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionComboBox.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionComboBox.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionComboBox.java	(revision 23192)
@@ -9,35 +9,35 @@
  */
 public class TurnRestrictionComboBox extends JComboBox{
-	
-	/**
-	 * Constructor 
-	 * 
-	 * @param model the combo box model. Must not be null.
-	 */
-	public TurnRestrictionComboBox(TurnRestrictionComboBoxModel model){
-		super(model);
-		setEditable(false);
-		setRenderer(new TurnRestrictionTypeRenderer());
-	}
-	
-	/**
-	 * Replies the turn restriction combo box model 
-	 * 
-	 * @return the turn restriction combo box model
-	 */
-	public TurnRestrictionComboBoxModel getTurnRestrictionComboBoxModel() {
-		return (TurnRestrictionComboBoxModel)getModel();
-	}
-	
-	/**
-	 * Initializes the set of icons used from the preference key
-	 * {@see PreferenceKeys#ROAD_SIGNS}.
-	 * 
-	 * @param prefs the JOSM preferences 
-	 */
-	public void initIconSetFromPreferences(Preferences prefs){
-		TurnRestrictionTypeRenderer renderer = (TurnRestrictionTypeRenderer)getRenderer();
-		renderer.initIconSetFromPreferences(prefs);
-		repaint();
-	}
+    
+    /**
+     * Constructor 
+     * 
+     * @param model the combo box model. Must not be null.
+     */
+    public TurnRestrictionComboBox(TurnRestrictionComboBoxModel model){
+        super(model);
+        setEditable(false);
+        setRenderer(new TurnRestrictionTypeRenderer());
+    }
+    
+    /**
+     * Replies the turn restriction combo box model 
+     * 
+     * @return the turn restriction combo box model
+     */
+    public TurnRestrictionComboBoxModel getTurnRestrictionComboBoxModel() {
+        return (TurnRestrictionComboBoxModel)getModel();
+    }
+    
+    /**
+     * Initializes the set of icons used from the preference key
+     * {@see PreferenceKeys#ROAD_SIGNS}.
+     * 
+     * @param prefs the JOSM preferences 
+     */
+    public void initIconSetFromPreferences(Preferences prefs){
+        TurnRestrictionTypeRenderer renderer = (TurnRestrictionTypeRenderer)getRenderer();
+        renderer.initIconSetFromPreferences(prefs);
+        repaint();
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionComboBoxModel.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionComboBoxModel.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionComboBoxModel.java	(revision 23192)
@@ -21,101 +21,101 @@
  */
 public class TurnRestrictionComboBoxModel implements ComboBoxModel, Observer{
-	static private final Logger logger = Logger.getLogger(TurnRestrictionComboBoxModel.class.getName());
-	
-	private TurnRestrictionEditorModel model;
-	final private List<Object> values = new ArrayList<Object>();
-	private String selectedTagValue = null;
-	private final transient EventListenerList listeners = new EventListenerList();
-	
-	/**
-	 * Populates the model with the list of standard values. If the
-	 * data contains a non-standard value it is displayed in the combo
-	 * box as an additional element. 
-	 */
-	protected void populate() {
-		values.clear();
-		for (TurnRestrictionType type: TurnRestrictionType.values()) {
-			values.add(type);
-		}		
-		
-		String tagValue = model.getRestrictionTagValue();
-		if (tagValue.trim().equals("")) {
-			selectedTagValue = null;
-		} else {
-			TurnRestrictionType type = TurnRestrictionType.fromTagValue(tagValue);
-			if (type == null) {
-				values.add(0, tagValue);
-				selectedTagValue = tagValue;
-			} else {
-				selectedTagValue = type.getTagValue();
-			}
-		}
-		fireContentsChanged();
-	}
-	
-	/**
-	 * Creates the combo box model. 
-	 * 
-	 * @param model the turn restriction editor model. Must not be null.
-	 */
-	public TurnRestrictionComboBoxModel(TurnRestrictionEditorModel model){
-		CheckParameterUtil.ensureParameterNotNull(model, "model");
-		this.model = model;
-		model.addObserver(this);
-		populate();
-	}
+    static private final Logger logger = Logger.getLogger(TurnRestrictionComboBoxModel.class.getName());
+    
+    private TurnRestrictionEditorModel model;
+    final private List<Object> values = new ArrayList<Object>();
+    private String selectedTagValue = null;
+    private final transient EventListenerList listeners = new EventListenerList();
+    
+    /**
+     * Populates the model with the list of standard values. If the
+     * data contains a non-standard value it is displayed in the combo
+     * box as an additional element. 
+     */
+    protected void populate() {
+        values.clear();
+        for (TurnRestrictionType type: TurnRestrictionType.values()) {
+            values.add(type);
+        }       
+        
+        String tagValue = model.getRestrictionTagValue();
+        if (tagValue.trim().equals("")) {
+            selectedTagValue = null;
+        } else {
+            TurnRestrictionType type = TurnRestrictionType.fromTagValue(tagValue);
+            if (type == null) {
+                values.add(0, tagValue);
+                selectedTagValue = tagValue;
+            } else {
+                selectedTagValue = type.getTagValue();
+            }
+        }
+        fireContentsChanged();
+    }
+    
+    /**
+     * Creates the combo box model. 
+     * 
+     * @param model the turn restriction editor model. Must not be null.
+     */
+    public TurnRestrictionComboBoxModel(TurnRestrictionEditorModel model){
+        CheckParameterUtil.ensureParameterNotNull(model, "model");
+        this.model = model;
+        model.addObserver(this);
+        populate();
+    }
 
-	public Object getSelectedItem() {
-		TurnRestrictionType type = TurnRestrictionType.fromTagValue(selectedTagValue);
-		if (type != null) return type;
-		return selectedTagValue;
-	}
+    public Object getSelectedItem() {
+        TurnRestrictionType type = TurnRestrictionType.fromTagValue(selectedTagValue);
+        if (type != null) return type;
+        return selectedTagValue;
+    }
 
-	public void setSelectedItem(Object anItem) {
-		String tagValue = null;
-		if (anItem instanceof String) {
-			tagValue = (String)anItem;
-		} else if (anItem instanceof TurnRestrictionType){
-			tagValue = ((TurnRestrictionType)anItem).getTagValue();
-		}
-		model.setRestrictionTagValue(tagValue);
-	}
+    public void setSelectedItem(Object anItem) {
+        String tagValue = null;
+        if (anItem instanceof String) {
+            tagValue = (String)anItem;
+        } else if (anItem instanceof TurnRestrictionType){
+            tagValue = ((TurnRestrictionType)anItem).getTagValue();
+        }
+        model.setRestrictionTagValue(tagValue);
+    }
 
-	public Object getElementAt(int index) {
-		return values.get(index);
-	}
+    public Object getElementAt(int index) {
+        return values.get(index);
+    }
 
-	public int getSize() {
-		return values.size();
-	}
-	
-	public void addListDataListener(ListDataListener l) {
-		listeners.add(ListDataListener.class, l);		
-	}
-	
-	public void removeListDataListener(ListDataListener l) {
-		listeners.remove(ListDataListener.class, l);		
-	}
-	
-	protected void fireContentsChanged() {
-		for(ListDataListener l: listeners.getListeners(ListDataListener.class)) {
-			l.contentsChanged(new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, 0, getSize()));
-		}
-	}
-	
-	/* ------------------------------------------------------------------------------------ */
-	/* interface Observer                                                                   */
-	/* ------------------------------------------------------------------------------------ */
-	public void update(Observable o, Object arg) {		
-		String tagValue = model.getRestrictionTagValue();
-		if (tagValue == null && selectedTagValue != null) {
-			populate();
-		} else if (tagValue != null && selectedTagValue == null){
-			populate();
-		} else if (tagValue != null) {
-			if (!tagValue.equals(selectedTagValue)) {
-				populate();
-			}
-		} 
-	}
+    public int getSize() {
+        return values.size();
+    }
+    
+    public void addListDataListener(ListDataListener l) {
+        listeners.add(ListDataListener.class, l);       
+    }
+    
+    public void removeListDataListener(ListDataListener l) {
+        listeners.remove(ListDataListener.class, l);        
+    }
+    
+    protected void fireContentsChanged() {
+        for(ListDataListener l: listeners.getListeners(ListDataListener.class)) {
+            l.contentsChanged(new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, 0, getSize()));
+        }
+    }
+    
+    /* ------------------------------------------------------------------------------------ */
+    /* interface Observer                                                                   */
+    /* ------------------------------------------------------------------------------------ */
+    public void update(Observable o, Object arg) {      
+        String tagValue = model.getRestrictionTagValue();
+        if (tagValue == null && selectedTagValue != null) {
+            populate();
+        } else if (tagValue != null && selectedTagValue == null){
+            populate();
+        } else if (tagValue != null) {
+            if (!tagValue.equals(selectedTagValue)) {
+                populate();
+            }
+        } 
+    }
 }
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 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditor.java	(revision 23192)
@@ -58,6 +58,6 @@
 
 public class TurnRestrictionEditor extends JDialog implements NavigationControler{
-	final private static Logger logger = Logger.getLogger(TurnRestrictionEditor.class.getName());
-	
+    final private static Logger logger = Logger.getLogger(TurnRestrictionEditor.class.getName());
+    
     /** the property name for the current turn restriction
      * @see #setRelation(Relation)
@@ -84,5 +84,5 @@
     /** the data layer the turn restriction belongs to */
     private OsmDataLayer layer;
-	
+    
     private JosmSelectionPanel pnlJosmSelection;
     private BasicEditorPanel pnlBasicEditor;
@@ -114,6 +114,6 @@
      */
     protected JPanel buildJOSMSelectionPanel() {
-    	pnlJosmSelection = new JosmSelectionPanel(layer);
-    	return pnlJosmSelection;
+        pnlJosmSelection = new JosmSelectionPanel(layer);
+        return pnlJosmSelection;
     }
     
@@ -125,23 +125,23 @@
      */
     protected JPanel buildEditorPanel() {
-    	JPanel pnl = new JPanel(new BorderLayout());
-    	tpEditors = new JTabbedPane();
-    	JScrollPane pane = new JScrollPane(pnlBasicEditor =new BasicEditorPanel(editorModel));
-    	pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
-    	pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
-    	tpEditors.add(pane);
-    	tpEditors.setTitleAt(0, tr("Basic"));
-    	tpEditors.setToolTipTextAt(0, tr("Edit basic attributes of a turn restriction"));
-    	
-    	tpEditors.add(pnlAdvancedEditor = new AdvancedEditorPanel(editorModel));
-    	tpEditors.setTitleAt(1, tr("Advanced"));
-    	tpEditors.setToolTipTextAt(1, tr("Edit the raw tags and members of this turn restriction"));
-    	
-    	tpEditors.add(pnlIssuesView = new IssuesView(editorModel.getIssuesModel()));
-    	tpEditors.setTitleAt(2, tr("Errors/Warnings"));
-    	tpEditors.setToolTipTextAt(2, tr("Show errors and warnings related to this turn restriction"));
-    	
-    	pnl.add(tpEditors, BorderLayout.CENTER);
-    	return pnl;
+        JPanel pnl = new JPanel(new BorderLayout());
+        tpEditors = new JTabbedPane();
+        JScrollPane pane = new JScrollPane(pnlBasicEditor =new BasicEditorPanel(editorModel));
+        pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+        pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
+        tpEditors.add(pane);
+        tpEditors.setTitleAt(0, tr("Basic"));
+        tpEditors.setToolTipTextAt(0, tr("Edit basic attributes of a turn restriction"));
+        
+        tpEditors.add(pnlAdvancedEditor = new AdvancedEditorPanel(editorModel));
+        tpEditors.setTitleAt(1, tr("Advanced"));
+        tpEditors.setToolTipTextAt(1, tr("Edit the raw tags and members of this turn restriction"));
+        
+        tpEditors.add(pnlIssuesView = new IssuesView(editorModel.getIssuesModel()));
+        tpEditors.setTitleAt(2, tr("Errors/Warnings"));
+        tpEditors.setToolTipTextAt(2, tr("Show errors and warnings related to this turn restriction"));
+        
+        pnl.add(tpEditors, BorderLayout.CENTER);
+        return pnl;
     }
     
@@ -153,9 +153,9 @@
      */
     protected JPanel buildContentPanel() {
-    	JPanel pnl = new JPanel(new BorderLayout());
-    	final JSplitPane sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
-    	pnl.add(sp, BorderLayout.CENTER);
-    	sp.setLeftComponent(buildEditorPanel());
-    	sp.setRightComponent(buildJOSMSelectionPanel());
+        JPanel pnl = new JPanel(new BorderLayout());
+        final JSplitPane sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
+        pnl.add(sp, BorderLayout.CENTER);
+        sp.setLeftComponent(buildEditorPanel());
+        sp.setRightComponent(buildJOSMSelectionPanel());
         addWindowListener(new WindowAdapter() {
             @Override
@@ -167,5 +167,5 @@
         });
 
-    	return pnl;
+        return pnl;
     }
     
@@ -197,17 +197,17 @@
      * builds the UI
      */
-    protected void build() {    	
-    	editorModel = new TurnRestrictionEditorModel(getLayer(), this);
-    	Container c = getContentPane();
-    	c.setLayout(new BorderLayout());
-    	c.add(buildToolBar(), BorderLayout.NORTH);
-    	c.add(buildContentPanel(), BorderLayout.CENTER);    	
-    	c.add(buildOkCancelButtonPanel(), BorderLayout.SOUTH);
-    	
-    	editorModel.getIssuesModel().addObserver(new IssuesModelObserver());
-    	setSize(600,600);    	
+    protected void build() {        
+        editorModel = new TurnRestrictionEditorModel(getLayer(), this);
+        Container c = getContentPane();
+        c.setLayout(new BorderLayout());
+        c.add(buildToolBar(), BorderLayout.NORTH);
+        c.add(buildContentPanel(), BorderLayout.CENTER);        
+        c.add(buildOkCancelButtonPanel(), BorderLayout.SOUTH);
+        
+        editorModel.getIssuesModel().addObserver(new IssuesModelObserver());
+        setSize(600,600);       
     }    
-	
-	/**
+    
+    /**
     * Creates a new turn restriction editor
     *
@@ -216,9 +216,9 @@
     * @throws IllegalArgumentException thrown if layer is null
     */
-	public TurnRestrictionEditor(Component owner, OsmDataLayer layer) {
-		this(owner, layer, null);
-	}
-	
-	 /**
+    public TurnRestrictionEditor(Component owner, OsmDataLayer layer) {
+        this(owner, layer, null);
+    }
+    
+     /**
      * Creates a new turn restriction editor
      *
@@ -229,5 +229,5 @@
      */
     public TurnRestrictionEditor(Component owner, OsmDataLayer layer, Relation turnRestriction)  throws IllegalArgumentException{
-    	super(JOptionPane.getFrameForComponent(owner),false /* not modal */);
+        super(JOptionPane.getFrameForComponent(owner),false /* not modal */);
         CheckParameterUtil.ensureParameterNotNull(layer, "layer");
         this.layer = layer;
@@ -260,9 +260,9 @@
     protected void setTurnRestriction(Relation turnRestriction) {      
         if (turnRestriction == null) {
-        	editorModel.populate(new Relation());
+            editorModel.populate(new Relation());
         } else if (turnRestriction.getDataSet() == null || turnRestriction.getDataSet() == getLayer().data) {
-        	editorModel.populate(turnRestriction);
+            editorModel.populate(turnRestriction);
         } else {
-        	throw new IllegalArgumentException(MessageFormat.format("turnRestriction must belong to layer ''{0}''", getLayer().getName()));
+            throw new IllegalArgumentException(MessageFormat.format("turnRestriction must belong to layer ''{0}''", getLayer().getName()));
         }
         setTurnRestrictionSnapshot(turnRestriction == null ? null : new Relation(turnRestriction));
@@ -332,22 +332,22 @@
      */
     public TurnRestrictionEditorModel getModel() {
-    	return editorModel;
+        return editorModel;
     }
     
     public void setVisible(boolean visible) {
-    	if (visible && ! isVisible()) {
-    		pnlJosmSelection.wireListeners();
-    		editorModel.registerAsEventListener();
-        	Main.pref.addPreferenceChangeListener(this.preferenceChangeHandler = new PreferenceChangeHandler());
-        	pnlBasicEditor.initIconSetFromPreferences(Main.pref);
-    	} else if (!visible && isVisible()) {
-    		pnlJosmSelection.unwireListeners();
-    		editorModel.unregisterAsEventListener();
-    		Main.pref.removePreferenceChangeListener(preferenceChangeHandler);
-    	}
-    	super.setVisible(visible);
-    	if (!visible){
-    		dispose();
-    	}
+        if (visible && ! isVisible()) {
+            pnlJosmSelection.wireListeners();
+            editorModel.registerAsEventListener();
+            Main.pref.addPreferenceChangeListener(this.preferenceChangeHandler = new PreferenceChangeHandler());
+            pnlBasicEditor.initIconSetFromPreferences(Main.pref);
+        } else if (!visible && isVisible()) {
+            pnlJosmSelection.unwireListeners();
+            editorModel.unregisterAsEventListener();
+            Main.pref.removePreferenceChangeListener(preferenceChangeHandler);
+        }
+        super.setVisible(visible);
+        if (!visible){
+            dispose();
+        }
     }
     
@@ -371,163 +371,163 @@
     /* ----------------------------------------------------------------------- */
     public void gotoBasicEditor() {
-    	tpEditors.setSelectedIndex(0);
-	}
+        tpEditors.setSelectedIndex(0);
+    }
 
     public void gotoAdvancedEditor() {
-    	tpEditors.setSelectedIndex(1);
-	}
-
-	public void gotoBasicEditor(BasicEditorFokusTargets focusTarget) {
-		tpEditors.setSelectedIndex(0);
-		pnlBasicEditor.requestFocusFor(focusTarget);
-	}
-
-	/**
+        tpEditors.setSelectedIndex(1);
+    }
+
+    public void gotoBasicEditor(BasicEditorFokusTargets focusTarget) {
+        tpEditors.setSelectedIndex(0);
+        pnlBasicEditor.requestFocusFor(focusTarget);
+    }
+
+    /**
      * The abstract base action for applying the updates of a turn restriction
      * to the dataset.
      */
-    abstract class SavingAction extends AbstractAction {    	
-    	protected boolean confirmSaveDespiteOfErrorsAndWarnings(){
-    		int numErrors = editorModel.getIssuesModel().getNumErrors();
-    		int numWarnings = editorModel.getIssuesModel().getNumWarnings();
-    		if (numErrors + numWarnings == 0) return true;
-    		
-    		StringBuffer sb = new StringBuffer();
-    		sb.append("<html>");
-    		sb.append(trn(
-				"There is still an unresolved error or warning identified for this turn restriction. "
-    				+ "You are recommended to resolve this issue first.",
-				  "There are still {0} errors and/or warnings identified for this turn restriction. "
-    				+ "You are recommended to resolve these issues first.",
-				  numErrors + numWarnings,
-				  numErrors + numWarnings
-    		));
-    		sb.append("<br>");
-    		sb.append(tr("Do you want to save anyway?"));
-    		ButtonSpec[] options = new ButtonSpec[] {
-    				new ButtonSpec(
-    						tr("Yes, save anyway"),
-    						ImageProvider.get("ok"),
-    						tr("Save the turn restriction despite of errors and/or warnings"),
-    						null // no specific help topic
-    				),
-    				new ButtonSpec(
-    						tr("No, resolve issues first"),
-    						ImageProvider.get("cancel"),
-    						tr("Cancel saving and start resolving pending issues first"),
-    						null // no specific help topic
-    				)
-    		};
-    		
-    		int ret = HelpAwareOptionPane.showOptionDialog(
-    				JOptionPane.getFrameForComponent(TurnRestrictionEditor.this),
-    				sb.toString(),
-    				tr("Pending errors and warnings"),
-    				JOptionPane.WARNING_MESSAGE,
-    				null, // no special icon
-    				options,
-    				options[1], // cancel is default operation
-    				HelpUtil.ht("/Plugins/turnrestrictions#PendingErrorsAndWarnings")
-    		);
-    		return ret == 0 /* OK */;    		
-    	}
-    	
-    	/**
-    	 * Replies the list of relation members in {@code r} which refer to
-    	 * a deleted or invisible primitives.
-    	 * 
-    	 * @param r the relation 
-    	 * @return the list of relation members in {@code r} which refer to
-    	 * a deleted or invisible member
-    	 */
-    	protected List<RelationMember> getDeletedRelationMembers(Relation r) {
-    		List<RelationMember> ret = new ArrayList<RelationMember>();
-    		for(RelationMember rm: r.getMembers()) {
-    			if (rm.getMember().isDeleted() || !rm.getMember().isVisible()) {
-    				ret.add(rm);
-    			}
-    		}
-    		return ret;
-    	}
-    	
-    	/**
-    	 * Removes all members referring to deleted or invisible primitives
-    	 * from the turn restriction {@code tr}.
-    	 * 
-    	 * @param tr  the turn restriction
-    	 */
-    	protected void removeDeletedMembers(Relation tr) {
-    		List<RelationMember> members = tr.getMembers();
-    		for(Iterator<RelationMember> it = members.iterator(); it.hasNext();) {
-    			RelationMember rm = it.next();
-    			if (rm.getMember().isDeleted() || !rm.getMember().isVisible()) {
-    				it.remove();
-    			}
-    		}
-    		tr.setMembers(members);
-    	}
-    	
-    	/**
-    	 * Asks the user how to proceed if a turn restriction refers to deleted or invisible
-    	 * primitives.
-    	 * 
-    	 * If this method returns true the respective members should be removed and the turn
-    	 * restriction should be saved anyway. If it replies false, the turn restriction must not
-    	 * be saved.  
-    	 * 
-    	 * @param deletedMembers the list of members referring to deleted or invisible primitives  
-    	 * @return the confirmation 
-    	 */
-    	protected boolean confirmSaveTurnRestrictionWithDeletePrimitives(List<RelationMember> deletedMembers) {    		    		
-    		StringBuffer sb = new StringBuffer();
-    		sb.append("<html>");
-    		sb.append(trn("This turn restriction refers to an object which was deleted outside "
-    		           + "of this turn restriction editor:",
-    		           "This turn restriction refers to {0} which were deleted outside "
-    		           + "of this turn restriction editor:", deletedMembers.size(), deletedMembers.size()));
-    		sb.append("<ul>");
-    		for(RelationMember rm: deletedMembers){
-    			sb.append("<li>");
-    			if (!rm.getRole().equals("")) {
-    				sb.append(rm.getRole()).append(": ");
-    			}
-    			sb.append(rm.getMember().getDisplayName(DefaultNameFormatter.getInstance()));
-    			sb.append("</li>");
-    		}
-    		sb.append(tr("Updates to this turn restriction can''t be saved unless deleted members are removed.<br>"
-    				+ "How to you want to proceed?"));
-    		
-    		ButtonSpec[] options = new ButtonSpec[] {
-    				new ButtonSpec(
-    					tr("Remove deleted members and save"),
-    					ImageProvider.get("OK"),
-    					tr("Remove deleted members and save"),
-    					null
-    			     ),
-     				  new ButtonSpec(
-        					tr("Cancel and return to editor"),
-        					ImageProvider.get("cancel"),
-        					tr("Cancel and return to editor"),
-        					null
-        			   )
-    		};
-    		
-    		int ret = HelpAwareOptionPane.showOptionDialog(
-    				TurnRestrictionEditor.this,
-    				sb.toString(),
-    				tr("Deleted members in turn restriction"),
-    				JOptionPane.WARNING_MESSAGE,
-    				null, // no special icon
-    				options,
-    				options[1], // cancel is default
-    				null // FIXME: provide help topic
-    		);    		
-    		return ret == 0 /* OK button */; 
-    	}
-    	
+    abstract class SavingAction extends AbstractAction {        
+        protected boolean confirmSaveDespiteOfErrorsAndWarnings(){
+            int numErrors = editorModel.getIssuesModel().getNumErrors();
+            int numWarnings = editorModel.getIssuesModel().getNumWarnings();
+            if (numErrors + numWarnings == 0) return true;
+            
+            StringBuffer sb = new StringBuffer();
+            sb.append("<html>");
+            sb.append(trn(
+                "There is still an unresolved error or warning identified for this turn restriction. "
+                    + "You are recommended to resolve this issue first.",
+                  "There are still {0} errors and/or warnings identified for this turn restriction. "
+                    + "You are recommended to resolve these issues first.",
+                  numErrors + numWarnings,
+                  numErrors + numWarnings
+            ));
+            sb.append("<br>");
+            sb.append(tr("Do you want to save anyway?"));
+            ButtonSpec[] options = new ButtonSpec[] {
+                    new ButtonSpec(
+                            tr("Yes, save anyway"),
+                            ImageProvider.get("ok"),
+                            tr("Save the turn restriction despite of errors and/or warnings"),
+                            null // no specific help topic
+                    ),
+                    new ButtonSpec(
+                            tr("No, resolve issues first"),
+                            ImageProvider.get("cancel"),
+                            tr("Cancel saving and start resolving pending issues first"),
+                            null // no specific help topic
+                    )
+            };
+            
+            int ret = HelpAwareOptionPane.showOptionDialog(
+                    JOptionPane.getFrameForComponent(TurnRestrictionEditor.this),
+                    sb.toString(),
+                    tr("Pending errors and warnings"),
+                    JOptionPane.WARNING_MESSAGE,
+                    null, // no special icon
+                    options,
+                    options[1], // cancel is default operation
+                    HelpUtil.ht("/Plugins/turnrestrictions#PendingErrorsAndWarnings")
+            );
+            return ret == 0 /* OK */;           
+        }
+        
+        /**
+         * Replies the list of relation members in {@code r} which refer to
+         * a deleted or invisible primitives.
+         * 
+         * @param r the relation 
+         * @return the list of relation members in {@code r} which refer to
+         * a deleted or invisible member
+         */
+        protected List<RelationMember> getDeletedRelationMembers(Relation r) {
+            List<RelationMember> ret = new ArrayList<RelationMember>();
+            for(RelationMember rm: r.getMembers()) {
+                if (rm.getMember().isDeleted() || !rm.getMember().isVisible()) {
+                    ret.add(rm);
+                }
+            }
+            return ret;
+        }
+        
+        /**
+         * Removes all members referring to deleted or invisible primitives
+         * from the turn restriction {@code tr}.
+         * 
+         * @param tr  the turn restriction
+         */
+        protected void removeDeletedMembers(Relation tr) {
+            List<RelationMember> members = tr.getMembers();
+            for(Iterator<RelationMember> it = members.iterator(); it.hasNext();) {
+                RelationMember rm = it.next();
+                if (rm.getMember().isDeleted() || !rm.getMember().isVisible()) {
+                    it.remove();
+                }
+            }
+            tr.setMembers(members);
+        }
+        
+        /**
+         * Asks the user how to proceed if a turn restriction refers to deleted or invisible
+         * primitives.
+         * 
+         * If this method returns true the respective members should be removed and the turn
+         * restriction should be saved anyway. If it replies false, the turn restriction must not
+         * be saved.  
+         * 
+         * @param deletedMembers the list of members referring to deleted or invisible primitives  
+         * @return the confirmation 
+         */
+        protected boolean confirmSaveTurnRestrictionWithDeletePrimitives(List<RelationMember> deletedMembers) {                     
+            StringBuffer sb = new StringBuffer();
+            sb.append("<html>");
+            sb.append(trn("This turn restriction refers to an object which was deleted outside "
+                       + "of this turn restriction editor:",
+                       "This turn restriction refers to {0} which were deleted outside "
+                       + "of this turn restriction editor:", deletedMembers.size(), deletedMembers.size()));
+            sb.append("<ul>");
+            for(RelationMember rm: deletedMembers){
+                sb.append("<li>");
+                if (!rm.getRole().equals("")) {
+                    sb.append(rm.getRole()).append(": ");
+                }
+                sb.append(rm.getMember().getDisplayName(DefaultNameFormatter.getInstance()));
+                sb.append("</li>");
+            }
+            sb.append(tr("Updates to this turn restriction can''t be saved unless deleted members are removed.<br>"
+                    + "How to you want to proceed?"));
+            
+            ButtonSpec[] options = new ButtonSpec[] {
+                    new ButtonSpec(
+                        tr("Remove deleted members and save"),
+                        ImageProvider.get("OK"),
+                        tr("Remove deleted members and save"),
+                        null
+                     ),
+                      new ButtonSpec(
+                            tr("Cancel and return to editor"),
+                            ImageProvider.get("cancel"),
+                            tr("Cancel and return to editor"),
+                            null
+                       )
+            };
+            
+            int ret = HelpAwareOptionPane.showOptionDialog(
+                    TurnRestrictionEditor.this,
+                    sb.toString(),
+                    tr("Deleted members in turn restriction"),
+                    JOptionPane.WARNING_MESSAGE,
+                    null, // no special icon
+                    options,
+                    options[1], // cancel is default
+                    null // FIXME: provide help topic
+            );          
+            return ret == 0 /* OK button */; 
+        }
+        
         /**
          * apply updates to a new turn restriction
          */
-        protected boolean applyNewTurnRestriction() {        	
+        protected boolean applyNewTurnRestriction() {           
             Relation newTurnRestriction = new Relation();
             editorModel.apply(newTurnRestriction);
@@ -541,8 +541,8 @@
             List<RelationMember> deletedMembers = getDeletedRelationMembers(newTurnRestriction);
             if (!deletedMembers.isEmpty()) {
-            	if (!confirmSaveTurnRestrictionWithDeletePrimitives(deletedMembers)) {
-            		return false;
-            	}
-            	removeDeletedMembers(newTurnRestriction);
+                if (!confirmSaveTurnRestrictionWithDeletePrimitives(deletedMembers)) {
+                    return false;
+                }
+                removeDeletedMembers(newTurnRestriction);
             }
             
@@ -576,12 +576,12 @@
          * outside of the turn restriction editor.
          */
-        protected void applyExistingNonConflictingTurnRestriction() {        	
+        protected void applyExistingNonConflictingTurnRestriction() {           
             if (getTurnRestriction().getDataSet() == null) {
-            	editorModel.apply(getTurnRestriction());
-            	Main.main.undoRedo.add(new AddCommand(getTurnRestriction()));
+                editorModel.apply(getTurnRestriction());
+                Main.main.undoRedo.add(new AddCommand(getTurnRestriction()));
             } else {
-            	Relation toUpdate = new Relation(getTurnRestriction());
+                Relation toUpdate = new Relation(getTurnRestriction());
                 editorModel.apply(toUpdate);            
-            	Main.main.undoRedo.add(new ChangeCommand(getTurnRestriction(), toUpdate));
+                Main.main.undoRedo.add(new ChangeCommand(getTurnRestriction(), toUpdate));
             }
             // this will refresh the snapshot and update the dialog title
@@ -646,8 +646,8 @@
 
         public void run() {
-        	if (!confirmSaveDespiteOfErrorsAndWarnings()){
-        		tpEditors.setSelectedIndex(2); // show the errors and warnings
-        		return;
-        	}
+            if (!confirmSaveDespiteOfErrorsAndWarnings()){
+                tpEditors.setSelectedIndex(2); // show the errors and warnings
+                return;
+            }
             if (getTurnRestriction() == null) {
                 applyNewTurnRestriction();
@@ -658,6 +658,6 @@
             editorModel.apply(toUpdate);
             if (TurnRestrictionEditorModel.hasSameMembersAndTags(toUpdate, getTurnRestriction()))
-            	// nothing to update 
-            	return;
+                // nothing to update 
+                return;
             
             if (isDirtyTurnRestriction()) {
@@ -689,12 +689,12 @@
 
         public void run() {
-        	if (!confirmSaveDespiteOfErrorsAndWarnings()){
-        		tpEditors.setSelectedIndex(2); // show the errors and warnings
-        		return;
-        	}
+            if (!confirmSaveDespiteOfErrorsAndWarnings()){
+                tpEditors.setSelectedIndex(2); // show the errors and warnings
+                return;
+            }
             if (getTurnRestriction() == null) {
-            	// it's a new turn restriction. Try to save it and close the dialog
+                // it's a new turn restriction. Try to save it and close the dialog
                 if (applyNewTurnRestriction()) {
-                	setVisible(false);
+                    setVisible(false);
                 }
                 return;
@@ -704,12 +704,12 @@
             editorModel.apply(toUpdate);
             if (TurnRestrictionEditorModel.hasSameMembersAndTags(toUpdate, getTurnRestriction())){
-            	// nothing to update 
-            	setVisible(false);
-            	return;
+                // nothing to update 
+                setVisible(false);
+                return;
             }
             
             if (isDirtyTurnRestriction()) {
-            	// the turn restriction this editor is working on has changed outside
-            	// of the editor. 
+                // the turn restriction this editor is working on has changed outside
+                // of the editor. 
                 if (confirmClosingBecauseOfDirtyState()) {
                     if (getLayer().getConflicts().hasConflictForMy(getTurnRestriction())) {
@@ -750,117 +750,117 @@
     
     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(
+        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();
-			}
-		}
+            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();
-			}
-		}
+        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();
-			}
-		}
+        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();
+            }
+        }
     }
     
     class IssuesModelObserver implements Observer {
-		public void update(Observable o, Object arg) {
-			int numWarnings = editorModel.getIssuesModel().getNumWarnings();
-			int numErrors = editorModel.getIssuesModel().getNumErrors();
-			String warningText = null;
-			if (numWarnings > 0){
-				warningText = trn("{0} warning", "{0} warnings", numWarnings, numWarnings);
-			}
-			String errorText = null;
-			if (numErrors > 0){
-				errorText = trn("{0} error", "{0} errors", numErrors, numErrors);
-			}
-			String title = "";
-			if (errorText != null) {
-				title += errorText;
-			}
-			if (warningText != null){
-				if (title.length() > 0){
-					title += "/";
-				}
-				title += warningText;
-			}
-			if (title.length() == 0){
-				title = tr("no issues");
-			}
-			tpEditors.setTitleAt(2, title);
-			tpEditors.setEnabledAt(2, numWarnings + numErrors > 0);
-		}    	
+        public void update(Observable o, Object arg) {
+            int numWarnings = editorModel.getIssuesModel().getNumWarnings();
+            int numErrors = editorModel.getIssuesModel().getNumErrors();
+            String warningText = null;
+            if (numWarnings > 0){
+                warningText = trn("{0} warning", "{0} warnings", numWarnings, numWarnings);
+            }
+            String errorText = null;
+            if (numErrors > 0){
+                errorText = trn("{0} error", "{0} errors", numErrors, numErrors);
+            }
+            String title = "";
+            if (errorText != null) {
+                title += errorText;
+            }
+            if (warningText != null){
+                if (title.length() > 0){
+                    title += "/";
+                }
+                title += warningText;
+            }
+            if (title.length() == 0){
+                title = tr("no issues");
+            }
+            tpEditors.setTitleAt(2, title);
+            tpEditors.setEnabledAt(2, numWarnings + numErrors > 0);
+        }       
     }
     
@@ -874,16 +874,16 @@
      *
      */
-    class PreferenceChangeHandler implements PreferenceChangedListener {    	
-    	public void refreshIconSet() {
-    		pnlBasicEditor.initIconSetFromPreferences(Main.pref);
-    	}
-    	
-		public void preferenceChanged(PreferenceChangeEvent evt) {			
-			if (evt.getKey().equals(PreferenceKeys.ROAD_SIGNS)){
-				refreshIconSet();
-			} else if (evt.getKey().equals(PreferenceKeys.SHOW_VIAS_IN_BASIC_EDITOR)) {
-				pnlBasicEditor.initViasVisibilityFromPreferences(Main.pref);
-			}			
-		}
+    class PreferenceChangeHandler implements PreferenceChangedListener {        
+        public void refreshIconSet() {
+            pnlBasicEditor.initIconSetFromPreferences(Main.pref);
+        }
+        
+        public void preferenceChanged(PreferenceChangeEvent evt) {          
+            if (evt.getKey().equals(PreferenceKeys.ROAD_SIGNS)){
+                refreshIconSet();
+            } else if (evt.getKey().equals(PreferenceKeys.SHOW_VIAS_IN_BASIC_EDITOR)) {
+                pnlBasicEditor.initViasVisibilityFromPreferences(Main.pref);
+            }           
+        }
     }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditorManager.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditorManager.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditorManager.java	(revision 23192)
@@ -23,5 +23,5 @@
  */
 public class TurnRestrictionEditorManager extends WindowAdapter implements MapView.LayerChangeListener{
-	static private final Logger logger = Logger.getLogger(TurnRestrictionEditorManager.class.getName());
+    static private final Logger logger = Logger.getLogger(TurnRestrictionEditorManager.class.getName());
 
     /** keeps track of open relation editors */
@@ -55,36 +55,36 @@
 
         @Override
-		public int hashCode() {
-			final int prime = 31;
-			int result = 1;
-			result = prime * result + ((layer == null) ? 0 : layer.hashCode());
-			result = prime * result
-					+ ((primitiveId == null) ? 0 : primitiveId.hashCode());
-			return result;
-		}
-
-		@Override
-		public boolean equals(Object obj) {
-			if (this == obj)
-				return true;
-			if (obj == null)
-				return false;
-			if (getClass() != obj.getClass())
-				return false;
-			DialogContext other = (DialogContext) obj;
-			if (layer == null) {
-				if (other.layer != null)
-					return false;
-			} else if (!layer.equals(other.layer))
-				return false;
-			if (primitiveId == null) {
-				if (other.primitiveId != null)
-					return false;
-			} else if (!primitiveId.equals(other.primitiveId))
-				return false;
-			return true;
-		}
-
-		public boolean matchesLayer(OsmDataLayer layer) {
+        public int hashCode() {
+            final int prime = 31;
+            int result = 1;
+            result = prime * result + ((layer == null) ? 0 : layer.hashCode());
+            result = prime * result
+                    + ((primitiveId == null) ? 0 : primitiveId.hashCode());
+            return result;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj)
+                return true;
+            if (obj == null)
+                return false;
+            if (getClass() != obj.getClass())
+                return false;
+            DialogContext other = (DialogContext) obj;
+            if (layer == null) {
+                if (other.layer != null)
+                    return false;
+            } else if (!layer.equals(other.layer))
+                return false;
+            if (primitiveId == null) {
+                if (other.primitiveId != null)
+                    return false;
+            } else if (!primitiveId.equals(other.primitiveId))
+                return false;
+            return true;
+        }
+
+        public boolean matchesLayer(OsmDataLayer layer) {
             if (layer == null) return false;
             return this.layer.equals(layer);
@@ -187,5 +187,5 @@
     @Override
     public void windowClosed(WindowEvent e) {
-    	TurnRestrictionEditor editor = (TurnRestrictionEditor)e.getWindow();
+        TurnRestrictionEditor editor = (TurnRestrictionEditor)e.getWindow();
         DialogContext context = null;
         for (DialogContext c : openDialogs.keySet()) {
@@ -200,5 +200,5 @@
     }
 
-	/**
+    /**
      * Positions an {@see TurnRestrictionEditor} centered on the screen
      *
@@ -286,5 +286,5 @@
             Entry<DialogContext,TurnRestrictionEditor> entry = it.next();
             if (entry.getKey().matchesLayer(dataLayer)) {
-            	TurnRestrictionEditor editor = entry.getValue();
+                TurnRestrictionEditor editor = entry.getValue();
                 it.remove();
                 editor.setVisible(false);
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditorModel.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditorModel.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionEditorModel.java	(revision 23192)
@@ -40,404 +40,404 @@
  */
 public class TurnRestrictionEditorModel extends Observable implements DataSetListener{
-	static private final Logger logger = Logger.getLogger(TurnRestrictionEditorModel.class.getName());
-	
-	/**
-	 * Replies true if {@code tp1} and {@code tp2} have the same tags and
-	 * the same members 
-	 * 
-	 * @param tp1 a turn restriction. Must not be null. 
-	 * @param tp2 a turn restriction . Must not be null.
-	 * @return true if {@code tp1} and {@code tp2} have the same tags and
-	 * the same members
-	 * @throws IllegalArgumentException thrown if {@code tp1} is null
-	 * @throws IllegalArgumentException thrown if {@code tp2} is null
-	 */
-	static public boolean hasSameMembersAndTags(Relation tp1, Relation tp2) throws IllegalArgumentException {
-		CheckParameterUtil.ensureParameterNotNull(tp1, "tp1");
-		CheckParameterUtil.ensureParameterNotNull(tp2, "tp2");
-		if (!TagCollection.from(tp1).asSet().equals(TagCollection.from(tp2).asSet())) return false;
-		if (tp1.getMembersCount() != tp2.getMembersCount()) return false;
-		for(int i=0; i < tp1.getMembersCount();i++){
-			if (!tp1.getMember(i).equals(tp2.getMember(i))) return false;
-		}
-		return true;
-	}
-	
-	private OsmDataLayer layer;
-	private final TagEditorModel tagEditorModel = new TagEditorModel();
-	private  RelationMemberEditorModel memberModel;
-	private  IssuesModel issuesModel;
-	private NavigationControler navigationControler;
-	
-	/**
-	 * Creates a model in the context of a {@see OsmDataLayer}
-	 * 
-	 * @param layer the layer. Must not be null.
-	 * @param navigationControler control to direct the user to specific UI components. Must not be null 
-	 * @throws IllegalArgumentException thrown if {@code layer} is null
-	 */
-	public TurnRestrictionEditorModel(OsmDataLayer layer, NavigationControler navigationControler) throws IllegalArgumentException{
-		CheckParameterUtil.ensureParameterNotNull(layer, "layer");
-		CheckParameterUtil.ensureParameterNotNull(navigationControler, "navigationControler");
-		this.layer = layer;
-		this.navigationControler = navigationControler;
-		memberModel = new RelationMemberEditorModel(layer);
-		memberModel.addTableModelListener(new RelationMemberModelListener());
-		issuesModel = new IssuesModel(this);
-		addObserver(issuesModel);
-		tagEditorModel.addTableModelListener(new TagEditorModelObserver());
-	}
-	
-	/**
-	 * Sets the way participating in the turn restriction in a given role.
-	 * 
-	 * @param role the role. Must not be null.  
-	 * @param way the way which participates in the turn restriction in the respective role.
-	 * null, to remove the way with the given role.
-	 * @exception IllegalArgumentException thrown if role is null
-	 */
-	public void setTurnRestrictionLeg(TurnRestrictionLegRole role, Way way) {
-		CheckParameterUtil.ensureParameterNotNull(role, "role");
-		switch(role){
-		case FROM:
-			memberModel.setFromPrimitive(way);
-			break;
-		case TO:
-			memberModel.setToPrimitive(way);
-			break;
-		}
-	}	
-		
-	/**
-	 * Sets the way participating in the turn restriction in a given role.
-	 * 
-	 * @param role the role. Must not be null.  
-	 * @param wayId the id of the way to set
-	 * @exception IllegalArgumentException thrown if role is null
-	 * @exception IllegalArgumentException thrown if wayId != null isn't the id of a way
-	 * @exception IllegalStateException thrown the no way with this id was found in the dataset 
-	 */
-	public void setTurnRestrictionLeg(TurnRestrictionLegRole role, PrimitiveId wayId) {
-		CheckParameterUtil.ensureParameterNotNull(role, "role");
-		if (wayId == null) {
-			setTurnRestrictionLeg(role, (Way)null);
-			return;
-		}
-		if (!wayId.getType().equals(OsmPrimitiveType.WAY)) {
-			throw new IllegalArgumentException(MessageFormat.format("parameter ''wayId'' of type {0} expected, got {1}", OsmPrimitiveType.WAY, wayId.getType()));
-		}
-
-		OsmPrimitive p = layer.data.getPrimitiveById(wayId);
-		if (p == null) {
-			throw new IllegalStateException(MessageFormat.format("didn''t find way with id {0} in layer ''{1}''", wayId, layer.getName()));			
-		}
-		setTurnRestrictionLeg(role, (Way)p);
-	}	
-	
-	/**
-	 * "Officially" a turn restriction should have exactly one member with 
-	 * role {@see TurnRestrictionLegRole#FROM} and one member with role {@see TurnRestrictionLegRole#TO},
-	 * both referring to an OSM {@see Way}. In order to deals with turn restrictions where these
-	 * integrity constraints are violated, this model also supports relation with multiple or no
-	 * 'from' or 'to' members.
-	 * 
-	 * Replies the turn restriction legs with role {@code role}. If no leg with this
-	 * role exists, an empty set is returned. If multiple legs exists, the set of referred
-	 * primitives is returned.  
-	 * 
-	 * @param role the role. Must not be null.
-	 * @return the set of turn restriction legs with role {@code role}. The empty set, if
-	 * no such turn restriction leg exists
-	 * @throws IllegalArgumentException thrown if role is null
-	 */
-	public Set<OsmPrimitive>getTurnRestrictionLeg(TurnRestrictionLegRole role){
-		CheckParameterUtil.ensureParameterNotNull(role, "role");
-		switch(role){
-		case FROM: return memberModel.getFromPrimitives();
-		case TO: return memberModel.getToPrimitives();
-		}
-		// should not happen
-		return null;
-	}
-	
-	/**
-	 * Initializes the model from a relation representing a turn
-	 * restriction
-	 * 
-	 * @param turnRestriction the turn restriction
-	 */
-	protected void initFromTurnRestriction(Relation turnRestriction) {
-		
-		// populate the member model
-		memberModel.populate(turnRestriction);
-		
-		// make sure we have a restriction tag
-		TagCollection tags = TagCollection.from(turnRestriction);
-		tags.setUniqueForKey("type", "restriction");
-		tagEditorModel.initFromTags(tags);
-				
-		setChanged();
-		notifyObservers();
-	}
-	
-	/**
-	 * Populates the turn restriction editor model with a turn restriction. 
-	 * {@code turnRestriction} is an arbitrary relation. A tag type=restriction
-	 * isn't required. If it is missing, it is added here. {@code turnRestriction}
-	 * must not be null and it must belong to a dataset. 
-	 * 
-	 * @param turnRestriction the turn restriction
-	 * @throws IllegalArgumentException thrown if turnRestriction is null
-	 * @throws IllegalArgumentException thrown if turnRestriction doesn't belong to a dataset  
-	 */
-	public void populate(Relation turnRestriction) {
-		CheckParameterUtil.ensureParameterNotNull(turnRestriction, "turnRestriction");
-		if (turnRestriction.getDataSet() != null && turnRestriction.getDataSet() != layer.data) {			
-			throw new IllegalArgumentException(
-				// don't translate - it's a technical message
-				MessageFormat.format("turnRestriction {0} must not belong to a different dataset than the dataset of layer ''{1}''", turnRestriction.getId(), layer.getName())
-			);
-		}
-		initFromTurnRestriction(turnRestriction);
-	}
-	
-	
-	/**
-	 * Applies the current state in the model to a turn restriction
-	 * 
-	 * @param turnRestriction the turn restriction. Must not be null.
-	 */
-	public void apply(Relation turnRestriction) {
-		CheckParameterUtil.ensureParameterNotNull(turnRestriction, "turnRestriction");		
-		TagCollection tags = tagEditorModel.getTagCollection();
-		turnRestriction.removeAll();
-		tags.applyTo(turnRestriction);
-		memberModel.applyTo(turnRestriction);		
-	}
-	
-	/**
-	 * Replies the current tag value for the tag <tt>restriction</tt>.
-	 * The empty tag, if there isn't a tag <tt>restriction</tt>.  
-	 * 
-	 * @return the tag value
-	 */
-	public String getRestrictionTagValue() {
-		TagCollection tags = tagEditorModel.getTagCollection();
-		if (!tags.hasTagsFor("restriction")) return "";
-		return tags.getJoinedValues("restriction");
-	}
-	
-	/**
-	 * Sets the current value for the restriction tag. If {@code value} is
-	 * null or an empty string, the restriction tag is removed. 
-	 * 
-	 * @param value the value of the restriction tag 
-	 */
-	public void setRestrictionTagValue(String value){
-		if (value == null || value.trim().equals("")) {
-			tagEditorModel.delete("restriction");			
-		} else {
-			TagModel  tm = tagEditorModel.get("restriction");
-			if (tm != null){
-				tm.setValue(value);
-			} else {
-				tagEditorModel.prepend(new TagModel("restriction", value.trim().toLowerCase()));
-			}
-		}
-		setChanged();
-		notifyObservers();
-	}
-	
-	/**
-	 * Replies the list of 'via' objects. The return value is an
-	 * unmodifiable list.
-	 *  
-	 * @return the list of 'via' objects
-	 */
-	public List<OsmPrimitive> getVias() {
-		return memberModel.getVias();
-	}
-	
-	/**
-	 * Sets the list of vias for the edited turn restriction.
-	 * 
-	 * If {@code vias} is null, all vias are removed. All primitives
-	 * in {@code vias} must be assigned to a dataset and the dataset
-	 * must be equal to the dataset of this editor model, see {@see #getDataSet()}
-	 * 
-	 * null values in {@see vias} are skipped. 
-	 * 
-	 * @param vias the list of vias 
-	 * @throws IllegalArgumentException thrown if one of the via objects belongs to the wrong dataset 
-	 */
-	public void setVias(List<OsmPrimitive> vias) throws IllegalArgumentException{
-		memberModel.setVias(vias);
-	}
-	
-	/**
-	 * Replies the layer in whose context this editor is working
-	 * 
-	 * @return the layer in whose context this editor is working
-	 */
-	public OsmDataLayer getLayer() {
-		return layer;
-	}
-	
-	/**
-	 * Registers this model with global event sources like {@see DatasetEventManager}
-	 */
-	public void registerAsEventListener(){
-		DatasetEventManager.getInstance().addDatasetListener(this, FireMode.IN_EDT);
-	}
-	
-	/**
-	 * Removes this model as listener from global event sources like  {@see DatasetEventManager}
-	 */
-	public void unregisterAsEventListener() {
-		DatasetEventManager.getInstance().removeDatasetListener(this);
-	}
-	
-	/**
-	 * Replies the tag  editor model 
-	 * 
-	 * @return the tag  editor model
-	 */
-	public TagEditorModel getTagEditorModel() {
-		return tagEditorModel;
-	}
-	
-	/**
-	 * Replies the editor model for the relation members
-	 * 
-	 * @return the editor model for the relation members
-	 */
-	public RelationMemberEditorModel getRelationMemberEditorModel() {
-		return memberModel;
-	}
-	
-	/**
-	 * Replies the model for the open issues in this turn restriction
-	 * editor.
-	 * 
-	 * @return the model for the open issues in this turn restriction
-	 * editor
-	 */
-	public IssuesModel getIssuesModel() {
-		return issuesModel;
-	}
-	
-	public NavigationControler getNavigationControler() {
-		return navigationControler;
-	}
-	
-	/**
-	 * Replies the current value of the tag "except", or the empty string
-	 * if the tag doesn't exist.
-	 * 
-	 * @return
-	 */
-	public ExceptValueModel getExcept() {
-		TagModel tag = tagEditorModel.get("except");
-		if (tag == null) return new ExceptValueModel("");
-		return new ExceptValueModel(tag.getValue());
-	}
-	
-	/**
-	 * Sets the current value of the tag "except". Removes the
-	 * tag is {@code value} is null or consists of white
-	 * space only. 
-	 * 
-	 * @param value the new value for 'except'
-	 */
-	public void setExcept(ExceptValueModel value){
-		if (value == null || value.getValue().equals("")) {
-			if (tagEditorModel.get("except") != null){
-				tagEditorModel.delete("except");
-				setChanged();
-				notifyObservers();				
-			}
-			return;			
-		}
-		TagModel tag = tagEditorModel.get("except");
-		if (tag == null) {
-			tagEditorModel.prepend(new TagModel("except", value.getValue()));
-			setChanged();
-			notifyObservers();
-		} else {
-			if (!tag.getValue().equals(value.getValue())) {
-				tag.setValue(value.getValue().trim());
-				setChanged();
-				notifyObservers();
-			}
-		}		
-	}
-
-	/* ----------------------------------------------------------------------------------------- */
-	/* interface DataSetListener                                                                 */
-	/* ----------------------------------------------------------------------------------------- */	
-	protected boolean isAffectedByDataSetUpdate(DataSet ds, List<? extends OsmPrimitive> updatedPrimitives) {
-		if (ds != layer.data) return false;
-		if (updatedPrimitives == null || updatedPrimitives.isEmpty()) return false;
-		Set<OsmPrimitive> myPrimitives = memberModel.getMemberPrimitives();
-		int size1 = myPrimitives.size();
-		myPrimitives.retainAll(updatedPrimitives);
-		return size1 != myPrimitives.size();
-	}
-	
-	public void dataChanged(DataChangedEvent event) {
-		// refresh the views
-		setChanged();
-		notifyObservers();		
-	}
-
-	public void nodeMoved(NodeMovedEvent event) {
-		// may affect the display name of node in the list of vias
-		if (isAffectedByDataSetUpdate(event.getDataset(), event.getPrimitives())) {
-			setChanged();
-			notifyObservers();
-		}
-	}
-
-	public void otherDatasetChange(AbstractDatasetChangedEvent event) {/* irrelevant in this context */}
-
-	public void primtivesAdded(PrimitivesAddedEvent event) {/* irrelevant in this context */}
-	public void primtivesRemoved(PrimitivesRemovedEvent event) {
-		// relevant for the state of this model but not handled here. When the 
-		// state of this model is applied to the dataset we check whether the 
-		// the turn restriction refers to deleted or invisible primitives 
-	}
-
-	public void relationMembersChanged(RelationMembersChangedEvent event) {/* irrelevant in this context */}
-	public void tagsChanged(TagsChangedEvent event) {
-		// may affect the display name of 'from', 'to' or 'via' elements
-		if (isAffectedByDataSetUpdate(event.getDataset(), event.getPrimitives())) {
-			setChanged();
-			notifyObservers();
-		}
-	}
-
-	public void wayNodesChanged(WayNodesChangedEvent event) {
-		// may affect the display name of 'from', 'to' or 'via' elements
-		if (isAffectedByDataSetUpdate(event.getDataset(), event.getPrimitives())) {
-			setChanged();
-			notifyObservers();
-		}		
-	}	
-	
-	class RelationMemberModelListener implements TableModelListener {
-		public void tableChanged(TableModelEvent e) {
-			setChanged();
-			notifyObservers();
-		}		
-	}
-
-	/* ----------------------------------------------------------------------------------------- */
-	/* inner classes                                                                             */
-	/* ----------------------------------------------------------------------------------------- */	
-	class TagEditorModelObserver implements TableModelListener {
-		public void tableChanged(TableModelEvent e) {
-			setChanged();
-			notifyObservers();
-		}		
-	}
+    static private final Logger logger = Logger.getLogger(TurnRestrictionEditorModel.class.getName());
+    
+    /**
+     * Replies true if {@code tp1} and {@code tp2} have the same tags and
+     * the same members 
+     * 
+     * @param tp1 a turn restriction. Must not be null. 
+     * @param tp2 a turn restriction . Must not be null.
+     * @return true if {@code tp1} and {@code tp2} have the same tags and
+     * the same members
+     * @throws IllegalArgumentException thrown if {@code tp1} is null
+     * @throws IllegalArgumentException thrown if {@code tp2} is null
+     */
+    static public boolean hasSameMembersAndTags(Relation tp1, Relation tp2) throws IllegalArgumentException {
+        CheckParameterUtil.ensureParameterNotNull(tp1, "tp1");
+        CheckParameterUtil.ensureParameterNotNull(tp2, "tp2");
+        if (!TagCollection.from(tp1).asSet().equals(TagCollection.from(tp2).asSet())) return false;
+        if (tp1.getMembersCount() != tp2.getMembersCount()) return false;
+        for(int i=0; i < tp1.getMembersCount();i++){
+            if (!tp1.getMember(i).equals(tp2.getMember(i))) return false;
+        }
+        return true;
+    }
+    
+    private OsmDataLayer layer;
+    private final TagEditorModel tagEditorModel = new TagEditorModel();
+    private  RelationMemberEditorModel memberModel;
+    private  IssuesModel issuesModel;
+    private NavigationControler navigationControler;
+    
+    /**
+     * Creates a model in the context of a {@see OsmDataLayer}
+     * 
+     * @param layer the layer. Must not be null.
+     * @param navigationControler control to direct the user to specific UI components. Must not be null 
+     * @throws IllegalArgumentException thrown if {@code layer} is null
+     */
+    public TurnRestrictionEditorModel(OsmDataLayer layer, NavigationControler navigationControler) throws IllegalArgumentException{
+        CheckParameterUtil.ensureParameterNotNull(layer, "layer");
+        CheckParameterUtil.ensureParameterNotNull(navigationControler, "navigationControler");
+        this.layer = layer;
+        this.navigationControler = navigationControler;
+        memberModel = new RelationMemberEditorModel(layer);
+        memberModel.addTableModelListener(new RelationMemberModelListener());
+        issuesModel = new IssuesModel(this);
+        addObserver(issuesModel);
+        tagEditorModel.addTableModelListener(new TagEditorModelObserver());
+    }
+    
+    /**
+     * Sets the way participating in the turn restriction in a given role.
+     * 
+     * @param role the role. Must not be null.  
+     * @param way the way which participates in the turn restriction in the respective role.
+     * null, to remove the way with the given role.
+     * @exception IllegalArgumentException thrown if role is null
+     */
+    public void setTurnRestrictionLeg(TurnRestrictionLegRole role, Way way) {
+        CheckParameterUtil.ensureParameterNotNull(role, "role");
+        switch(role){
+        case FROM:
+            memberModel.setFromPrimitive(way);
+            break;
+        case TO:
+            memberModel.setToPrimitive(way);
+            break;
+        }
+    }   
+        
+    /**
+     * Sets the way participating in the turn restriction in a given role.
+     * 
+     * @param role the role. Must not be null.  
+     * @param wayId the id of the way to set
+     * @exception IllegalArgumentException thrown if role is null
+     * @exception IllegalArgumentException thrown if wayId != null isn't the id of a way
+     * @exception IllegalStateException thrown the no way with this id was found in the dataset 
+     */
+    public void setTurnRestrictionLeg(TurnRestrictionLegRole role, PrimitiveId wayId) {
+        CheckParameterUtil.ensureParameterNotNull(role, "role");
+        if (wayId == null) {
+            setTurnRestrictionLeg(role, (Way)null);
+            return;
+        }
+        if (!wayId.getType().equals(OsmPrimitiveType.WAY)) {
+            throw new IllegalArgumentException(MessageFormat.format("parameter ''wayId'' of type {0} expected, got {1}", OsmPrimitiveType.WAY, wayId.getType()));
+        }
+
+        OsmPrimitive p = layer.data.getPrimitiveById(wayId);
+        if (p == null) {
+            throw new IllegalStateException(MessageFormat.format("didn''t find way with id {0} in layer ''{1}''", wayId, layer.getName()));         
+        }
+        setTurnRestrictionLeg(role, (Way)p);
+    }   
+    
+    /**
+     * "Officially" a turn restriction should have exactly one member with 
+     * role {@see TurnRestrictionLegRole#FROM} and one member with role {@see TurnRestrictionLegRole#TO},
+     * both referring to an OSM {@see Way}. In order to deals with turn restrictions where these
+     * integrity constraints are violated, this model also supports relation with multiple or no
+     * 'from' or 'to' members.
+     * 
+     * Replies the turn restriction legs with role {@code role}. If no leg with this
+     * role exists, an empty set is returned. If multiple legs exists, the set of referred
+     * primitives is returned.  
+     * 
+     * @param role the role. Must not be null.
+     * @return the set of turn restriction legs with role {@code role}. The empty set, if
+     * no such turn restriction leg exists
+     * @throws IllegalArgumentException thrown if role is null
+     */
+    public Set<OsmPrimitive>getTurnRestrictionLeg(TurnRestrictionLegRole role){
+        CheckParameterUtil.ensureParameterNotNull(role, "role");
+        switch(role){
+        case FROM: return memberModel.getFromPrimitives();
+        case TO: return memberModel.getToPrimitives();
+        }
+        // should not happen
+        return null;
+    }
+    
+    /**
+     * Initializes the model from a relation representing a turn
+     * restriction
+     * 
+     * @param turnRestriction the turn restriction
+     */
+    protected void initFromTurnRestriction(Relation turnRestriction) {
+        
+        // populate the member model
+        memberModel.populate(turnRestriction);
+        
+        // make sure we have a restriction tag
+        TagCollection tags = TagCollection.from(turnRestriction);
+        tags.setUniqueForKey("type", "restriction");
+        tagEditorModel.initFromTags(tags);
+                
+        setChanged();
+        notifyObservers();
+    }
+    
+    /**
+     * Populates the turn restriction editor model with a turn restriction. 
+     * {@code turnRestriction} is an arbitrary relation. A tag type=restriction
+     * isn't required. If it is missing, it is added here. {@code turnRestriction}
+     * must not be null and it must belong to a dataset. 
+     * 
+     * @param turnRestriction the turn restriction
+     * @throws IllegalArgumentException thrown if turnRestriction is null
+     * @throws IllegalArgumentException thrown if turnRestriction doesn't belong to a dataset  
+     */
+    public void populate(Relation turnRestriction) {
+        CheckParameterUtil.ensureParameterNotNull(turnRestriction, "turnRestriction");
+        if (turnRestriction.getDataSet() != null && turnRestriction.getDataSet() != layer.data) {           
+            throw new IllegalArgumentException(
+                // don't translate - it's a technical message
+                MessageFormat.format("turnRestriction {0} must not belong to a different dataset than the dataset of layer ''{1}''", turnRestriction.getId(), layer.getName())
+            );
+        }
+        initFromTurnRestriction(turnRestriction);
+    }
+    
+    
+    /**
+     * Applies the current state in the model to a turn restriction
+     * 
+     * @param turnRestriction the turn restriction. Must not be null.
+     */
+    public void apply(Relation turnRestriction) {
+        CheckParameterUtil.ensureParameterNotNull(turnRestriction, "turnRestriction");      
+        TagCollection tags = tagEditorModel.getTagCollection();
+        turnRestriction.removeAll();
+        tags.applyTo(turnRestriction);
+        memberModel.applyTo(turnRestriction);       
+    }
+    
+    /**
+     * Replies the current tag value for the tag <tt>restriction</tt>.
+     * The empty tag, if there isn't a tag <tt>restriction</tt>.  
+     * 
+     * @return the tag value
+     */
+    public String getRestrictionTagValue() {
+        TagCollection tags = tagEditorModel.getTagCollection();
+        if (!tags.hasTagsFor("restriction")) return "";
+        return tags.getJoinedValues("restriction");
+    }
+    
+    /**
+     * Sets the current value for the restriction tag. If {@code value} is
+     * null or an empty string, the restriction tag is removed. 
+     * 
+     * @param value the value of the restriction tag 
+     */
+    public void setRestrictionTagValue(String value){
+        if (value == null || value.trim().equals("")) {
+            tagEditorModel.delete("restriction");           
+        } else {
+            TagModel  tm = tagEditorModel.get("restriction");
+            if (tm != null){
+                tm.setValue(value);
+            } else {
+                tagEditorModel.prepend(new TagModel("restriction", value.trim().toLowerCase()));
+            }
+        }
+        setChanged();
+        notifyObservers();
+    }
+    
+    /**
+     * Replies the list of 'via' objects. The return value is an
+     * unmodifiable list.
+     *  
+     * @return the list of 'via' objects
+     */
+    public List<OsmPrimitive> getVias() {
+        return memberModel.getVias();
+    }
+    
+    /**
+     * Sets the list of vias for the edited turn restriction.
+     * 
+     * If {@code vias} is null, all vias are removed. All primitives
+     * in {@code vias} must be assigned to a dataset and the dataset
+     * must be equal to the dataset of this editor model, see {@see #getDataSet()}
+     * 
+     * null values in {@see vias} are skipped. 
+     * 
+     * @param vias the list of vias 
+     * @throws IllegalArgumentException thrown if one of the via objects belongs to the wrong dataset 
+     */
+    public void setVias(List<OsmPrimitive> vias) throws IllegalArgumentException{
+        memberModel.setVias(vias);
+    }
+    
+    /**
+     * Replies the layer in whose context this editor is working
+     * 
+     * @return the layer in whose context this editor is working
+     */
+    public OsmDataLayer getLayer() {
+        return layer;
+    }
+    
+    /**
+     * Registers this model with global event sources like {@see DatasetEventManager}
+     */
+    public void registerAsEventListener(){
+        DatasetEventManager.getInstance().addDatasetListener(this, FireMode.IN_EDT);
+    }
+    
+    /**
+     * Removes this model as listener from global event sources like  {@see DatasetEventManager}
+     */
+    public void unregisterAsEventListener() {
+        DatasetEventManager.getInstance().removeDatasetListener(this);
+    }
+    
+    /**
+     * Replies the tag  editor model 
+     * 
+     * @return the tag  editor model
+     */
+    public TagEditorModel getTagEditorModel() {
+        return tagEditorModel;
+    }
+    
+    /**
+     * Replies the editor model for the relation members
+     * 
+     * @return the editor model for the relation members
+     */
+    public RelationMemberEditorModel getRelationMemberEditorModel() {
+        return memberModel;
+    }
+    
+    /**
+     * Replies the model for the open issues in this turn restriction
+     * editor.
+     * 
+     * @return the model for the open issues in this turn restriction
+     * editor
+     */
+    public IssuesModel getIssuesModel() {
+        return issuesModel;
+    }
+    
+    public NavigationControler getNavigationControler() {
+        return navigationControler;
+    }
+    
+    /**
+     * Replies the current value of the tag "except", or the empty string
+     * if the tag doesn't exist.
+     * 
+     * @return
+     */
+    public ExceptValueModel getExcept() {
+        TagModel tag = tagEditorModel.get("except");
+        if (tag == null) return new ExceptValueModel("");
+        return new ExceptValueModel(tag.getValue());
+    }
+    
+    /**
+     * Sets the current value of the tag "except". Removes the
+     * tag is {@code value} is null or consists of white
+     * space only. 
+     * 
+     * @param value the new value for 'except'
+     */
+    public void setExcept(ExceptValueModel value){
+        if (value == null || value.getValue().equals("")) {
+            if (tagEditorModel.get("except") != null){
+                tagEditorModel.delete("except");
+                setChanged();
+                notifyObservers();              
+            }
+            return;         
+        }
+        TagModel tag = tagEditorModel.get("except");
+        if (tag == null) {
+            tagEditorModel.prepend(new TagModel("except", value.getValue()));
+            setChanged();
+            notifyObservers();
+        } else {
+            if (!tag.getValue().equals(value.getValue())) {
+                tag.setValue(value.getValue().trim());
+                setChanged();
+                notifyObservers();
+            }
+        }       
+    }
+
+    /* ----------------------------------------------------------------------------------------- */
+    /* interface DataSetListener                                                                 */
+    /* ----------------------------------------------------------------------------------------- */ 
+    protected boolean isAffectedByDataSetUpdate(DataSet ds, List<? extends OsmPrimitive> updatedPrimitives) {
+        if (ds != layer.data) return false;
+        if (updatedPrimitives == null || updatedPrimitives.isEmpty()) return false;
+        Set<OsmPrimitive> myPrimitives = memberModel.getMemberPrimitives();
+        int size1 = myPrimitives.size();
+        myPrimitives.retainAll(updatedPrimitives);
+        return size1 != myPrimitives.size();
+    }
+    
+    public void dataChanged(DataChangedEvent event) {
+        // refresh the views
+        setChanged();
+        notifyObservers();      
+    }
+
+    public void nodeMoved(NodeMovedEvent event) {
+        // may affect the display name of node in the list of vias
+        if (isAffectedByDataSetUpdate(event.getDataset(), event.getPrimitives())) {
+            setChanged();
+            notifyObservers();
+        }
+    }
+
+    public void otherDatasetChange(AbstractDatasetChangedEvent event) {/* irrelevant in this context */}
+
+    public void primtivesAdded(PrimitivesAddedEvent event) {/* irrelevant in this context */}
+    public void primtivesRemoved(PrimitivesRemovedEvent event) {
+        // relevant for the state of this model but not handled here. When the 
+        // state of this model is applied to the dataset we check whether the 
+        // the turn restriction refers to deleted or invisible primitives 
+    }
+
+    public void relationMembersChanged(RelationMembersChangedEvent event) {/* irrelevant in this context */}
+    public void tagsChanged(TagsChangedEvent event) {
+        // may affect the display name of 'from', 'to' or 'via' elements
+        if (isAffectedByDataSetUpdate(event.getDataset(), event.getPrimitives())) {
+            setChanged();
+            notifyObservers();
+        }
+    }
+
+    public void wayNodesChanged(WayNodesChangedEvent event) {
+        // may affect the display name of 'from', 'to' or 'via' elements
+        if (isAffectedByDataSetUpdate(event.getDataset(), event.getPrimitives())) {
+            setChanged();
+            notifyObservers();
+        }       
+    }   
+    
+    class RelationMemberModelListener implements TableModelListener {
+        public void tableChanged(TableModelEvent e) {
+            setChanged();
+            notifyObservers();
+        }       
+    }
+
+    /* ----------------------------------------------------------------------------------------- */
+    /* inner classes                                                                             */
+    /* ----------------------------------------------------------------------------------------- */ 
+    class TagEditorModelObserver implements TableModelListener {
+        public void tableChanged(TableModelEvent e) {
+            setChanged();
+            notifyObservers();
+        }       
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegEditor.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegEditor.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegEditor.java	(revision 23192)
@@ -55,314 +55,314 @@
  */
 public class TurnRestrictionLegEditor extends JPanel implements Observer, PrimitiveIdListProvider {
-	static private final Logger logger = Logger.getLogger(TurnRestrictionLegEditor.class.getName());
+    static private final Logger logger = Logger.getLogger(TurnRestrictionLegEditor.class.getName());
  
-	private JLabel lblOsmObject;
-	private final Set<OsmPrimitive> legs = new HashSet<OsmPrimitive>();
-	private TurnRestrictionEditorModel model;
-	private TurnRestrictionLegRole role; 
-	private DeleteAction actDelete;
-	private CopyAction actCopy;
-	private PasteAction actPaste;
-	private TransferHandler transferHandler;
-	
-	/**
-	 * builds the UI 
-	 */
-	protected void build() {
-		setLayout(new BorderLayout());
-		add(lblOsmObject = new JLabel(), BorderLayout.CENTER);		
-		lblOsmObject.setOpaque(true);
-		lblOsmObject.setBorder(null);
-		setBorder(
-				BorderFactory.createCompoundBorder(
-						BorderFactory.createEtchedBorder(),
-						BorderFactory.createEmptyBorder(1,1,1,1)
-				)
-		);
-		
-		JButton btn;
-		actDelete = new DeleteAction();
-		add(btn = new JButton(actDelete), BorderLayout.EAST);
-		btn.setFocusable(false);
-		btn.setText(null);
-		btn.setBorder(BorderFactory.createRaisedBevelBorder());
-				
-		// focus handling
-		FocusHandler fh  = new FocusHandler();
-		lblOsmObject.setFocusable(true);	
-		lblOsmObject.addFocusListener(fh);		
-		this.addFocusListener(fh);
-
-		// mouse event handling
-		MouseEventHandler meh = new MouseEventHandler();
-		lblOsmObject.addMouseListener(meh);
-		addMouseListener(meh);
-		lblOsmObject.addMouseListener(new PopupLauncher());
-		
-		// enable DEL to remove the object from the turn restriction
-		registerKeyboardAction(actDelete,KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,0) , JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
-
-		getInputMap().put(Shortcut.getCopyKeyStroke(), TransferHandler.getCopyAction().getValue(Action.NAME));;
-		getInputMap().put(Shortcut.getPasteKeyStroke(), TransferHandler.getPasteAction().getValue(Action.NAME));;
-		getActionMap().put(TransferHandler.getCopyAction().getValue(Action.NAME), TransferHandler.getCopyAction());
-		getActionMap().put(TransferHandler.getPasteAction().getValue(Action.NAME), TransferHandler.getPasteAction());
-		lblOsmObject.setTransferHandler(transferHandler = new LegEditorTransferHandler(this));
-		lblOsmObject.addMouseMotionListener(new MouseMotionAdapter(){
-			@Override
-			public void mouseDragged(MouseEvent e) {
-				JComponent c = (JComponent)e.getSource();
-				TransferHandler th = c.getTransferHandler();
-				th.exportAsDrag(c, e, TransferHandler.COPY);				
-			}					
-		});
-		actCopy = new CopyAction();
-		actPaste = new PasteAction();
-	}
-	
-	/**
-	 * Constructor 
-	 * 
-	 * @param model the model. Must not be null.
-	 * @param role the leg role of the leg this editor is editing. Must not be null.
-	 * @exception IllegalArgumentException thrown if model is null
-	 * @exception IllegalArgumentException thrown if role is null
-	 */
-	public TurnRestrictionLegEditor(TurnRestrictionEditorModel model, TurnRestrictionLegRole role) {
-		CheckParameterUtil.ensureParameterNotNull(model, "model");
-		CheckParameterUtil.ensureParameterNotNull(role, "role");
-		
-		this.model = model;
-		this.role = role;
-		build();
-		model.addObserver(this);
-		refresh();	
-	}
-
-	protected void refresh(){
-		legs.clear();
-		legs.addAll(model.getTurnRestrictionLeg(role));
-		if (legs.isEmpty()) {
-			lblOsmObject.setFont(UIManager.getFont("Label.font").deriveFont(Font.ITALIC));
-			lblOsmObject.setIcon(null);
-			lblOsmObject.setText(tr("please select a way"));
-			lblOsmObject.setToolTipText(null);
-		} else if (legs.size() == 1){
-			OsmPrimitive leg = legs.iterator().next();
-			lblOsmObject.setFont(UIManager.getFont("Label.font"));
-			lblOsmObject.setIcon(ImageProvider.get("data", "way"));
-			lblOsmObject.setText(leg.getDisplayName(DefaultNameFormatter.getInstance()));
-			lblOsmObject.setToolTipText(DefaultNameFormatter.getInstance().buildDefaultToolTip(leg));
-		} else {
-			lblOsmObject.setFont(UIManager.getFont("Label.font").deriveFont(Font.ITALIC));
-			lblOsmObject.setIcon(null);
-			lblOsmObject.setText(tr("multiple objects with role ''{0}''",this.role.getOsmRole()));
-			lblOsmObject.setToolTipText(null);			
-		}
-		renderColors();
-		actDelete.updateEnabledState();
-	}
-	
-	/**
-	 * Render the foreground and background color
-	 */
-	protected void renderColors() {
-		if (lblOsmObject.hasFocus()) {
-			setBackground(UIManager.getColor("List.selectionBackground"));
-			setForeground(UIManager.getColor("List.selectionForeground"));
-			lblOsmObject.setBackground(UIManager.getColor("List.selectionBackground"));
-			lblOsmObject.setForeground(UIManager.getColor("List.selectionForeground"));
-		} else {
-			lblOsmObject.setBackground(UIManager.getColor("List.background"));
-			lblOsmObject.setForeground(UIManager.getColor("List.foreground"));
-		}
-	}
-	
-	/**
-	 * Replies the model for this editor
-	 * 
-	 * @return the model 
-	 */
-	public TurnRestrictionEditorModel getModel() {
-		return model;
-	}
-	
-	/**
-	 * Replies the role of this editor 
-	 * 
-	 * @return the role 
-	 */
-	public TurnRestrictionLegRole getRole() {
-		return role;
-	}		
-	
-	/* ----------------------------------------------------------------------------- */
-	/* interface Observer                                                            */
-	/* ----------------------------------------------------------------------------- */
-	public void update(Observable o, Object arg) {
-		refresh();		
-	}
-	
-	/* ----------------------------------------------------------------------------- */
-	/* interface PrimitiveIdListProvider                                                            */
-	/* ----------------------------------------------------------------------------- */
-	public List<PrimitiveId> getSelectedPrimitiveIds() {
-		if (legs.size() == 1) {
-			return Collections.singletonList(legs.iterator().next().getPrimitiveId());
-		}
-		return Collections.emptyList();
-	}
-	
-	/* ----------------------------------------------------------------------------- */
-	/* inner classes                                                                 */
-	/* ----------------------------------------------------------------------------- */	
-	/**
-	 * Responds to focus change events  
-	 */
-	class FocusHandler extends FocusAdapter {
-		@Override
-		public void focusGained(FocusEvent e) {
-			renderColors();
-		}
-
-		@Override
-		public void focusLost(FocusEvent e) {
-			renderColors();
-		}		
-	}
-	
-	class MouseEventHandler extends MouseAdapter {
-		@Override
-		public void mouseClicked(MouseEvent e) {
-			lblOsmObject.requestFocusInWindow();
-		}		
-	}
-	
-	/**
-	 * Deletes the way from the turn restriction 
-	 */
-	class DeleteAction extends AbstractAction {
-		public DeleteAction() {
-			putValue(SHORT_DESCRIPTION, tr("Delete from turn restriction"));
-			putValue(NAME, tr("Delete"));
-			putValue(SMALL_ICON, ImageProvider.get("deletesmall"));
-			putValue(ACCELERATOR_KEY,KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,0));
-			updateEnabledState();
-		}
-		
-		public void actionPerformed(ActionEvent e) {
-			model.setTurnRestrictionLeg(role, null);			
-		}		
-		
-		public void updateEnabledState() {
-			setEnabled(legs.size()>0);
-		}
-	}
-	
-	/**
-	 * The transfer handler for Drag-and-Drop. 
-	 */
-	class LegEditorTransferHandler extends PrimitiveIdListTransferHandler {
-		Logger logger = Logger.getLogger(LegEditorTransferHandler.class.getName());
-		
-		public LegEditorTransferHandler(PrimitiveIdListProvider provider){
-			super(provider);
-		}
-
-		@SuppressWarnings("unchecked")
-		@Override
-		public boolean importData(JComponent comp, Transferable t) {
-			try {
-				List<PrimitiveId> ids = (List<PrimitiveId>)t.getTransferData(PrimitiveIdTransferable.PRIMITIVE_ID_LIST_FLAVOR);
-				if (ids.size() !=1) {
-					return false;
-				}
-				PrimitiveId id = ids.get(0);
-				if (!id.getType().equals(OsmPrimitiveType.WAY)) return false;
-				model.setTurnRestrictionLeg(role, id);
-				return true;
-			} catch(IOException e) {
-				// ignore
-				return false;
-			} catch(UnsupportedFlavorException e) {
-				// ignore
-				return false;
-			}
-		}
-
-		@Override
-		protected Transferable createTransferable(JComponent c) {
-			if (legs.size() != 1) return null;
-			return super.createTransferable(c);
-		}
-	}
-	
-	class PopupLauncher extends PopupMenuLauncher {
-		@Override
-		public void launch(MouseEvent evt) {
-			new PopupMenu().show(lblOsmObject, evt.getX(), evt.getY());
-		}		
-	}
-	
-	class PopupMenu extends JPopupMenu {
-		public PopupMenu() {
-			actCopy.updateEnabledState();
-			JMenuItem item = add(actCopy);
-			item.setTransferHandler(transferHandler);
-			actPaste.updateEnabledState();
-			item = add(actPaste);			
-			item.setTransferHandler(transferHandler);
-			addSeparator();
-			add(actDelete);
-		}
-	}
-	
-	class CopyAction extends AbstractAction {
-		private Action delegate;
-		
-		public CopyAction(){
-			putValue(NAME, tr("Copy"));
-			putValue(SHORT_DESCRIPTION, tr("Copy to the clipboard"));
-			putValue(SMALL_ICON, ImageProvider.get("copy"));
-			putValue(ACCELERATOR_KEY, Shortcut.getCopyKeyStroke());
-			delegate = TurnRestrictionLegEditor.this.getActionMap().get("copy");
-			updateEnabledState();
-		}
-
-		public void actionPerformed(ActionEvent e) {
-			delegate.actionPerformed(e);
-		}
-		
-		public void updateEnabledState() {
-			setEnabled(legs.size() == 1);
-		}
-	}
-	
-	class PasteAction extends AbstractAction {
-		private Action delegate;
-		
-		public boolean canPaste() {
-			Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
-			for (DataFlavor df: clipboard.getAvailableDataFlavors()) {
-				if (df.equals(PrimitiveIdTransferable.PRIMITIVE_ID_LIST_FLAVOR)) return true;
-			}			
-			// FIXME: check whether there are selected objects in the JOSM copy/paste buffer  
-			return false;
-		}
-		
-		public PasteAction(){
-			putValue(NAME, tr("Paste"));
-			putValue(SHORT_DESCRIPTION, tr("Paste from the clipboard"));
-			putValue(SMALL_ICON, ImageProvider.get("paste"));
-			putValue(ACCELERATOR_KEY, Shortcut.getPasteKeyStroke());
-			delegate = TurnRestrictionLegEditor.this.getActionMap().get("paste");
-		}
-		
-		public void updateEnabledState() {
-			setEnabled(canPaste());
-		}
-
-		public void actionPerformed(ActionEvent e) {
-			delegate.actionPerformed(e);			
-		}
-	}
+    private JLabel lblOsmObject;
+    private final Set<OsmPrimitive> legs = new HashSet<OsmPrimitive>();
+    private TurnRestrictionEditorModel model;
+    private TurnRestrictionLegRole role; 
+    private DeleteAction actDelete;
+    private CopyAction actCopy;
+    private PasteAction actPaste;
+    private TransferHandler transferHandler;
+    
+    /**
+     * builds the UI 
+     */
+    protected void build() {
+        setLayout(new BorderLayout());
+        add(lblOsmObject = new JLabel(), BorderLayout.CENTER);      
+        lblOsmObject.setOpaque(true);
+        lblOsmObject.setBorder(null);
+        setBorder(
+                BorderFactory.createCompoundBorder(
+                        BorderFactory.createEtchedBorder(),
+                        BorderFactory.createEmptyBorder(1,1,1,1)
+                )
+        );
+        
+        JButton btn;
+        actDelete = new DeleteAction();
+        add(btn = new JButton(actDelete), BorderLayout.EAST);
+        btn.setFocusable(false);
+        btn.setText(null);
+        btn.setBorder(BorderFactory.createRaisedBevelBorder());
+                
+        // focus handling
+        FocusHandler fh  = new FocusHandler();
+        lblOsmObject.setFocusable(true);    
+        lblOsmObject.addFocusListener(fh);      
+        this.addFocusListener(fh);
+
+        // mouse event handling
+        MouseEventHandler meh = new MouseEventHandler();
+        lblOsmObject.addMouseListener(meh);
+        addMouseListener(meh);
+        lblOsmObject.addMouseListener(new PopupLauncher());
+        
+        // enable DEL to remove the object from the turn restriction
+        registerKeyboardAction(actDelete,KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,0) , JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+
+        getInputMap().put(Shortcut.getCopyKeyStroke(), TransferHandler.getCopyAction().getValue(Action.NAME));;
+        getInputMap().put(Shortcut.getPasteKeyStroke(), TransferHandler.getPasteAction().getValue(Action.NAME));;
+        getActionMap().put(TransferHandler.getCopyAction().getValue(Action.NAME), TransferHandler.getCopyAction());
+        getActionMap().put(TransferHandler.getPasteAction().getValue(Action.NAME), TransferHandler.getPasteAction());
+        lblOsmObject.setTransferHandler(transferHandler = new LegEditorTransferHandler(this));
+        lblOsmObject.addMouseMotionListener(new MouseMotionAdapter(){
+            @Override
+            public void mouseDragged(MouseEvent e) {
+                JComponent c = (JComponent)e.getSource();
+                TransferHandler th = c.getTransferHandler();
+                th.exportAsDrag(c, e, TransferHandler.COPY);                
+            }                   
+        });
+        actCopy = new CopyAction();
+        actPaste = new PasteAction();
+    }
+    
+    /**
+     * Constructor 
+     * 
+     * @param model the model. Must not be null.
+     * @param role the leg role of the leg this editor is editing. Must not be null.
+     * @exception IllegalArgumentException thrown if model is null
+     * @exception IllegalArgumentException thrown if role is null
+     */
+    public TurnRestrictionLegEditor(TurnRestrictionEditorModel model, TurnRestrictionLegRole role) {
+        CheckParameterUtil.ensureParameterNotNull(model, "model");
+        CheckParameterUtil.ensureParameterNotNull(role, "role");
+        
+        this.model = model;
+        this.role = role;
+        build();
+        model.addObserver(this);
+        refresh();  
+    }
+
+    protected void refresh(){
+        legs.clear();
+        legs.addAll(model.getTurnRestrictionLeg(role));
+        if (legs.isEmpty()) {
+            lblOsmObject.setFont(UIManager.getFont("Label.font").deriveFont(Font.ITALIC));
+            lblOsmObject.setIcon(null);
+            lblOsmObject.setText(tr("please select a way"));
+            lblOsmObject.setToolTipText(null);
+        } else if (legs.size() == 1){
+            OsmPrimitive leg = legs.iterator().next();
+            lblOsmObject.setFont(UIManager.getFont("Label.font"));
+            lblOsmObject.setIcon(ImageProvider.get("data", "way"));
+            lblOsmObject.setText(leg.getDisplayName(DefaultNameFormatter.getInstance()));
+            lblOsmObject.setToolTipText(DefaultNameFormatter.getInstance().buildDefaultToolTip(leg));
+        } else {
+            lblOsmObject.setFont(UIManager.getFont("Label.font").deriveFont(Font.ITALIC));
+            lblOsmObject.setIcon(null);
+            lblOsmObject.setText(tr("multiple objects with role ''{0}''",this.role.getOsmRole()));
+            lblOsmObject.setToolTipText(null);          
+        }
+        renderColors();
+        actDelete.updateEnabledState();
+    }
+    
+    /**
+     * Render the foreground and background color
+     */
+    protected void renderColors() {
+        if (lblOsmObject.hasFocus()) {
+            setBackground(UIManager.getColor("List.selectionBackground"));
+            setForeground(UIManager.getColor("List.selectionForeground"));
+            lblOsmObject.setBackground(UIManager.getColor("List.selectionBackground"));
+            lblOsmObject.setForeground(UIManager.getColor("List.selectionForeground"));
+        } else {
+            lblOsmObject.setBackground(UIManager.getColor("List.background"));
+            lblOsmObject.setForeground(UIManager.getColor("List.foreground"));
+        }
+    }
+    
+    /**
+     * Replies the model for this editor
+     * 
+     * @return the model 
+     */
+    public TurnRestrictionEditorModel getModel() {
+        return model;
+    }
+    
+    /**
+     * Replies the role of this editor 
+     * 
+     * @return the role 
+     */
+    public TurnRestrictionLegRole getRole() {
+        return role;
+    }       
+    
+    /* ----------------------------------------------------------------------------- */
+    /* interface Observer                                                            */
+    /* ----------------------------------------------------------------------------- */
+    public void update(Observable o, Object arg) {
+        refresh();      
+    }
+    
+    /* ----------------------------------------------------------------------------- */
+    /* interface PrimitiveIdListProvider                                                            */
+    /* ----------------------------------------------------------------------------- */
+    public List<PrimitiveId> getSelectedPrimitiveIds() {
+        if (legs.size() == 1) {
+            return Collections.singletonList(legs.iterator().next().getPrimitiveId());
+        }
+        return Collections.emptyList();
+    }
+    
+    /* ----------------------------------------------------------------------------- */
+    /* inner classes                                                                 */
+    /* ----------------------------------------------------------------------------- */ 
+    /**
+     * Responds to focus change events  
+     */
+    class FocusHandler extends FocusAdapter {
+        @Override
+        public void focusGained(FocusEvent e) {
+            renderColors();
+        }
+
+        @Override
+        public void focusLost(FocusEvent e) {
+            renderColors();
+        }       
+    }
+    
+    class MouseEventHandler extends MouseAdapter {
+        @Override
+        public void mouseClicked(MouseEvent e) {
+            lblOsmObject.requestFocusInWindow();
+        }       
+    }
+    
+    /**
+     * Deletes the way from the turn restriction 
+     */
+    class DeleteAction extends AbstractAction {
+        public DeleteAction() {
+            putValue(SHORT_DESCRIPTION, tr("Delete from turn restriction"));
+            putValue(NAME, tr("Delete"));
+            putValue(SMALL_ICON, ImageProvider.get("deletesmall"));
+            putValue(ACCELERATOR_KEY,KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,0));
+            updateEnabledState();
+        }
+        
+        public void actionPerformed(ActionEvent e) {
+            model.setTurnRestrictionLeg(role, null);            
+        }       
+        
+        public void updateEnabledState() {
+            setEnabled(legs.size()>0);
+        }
+    }
+    
+    /**
+     * The transfer handler for Drag-and-Drop. 
+     */
+    class LegEditorTransferHandler extends PrimitiveIdListTransferHandler {
+        Logger logger = Logger.getLogger(LegEditorTransferHandler.class.getName());
+        
+        public LegEditorTransferHandler(PrimitiveIdListProvider provider){
+            super(provider);
+        }
+
+        @SuppressWarnings("unchecked")
+        @Override
+        public boolean importData(JComponent comp, Transferable t) {
+            try {
+                List<PrimitiveId> ids = (List<PrimitiveId>)t.getTransferData(PrimitiveIdTransferable.PRIMITIVE_ID_LIST_FLAVOR);
+                if (ids.size() !=1) {
+                    return false;
+                }
+                PrimitiveId id = ids.get(0);
+                if (!id.getType().equals(OsmPrimitiveType.WAY)) return false;
+                model.setTurnRestrictionLeg(role, id);
+                return true;
+            } catch(IOException e) {
+                // ignore
+                return false;
+            } catch(UnsupportedFlavorException e) {
+                // ignore
+                return false;
+            }
+        }
+
+        @Override
+        protected Transferable createTransferable(JComponent c) {
+            if (legs.size() != 1) return null;
+            return super.createTransferable(c);
+        }
+    }
+    
+    class PopupLauncher extends PopupMenuLauncher {
+        @Override
+        public void launch(MouseEvent evt) {
+            new PopupMenu().show(lblOsmObject, evt.getX(), evt.getY());
+        }       
+    }
+    
+    class PopupMenu extends JPopupMenu {
+        public PopupMenu() {
+            actCopy.updateEnabledState();
+            JMenuItem item = add(actCopy);
+            item.setTransferHandler(transferHandler);
+            actPaste.updateEnabledState();
+            item = add(actPaste);           
+            item.setTransferHandler(transferHandler);
+            addSeparator();
+            add(actDelete);
+        }
+    }
+    
+    class CopyAction extends AbstractAction {
+        private Action delegate;
+        
+        public CopyAction(){
+            putValue(NAME, tr("Copy"));
+            putValue(SHORT_DESCRIPTION, tr("Copy to the clipboard"));
+            putValue(SMALL_ICON, ImageProvider.get("copy"));
+            putValue(ACCELERATOR_KEY, Shortcut.getCopyKeyStroke());
+            delegate = TurnRestrictionLegEditor.this.getActionMap().get("copy");
+            updateEnabledState();
+        }
+
+        public void actionPerformed(ActionEvent e) {
+            delegate.actionPerformed(e);
+        }
+        
+        public void updateEnabledState() {
+            setEnabled(legs.size() == 1);
+        }
+    }
+    
+    class PasteAction extends AbstractAction {
+        private Action delegate;
+        
+        public boolean canPaste() {
+            Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
+            for (DataFlavor df: clipboard.getAvailableDataFlavors()) {
+                if (df.equals(PrimitiveIdTransferable.PRIMITIVE_ID_LIST_FLAVOR)) return true;
+            }           
+            // FIXME: check whether there are selected objects in the JOSM copy/paste buffer  
+            return false;
+        }
+        
+        public PasteAction(){
+            putValue(NAME, tr("Paste"));
+            putValue(SHORT_DESCRIPTION, tr("Paste from the clipboard"));
+            putValue(SMALL_ICON, ImageProvider.get("paste"));
+            putValue(ACCELERATOR_KEY, Shortcut.getPasteKeyStroke());
+            delegate = TurnRestrictionLegEditor.this.getActionMap().get("paste");
+        }
+        
+        public void updateEnabledState() {
+            setEnabled(canPaste());
+        }
+
+        public void actionPerformed(ActionEvent e) {
+            delegate.actionPerformed(e);            
+        }
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegRole.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegRole.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionLegRole.java	(revision 23192)
@@ -4,16 +4,16 @@
  * Enumerates the two roles a "leg" in a turn restriction can have.
  */
-public enum TurnRestrictionLegRole {	
-	FROM("from"),
-	TO("to");
-	
-	private String osmRoleName;
-	
-	private TurnRestrictionLegRole(String osmRoleName) {
-		this.osmRoleName = osmRoleName;
-	}
-	
-	public String getOsmRole() {
-		return osmRoleName;
-	}
+public enum TurnRestrictionLegRole {    
+    FROM("from"),
+    TO("to");
+    
+    private String osmRoleName;
+    
+    private TurnRestrictionLegRole(String osmRoleName) {
+        this.osmRoleName = osmRoleName;
+    }
+    
+    public String getOsmRole() {
+        return osmRoleName;
+    }
 }
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 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionSelectionPopupPanel.java	(revision 23192)
@@ -50,315 +50,315 @@
  */
 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 (e.getOppositeComponent() == null ||!SwingUtilities.isDescendingFrom(e.getOppositeComponent(), TurnRestrictionSelectionPopupPanel.this)) {
-				if (parentPopup != null){
-					parentPopup.hide();
-				}
-			}
-		}
-	}
+    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 (e.getOppositeComponent() == null ||!SwingUtilities.isDescendingFrom(e.getOppositeComponent(), TurnRestrictionSelectionPopupPanel.this)) {
+                if (parentPopup != null){
+                    parentPopup.hide();
+                }
+            }
+        }
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionType.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionType.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionType.java	(revision 23192)
@@ -9,60 +9,60 @@
  */
 public enum TurnRestrictionType {
-	NO_RIGHT_TURN("no_right_turn", tr("No Right Turn")),
-	NO_LEFT_TURN("no_left_turn", tr("No Left Turn")),
-	NO_U_TURN("no_u_turn", tr("No U-Turn")),
-	NO_STRAIGHT_ON("no_straight_on", tr("No Straight On")),	
-	ONLY_RIGHT_TURN("only_right_turn", tr("Only Right Turn")),
-	ONLY_LEFT_TURN("only_left_turn", tr("Only Left Turn")),
-	ONLY_STRAIGHT_ON("only_straight_on", tr("Only Straight On"));
-	
-	private String tagValue;
-	private String displayName;
-	
-	TurnRestrictionType(String tagValue, String displayName) {
-		this.tagValue = tagValue;
-		this.displayName = displayName;
-	}
-	
-	/**
-	 * Replies the tag value for a specific turn restriction type
-	 * 
-	 * @return the tag value for a specific turn restriction type
-	 */
-	public String getTagValue() {
-		return tagValue;
-	}
-	
-	/**
-	 * Replies the localized display name for a turn restriction type
-	 */
-	public String getDisplayName() {
-		return displayName;
-	}	
-	
-	/**
-	 * Replies the enumeration value for a given tag value. null,
-	 * if {@code tagValue} is null or if there isnt an enumeration value
-	 * for this {@code tagValue}
-	 *  
-	 * @param tagValue the tag value, i.e. <tt>no_left_turn</tt>
-	 * @return the enumeration value
-	 */
-	static public TurnRestrictionType fromTagValue(String tagValue) {
-		if (tagValue == null) return null;
-		for(TurnRestrictionType type: values()) {
-			if(type.getTagValue().equals(tagValue)) return type;
-		}
-		return null;
-	}
+    NO_RIGHT_TURN("no_right_turn", tr("No Right Turn")),
+    NO_LEFT_TURN("no_left_turn", tr("No Left Turn")),
+    NO_U_TURN("no_u_turn", tr("No U-Turn")),
+    NO_STRAIGHT_ON("no_straight_on", tr("No Straight On")), 
+    ONLY_RIGHT_TURN("only_right_turn", tr("Only Right Turn")),
+    ONLY_LEFT_TURN("only_left_turn", tr("Only Left Turn")),
+    ONLY_STRAIGHT_ON("only_straight_on", tr("Only Straight On"));
+    
+    private String tagValue;
+    private String displayName;
+    
+    TurnRestrictionType(String tagValue, String displayName) {
+        this.tagValue = tagValue;
+        this.displayName = displayName;
+    }
+    
+    /**
+     * Replies the tag value for a specific turn restriction type
+     * 
+     * @return the tag value for a specific turn restriction type
+     */
+    public String getTagValue() {
+        return tagValue;
+    }
+    
+    /**
+     * Replies the localized display name for a turn restriction type
+     */
+    public String getDisplayName() {
+        return displayName;
+    }   
+    
+    /**
+     * Replies the enumeration value for a given tag value. null,
+     * if {@code tagValue} is null or if there isnt an enumeration value
+     * for this {@code tagValue}
+     *  
+     * @param tagValue the tag value, i.e. <tt>no_left_turn</tt>
+     * @return the enumeration value
+     */
+    static public TurnRestrictionType fromTagValue(String tagValue) {
+        if (tagValue == null) return null;
+        for(TurnRestrictionType type: values()) {
+            if(type.getTagValue().equals(tagValue)) return type;
+        }
+        return null;
+    }
 
-	/**
-	 * Replies true if {@code tagValue} is a standard restriction type. 
-	 * 
-	 * @param tagValue the tag value 
-	 * @return true if {@code tagValue} is a standard restriction type
-	 */
-	static public boolean isStandardTagValue(String tagValue){
-		return fromTagValue(tagValue) != null;
-	}
+    /**
+     * Replies true if {@code tagValue} is a standard restriction type. 
+     * 
+     * @param tagValue the tag value 
+     * @return true if {@code tagValue} is a standard restriction type
+     */
+    static public boolean isStandardTagValue(String tagValue){
+        return fromTagValue(tagValue) != null;
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeRenderer.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeRenderer.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/TurnRestrictionTypeRenderer.java	(revision 23192)
@@ -20,68 +20,68 @@
 public class TurnRestrictionTypeRenderer extends JLabel implements ListCellRenderer{
  
-	final private Map<TurnRestrictionType, ImageIcon> icons = new HashMap<TurnRestrictionType, ImageIcon>();
-	private String iconSet = "set-a";
-	
-	/**
-	 * Loads the image icons for the rendered turn restriction types 
-	 */
-	protected void loadImages() {
-		for(TurnRestrictionType type: TurnRestrictionType.values()) {
-			try {
-				ImageIcon icon = new ImageIcon(ImageProvider.get("types/" + iconSet, type.getTagValue()).getImage().getScaledInstance(16, 16, Image.SCALE_SMOOTH));
-				icons.put(type,icon);
-			} catch(Exception e){
-				System.out.println(tr("Warning: failed to load icon for turn restriction type ''{0}''", type.getTagValue()));
-				e.printStackTrace();				
-			}
-		}
-	}
-	
-	public TurnRestrictionTypeRenderer() {
-		setOpaque(true);
-		loadImages();
-	}
-	
-	protected void renderColors(boolean isSelected){
-		if (isSelected){
-			setBackground(UIManager.getColor("List.selectionBackground"));
-			setForeground(UIManager.getColor("List.selectionForeground"));
-		} else {
-			setBackground(UIManager.getColor("List.background"));
-			setForeground(UIManager.getColor("List.foreground"));			
-		}
-	}
-	
-	/**
-	 * Initializes the set of icons used from the preference key
-	 * {@see PreferenceKeys#ROAD_SIGNS}.
-	 * 
-	 * @param prefs the JOSM preferences 
-	 */
-	public void initIconSetFromPreferences(Preferences prefs){		
-		iconSet = prefs.get(PreferenceKeys.ROAD_SIGNS, "set-a");
-		iconSet = iconSet.trim().toLowerCase();
-		if (!iconSet.equals("set-a") && !iconSet.equals("set-b")) {
-			iconSet = "set-a";
-		}
-		loadImages();
-	}
-	
-	public Component getListCellRendererComponent(JList list, Object value,
-			int index, boolean isSelected, boolean cellHasFocus) {
-		
-		renderColors(isSelected);
-		if (value == null) {
-			setText(tr("please select a turn restriction type"));
-			setIcon(null);
-		} else if (value instanceof String){
-			setText((String)value);
-			setIcon(null); // FIXME: special icon for non-standard types? 
-		} else if (value instanceof TurnRestrictionType){
-			TurnRestrictionType type = (TurnRestrictionType)value;
-			setText(type.getDisplayName());
-			setIcon(icons.get(type));
-		}
-		return this;
-	}	
+    final private Map<TurnRestrictionType, ImageIcon> icons = new HashMap<TurnRestrictionType, ImageIcon>();
+    private String iconSet = "set-a";
+    
+    /**
+     * Loads the image icons for the rendered turn restriction types 
+     */
+    protected void loadImages() {
+        for(TurnRestrictionType type: TurnRestrictionType.values()) {
+            try {
+                ImageIcon icon = new ImageIcon(ImageProvider.get("types/" + iconSet, type.getTagValue()).getImage().getScaledInstance(16, 16, Image.SCALE_SMOOTH));
+                icons.put(type,icon);
+            } catch(Exception e){
+                System.out.println(tr("Warning: failed to load icon for turn restriction type ''{0}''", type.getTagValue()));
+                e.printStackTrace();                
+            }
+        }
+    }
+    
+    public TurnRestrictionTypeRenderer() {
+        setOpaque(true);
+        loadImages();
+    }
+    
+    protected void renderColors(boolean isSelected){
+        if (isSelected){
+            setBackground(UIManager.getColor("List.selectionBackground"));
+            setForeground(UIManager.getColor("List.selectionForeground"));
+        } else {
+            setBackground(UIManager.getColor("List.background"));
+            setForeground(UIManager.getColor("List.foreground"));           
+        }
+    }
+    
+    /**
+     * Initializes the set of icons used from the preference key
+     * {@see PreferenceKeys#ROAD_SIGNS}.
+     * 
+     * @param prefs the JOSM preferences 
+     */
+    public void initIconSetFromPreferences(Preferences prefs){      
+        iconSet = prefs.get(PreferenceKeys.ROAD_SIGNS, "set-a");
+        iconSet = iconSet.trim().toLowerCase();
+        if (!iconSet.equals("set-a") && !iconSet.equals("set-b")) {
+            iconSet = "set-a";
+        }
+        loadImages();
+    }
+    
+    public Component getListCellRendererComponent(JList list, Object value,
+            int index, boolean isSelected, boolean cellHasFocus) {
+        
+        renderColors(isSelected);
+        if (value == null) {
+            setText(tr("please select a turn restriction type"));
+            setIcon(null);
+        } else if (value instanceof String){
+            setText((String)value);
+            setIcon(null); // FIXME: special icon for non-standard types? 
+        } else if (value instanceof TurnRestrictionType){
+            TurnRestrictionType type = (TurnRestrictionType)value;
+            setText(type.getDisplayName());
+            setIcon(icons.get(type));
+        }
+        return this;
+    }   
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/VehicleExceptionEditor.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/VehicleExceptionEditor.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/VehicleExceptionEditor.java	(revision 23192)
@@ -36,292 +36,292 @@
  */
 public class VehicleExceptionEditor extends JPanel implements Observer{
-	static private final Logger logger = Logger.getLogger(VehicleExceptionEditor.class.getName());
-	
-	private TurnRestrictionEditorModel model;
-	private JCheckBox cbPsv;
-	private JCheckBox cbBicyle;
-	private JCheckBox cbHgv;
-	private JCheckBox cbMotorcar;
-	private JTextField tfNonStandardValue;
-	private ButtonGroup bgStandardOrNonStandard;
-	private JRadioButton rbStandardException;
-	private JRadioButton rbNonStandardException;
-	private JPanel pnlStandard;
-	private JPanel pnlNonStandard;
-	private ExceptValueModel exceptValue = new ExceptValueModel();
-	
-	private JPanel buildMessagePanel() {
-		JPanel pnl = new JPanel(new BorderLayout());
-		HtmlPanel msg = new HtmlPanel();
-		pnl.add(msg, BorderLayout.CENTER);
-		msg.setText(
-				"<html><body>"
-				+ tr("Select the vehicle types this turn restriction is <strong>not</strong> applicable for.")
-				+ "</body></html>"
-	    );
-		return pnl;
-	}
-	
-	private JPanel buildStandardInputPanel() {
-		if (pnlStandard != null)
-			return pnlStandard;
-		
-		StandardVehicleTypeChangeListener changeHandler = new StandardVehicleTypeChangeListener();
-		
-		GridBagConstraints gc = new GridBagConstraints();
-		gc.anchor = GridBagConstraints.NORTHWEST;
-		gc.fill = GridBagConstraints.HORIZONTAL;
-		gc.gridx = 0;
-		gc.gridy = 0;
-		
-		pnlStandard = new JPanel(new GridBagLayout());
-		JLabel lbl;
-		cbPsv = new JCheckBox();
-		cbPsv.addItemListener(changeHandler);
-		lbl = new JLabel();
-		lbl.setText(tr("Public Service Vehicles"));
-		lbl.setToolTipText(tr("Public service vehicles like buses, tramways, etc."));
-		lbl.setIcon(ImageProvider.get("vehicle", "psv"));
-		
-		gc.weightx = 0.0;
-		pnlStandard.add(cbPsv, gc);
-		gc.weightx = 1.0;
-		gc.gridx++;
-		pnlStandard.add(lbl, gc);
-		
-		cbHgv = new JCheckBox();
-		cbHgv.addItemListener(changeHandler);
-		lbl = new JLabel();
-		lbl.setText(tr("Heavy Goods Vehicles"));
-		lbl.setIcon(ImageProvider.get("vehicle", "hgv"));
-
-		gc.weightx = 0.0;
-		gc.gridx++;
-		pnlStandard.add(cbHgv, gc);
-		gc.weightx = 1.0;
-		gc.gridx++;
-		pnlStandard.add(lbl, gc);
-
-		cbMotorcar = new JCheckBox();
-		cbMotorcar.addItemListener(changeHandler);
-		lbl = new JLabel();
-		lbl.setText(tr("Motorcars"));
-		lbl.setIcon(ImageProvider.get("vehicle", "motorcar"));
-		
-		gc.weightx = 0.0;
-		gc.gridx = 0;
-		gc.gridy = 1;
-		pnlStandard.add(cbMotorcar, gc);
-		gc.weightx = 1.0;
-		gc.gridx++;
-		pnlStandard.add(lbl, gc);
-		
-		cbBicyle = new JCheckBox();
-		cbBicyle.addItemListener(changeHandler);
-		lbl = new JLabel();
-		lbl.setText(tr("Bicycles"));
-		lbl.setIcon(ImageProvider.get("vehicle", "bicycle"));
-		
-
-		gc.weightx = 0.0;
-		gc.gridx++;
-		pnlStandard.add(cbBicyle, gc);
-		gc.weightx = 1.0;
-		gc.gridx++;
-		pnlStandard.add(lbl, gc);
-		
-		return pnlStandard;
-	}
-	
-	private JPanel buildNonStandardInputPanel() {
-		if (pnlNonStandard != null)
-			return pnlNonStandard;
-		pnlNonStandard = new JPanel(new GridBagLayout());
-		GridBagConstraints gc = new GridBagConstraints();
-		gc.anchor = GridBagConstraints.NORTHWEST;
-		gc.fill = GridBagConstraints.HORIZONTAL;
-		gc.weightx = 0.0;
-		gc.insets = new Insets(0, 0, 4, 0);
-		gc.gridx = 0;
-		gc.gridy = 0;
-		
-		pnlNonStandard.add(new JLabel(tr("Value:")), gc);
-		gc.gridx = 1;
-		gc.weightx = 1.0;
-		pnlNonStandard.add(tfNonStandardValue = new JTextField(), gc);
-		SelectAllOnFocusGainedDecorator.decorate(tfNonStandardValue);
-		
-		NonStandardVehicleTypesHandler inputChangedHandler = new NonStandardVehicleTypesHandler();
-		tfNonStandardValue.addActionListener(inputChangedHandler);
-		tfNonStandardValue.addFocusListener(inputChangedHandler);
-		return pnlNonStandard;
-	}
-		
-	/**
-	 * Builds the UI for entering standard values 
-	 */
-	protected void buildStandard() {
-		setLayout(new GridBagLayout());
-		GridBagConstraints gc = new GridBagConstraints();
-		gc.anchor = GridBagConstraints.NORTHWEST;
-		gc.fill = GridBagConstraints.HORIZONTAL;
-		gc.weightx = 1.0;
-		gc.gridx = 0;
-		gc.gridy = 0;
-		add(buildMessagePanel(), gc);
-		
-		gc.gridy=1;
-		add(buildStandardInputPanel(), gc);		
-	}
-	
-	/**
-	 * Builds the UI for entering either standard or non-standard values 
-	 */
-	protected void buildNonStandard() {
-		setLayout(new GridBagLayout());
-		GridBagConstraints gc = new GridBagConstraints();
-		gc.anchor = GridBagConstraints.NORTHWEST;
-		gc.fill = GridBagConstraints.HORIZONTAL;
-		gc.weightx = 1.0;
-		gc.gridx = 0;
-		gc.gridy = 0;
-		add(buildMessagePanel(), gc);
-				
-		gc.gridx=0;
-		gc.gridy=1;
-		gc.insets = new Insets(0,0,0,0);
-		add(rbStandardException = new JRadioButton(tr("Use standard exceptions")), gc);
-
-		gc.gridx=0;
-		gc.gridy=2;
-		gc.insets = new Insets(0, 20, 0,0);
-		add(buildStandardInputPanel(), gc);
-
-		gc.gridx=0;
-		gc.gridy=3;
-		gc.insets = new Insets(0,0,0,0);
-		add(rbNonStandardException = new JRadioButton(tr("Use non-standard exceptions")), gc);
-
-		gc.gridx=0;
-		gc.gridy=4;
-		gc.insets = new Insets(0, 20, 0,0);
-		add(buildNonStandardInputPanel(), gc);
-		
-		bgStandardOrNonStandard = new ButtonGroup();
-		bgStandardOrNonStandard.add(rbNonStandardException);
-		bgStandardOrNonStandard.add(rbStandardException);
-		
-		StandardNonStandardChangeHander changeHandler = new StandardNonStandardChangeHander();
-		rbNonStandardException.addItemListener(changeHandler);
-		rbStandardException.addItemListener(changeHandler);
-	}
-	
-	protected void build() {
-		removeAll();
-		buildNonStandardInputPanel();
-		buildStandardInputPanel();
-		if (exceptValue.isStandard()){
-			buildStandard();
-		} else {
-			buildNonStandard();
-		}
-		init();
-		invalidate();
-	}
-	
-	protected void init() {
-		cbPsv.setSelected(exceptValue.isVehicleException("psv"));
-		cbBicyle.setSelected(exceptValue.isVehicleException("bicycle"));
-		cbMotorcar.setSelected(exceptValue.isVehicleException("motorcar"));
-		cbHgv.setSelected(exceptValue.isVehicleException("hgv"));
-		if (!exceptValue.isStandard()){
-			rbNonStandardException.setSelected(true);
-			tfNonStandardValue.setText(exceptValue.getValue());
-			setEnabledNonStandardInputPanel(true);
-			setEnabledStandardInputPanel(false);
-		} else {
-			setEnabledNonStandardInputPanel(false);
-			setEnabledStandardInputPanel(true);
-		}
-	}
-	
-	protected void setEnabledStandardInputPanel(boolean enabled) {
-		for (Component c: pnlStandard.getComponents()){
-			c.setEnabled(enabled);
-		}
-	}
-	
-	protected void setEnabledNonStandardInputPanel(boolean enabled) {
-		for (Component c: pnlNonStandard.getComponents()){
-			c.setEnabled(enabled);
-		}
-	}
-
-	
-	/**
-	 * Creates the editor 
-	 * 
-	 * @param model the editor model. Must not be null.
-	 * @throws IllegalArgumentException thrown if {@code model} is null
-	 */
-	public VehicleExceptionEditor(TurnRestrictionEditorModel model) throws IllegalArgumentException {
-		CheckParameterUtil.ensureParameterNotNull(model, "model");
-		this.model = model;
-		build();
-		model.addObserver(this);
-	}
-	
-	/* ------------------------------------------------------------------------------------ */
-	/* interface Observer                                                                   */
-	/* ------------------------------------------------------------------------------------ */
-	public void update(Observable o, Object arg) {
-		if (!this.exceptValue.equals(model.getExcept())) {
-			this.exceptValue = model.getExcept();
-			build();
-		}
-	}
-
-	/* ------------------------------------------------------------------------------------ */
-	/* inner classes                                                                        */
-	/* ------------------------------------------------------------------------------------ */
-	class StandardNonStandardChangeHander implements ItemListener {
-		public void itemStateChanged(ItemEvent e) {
-			if (rbNonStandardException.isSelected()){
-				setEnabledNonStandardInputPanel(true);
-				setEnabledStandardInputPanel(false);
-				exceptValue.setStandard(false);
-			} else {
-				setEnabledNonStandardInputPanel(false);
-				setEnabledStandardInputPanel(true);
-				exceptValue.setStandard(true);
-			}
-			model.setExcept(exceptValue);
-		}
-	}
-	
-	class StandardVehicleTypeChangeListener implements ItemListener {
-		public void itemStateChanged(ItemEvent e) {
-			exceptValue.setVehicleException("bicycle", cbBicyle.isSelected());
-			exceptValue.setVehicleException("hgv", cbHgv.isSelected());
-			exceptValue.setVehicleException("psv", cbPsv.isSelected());
-			exceptValue.setVehicleException("motorcar", cbMotorcar.isSelected());
-			model.setExcept(exceptValue);
-		}
-	}
-	
-	class NonStandardVehicleTypesHandler implements ActionListener, FocusListener {
-		public void persist() {
-			exceptValue.setValue(tfNonStandardValue.getText());
-			model.setExcept(exceptValue);
-		}
-		
-		public void focusGained(FocusEvent e) {}
-		public void focusLost(FocusEvent e) {
-			persist();
-		}
-
-		public void actionPerformed(ActionEvent e) {
-			persist();			
-		}
-	}
+    static private final Logger logger = Logger.getLogger(VehicleExceptionEditor.class.getName());
+    
+    private TurnRestrictionEditorModel model;
+    private JCheckBox cbPsv;
+    private JCheckBox cbBicyle;
+    private JCheckBox cbHgv;
+    private JCheckBox cbMotorcar;
+    private JTextField tfNonStandardValue;
+    private ButtonGroup bgStandardOrNonStandard;
+    private JRadioButton rbStandardException;
+    private JRadioButton rbNonStandardException;
+    private JPanel pnlStandard;
+    private JPanel pnlNonStandard;
+    private ExceptValueModel exceptValue = new ExceptValueModel();
+    
+    private JPanel buildMessagePanel() {
+        JPanel pnl = new JPanel(new BorderLayout());
+        HtmlPanel msg = new HtmlPanel();
+        pnl.add(msg, BorderLayout.CENTER);
+        msg.setText(
+                "<html><body>"
+                + tr("Select the vehicle types this turn restriction is <strong>not</strong> applicable for.")
+                + "</body></html>"
+        );
+        return pnl;
+    }
+    
+    private JPanel buildStandardInputPanel() {
+        if (pnlStandard != null)
+            return pnlStandard;
+        
+        StandardVehicleTypeChangeListener changeHandler = new StandardVehicleTypeChangeListener();
+        
+        GridBagConstraints gc = new GridBagConstraints();
+        gc.anchor = GridBagConstraints.NORTHWEST;
+        gc.fill = GridBagConstraints.HORIZONTAL;
+        gc.gridx = 0;
+        gc.gridy = 0;
+        
+        pnlStandard = new JPanel(new GridBagLayout());
+        JLabel lbl;
+        cbPsv = new JCheckBox();
+        cbPsv.addItemListener(changeHandler);
+        lbl = new JLabel();
+        lbl.setText(tr("Public Service Vehicles"));
+        lbl.setToolTipText(tr("Public service vehicles like buses, tramways, etc."));
+        lbl.setIcon(ImageProvider.get("vehicle", "psv"));
+        
+        gc.weightx = 0.0;
+        pnlStandard.add(cbPsv, gc);
+        gc.weightx = 1.0;
+        gc.gridx++;
+        pnlStandard.add(lbl, gc);
+        
+        cbHgv = new JCheckBox();
+        cbHgv.addItemListener(changeHandler);
+        lbl = new JLabel();
+        lbl.setText(tr("Heavy Goods Vehicles"));
+        lbl.setIcon(ImageProvider.get("vehicle", "hgv"));
+
+        gc.weightx = 0.0;
+        gc.gridx++;
+        pnlStandard.add(cbHgv, gc);
+        gc.weightx = 1.0;
+        gc.gridx++;
+        pnlStandard.add(lbl, gc);
+
+        cbMotorcar = new JCheckBox();
+        cbMotorcar.addItemListener(changeHandler);
+        lbl = new JLabel();
+        lbl.setText(tr("Motorcars"));
+        lbl.setIcon(ImageProvider.get("vehicle", "motorcar"));
+        
+        gc.weightx = 0.0;
+        gc.gridx = 0;
+        gc.gridy = 1;
+        pnlStandard.add(cbMotorcar, gc);
+        gc.weightx = 1.0;
+        gc.gridx++;
+        pnlStandard.add(lbl, gc);
+        
+        cbBicyle = new JCheckBox();
+        cbBicyle.addItemListener(changeHandler);
+        lbl = new JLabel();
+        lbl.setText(tr("Bicycles"));
+        lbl.setIcon(ImageProvider.get("vehicle", "bicycle"));
+        
+
+        gc.weightx = 0.0;
+        gc.gridx++;
+        pnlStandard.add(cbBicyle, gc);
+        gc.weightx = 1.0;
+        gc.gridx++;
+        pnlStandard.add(lbl, gc);
+        
+        return pnlStandard;
+    }
+    
+    private JPanel buildNonStandardInputPanel() {
+        if (pnlNonStandard != null)
+            return pnlNonStandard;
+        pnlNonStandard = new JPanel(new GridBagLayout());
+        GridBagConstraints gc = new GridBagConstraints();
+        gc.anchor = GridBagConstraints.NORTHWEST;
+        gc.fill = GridBagConstraints.HORIZONTAL;
+        gc.weightx = 0.0;
+        gc.insets = new Insets(0, 0, 4, 0);
+        gc.gridx = 0;
+        gc.gridy = 0;
+        
+        pnlNonStandard.add(new JLabel(tr("Value:")), gc);
+        gc.gridx = 1;
+        gc.weightx = 1.0;
+        pnlNonStandard.add(tfNonStandardValue = new JTextField(), gc);
+        SelectAllOnFocusGainedDecorator.decorate(tfNonStandardValue);
+        
+        NonStandardVehicleTypesHandler inputChangedHandler = new NonStandardVehicleTypesHandler();
+        tfNonStandardValue.addActionListener(inputChangedHandler);
+        tfNonStandardValue.addFocusListener(inputChangedHandler);
+        return pnlNonStandard;
+    }
+        
+    /**
+     * Builds the UI for entering standard values 
+     */
+    protected void buildStandard() {
+        setLayout(new GridBagLayout());
+        GridBagConstraints gc = new GridBagConstraints();
+        gc.anchor = GridBagConstraints.NORTHWEST;
+        gc.fill = GridBagConstraints.HORIZONTAL;
+        gc.weightx = 1.0;
+        gc.gridx = 0;
+        gc.gridy = 0;
+        add(buildMessagePanel(), gc);
+        
+        gc.gridy=1;
+        add(buildStandardInputPanel(), gc);     
+    }
+    
+    /**
+     * Builds the UI for entering either standard or non-standard values 
+     */
+    protected void buildNonStandard() {
+        setLayout(new GridBagLayout());
+        GridBagConstraints gc = new GridBagConstraints();
+        gc.anchor = GridBagConstraints.NORTHWEST;
+        gc.fill = GridBagConstraints.HORIZONTAL;
+        gc.weightx = 1.0;
+        gc.gridx = 0;
+        gc.gridy = 0;
+        add(buildMessagePanel(), gc);
+                
+        gc.gridx=0;
+        gc.gridy=1;
+        gc.insets = new Insets(0,0,0,0);
+        add(rbStandardException = new JRadioButton(tr("Use standard exceptions")), gc);
+
+        gc.gridx=0;
+        gc.gridy=2;
+        gc.insets = new Insets(0, 20, 0,0);
+        add(buildStandardInputPanel(), gc);
+
+        gc.gridx=0;
+        gc.gridy=3;
+        gc.insets = new Insets(0,0,0,0);
+        add(rbNonStandardException = new JRadioButton(tr("Use non-standard exceptions")), gc);
+
+        gc.gridx=0;
+        gc.gridy=4;
+        gc.insets = new Insets(0, 20, 0,0);
+        add(buildNonStandardInputPanel(), gc);
+        
+        bgStandardOrNonStandard = new ButtonGroup();
+        bgStandardOrNonStandard.add(rbNonStandardException);
+        bgStandardOrNonStandard.add(rbStandardException);
+        
+        StandardNonStandardChangeHander changeHandler = new StandardNonStandardChangeHander();
+        rbNonStandardException.addItemListener(changeHandler);
+        rbStandardException.addItemListener(changeHandler);
+    }
+    
+    protected void build() {
+        removeAll();
+        buildNonStandardInputPanel();
+        buildStandardInputPanel();
+        if (exceptValue.isStandard()){
+            buildStandard();
+        } else {
+            buildNonStandard();
+        }
+        init();
+        invalidate();
+    }
+    
+    protected void init() {
+        cbPsv.setSelected(exceptValue.isVehicleException("psv"));
+        cbBicyle.setSelected(exceptValue.isVehicleException("bicycle"));
+        cbMotorcar.setSelected(exceptValue.isVehicleException("motorcar"));
+        cbHgv.setSelected(exceptValue.isVehicleException("hgv"));
+        if (!exceptValue.isStandard()){
+            rbNonStandardException.setSelected(true);
+            tfNonStandardValue.setText(exceptValue.getValue());
+            setEnabledNonStandardInputPanel(true);
+            setEnabledStandardInputPanel(false);
+        } else {
+            setEnabledNonStandardInputPanel(false);
+            setEnabledStandardInputPanel(true);
+        }
+    }
+    
+    protected void setEnabledStandardInputPanel(boolean enabled) {
+        for (Component c: pnlStandard.getComponents()){
+            c.setEnabled(enabled);
+        }
+    }
+    
+    protected void setEnabledNonStandardInputPanel(boolean enabled) {
+        for (Component c: pnlNonStandard.getComponents()){
+            c.setEnabled(enabled);
+        }
+    }
+
+    
+    /**
+     * Creates the editor 
+     * 
+     * @param model the editor model. Must not be null.
+     * @throws IllegalArgumentException thrown if {@code model} is null
+     */
+    public VehicleExceptionEditor(TurnRestrictionEditorModel model) throws IllegalArgumentException {
+        CheckParameterUtil.ensureParameterNotNull(model, "model");
+        this.model = model;
+        build();
+        model.addObserver(this);
+    }
+    
+    /* ------------------------------------------------------------------------------------ */
+    /* interface Observer                                                                   */
+    /* ------------------------------------------------------------------------------------ */
+    public void update(Observable o, Object arg) {
+        if (!this.exceptValue.equals(model.getExcept())) {
+            this.exceptValue = model.getExcept();
+            build();
+        }
+    }
+
+    /* ------------------------------------------------------------------------------------ */
+    /* inner classes                                                                        */
+    /* ------------------------------------------------------------------------------------ */
+    class StandardNonStandardChangeHander implements ItemListener {
+        public void itemStateChanged(ItemEvent e) {
+            if (rbNonStandardException.isSelected()){
+                setEnabledNonStandardInputPanel(true);
+                setEnabledStandardInputPanel(false);
+                exceptValue.setStandard(false);
+            } else {
+                setEnabledNonStandardInputPanel(false);
+                setEnabledStandardInputPanel(true);
+                exceptValue.setStandard(true);
+            }
+            model.setExcept(exceptValue);
+        }
+    }
+    
+    class StandardVehicleTypeChangeListener implements ItemListener {
+        public void itemStateChanged(ItemEvent e) {
+            exceptValue.setVehicleException("bicycle", cbBicyle.isSelected());
+            exceptValue.setVehicleException("hgv", cbHgv.isSelected());
+            exceptValue.setVehicleException("psv", cbPsv.isSelected());
+            exceptValue.setVehicleException("motorcar", cbMotorcar.isSelected());
+            model.setExcept(exceptValue);
+        }
+    }
+    
+    class NonStandardVehicleTypesHandler implements ActionListener, FocusListener {
+        public void persist() {
+            exceptValue.setValue(tfNonStandardValue.getText());
+            model.setExcept(exceptValue);
+        }
+        
+        public void focusGained(FocusEvent e) {}
+        public void focusLost(FocusEvent e) {
+            persist();
+        }
+
+        public void actionPerformed(ActionEvent e) {
+            persist();          
+        }
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/ViaList.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/ViaList.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/ViaList.java	(revision 23192)
@@ -46,262 +46,262 @@
  */
 public class ViaList extends JList{
-	
-	static private final Logger logger = Logger.getLogger(ViaList.class.getName());
-
-	private ViaListModel model;
-	private DeleteAction actDelete;
-	private MoveUpAction actMoveUp;
-	private MoveDownAction actMoveDown;
-	private CopyAction actCopy;
-	private PasteAction actPaste;
-	private TransferHandler transferHandler;
-	
-	/**
-	 * Constructor 
-	 * 
-	 * @param model the via list model. Must not be null.
-	 * @param selectionModel the selection model. Must not be null.
-	 * 
-	 */
-	public ViaList(ViaListModel model, DefaultListSelectionModel selectionModel) {
-		super(model);
-		this.model = model;
-		setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
-		setSelectionModel(selectionModel);
-		setCellRenderer(new OsmPrimitivRenderer());
-		setDragEnabled(true);		
-		setTransferHandler(transferHandler =new ViaListTransferHandler(model));
-		setVisibleRowCount(4);
-		
-		actDelete = new DeleteAction();
-		selectionModel.addListSelectionListener(actDelete);
-		registerKeyboardAction(actDelete, KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
-		
-		actMoveDown = new MoveDownAction();
-		selectionModel.addListSelectionListener(actMoveDown);
-		registerKeyboardAction(actMoveDown, KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.ALT_DOWN_MASK), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
-
-		actMoveUp = new MoveUpAction();
-		selectionModel.addListSelectionListener(actMoveUp);
-		registerKeyboardAction(actMoveUp, KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.ALT_DOWN_MASK), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
-		
-		actCopy = new CopyAction();
-		actPaste = new PasteAction();
-		getSelectionModel().addListSelectionListener(actCopy);
-        
-		addMouseListener(new ViaListPopupMenuLaucher());			
-	}
-	
-	/**
-	 * The transfer handler for Drag-and-Drop. 
-	 */
-	class ViaListTransferHandler extends PrimitiveIdListTransferHandler {
-		Logger logger = Logger.getLogger(ViaListTransferHandler.class.getName());
-		
-		private boolean isViaListInDragOperation = false;
-		private List<Integer> selectedRowsMemento = null;
-		
-		public ViaListTransferHandler(PrimitiveIdListProvider provider) {
-			super(provider);
-		}
-
-		@Override
-		public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) {
-			// a drag operation on itself is always allowed
-			if (isViaListInDragOperation) return true;
-			return isSupportedFlavor(transferFlavors);			
-		}
-
-		@SuppressWarnings("unchecked")
-		@Override
-		public boolean importData(JComponent comp, Transferable t) {	
-			if (!isSupportedFlavor(t.getTransferDataFlavors())) return false;
-			if (isViaListInDragOperation) {
-				// this is a drag operation on itself
-				int targetRow = getSelectedIndex();
-				if (targetRow <0) return true;
-				model.moveVias(selectedRowsMemento, targetRow);				
-			} else {
-				// this is a drag operation from another component
-				try {
-					List<PrimitiveId> idsToAdd = (List<PrimitiveId>)t.getTransferData(PrimitiveIdTransferable.PRIMITIVE_ID_LIST_FLAVOR);
-					model.insertVias(idsToAdd);
-				} catch(IOException e){
-					e.printStackTrace();
-				} catch(UnsupportedFlavorException e){
-					e.printStackTrace();
-				}
-			}
-			return true;
-		}
-
-		@Override
-		protected void exportDone(JComponent source, Transferable data, int action) {
-			isViaListInDragOperation = false;
-			super.exportDone(source, data, action);
-		}
-
-		@Override
-		public void exportAsDrag(JComponent comp, InputEvent e, int action) {
-			isViaListInDragOperation = true;
-			selectedRowsMemento = model.getSelectedRows();
-			super.exportAsDrag(comp, e, action);
-		}		
-	}	
-	
-	class DeleteAction extends AbstractAction implements ListSelectionListener {
-		public DeleteAction() {
-			putValue(NAME, tr("Remove"));
-			putValue(SMALL_ICON, ImageProvider.get("dialogs", "delete"));
-			putValue(SHORT_DESCRIPTION,tr("Remove the currently selected vias"));		
-			putValue(ACCELERATOR_KEY,KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,0));			
-			updateEnabledState();
-		}
-		
-		public void valueChanged(ListSelectionEvent e) {
-			updateEnabledState();			
-		}
-		
-		public void updateEnabledState() {
-			setEnabled(getSelectedIndex() >= 0);
-		}
-
-		public void actionPerformed(ActionEvent e) {
-			model.removeSelectedVias();			
-		}
-	}
-	
-	class MoveDownAction extends AbstractAction implements ListSelectionListener{		
-		public MoveDownAction(){
-			putValue(NAME, tr("Move down"));
-			putValue(SHORT_DESCRIPTION, tr("Move the selected vias down by one position"));
-			putValue(ACCELERATOR_KEY,KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.ALT_DOWN_MASK));
-			putValue(SMALL_ICON, ImageProvider.get("dialogs", "movedown"));
-			updateEnabledState();
-		}
-		
-		public void actionPerformed(ActionEvent e) {
-			model.moveDown();
-		}
-
-		public void updateEnabledState(){
-			if (getSelectedIndex() < 0) {
-				setEnabled(false);
-				return;
-			}
-			setEnabled(getSelectionModel().getMaxSelectionIndex() < getModel().getSize() -1);
-		}
-		
-		public void valueChanged(ListSelectionEvent e) {
-			updateEnabledState();			
-		}
-	}
-	
-	class MoveUpAction extends AbstractAction implements ListSelectionListener{		
-		public MoveUpAction() {
-			putValue(NAME, tr("Move up"));
-			putValue(SHORT_DESCRIPTION, tr("Move the selected vias up by one position"));
-			putValue(ACCELERATOR_KEY,KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.ALT_DOWN_MASK));
-			putValue(SMALL_ICON, ImageProvider.get("dialogs", "moveup"));
-			updateEnabledState();
-		}
-		
-		public void actionPerformed(ActionEvent e) {
-			model.moveUp();
-		}
-
-		public void updateEnabledState(){
-			if (getSelectedIndex() < 0) {
-				setEnabled(false);
-				return;
-			}
-			setEnabled(getSelectionModel().getMinSelectionIndex() > 0);
-		}
-		
-		public void valueChanged(ListSelectionEvent e) {
-			updateEnabledState();			
-		}
-	}
-
-	class CopyAction extends AbstractAction implements ListSelectionListener {
-		private Action delegate;
-		
-		public CopyAction(){
-			putValue(NAME, tr("Copy"));
-			putValue(SHORT_DESCRIPTION, tr("Copy the selected vias to the clipboard"));
-			putValue(SMALL_ICON, ImageProvider.get("copy"));
-			putValue(ACCELERATOR_KEY, Shortcut.getCopyKeyStroke());
-			delegate = ViaList.this.getActionMap().get("copy");
-		}
-
-		public void actionPerformed(ActionEvent e) {			
-			delegate.actionPerformed(e);
-		}
-
-		protected void updateEnabledState() {
-			setEnabled(!model.getSelectedVias().isEmpty());
-		}
-		
-		public void valueChanged(ListSelectionEvent e) {
-			updateEnabledState();
-		}
-	}
-	
-	class PasteAction extends AbstractAction {
-		private Action delegate;
-		
-		public boolean canPaste() {
-			Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
-			for (DataFlavor df: clipboard.getAvailableDataFlavors()) {
-				if (df.equals(PrimitiveIdTransferable.PRIMITIVE_ID_LIST_FLAVOR)) return true;
-			}			
-			// FIXME: check whether there are selected objects in the JOSM copy/paste buffer  
-			return false;
-		}
-		
-		public PasteAction(){
-			putValue(NAME, tr("Paste"));
-			putValue(SHORT_DESCRIPTION, tr("Insert 'via' objects from the clipboard"));
-			putValue(SMALL_ICON, ImageProvider.get("paste"));
-			putValue(ACCELERATOR_KEY, Shortcut.getPasteKeyStroke());
-			delegate = ViaList.this.getActionMap().get("paste");
-			updateEnabledState();
-		}
-
-		public void updateEnabledState() {
-			setEnabled(canPaste());
-		}
-		
-		public void actionPerformed(ActionEvent e) {
-			delegate.actionPerformed(e);			
-		}
-	}
-	
-	class ViaListPopupMenu extends JPopupMenu {
-		public ViaListPopupMenu() {
-			JMenuItem item = add(actCopy);
-			item.setTransferHandler(transferHandler);			
-			item = add(actPaste);
-			actPaste.updateEnabledState();
-			item.setTransferHandler(transferHandler);
-			addSeparator();
-			add(actDelete);
-			addSeparator();
-			add(actMoveUp);
-			add(actMoveDown);
-		}
-	}
-	
-	class ViaListPopupMenuLaucher extends PopupMenuLauncher {
-		@Override
-		public void launch(MouseEvent evt) {
-			if (getSelectedIndex() <0) {
-				int idx = locationToIndex(evt.getPoint());
-				if (idx >=0) {
-					setSelectedIndex(idx);
-				}
-			}
-			new ViaListPopupMenu().show(ViaList.this, evt.getX(), evt.getY());
-		}		
-	}	
+    
+    static private final Logger logger = Logger.getLogger(ViaList.class.getName());
+
+    private ViaListModel model;
+    private DeleteAction actDelete;
+    private MoveUpAction actMoveUp;
+    private MoveDownAction actMoveDown;
+    private CopyAction actCopy;
+    private PasteAction actPaste;
+    private TransferHandler transferHandler;
+    
+    /**
+     * Constructor 
+     * 
+     * @param model the via list model. Must not be null.
+     * @param selectionModel the selection model. Must not be null.
+     * 
+     */
+    public ViaList(ViaListModel model, DefaultListSelectionModel selectionModel) {
+        super(model);
+        this.model = model;
+        setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
+        setSelectionModel(selectionModel);
+        setCellRenderer(new OsmPrimitivRenderer());
+        setDragEnabled(true);       
+        setTransferHandler(transferHandler =new ViaListTransferHandler(model));
+        setVisibleRowCount(4);
+        
+        actDelete = new DeleteAction();
+        selectionModel.addListSelectionListener(actDelete);
+        registerKeyboardAction(actDelete, KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+        
+        actMoveDown = new MoveDownAction();
+        selectionModel.addListSelectionListener(actMoveDown);
+        registerKeyboardAction(actMoveDown, KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.ALT_DOWN_MASK), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+
+        actMoveUp = new MoveUpAction();
+        selectionModel.addListSelectionListener(actMoveUp);
+        registerKeyboardAction(actMoveUp, KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.ALT_DOWN_MASK), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+        
+        actCopy = new CopyAction();
+        actPaste = new PasteAction();
+        getSelectionModel().addListSelectionListener(actCopy);
+        
+        addMouseListener(new ViaListPopupMenuLaucher());            
+    }
+    
+    /**
+     * The transfer handler for Drag-and-Drop. 
+     */
+    class ViaListTransferHandler extends PrimitiveIdListTransferHandler {
+        Logger logger = Logger.getLogger(ViaListTransferHandler.class.getName());
+        
+        private boolean isViaListInDragOperation = false;
+        private List<Integer> selectedRowsMemento = null;
+        
+        public ViaListTransferHandler(PrimitiveIdListProvider provider) {
+            super(provider);
+        }
+
+        @Override
+        public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) {
+            // a drag operation on itself is always allowed
+            if (isViaListInDragOperation) return true;
+            return isSupportedFlavor(transferFlavors);          
+        }
+
+        @SuppressWarnings("unchecked")
+        @Override
+        public boolean importData(JComponent comp, Transferable t) {    
+            if (!isSupportedFlavor(t.getTransferDataFlavors())) return false;
+            if (isViaListInDragOperation) {
+                // this is a drag operation on itself
+                int targetRow = getSelectedIndex();
+                if (targetRow <0) return true;
+                model.moveVias(selectedRowsMemento, targetRow);             
+            } else {
+                // this is a drag operation from another component
+                try {
+                    List<PrimitiveId> idsToAdd = (List<PrimitiveId>)t.getTransferData(PrimitiveIdTransferable.PRIMITIVE_ID_LIST_FLAVOR);
+                    model.insertVias(idsToAdd);
+                } catch(IOException e){
+                    e.printStackTrace();
+                } catch(UnsupportedFlavorException e){
+                    e.printStackTrace();
+                }
+            }
+            return true;
+        }
+
+        @Override
+        protected void exportDone(JComponent source, Transferable data, int action) {
+            isViaListInDragOperation = false;
+            super.exportDone(source, data, action);
+        }
+
+        @Override
+        public void exportAsDrag(JComponent comp, InputEvent e, int action) {
+            isViaListInDragOperation = true;
+            selectedRowsMemento = model.getSelectedRows();
+            super.exportAsDrag(comp, e, action);
+        }       
+    }   
+    
+    class DeleteAction extends AbstractAction implements ListSelectionListener {
+        public DeleteAction() {
+            putValue(NAME, tr("Remove"));
+            putValue(SMALL_ICON, ImageProvider.get("dialogs", "delete"));
+            putValue(SHORT_DESCRIPTION,tr("Remove the currently selected vias"));       
+            putValue(ACCELERATOR_KEY,KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,0));         
+            updateEnabledState();
+        }
+        
+        public void valueChanged(ListSelectionEvent e) {
+            updateEnabledState();           
+        }
+        
+        public void updateEnabledState() {
+            setEnabled(getSelectedIndex() >= 0);
+        }
+
+        public void actionPerformed(ActionEvent e) {
+            model.removeSelectedVias();         
+        }
+    }
+    
+    class MoveDownAction extends AbstractAction implements ListSelectionListener{       
+        public MoveDownAction(){
+            putValue(NAME, tr("Move down"));
+            putValue(SHORT_DESCRIPTION, tr("Move the selected vias down by one position"));
+            putValue(ACCELERATOR_KEY,KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.ALT_DOWN_MASK));
+            putValue(SMALL_ICON, ImageProvider.get("dialogs", "movedown"));
+            updateEnabledState();
+        }
+        
+        public void actionPerformed(ActionEvent e) {
+            model.moveDown();
+        }
+
+        public void updateEnabledState(){
+            if (getSelectedIndex() < 0) {
+                setEnabled(false);
+                return;
+            }
+            setEnabled(getSelectionModel().getMaxSelectionIndex() < getModel().getSize() -1);
+        }
+        
+        public void valueChanged(ListSelectionEvent e) {
+            updateEnabledState();           
+        }
+    }
+    
+    class MoveUpAction extends AbstractAction implements ListSelectionListener{     
+        public MoveUpAction() {
+            putValue(NAME, tr("Move up"));
+            putValue(SHORT_DESCRIPTION, tr("Move the selected vias up by one position"));
+            putValue(ACCELERATOR_KEY,KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.ALT_DOWN_MASK));
+            putValue(SMALL_ICON, ImageProvider.get("dialogs", "moveup"));
+            updateEnabledState();
+        }
+        
+        public void actionPerformed(ActionEvent e) {
+            model.moveUp();
+        }
+
+        public void updateEnabledState(){
+            if (getSelectedIndex() < 0) {
+                setEnabled(false);
+                return;
+            }
+            setEnabled(getSelectionModel().getMinSelectionIndex() > 0);
+        }
+        
+        public void valueChanged(ListSelectionEvent e) {
+            updateEnabledState();           
+        }
+    }
+
+    class CopyAction extends AbstractAction implements ListSelectionListener {
+        private Action delegate;
+        
+        public CopyAction(){
+            putValue(NAME, tr("Copy"));
+            putValue(SHORT_DESCRIPTION, tr("Copy the selected vias to the clipboard"));
+            putValue(SMALL_ICON, ImageProvider.get("copy"));
+            putValue(ACCELERATOR_KEY, Shortcut.getCopyKeyStroke());
+            delegate = ViaList.this.getActionMap().get("copy");
+        }
+
+        public void actionPerformed(ActionEvent e) {            
+            delegate.actionPerformed(e);
+        }
+
+        protected void updateEnabledState() {
+            setEnabled(!model.getSelectedVias().isEmpty());
+        }
+        
+        public void valueChanged(ListSelectionEvent e) {
+            updateEnabledState();
+        }
+    }
+    
+    class PasteAction extends AbstractAction {
+        private Action delegate;
+        
+        public boolean canPaste() {
+            Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
+            for (DataFlavor df: clipboard.getAvailableDataFlavors()) {
+                if (df.equals(PrimitiveIdTransferable.PRIMITIVE_ID_LIST_FLAVOR)) return true;
+            }           
+            // FIXME: check whether there are selected objects in the JOSM copy/paste buffer  
+            return false;
+        }
+        
+        public PasteAction(){
+            putValue(NAME, tr("Paste"));
+            putValue(SHORT_DESCRIPTION, tr("Insert 'via' objects from the clipboard"));
+            putValue(SMALL_ICON, ImageProvider.get("paste"));
+            putValue(ACCELERATOR_KEY, Shortcut.getPasteKeyStroke());
+            delegate = ViaList.this.getActionMap().get("paste");
+            updateEnabledState();
+        }
+
+        public void updateEnabledState() {
+            setEnabled(canPaste());
+        }
+        
+        public void actionPerformed(ActionEvent e) {
+            delegate.actionPerformed(e);            
+        }
+    }
+    
+    class ViaListPopupMenu extends JPopupMenu {
+        public ViaListPopupMenu() {
+            JMenuItem item = add(actCopy);
+            item.setTransferHandler(transferHandler);           
+            item = add(actPaste);
+            actPaste.updateEnabledState();
+            item.setTransferHandler(transferHandler);
+            addSeparator();
+            add(actDelete);
+            addSeparator();
+            add(actMoveUp);
+            add(actMoveDown);
+        }
+    }
+    
+    class ViaListPopupMenuLaucher extends PopupMenuLauncher {
+        @Override
+        public void launch(MouseEvent evt) {
+            if (getSelectedIndex() <0) {
+                int idx = locationToIndex(evt.getPoint());
+                if (idx >=0) {
+                    setSelectedIndex(idx);
+                }
+            }
+            new ViaListPopupMenu().show(ViaList.this, evt.getX(), evt.getY());
+        }       
+    }   
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/ViaListModel.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/ViaListModel.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/ViaListModel.java	(revision 23192)
@@ -23,223 +23,223 @@
  */
 public class ViaListModel extends AbstractListModel implements PrimitiveIdListProvider, Observer{
-	static private final Logger logger = Logger.getLogger(ViaListModel.class.getName());
-	
-	private DefaultListSelectionModel selectionModel;
-	private final ArrayList<OsmPrimitive> vias = new ArrayList<OsmPrimitive>();
-	private TurnRestrictionEditorModel model;
-	
-	/**
-	 * Constructor 
-	 * 
-	 * @param model the turn restriction editor model. Must not be null.
-	 * @param selectionModel the selection model. Must not be null.
-	 * @throws IllegalArgumentException thrown if model is null
-	 * @throws IllegalArgumentException thrown if selectionModel is null
-	 */
-	public ViaListModel(TurnRestrictionEditorModel model, DefaultListSelectionModel selectionModel) {
-		CheckParameterUtil.ensureParameterNotNull(model, "model");
-		CheckParameterUtil.ensureParameterNotNull(selectionModel, "selectionModel");
-		this.model = model;
-		this.selectionModel = selectionModel;
-		model.addObserver(this);
-		refresh();
-	}
-
-	/**
-	 * Replies the list of currently selected vias
-	 * 
-	 * @return the list of currently selected vias
-	 */
-	public List<OsmPrimitive> getSelectedVias() {
-		ArrayList<OsmPrimitive> ret = new ArrayList<OsmPrimitive>();
-		for (int i=0; i < getSize(); i++) {
-			if (selectionModel.isSelectedIndex(i)) {
-				ret.add(vias.get(i));
-			}
-		}
-		return ret;
-	}
-	
-	/**
-	 * Sets the collection of currently selected vias
-	 * 
-	 *  @param vias a collection of vias 
-	 */
-	public void setSelectedVias(Collection<OsmPrimitive> vias) {
-		selectionModel.clearSelection();
-		if (vias == null) return;
-		for(OsmPrimitive via: vias) {
-			int idx = this.vias.indexOf(via);
-			if (idx < 0) continue;
-			selectionModel.addSelectionInterval(idx, idx);
-		}
-	}
-	
-	/**
-	 * Replies the list of selected rows 
-	 * 
-	 * @return the list of selected rows
-	 */
-	public List<Integer> getSelectedRows() {
-		ArrayList<Integer> ret = new ArrayList<Integer>();
-		for (int i=0; i < getSize(); i++) {
-			if (selectionModel.isSelectedIndex(i)) {
-				ret.add(i);
-			}
-		}
-		return ret;
-	}
-	
-	protected List<Integer> moveUp(List<Integer> rows, int targetRow) {
-		List<Integer> ret = new ArrayList<Integer>(rows.size());
-		int delta = rows.get(0) - targetRow;
-		for(int row: rows) {
-			OsmPrimitive via = vias.remove(row);
-			vias.add(row - delta, via);
-			ret.add(row - delta);
-		}
-		return ret;
-	}
-	
-	protected List<Integer>  moveDown(List<Integer> rows, int targetRow) {
-		List<Integer> ret = new ArrayList<Integer>(rows.size());
-		int delta = targetRow - rows.get(0);
-		for(int i = rows.size()-1; i >=0; i--) {
-			int row = rows.get(i);
-			OsmPrimitive via = vias.remove(row);
-			vias.add(row + delta, via);
-			ret.add(row + delta);
-		}
-		return ret;
-	}
-	
-	public void moveVias(List<Integer> selectedRows, int targetRow){
-		if (selectedRows == null) return;
-		if (selectedRows.size() == 1){
-			int sourceRow = selectedRows.get(0);
-			if (sourceRow == targetRow) return;
-			OsmPrimitive via = vias.remove(sourceRow);
-			vias.add(targetRow, via);
-			fireContentsChanged(this, 0, getSize());
-			selectionModel.setSelectionInterval(targetRow, targetRow);
-			return;
-		} 
-		int min = selectedRows.get(0);
-		int max = selectedRows.get(selectedRows.size()-1);
-		if (targetRow < min) {
-			selectedRows = moveUp(selectedRows, targetRow);
-		} else if (targetRow == min){
-			// do nothing
-		} else if (targetRow - min < getSize() - max){
-			int delta = Math.min(targetRow - min, getSize()-1 - max);
-			targetRow = min + delta;
-			if (targetRow > min) {
-				selectedRows = moveDown(selectedRows, targetRow);
-			}
-		} 
-		fireContentsChanged(this, 0, getSize());
-		selectionModel.clearSelection();
-		for(int row: selectedRows) {
-			selectionModel.addSelectionInterval(row, row);
-		}		
-	}
-	
-	/**
-	 * Move the currently selected vias up by one position
-	 */
-	public void moveUp() {
-		List<Integer> sel = getSelectedRows();
-		if (sel.isEmpty() || sel.get(0) == 0) return;
-		moveVias(sel, sel.get(0)-1);
-	}
-
-	/**
-	 * Move the currently selected vias down by one position
-	 */
-	public void moveDown() {
-		List<Integer> sel = getSelectedRows();
-		if (sel.isEmpty() || sel.get(sel.size()-1) == getSize()-1) return;
-		moveVias(sel, sel.get(sel.size()-1)+1);
-	}
-	
-	/**
-	 * Inserts a list of OSM objects given by OSM primitive ids. 
-	 * 
-	 * @param idsToInsert the ids of the objects to insert
-	 */
-	public void insertVias(List<PrimitiveId> idsToInsert) {
-		if (idsToInsert == null) return;
-		List<OsmPrimitive> primitives = new ArrayList<OsmPrimitive>(idsToInsert.size());
-		DataSet ds = model.getLayer().data;
-		for(PrimitiveId id: idsToInsert){
-			OsmPrimitive p = ds.getPrimitiveById(id);
-			if (p == null){
-				System.out.println(tr("Failed to retrieve OSM object with id {0} from dataset {1}. Cannot add it as ''via''.", id, ds));
-				continue;
-			}
-			primitives.add(p);
-		}
-		int targetRow = Math.max(selectionModel.getMinSelectionIndex(),0);
-		List<OsmPrimitive> newVias = new ArrayList<OsmPrimitive>(vias);
-		newVias.addAll(targetRow, primitives);
-		model.setVias(newVias);
-		fireContentsChanged(this, 0, getSize());
-		selectionModel.clearSelection();
-		for(int i=targetRow; i< targetRow + primitives.size();i++) {
-			selectionModel.addSelectionInterval(i, i);
-		}			
-	}
-
-	/**
-	 * Removes the currently selected vias
-	 */
-	public void removeSelectedVias() {
-		ArrayList<OsmPrimitive> newVias = new ArrayList<OsmPrimitive>(vias);
-		int j = 0;
-		for(int i=0; i< getSize();i++){
-			if (!selectionModel.isSelectedIndex(i)) continue;
-			newVias.remove(i-j);
-			j++;
-		}
-		if (j == 0) return; // nothing selected, nothing deleted
-		model.setVias(newVias);
-	}
-	
-	/**
-	 * Refreshes the list of 'vias' in this model with the current list of
-	 * vias from the turn restriction model. 
-	 */
-	protected void refresh() {
-		List<OsmPrimitive> sel = getSelectedVias();
-		vias.clear();
-		vias.addAll(model.getVias());		
-		fireContentsChanged(this, 0, getSize());
-		setSelectedVias(sel);
-	}
-
-	public Object getElementAt(int index) {
-		return vias.get(index);
-	}
-
-	public int getSize() {
-		return vias.size();
-	}
-	
-	/* ----------------------------------------------------------------------- */
-	/* interface PrimitiveIdListProvider                                       */
-	/* ----------------------------------------------------------------------- */
-	public List<PrimitiveId> getSelectedPrimitiveIds() {
-		ArrayList<PrimitiveId> ids = new ArrayList<PrimitiveId>();
-		for (OsmPrimitive p: getSelectedVias()) {
-			ids.add(p.getPrimitiveId());
-		}
-		return ids;
-	}
-
-	/* ----------------------------------------------------------------------- */
-	/* interface Observer                                                      */
-	/* ----------------------------------------------------------------------- */
-	public void update(Observable o, Object arg) {
-		refresh();
-	}	
+    static private final Logger logger = Logger.getLogger(ViaListModel.class.getName());
+    
+    private DefaultListSelectionModel selectionModel;
+    private final ArrayList<OsmPrimitive> vias = new ArrayList<OsmPrimitive>();
+    private TurnRestrictionEditorModel model;
+    
+    /**
+     * Constructor 
+     * 
+     * @param model the turn restriction editor model. Must not be null.
+     * @param selectionModel the selection model. Must not be null.
+     * @throws IllegalArgumentException thrown if model is null
+     * @throws IllegalArgumentException thrown if selectionModel is null
+     */
+    public ViaListModel(TurnRestrictionEditorModel model, DefaultListSelectionModel selectionModel) {
+        CheckParameterUtil.ensureParameterNotNull(model, "model");
+        CheckParameterUtil.ensureParameterNotNull(selectionModel, "selectionModel");
+        this.model = model;
+        this.selectionModel = selectionModel;
+        model.addObserver(this);
+        refresh();
+    }
+
+    /**
+     * Replies the list of currently selected vias
+     * 
+     * @return the list of currently selected vias
+     */
+    public List<OsmPrimitive> getSelectedVias() {
+        ArrayList<OsmPrimitive> ret = new ArrayList<OsmPrimitive>();
+        for (int i=0; i < getSize(); i++) {
+            if (selectionModel.isSelectedIndex(i)) {
+                ret.add(vias.get(i));
+            }
+        }
+        return ret;
+    }
+    
+    /**
+     * Sets the collection of currently selected vias
+     * 
+     *  @param vias a collection of vias 
+     */
+    public void setSelectedVias(Collection<OsmPrimitive> vias) {
+        selectionModel.clearSelection();
+        if (vias == null) return;
+        for(OsmPrimitive via: vias) {
+            int idx = this.vias.indexOf(via);
+            if (idx < 0) continue;
+            selectionModel.addSelectionInterval(idx, idx);
+        }
+    }
+    
+    /**
+     * Replies the list of selected rows 
+     * 
+     * @return the list of selected rows
+     */
+    public List<Integer> getSelectedRows() {
+        ArrayList<Integer> ret = new ArrayList<Integer>();
+        for (int i=0; i < getSize(); i++) {
+            if (selectionModel.isSelectedIndex(i)) {
+                ret.add(i);
+            }
+        }
+        return ret;
+    }
+    
+    protected List<Integer> moveUp(List<Integer> rows, int targetRow) {
+        List<Integer> ret = new ArrayList<Integer>(rows.size());
+        int delta = rows.get(0) - targetRow;
+        for(int row: rows) {
+            OsmPrimitive via = vias.remove(row);
+            vias.add(row - delta, via);
+            ret.add(row - delta);
+        }
+        return ret;
+    }
+    
+    protected List<Integer>  moveDown(List<Integer> rows, int targetRow) {
+        List<Integer> ret = new ArrayList<Integer>(rows.size());
+        int delta = targetRow - rows.get(0);
+        for(int i = rows.size()-1; i >=0; i--) {
+            int row = rows.get(i);
+            OsmPrimitive via = vias.remove(row);
+            vias.add(row + delta, via);
+            ret.add(row + delta);
+        }
+        return ret;
+    }
+    
+    public void moveVias(List<Integer> selectedRows, int targetRow){
+        if (selectedRows == null) return;
+        if (selectedRows.size() == 1){
+            int sourceRow = selectedRows.get(0);
+            if (sourceRow == targetRow) return;
+            OsmPrimitive via = vias.remove(sourceRow);
+            vias.add(targetRow, via);
+            fireContentsChanged(this, 0, getSize());
+            selectionModel.setSelectionInterval(targetRow, targetRow);
+            return;
+        } 
+        int min = selectedRows.get(0);
+        int max = selectedRows.get(selectedRows.size()-1);
+        if (targetRow < min) {
+            selectedRows = moveUp(selectedRows, targetRow);
+        } else if (targetRow == min){
+            // do nothing
+        } else if (targetRow - min < getSize() - max){
+            int delta = Math.min(targetRow - min, getSize()-1 - max);
+            targetRow = min + delta;
+            if (targetRow > min) {
+                selectedRows = moveDown(selectedRows, targetRow);
+            }
+        } 
+        fireContentsChanged(this, 0, getSize());
+        selectionModel.clearSelection();
+        for(int row: selectedRows) {
+            selectionModel.addSelectionInterval(row, row);
+        }       
+    }
+    
+    /**
+     * Move the currently selected vias up by one position
+     */
+    public void moveUp() {
+        List<Integer> sel = getSelectedRows();
+        if (sel.isEmpty() || sel.get(0) == 0) return;
+        moveVias(sel, sel.get(0)-1);
+    }
+
+    /**
+     * Move the currently selected vias down by one position
+     */
+    public void moveDown() {
+        List<Integer> sel = getSelectedRows();
+        if (sel.isEmpty() || sel.get(sel.size()-1) == getSize()-1) return;
+        moveVias(sel, sel.get(sel.size()-1)+1);
+    }
+    
+    /**
+     * Inserts a list of OSM objects given by OSM primitive ids. 
+     * 
+     * @param idsToInsert the ids of the objects to insert
+     */
+    public void insertVias(List<PrimitiveId> idsToInsert) {
+        if (idsToInsert == null) return;
+        List<OsmPrimitive> primitives = new ArrayList<OsmPrimitive>(idsToInsert.size());
+        DataSet ds = model.getLayer().data;
+        for(PrimitiveId id: idsToInsert){
+            OsmPrimitive p = ds.getPrimitiveById(id);
+            if (p == null){
+                System.out.println(tr("Failed to retrieve OSM object with id {0} from dataset {1}. Cannot add it as ''via''.", id, ds));
+                continue;
+            }
+            primitives.add(p);
+        }
+        int targetRow = Math.max(selectionModel.getMinSelectionIndex(),0);
+        List<OsmPrimitive> newVias = new ArrayList<OsmPrimitive>(vias);
+        newVias.addAll(targetRow, primitives);
+        model.setVias(newVias);
+        fireContentsChanged(this, 0, getSize());
+        selectionModel.clearSelection();
+        for(int i=targetRow; i< targetRow + primitives.size();i++) {
+            selectionModel.addSelectionInterval(i, i);
+        }           
+    }
+
+    /**
+     * Removes the currently selected vias
+     */
+    public void removeSelectedVias() {
+        ArrayList<OsmPrimitive> newVias = new ArrayList<OsmPrimitive>(vias);
+        int j = 0;
+        for(int i=0; i< getSize();i++){
+            if (!selectionModel.isSelectedIndex(i)) continue;
+            newVias.remove(i-j);
+            j++;
+        }
+        if (j == 0) return; // nothing selected, nothing deleted
+        model.setVias(newVias);
+    }
+    
+    /**
+     * Refreshes the list of 'vias' in this model with the current list of
+     * vias from the turn restriction model. 
+     */
+    protected void refresh() {
+        List<OsmPrimitive> sel = getSelectedVias();
+        vias.clear();
+        vias.addAll(model.getVias());       
+        fireContentsChanged(this, 0, getSize());
+        setSelectedVias(sel);
+    }
+
+    public Object getElementAt(int index) {
+        return vias.get(index);
+    }
+
+    public int getSize() {
+        return vias.size();
+    }
+    
+    /* ----------------------------------------------------------------------- */
+    /* interface PrimitiveIdListProvider                                       */
+    /* ----------------------------------------------------------------------- */
+    public List<PrimitiveId> getSelectedPrimitiveIds() {
+        ArrayList<PrimitiveId> ids = new ArrayList<PrimitiveId>();
+        for (OsmPrimitive p: getSelectedVias()) {
+            ids.add(p.getPrimitiveId());
+        }
+        return ids;
+    }
+
+    /* ----------------------------------------------------------------------- */
+    /* interface Observer                                                      */
+    /* ----------------------------------------------------------------------- */
+    public void update(Observable o, Object arg) {
+        refresh();
+    }   
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/AbstractTurnRestrictionsListView.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/AbstractTurnRestrictionsListView.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/AbstractTurnRestrictionsListView.java	(revision 23192)
@@ -15,26 +15,26 @@
  */
 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);
-	}
-	
-	public void initIconSetFromPreferences(Preferences prefs){
-		TurnRestrictionCellRenderer renderer = (TurnRestrictionCellRenderer)lstTurnRestrictions.getCellRenderer();
-		renderer.initIconSetFromPreferences(prefs);
-	}
+    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);
+    }
+    
+    public void initIconSetFromPreferences(Preferences prefs){
+        TurnRestrictionCellRenderer renderer = (TurnRestrictionCellRenderer)lstTurnRestrictions.getCellRenderer();
+        renderer.initIconSetFromPreferences(prefs);
+    }
 }
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 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionCellRenderer.java	(revision 23192)
@@ -41,218 +41,218 @@
  */
 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;
-	private String iconSet = "set-a";
-	
-	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/" + iconSet + "/" + 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 ImageProvider.get("types", "non-standard-type");
-		}
-		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");
-		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);
-	}
-
-	/**
-	 * Initializes the set of icons used from the preference key
-	 * {@see PreferenceKeys#ROAD_SIGNS}.
-	 * 
-	 * @param prefs the JOSM preferences 
-	 */
-	public void initIconSetFromPreferences(Preferences prefs){
-		
-		iconSet = prefs.get(PreferenceKeys.ROAD_SIGNS, "set-a");
-		iconSet = iconSet.trim().toLowerCase();
-		if (!iconSet.equals("set-a") && !iconSet.equals("set-b")) {
-			iconSet = "set-a";
-		}
-	}
-	
-	/* ---------------------------------------------------------------------------------- */
-	/* 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;
-	}	
+    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;
+    private String iconSet = "set-a";
+    
+    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/" + iconSet + "/" + 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 ImageProvider.get("types", "non-standard-type");
+        }
+        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");
+        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);
+    }
+
+    /**
+     * Initializes the set of icons used from the preference key
+     * {@see PreferenceKeys#ROAD_SIGNS}.
+     * 
+     * @param prefs the JOSM preferences 
+     */
+    public void initIconSetFromPreferences(Preferences prefs){
+        
+        iconSet = prefs.get(PreferenceKeys.ROAD_SIGNS, "set-a");
+        iconSet = iconSet.trim().toLowerCase();
+        if (!iconSet.equals("set-a") && !iconSet.equals("set-b")) {
+            iconSet = "set-a";
+        }
+    }
+    
+    /* ---------------------------------------------------------------------------------- */
+    /* 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: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsInDatasetListModel.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsInDatasetListModel.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsInDatasetListModel.java	(revision 23192)
@@ -34,99 +34,99 @@
  */
 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);
-		}
-	}
+    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 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 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 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 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 */}
+    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/list/TurnRestrictionsInDatasetView.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsInDatasetView.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsInDatasetView.java	(revision 23192)
@@ -18,32 +18,32 @@
  * 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 TurnRestrictionCellRenderer());
-		
-		setLayout(new BorderLayout());
-		add(new JScrollPane(lstTurnRestrictions), BorderLayout.CENTER);
-	}
+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 TurnRestrictionCellRenderer());
+        
+        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 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);
-	}
+    protected void unregisterAsListener() {
+        MapView.removeEditLayerChangeListener((EditLayerChangeListener)model);
+        DatasetEventManager.getInstance().removeDatasetListener((DataSetListener)model);
+    }
 
-	public TurnRestrictionsInDatasetView() {
-		build();
-	}
+    public TurnRestrictionsInDatasetView() {
+        build();
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsInSelectionListModel.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsInSelectionListModel.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsInSelectionListModel.java	(revision 23192)
@@ -19,45 +19,45 @@
  */
 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);
-	}
+    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);
-	}
+    /* --------------------------------------------------------------------------- */
+    /* 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/list/TurnRestrictionsInSelectionView.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsInSelectionView.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsInSelectionView.java	(revision 23192)
@@ -24,34 +24,34 @@
 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 TurnRestrictionCellRenderer());
-		
-		setLayout(new BorderLayout());
-		add(new JScrollPane(lstTurnRestrictions), BorderLayout.CENTER);
-	}
+    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 TurnRestrictionCellRenderer());
+        
+        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);
-		TurnRestrictionsInSelectionListModel m = (TurnRestrictionsInSelectionListModel)model;
-		if (Main.main.getEditLayer() != null){
-			m.initFromSelection(Main.main.getEditLayer().data.getSelected());
-		} else {
-			m.initFromSelection(Collections.<OsmPrimitive>emptyList());
-		}
-	}
+    protected void registerAsListener() {
+        MapView.addEditLayerChangeListener((EditLayerChangeListener)model);
+        SelectionEventManager.getInstance().addSelectionListener((SelectionChangedListener)model, FireMode.IN_EDT_CONSOLIDATED);
+        TurnRestrictionsInSelectionListModel m = (TurnRestrictionsInSelectionListModel)model;
+        if (Main.main.getEditLayer() != null){
+            m.initFromSelection(Main.main.getEditLayer().data.getSelected());
+        } else {
+            m.initFromSelection(Collections.<OsmPrimitive>emptyList());
+        }
+    }
 
-	protected void unregisterAsListener() {
-		MapView.removeEditLayerChangeListener((EditLayerChangeListener)model);
-		SelectionEventManager.getInstance().removeSelectionListener((SelectionChangedListener)model);		
-	}
+    protected void unregisterAsListener() {
+        MapView.removeEditLayerChangeListener((EditLayerChangeListener)model);
+        SelectionEventManager.getInstance().removeSelectionListener((SelectionChangedListener)model);       
+    }
 
-	public TurnRestrictionsInSelectionView() {
-		build();
-	}
+    public TurnRestrictionsInSelectionView() {
+        build();
+    }
 }
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 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsListDialog.java	(revision 23192)
@@ -52,162 +52,162 @@
  */
 public class TurnRestrictionsListDialog extends ToggleDialog{
-	private static final Logger logger = Logger.getLogger(TurnRestrictionsListDialog.class.getName());
-
-	/** checkbox for switching between the two list views */
-	private JCheckBox cbInSelectionOnly;
-	/** the view for the turn restrictions in the current data set */
-	private TurnRestrictionsInDatasetView pnlTurnRestrictionsInDataSet;
-	/** the view for the turn restrictions related to the current selection */
-	private TurnRestrictionsInSelectionView pnlTurnRestrictionsInSelection;
-	
-	/** three actions */
-	private NewAction actNew;
-	private EditAction actEdit;
-	private DeleteAction actDelete;	 
-	private SelectSelectedTurnRestrictions actSelectSelectedTurnRestrictions;
-	private ZoomToAction actZoomTo;
-	private SwitchListViewHandler switchListViewHandler;
-	
-	private AbstractTurnRestrictionsListView currentListView = null;
-	
-	/** the main content panel in this toggle dialog */
-	private JPanel pnlContent;
-	private PreferenceChangeHandler preferenceChangeHandler;
-	
-	@Override
-	public void showNotify() {
-		pnlTurnRestrictionsInDataSet.registerAsListener();		
-		pnlTurnRestrictionsInSelection.registerAsListener();
-		MapView.addEditLayerChangeListener(actNew);
-		actNew.updateEnabledState();
-		Main.pref.addPreferenceChangeListener(preferenceChangeHandler);
-		preferenceChangeHandler.refreshIconSet();
-	}
-
-	@Override
-	public void hideNotify() {
-		pnlTurnRestrictionsInDataSet.unregisterAsListener();
-		pnlTurnRestrictionsInSelection.unregisterAsListener();
-		MapView.removeEditLayerChangeListener(actNew);
-		Main.pref.removePreferenceChangeListener(preferenceChangeHandler);
-	}
-
-	/**
-	 * Builds the panel with the checkbox for switching between the two
-	 * list views
-	 * 
-	 * @return the panel
-	 */
-	protected JPanel buildInSelectionOnlyTogglePanel(){
-		JPanel pnl = new JPanel(new FlowLayout(FlowLayout.LEFT,0,0));
-		pnl.setBorder(null);
-		pnl.add(cbInSelectionOnly = new JCheckBox(tr("Only participating in selection")));
-		cbInSelectionOnly.setToolTipText(tr(
-		   "<html>Select to display turn restrictions related to object in the current selection only.<br>"
-		 + "Deselect to display all turn restrictions in the current data set.</html>"));
-		return pnl;
-	}
-	
-	/**
-	 * Builds the panel with the action buttons 
-	 * 
-	 * @return the panel 
-	 */
-	protected JPanel buildCommandPanel() {
-		JPanel pnl = new JPanel(new FlowLayout(FlowLayout.LEFT,0,0));
-		pnl.setBorder(null);
-		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;
-	}
-	
-	/**
-	 * Builds the UI
-	 */
-	protected void build() {
-		pnlContent = new JPanel(new BorderLayout(0,0));
-		pnlContent.setBorder(null);
-		pnlContent.add(buildInSelectionOnlyTogglePanel(),  BorderLayout.NORTH);
-		pnlContent.add(buildCommandPanel(), BorderLayout.SOUTH);
-		
-		add(pnlContent, BorderLayout.CENTER);
-		
-		// create the two list views 
-		pnlTurnRestrictionsInDataSet = new TurnRestrictionsInDatasetView();
-		pnlTurnRestrictionsInSelection = new TurnRestrictionsInSelectionView();
-		
-		// wire the handler for switching between list views 
-		switchListViewHandler = new SwitchListViewHandler();
-		switchListViewHandler.activateListView(pnlTurnRestrictionsInDataSet);
-		cbInSelectionOnly.addItemListener(switchListViewHandler);
-		
-		// wire the popup menu launcher to the two turn restriction lists  
-		TurnRestrictionsPopupLauncher launcher = new TurnRestrictionsPopupLauncher();
-		pnlTurnRestrictionsInDataSet.getList().addMouseListener(launcher);
-		pnlTurnRestrictionsInSelection.getList().addMouseListener(launcher);
-		
-		preferenceChangeHandler = new PreferenceChangeHandler();
-		
-	}
-	
-	/**
-	 * Constructor
-	 */
-	public TurnRestrictionsListDialog() {
-		super(
-				tr("Turn Restrictions"), 
-				"turnrestrictions",
-				tr("Display and manage turn restrictions in the current data set"),
-				null, // no shortcut
-				150   // default height
-		);
-		build();
-		HelpUtil.setHelpContext(this, HelpUtil.ht("/Plugins/turnrestrictions#TurnRestrictionToggleDialog"));
-	}	
-	
-	/**
-	 * Switches between the two list view.
-	 */
-	class SwitchListViewHandler implements ItemListener {
-		public void activateListView(AbstractTurnRestrictionsListView view) {
-			if (currentListView != null) {
-				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();
-			actSelectSelectedTurnRestrictions.updateEnabledState();
-			actZoomTo.updateEnabledState();
-			currentListView.revalidate();
-			currentListView.repaint();			
-		}
-
-		public void itemStateChanged(ItemEvent e) {
-			switch(e.getStateChange()) {
-			case ItemEvent.SELECTED:
-				activateListView(pnlTurnRestrictionsInSelection);
-				break;
-				
-			case ItemEvent.DESELECTED:		
-				activateListView(pnlTurnRestrictionsInDataSet);
-				break;
-			}
-		}
-	}
-	
-	 /**
+    private static final Logger logger = Logger.getLogger(TurnRestrictionsListDialog.class.getName());
+
+    /** checkbox for switching between the two list views */
+    private JCheckBox cbInSelectionOnly;
+    /** the view for the turn restrictions in the current data set */
+    private TurnRestrictionsInDatasetView pnlTurnRestrictionsInDataSet;
+    /** the view for the turn restrictions related to the current selection */
+    private TurnRestrictionsInSelectionView pnlTurnRestrictionsInSelection;
+    
+    /** three actions */
+    private NewAction actNew;
+    private EditAction actEdit;
+    private DeleteAction actDelete;  
+    private SelectSelectedTurnRestrictions actSelectSelectedTurnRestrictions;
+    private ZoomToAction actZoomTo;
+    private SwitchListViewHandler switchListViewHandler;
+    
+    private AbstractTurnRestrictionsListView currentListView = null;
+    
+    /** the main content panel in this toggle dialog */
+    private JPanel pnlContent;
+    private PreferenceChangeHandler preferenceChangeHandler;
+    
+    @Override
+    public void showNotify() {
+        pnlTurnRestrictionsInDataSet.registerAsListener();      
+        pnlTurnRestrictionsInSelection.registerAsListener();
+        MapView.addEditLayerChangeListener(actNew);
+        actNew.updateEnabledState();
+        Main.pref.addPreferenceChangeListener(preferenceChangeHandler);
+        preferenceChangeHandler.refreshIconSet();
+    }
+
+    @Override
+    public void hideNotify() {
+        pnlTurnRestrictionsInDataSet.unregisterAsListener();
+        pnlTurnRestrictionsInSelection.unregisterAsListener();
+        MapView.removeEditLayerChangeListener(actNew);
+        Main.pref.removePreferenceChangeListener(preferenceChangeHandler);
+    }
+
+    /**
+     * Builds the panel with the checkbox for switching between the two
+     * list views
+     * 
+     * @return the panel
+     */
+    protected JPanel buildInSelectionOnlyTogglePanel(){
+        JPanel pnl = new JPanel(new FlowLayout(FlowLayout.LEFT,0,0));
+        pnl.setBorder(null);
+        pnl.add(cbInSelectionOnly = new JCheckBox(tr("Only participating in selection")));
+        cbInSelectionOnly.setToolTipText(tr(
+           "<html>Select to display turn restrictions related to object in the current selection only.<br>"
+         + "Deselect to display all turn restrictions in the current data set.</html>"));
+        return pnl;
+    }
+    
+    /**
+     * Builds the panel with the action buttons 
+     * 
+     * @return the panel 
+     */
+    protected JPanel buildCommandPanel() {
+        JPanel pnl = new JPanel(new FlowLayout(FlowLayout.LEFT,0,0));
+        pnl.setBorder(null);
+        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;
+    }
+    
+    /**
+     * Builds the UI
+     */
+    protected void build() {
+        pnlContent = new JPanel(new BorderLayout(0,0));
+        pnlContent.setBorder(null);
+        pnlContent.add(buildInSelectionOnlyTogglePanel(),  BorderLayout.NORTH);
+        pnlContent.add(buildCommandPanel(), BorderLayout.SOUTH);
+        
+        add(pnlContent, BorderLayout.CENTER);
+        
+        // create the two list views 
+        pnlTurnRestrictionsInDataSet = new TurnRestrictionsInDatasetView();
+        pnlTurnRestrictionsInSelection = new TurnRestrictionsInSelectionView();
+        
+        // wire the handler for switching between list views 
+        switchListViewHandler = new SwitchListViewHandler();
+        switchListViewHandler.activateListView(pnlTurnRestrictionsInDataSet);
+        cbInSelectionOnly.addItemListener(switchListViewHandler);
+        
+        // wire the popup menu launcher to the two turn restriction lists  
+        TurnRestrictionsPopupLauncher launcher = new TurnRestrictionsPopupLauncher();
+        pnlTurnRestrictionsInDataSet.getList().addMouseListener(launcher);
+        pnlTurnRestrictionsInSelection.getList().addMouseListener(launcher);
+        
+        preferenceChangeHandler = new PreferenceChangeHandler();
+        
+    }
+    
+    /**
+     * Constructor
+     */
+    public TurnRestrictionsListDialog() {
+        super(
+                tr("Turn Restrictions"), 
+                "turnrestrictions",
+                tr("Display and manage turn restrictions in the current data set"),
+                null, // no shortcut
+                150   // default height
+        );
+        build();
+        HelpUtil.setHelpContext(this, HelpUtil.ht("/Plugins/turnrestrictions#TurnRestrictionToggleDialog"));
+    }   
+    
+    /**
+     * Switches between the two list view.
+     */
+    class SwitchListViewHandler implements ItemListener {
+        public void activateListView(AbstractTurnRestrictionsListView view) {
+            if (currentListView != null) {
+                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();
+            actSelectSelectedTurnRestrictions.updateEnabledState();
+            actZoomTo.updateEnabledState();
+            currentListView.revalidate();
+            currentListView.repaint();          
+        }
+
+        public void itemStateChanged(ItemEvent e) {
+            switch(e.getStateChange()) {
+            case ItemEvent.SELECTED:
+                activateListView(pnlTurnRestrictionsInSelection);
+                break;
+                
+            case ItemEvent.DESELECTED:      
+                activateListView(pnlTurnRestrictionsInDataSet);
+                break;
+            }
+        }
+    }
+    
+     /**
      * The edit action
      *
@@ -231,21 +231,21 @@
         }
 
-		public void launchEditor(Relation toEdit) {
-			if (toEdit == null)
-				return;
-			OsmDataLayer layer = Main.main.getEditLayer();
-			TurnRestrictionEditorManager manager = TurnRestrictionEditorManager.getInstance();
-			TurnRestrictionEditor editor = manager.getEditorForRelation(layer, toEdit);
-			if (editor != null) {
-				editor.setVisible(true);
-				editor.toFront();
-			} else {
-				editor = new TurnRestrictionEditor(
-						TurnRestrictionsListDialog.this, layer,toEdit);
-				manager.positionOnScreen(editor);
-				manager.register(layer, toEdit,editor);
-				editor.setVisible(true);
-			}
-		}
+        public void launchEditor(Relation toEdit) {
+            if (toEdit == null)
+                return;
+            OsmDataLayer layer = Main.main.getEditLayer();
+            TurnRestrictionEditorManager manager = TurnRestrictionEditorManager.getInstance();
+            TurnRestrictionEditor editor = manager.getEditorForRelation(layer, toEdit);
+            if (editor != null) {
+                editor.setVisible(true);
+                editor.toFront();
+            } else {
+                editor = new TurnRestrictionEditor(
+                        TurnRestrictionsListDialog.this, layer,toEdit);
+                manager.positionOnScreen(editor);
+                manager.register(layer, toEdit,editor);
+                editor.setVisible(true);
+            }
+        }
 
         public void actionPerformed(ActionEvent e) {
@@ -258,5 +258,5 @@
 
         public void updateEnabledState() {
-        	setEnabled(currentListView!= null && currentListView.getModel().getSelectedTurnRestrictions().size() == 1);
+            setEnabled(currentListView!= null && currentListView.getModel().getSelectedTurnRestrictions().size() == 1);
         }
         
@@ -298,9 +298,9 @@
         
         public void updateEnabledState() {
-        	setEnabled(currentListView != null && !currentListView.getModel().getSelectedTurnRestrictions().isEmpty());
+            setEnabled(currentListView != null && !currentListView.getModel().getSelectedTurnRestrictions().isEmpty());
         }
 
         public void valueChanged(ListSelectionEvent e) {
-        	updateEnabledState();
+            updateEnabledState();
         }
     }
@@ -319,8 +319,8 @@
 
         public void run() {
-        	 OsmDataLayer layer =  Main.main.getEditLayer();
-        	 if (layer == null) return;
-        	 Relation tr = new TurnRestrictionBuilder().buildFromSelection(layer);
-        	 TurnRestrictionEditor editor = new TurnRestrictionEditor(TurnRestrictionsListDialog.this, layer, tr);
+             OsmDataLayer layer =  Main.main.getEditLayer();
+             if (layer == null) return;
+             Relation tr = new TurnRestrictionBuilder().buildFromSelection(layer);
+             TurnRestrictionEditor editor = new TurnRestrictionEditor(TurnRestrictionsListDialog.this, layer, tr);
              TurnRestrictionEditorManager.getInstance().positionOnScreen(editor);             
              TurnRestrictionEditorManager.getInstance().register(layer, tr, editor);
@@ -336,8 +336,8 @@
         }
 
-		public void editLayerChanged(OsmDataLayer oldLayer,
-				OsmDataLayer newLayer) {
-            updateEnabledState();
-		}
+        public void editLayerChanged(OsmDataLayer oldLayer,
+                OsmDataLayer newLayer) {
+            updateEnabledState();
+        }
     }
     
@@ -367,9 +367,9 @@
         
         public void updateEnabledState() {
-        	setEnabled(currentListView != null && !currentListView.getModel().getSelectedTurnRestrictions().isEmpty());
+            setEnabled(currentListView != null && !currentListView.getModel().getSelectedTurnRestrictions().isEmpty());
         }
 
         public void valueChanged(ListSelectionEvent e) {
-        	updateEnabledState();
+            updateEnabledState();
         }
     }
@@ -401,9 +401,9 @@
         
         public void updateEnabledState() {
-        	setEnabled(currentListView != null && !currentListView.getModel().getSelectedTurnRestrictions().isEmpty());
+            setEnabled(currentListView != null && !currentListView.getModel().getSelectedTurnRestrictions().isEmpty());
         }
 
         public void valueChanged(ListSelectionEvent e) {
-        	updateEnabledState();
+            updateEnabledState();
         }
     }
@@ -448,15 +448,15 @@
      *
      */
-    class PreferenceChangeHandler implements PreferenceChangedListener {    	
-    	public void refreshIconSet() {
-    		pnlTurnRestrictionsInDataSet.initIconSetFromPreferences(Main.pref);
-			pnlTurnRestrictionsInSelection.initIconSetFromPreferences(Main.pref);
-			repaint();
-    	}
-    	
-		public void preferenceChanged(PreferenceChangeEvent evt) {			
-			if (!evt.getKey().equals(PreferenceKeys.ROAD_SIGNS)) return;
-			refreshIconSet();
-		}
+    class PreferenceChangeHandler implements PreferenceChangedListener {        
+        public void refreshIconSet() {
+            pnlTurnRestrictionsInDataSet.initIconSetFromPreferences(Main.pref);
+            pnlTurnRestrictionsInSelection.initIconSetFromPreferences(Main.pref);
+            repaint();
+        }
+        
+        public void preferenceChanged(PreferenceChangeEvent evt) {          
+            if (!evt.getKey().equals(PreferenceKeys.ROAD_SIGNS)) return;
+            refreshIconSet();
+        }
     }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsListModel.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsListModel.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/list/TurnRestrictionsListModel.java	(revision 23192)
@@ -73,9 +73,9 @@
      */
     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;
+        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;
     }
     
@@ -122,6 +122,6 @@
                 continue;
             }
-			turnrestrictions.add(r);
-			added = true;
+            turnrestrictions.add(r);
+            added = true;
         }
         if (added) {
@@ -143,5 +143,5 @@
         Set<Relation> removedTurnRestrictions = new HashSet<Relation>();
         for (OsmPrimitive p: removedPrimitives) {
-        	if (!isTurnRestriction(p)) continue;
+            if (!isTurnRestriction(p)) continue;
             removedTurnRestrictions.add((Relation)p);
         }
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 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/PreferenceEditor.java	(revision 23192)
@@ -31,105 +31,105 @@
  */
 public class PreferenceEditor extends JPanel implements PreferenceSetting{
-	
-	private PreferencesPanel pnlIconPreferences;
+    
+    private PreferencesPanel pnlIconPreferences;
 
-	/**
-	 * 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>"
-				+ tr("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;
-	}
+    /**
+     * 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>"
+                + tr("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 JPanel buildIconPreferencePanel() {
-		JPanel pnl = new JPanel(new BorderLayout());
-		
-		pnlIconPreferences = new PreferencesPanel();
-		pnlIconPreferences.initFromPreferences(Main.pref);
-		
-		JScrollPane sp = new JScrollPane(pnlIconPreferences);
-		sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
-		sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
-		
-		pnl.add(sp, BorderLayout.CENTER);
-		return pnl;
-	}
-	
-	protected void build() {
-		setLayout(new BorderLayout());
-		JTabbedPane tp = new JTabbedPane();
-		tp.add(buildIconPreferencePanel());
-		tp.add(buildCreditPanel());		
-		tp.setTitleAt(0, tr("Preferences"));
-		tp.setToolTipTextAt(0,tr("Configure the preferences for the turnrestrictions plugin"));
-		tp.setTitleAt(1, 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);
+    protected JPanel buildIconPreferencePanel() {
+        JPanel pnl = new JPanel(new BorderLayout());
+        
+        pnlIconPreferences = new PreferencesPanel();
+        pnlIconPreferences.initFromPreferences(Main.pref);
+        
+        JScrollPane sp = new JScrollPane(pnlIconPreferences);
+        sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+        sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
+        
+        pnl.add(sp, BorderLayout.CENTER);
+        return pnl;
+    }
+    
+    protected void build() {
+        setLayout(new BorderLayout());
+        JTabbedPane tp = new JTabbedPane();
+        tp.add(buildIconPreferencePanel());
+        tp.add(buildCreditPanel());     
+        tp.setTitleAt(0, tr("Preferences"));
+        tp.setToolTipTextAt(0,tr("Configure the preferences for the turnrestrictions plugin"));
+        tp.setTitleAt(1, 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() {
-		pnlIconPreferences.saveToPreferences(Main.pref);
-		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();
-			}
-		}
+    public boolean ok() {
+        pnlIconPreferences.saveToPreferences(Main.pref);
+        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();
-		}
-	}
+        @Override
+        public void mouseClicked(MouseEvent e) {
+            launchBrowser();
+        }
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/PreferenceKeys.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/PreferenceKeys.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/PreferenceKeys.java	(revision 23192)
@@ -9,32 +9,32 @@
  */
 public interface PreferenceKeys {
-	/**
-	 * Indicates which of two sets of road sign icons to use. Supported
-	 * values are:
-	 * <ul>
-	 *   <li><tt>set-a</tt> - the set of icons in the directory <tt>/images/types/set-a</tt></li>
-	 *   <li><tt>set-b</tt> - the set of icons in the directory <tt>/images/types/set-b</tt></li>
-	 * </ul>
-	 * 
-	 */
-	String ROAD_SIGNS = "turnrestrictions.road-signs";
-	
-	/**
-	 * Indicates whether the Basic Editor should include a widget for for displaying
-	 * and editing the via-objects of a turn restriction.
-	 * 
-	 * Supported values are:
-	 * <ul>
-	 *   <li><tt>true</tt> - display the list of vias in the basic editor </li>
-	 *    <li><tt>false</tt> - don't display the list of vias in the basic editor </li>
-	 * </ul>
-	 */
-	String SHOW_VIAS_IN_BASIC_EDITOR = "turnrestrictions.show-vias-in-basic-editor";
-	
-	/**
-	 * The shortcut which triggers creating a new or editing and existing turn
-	 * restriction. The value must be parseable by {@see KeyStroke#getKeyStroke(String)}.
-	 * If missing, the default value "ctrl shift T" is assumed.
-	 */
-	String EDIT_SHORTCUT= "turnrestrictions.edit-shortcut";
+    /**
+     * Indicates which of two sets of road sign icons to use. Supported
+     * values are:
+     * <ul>
+     *   <li><tt>set-a</tt> - the set of icons in the directory <tt>/images/types/set-a</tt></li>
+     *   <li><tt>set-b</tt> - the set of icons in the directory <tt>/images/types/set-b</tt></li>
+     * </ul>
+     * 
+     */
+    String ROAD_SIGNS = "turnrestrictions.road-signs";
+    
+    /**
+     * Indicates whether the Basic Editor should include a widget for for displaying
+     * and editing the via-objects of a turn restriction.
+     * 
+     * Supported values are:
+     * <ul>
+     *   <li><tt>true</tt> - display the list of vias in the basic editor </li>
+     *    <li><tt>false</tt> - don't display the list of vias in the basic editor </li>
+     * </ul>
+     */
+    String SHOW_VIAS_IN_BASIC_EDITOR = "turnrestrictions.show-vias-in-basic-editor";
+    
+    /**
+     * The shortcut which triggers creating a new or editing and existing turn
+     * restriction. The value must be parseable by {@see KeyStroke#getKeyStroke(String)}.
+     * If missing, the default value "ctrl shift T" is assumed.
+     */
+    String EDIT_SHORTCUT= "turnrestrictions.edit-shortcut";
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/PreferencesPanel.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/PreferencesPanel.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/PreferencesPanel.java	(revision 23192)
@@ -30,203 +30,203 @@
  */
 public class PreferencesPanel extends VerticallyScrollablePanel {
-	private static final Logger logger = Logger.getLogger(PreferencesPanel.class.getName());
-	private JRadioButton rbSetA;
-	private JRadioButton rbSetB;
-	private ButtonGroup bgIconSet;
-	private JCheckBox cbShowViaListInBasicEditor;
-	private ShortcutPreferencePanel pnlShortcutPreference;
-	
-	protected JPanel buildShowViaListInBasicEditorPanel() {
-		JPanel pnl = new JPanel(new GridBagLayout());
-		GridBagConstraints gc = new GridBagConstraints();
-		gc.anchor = GridBagConstraints.NORTHWEST;
-		gc.fill = GridBagConstraints.HORIZONTAL;
-		gc.weightx = 1.0;
-		gc.gridx = 0;
-		gc.gridy = 0;
-		
-		HtmlPanel msg = new HtmlPanel();
-		msg.setText("<html><body>"
-				+ tr("The Basic Editor can optionally display the list of via-objects "
-					 + "of a turn restriction. If enabled, one can edit them "
-					 + "in the Basic editor too. If disabled, editing of via-objects is "
-					 + "possible in the Advanced Editor only."
-				  )
-				+ "</body></html>"
-	    );
-		pnl.add(msg, gc);
-		
-		gc.gridy++;
-		pnl.add(cbShowViaListInBasicEditor = new JCheckBox(tr("Display and edit list of via-objects in the Basic Editor")), gc);
-		return pnl;
-	}
-	
-	/**
-	 * Builds the panel for the icon set "set-a"
-	 * 
-	 * @return
-	 */
-	protected JPanel buildSetAPanel() {
-		JPanel pnl = new JPanel(new GridBagLayout());;
-		GridBagConstraints gc = new GridBagConstraints();
-		gc.anchor = GridBagConstraints.NORTHWEST;
-		gc.fill = GridBagConstraints.HORIZONTAL;
-		gc.weightx = 1.0;
-		gc.gridx = 0;
-		gc.gridy = 0;
-		
-		pnl.add(rbSetA = new JRadioButton(tr("Road signs - Set A")),gc);
-		
-		JPanel icons = new JPanel(new FlowLayout(FlowLayout.LEFT));
-		for (TurnRestrictionType type: TurnRestrictionType.values()){
-			JLabel lbl = new JLabel();
-			icons.add(lbl);
-			lbl.setIcon(ImageProvider.get("types/set-a",type.getTagValue()));
-		}
-		
-		gc.gridy = 1;
-		gc.insets = new Insets(0,20,0,0);
-		pnl.add(icons, gc);
-		return pnl;		
-	}
-	
-	/**
-	 * Builds the panel for the icon set "set-b"
-	 * 
-	 * @return
-	 */
-	protected JPanel buildSetBPanel() {
-		JPanel pnl = new JPanel(new GridBagLayout());;
-		GridBagConstraints gc = new GridBagConstraints();
-		gc.anchor = GridBagConstraints.NORTHWEST;
-		gc.fill = GridBagConstraints.HORIZONTAL;
-		gc.weightx = 1.0;
-		gc.gridx = 0;
-		gc.gridy = 0;
-		
-		pnl.add(rbSetB = new JRadioButton(tr("Road signs - Set B")),gc);
-		
-		JPanel icons = new JPanel(new FlowLayout(FlowLayout.LEFT));
-		for (TurnRestrictionType type: TurnRestrictionType.values()){
-			JLabel lbl = new JLabel();
-			icons.add(lbl);
-			lbl.setIcon(ImageProvider.get("types/set-b",type.getTagValue()));
-		}
-		
-		gc.gridy = 1;
-		gc.insets = new Insets(0,20,0,0);
-		pnl.add(icons, gc);
-		return pnl;		
-	}
-	
-	/**
-	 * Builds the message panel at the top
-	 * 
-	 * @return
-	 */
-	protected JPanel buildMessagePanel() {
-		HtmlPanel pnl = new HtmlPanel();
-		pnl.setText(
-				"<html><body>"
-			  + tr("Please select the set of road sign icons to be used in the plugin.")
-			  + "</body></html>"
-		);
-		return pnl;
-	}
-	
-	/**
-	 * Builds the UI
-	 * 
-	 * @return
-	 */
-	protected void build() {			
-		setLayout(new GridBagLayout());
-		GridBagConstraints gc = new GridBagConstraints();
-		gc.anchor = GridBagConstraints.NORTHWEST;
-		gc.fill = GridBagConstraints.HORIZONTAL;
-		gc.weightx = 1.0;
-		gc.gridx = 0;
-		gc.gridy = 0;
-		
-		add(buildMessagePanel(), gc);
-		gc.gridy++;
-		add(buildSetAPanel(), gc);
-		gc.gridy++;
-		add(buildSetBPanel(), gc);
-		gc.gridy++;
-		add(new JSeparator(), gc);		
-		gc.gridy++;
-		add(buildShowViaListInBasicEditorPanel(), gc);
-		gc.gridy++;
-		add(new JSeparator(), gc);
-		gc.gridy++;
-		add(pnlShortcutPreference = new ShortcutPreferencePanel(), gc);
-		
-		// filler - just grab remaining space
-		gc.gridy++;
-		gc.fill = GridBagConstraints.BOTH;
-		gc.weighty = 1.0;
-		add(new JPanel(), gc);		 
-		
-		bgIconSet = new ButtonGroup();
-		bgIconSet.add(rbSetA);
-		bgIconSet.add(rbSetB);
-		
-		setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
-	}
-	
-	/**
-	 * Initializes the UI from the current settings in the JOSM preferences
-	 * {@code prefs}
-	 * 
-	 * @param prefs the preferences 
-	 */
-	public void initFromPreferences(Preferences prefs){
-		String set = prefs.get(PreferenceKeys.ROAD_SIGNS, "set-a");
-		set = set.trim().toLowerCase();
-		if (! set.equals("set-a") && ! set.equals("set-b")) {
-			System.out.println(tr("Warning: the preference with key ''{0}'' has an unsupported value ''{1}''. Assuming the default value ''set-a''.", PreferenceKeys.ROAD_SIGNS, set));
-			set = "set-a";
-		}
-		if (set.equals("set-a")){
-			rbSetA.setSelected(true);
-		} else {
-			rbSetB.setSelected(true);
-		}
-		
-		boolean b = prefs.getBoolean(PreferenceKeys.SHOW_VIAS_IN_BASIC_EDITOR, false);
-		cbShowViaListInBasicEditor.setSelected(b);
-		
-		pnlShortcutPreference.initFromPreferences(prefs);
-	}
-	
-	/**
-	 * Saves the current settings to the JOSM preferences {@code prefs}.
-	 * 
-	 * @param prefs the preferences 
-	 */
-	public void saveToPreferences(Preferences prefs){
-		String set = null;
-		if (rbSetA.isSelected()){
-			set = "set-a";
-		} else {
-			set = "set-b";
-		}
-		String oldSet = prefs.get(PreferenceKeys.ROAD_SIGNS, "set-a");		
-		if (!set.equals(oldSet)){
-			prefs.put(PreferenceKeys.ROAD_SIGNS, set);
-		}
-		
-		boolean newValue = cbShowViaListInBasicEditor.isSelected();
-		boolean oldValue = prefs.getBoolean(PreferenceKeys.SHOW_VIAS_IN_BASIC_EDITOR, false);
-		if (newValue != oldValue){
-			prefs.put(PreferenceKeys.SHOW_VIAS_IN_BASIC_EDITOR, newValue);
-		}		
-		
-		pnlShortcutPreference.saveToPreferences(prefs);
-	}
-	
-	public PreferencesPanel() {
-		build();
-	}	
+    private static final Logger logger = Logger.getLogger(PreferencesPanel.class.getName());
+    private JRadioButton rbSetA;
+    private JRadioButton rbSetB;
+    private ButtonGroup bgIconSet;
+    private JCheckBox cbShowViaListInBasicEditor;
+    private ShortcutPreferencePanel pnlShortcutPreference;
+    
+    protected JPanel buildShowViaListInBasicEditorPanel() {
+        JPanel pnl = new JPanel(new GridBagLayout());
+        GridBagConstraints gc = new GridBagConstraints();
+        gc.anchor = GridBagConstraints.NORTHWEST;
+        gc.fill = GridBagConstraints.HORIZONTAL;
+        gc.weightx = 1.0;
+        gc.gridx = 0;
+        gc.gridy = 0;
+        
+        HtmlPanel msg = new HtmlPanel();
+        msg.setText("<html><body>"
+                + tr("The Basic Editor can optionally display the list of via-objects "
+                     + "of a turn restriction. If enabled, one can edit them "
+                     + "in the Basic editor too. If disabled, editing of via-objects is "
+                     + "possible in the Advanced Editor only."
+                  )
+                + "</body></html>"
+        );
+        pnl.add(msg, gc);
+        
+        gc.gridy++;
+        pnl.add(cbShowViaListInBasicEditor = new JCheckBox(tr("Display and edit list of via-objects in the Basic Editor")), gc);
+        return pnl;
+    }
+    
+    /**
+     * Builds the panel for the icon set "set-a"
+     * 
+     * @return
+     */
+    protected JPanel buildSetAPanel() {
+        JPanel pnl = new JPanel(new GridBagLayout());;
+        GridBagConstraints gc = new GridBagConstraints();
+        gc.anchor = GridBagConstraints.NORTHWEST;
+        gc.fill = GridBagConstraints.HORIZONTAL;
+        gc.weightx = 1.0;
+        gc.gridx = 0;
+        gc.gridy = 0;
+        
+        pnl.add(rbSetA = new JRadioButton(tr("Road signs - Set A")),gc);
+        
+        JPanel icons = new JPanel(new FlowLayout(FlowLayout.LEFT));
+        for (TurnRestrictionType type: TurnRestrictionType.values()){
+            JLabel lbl = new JLabel();
+            icons.add(lbl);
+            lbl.setIcon(ImageProvider.get("types/set-a",type.getTagValue()));
+        }
+        
+        gc.gridy = 1;
+        gc.insets = new Insets(0,20,0,0);
+        pnl.add(icons, gc);
+        return pnl;     
+    }
+    
+    /**
+     * Builds the panel for the icon set "set-b"
+     * 
+     * @return
+     */
+    protected JPanel buildSetBPanel() {
+        JPanel pnl = new JPanel(new GridBagLayout());;
+        GridBagConstraints gc = new GridBagConstraints();
+        gc.anchor = GridBagConstraints.NORTHWEST;
+        gc.fill = GridBagConstraints.HORIZONTAL;
+        gc.weightx = 1.0;
+        gc.gridx = 0;
+        gc.gridy = 0;
+        
+        pnl.add(rbSetB = new JRadioButton(tr("Road signs - Set B")),gc);
+        
+        JPanel icons = new JPanel(new FlowLayout(FlowLayout.LEFT));
+        for (TurnRestrictionType type: TurnRestrictionType.values()){
+            JLabel lbl = new JLabel();
+            icons.add(lbl);
+            lbl.setIcon(ImageProvider.get("types/set-b",type.getTagValue()));
+        }
+        
+        gc.gridy = 1;
+        gc.insets = new Insets(0,20,0,0);
+        pnl.add(icons, gc);
+        return pnl;     
+    }
+    
+    /**
+     * Builds the message panel at the top
+     * 
+     * @return
+     */
+    protected JPanel buildMessagePanel() {
+        HtmlPanel pnl = new HtmlPanel();
+        pnl.setText(
+                "<html><body>"
+              + tr("Please select the set of road sign icons to be used in the plugin.")
+              + "</body></html>"
+        );
+        return pnl;
+    }
+    
+    /**
+     * Builds the UI
+     * 
+     * @return
+     */
+    protected void build() {            
+        setLayout(new GridBagLayout());
+        GridBagConstraints gc = new GridBagConstraints();
+        gc.anchor = GridBagConstraints.NORTHWEST;
+        gc.fill = GridBagConstraints.HORIZONTAL;
+        gc.weightx = 1.0;
+        gc.gridx = 0;
+        gc.gridy = 0;
+        
+        add(buildMessagePanel(), gc);
+        gc.gridy++;
+        add(buildSetAPanel(), gc);
+        gc.gridy++;
+        add(buildSetBPanel(), gc);
+        gc.gridy++;
+        add(new JSeparator(), gc);      
+        gc.gridy++;
+        add(buildShowViaListInBasicEditorPanel(), gc);
+        gc.gridy++;
+        add(new JSeparator(), gc);
+        gc.gridy++;
+        add(pnlShortcutPreference = new ShortcutPreferencePanel(), gc);
+        
+        // filler - just grab remaining space
+        gc.gridy++;
+        gc.fill = GridBagConstraints.BOTH;
+        gc.weighty = 1.0;
+        add(new JPanel(), gc);       
+        
+        bgIconSet = new ButtonGroup();
+        bgIconSet.add(rbSetA);
+        bgIconSet.add(rbSetB);
+        
+        setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
+    }
+    
+    /**
+     * Initializes the UI from the current settings in the JOSM preferences
+     * {@code prefs}
+     * 
+     * @param prefs the preferences 
+     */
+    public void initFromPreferences(Preferences prefs){
+        String set = prefs.get(PreferenceKeys.ROAD_SIGNS, "set-a");
+        set = set.trim().toLowerCase();
+        if (! set.equals("set-a") && ! set.equals("set-b")) {
+            System.out.println(tr("Warning: the preference with key ''{0}'' has an unsupported value ''{1}''. Assuming the default value ''set-a''.", PreferenceKeys.ROAD_SIGNS, set));
+            set = "set-a";
+        }
+        if (set.equals("set-a")){
+            rbSetA.setSelected(true);
+        } else {
+            rbSetB.setSelected(true);
+        }
+        
+        boolean b = prefs.getBoolean(PreferenceKeys.SHOW_VIAS_IN_BASIC_EDITOR, false);
+        cbShowViaListInBasicEditor.setSelected(b);
+        
+        pnlShortcutPreference.initFromPreferences(prefs);
+    }
+    
+    /**
+     * Saves the current settings to the JOSM preferences {@code prefs}.
+     * 
+     * @param prefs the preferences 
+     */
+    public void saveToPreferences(Preferences prefs){
+        String set = null;
+        if (rbSetA.isSelected()){
+            set = "set-a";
+        } else {
+            set = "set-b";
+        }
+        String oldSet = prefs.get(PreferenceKeys.ROAD_SIGNS, "set-a");      
+        if (!set.equals(oldSet)){
+            prefs.put(PreferenceKeys.ROAD_SIGNS, set);
+        }
+        
+        boolean newValue = cbShowViaListInBasicEditor.isSelected();
+        boolean oldValue = prefs.getBoolean(PreferenceKeys.SHOW_VIAS_IN_BASIC_EDITOR, false);
+        if (newValue != oldValue){
+            prefs.put(PreferenceKeys.SHOW_VIAS_IN_BASIC_EDITOR, newValue);
+        }       
+        
+        pnlShortcutPreference.saveToPreferences(prefs);
+    }
+    
+    public PreferencesPanel() {
+        build();
+    }   
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/ShortcutPreferencePanel.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/ShortcutPreferencePanel.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/preferences/ShortcutPreferencePanel.java	(revision 23192)
@@ -36,190 +36,190 @@
  */
 public class ShortcutPreferencePanel extends JPanel {
-	
-	private JCheckBox cbCtrl;
-	private JCheckBox cbAlt;
-	private JCheckBox cbShift;
-	private JCheckBox cbMeta;
-	private JComboBox cmKeyCodes;
-
-	protected JPanel buildMessagePanel() {
-		HtmlPanel pnl = new HtmlPanel();
-		pnl.setText("<html><body>"
-			+ tr("Please configure the <strong>keyboard shortcut</strong> which triggers "
-				+ "creating/editing a turn restriction from the current JOSM selection.")
-			+ "</body></html>"
-		);
-		return pnl;
-	}
-	
-	protected JPanel buildShortCutConfigPanel() {
-		JPanel pnl = new JPanel(new GridBagLayout());
-		GridBagConstraints gc = new GridBagConstraints();
-		gc.anchor = GridBagConstraints.NORTHWEST;
-		gc.fill = GridBagConstraints.HORIZONTAL;
-		gc.weightx = 0.0;
-		gc.gridx = 0;
-		gc.gridy = 0;
-		
-		pnl.add(new JLabel(trc("keyboard-key", "Key:")), gc);
-		gc.gridx++;
-		gc.gridwidth=4;
-		gc.weightx = 1.0;
-		pnl.add(cmKeyCodes = new JComboBox(new VKeyComboBoxModel()), gc);
-		cmKeyCodes.setRenderer(new VKeyCellRenderer());
-		
-		gc.gridx = 0;
-		gc.gridy = 1;
-		gc.gridwidth = 1;
-		gc.weightx = 0.0;
-		pnl.add(new JLabel(trc("keyboard-modifiers", "Modifiers:")), gc);
-	
-		gc.gridx++;
-		pnl.add(cbShift = new JCheckBox(trc("keyboard-modifiers", "Shift")), gc);
-		gc.gridx++;
-		pnl.add(cbCtrl = new JCheckBox(trc("keyboard-modifiers", "Ctrl")), gc);
-		gc.gridx++;
-		pnl.add(cbAlt = new JCheckBox(trc("keyboard-modifiers", "Alt")), gc);
-		gc.gridx++;
-		gc.weightx = 1.0;
-		pnl.add(cbMeta = new JCheckBox(trc("keyboard-modifiers", "Meta")), gc);
-		
-		return pnl;
-	}
-	
-	protected void build() {
-		setLayout(new GridBagLayout());
-		GridBagConstraints gc = new GridBagConstraints();
-		gc.anchor = GridBagConstraints.NORTHWEST;
-		gc.fill = GridBagConstraints.HORIZONTAL;
-		gc.weightx = 1.0;
-		gc.gridx = 0;
-		gc.gridy = 0;
-		add(buildMessagePanel(), gc);
-		gc.gridy++;
-		add(buildShortCutConfigPanel(), gc);
-	}
-	
-	public ShortcutPreferencePanel() {
-		build();
-	}
-	
-	public void initFromPreferences(Preferences pref){
-		String value = pref.get(PreferenceKeys.EDIT_SHORTCUT, "shift ctrl T");
-		KeyStroke key = KeyStroke.getKeyStroke(value);
-		if (key == null){
-			System.out.println(tr("Warning: illegal value ''{0}'' for preference key ''{1}''. Falling back to default value ''shift ctrl T''.", value, PreferenceKeys.EDIT_SHORTCUT));
-			key = KeyStroke.getKeyStroke("shift ctrl T");
-		}
-		cmKeyCodes.getModel().setSelectedItem(key.getKeyCode());
-		cbAlt.setSelected((key.getModifiers() & KeyEvent.ALT_DOWN_MASK) != 0);
-		cbCtrl.setSelected((key.getModifiers() & KeyEvent.CTRL_DOWN_MASK) != 0);
-		cbShift.setSelected((key.getModifiers() & KeyEvent.SHIFT_DOWN_MASK) != 0);
-		cbMeta.setSelected((key.getModifiers() & KeyEvent.META_DOWN_MASK) != 0);
-	}
-	
-	public void saveToPreferences(Preferences pref){
-		Integer code  = (Integer)cmKeyCodes.getModel().getSelectedItem();
-		if (code == null) {
-			code = KeyEvent.VK_T;
-		}
-		int modifiers = 0;
-		if (cbAlt.isSelected()) modifiers |= KeyEvent.ALT_DOWN_MASK;
-		if (cbCtrl.isSelected()) modifiers |= KeyEvent.CTRL_DOWN_MASK;
-		if (cbShift.isSelected()) modifiers |= KeyEvent.SHIFT_DOWN_MASK;
-		if (cbMeta.isSelected()) modifiers |= KeyEvent.META_DOWN_MASK;		
-		KeyStroke ks = KeyStroke.getKeyStroke(code, modifiers);
-		
-		pref.put(PreferenceKeys.EDIT_SHORTCUT, ks.toString());		
-		CreateOrEditTurnRestrictionAction.install(ks);
-	}
-	
-	static private class VKeyComboBoxModel extends AbstractListModel implements ComboBoxModel {
-		private final ArrayList<Integer> keys = new ArrayList<Integer>();
-		private Integer selected = null;
-
-		public VKeyComboBoxModel() {
-			populate();
-		}
-		
-		public void populate() {
-			for (Field f :KeyEvent.class.getFields()) {
-				if (! Modifier.isStatic(f.getModifiers())) continue;
-				if (! f.getName().startsWith("VK_")) continue;
-				try {
-					keys.add((Integer)f.get(null));
-				} catch(IllegalAccessException e){
-					// ignore
-				}
-			}
-			
-			Collections.sort(keys, new KeyCodeComparator());
-		}
-		
-		public Object getSelectedItem() {
-			return selected;
-		}
-
-		public void setSelectedItem(Object anItem) {
-			this.selected = (Integer)anItem;			
-		}
-
-		public Object getElementAt(int index) {
-			return keys.get(index);
-		}
-
-		public int getSize() {
-			return keys.size();
-		}		
-	}
-	
-	static private class VKeyCellRenderer extends JLabel implements ListCellRenderer {
-		public Component getListCellRendererComponent(JList list, Object value,
-				int index, boolean isSelected, boolean cellHasFocus) {
-			if (isSelected) {
-				setBackground(UIManager.getColor("ComboBox.selectionBackground"));
-				setForeground(UIManager.getColor("ComboBox.selectionForeground"));
-			} else {
-				setBackground(UIManager.getColor("ComboBox.background"));
-				setForeground(UIManager.getColor("ComboBox.foreground"));
-			}
-			setText(KeyEvent.getKeyText((Integer)value));
-			return this;
-		}		
-	}
-	
-	static private class KeyCodeComparator implements Comparator<Integer> {
-		private final static Map<Integer, String> keyNames = new HashMap<Integer, String>();
-		
-		protected String keyName(Integer code){
-			String name = keyNames.get(code);
-			if (name == null){
-				name = KeyEvent.getKeyText(code);
-				keyNames.put(code, name);
-			}
-			return name;
-		}
-		/**
-		 * Make sure single letter keys (A-Z, 0-9) are at the top of the list.
-		 * Make sure function key F1-F19 are sorted numerically, not lexicografically.
-		 * 
-		 */
-		public int compare(Integer kc1, Integer kc2) {
-			String n1 = keyName(kc1);
-			String n2 = keyName(kc2);
-			if (n1.length() == 1 && n2.length()==1){
-				return n1.compareTo(n2);
-			} else if (n1.length() == 1){
-				return -1;
-			} else if (n2.length() == 1){
-				return 1;
-			} else if (n1.matches("F\\d+") && n2.matches("F\\d+")){
-				int f1 = Integer.parseInt(n1.substring(1));
-				int f2 = Integer.parseInt(n2.substring(1));
-				return new Integer(f1).compareTo(f2);				
-			} else {
-				return n1.compareTo(n2);
-			}				
-		}		
-	}
+    
+    private JCheckBox cbCtrl;
+    private JCheckBox cbAlt;
+    private JCheckBox cbShift;
+    private JCheckBox cbMeta;
+    private JComboBox cmKeyCodes;
+
+    protected JPanel buildMessagePanel() {
+        HtmlPanel pnl = new HtmlPanel();
+        pnl.setText("<html><body>"
+            + tr("Please configure the <strong>keyboard shortcut</strong> which triggers "
+                + "creating/editing a turn restriction from the current JOSM selection.")
+            + "</body></html>"
+        );
+        return pnl;
+    }
+    
+    protected JPanel buildShortCutConfigPanel() {
+        JPanel pnl = new JPanel(new GridBagLayout());
+        GridBagConstraints gc = new GridBagConstraints();
+        gc.anchor = GridBagConstraints.NORTHWEST;
+        gc.fill = GridBagConstraints.HORIZONTAL;
+        gc.weightx = 0.0;
+        gc.gridx = 0;
+        gc.gridy = 0;
+        
+        pnl.add(new JLabel(trc("keyboard-key", "Key:")), gc);
+        gc.gridx++;
+        gc.gridwidth=4;
+        gc.weightx = 1.0;
+        pnl.add(cmKeyCodes = new JComboBox(new VKeyComboBoxModel()), gc);
+        cmKeyCodes.setRenderer(new VKeyCellRenderer());
+        
+        gc.gridx = 0;
+        gc.gridy = 1;
+        gc.gridwidth = 1;
+        gc.weightx = 0.0;
+        pnl.add(new JLabel(trc("keyboard-modifiers", "Modifiers:")), gc);
+    
+        gc.gridx++;
+        pnl.add(cbShift = new JCheckBox(trc("keyboard-modifiers", "Shift")), gc);
+        gc.gridx++;
+        pnl.add(cbCtrl = new JCheckBox(trc("keyboard-modifiers", "Ctrl")), gc);
+        gc.gridx++;
+        pnl.add(cbAlt = new JCheckBox(trc("keyboard-modifiers", "Alt")), gc);
+        gc.gridx++;
+        gc.weightx = 1.0;
+        pnl.add(cbMeta = new JCheckBox(trc("keyboard-modifiers", "Meta")), gc);
+        
+        return pnl;
+    }
+    
+    protected void build() {
+        setLayout(new GridBagLayout());
+        GridBagConstraints gc = new GridBagConstraints();
+        gc.anchor = GridBagConstraints.NORTHWEST;
+        gc.fill = GridBagConstraints.HORIZONTAL;
+        gc.weightx = 1.0;
+        gc.gridx = 0;
+        gc.gridy = 0;
+        add(buildMessagePanel(), gc);
+        gc.gridy++;
+        add(buildShortCutConfigPanel(), gc);
+    }
+    
+    public ShortcutPreferencePanel() {
+        build();
+    }
+    
+    public void initFromPreferences(Preferences pref){
+        String value = pref.get(PreferenceKeys.EDIT_SHORTCUT, "shift ctrl T");
+        KeyStroke key = KeyStroke.getKeyStroke(value);
+        if (key == null){
+            System.out.println(tr("Warning: illegal value ''{0}'' for preference key ''{1}''. Falling back to default value ''shift ctrl T''.", value, PreferenceKeys.EDIT_SHORTCUT));
+            key = KeyStroke.getKeyStroke("shift ctrl T");
+        }
+        cmKeyCodes.getModel().setSelectedItem(key.getKeyCode());
+        cbAlt.setSelected((key.getModifiers() & KeyEvent.ALT_DOWN_MASK) != 0);
+        cbCtrl.setSelected((key.getModifiers() & KeyEvent.CTRL_DOWN_MASK) != 0);
+        cbShift.setSelected((key.getModifiers() & KeyEvent.SHIFT_DOWN_MASK) != 0);
+        cbMeta.setSelected((key.getModifiers() & KeyEvent.META_DOWN_MASK) != 0);
+    }
+    
+    public void saveToPreferences(Preferences pref){
+        Integer code  = (Integer)cmKeyCodes.getModel().getSelectedItem();
+        if (code == null) {
+            code = KeyEvent.VK_T;
+        }
+        int modifiers = 0;
+        if (cbAlt.isSelected()) modifiers |= KeyEvent.ALT_DOWN_MASK;
+        if (cbCtrl.isSelected()) modifiers |= KeyEvent.CTRL_DOWN_MASK;
+        if (cbShift.isSelected()) modifiers |= KeyEvent.SHIFT_DOWN_MASK;
+        if (cbMeta.isSelected()) modifiers |= KeyEvent.META_DOWN_MASK;      
+        KeyStroke ks = KeyStroke.getKeyStroke(code, modifiers);
+        
+        pref.put(PreferenceKeys.EDIT_SHORTCUT, ks.toString());      
+        CreateOrEditTurnRestrictionAction.install(ks);
+    }
+    
+    static private class VKeyComboBoxModel extends AbstractListModel implements ComboBoxModel {
+        private final ArrayList<Integer> keys = new ArrayList<Integer>();
+        private Integer selected = null;
+
+        public VKeyComboBoxModel() {
+            populate();
+        }
+        
+        public void populate() {
+            for (Field f :KeyEvent.class.getFields()) {
+                if (! Modifier.isStatic(f.getModifiers())) continue;
+                if (! f.getName().startsWith("VK_")) continue;
+                try {
+                    keys.add((Integer)f.get(null));
+                } catch(IllegalAccessException e){
+                    // ignore
+                }
+            }
+            
+            Collections.sort(keys, new KeyCodeComparator());
+        }
+        
+        public Object getSelectedItem() {
+            return selected;
+        }
+
+        public void setSelectedItem(Object anItem) {
+            this.selected = (Integer)anItem;            
+        }
+
+        public Object getElementAt(int index) {
+            return keys.get(index);
+        }
+
+        public int getSize() {
+            return keys.size();
+        }       
+    }
+    
+    static private class VKeyCellRenderer extends JLabel implements ListCellRenderer {
+        public Component getListCellRendererComponent(JList list, Object value,
+                int index, boolean isSelected, boolean cellHasFocus) {
+            if (isSelected) {
+                setBackground(UIManager.getColor("ComboBox.selectionBackground"));
+                setForeground(UIManager.getColor("ComboBox.selectionForeground"));
+            } else {
+                setBackground(UIManager.getColor("ComboBox.background"));
+                setForeground(UIManager.getColor("ComboBox.foreground"));
+            }
+            setText(KeyEvent.getKeyText((Integer)value));
+            return this;
+        }       
+    }
+    
+    static private class KeyCodeComparator implements Comparator<Integer> {
+        private final static Map<Integer, String> keyNames = new HashMap<Integer, String>();
+        
+        protected String keyName(Integer code){
+            String name = keyNames.get(code);
+            if (name == null){
+                name = KeyEvent.getKeyText(code);
+                keyNames.put(code, name);
+            }
+            return name;
+        }
+        /**
+         * Make sure single letter keys (A-Z, 0-9) are at the top of the list.
+         * Make sure function key F1-F19 are sorted numerically, not lexicografically.
+         * 
+         */
+        public int compare(Integer kc1, Integer kc2) {
+            String n1 = keyName(kc1);
+            String n2 = keyName(kc2);
+            if (n1.length() == 1 && n2.length()==1){
+                return n1.compareTo(n2);
+            } else if (n1.length() == 1){
+                return -1;
+            } else if (n2.length() == 1){
+                return 1;
+            } else if (n1.matches("F\\d+") && n2.matches("F\\d+")){
+                int f1 = Integer.parseInt(n1.substring(1));
+                int f2 = Integer.parseInt(n2.substring(1));
+                return new Integer(f1).compareTo(f2);               
+            } else {
+                return n1.compareTo(n2);
+            }               
+        }       
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/IdenticalTurnRestrictionLegsError.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/IdenticalTurnRestrictionLegsError.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/IdenticalTurnRestrictionLegsError.java	(revision 23192)
@@ -15,50 +15,50 @@
  */
 public class IdenticalTurnRestrictionLegsError extends Issue{
-	private OsmPrimitive leg;
-	
-	public IdenticalTurnRestrictionLegsError(IssuesModel parent, OsmPrimitive leg) {
-		super(parent, Severity.ERROR);
-		actions.add(new DeleteFromAction());
-		actions.add(new DeleteToAction());
-		actions.add(new FixInEditorAction());
-		this.leg = leg;
-	}
+    private OsmPrimitive leg;
+    
+    public IdenticalTurnRestrictionLegsError(IssuesModel parent, OsmPrimitive leg) {
+        super(parent, Severity.ERROR);
+        actions.add(new DeleteFromAction());
+        actions.add(new DeleteToAction());
+        actions.add(new FixInEditorAction());
+        this.leg = leg;
+    }
 
-	@Override
-	public String getText() {		
-		return tr("This turn restriction uses the OSM way <span class=\"object-name\">{0}</span> with role <tt>from</tt> <strong>and</strong> with role <tt>to</tt>. "
-				+ "In a turn restriction, the way with role <tt>from</tt> should be different from the way with role <tt>to</tt>, though.",
-				leg.getDisplayName(DefaultNameFormatter.getInstance())
-				);				
-	}
-	
-	class DeleteFromAction extends AbstractAction {
-		public DeleteFromAction() {
-			putValue(NAME, tr("Delete ''from''"));
-			putValue(SHORT_DESCRIPTION, tr("Removes the member with role ''from''"));
-		}
-		public void actionPerformed(ActionEvent e) {
-			getIssuesModel().getEditorModel().getRelationMemberEditorModel().setFromPrimitive(null);			
-		}		
-	}
-	
-	class DeleteToAction extends AbstractAction {
-		public DeleteToAction() {
-			putValue(NAME, tr("Delete ''to''"));
-			putValue(SHORT_DESCRIPTION, tr("Removes the member with role ''to''"));
-		}
-		public void actionPerformed(ActionEvent e) {
-			getIssuesModel().getEditorModel().getRelationMemberEditorModel().setToPrimitive(null);			
-		}		
-	}
-	
-	class FixInEditorAction extends AbstractAction {
-		public FixInEditorAction() {
-			putValue(NAME, tr("Fix in editor"));
-			putValue(SHORT_DESCRIPTION, tr("Go to Basic Editor and manually choose members with roles ''from'' and ''to''"));
-		}
-		public void actionPerformed(ActionEvent e) {
-			getIssuesModel().getNavigationControler().gotoBasicEditor();		
-		}		
-	}
+    @Override
+    public String getText() {       
+        return tr("This turn restriction uses the OSM way <span class=\"object-name\">{0}</span> with role <tt>from</tt> <strong>and</strong> with role <tt>to</tt>. "
+                + "In a turn restriction, the way with role <tt>from</tt> should be different from the way with role <tt>to</tt>, though.",
+                leg.getDisplayName(DefaultNameFormatter.getInstance())
+                );              
+    }
+    
+    class DeleteFromAction extends AbstractAction {
+        public DeleteFromAction() {
+            putValue(NAME, tr("Delete ''from''"));
+            putValue(SHORT_DESCRIPTION, tr("Removes the member with role ''from''"));
+        }
+        public void actionPerformed(ActionEvent e) {
+            getIssuesModel().getEditorModel().getRelationMemberEditorModel().setFromPrimitive(null);            
+        }       
+    }
+    
+    class DeleteToAction extends AbstractAction {
+        public DeleteToAction() {
+            putValue(NAME, tr("Delete ''to''"));
+            putValue(SHORT_DESCRIPTION, tr("Removes the member with role ''to''"));
+        }
+        public void actionPerformed(ActionEvent e) {
+            getIssuesModel().getEditorModel().getRelationMemberEditorModel().setToPrimitive(null);          
+        }       
+    }
+    
+    class FixInEditorAction extends AbstractAction {
+        public FixInEditorAction() {
+            putValue(NAME, tr("Fix in editor"));
+            putValue(SHORT_DESCRIPTION, tr("Go to Basic Editor and manually choose members with roles ''from'' and ''to''"));
+        }
+        public void actionPerformed(ActionEvent e) {
+            getIssuesModel().getNavigationControler().gotoBasicEditor();        
+        }       
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/IllegalRestrictionTypeError.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/IllegalRestrictionTypeError.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/IllegalRestrictionTypeError.java	(revision 23192)
@@ -15,28 +15,28 @@
  */
 public class IllegalRestrictionTypeError extends Issue{
-	private String value;
-	
-	public IllegalRestrictionTypeError(IssuesModel parent, String value) {
-		super(parent, Severity.ERROR);
-		actions.add(new FixInEditorAction());
-		this.value = value;
-	}
+    private String value;
+    
+    public IllegalRestrictionTypeError(IssuesModel parent, String value) {
+        super(parent, Severity.ERROR);
+        actions.add(new FixInEditorAction());
+        this.value = value;
+    }
 
-	@Override
-	public String getText() {		
-		return tr("This turn restriction uses a non-standard restriction type <tt>{0}</tt> for the tag key <tt>restriction</tt>. "
-				+ "It is recommended to use standard values only. Please select one in the Basic editor.",
-				value
-				);				
-	}
-	
-	class FixInEditorAction extends AbstractAction {
-		public FixInEditorAction() {
-			putValue(NAME, tr("Fix in editor"));
-			putValue(SHORT_DESCRIPTION, tr("Go to Basic Editor and manually choose a turn restriction type"));
-		}
-		public void actionPerformed(ActionEvent e) {
-			getIssuesModel().getNavigationControler().gotoBasicEditor(NavigationControler.BasicEditorFokusTargets.RESTRICION_TYPE);			
-		}		
-	}
+    @Override
+    public String getText() {       
+        return tr("This turn restriction uses a non-standard restriction type <tt>{0}</tt> for the tag key <tt>restriction</tt>. "
+                + "It is recommended to use standard values only. Please select one in the Basic editor.",
+                value
+                );              
+    }
+    
+    class FixInEditorAction extends AbstractAction {
+        public FixInEditorAction() {
+            putValue(NAME, tr("Fix in editor"));
+            putValue(SHORT_DESCRIPTION, tr("Go to Basic Editor and manually choose a turn restriction type"));
+        }
+        public void actionPerformed(ActionEvent e) {
+            getIssuesModel().getNavigationControler().gotoBasicEditor(NavigationControler.BasicEditorFokusTargets.RESTRICION_TYPE);         
+        }       
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/IntersectionMissingAsViaError.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/IntersectionMissingAsViaError.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/IntersectionMissingAsViaError.java	(revision 23192)
@@ -20,47 +20,47 @@
  */
 public class IntersectionMissingAsViaError extends Issue{
-	private Way from;
-	private Way to;
-	private Node interesect;
-	
-	public IntersectionMissingAsViaError(IssuesModel parent, Way from, Way to, Node intersect) {
-		super(parent, Severity.ERROR);
-		this.from = from;
-		this.to = to;
-		this.interesect = intersect;
-		actions.add(new SetVia());
-		actions.add(new FixInEditorAction());
-	}
+    private Way from;
+    private Way to;
+    private Node interesect;
+    
+    public IntersectionMissingAsViaError(IssuesModel parent, Way from, Way to, Node intersect) {
+        super(parent, Severity.ERROR);
+        this.from = from;
+        this.to = to;
+        this.interesect = intersect;
+        actions.add(new SetVia());
+        actions.add(new FixInEditorAction());
+    }
 
-	@Override
-	public String getText() {		
-		String msg = tr("The <strong>from</strong>-way <span class=\"object-name\">{0}</span> and the <strong>to</strong>-way <span class=\"object-name\">{1}</span> "
-		       + "interesect at node <span class=\"object-name\">{2}</span> but <span class=\"object-name\">{2}</span> isn''t a <strong>via</strong>-object.<br> "
-		       + "It is recommended to set <span class=\"object-name\">{2}</span> as unique <strong>via</strong>-object.",
-		       this.from.getDisplayName(DefaultNameFormatter.getInstance()),
-		       this.to.getDisplayName(DefaultNameFormatter.getInstance()),
-		       this.interesect.getDisplayName(DefaultNameFormatter.getInstance())
-		);
-		return msg;
-	}
-	
-	class SetVia extends AbstractAction {
-		public SetVia() {
-			putValue(NAME, tr("Set via-Object"));
-			putValue(SHORT_DESCRIPTION, tr("Replaces the currently configured via-objects with the node at the intersection"));
-		}
-		public void actionPerformed(ActionEvent e) {
-			getIssuesModel().getEditorModel().setVias(Collections.<OsmPrimitive>singletonList(interesect));			
-		}		
-	}
-	
-	class FixInEditorAction extends AbstractAction {
-		public FixInEditorAction() {
-			putValue(NAME, tr("Fix in editor"));
-			putValue(SHORT_DESCRIPTION, tr("Go to Basic Editor and manually fix the list of via-objects"));
-		}
-		public void actionPerformed(ActionEvent e) {
-			getIssuesModel().getNavigationControler().gotoBasicEditor(BasicEditorFokusTargets.VIA);	
-		}		
-	}
+    @Override
+    public String getText() {       
+        String msg = tr("The <strong>from</strong>-way <span class=\"object-name\">{0}</span> and the <strong>to</strong>-way <span class=\"object-name\">{1}</span> "
+               + "interesect at node <span class=\"object-name\">{2}</span> but <span class=\"object-name\">{2}</span> isn''t a <strong>via</strong>-object.<br> "
+               + "It is recommended to set <span class=\"object-name\">{2}</span> as unique <strong>via</strong>-object.",
+               this.from.getDisplayName(DefaultNameFormatter.getInstance()),
+               this.to.getDisplayName(DefaultNameFormatter.getInstance()),
+               this.interesect.getDisplayName(DefaultNameFormatter.getInstance())
+        );
+        return msg;
+    }
+    
+    class SetVia extends AbstractAction {
+        public SetVia() {
+            putValue(NAME, tr("Set via-Object"));
+            putValue(SHORT_DESCRIPTION, tr("Replaces the currently configured via-objects with the node at the intersection"));
+        }
+        public void actionPerformed(ActionEvent e) {
+            getIssuesModel().getEditorModel().setVias(Collections.<OsmPrimitive>singletonList(interesect));         
+        }       
+    }
+    
+    class FixInEditorAction extends AbstractAction {
+        public FixInEditorAction() {
+            putValue(NAME, tr("Fix in editor"));
+            putValue(SHORT_DESCRIPTION, tr("Go to Basic Editor and manually fix the list of via-objects"));
+        }
+        public void actionPerformed(ActionEvent e) {
+            getIssuesModel().getNavigationControler().gotoBasicEditor(BasicEditorFokusTargets.VIA); 
+        }       
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/Issue.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/Issue.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/Issue.java	(revision 23192)
@@ -18,83 +18,83 @@
  */
 abstract public class Issue {
-	/** the parent model for this issue */
-	protected IssuesModel parent;
-	protected Severity severity;
-	protected final ArrayList<Action> actions = new ArrayList<Action>();
-	
-	/**
-	 * Creates a new issue associated with a parent model. Severity is
-	 * initialized to {@see Severity#WARNING}.
-	 * 
-	 * @param parent the parent model. Must not be null.
-	 * @throws IllegalArgumentException thrown if parent is null
-	 */
-	public Issue(IssuesModel parent) throws IllegalArgumentException{
-		CheckParameterUtil.ensureParameterNotNull(parent, "parent");
-		this.parent = parent;
-		this.severity = Severity.WARNING;
-	}
-	
-	/**
-	 * Creates a new issue of severity {@code severity} associated with
-	 * the parent model {@code parent}.
-	 * 
-	 * @param parent the parent model. Must not be null.
-	 * @param severity the severity. Must not be null.
-	 * @throws IllegalArgumentException thrown if parent is null
-	 * @throws IllegalArgumentException thrown if severity is null 
-	 */
-	public Issue(IssuesModel parent, Severity severity){
-		CheckParameterUtil.ensureParameterNotNull(parent, "parent");
-		CheckParameterUtil.ensureParameterNotNull(severity, "severity");
-		this.parent = parent;
-		this.severity = severity;
-	}
+    /** the parent model for this issue */
+    protected IssuesModel parent;
+    protected Severity severity;
+    protected final ArrayList<Action> actions = new ArrayList<Action>();
+    
+    /**
+     * Creates a new issue associated with a parent model. Severity is
+     * initialized to {@see Severity#WARNING}.
+     * 
+     * @param parent the parent model. Must not be null.
+     * @throws IllegalArgumentException thrown if parent is null
+     */
+    public Issue(IssuesModel parent) throws IllegalArgumentException{
+        CheckParameterUtil.ensureParameterNotNull(parent, "parent");
+        this.parent = parent;
+        this.severity = Severity.WARNING;
+    }
+    
+    /**
+     * Creates a new issue of severity {@code severity} associated with
+     * the parent model {@code parent}.
+     * 
+     * @param parent the parent model. Must not be null.
+     * @param severity the severity. Must not be null.
+     * @throws IllegalArgumentException thrown if parent is null
+     * @throws IllegalArgumentException thrown if severity is null 
+     */
+    public Issue(IssuesModel parent, Severity severity){
+        CheckParameterUtil.ensureParameterNotNull(parent, "parent");
+        CheckParameterUtil.ensureParameterNotNull(severity, "severity");
+        this.parent = parent;
+        this.severity = severity;
+    }
 
-	/**
-	 * Replies the parent model this issue is associated with 
-	 * 
-	 * @return the parent model 
-	 */
-	public IssuesModel getIssuesModel() {
-		return parent;
-	}
+    /**
+     * Replies the parent model this issue is associated with 
+     * 
+     * @return the parent model 
+     */
+    public IssuesModel getIssuesModel() {
+        return parent;
+    }
 
-	/**
-	 * Replies the severity of this issue 
-	 * 
-	 * @return the severity 
-	 */
-	public Severity getSeverity() {
-		return severity;
-	}
+    /**
+     * Replies the severity of this issue 
+     * 
+     * @return the severity 
+     */
+    public Severity getSeverity() {
+        return severity;
+    }
 
-	/**
-	 * Sets the severity of this issue. 
-	 * 
-	 * @param severity the severity. Must not be null.
-	 * @throws IllegalArgumentException thrown if severity is null
-	 */
-	public void setSeverity(Severity severity) throws IllegalArgumentException {
-		CheckParameterUtil.ensureParameterNotNull(severity, "severity");
-		this.severity = severity;
-	}
+    /**
+     * Sets the severity of this issue. 
+     * 
+     * @param severity the severity. Must not be null.
+     * @throws IllegalArgumentException thrown if severity is null
+     */
+    public void setSeverity(Severity severity) throws IllegalArgumentException {
+        CheckParameterUtil.ensureParameterNotNull(severity, "severity");
+        this.severity = severity;
+    }
 
-	/**
-	 * Replies the HTML formatted description of the issue. The text should neither include
-	 * the &lt;html&gt;, nor the &lt;body&gt; tag.  
-	 * 
-	 * @return the HTML formatted description of the issue.
-	 */
-	public abstract String getText();
-	
-	/**
-	 * Replies a list of actions which can be applied to this issue in order to fix
-	 * it. The default implementation replies an empty list.
-	 * 
-	 * @return a list of action
-	 */
-	public List<Action> getActions() {
-		return Collections.unmodifiableList(actions);
-	}
+    /**
+     * Replies the HTML formatted description of the issue. The text should neither include
+     * the &lt;html&gt;, nor the &lt;body&gt; tag.  
+     * 
+     * @return the HTML formatted description of the issue.
+     */
+    public abstract String getText();
+    
+    /**
+     * Replies a list of actions which can be applied to this issue in order to fix
+     * it. The default implementation replies an empty list.
+     * 
+     * @return a list of action
+     */
+    public List<Action> getActions() {
+        return Collections.unmodifiableList(actions);
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/IssueView.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/IssueView.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/IssueView.java	(revision 23192)
@@ -26,11 +26,11 @@
 public class IssueView extends JPanel{
 
-	private HtmlPanel pnlMessage;
-	private JPanel pnlActions;
-	private Issue issue;
-	private JLabel lblIcon;
-	private StyleSheet styleSheet;
-	
-	 /**
+    private HtmlPanel pnlMessage;
+    private JPanel pnlActions;
+    private Issue issue;
+    private JLabel lblIcon;
+    private StyleSheet styleSheet;
+    
+     /**
      * Builds the style sheet used in the internal help browser
      *
@@ -43,82 +43,82 @@
         ss.addRule(".object-name {background-color:rgb(240,240,240); color: blue;}");
     }
-	
-	protected void build() {
-		setLayout(new GridBagLayout());
-		setBackground(Color.WHITE);
-		setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY, 1));
-		
-		// add the icon for the severity 
-		GridBagConstraints gc = new GridBagConstraints();
-		gc.anchor = GridBagConstraints.NORTHWEST;
-		gc.fill = GridBagConstraints.VERTICAL;
-		gc.gridheight = 2;
-		gc.weightx = 0.0;
-		gc.weighty = 1.0;
-		gc.gridx = 0;
-		gc.gridy = 0;
-		gc.insets = new Insets(2,2,2,2);
-		add(lblIcon = new JLabel(), gc);
-		lblIcon.setVerticalAlignment(SwingConstants.TOP);
-		lblIcon.setHorizontalAlignment(SwingConstants.CENTER);
-		lblIcon.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
+    
+    protected void build() {
+        setLayout(new GridBagLayout());
+        setBackground(Color.WHITE);
+        setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY, 1));
+        
+        // add the icon for the severity 
+        GridBagConstraints gc = new GridBagConstraints();
+        gc.anchor = GridBagConstraints.NORTHWEST;
+        gc.fill = GridBagConstraints.VERTICAL;
+        gc.gridheight = 2;
+        gc.weightx = 0.0;
+        gc.weighty = 1.0;
+        gc.gridx = 0;
+        gc.gridy = 0;
+        gc.insets = new Insets(2,2,2,2);
+        add(lblIcon = new JLabel(), gc);
+        lblIcon.setVerticalAlignment(SwingConstants.TOP);
+        lblIcon.setHorizontalAlignment(SwingConstants.CENTER);
+        lblIcon.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
 
-		// add the html panel with the issue description 
-		gc.insets = new Insets(0,0,0,0);
-		gc.anchor = GridBagConstraints.NORTHWEST;
-		gc.fill = GridBagConstraints.BOTH;
-		gc.gridx = 1;
-		gc.gridy = 0;
-		gc.gridheight = 1;
-		gc.weightx = 1.0;
-		gc.weighty = 1.0;
-		add(pnlMessage = new HtmlPanel(), gc);
-		initStyleSheet(pnlMessage);
-		pnlMessage.setBackground(Color.white);
-		pnlMessage.setText("<html><body>" + issue.getText() + "</html></bod>");
+        // add the html panel with the issue description 
+        gc.insets = new Insets(0,0,0,0);
+        gc.anchor = GridBagConstraints.NORTHWEST;
+        gc.fill = GridBagConstraints.BOTH;
+        gc.gridx = 1;
+        gc.gridy = 0;
+        gc.gridheight = 1;
+        gc.weightx = 1.0;
+        gc.weighty = 1.0;
+        add(pnlMessage = new HtmlPanel(), gc);
+        initStyleSheet(pnlMessage);
+        pnlMessage.setBackground(Color.white);
+        pnlMessage.setText("<html><body>" + issue.getText() + "</html></bod>");
 
-		
-		// if there are any actions available to resolve the issue, add a panel with action buttons 
-		if (!issue.getActions().isEmpty()) {
-			pnlActions = new JPanel(new FlowLayout(FlowLayout.LEFT));
-			pnlActions.setBackground(Color.WHITE);
-			for (Action action: issue.getActions()){
-				JButton btn = new JButton(action);
-				pnlActions.add(btn);				
-			}
-			
-			gc.gridx = 1;			
-			gc.gridy = 1;			
-			gc.fill = GridBagConstraints.HORIZONTAL;
-			gc.weighty = 0.0;
-			add(pnlActions,gc);
-		}	
-		
-		// set the severity icon 
-		switch(issue.getSeverity()){
-		case WARNING: 
-			lblIcon.setIcon(ImageProvider.get("warning-small"));
-			break;
-		case ERROR:
-			lblIcon.setIcon(ImageProvider.get("error"));
-			break;
-		}		
-	}
-	
-	/**
-	 * Creates an issue view for an issue.
-	 * 
-	 * @param issue the issue. Must not be null.
-	 * @throws IllegalArgumentException thrown if issue is null.
-	 */
-	public IssueView(Issue issue) throws IllegalArgumentException{
-		CheckParameterUtil.ensureParameterNotNull(issue, "issue");
-		this.issue = issue;
-		build();		
-	}
+        
+        // if there are any actions available to resolve the issue, add a panel with action buttons 
+        if (!issue.getActions().isEmpty()) {
+            pnlActions = new JPanel(new FlowLayout(FlowLayout.LEFT));
+            pnlActions.setBackground(Color.WHITE);
+            for (Action action: issue.getActions()){
+                JButton btn = new JButton(action);
+                pnlActions.add(btn);                
+            }
+            
+            gc.gridx = 1;           
+            gc.gridy = 1;           
+            gc.fill = GridBagConstraints.HORIZONTAL;
+            gc.weighty = 0.0;
+            add(pnlActions,gc);
+        }   
+        
+        // set the severity icon 
+        switch(issue.getSeverity()){
+        case WARNING: 
+            lblIcon.setIcon(ImageProvider.get("warning-small"));
+            break;
+        case ERROR:
+            lblIcon.setIcon(ImageProvider.get("error"));
+            break;
+        }       
+    }
+    
+    /**
+     * Creates an issue view for an issue.
+     * 
+     * @param issue the issue. Must not be null.
+     * @throws IllegalArgumentException thrown if issue is null.
+     */
+    public IssueView(Issue issue) throws IllegalArgumentException{
+        CheckParameterUtil.ensureParameterNotNull(issue, "issue");
+        this.issue = issue;
+        build();        
+    }
 
-	@Override
-	public Dimension getMinimumSize() {
-		return super.getPreferredSize();
-	}
+    @Override
+    public Dimension getMinimumSize() {
+        return super.getPreferredSize();
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/IssuesModel.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/IssuesModel.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/IssuesModel.java	(revision 23192)
@@ -31,234 +31,234 @@
  */
 public class IssuesModel extends Observable implements Observer{
-	private final ArrayList<Issue> issues = new ArrayList<Issue>();
-	private TurnRestrictionEditorModel editorModel;
-	
-	/**
-	 * Creates the model 
-	 * 
-	 * {@code controler} is used in resolution actions for issues in
-	 * this model to direct the user to a specific input field in one
-	 * of the editor tabs in order to fix an issue. 
-	 * 
-	 * @param editorModel the editor model. Must not be null.
-	 * @throws IllegalArgumentException thrown if controler is null
-	 */
-	public IssuesModel(TurnRestrictionEditorModel editorModel) throws IllegalArgumentException{
-		CheckParameterUtil.ensureParameterNotNull(editorModel, "editorModel");
-		this.editorModel = editorModel;
-		this.editorModel.addObserver(this);
-	}
-	
-	/**
-	 * Populates the model with a list of issues. Just clears the model
-	 * if {@code issues} is null or empty. 
-	 * 
-	 * @param issues the list of issues. 
-	 */
-	public void populate(List<Issue> issues){
-		this.issues.clear();
-		if (issues != null){
-			this.issues.addAll(issues);
-		}
-		setChanged();
-		notifyObservers();
-	}
-	
-	/**
-	 * Replies the (unmodifiable) list of issues in this model.
-	 * 
-	 * @return the (unmodifiable) list of issues in this model.
-	 */
-	public List<Issue> getIssues() {
-		return Collections.unmodifiableList(issues);
-	}
-	
-	/**
-	 * Replies the turn restriction editor model 
-	 * 
-	 * @return
-	 */
-	public TurnRestrictionEditorModel getEditorModel() {
-		return editorModel;
-	}
-	
-	/**
-	 * Populates this model with issues derived from the state of the
-	 * turn restriction editor model. If {@code editorModel} is null, the
-	 * list of issues is cleared.
-	 * 
-	 * @param editorModel the editor model. 
-	 */
-	public void populate() {
-		issues.clear();
-		if (editorModel != null) {
-			checkTags(editorModel);
-			checkFromLeg(editorModel);
-			checkToLeg(editorModel);
-			checkFromAndToEquals(editorModel);
-			checkVias(editorModel);
-		}
-		setChanged();
-		notifyObservers();
-	}
-	
-	/**
-	 * Checks whether there are required tags missing. 
-	 * 
-	 * @param editorModel
-	 */
-	protected void checkTags(TurnRestrictionEditorModel editorModel) {
-		TagEditorModel tagEditorModel = editorModel.getTagEditorModel();
-		TagModel tag = tagEditorModel.get("type");
-		
-		// missing marker tag for a turn restriction
-		if (tag == null || ! tag.getValue().trim().equals("restriction")) {
-			issues.add(new RequiredTagMissingError(this, "type", "restriction"));
-		}
-		
-		// missing or illegal restriction type ?
-		tag = tagEditorModel.get("restriction");
-		if (tag == null) {
-			issues.add(new MissingRestrictionTypeError(this));
-		} else if (!TurnRestrictionType.isStandardTagValue(tag.getValue())) {
-			issues.add(new IllegalRestrictionTypeError(this, tag.getValue()));
-		}
-
-		// non-standard value for the 'except' tag? 
-		ExceptValueModel except = getEditorModel().getExcept();
-		if (!except.isStandard()) {
-			issues.add(new NonStandardExceptWarning(this, except));
-		}
-	}
-	
-	/**
-	 * Checks various data integrity restriction for the relation member with
-	 * role 'from'.
-	 * 
-	 */
-	protected void checkFromLeg(TurnRestrictionEditorModel editorModel) {
-		Set<OsmPrimitive> froms = editorModel.getTurnRestrictionLeg(TurnRestrictionLegRole.FROM);
-		if (froms.isEmpty()){
-			issues.add(new MissingTurnRestrictionLegError(this, TurnRestrictionLegRole.FROM));
-			return;
-		} else if (froms.size() > 1){
-			issues.add(new MultipleTurnRestrictionLegError(this, TurnRestrictionLegRole.FROM, froms.size()));
-			return;
-		} 
-		OsmPrimitive p = froms.iterator().next();
-		if (! (p instanceof Way)) {
-			issues.add(new WrongTurnRestrictionLegTypeError(this, TurnRestrictionLegRole.FROM, p));
-		}
-	}
-	
-	/**
-	 * Checks various data integrity restriction for the relation member with
-	 * role 'to'.
-	 * 
-	 */
-	protected void checkToLeg(TurnRestrictionEditorModel editorModel) {
-		Set<OsmPrimitive> toLegs = editorModel.getTurnRestrictionLeg(TurnRestrictionLegRole.TO);
-		if (toLegs.isEmpty()){
-			issues.add(new MissingTurnRestrictionLegError(this, TurnRestrictionLegRole.TO));
-			return;
-		} else if (toLegs.size() > 1){
-			issues.add(new MultipleTurnRestrictionLegError(this, TurnRestrictionLegRole.TO, toLegs.size()));
-			return;
-		} 
-		OsmPrimitive p = toLegs.iterator().next();
-		if (! (p instanceof Way)) {
-			issues.add(new WrongTurnRestrictionLegTypeError(this, TurnRestrictionLegRole.TO, p));
-		}
-	}
-	
-	/**
-	 * Creates an issue if this turn restriction has identical 'from' and to'.
-	 * 
-	 * @param editorModel
-	 */
-	protected void checkFromAndToEquals(TurnRestrictionEditorModel editorModel){
-		Set<OsmPrimitive> toLegs = editorModel.getTurnRestrictionLeg(TurnRestrictionLegRole.TO);
-		Set<OsmPrimitive> fromLegs = editorModel.getTurnRestrictionLeg(TurnRestrictionLegRole.FROM);
-		if (toLegs.size() != 1 || fromLegs.size() != 1) return;
-		
-		OsmPrimitive from = fromLegs.iterator().next();
-		OsmPrimitive to = toLegs.iterator().next();
-		
-		if (! (from instanceof Way)) return;
-		if (! (to instanceof Way)) return;
-		if (from.equals(to) && ! "no_u_turn".equals(editorModel.getRestrictionTagValue())){
-			// identical from and to allowed for "no_u_turn" only
-			//
-			issues.add(new IdenticalTurnRestrictionLegsError(this, from));
-		}		
-	}
-	
-	protected Node getNodeAtIntersection(Way from, Way to){
-		Set<Node> fromNodes = new HashSet<Node>(from.getNodes());
-		fromNodes.retainAll(to.getNodes());
-		if (fromNodes.size() == 1){
-			return fromNodes.iterator().next();
-		} else {
-			return null;
-		}
-	}
-	
-	/**
-	 * Checks the 'via' members in the turn restriction
-	 * 
-	 * @param editorModel the editor model
-	 */
-	protected void checkVias(TurnRestrictionEditorModel editorModel){
-		Set<OsmPrimitive> toLegs = editorModel.getTurnRestrictionLeg(TurnRestrictionLegRole.TO);
-		Set<OsmPrimitive> fromLegs = editorModel.getTurnRestrictionLeg(TurnRestrictionLegRole.FROM);
-		// we only check vias if 'to' and 'from' are already OK
-		if (toLegs.size() != 1 || fromLegs.size() != 1) return;
-		if (! (toLegs.iterator().next() instanceof Way)) return;
-		if (! (fromLegs.iterator().next() instanceof Way)) return;
-		
-		Way from = (Way)fromLegs.iterator().next();
-		Way to = (Way)toLegs.iterator().next();
-		Node intersect = getNodeAtIntersection(from, to);
-		if (intersect != null){
-			if (!editorModel.getVias().contains(intersect)) {
-				issues.add(new IntersectionMissingAsViaError(this, from, to, intersect));
-			}
-		}
-		
-		// 'from' intersects with 'to' - should be split  
-		if (intersect != null && from.getNode(0) != intersect && from.getNode(from.getNodesCount()-1) != intersect){
-			issues.add(new TurnRestrictionLegSplitRequiredError(this, TurnRestrictionLegRole.FROM, from, to, intersect));
-		}
-		// 'to' intersects with 'from' - should be split
-		if (intersect != null && to.getNode(0) != intersect && to.getNode(to.getNodesCount()-1) != intersect){
-			issues.add(new TurnRestrictionLegSplitRequiredError(this, TurnRestrictionLegRole.TO, from, to, intersect));
-		}		
-	}
-	
-	public NavigationControler getNavigationControler() {
-		return editorModel.getNavigationControler();
-	}
-	
-	public int getNumWarnings() {
-		int ret = 0;
-		for (Issue issue: issues){
-			if (issue.getSeverity().equals(Severity.WARNING)) ret++;
-		}
-		return ret;
-	}
-
-	public int getNumErrors() {
-		int ret = 0;
-		for (Issue issue: issues){
-			if (issue.getSeverity().equals(Severity.ERROR)) ret++;
-		}
-		return ret;
-	}
-
-	/* ------------------------------------------------------------------------------------- */
-	/* interface Observer                                                                    */
-	/* ------------------------------------------------------------------------------------- */
-	public void update(Observable o, Object arg) {
-		populate();		
-	}
+    private final ArrayList<Issue> issues = new ArrayList<Issue>();
+    private TurnRestrictionEditorModel editorModel;
+    
+    /**
+     * Creates the model 
+     * 
+     * {@code controler} is used in resolution actions for issues in
+     * this model to direct the user to a specific input field in one
+     * of the editor tabs in order to fix an issue. 
+     * 
+     * @param editorModel the editor model. Must not be null.
+     * @throws IllegalArgumentException thrown if controler is null
+     */
+    public IssuesModel(TurnRestrictionEditorModel editorModel) throws IllegalArgumentException{
+        CheckParameterUtil.ensureParameterNotNull(editorModel, "editorModel");
+        this.editorModel = editorModel;
+        this.editorModel.addObserver(this);
+    }
+    
+    /**
+     * Populates the model with a list of issues. Just clears the model
+     * if {@code issues} is null or empty. 
+     * 
+     * @param issues the list of issues. 
+     */
+    public void populate(List<Issue> issues){
+        this.issues.clear();
+        if (issues != null){
+            this.issues.addAll(issues);
+        }
+        setChanged();
+        notifyObservers();
+    }
+    
+    /**
+     * Replies the (unmodifiable) list of issues in this model.
+     * 
+     * @return the (unmodifiable) list of issues in this model.
+     */
+    public List<Issue> getIssues() {
+        return Collections.unmodifiableList(issues);
+    }
+    
+    /**
+     * Replies the turn restriction editor model 
+     * 
+     * @return
+     */
+    public TurnRestrictionEditorModel getEditorModel() {
+        return editorModel;
+    }
+    
+    /**
+     * Populates this model with issues derived from the state of the
+     * turn restriction editor model. If {@code editorModel} is null, the
+     * list of issues is cleared.
+     * 
+     * @param editorModel the editor model. 
+     */
+    public void populate() {
+        issues.clear();
+        if (editorModel != null) {
+            checkTags(editorModel);
+            checkFromLeg(editorModel);
+            checkToLeg(editorModel);
+            checkFromAndToEquals(editorModel);
+            checkVias(editorModel);
+        }
+        setChanged();
+        notifyObservers();
+    }
+    
+    /**
+     * Checks whether there are required tags missing. 
+     * 
+     * @param editorModel
+     */
+    protected void checkTags(TurnRestrictionEditorModel editorModel) {
+        TagEditorModel tagEditorModel = editorModel.getTagEditorModel();
+        TagModel tag = tagEditorModel.get("type");
+        
+        // missing marker tag for a turn restriction
+        if (tag == null || ! tag.getValue().trim().equals("restriction")) {
+            issues.add(new RequiredTagMissingError(this, "type", "restriction"));
+        }
+        
+        // missing or illegal restriction type ?
+        tag = tagEditorModel.get("restriction");
+        if (tag == null) {
+            issues.add(new MissingRestrictionTypeError(this));
+        } else if (!TurnRestrictionType.isStandardTagValue(tag.getValue())) {
+            issues.add(new IllegalRestrictionTypeError(this, tag.getValue()));
+        }
+
+        // non-standard value for the 'except' tag? 
+        ExceptValueModel except = getEditorModel().getExcept();
+        if (!except.isStandard()) {
+            issues.add(new NonStandardExceptWarning(this, except));
+        }
+    }
+    
+    /**
+     * Checks various data integrity restriction for the relation member with
+     * role 'from'.
+     * 
+     */
+    protected void checkFromLeg(TurnRestrictionEditorModel editorModel) {
+        Set<OsmPrimitive> froms = editorModel.getTurnRestrictionLeg(TurnRestrictionLegRole.FROM);
+        if (froms.isEmpty()){
+            issues.add(new MissingTurnRestrictionLegError(this, TurnRestrictionLegRole.FROM));
+            return;
+        } else if (froms.size() > 1){
+            issues.add(new MultipleTurnRestrictionLegError(this, TurnRestrictionLegRole.FROM, froms.size()));
+            return;
+        } 
+        OsmPrimitive p = froms.iterator().next();
+        if (! (p instanceof Way)) {
+            issues.add(new WrongTurnRestrictionLegTypeError(this, TurnRestrictionLegRole.FROM, p));
+        }
+    }
+    
+    /**
+     * Checks various data integrity restriction for the relation member with
+     * role 'to'.
+     * 
+     */
+    protected void checkToLeg(TurnRestrictionEditorModel editorModel) {
+        Set<OsmPrimitive> toLegs = editorModel.getTurnRestrictionLeg(TurnRestrictionLegRole.TO);
+        if (toLegs.isEmpty()){
+            issues.add(new MissingTurnRestrictionLegError(this, TurnRestrictionLegRole.TO));
+            return;
+        } else if (toLegs.size() > 1){
+            issues.add(new MultipleTurnRestrictionLegError(this, TurnRestrictionLegRole.TO, toLegs.size()));
+            return;
+        } 
+        OsmPrimitive p = toLegs.iterator().next();
+        if (! (p instanceof Way)) {
+            issues.add(new WrongTurnRestrictionLegTypeError(this, TurnRestrictionLegRole.TO, p));
+        }
+    }
+    
+    /**
+     * Creates an issue if this turn restriction has identical 'from' and to'.
+     * 
+     * @param editorModel
+     */
+    protected void checkFromAndToEquals(TurnRestrictionEditorModel editorModel){
+        Set<OsmPrimitive> toLegs = editorModel.getTurnRestrictionLeg(TurnRestrictionLegRole.TO);
+        Set<OsmPrimitive> fromLegs = editorModel.getTurnRestrictionLeg(TurnRestrictionLegRole.FROM);
+        if (toLegs.size() != 1 || fromLegs.size() != 1) return;
+        
+        OsmPrimitive from = fromLegs.iterator().next();
+        OsmPrimitive to = toLegs.iterator().next();
+        
+        if (! (from instanceof Way)) return;
+        if (! (to instanceof Way)) return;
+        if (from.equals(to) && ! "no_u_turn".equals(editorModel.getRestrictionTagValue())){
+            // identical from and to allowed for "no_u_turn" only
+            //
+            issues.add(new IdenticalTurnRestrictionLegsError(this, from));
+        }       
+    }
+    
+    protected Node getNodeAtIntersection(Way from, Way to){
+        Set<Node> fromNodes = new HashSet<Node>(from.getNodes());
+        fromNodes.retainAll(to.getNodes());
+        if (fromNodes.size() == 1){
+            return fromNodes.iterator().next();
+        } else {
+            return null;
+        }
+    }
+    
+    /**
+     * Checks the 'via' members in the turn restriction
+     * 
+     * @param editorModel the editor model
+     */
+    protected void checkVias(TurnRestrictionEditorModel editorModel){
+        Set<OsmPrimitive> toLegs = editorModel.getTurnRestrictionLeg(TurnRestrictionLegRole.TO);
+        Set<OsmPrimitive> fromLegs = editorModel.getTurnRestrictionLeg(TurnRestrictionLegRole.FROM);
+        // we only check vias if 'to' and 'from' are already OK
+        if (toLegs.size() != 1 || fromLegs.size() != 1) return;
+        if (! (toLegs.iterator().next() instanceof Way)) return;
+        if (! (fromLegs.iterator().next() instanceof Way)) return;
+        
+        Way from = (Way)fromLegs.iterator().next();
+        Way to = (Way)toLegs.iterator().next();
+        Node intersect = getNodeAtIntersection(from, to);
+        if (intersect != null){
+            if (!editorModel.getVias().contains(intersect)) {
+                issues.add(new IntersectionMissingAsViaError(this, from, to, intersect));
+            }
+        }
+        
+        // 'from' intersects with 'to' - should be split  
+        if (intersect != null && from.getNode(0) != intersect && from.getNode(from.getNodesCount()-1) != intersect){
+            issues.add(new TurnRestrictionLegSplitRequiredError(this, TurnRestrictionLegRole.FROM, from, to, intersect));
+        }
+        // 'to' intersects with 'from' - should be split
+        if (intersect != null && to.getNode(0) != intersect && to.getNode(to.getNodesCount()-1) != intersect){
+            issues.add(new TurnRestrictionLegSplitRequiredError(this, TurnRestrictionLegRole.TO, from, to, intersect));
+        }       
+    }
+    
+    public NavigationControler getNavigationControler() {
+        return editorModel.getNavigationControler();
+    }
+    
+    public int getNumWarnings() {
+        int ret = 0;
+        for (Issue issue: issues){
+            if (issue.getSeverity().equals(Severity.WARNING)) ret++;
+        }
+        return ret;
+    }
+
+    public int getNumErrors() {
+        int ret = 0;
+        for (Issue issue: issues){
+            if (issue.getSeverity().equals(Severity.ERROR)) ret++;
+        }
+        return ret;
+    }
+
+    /* ------------------------------------------------------------------------------------- */
+    /* interface Observer                                                                    */
+    /* ------------------------------------------------------------------------------------- */
+    public void update(Observable o, Object arg) {
+        populate();     
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/IssuesView.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/IssuesView.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/IssuesView.java	(revision 23192)
@@ -17,56 +17,56 @@
  */
 public class IssuesView extends VerticallyScrollablePanel implements Observer{
-	static private final Logger logger = Logger.getLogger(IssuesView.class.getName());
-	
-	/** the issues model */
-	private IssuesModel model;
-	
-	protected void build(){
-		setLayout(new GridBagLayout());
-	}
-	
-	/**
-	 * Creates the view 
-	 * 
-	 * @param model the model. Must not be null.
-	 * @exception IllegalArgumentException thrown if model is null
-	 */
-	public IssuesView(IssuesModel model) throws IllegalArgumentException{
-		CheckParameterUtil.ensureParameterNotNull(model, "model");
-		this.model = model;
-		model.addObserver(this);
-		build();
-		HelpUtil.setHelpContext(this, HelpUtil.ht("/Plugins/turnrestrictions#ErrorsAndWarnings"));
-	}
-	
-	/**
-	 * Refreshes the view with the current state in the model
-	 */
-	public void refresh() {
-		removeAll();
-		if (! model.getIssues().isEmpty()){
-			GridBagConstraints gc = new GridBagConstraints();
-			gc.anchor = GridBagConstraints.NORTHWEST;
-			gc.fill = GridBagConstraints.HORIZONTAL;
-			gc.weightx = 1.0;
-			gc.weighty = 0.0;
-			gc.gridx = 0;
-			gc.gridy = 0;
-			for (Issue issue: model.getIssues()){
-				add(new IssueView(issue), gc);
-				gc.gridy++;
-			}
-			// filler - grabs remaining space
-			gc.weighty = 1.0;			
-			add(new JPanel(), gc);
-		}
-		invalidate();
-	}
+    static private final Logger logger = Logger.getLogger(IssuesView.class.getName());
+    
+    /** the issues model */
+    private IssuesModel model;
+    
+    protected void build(){
+        setLayout(new GridBagLayout());
+    }
+    
+    /**
+     * Creates the view 
+     * 
+     * @param model the model. Must not be null.
+     * @exception IllegalArgumentException thrown if model is null
+     */
+    public IssuesView(IssuesModel model) throws IllegalArgumentException{
+        CheckParameterUtil.ensureParameterNotNull(model, "model");
+        this.model = model;
+        model.addObserver(this);
+        build();
+        HelpUtil.setHelpContext(this, HelpUtil.ht("/Plugins/turnrestrictions#ErrorsAndWarnings"));
+    }
+    
+    /**
+     * Refreshes the view with the current state in the model
+     */
+    public void refresh() {
+        removeAll();
+        if (! model.getIssues().isEmpty()){
+            GridBagConstraints gc = new GridBagConstraints();
+            gc.anchor = GridBagConstraints.NORTHWEST;
+            gc.fill = GridBagConstraints.HORIZONTAL;
+            gc.weightx = 1.0;
+            gc.weighty = 0.0;
+            gc.gridx = 0;
+            gc.gridy = 0;
+            for (Issue issue: model.getIssues()){
+                add(new IssueView(issue), gc);
+                gc.gridy++;
+            }
+            // filler - grabs remaining space
+            gc.weighty = 1.0;           
+            add(new JPanel(), gc);
+        }
+        invalidate();
+    }
 
-	/* ------------------------------------------------------------------------------- */
-	/* interface Observer                                                              */
-	/* ------------------------------------------------------------------------------- */
-	public void update(Observable o, Object arg) {
-		refresh();		
-	}
+    /* ------------------------------------------------------------------------------- */
+    /* interface Observer                                                              */
+    /* ------------------------------------------------------------------------------- */
+    public void update(Observable o, Object arg) {
+        refresh();      
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/MissingRestrictionTypeError.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/MissingRestrictionTypeError.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/MissingRestrictionTypeError.java	(revision 23192)
@@ -15,23 +15,23 @@
  */
 public class MissingRestrictionTypeError extends Issue{
-	
-	public MissingRestrictionTypeError(IssuesModel parent) {
-		super(parent, Severity.ERROR);
-		actions.add(new FixInEditorAction());
-	}
+    
+    public MissingRestrictionTypeError(IssuesModel parent) {
+        super(parent, Severity.ERROR);
+        actions.add(new FixInEditorAction());
+    }
 
-	@Override
-	public String getText() {
-		return tr("A turn restriction must declare the type of restriction. Please select a type in the Basic Editor.");				
-	}
-	
-	class FixInEditorAction extends AbstractAction {
-		public FixInEditorAction() {
-			putValue(NAME, tr("Fix in editor"));
-			putValue(SHORT_DESCRIPTION, tr("Go to Basic Editor and manually choose a turn restriction type"));
-		}
-		public void actionPerformed(ActionEvent e) {
-			getIssuesModel().getNavigationControler().gotoBasicEditor(NavigationControler.BasicEditorFokusTargets.RESTRICION_TYPE);			
-		}		
-	}
+    @Override
+    public String getText() {
+        return tr("A turn restriction must declare the type of restriction. Please select a type in the Basic Editor.");                
+    }
+    
+    class FixInEditorAction extends AbstractAction {
+        public FixInEditorAction() {
+            putValue(NAME, tr("Fix in editor"));
+            putValue(SHORT_DESCRIPTION, tr("Go to Basic Editor and manually choose a turn restriction type"));
+        }
+        public void actionPerformed(ActionEvent e) {
+            getIssuesModel().getNavigationControler().gotoBasicEditor(NavigationControler.BasicEditorFokusTargets.RESTRICION_TYPE);         
+        }       
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/MissingTurnRestrictionLegError.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/MissingTurnRestrictionLegError.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/MissingTurnRestrictionLegError.java	(revision 23192)
@@ -15,55 +15,55 @@
  */
 public class MissingTurnRestrictionLegError extends Issue {
-	private TurnRestrictionLegRole role;
+    private TurnRestrictionLegRole role;
 
-	/**
-	 * Creates the issue. 
-	 * 
-	 * @param parent the parent model 
-	 * @param role the role of the missing way
-	 */
-	public MissingTurnRestrictionLegError(IssuesModel parent, TurnRestrictionLegRole role) {
-		super(parent, Severity.ERROR);
-		this.role = role;
-		actions.add(new FixAction());
-	}
+    /**
+     * Creates the issue. 
+     * 
+     * @param parent the parent model 
+     * @param role the role of the missing way
+     */
+    public MissingTurnRestrictionLegError(IssuesModel parent, TurnRestrictionLegRole role) {
+        super(parent, Severity.ERROR);
+        this.role = role;
+        actions.add(new FixAction());
+    }
 
-	@Override
-	public String getText() {
-		String msg = "";
-		switch(role){
-		case FROM: 
-			msg = tr("An OSM way with role <tt>from</tt> is required in a turn restriction.");
-			break;
-		case TO: 
-			msg = tr("An OSM way with role <tt>to</tt> is required in a turn restriction.");
-			break;
-		}
-		msg += " " + tr("Please go to the Basic editor and manually choose an OSM way.");
-		return msg;
-	}
+    @Override
+    public String getText() {
+        String msg = "";
+        switch(role){
+        case FROM: 
+            msg = tr("An OSM way with role <tt>from</tt> is required in a turn restriction.");
+            break;
+        case TO: 
+            msg = tr("An OSM way with role <tt>to</tt> is required in a turn restriction.");
+            break;
+        }
+        msg += " " + tr("Please go to the Basic editor and manually choose an OSM way.");
+        return msg;
+    }
 
-	class FixAction extends AbstractAction {
-		public FixAction() {
-			putValue(NAME, tr("Add in editor"));
-			switch(role){
-			case FROM:
-				putValue(SHORT_DESCRIPTION, tr("Add an OSM way with role ''from''"));
-				break;
-			case TO:
-				putValue(SHORT_DESCRIPTION, tr("Add an OSM way with role ''to''"));
-				break;				
-			}			
-		}
-		public void actionPerformed(ActionEvent e) {
-			switch(role){
-			case FROM:
-				getIssuesModel().getNavigationControler().gotoBasicEditor(FROM);
-				break;
-			case TO:
-				getIssuesModel().getNavigationControler().gotoBasicEditor(TO);
-				break;				
-			}			
-		}		
-	}
+    class FixAction extends AbstractAction {
+        public FixAction() {
+            putValue(NAME, tr("Add in editor"));
+            switch(role){
+            case FROM:
+                putValue(SHORT_DESCRIPTION, tr("Add an OSM way with role ''from''"));
+                break;
+            case TO:
+                putValue(SHORT_DESCRIPTION, tr("Add an OSM way with role ''to''"));
+                break;              
+            }           
+        }
+        public void actionPerformed(ActionEvent e) {
+            switch(role){
+            case FROM:
+                getIssuesModel().getNavigationControler().gotoBasicEditor(FROM);
+                break;
+            case TO:
+                getIssuesModel().getNavigationControler().gotoBasicEditor(TO);
+                break;              
+            }           
+        }       
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/MultipleTurnRestrictionLegError.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/MultipleTurnRestrictionLegError.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/MultipleTurnRestrictionLegError.java	(revision 23192)
@@ -14,50 +14,50 @@
  */
 public class MultipleTurnRestrictionLegError extends Issue {
-	private TurnRestrictionLegRole role;
-	private int numLegs;
-	
-	/**
-	 * Create the issue
-	 * 
-	 * @param parent the parent model 
-	 * @param role the role of the turn restriction leg with multiple entries 
-	 * @param numLegs the number of legs
-	 */
-	public MultipleTurnRestrictionLegError(IssuesModel parent, TurnRestrictionLegRole role, int numLegs) {
-		super(parent, Severity.ERROR);
-		this.role = role;
-		this.numLegs = numLegs;
-		actions.add(new FixAction());
-	}
+    private TurnRestrictionLegRole role;
+    private int numLegs;
+    
+    /**
+     * Create the issue
+     * 
+     * @param parent the parent model 
+     * @param role the role of the turn restriction leg with multiple entries 
+     * @param numLegs the number of legs
+     */
+    public MultipleTurnRestrictionLegError(IssuesModel parent, TurnRestrictionLegRole role, int numLegs) {
+        super(parent, Severity.ERROR);
+        this.role = role;
+        this.numLegs = numLegs;
+        actions.add(new FixAction());
+    }
 
-	@Override
-	public String getText() {
-		switch(role){
-		case FROM:  
-			return tr("A turn restriction requires exactly one way with role <tt>from</tt>. "
-				+ "This turn restriction has {0} ways in this role. Please remove "
-				+ "{1} of them.",
-				numLegs,
-				numLegs -1
-			);
-		case TO: 
-			return tr("A turn restriction requires exactly one way with role <tt>to</tt>. "
-					+ "This turn restriction has {0} ways in this role. Please remove "
-					+ "{1} of them.",
-					numLegs,
-					numLegs -1
-				);
-		}
-		return "";
-	}
+    @Override
+    public String getText() {
+        switch(role){
+        case FROM:  
+            return tr("A turn restriction requires exactly one way with role <tt>from</tt>. "
+                + "This turn restriction has {0} ways in this role. Please remove "
+                + "{1} of them.",
+                numLegs,
+                numLegs -1
+            );
+        case TO: 
+            return tr("A turn restriction requires exactly one way with role <tt>to</tt>. "
+                    + "This turn restriction has {0} ways in this role. Please remove "
+                    + "{1} of them.",
+                    numLegs,
+                    numLegs -1
+                );
+        }
+        return "";
+    }
 
-	class FixAction extends AbstractAction {
-		public FixAction() {
-			putValue(NAME, tr("Fix in editor"));
-			putValue(SHORT_DESCRIPTION, tr("Go to the Advanced Editor and remove the members"));
-		}
-		public void actionPerformed(ActionEvent e) {
-			getIssuesModel().getNavigationControler().gotoAdvancedEditor();
-		}		
-	}
+    class FixAction extends AbstractAction {
+        public FixAction() {
+            putValue(NAME, tr("Fix in editor"));
+            putValue(SHORT_DESCRIPTION, tr("Go to the Advanced Editor and remove the members"));
+        }
+        public void actionPerformed(ActionEvent e) {
+            getIssuesModel().getNavigationControler().gotoAdvancedEditor();
+        }       
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/NonStandardExceptWarning.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/NonStandardExceptWarning.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/NonStandardExceptWarning.java	(revision 23192)
@@ -14,27 +14,27 @@
  */
 public class NonStandardExceptWarning extends Issue{
-	private ExceptValueModel value;
-	public NonStandardExceptWarning(IssuesModel parent, ExceptValueModel value) {
-		super(parent, Severity.WARNING);
-		actions.add(new FixInEditorAction());
-		this.value  = value;
-	}
+    private ExceptValueModel value;
+    public NonStandardExceptWarning(IssuesModel parent, ExceptValueModel value) {
+        super(parent, Severity.WARNING);
+        actions.add(new FixInEditorAction());
+        this.value  = value;
+    }
 
-	@Override
-	public String getText() {		
-		return tr("The tag <tt>except</tt> has the non-standard value <tt>{0}</tt>. "
-				+ "It is recommended to use standard values for <tt>except</tt> only.",
-				value.getValue()
-				);				
-	}
-	
-	class FixInEditorAction extends AbstractAction {
-		public FixInEditorAction() {
-			putValue(NAME, tr("Fix in editor"));
-			putValue(SHORT_DESCRIPTION, tr("Go to Basic Editor and select standard vehicle type based exceptions"));
-		}
-		public void actionPerformed(ActionEvent e) {
-			getIssuesModel().getNavigationControler().gotoBasicEditor();		
-		}		
-	}
+    @Override
+    public String getText() {       
+        return tr("The tag <tt>except</tt> has the non-standard value <tt>{0}</tt>. "
+                + "It is recommended to use standard values for <tt>except</tt> only.",
+                value.getValue()
+                );              
+    }
+    
+    class FixInEditorAction extends AbstractAction {
+        public FixInEditorAction() {
+            putValue(NAME, tr("Fix in editor"));
+            putValue(SHORT_DESCRIPTION, tr("Go to Basic Editor and select standard vehicle type based exceptions"));
+        }
+        public void actionPerformed(ActionEvent e) {
+            getIssuesModel().getNavigationControler().gotoBasicEditor();        
+        }       
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/RequiredTagMissingError.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/RequiredTagMissingError.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/RequiredTagMissingError.java	(revision 23192)
@@ -15,44 +15,44 @@
  */
 public class RequiredTagMissingError extends Issue {
-	static private final Logger logger = Logger.getLogger(RequiredTagMissingError.class.getName());
-	private String tagKey;
-	private String tagValue;
-	
-	/**
-	 * Create the issue 
-	 * 
-	 * @param parent the issues model
-	 * @param tagKey the tag key 
-	 * @param tagValue the tag value 
-	 */
-	public RequiredTagMissingError(IssuesModel parent, String tagKey, String tagValue) {
-		super(parent, Severity.ERROR);
-		this.tagKey = tagKey;
-		this.tagValue = tagValue;
-		actions.add(new AddTagAction());
-	}
+    static private final Logger logger = Logger.getLogger(RequiredTagMissingError.class.getName());
+    private String tagKey;
+    private String tagValue;
+    
+    /**
+     * Create the issue 
+     * 
+     * @param parent the issues model
+     * @param tagKey the tag key 
+     * @param tagValue the tag value 
+     */
+    public RequiredTagMissingError(IssuesModel parent, String tagKey, String tagValue) {
+        super(parent, Severity.ERROR);
+        this.tagKey = tagKey;
+        this.tagValue = tagValue;
+        actions.add(new AddTagAction());
+    }
 
-	@Override
-	public String getText() {	
-		return tr("The required tag <tt>{0}={1}</tt> is missing.",				
-				this.tagKey,
-				this.tagValue
-		);
-	}
+    @Override
+    public String getText() {   
+        return tr("The required tag <tt>{0}={1}</tt> is missing.",              
+                this.tagKey,
+                this.tagValue
+        );
+    }
 
-	private class AddTagAction extends AbstractAction {
-		public AddTagAction(){
-			putValue(NAME,tr("Add missing tag"));
-			putValue(SHORT_DESCRIPTION, tr("Add the missing tag {0}={1}", tagKey, tagValue));		
-		}
-		
-		public void actionPerformed(ActionEvent e) {
-			TagEditorModel model = getIssuesModel().getEditorModel().getTagEditorModel();
-			TagModel t = model.get(tagKey);
-			if (t == null){
-				t = new TagModel(tagKey, tagValue);
-				model.prepend(t);
-			}			
-		}		 
-	}
+    private class AddTagAction extends AbstractAction {
+        public AddTagAction(){
+            putValue(NAME,tr("Add missing tag"));
+            putValue(SHORT_DESCRIPTION, tr("Add the missing tag {0}={1}", tagKey, tagValue));       
+        }
+        
+        public void actionPerformed(ActionEvent e) {
+            TagEditorModel model = getIssuesModel().getEditorModel().getTagEditorModel();
+            TagModel t = model.get(tagKey);
+            if (t == null){
+                t = new TagModel(tagKey, tagValue);
+                model.prepend(t);
+            }           
+        }        
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/Severity.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/Severity.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/Severity.java	(revision 23192)
@@ -2,5 +2,5 @@
 
 public enum Severity {
-	WARNING,
-	ERROR
+    WARNING,
+    ERROR
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/TurnRestrictionLegSplitRequiredError.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/TurnRestrictionLegSplitRequiredError.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/TurnRestrictionLegSplitRequiredError.java	(revision 23192)
@@ -23,74 +23,74 @@
  */
 public class TurnRestrictionLegSplitRequiredError extends Issue{
-	private TurnRestrictionLegRole role;
-	private Way from;
-	private Way to;
-	private Node interesect;
+    private TurnRestrictionLegRole role;
+    private Way from;
+    private Way to;
+    private Node interesect;
 
-	/**
-	 * Create the issue
-	 *
-	 * @param parent the parent model
-	 * @param role the role of the way which should be splitted
-	 * @param from the way with role 'from'
-	 * @param to the way with role 'to'
-	 * @param interesect the node at the intersection
-	 */
-	public TurnRestrictionLegSplitRequiredError(IssuesModel parent, TurnRestrictionLegRole role, Way from, Way to, Node intersect) {
-		super(parent, Severity.ERROR);
-		this.role = role;
-		this.from = from;
-		this.to = to;
-		this.interesect = intersect;
-		actions.add(new SplitAction());
-	}
+    /**
+     * Create the issue
+     *
+     * @param parent the parent model
+     * @param role the role of the way which should be splitted
+     * @param from the way with role 'from'
+     * @param to the way with role 'to'
+     * @param interesect the node at the intersection
+     */
+    public TurnRestrictionLegSplitRequiredError(IssuesModel parent, TurnRestrictionLegRole role, Way from, Way to, Node intersect) {
+        super(parent, Severity.ERROR);
+        this.role = role;
+        this.from = from;
+        this.to = to;
+        this.interesect = intersect;
+        actions.add(new SplitAction());
+    }
 
-	@Override
-	public String getText() {
-		String msg = null;
-		switch(role){
-		case FROM:
-			msg = tr("The OSM way <span class=\"object-name\">{0}</span> with role <tt>{1}</tt> should be split "
-				+ "at node <span class=\"object-name\">{2}</span> where it connects to way <span class=\"object-name\">{3}</span>.",
-				from.getDisplayName(DefaultNameFormatter.getInstance()),
-				role.getOsmRole(),
-				interesect.getDisplayName(DefaultNameFormatter.getInstance()),
-				to.getDisplayName(DefaultNameFormatter.getInstance())
-			);
-			break;
-		case TO:
-			msg = tr("The OSM way <span class=\"object-name\">{0}</span> with role <tt>{1}</tt> should be split "
-					+ "at node <span class=\"object-name\">{2}</span> where it connects to way <span class=\"object-name\">{3}</span>.",
-					to.getDisplayName(DefaultNameFormatter.getInstance()),
-					role.getOsmRole(),
-					interesect.getDisplayName(DefaultNameFormatter.getInstance()),
-					from.getDisplayName(DefaultNameFormatter.getInstance())
-				);
-			break;
-		}
-		return msg;
-	}
+    @Override
+    public String getText() {
+        String msg = null;
+        switch(role){
+        case FROM:
+            msg = tr("The OSM way <span class=\"object-name\">{0}</span> with role <tt>{1}</tt> should be split "
+                + "at node <span class=\"object-name\">{2}</span> where it connects to way <span class=\"object-name\">{3}</span>.",
+                from.getDisplayName(DefaultNameFormatter.getInstance()),
+                role.getOsmRole(),
+                interesect.getDisplayName(DefaultNameFormatter.getInstance()),
+                to.getDisplayName(DefaultNameFormatter.getInstance())
+            );
+            break;
+        case TO:
+            msg = tr("The OSM way <span class=\"object-name\">{0}</span> with role <tt>{1}</tt> should be split "
+                    + "at node <span class=\"object-name\">{2}</span> where it connects to way <span class=\"object-name\">{3}</span>.",
+                    to.getDisplayName(DefaultNameFormatter.getInstance()),
+                    role.getOsmRole(),
+                    interesect.getDisplayName(DefaultNameFormatter.getInstance()),
+                    from.getDisplayName(DefaultNameFormatter.getInstance())
+                );
+            break;
+        }
+        return msg;
+    }
 
-	class SplitAction extends AbstractAction {
-		public SplitAction() {
-			putValue(NAME, tr("Split now"));
-			putValue(SHORT_DESCRIPTION, tr("Splits the way"));
-		}
-		public void actionPerformed(ActionEvent e) {
-			Way way = null;
-			switch(role){
-			case FROM: way = from; break;
-			case TO: way = to; break;
-			}
-			SplitWayResult result = SplitWayAction.split(
-					parent.getEditorModel().getLayer(),
-					way,
-					Collections.singletonList(interesect),
-					Collections.<OsmPrimitive>emptyList()
-			);
-			if (result != null){
-				Main.main.undoRedo.add(result.getCommand());
-			}
-		}
-	}
+    class SplitAction extends AbstractAction {
+        public SplitAction() {
+            putValue(NAME, tr("Split now"));
+            putValue(SHORT_DESCRIPTION, tr("Splits the way"));
+        }
+        public void actionPerformed(ActionEvent e) {
+            Way way = null;
+            switch(role){
+            case FROM: way = from; break;
+            case TO: way = to; break;
+            }
+            SplitWayResult result = SplitWayAction.split(
+                    parent.getEditorModel().getLayer(),
+                    way,
+                    Collections.singletonList(interesect),
+                    Collections.<OsmPrimitive>emptyList()
+            );
+            if (result != null){
+                Main.main.undoRedo.add(result.getCommand());
+            }
+        }
+    }
 }
Index: applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/WrongTurnRestrictionLegTypeError.java
===================================================================
--- applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/WrongTurnRestrictionLegTypeError.java	(revision 22477)
+++ applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/qa/WrongTurnRestrictionLegTypeError.java	(revision 23192)
@@ -19,77 +19,77 @@
  */
 public class WrongTurnRestrictionLegTypeError extends Issue {
-	private TurnRestrictionLegRole role;
-	private OsmPrimitive leg;
+    private TurnRestrictionLegRole role;
+    private OsmPrimitive leg;
 
-	/**
-	 * Create the issue 
-	 * 
-	 * @param parent the parent model 
-	 * @param role the role of the turn restriction leg
-	 * @param leg the leg 
-	 */
-	public WrongTurnRestrictionLegTypeError(IssuesModel parent, TurnRestrictionLegRole role, OsmPrimitive leg) {
-		super(parent, Severity.ERROR);
-		this.role = role;
-		this.leg = leg;
-		actions.add(new DeleteAction());
-		actions.add(new FixInEditorAction());
-	}
+    /**
+     * Create the issue 
+     * 
+     * @param parent the parent model 
+     * @param role the role of the turn restriction leg
+     * @param leg the leg 
+     */
+    public WrongTurnRestrictionLegTypeError(IssuesModel parent, TurnRestrictionLegRole role, OsmPrimitive leg) {
+        super(parent, Severity.ERROR);
+        this.role = role;
+        this.leg = leg;
+        actions.add(new DeleteAction());
+        actions.add(new FixInEditorAction());
+    }
 
-	@Override
-	public String getText() {		
-		String msg = null;
-		switch(leg.getType()){
-		case NODE:
-			msg = tr(
-				"This turn restriction uses the OSM node <span class=\"object-name\">{0}</span> as member with role <tt>{1}</tt>.",
-				leg.getDisplayName(DefaultNameFormatter.getInstance()),
-				role.toString()
-			);
-			break;
-		case RELATION:
-			msg = tr("This turn restriction uses the OSM relation <span class=\"object-name\">{0}</span> as member with role <tt>{1}</tt>.",
-					leg.getDisplayName(DefaultNameFormatter.getInstance()),
-					role.toString()
-				);				
-			break;			
-		}
-		return msg + " " + tr("An OSM way is required instead.");
-	}
+    @Override
+    public String getText() {       
+        String msg = null;
+        switch(leg.getType()){
+        case NODE:
+            msg = tr(
+                "This turn restriction uses the OSM node <span class=\"object-name\">{0}</span> as member with role <tt>{1}</tt>.",
+                leg.getDisplayName(DefaultNameFormatter.getInstance()),
+                role.toString()
+            );
+            break;
+        case RELATION:
+            msg = tr("This turn restriction uses the OSM relation <span class=\"object-name\">{0}</span> as member with role <tt>{1}</tt>.",
+                    leg.getDisplayName(DefaultNameFormatter.getInstance()),
+                    role.toString()
+                );              
+            break;          
+        }
+        return msg + " " + tr("An OSM way is required instead.");
+    }
 
-	class DeleteAction extends AbstractAction {
-		public DeleteAction() {
-			putValue(NAME, tr("Delete"));
-			putValue(SHORT_DESCRIPTION, tr("Delete the member from the turn restriction"));
-		}
-		public void actionPerformed(ActionEvent e) {
-			RelationMemberEditorModel model = getIssuesModel().getEditorModel().getRelationMemberEditorModel();
-			switch(role){
-			case FROM: 
-				model.setFromPrimitive(null);
-				break;
-			case TO:
-				model.setToPrimitive(null);
-				break;
-			}
-		}		
-	}
-	
-	class FixInEditorAction extends AbstractAction {
-		public FixInEditorAction() {
-			putValue(NAME, tr("Fix in editor"));
-			putValue(SHORT_DESCRIPTION, tr("Change to the Basic Editor and select an OSM way"));
-		}
-		public void actionPerformed(ActionEvent e) {
-			NavigationControler controler = getIssuesModel().getNavigationControler();
-			switch(role){
-			case FROM: 
-				controler.gotoBasicEditor(BasicEditorFokusTargets.FROM);
-				break;
-			case TO:
-				controler.gotoBasicEditor(BasicEditorFokusTargets.TO);
-				break;
-			}
-		}		
-	}
+    class DeleteAction extends AbstractAction {
+        public DeleteAction() {
+            putValue(NAME, tr("Delete"));
+            putValue(SHORT_DESCRIPTION, tr("Delete the member from the turn restriction"));
+        }
+        public void actionPerformed(ActionEvent e) {
+            RelationMemberEditorModel model = getIssuesModel().getEditorModel().getRelationMemberEditorModel();
+            switch(role){
+            case FROM: 
+                model.setFromPrimitive(null);
+                break;
+            case TO:
+                model.setToPrimitive(null);
+                break;
+            }
+        }       
+    }
+    
+    class FixInEditorAction extends AbstractAction {
+        public FixInEditorAction() {
+            putValue(NAME, tr("Fix in editor"));
+            putValue(SHORT_DESCRIPTION, tr("Change to the Basic Editor and select an OSM way"));
+        }
+        public void actionPerformed(ActionEvent e) {
+            NavigationControler controler = getIssuesModel().getNavigationControler();
+            switch(role){
+            case FROM: 
+                controler.gotoBasicEditor(BasicEditorFokusTargets.FROM);
+                break;
+            case TO:
+                controler.gotoBasicEditor(BasicEditorFokusTargets.TO);
+                break;
+            }
+        }       
+    }
 }
