Index: applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ErrorLayer.java
===================================================================
--- applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ErrorLayer.java	(revision 6388)
+++ applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ErrorLayer.java	(revision 6389)
@@ -31,11 +31,9 @@
 public class ErrorLayer extends Layer implements LayerChangeListener
 {
-	/**
-	 * Constructor 
-	 * @param name
-	 */
-	public ErrorLayer(String name) 
-    {
-		super(name);
+	private OSMValidatorPlugin plugin;
+
+	public ErrorLayer(OSMValidatorPlugin plugin) {
+		super(tr("Validation errors"));
+		this.plugin = plugin;
         Layer.listeners.add(this); 
 	}
@@ -57,5 +55,5 @@
     public void paint(final Graphics g, final MapView mv) 
     {
-        DefaultMutableTreeNode root = OSMValidatorPlugin.getPlugin().validationDialog.tree.getRoot();
+        DefaultMutableTreeNode root = plugin.validationDialog.tree.getRoot();
         if( root == null || root.getChildCount() == 0)
             return;
@@ -85,5 +83,5 @@
     {
         Bag<Severity, TestError> errorTree = new Bag<Severity, TestError>();
-        List<TestError> errors = OSMValidatorPlugin.getPlugin().validationDialog.tree.getErrors();
+        List<TestError> errors = plugin.validationDialog.tree.getErrors();
         for(TestError e : errors)
         {
Index: applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/OSMValidatorPlugin.java
===================================================================
--- applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/OSMValidatorPlugin.java	(revision 6388)
+++ applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/OSMValidatorPlugin.java	(revision 6389)
@@ -31,5 +31,5 @@
 {
     /** The validate action */
-    ValidateAction validateAction = new ValidateAction();
+    ValidateAction validateAction = new ValidateAction(this);
     
     /** The validation dialog */
@@ -70,5 +70,5 @@
 	public PreferenceSetting getPreferenceSetting() 
 	{
-		return new PreferenceEditor();
+		return new PreferenceEditor(this);
 	}
 	
@@ -78,7 +78,7 @@
 		if (newFrame != null)
 		{
-		    validationDialog = new ValidatorDialog();
+		    validationDialog = new ValidatorDialog(this);
 	        newFrame.addToggleDialog(validationDialog);
-            Main.main.addLayer(new ErrorLayer(tr("Validation errors")));
+            Main.main.addLayer(new ErrorLayer(this));
         	if( Main.pref.hasKey(PreferenceEditor.PREF_DEBUG + ".grid") )
         		Main.main.addLayer(new GridLayer(tr("Grid")));
@@ -101,15 +101,4 @@
 		if( newFrame != null )
 			hooks.add( 0, new ValidateUploadHook() );
-	}
-
-	
-	/**
-	 * Utility method for classes that can't access the plugin directly
-	 * 
-	 * @return The plugin object
-	 */
-	public static OSMValidatorPlugin getPlugin() 
-	{
-		return (OSMValidatorPlugin)Util.getPlugin(OSMValidatorPlugin.class);
 	}
 
Index: applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/PreferenceEditor.java
===================================================================
--- applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/PreferenceEditor.java	(revision 6388)
+++ applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/PreferenceEditor.java	(revision 6389)
@@ -24,4 +24,6 @@
 public class PreferenceEditor implements PreferenceSetting
 {
+	private OSMValidatorPlugin plugin;
+
 	/** The preferences prefix */
 	public static final String PREFIX = "validator";
@@ -38,4 +40,8 @@
 	/** The list of all tests */
 	private Collection<Test> allTests;
+
+	public PreferenceEditor(OSMValidatorPlugin plugin) {
+		this.plugin = plugin;
+	}
 
     public void addGui(PreferenceDialog gui)
@@ -81,5 +87,5 @@
 		if (testsBeforeUpload.length() > 0 ) testsBeforeUpload = testsBeforeUpload.deleteCharAt(0);
 		
-		OSMValidatorPlugin.getPlugin().initializeTests( allTests );
+		plugin.initializeTests( allTests );
 		
 		Main.pref.put( PREF_TESTS, tests.toString());
Index: applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidateAction.java
===================================================================
--- applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidateAction.java	(revision 6388)
+++ applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidateAction.java	(revision 6389)
@@ -23,4 +23,6 @@
 public class ValidateAction extends JosmAction 
 {
+	private OSMValidatorPlugin plugin;
+
 	/** Serializable ID */
     private static final long serialVersionUID = -2304521273582574603L;
@@ -32,7 +34,7 @@
 	 * Constructor
 	 */
-	public ValidateAction()
-	{
+	public ValidateAction(OSMValidatorPlugin plugin) {
 		super("Validation", "validator", "Performs the data validation", KeyEvent.VK_V, KeyEvent.CTRL_DOWN_MASK + KeyEvent.ALT_MASK, true);
+		this.plugin = plugin;
 	}
 
@@ -54,5 +56,4 @@
 	public void doValidate(@SuppressWarnings("unused") ActionEvent ev, boolean getSelectedItems)
 	{
-		OSMValidatorPlugin plugin = OSMValidatorPlugin.getPlugin();
         if( plugin.validateAction == null || Main.map == null || !Main.map.isVisible() )
             return;
Index: applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidatorDialog.java
===================================================================
--- applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidatorDialog.java	(revision 6388)
+++ applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidatorDialog.java	(revision 6389)
@@ -32,4 +32,6 @@
 public class ValidatorDialog extends ToggleDialog implements ActionListener
 {
+	private OSMValidatorPlugin plugin;
+
     /** Serializable ID */
     private static final long serialVersionUID = 2952292777351992696L;
@@ -56,7 +58,8 @@
      * Constructor
      */
-    public ValidatorDialog() 
-    {
+    public ValidatorDialog(OSMValidatorPlugin plugin) {
         super(tr("Validation errors"), "validator", tr("Open the validation window."), KeyEvent.VK_V, 150);
+
+		this.plugin = plugin;
         
         tree = new ErrorTreePanel();
@@ -134,5 +137,5 @@
 		DataSet.fireSelectionChanged(Main.ds.getSelected());
 		       
-    	OSMValidatorPlugin.getPlugin().validateAction.doValidate(e, false);
+    	plugin.validateAction.doValidate(e, false);
 	}	
 	
@@ -177,5 +180,5 @@
 			setSelectedItems();
 		else if( actionCommand.equals("Validate"))
-	    	OSMValidatorPlugin.getPlugin().validateAction.actionPerformed(e);
+	    	plugin.validateAction.actionPerformed(e);
 		else if( actionCommand.equals("Fix"))
 	    	fixErrors(e); 
Index: applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/Util.java
===================================================================
--- applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/Util.java	(revision 6388)
+++ applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/Util.java	(revision 6389)
@@ -26,25 +26,4 @@
 public class Util 
 {
-
-    /**
-     * Utility method to retrieve the plugin for classes that can't access to the plugin object directly.
-     * 
-     * @param clazz The plugin class
-     * @return The YWMS plugin
-     */
-    public static Plugin getPlugin(Class<? extends Plugin> clazz)
-    {
-    	String classname = clazz.getName();
-        for (PluginProxy plugin : Main.plugins)
-        {
-            if( plugin.info.className.equals(classname) )
-            {
-                return (Plugin)plugin.plugin;
-            }
-        }
-        
-        return null;
-    }
-    
 	/** 
 	 * Returns the plugin's directory of the plugin
