Index: plications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/MapdustDownloadThread.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/MapdustDownloadThread.java	(revision 25126)
+++ 	(revision )
@@ -1,130 +1,0 @@
-/* Copyright (c) 2010, skobbler GmbH
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its
- *    contributors may be used to endorse or promote products derived from this
- *    software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-package org.openstreetmap.josm.plugins.mapdust;
-
-
-import java.awt.geom.Point2D;
-import java.util.concurrent.TimeUnit;
-import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.plugins.mapdust.gui.value.MapdustPluginState;
-
-
-/**
- * The MapDust download thread. Download the MapDust bugs in a given period of
- * time.
- *
- * @author Bea
- * @version $Revision$
- */
-public class MapdustDownloadThread extends Thread {
-
-    /** The <code>MapdustDownloadThread</code> instance */
-    private static MapdustDownloadThread instance;
-
-    /** Specifies if the download was done or not */
-    private boolean downloadDone = false;
-
-    /** The interval */
-    private final long INTERVAL = TimeUnit.MINUTES.toMillis(30);
-
-    /** The <code>MapdustPlugin</code> object */
-    private MapdustPlugin plugin;
-
-    /** The <code>Point2D</code> object */
-    private Point2D lastCenter;
-
-    /**
-     * Builds a <code>MapdustDownloadThread</code> object.
-     */
-    public MapdustDownloadThread() {
-        setName("Downloading Mapdust data!");
-        start();
-    }
-
-    /**
-     *
-     * @return A <code>MapdustDownloadThread</code> object
-     */
-    public static synchronized MapdustDownloadThread getInstance() {
-        if (instance == null) {
-            instance = new MapdustDownloadThread();
-        }
-        return instance;
-    }
-
-    @Override
-    public void run() {
-        try {
-            while (true) {
-                // if the center of the map has changed, the user has dragged or
-                // zoomed the map
-                if (Main.map != null && Main.map.mapView != null) {
-                    Point2D currentCenter = Main.map.mapView.getCenter();
-                    if (currentCenter != null
-                            && !currentCenter.equals(lastCenter)) {
-                        downloadDone = false;
-                        lastCenter = currentCenter;
-                    }
-                }
-                String pluginState = Main.pref.get("mapdust.pluginState");
-                boolean modify =
-                        Boolean.parseBoolean(Main.pref.get("mapdust.modify"));
-                if (!downloadDone) {
-                    if (plugin != null
-                            && pluginState.equals(MapdustPluginState.ONLINE
-                                    .getValue()) && !modify) {
-                        plugin.updateData();
-                        downloadDone = true;
-                    }
-                }
-                Thread.sleep(INTERVAL);
-            }
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-    }
-
-    /**
-     * Returns the <code>MapdustPlugin</code> object
-     *
-     * @return the plugin
-     */
-    public MapdustPlugin getPlugin() {
-        return plugin;
-    }
-
-    /**
-     * Sets the <code>MapdustPlugin</code> object
-     *
-     * @param plugin the plugin to set
-     */
-    public void setPlugin(MapdustPlugin plugin) {
-        this.plugin = plugin;
-    }
-
-}
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/MapdustLayer.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/MapdustLayer.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/MapdustLayer.java	(revision 25127)
@@ -60,21 +60,21 @@
 /**
  * Defines the MapDust JOSM layer main functionality.
- *
+ * 
  * @author Bea
  */
 public class MapdustLayer extends Layer {
-
+    
     /** The <code>MapdustGUI</code> object */
     private MapdustGUI mapdustGUI;
-
+    
     /** The list of <code>MapdustBugList</code> objects */
     private List<MapdustBug> mapdustBugList;
-
+    
     /** The selected <code>MapdustBug</code> object */
     private MapdustBug bugSelected;
-
+    
     /**
      * Builds a <code>MapdustLayer</code> object based on the given parameters.
-     *
+     * 
      * @param name The name of the layer
      * @param mapdustGUI The <code>MapdustGUI</code> object
@@ -88,8 +88,8 @@
         this.bugSelected = null;
     }
-
+    
     /**
      * Returns the icon of the MapDust layer.
-     *
+     * 
      * @return icon
      */
@@ -99,8 +99,8 @@
         return layerIcon;
     }
-
+    
     /**
      * Returns the info components of the MapDust layer.
-     *
+     * 
      * @return object
      */
@@ -110,8 +110,8 @@
         return tr(infoComponent);
     }
-
+    
     /**
      * Returns the menu entries of the MapDust layer.
-     *
+     * 
      * @return an array of <code>Action</code> objects.
      */
@@ -129,8 +129,8 @@
         return menuEntries;
     }
-
+    
     /**
      * Returns the text of the tool tip of the MapDust layer.
-     *
+     * 
      * @return the tooltip text
      */
@@ -140,8 +140,8 @@
         return tr(toolTipText);
     }
-
+    
     /**
      * Returns the image icon based on the given status and type.
-     *
+     * 
      * @param iconType The type of the bug
      * @param status The status of the bug
@@ -158,9 +158,9 @@
         return icon;
     }
-
+    
     /**
      * Draw the objects to the given map view. Also draws the MapDust bugs to
      * the map, and the tooltip for the selected MapDust bug.
-     *
+     * 
      * @param g The <code>Graphics2D</code> object
      * @param mv The <code>MapView</code> object
@@ -181,13 +181,9 @@
                 int width = icon.getIconWidth();
                 int height = icon.getIconHeight();
-                /* draw the bug icon */
-                /*
-                 * need to do 2 times, because in some areas the bug image is
-                 * invisible
-                 */
+                /* need to do drawing 2 times, because in some areas the bug 
+                 * image is invisible */
                 for (int i = 0; i < 2; i++) {
                     g.drawImage(icon.getImage(), p.x - (width / 2), p.y
                             - (height / 2), new ImageObserver() {
-
                         @Override
                         public boolean imageUpdate(Image img, int infoflags,
@@ -198,4 +194,5 @@
                 }
             }
+            
             /* draw the selected bug description */
             /* selected by clicking */
@@ -220,5 +217,4 @@
                 g.drawImage(icon.getImage(), p.x - (width / 2), p.y
                         - (height / 2), new ImageObserver() {
-
                     @Override
                     public boolean imageUpdate(Image img, int infoflags, int x,
@@ -246,17 +242,23 @@
         }
     }
-
+    
+    /**
+     * No need to implement this.
+     */
     @Override
     public boolean isMergable(Layer layer) {
         return false;
     }
-
+    
+    /**
+     * No need to implement this.
+     */
     @Override
     public void mergeFrom(Layer layer) {}
-
+    
     /**
      * Builds the text of the tooltip containing a short description of the
      * given <code>MapdustBug</code> object.
-     *
+     * 
      * @param bug The <code>MapdustBug</code> object
      * @return A string containing the description text
@@ -277,11 +279,14 @@
         return text;
     }
-
+    
+    /**
+     * No need to implement this.
+     */
     @Override
     public void visitBoundingBox(BoundingXYVisitor arg0) {}
-
+    
     /**
      * Returns the <code>MapdustGUI</code> object
-     *
+     * 
      * @return the mapdustGUI
      */
@@ -289,8 +294,8 @@
         return mapdustGUI;
     }
-
+    
     /**
      * Sets the <code>MapdustGUI</code> object
-     *
+     * 
      * @param mapdustGUI the mapdustGUI to set
      */
@@ -298,8 +303,8 @@
         this.mapdustGUI = mapdustGUI;
     }
-
+    
     /**
      * Returns the list of <code>MapdustBug</code> objects
-     *
+     * 
      * @return the mapdustBugList
      */
@@ -307,8 +312,8 @@
         return mapdustBugList;
     }
-
+    
     /**
      * Returns the selected bug
-     *
+     * 
      * @return the bugSelected
      */
@@ -316,8 +321,8 @@
         return bugSelected;
     }
-
+    
     /**
      * Sets the selected bug
-     *
+     * 
      * @param bugSelected the bugSelected to set
      */
@@ -325,7 +330,8 @@
         this.bugSelected = bugSelected;
     }
-
+    
     /**
      * Sets the list of <code>MapdustBug</code> objects
+     * 
      * @param mapdustBugList the mapdustBugList to set
      */
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/MapdustPlugin.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/MapdustPlugin.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/MapdustPlugin.java	(revision 25127)
@@ -42,4 +42,5 @@
 import org.openstreetmap.josm.gui.MapView;
 import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
+import org.openstreetmap.josm.gui.NavigatableComponent;
 import org.openstreetmap.josm.gui.NavigatableComponent.ZoomChangeListener;
 import org.openstreetmap.josm.gui.layer.Layer;
@@ -60,6 +61,6 @@
 
 /**
- * This is the main class of the MapDust plugin. Defines the MapDust plugin main
- * functionality.
+ * This is the main class of the MapDust plug-in. Defines the MapDust plug-in
+ * main functionality.
  * 
  * @author Bea
@@ -69,34 +70,57 @@
         ZoomChangeListener, MouseListener, MapdustRefreshObserver,
         MapdustBugObserver, MapdustInitialUpdateObserver {
-    
-    /** The graphical user interface of the plugin */
+
+    /** The graphical user interface of the plug-in */
     private MapdustGUI mapdustGUI;
-    
-    /** The layer of the MapDust plugin */
+
+    /** The layer of the MapDust plug-in */
     private MapdustLayer mapdustLayer;
-    
+
     /** The list of <code>MapdustBug</code> objects */
     private List<MapdustBug> mapdustBugList;
-    
-    /** Flag indicating if the list of bugs was empty or not */
-    private boolean wasEmpty;
-    
+
+    /** The <code>CreateIssueDialog</code> object */
+    private CreateIssueDialog dialog;
+
+    /** Specifies if there was or not an error downloading the data */
+    private boolean wasError = false;
+
     /**
      * Builds a new <code>MapDustPlugin</code> object based on the given
      * arguments.
-     * 
+     *
      * @param info The <code>MapDustPlugin</code> object
      */
     public MapdustPlugin(PluginInformation info) {
         super(info);
-        Main.pref.put("mapdust.pluginState",
-                MapdustPluginState.ONLINE.getValue());
+        initializePlugin();
+    }
+
+    /**
+     * Initialize the <code>MapdustPlugin</code> object. Creates the
+     * <code>MapdustGUI</code> and initializes the following variables with
+     * default values: 'mapdust.pluginState', 'mapdust.nickname',
+     * 'mapdust.showError'.
+     */
+    private void initializePlugin() {
+        /* create MapDust GUI */
+        Shortcut shortcut = Shortcut.registerShortcut("mapdust",
+                tr("Toggle: {0}", tr("Open MapDust")), KeyEvent.VK_0,
+                Shortcut.GROUP_MENU, Shortcut.SHIFT_DEFAULT);
+        String name = "MapDust bug reports";
+        String tooltip = "Activates the MapDust bug reporter plugin";
+        mapdustGUI = new MapdustGUI(tr(name), "mapdust_icon.png", tr(tooltip),
+                shortcut, 150, this);
+        /* add default values for static variables */
+        Main.pref.put("mapdust.pluginState", MapdustPluginState.ONLINE.getValue());
         Main.pref.put("mapdust.nickname", null);
-        Main.pref.put("mapdust.modify", false);
-    }
-    
-    /**
-     * Initializes the new view with the MapDust Bugs from that area.
-     * 
+        Main.pref.put("mapdust.showError", true);
+    }
+
+    /**
+     * Initializes the new <code>MapFrame</code>. Adds the
+     * <code>MapdustGUI</code> to the new <code>MapFrame</code> and sets the
+     * observers/listeners.
+     *
      * @param oldMapFrame The old <code>MapFrame</code> object
      * @param newMapFrame The new <code>MapFrame</code> object
@@ -107,72 +131,58 @@
             /* if new MapFrame is null, remove listener */
             MapView.removeLayerChangeListener(this);
+            NavigatableComponent.removeZoomChangeListener(this);
         } else {
             /* add MapDust dialog window */
-            Shortcut shortcut = Shortcut.registerShortcut("mapdust", 
-                    tr("Toggle: {0}", tr("Open MapDust")), KeyEvent.VK_0,
-                    Shortcut.GROUP_MENU, Shortcut.SHIFT_DEFAULT);
-            String name = "MapDust bug reports";
-            String tooltip = "Activates the MapDust bug reporter plugin";
-            mapdustGUI = new MapdustGUI(tr(name), "mapdust_icon.png", tr(tooltip),
-                    shortcut, 150, this);
-            mapdustGUI.setBounds(newMapFrame.getBounds());
-            mapdustGUI.addObserver(this);
-            newMapFrame.addToggleDialog(mapdustGUI);
-            MapView.addZoomChangeListener(this);
-            MapView.addLayerChangeListener(this);
-            Main.map.mapView.addMouseListener(this);
-        }
-    }
-    
-    /**
-     * Updates the MapDust plugin data. Downloads the list of
-     * <code>MapdustBug</code> objects for the given area, and updates the map
-     * and the Mapdust layer with the new data.
-     */
-    @Override
-    public synchronized void updateData() {
-        if (Main.map != null && Main.map.mapView != null) {
-            try {
-                /* downloads the MapDust bugs */
-                this.mapdustBugList = getMapdustBugs();
-                if (getMapdustGUI().isDialogShowing()) {
-                    /* updates the views */
-                    if ((this.mapdustBugList == null || this.mapdustBugList
-                            .size() == 0) && !wasEmpty) {
-                        updateView();
-                        String waringMessage = "There is no MapDust bug in ";
-                        waringMessage += "your visible area.";
-                        JOptionPane.showMessageDialog(Main.parent,
-                                tr(waringMessage), tr("Warning"),
-                                JOptionPane.WARNING_MESSAGE);
-                        wasEmpty = true;
-                    } else {
-                        updateView();
-                        wasEmpty = false;
-                    }
-                }
-            } catch (MapdustServiceHandlerException e) {
-                /* show errprMessage, and remove the layer */
-                String errorMessage = "There was a Mapdust service error.";
-                errorMessage += " Please try later.";
-                JOptionPane.showMessageDialog(Main.parent, tr(errorMessage),
-                        tr("Error"), JOptionPane.ERROR_MESSAGE);
-                MapView.removeLayerChangeListener(this);
-                Main.map.mapView.removeLayer(mapdustLayer);
-                Main.map.remove(mapdustGUI);
-            }
-        }
-    }
-    
+            if (Main.map != null && Main.map.mapView != null) {
+                /* set bounds for MapdustGUI */
+                mapdustGUI.setBounds(newMapFrame.getBounds());
+                /* add observer */
+                mapdustGUI.addObserver(this);
+                /* add dialog to new MapFrame */
+                newMapFrame.addToggleDialog(mapdustGUI);
+                /* add ZoomChangeListener */
+                NavigatableComponent.addZoomChangeListener(this);
+                /* add LayerChangeListener */
+                MapView.addLayerChangeListener(this);
+                /* add MouseListener */
+                Main.map.mapView.addMouseListener(this);
+            }
+        }
+    }
+
+    /**
+     * Refreshes the MapDust data. Downloads the data from the given area and
+     * updates the map and the MapDust list with this new data. This method is
+     * called whenever the 'Refresh' button is pressed by the user.
+     */
+    @Override
+    public void refreshData() {
+        if (containsOsmDataLayer() && mapdustGUI.isShowing()) {
+            updatePluginData();
+        }
+    }
+
+    /**
+     * Downloads the MapDust bugs from the current map view, and updates the
+     * plugin data with the new downloaded data. This method is called only
+     * once, before first showing the MapDust bugs.
+     */
+    @Override
+    public void initialUpdate() {
+        if (containsOsmDataLayer()) {
+            updatePluginData();
+        }
+    }
+
     /**
      * Updates the given <code>MapdustBug</code> object from the map and from
      * the MapDust bugs list.
-     * 
+     *
      * @param mapdustBug The <code>MapdustBug</code> object
      */
     @Override
     public synchronized void changedData(MapdustBug mapdustBug) {
-        if (this.mapdustBugList == null) {
-            this.mapdustBugList = new ArrayList<MapdustBug>();
+        if (mapdustBugList == null) {
+            mapdustBugList = new ArrayList<MapdustBug>();
         }
         if (getMapdustGUI().isDialogShowing()) {
@@ -197,16 +207,47 @@
         }
     }
-    
+
+    /**
+     * If the zoom was changed, download the bugs from the current map view.
+     * This method is called whenever the zoom was changed.
+     */
+    @Override
+    public void zoomChanged() {
+        if (containsOsmDataLayer() && this.mapdustGUI.isShowing() && !wasError) {
+            updatePluginData();
+        }
+    }
+
+    /**
+     * No need to implement this.
+     */
     @Override
     public void activeLayerChange(Layer arg0, Layer arg1) {}
-    
+
+    /**
+     * Adds the <code>MapdustLayer</code> to the JOSM editor. If the list of
+     * <code>MapdustBug</code>s is null then downloads the data from the MapDust
+     * Service and updates the editor with this new data.
+     * 
+     * @param layer The <code>Layer</code> which will be added to the JOSM
+     * editor
+     */
     @Override
     public void layerAdded(Layer layer) {
         if (layer instanceof MapdustLayer) {
             /* download the MapDust bugs and update the plugin */
-            updateData();
-        }
-    }
-    
+            if (mapdustBugList == null) {
+                updateMapdustData();
+            }
+        }
+    }
+
+    /**
+     * Removes the <code>MapdustLayer</code> from the JOSM editor. Also closes
+     * the MapDust plugin window.
+     * 
+     * @param layer The <code>Layer</code> which will be removed from the JOSM
+     * editor
+     */
     @Override
     public void layerRemoved(Layer layer) {
@@ -214,96 +255,159 @@
             /* remove the layer */
             MapView.removeLayerChangeListener(this);
-            MapView.removeZoomChangeListener(this);
+            NavigatableComponent.removeZoomChangeListener(this);
             Main.map.mapView.removeLayer(layer);
             Main.map.remove(mapdustGUI);
             if (mapdustGUI != null) {
-                mapdustGUI.update(null, this);
+                mapdustGUI.update(new ArrayList<MapdustBug>(), this);
+                mapdustGUI.setVisible(false);
             }
             mapdustLayer = null;
-            wasEmpty = false;
-        }
-    }
-    
+        }
+    }
+
+    /**
+     * No need to implement this.
+     */
+    @Override
+    public void mouseEntered(MouseEvent event) {}
+
+    /**
+     * No need to implement this.
+     */
+    @Override
+    public void mouseExited(MouseEvent arg0) {}
+
+    /**
+     * No need to implement this.
+     */
+    @Override
+    public void mousePressed(MouseEvent event) {}
+
+    /**
+     * No need to implement this.
+     */
+    @Override
+    public void mouseReleased(MouseEvent arg0) {}
+
+    /**
+     * At mouse click the following two actions can be done: adding a new bug,
+     * and selecting a bug from the map. A bug can be added if the plugin is the
+     * only active plugin and you double click on the map. You can select a bug
+     * from the map by clicking on it.
+     * 
+     * @event The <code>MouseEvent</code> object
+     */
     @Override
     public void mouseClicked(MouseEvent event) {
-        if (mapdustLayer != null && mapdustLayer.isVisible()
-                && Main.map.mapView.getActiveLayer() == getMapdustLayer()) {
-            /* show add bug dialog */
-            if (event.getButton() == MouseEvent.BUTTON3
-                    && event.getClickCount() == 2) {
-                String mapdustAddBug = Main.pref.get("mapdust.addBug");
-                boolean addBug = Boolean.parseBoolean(mapdustAddBug);
-                if (!addBug) {
-                    mapdustGUI.getPanel().getBtnPanel().getBtnWorkOffline()
-                            .setEnabled(false);
-                    mapdustGUI.getPanel().getBtnPanel().getBtnRefresh()
-                            .setEnabled(false);
-                    mapdustGUI.getPanel().getBtnPanel().getBtnAddComment()
-                            .setEnabled(false);
-                    mapdustGUI.getPanel().getBtnPanel().getBtnFixBugReport()
-                            .setEnabled(false);
-                    mapdustGUI.getPanel().getBtnPanel()
-                            .getBtnInvalidateBugReport().setEnabled(false);
-                    mapdustGUI.getPanel().getBtnPanel().getBtnReOpenBugReport()
-                            .setEnabled(false);
-                    Main.pref.put("mapdust.modify", true);
-                    MapdustBug selectedBug =
-                            mapdustGUI.getPanel().getSelectedBug();
-                    if (selectedBug != null) {
-                        Main.pref.put("selectedBug.status", selectedBug
-                                .getStatus().getValue());
-                    } else {
-                        Main.pref.put("selectedBug.status", "create");
+        if (mapdustLayer != null && mapdustLayer.isVisible()) {
+            if (event.getButton() == MouseEvent.BUTTON1) {
+                if (event.getClickCount() == 2 && !event.isConsumed()) {
+                    if (Main.map.mapView.getActiveLayer() == getMapdustLayer()) {
+                        /* show add bug dialog */
+                        MapdustBug bug = mapdustGUI.getPanel().getSelectedBug();
+                        if (bug != null) {
+                            Main.pref.put("selectedBug.status", bug.getStatus()
+                                    .getValue());
+                        } else {
+                            Main.pref.put("selectedBug.status", "create");
+                        }
+                        /* disable MapdustButtonPanel */
+                        mapdustGUI.disableBtnPanel();
+                        /* create and show dialog */
+                        dialog = new CreateIssueDialog(event.getPoint(), this);
+                        dialog.showDialog();
+                        event.consume();
+                        return;
                     }
-                    String title = "Create bug report";
-                    String iconName = "dialogs/open.png";
-                    String messageText =
-                            "In order to create a new bug report you";
-                    messageText += " need to provide your nickname and a brief";
-                    messageText += " description for the bug.";
-                    Point point = event.getPoint();
-                    CreateIssueDialog dialog =
-                            new CreateIssueDialog(tr(title), iconName,
-                                    tr(messageText), point, this);
-                    dialog.setLocationRelativeTo(null);
-                    dialog.getContentPane().setPreferredSize(dialog.getSize());
-                    dialog.pack();
-                    dialog.setVisible(true);
-                } else {
-                    Main.pref.put("mapdust.addBug", false);
                 }
-            }
-            if (event.getButton() == MouseEvent.BUTTON1) {
-                /* allow click on the bug icon on the map */
-                Point p = event.getPoint();
-                MapdustBug nearestBug = getNearestBug(p);
-                if (nearestBug != null) {
-                    mapdustLayer.setBugSelected(nearestBug);
-                    /* set also in the list of bugs the element */
-                    mapdustGUI.getPanel().setSelectedBug(nearestBug);
-                    Main.map.mapView.repaint();
+                if (event.getClickCount() == 1 && !event.isConsumed()) {
+                    /* allow click on the bug icon on the map */
+                    Point p = event.getPoint();
+                    MapdustBug nearestBug = getNearestBug(p);
+                    if (nearestBug != null) {
+                        mapdustLayer.setBugSelected(nearestBug);
+                        /* set also in the list of bugs the element */
+                        mapdustGUI.getPanel().setSelectedBug(nearestBug);
+                        Main.map.mapView.repaint();
+                    }
+                    return;
                 }
             }
         }
     }
-    
-    /**
-     * Updates the current view, with the given list of <code>MapdustBug</code>
-     * objects.
+
+
+    /**
+     * Updates the <code>MapdustPlugin</code> data. Downloads the
+     * <code>MapdustBug</code> objects from the current view, and updates the
+     * <code>MapdustGUI</code> and the map with the new data.
+     */
+    private void updatePluginData() {
+        Main.worker.execute(new Runnable() {
+            @Override
+            public void run() {
+                updateMapdustData();
+            }
+        });
+    }
+
+    /**
+     * Returns the bounds of the current <code>MapView</code>.
+     *
+     * @return bounds
+     */
+    private Bounds getBounds() {
+        MapView mapView = Main.map.mapView;
+        Bounds bounds = new Bounds(mapView.getLatLon(0, mapView.getHeight()), 
+                mapView.getLatLon(mapView.getWidth(), 0));
+        return bounds;
+    }
+
+    /**
+     * Updates the MapDust plugin data. Downloads the list of
+     * <code>MapdustBug</code> objects for the given area, and updates the map
+     * and the MapDust layer with the new data.
+     */
+    private synchronized void updateMapdustData() {
+        if (Main.map != null && Main.map.mapView != null) {
+            /* download the MapDust data */
+            try {
+                Bounds bounds = getBounds();
+                MapdustServiceHandler handler = new MapdustServiceHandler();
+                mapdustBugList = handler.getBugs(bounds.getMin().lon(),
+                        bounds.getMin().lat(), bounds.getMax().lon(),
+                        bounds.getMax().lat());
+                wasError = false;
+            } catch (MapdustServiceHandlerException e) {
+                wasError = true;
+                mapdustBugList = new ArrayList<MapdustBug>();
+                updateView();
+                handleError();
+            }
+            /* update the view */
+            if (!wasError) {
+                updateView();
+            }
+        }
+    }
+
+    /**
+     * Updates the current view ( map and MapDust bug list), with the given list
+     * of <code>MapdustBug</code> objects.
      */
     private void updateView() {
         /* update the dialog with the new data */
         mapdustGUI.update(mapdustBugList, this);
+        mapdustGUI.setVisible(true);
         mapdustGUI.revalidate();
+        /* update the MapdustLayer */
         if (mapdustLayer == null) {
             /* create and add the layer */
-            mapdustLayer =
-                    new MapdustLayer("MapDust", mapdustGUI, mapdustBugList);
-            Main.main.addLayer(mapdustLayer);
-            Main.map.mapView.moveLayer(mapdustLayer, 0);
-            ;
+            mapdustLayer = new MapdustLayer("MapDust", mapdustGUI, mapdustBugList);
+            Main.main.addLayer(this.mapdustLayer);
+            Main.map.mapView.moveLayer(this.mapdustLayer, 0);
             Main.map.mapView.addMouseListener(this);
             MapView.addLayerChangeListener(this);
-            MapView.addZoomChangeListener(this);
+            NavigatableComponent.addZoomChangeListener(this);
         } else {
             /* re-set the properties */
@@ -317,51 +421,14 @@
         Main.map.repaint();
     }
-    
-    /**
-     * Downloads the MapDust bugs from the current map view, and updates the
-     * plugin data with the new downloaded data.
-     */
-    @Override
-    public void initialUpdate() {
-        if (containsOsmDataLayer()) {
-            updateData();
-        }
-    }
-    
-    /**
-     * If the zoom was changed, download the bugs from the current map view.
-     */
-    @Override
-    public void zoomChanged() {
-        updateData();
-    }
-    
-    /**
-     * Verifies if the <code>OsmDataLayer</code> layer has been added to the
-     * list of layers.
-     * 
-     * @return true if the <code>OsmDataLayer</code> layer has been added false
-     * otherwise
-     */
-    private boolean containsOsmDataLayer() {
-        boolean contains = false;
-        List<Layer> l = Main.map.mapView.getAllLayersAsList();
-        for (Layer ll : l) {
-            if (ll instanceof OsmDataLayer) {
-                contains = true;
-            }
-        }
-        return contains;
-    }
-    
+
     /**
      * Updates the MapDust bugs list with the given <code>MapdustBug</code>
      * object.
-     * 
+     *
      * @param mapdustBug The <code>MapdustBug</code> object
      */
     private void updateMapdustBugList(MapdustBug mapdustBug) {
         MapdustBug oldBug = null;
-        for (MapdustBug bug : mapdustBugList) {
+        for (MapdustBug bug : this.mapdustBugList) {
             if (bug.getId().equals(mapdustBug.getId())) {
                 oldBug = bug;
@@ -370,42 +437,16 @@
         if (oldBug != null) {
             /* remove, add */
-            mapdustBugList.remove(oldBug);
-            mapdustBugList.add(0, mapdustBug);
+            this.mapdustBugList.remove(oldBug);
+            this.mapdustBugList.add(0, mapdustBug);
         } else {
             /* new add */
-            mapdustBugList.add(0, mapdustBug);
-        }
-    }
-    
-    /**
-     * Returns the list of <code>MapdustBug</code> objects from the current
-     * area.
-     * 
-     * @return A list of <code>MapdustBug</code> objects
-     * @throws MapdustServiceHandlerException In the case of a MapDust service
-     * error
-     */
-    private List<MapdustBug> getMapdustBugs()
-            throws MapdustServiceHandlerException {
-        /* get the bounding box */
-        MapView mapView = Main.map.mapView;
-        Bounds bounds =
-                new Bounds(mapView.getLatLon(0, mapView.getHeight()),
-                        mapView.getLatLon(mapView.getWidth(), 0));
-        Double minLon = bounds.getMin().lon();
-        Double minLat = bounds.getMin().lat();
-        Double maxLon = bounds.getMax().lon();
-        Double maxLat = bounds.getMax().lat();
-        
-        /* get the bugs from the bounding box */
-        MapdustServiceHandler handler = new MapdustServiceHandler();
-        List<MapdustBug> list = handler.getBugs(minLon, minLat, maxLon, maxLat);
-        return list;
-    }
-    
+            this.mapdustBugList.add(0, mapdustBug);
+        }
+    }
+
     /**
      * Returns the nearest <code>MapdustBug</code> object to the given point on
      * the map.
-     * 
+     *
      * @param p A <code>Point</code> object
      * @return A <code>MapdustBug</code> object
@@ -427,24 +468,42 @@
         return nearestBug;
     }
-    
-    @Override
-    public void mouseEntered(MouseEvent event) {
-
-    }
-    
-    @Override
-    public void mouseExited(MouseEvent arg0) {}
-    
-    @Override
-    public void mousePressed(MouseEvent event) {
-
-    }
-    
-    @Override
-    public void mouseReleased(MouseEvent arg0) {}
-    
+
+    /**
+     * Verifies if the <code>OsmDataLayer</code> layer has been added to the
+     * list of layers.
+     *
+     * @return true if the <code>OsmDataLayer</code> layer has been added false
+     * otherwise
+     */
+    private boolean containsOsmDataLayer() {
+        boolean contains = false;
+        List<Layer> l = Main.map.mapView.getAllLayersAsList();
+        for (Layer ll : l) {
+            if (ll instanceof OsmDataLayer) {
+                contains = true;
+            }
+        }
+        return contains;
+    }
+
+    /**
+     * Handles the <code>MapdustServiceHandlerException</code> error.
+     *
+     */
+    private void handleError() {
+        String showMessage = Main.pref.get("mapdust.showError");
+        Boolean showErrorMessage = Boolean.parseBoolean(showMessage);
+        if (showErrorMessage) {
+            /* show errprMessage, and remove the layer */
+            Main.pref.put("mapdust.showError", false);
+            String errorMessage = "There was a Mapdust service error.";
+            errorMessage += " Please try later.";
+            JOptionPane.showMessageDialog(Main.parent, tr(errorMessage));
+        }
+    }
+
     /**
      * Returns the <code>MapdustGUI</code> object
-     * 
+     *
      * @return the mapdustGUI
      */
@@ -452,8 +511,8 @@
         return mapdustGUI;
     }
-    
+
     /**
      * Sets the <code>MapdustGUI</code> object.
-     * 
+     *
      * @param mapdustGUI the mapdustGUI to set
      */
@@ -461,8 +520,8 @@
         this.mapdustGUI = mapdustGUI;
     }
-    
+
     /**
      * Returns the <code>MapdustLayer</code> object.
-     * 
+     *
      * @return the mapdustLayer
      */
@@ -470,8 +529,8 @@
         return mapdustLayer;
     }
-    
+
     /**
      * Sets the <code>MapdustLayer</code> object.
-     * 
+     *
      * @param mapdustLayer the mapdustLayer to set
      */
@@ -479,8 +538,8 @@
         this.mapdustLayer = mapdustLayer;
     }
-    
+
     /**
      * Returns the list of <code>MapdustBug</code> objects
-     * 
+     *
      * @return the mapdustBugList
      */
@@ -488,8 +547,8 @@
         return mapdustBugList;
     }
-    
+
     /**
      * Sets the list of <code>MapdustBug</code> objects
-     * 
+     *
      * @param mapdustBugList the mapdustBugList to set
      */
@@ -497,4 +556,4 @@
         this.mapdustBugList = mapdustBugList;
     }
-    
+
 }
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/MapdustGUI.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/MapdustGUI.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/MapdustGUI.java	(revision 25127)
@@ -33,5 +33,4 @@
 import java.util.ArrayList;
 import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.List;
 import javax.swing.JPanel;
@@ -87,14 +86,11 @@
     
     /** The <code>MapdustBugPropertiesPanel</code> */
-    private final MapdustBugPropertiesPanel detailsPanel;
+    private MapdustBugPropertiesPanel detailsPanel;
     
     /** The <code>JPanel</code> */
     private JPanel mainPanel;
     
-    /**
-     * Flag indicating if the MapDust data was downloaded and the view was
-     * updated
-     */
-    private boolean initialUpdate = false;
+    /** Specifies if the MapDust data was or not downloaded */
+    private boolean downloaded = false;
     
     /**
@@ -112,40 +108,4 @@
         super(tr(name), iconName, tr(tooltip), shortcut, preferredHeight);
         this.mapdustPlugin = mapdustPlugin;
-        panel = new MapdustPanel(mapdustPlugin.getMapdustBugList(),
-                "Bug reports", mapdustPlugin);
-        MapdustBug bug = null;
-        if (mapdustPlugin.getMapdustBugList() != null
-                && mapdustPlugin.getMapdustBugList().size() > 0) {
-            bug = mapdustPlugin.getMapdustBugList().get(0);
-        }
-        detailsPanel = new MapdustBugPropertiesPanel(bug);
-        panel.addObserver(detailsPanel);
-        addObserver(detailsPanel);
-        String pluginState = Main.pref.get("mapdust.pluginState");
-        if (pluginState.equals(MapdustPluginState.OFFLINE.getValue())) {
-            /* offline mode, need to add also queue panel */
-            tabbedPane = new JTabbedPane();
-            List<MapdustAction> list = new LinkedList<MapdustAction>();
-            mainPanel = new JPanel();
-            mainPanel.setAutoscrolls(true);
-            mainPanel.setLayout(new BorderLayout(5, 10));
-            mainPanel.add(detailsPanel, BorderLayout.NORTH);
-            mainPanel.add(panel, BorderLayout.CENTER);
-            queuePanel = new MapdustActionPanel(list, "Work offline", mapdustPlugin);
-            tabbedPane.add(mainPanel, 0);
-            tabbedPane.add(queuePanel);
-            add(tabbedPane, BorderLayout.CENTER);
-        } else {
-            /* online mode */
-            mainPanel = new JPanel();
-            mainPanel.setIgnoreRepaint(true);
-            mainPanel.setAutoscrolls(true);
-            mainPanel.setLayout(new BorderLayout(5, 10));
-            mainPanel.add(detailsPanel, BorderLayout.NORTH);
-            mainPanel.add(panel, BorderLayout.CENTER);
-            add(mainPanel, BorderLayout.CENTER);
-            tabbedPane = null;
-            queuePanel = null;
-        }
     }
     
@@ -165,20 +125,21 @@
             if (tabbedPane != null) {
                 /* offline to online */
-                tabbedPane.remove(panel);
-                tabbedPane.remove(queuePanel);
-                mainPanel.remove(tabbedPane);
                 remove(mainPanel);
                 queuePanel = null;
             } else {
                 /* online to online */
-                mainPanel.remove(detailsPanel);
-                mainPanel.remove(panel);
-                remove(mainPanel);
+                if (mainPanel != null) {
+                    remove(mainPanel);
+                }
             }
             /* add panels with updated data */
             panel = new MapdustPanel(mapdustBugs, "Bug reports", mapdustPlugin);
-            MapdustBug selectedBug =
-                    (mapdustBugs != null && mapdustBugs.size() > 0) ? mapdustBugs
-                            .get(0) : null;
+            MapdustBug selectedBug = (mapdustBugs != null && mapdustBugs.size() 
+                    > 0) ? mapdustBugs.get(0) : null;
+            if (detailsPanel == null) {
+                detailsPanel = new MapdustBugPropertiesPanel(selectedBug);
+                panel.addObserver(detailsPanel);
+                addObserver(detailsPanel);
+            }
             notifyObservers(selectedBug);
             panel.addObserver(detailsPanel);
@@ -196,13 +157,7 @@
             if (queuePanel == null) {
                 /* from online to offline */
-                mainPanel.remove(detailsPanel);
-                mainPanel.remove(panel);
                 remove(mainPanel);
             } else {
                 list = queuePanel.getActionList();
-                mainPanel.remove(detailsPanel);
-                tabbedPane.remove(panel);
-                tabbedPane.remove(queuePanel);
-                mainPanel.remove(tabbedPane);
                 remove(mainPanel);
             }
@@ -213,8 +168,17 @@
             panel = new MapdustPanel(mapdustBugs, "Bug reports (offline)",
                     mapdustPlugin);
+            MapdustBug selectedBug = (mapdustBugs != null && mapdustBugs.size() 
+                    > 0) ? mapdustBugs.get(0) : null;
+            if (detailsPanel == null) {
+                detailsPanel = new MapdustBugPropertiesPanel(selectedBug);
+                panel.addObserver(detailsPanel);
+                addObserver(detailsPanel);
+            }
+            notifyObservers(selectedBug);
+            panel.addObserver(detailsPanel);
             mainPanel = new JPanel();
             mainPanel.setAutoscrolls(true);
             mainPanel.setLayout(new BorderLayout());
-            if (mapdustBugs != null && mapdustBugs.size() > 0) {
+            if (mapdustBugs != null) {
                 mainPanel.add(detailsPanel, BorderLayout.NORTH);
             }
@@ -239,9 +203,7 @@
         
         /* remove panels */
-        mainPanel.remove(detailsPanel);
-        tabbedPane.remove(panel);
-        tabbedPane.remove(queuePanel);
-        mainPanel.remove(tabbedPane);
-        remove(mainPanel);
+        if (mainPanel != null) {
+            remove(mainPanel);
+        }
         /* create new tabbed pane */
         tabbedPane = new JTabbedPane();
@@ -263,19 +225,16 @@
     
     /**
-     * Shows the MapDust main dialog. In the case if the plugin was not updated
-     * with the new MapDust data, or the data was not downloaded; it will also
-     * download the MapDust data from the current view, and update the plugin
-     * with the new data.
-     * 
-     */
-    @Override
-    public void showDialog() {
-        super.showDialog();
-        /* was not updated */
-        if (!initialUpdate && isShowing) {
-            notifyObservers();
-            initialUpdate = true;
-        }
-    }
+     * Disables the buttons from the <code>MapdustButtonPanel</code> buttons.
+     * 
+     */
+    public void disableBtnPanel() {
+        panel.getBtnPanel().getBtnWorkOffline().setEnabled(false);
+        panel.getBtnPanel().getBtnRefresh().setEnabled(false);
+        panel.getBtnPanel().getBtnAddComment().setEnabled(false);
+        panel.getBtnPanel().getBtnFixBugReport().setEnabled(false);
+        panel.getBtnPanel().getBtnInvalidateBugReport().setEnabled(false);
+        panel.getBtnPanel().getBtnReOpenBugReport().setEnabled(false);
+    }
+    
     
     /**
@@ -307,4 +266,19 @@
     
     /**
+     * Displays the <code>MapdustGUI</code> dialog window in the JOSM editor. If
+     * the MapDust data was not downloaded yet, it will donwload the data and
+     * also update the MapDust plugin with the data. If the MapDust data was
+     * already downloaded, then the <code>MapdustGUI</code> will be displayed.
+     */
+    @Override
+    public void showDialog() {
+        if (!downloaded) {
+            notifyObservers();
+            downloaded = true;
+        }
+        super.showDialog();
+    }
+    
+    /**
      * Adds a new MapDust bug details observer to the list of observers.
      * 
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/adapter/WindowClose.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/adapter/WindowClose.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/adapter/WindowClose.java	(revision 25127)
@@ -41,30 +41,30 @@
 /**
  * Closes the given dialog window.
- * 
+ *
  * @author Bea
  * @version $Revision$
  */
 public class WindowClose extends WindowAdapter {
-    
+
     /** Serial version UID */
     private static final long serialVersionUID = 1L;
-    
+
     /** A <code>AbstractDialog</code> object */
     private AbstractDialog dialog;
-    
+
     /** The <code>MapdustButtonPanel</code> object */
     private MapdustButtonPanel btnPanel;
-    
+
     /** The <code>JToggleButton</code> which had fired the dialog */
     private JToggleButton btnFired;
-    
+
     /**
      * Builds a <code>WindowClose</code> object
      */
     public WindowClose() {}
-    
+
     /**
      * Builds a <code>WindowClose</code> object based on the given arguments
-     * 
+     *
      * @param dialog The dialog which will be closed
      * @param btnPanel The button panel
@@ -77,5 +77,5 @@
         this.btnFired = btnFired;
     }
-    
+
     @Override
     public void windowClosing(WindowEvent event) {
@@ -128,9 +128,7 @@
         }
         /* dispose dialog */
-        Main.pref.put("mapdust.addBug", true);
-        Main.pref.put("mapdust.modify", false);
         dialog.setVisible(false);
         dialog.dispose();
-        return;
     }
+
 }
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteActionList.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteActionList.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteActionList.java	(revision 25127)
@@ -71,8 +71,12 @@
     }
 
+    /**
+     * Uploads the content of the action list to the MapDust service. 
+     * 
+     * @param event The event which fires this action
+     */
     @Override
     public void actionPerformed(ActionEvent event) {
         if (event.getSource() instanceof JToggleButton) {
-            // upload actions
             try {
                 MapdustActionUploader.getInstance().uploadData(
@@ -84,8 +88,6 @@
                         tr("Error"), JOptionPane.ERROR_MESSAGE);
             }
-            Main.pref.put("mapdust.pluginState",
-                    MapdustPluginState.ONLINE.getValue());
-            getMapdustGUI().getPanel().getBtnPanel().getBtnRefresh()
-                    .setEnabled(true);
+            Main.pref.put("mapdust.pluginState", MapdustPluginState.ONLINE.getValue());
+            getMapdustGUI().getPanel().getBtnPanel().getBtnRefresh().setEnabled(true);
             notifyObservers();
         }
@@ -121,6 +123,7 @@
         Iterator<MapdustRefreshObserver> elements = this.observers.iterator();
         while (elements.hasNext()) {
-            (elements.next()).updateData();
+            (elements.next()).refreshData();
         }
     }
+
 }
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteAddBug.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteAddBug.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteAddBug.java	(revision 25127)
@@ -82,5 +82,5 @@
     public ExecuteAddBug() {}
 
-    /***
+    /**
      * Builds a <code>ExecuteAddBug</code> object based on the given arguments.
      *
@@ -93,4 +93,11 @@
     }
 
+    /**
+     * Creates a new <code>MapdustBug</code> object if the entered informations
+     * are valid. Otherwise a corresponding warning message will be shown to the
+     * user.
+     * 
+     * @param event The action event which fires this action
+     */
     @Override
     public void actionPerformed(ActionEvent event) {
@@ -115,6 +122,5 @@
                 latlon = Main.map.mapView.getLatLon(p.x, p.y);
             }
-            MapdustBug bug =
-                    new MapdustBug(latlon, type, commentText, nickname);
+            MapdustBug bug = new MapdustBug(latlon, type, commentText, nickname);
             String pluginState = Main.pref.get("mapdust.pluginState");
             if (pluginState.equals(MapdustPluginState.OFFLINE.getValue())) {
@@ -123,7 +129,6 @@
                 bug.setStatus(Status.OPEN);
                 String iconPath = getIconPath(bug);
-                MapdustAction mapdustAction =
-                        new MapdustAction(MapdustServiceCommand.ADD_BUG,
-                                iconPath, bug);
+                MapdustAction mapdustAction = new MapdustAction(
+                        MapdustServiceCommand.ADD_BUG, iconPath, bug);
                 if (getMapdustGUI().getQueuePanel() != null) {
                     notifyObservers(mapdustAction);
@@ -138,7 +143,6 @@
                 } catch (MapdustServiceHandlerException e) {
                     errorMessage = "There was a Mapdust service error.";
-                    JOptionPane.showMessageDialog(Main.parent,
-                            tr(errorMessage), tr("Error"),
-                            JOptionPane.ERROR_MESSAGE);
+                    JOptionPane.showMessageDialog(Main.parent, tr(errorMessage), 
+                            tr("Error"), JOptionPane.ERROR_MESSAGE);
                 }
                 if (id != null) {
@@ -149,7 +153,6 @@
                     } catch (MapdustServiceHandlerException e) {
                         errorMessage = "There was a Mapdust service error.";
-                        JOptionPane.showMessageDialog(Main.parent,
-                                tr(errorMessage), tr("Error"),
-                                JOptionPane.ERROR_MESSAGE);
+                        JOptionPane.showMessageDialog(Main.parent, tr(errorMessage), 
+                                tr("Error"), JOptionPane.ERROR_MESSAGE);
                     }
                     if (newMapdustBug != null) {
@@ -159,7 +162,7 @@
                 resetSelectedBug(0);
             }
-            Main.pref.put("mapdust.modify", false);
             /* destroy dialog */
             getDialog().dispose();
+            return;
         }
     }
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteCancel.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteCancel.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteCancel.java	(revision 25127)
@@ -65,5 +65,9 @@
     }
 
-
+    /**
+     * Cancels the executed action, and closes the visible dialog window.
+     * 
+     * @param event The action event which fires this action
+     */
     @Override
     public void actionPerformed(ActionEvent event) {
@@ -72,6 +76,5 @@
             String status = Main.pref.get("selectedBug.status");
             /* enable buttons */
-            MapdustButtonPanel btnPanel =
-                    getMapdustGUI().getPanel().getBtnPanel();
+            MapdustButtonPanel btnPanel = getMapdustGUI().getPanel().getBtnPanel();
             if (btnPanel != null) {
                 btnPanel.getBtnWorkOffline().setEnabled(true);
@@ -119,10 +122,7 @@
         }
 
-        Main.pref.put("mapdust.addBug", true);
-        Main.pref.put("mapdust.modify", false);
         /* dispose dialog */
-        getDialog().setVisible(false);
         getDialog().dispose();
     }
-    
+
 }
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteCloseBug.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteCloseBug.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteCloseBug.java	(revision 25127)
@@ -55,5 +55,5 @@
  * Fixes the given <code>MapdustBug</code> object. Validates the input data, and
  * based on the plugin state executes the corresponding action. If the plugin is
- * in the "ONLINE" state then executes the Mapdust Service 'changeBugStatus'
+ * in the "ONLINE" state then executes the MapDust Service 'changeBugStatus'
  * action with statusId=2 and the given input parameters. If the plugin is in
  * the "OFFLINE" state then adds the given action to the queue list.
@@ -92,4 +92,10 @@
     }
 
+    /**
+     * Closes the given MapDust bug. If the entered informations are invalid a
+     * corresponding warning message will be displayed.
+     * 
+     * @param event The action event which fires this action
+     */
     @Override
     public void actionPerformed(ActionEvent event) {
@@ -107,5 +113,5 @@
                     /* invalid input data */
                     JOptionPane.showMessageDialog(Main.parent, tr(errorMessage),
-                           tr("Missing input data"), JOptionPane.WARNING_MESSAGE);
+                            tr("Missing input data"), JOptionPane.WARNING_MESSAGE);
                     return;
                 }
@@ -155,5 +161,4 @@
                 enableFiredButton(issueDialog.getFiredButton());
                 resetSelectedBug(0);
-                Main.pref.put("mapdust.modify", false);
                 /* destroy dialog */
                 issueDialog.dispose();
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteCommentBug.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteCommentBug.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteCommentBug.java	(revision 25127)
@@ -91,4 +91,10 @@
     }
 
+    /**
+     * Creates a comment for the given MapDust bug. If the entered informations
+     * are invalid a corresponding warning message will be displayed.
+     * 
+     * @param event The action event which fires this action
+     */
     @Override
     public void actionPerformed(ActionEvent event) {
@@ -154,5 +160,4 @@
                 enableFiredButton(issueDialog.getFiredButton());
                 resetSelectedBug(0);
-                Main.pref.put("mapdust.modify", false);
                 /* destroy dialog */
                 issueDialog.dispose();
@@ -228,3 +233,4 @@
         }
     }
+    
 }
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteInvalidateBug.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteInvalidateBug.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteInvalidateBug.java	(revision 25127)
@@ -95,4 +95,10 @@
     }
 
+    /**
+     * Invalidates the given MapDust bug. If the entered informations are
+     * invalid a corresponding warning message will be displayed.
+     * 
+     * @param event The action event which fires this action
+     */
     @Override
     public void actionPerformed(ActionEvent event) {
@@ -101,5 +107,6 @@
             if (btn.getText().equals("OK")) {
                 /* ok button was pressed */
-                ChangeIssueStatusDialog issueDialog = (ChangeIssueStatusDialog) getDialog();
+                ChangeIssueStatusDialog issueDialog =
+                        (ChangeIssueStatusDialog) getDialog();
                 String nickname = issueDialog.getTxtNickname().getText();
                 String commentText = issueDialog.getTxtDescription().getText();
@@ -108,5 +115,5 @@
                 if (errorMessage != null) {
                     /* invalid input */
-                    JOptionPane.showMessageDialog(Main.parent, tr(errorMessage),
+                    JOptionPane.showMessageDialog(Main.parent, tr(errorMessage), 
                             tr("Missing input data"), JOptionPane.WARNING_MESSAGE);
                     return;
@@ -115,5 +122,5 @@
                 Main.pref.put("mapdust.nickname", nickname);
                 MapdustBug selectedBug = getSelectedBug();
-                MapdustComment comment = new MapdustComment(selectedBug.getId(),
+                MapdustComment comment = new MapdustComment(selectedBug.getId(), 
                         commentText, nickname);
                 String pluginState = Main.pref.get("mapdust.pluginState");
@@ -123,5 +130,5 @@
                     String iconPath = getIconPath(selectedBug);
                     MapdustAction mapdustAction = new MapdustAction(
-                            MapdustServiceCommand.CHANGE_BUG_STATUS, iconPath,
+                            MapdustServiceCommand.CHANGE_BUG_STATUS, iconPath, 
                             selectedBug, comment, 3);
                     if (getMapdustGUI().getQueuePanel() != null) {
@@ -136,6 +143,7 @@
                     } catch (MapdustServiceHandlerException e) {
                         errorMessage = "There was a Mapdust service error.";
-                        JOptionPane.showMessageDialog(Main.parent, tr(errorMessage),
-                                tr("Error"), JOptionPane.ERROR_MESSAGE);
+                        JOptionPane.showMessageDialog(Main.parent, 
+                                tr(errorMessage), tr("Error"),
+                                JOptionPane.ERROR_MESSAGE);
                     }
                     if (id != null) {
@@ -143,10 +151,12 @@
                         MapdustBug newMapdustBug = null;
                         try {
-                            newMapdustBug = handler.getBug(selectedBug.getId(), null);
+                            newMapdustBug = handler.getBug(selectedBug.getId(), 
+                                    null);
                         } catch (MapdustServiceHandlerException e) {
                             errorMessage = "There was a Mapdust service error.";
                             errorMessage += "Mapdust bug report.";
-                            JOptionPane.showMessageDialog(Main.parent, tr(errorMessage),
-                                    tr("Error"), JOptionPane.ERROR_MESSAGE);
+                            JOptionPane.showMessageDialog(Main.parent, 
+                                    tr(errorMessage), tr("Error"),
+                                    JOptionPane.ERROR_MESSAGE);
                         }
                         if (newMapdustBug != null) {
@@ -158,5 +168,4 @@
                 enableFiredButton(issueDialog.getFiredButton());
                 resetSelectedBug(0);
-                Main.pref.put("mapdust.modify", false);
                 /* destroy dialog */
                 issueDialog.dispose();
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteReOpenBug.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteReOpenBug.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteReOpenBug.java	(revision 25127)
@@ -94,4 +94,8 @@
     }
 
+    /**
+     * 
+     * @param event The event which fires this action
+     */
     @Override
     public void actionPerformed(ActionEvent event) {
@@ -165,5 +169,4 @@
                 enableFiredButton(issueDialog.getFiredButton());
                 resetSelectedBug(0);
-                Main.pref.put("mapdust.modify", false);
                 /* destroy dialog */
                 issueDialog.dispose();
@@ -240,3 +243,4 @@
         }
     }
+    
 }
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteRefresh.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteRefresh.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteRefresh.java	(revision 25127)
@@ -34,4 +34,5 @@
 import javax.swing.AbstractAction;
 import javax.swing.JToggleButton;
+import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.plugins.mapdust.gui.observer.MapdustRefreshObservable;
 import org.openstreetmap.josm.plugins.mapdust.gui.observer.MapdustRefreshObserver;
@@ -60,4 +61,9 @@
     public ExecuteRefresh() {}
 
+    /**
+     * Updates the Mapdust data.
+     * 
+     * @param event The event which fires this action
+     */
     @Override
     public void actionPerformed(ActionEvent event) {
@@ -65,4 +71,5 @@
             JToggleButton btn = (JToggleButton) event.getSource();
             /* update the bugs */
+            Main.pref.put("mapdust.showError", true);
             notifyObservers();
             btn.setSelected(false);
@@ -99,6 +106,7 @@
         Iterator<MapdustRefreshObserver> elements = this.observers.iterator();
         while (elements.hasNext()) {
-            (elements.next()).updateData();
+            (elements.next()).refreshData();
         }
     }
+    
 }
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteWorkOffline.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteWorkOffline.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteWorkOffline.java	(revision 25127)
@@ -46,8 +46,8 @@
 /**
  * Executes the work offline action. In the offline mode the user actions will
- * not be uploaded immediately to the Mapdust service. The user can perform the
+ * not be uploaded immediately to the MapDust service. The user can perform the
  * following actions in offline mode: add bug, comment bug and change bug
- * status. After deactivating the offline mode the user's modifications will be
- * uploaded to the Mapdust service.
+ * status. After de-activating the offline mode the user's modifications will be
+ * uploaded to the MapDust service.
  *
  * @author Bea
@@ -79,4 +79,9 @@
     }
 
+    /**
+     * Sets the 'offline' mode for the plugin.
+     * 
+     * @param event The event which fires this action
+     */
     @Override
     public void actionPerformed(ActionEvent event) {
@@ -94,17 +99,13 @@
                     String message = "Do you want to submit your changes ";
                     message += "to Mapdust?";
-                    int result =
-                            JOptionPane.showConfirmDialog(Main.parent,
-                                    tr(message), tr(title),
-                                    JOptionPane.YES_NO_OPTION);
+                    int result = JOptionPane.showConfirmDialog(Main.parent,
+                            tr(message), tr(title), JOptionPane.YES_NO_OPTION);
                     if (result == JOptionPane.YES_OPTION) {
                         // process data
                         try {
                             MapdustActionUploader.getInstance().uploadData(
-                                    getMapdustGUI().getQueuePanel()
-                                            .getActionList());
+                                    getMapdustGUI().getQueuePanel().getActionList());
                         } catch (MapdustActionUploaderException e) {
-                            String errorMessage =
-                                    "There was a Mapdust service error.";
+                            String errorMessage = "There was a Mapdust service error.";
                             JOptionPane.showMessageDialog(Main.parent,
                                     tr(errorMessage), tr("Error"),
@@ -150,6 +151,7 @@
         Iterator<MapdustRefreshObserver> elements = this.observers.iterator();
         while (elements.hasNext()) {
-            (elements.next()).updateData();
+            (elements.next()).refreshData();
         }
     }
+    
 }
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/show/MapdustShowAction.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/show/MapdustShowAction.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/show/MapdustShowAction.java	(revision 25127)
@@ -141,5 +141,4 @@
     }
 
-
     /**
      * Disables the buttons from the given button panel.
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/show/ShowCloseBugAction.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/show/ShowCloseBugAction.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/show/ShowCloseBugAction.java	(revision 25127)
@@ -31,5 +31,4 @@
 import java.awt.event.ActionEvent;
 import javax.swing.JToggleButton;
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.plugins.mapdust.MapdustPlugin;
 import org.openstreetmap.josm.plugins.mapdust.gui.component.dialog.ChangeIssueStatusDialog;
@@ -76,5 +75,4 @@
             }
             disableButtons(getButtonPanel());
-            Main.pref.put("mapdust.modify", true);
             ChangeIssueStatusDialog dialog = new ChangeIssueStatusDialog(
                     getTitle(), getIconName(), getMessageText(), "close", btn,
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/show/ShowCommentBugAction.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/show/ShowCommentBugAction.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/show/ShowCommentBugAction.java	(revision 25127)
@@ -31,5 +31,4 @@
 import java.awt.event.ActionEvent;
 import javax.swing.JToggleButton;
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.plugins.mapdust.MapdustPlugin;
 import org.openstreetmap.josm.plugins.mapdust.gui.component.dialog.CommentIssueDialog;
@@ -77,5 +76,4 @@
             }
             disableButtons(getButtonPanel());
-            Main.pref.put("mapdust.modify", true);
             CommentIssueDialog dialog = new CommentIssueDialog(getTitle(),
                     getIconName(), getMessageText(), btn, getMapdustPlugin());
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/show/ShowInvalidateBugAction.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/show/ShowInvalidateBugAction.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/show/ShowInvalidateBugAction.java	(revision 25127)
@@ -31,5 +31,4 @@
 import java.awt.event.ActionEvent;
 import javax.swing.JToggleButton;
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.plugins.mapdust.MapdustPlugin;
 import org.openstreetmap.josm.plugins.mapdust.gui.component.dialog.ChangeIssueStatusDialog;
@@ -77,5 +76,4 @@
             }
             disableButtons(getButtonPanel());
-            Main.pref.put("mapdust.modify", true);
             ChangeIssueStatusDialog dialog = new ChangeIssueStatusDialog(
                     getTitle(), getIconName(), getMessageText(), "invalidate",
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/show/ShowReOpenBugAction.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/show/ShowReOpenBugAction.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/show/ShowReOpenBugAction.java	(revision 25127)
@@ -31,5 +31,4 @@
 import java.awt.event.ActionEvent;
 import javax.swing.JToggleButton;
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.plugins.mapdust.MapdustPlugin;
 import org.openstreetmap.josm.plugins.mapdust.gui.component.dialog.ChangeIssueStatusDialog;
@@ -76,5 +75,4 @@
             }
             disableButtons(getButtonPanel());
-            Main.pref.put("mapdust.modify", true);
             ChangeIssueStatusDialog dialog = new ChangeIssueStatusDialog(
                     getTitle(), getIconName(), getMessageText(), "reopen", btn,
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/dialog/ChangeIssueStatusDialog.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/dialog/ChangeIssueStatusDialog.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/dialog/ChangeIssueStatusDialog.java	(revision 25127)
@@ -126,6 +126,5 @@
         setLayout(null);
         addComponents(mapdustPlugin);
-        MapdustButtonPanel btnPanel =
-                mapdustPlugin.getMapdustGUI().getPanel().getBtnPanel();
+        MapdustButtonPanel btnPanel = mapdustPlugin.getMapdustGUI().getPanel().getBtnPanel();
         addWindowListener(new WindowClose(this, btnPanel, getFiredButton()));
     }
@@ -201,10 +200,10 @@
         /* creates the cancel button */
         if (btnCancel == null) {
-            Rectangle bounds = new Rectangle(250, 170, 80, 25);
+            Rectangle bounds = new Rectangle(240, 170, 90, 25);
             btnCancel = ComponentUtil.createJButton("Cancel", bounds, cancelAction);
         }
         /* creates the ok button */
         if (btnOk == null) {
-            Rectangle bounds = new Rectangle(180, 170, 60, 25);
+            Rectangle bounds = new Rectangle(170, 170, 60, 25);
             btnOk = ComponentUtil.createJButton("OK", bounds, okAction);
         }
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/dialog/CommentIssueDialog.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/dialog/CommentIssueDialog.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/dialog/CommentIssueDialog.java	(revision 25127)
@@ -166,5 +166,5 @@
         /* creates the cancel button */
         if (btnCancel == null) {
-            Rectangle bounds = new Rectangle(250, 170, 80, 25);
+            Rectangle bounds = new Rectangle(240, 170, 90, 25);
             ExecuteCancel cancelAction = new ExecuteCancel(this,
                     mapdustPlugin.getMapdustGUI());
@@ -174,5 +174,5 @@
         /* creates the ok button */
         if (btnOk == null) {
-            Rectangle bounds = new Rectangle(180, 170, 60, 25);
+            Rectangle bounds = new Rectangle(170, 170, 60, 25);
             ExecuteCommentBug okAction =
                     new ExecuteCommentBug(this, mapdustPlugin.getMapdustGUI());
@@ -272,3 +272,4 @@
         return messageText;
     }
+    
 }
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/dialog/CreateIssueDialog.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/dialog/CreateIssueDialog.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/dialog/CreateIssueDialog.java	(revision 25127)
@@ -66,5 +66,5 @@
 
     /** The create issue text */
-    private final String createIssueText;
+    private String createIssueText;
 
     /** Text message */
@@ -111,21 +111,43 @@
      * @param mapdustPlugin The <code>MapdustPlugin</code> object
      */
-    public CreateIssueDialog(String title, String iconName, String messageText,
-            Point point, MapdustPlugin mapdustPlugin) {
-        this.createIssueText = messageText;
+    public CreateIssueDialog(Point point, MapdustPlugin mapdustPlugin) {
+        this.createIssueText= "In order to create a new bug report you";
+        this.createIssueText += " need to provide your nickname and a brief";
+        this.createIssueText+= " description for the bug.";
         this.point = point;
-        setTitle(title);
-        setDefaultLookAndFeelDecorated(true);
-        Image image = ImageProvider.get(iconName).getImage();
+        /* set JDialog settings */
+        initializeDialog();
+        /* add components to the dialog */
+        addComponents(mapdustPlugin);
+        /* add window listenet */
+        MapdustButtonPanel btnPanel = mapdustPlugin.getMapdustGUI().getPanel().getBtnPanel();
+        addWindowListener(new WindowClose(this, btnPanel, null));
+    }
+
+    /**
+     * Initializes the dialog default fields.
+     */
+    private void initializeDialog(){
+        /* set JDialog settings */
+        setTitle("Create bug report");
+        setModal(true);
+        Image image = ImageProvider.get("dialogs/open.png").getImage();
         setIconImage(image);
-        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+        setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
         getContentPane().setFont(new Font("Times New Roman", Font.BOLD, 14));
         setResizable(false);
         setForeground(Color.black);
         setLayout(null);
-        setModal(true);
-        addComponents(mapdustPlugin);
-        MapdustButtonPanel btnPanel = mapdustPlugin.getMapdustGUI().getPanel().getBtnPanel();
-        addWindowListener(new WindowClose(this, btnPanel, getFiredButton()));
+
+    }
+
+    /**
+     * Displays the dialog.
+     */
+    public void showDialog(){
+       setLocationRelativeTo(null);
+       getContentPane().setPreferredSize(getSize());
+       pack();
+       setVisible(true);
     }
 
@@ -167,5 +189,5 @@
         if (lblDescription == null) {
             lblDescription = ComponentUtil.createJLabel("Description", font,
-                    new Rectangle(10, 150, 85, 25));
+                    new Rectangle(10, 150, 95, 25));
         }
         if (cmpDescription == null) {
@@ -178,5 +200,5 @@
         /* creates the cancel button */
         if (btnCancel == null) {
-            Rectangle bounds = new Rectangle(260, 210, 80, 25);
+            Rectangle bounds = new Rectangle(250, 210, 90, 25);
             ExecuteCancel cancelAction = new ExecuteCancel(this,
                     mapdustPlugin.getMapdustGUI());
@@ -186,5 +208,5 @@
         /* creates the ok button */
         if (btnOk == null) {
-            Rectangle bounds = new Rectangle(190, 210, 60, 25);
+            Rectangle bounds = new Rectangle(180, 210, 60, 25);
             ExecuteAddBug okAction = new ExecuteAddBug(this,
                     mapdustPlugin.getMapdustGUI());
@@ -286,3 +308,4 @@
         return point;
     }
+
 }
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/panel/MapdustBugPropertiesPanel.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/panel/MapdustBugPropertiesPanel.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/panel/MapdustBugPropertiesPanel.java	(revision 25127)
@@ -29,9 +29,12 @@
 
 
+import static org.openstreetmap.josm.tools.I18n.tr;
 import java.awt.BorderLayout;
 import java.awt.Dimension;
+import javax.swing.JOptionPane;
 import javax.swing.JPanel;
 import javax.swing.JScrollPane;
 import javax.swing.JTabbedPane;
+import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.plugins.mapdust.gui.component.util.ComponentUtil;
@@ -91,7 +94,12 @@
     }
 
+    /**
+     * Displays the details of the given MapDust bug.
+     * 
+     * @param mapdustBug The <code>MapdustBug</code> object
+     */
     @Override
     public void showDetails(MapdustBug mapdustBug) {
-        MapdustBug selectedBug=mapdustBug;
+        MapdustBug selectedBug = mapdustBug;
         if (mapdustBug != null) {
             if (mapdustBug.getNumberOfComments() > 0) {
@@ -104,10 +112,11 @@
         if (mainPanel != null) {
             index = mainPanel.getSelectedIndex();
-            cmpDetails.remove(detailsPanel);
-            mainPanel.remove(cmpDetails);
-            mainPanel.remove(cmpAddress);
-            mainPanel.remove(descriptionPanel);
-            mainPanel.remove(commentsPanel);
-            mainPanel.remove(helpPanel);
+            if (mainPanel.getComponentCount() > 0) {
+                mainPanel.remove(cmpDetails);
+                mainPanel.remove(cmpAddress);
+                mainPanel.remove(descriptionPanel);
+                mainPanel.remove(commentsPanel);
+                mainPanel.remove(helpPanel);
+            }
             remove(mainPanel);
         }
@@ -143,7 +152,6 @@
         /* create details panel */
         detailsPanel = new MapdustBugDetailsPanel(mapdustBug);
-        cmpDetails =
-                ComponentUtil.createJScrollPane(detailsPanel, getBounds(),
-                        getBackground(), true, true);
+        cmpDetails = ComponentUtil.createJScrollPane(detailsPanel, getBounds(),
+                getBackground(), true, true);
         cmpDetails.setPreferredSize(new Dimension(100, 100));
         cmpDetails.setName("Bug Details");
@@ -153,19 +161,16 @@
         LatLon coordinates = mapdustBug != null ? mapdustBug.getLatLon() : null;
         addressPanel = new MapdustAddressPanel(address, coordinates);
-        cmpAddress =
-                ComponentUtil.createJScrollPane(addressPanel, getBounds(),
-                        getBackground(), true, true);
+        cmpAddress = ComponentUtil.createJScrollPane(addressPanel, getBounds(),
+                getBackground(), true, true);
         cmpAddress.setName("Address");
         cmpAddress.setPreferredSize(new Dimension(100, 100));
 
         /* create description panel */
-        String description =
-                mapdustBug != null ? mapdustBug.getDescription() : "";
+        String description = mapdustBug != null ? mapdustBug.getDescription() : "";
         descriptionPanel = new MapdustDescriptionPanel(description);
 
         /* create comments panel */
-        MapdustComment[] comments =
-                mapdustBug != null ? mapdustBug.getComments()
-                        : new MapdustComment[0];
+        MapdustComment[] comments = mapdustBug != null ? mapdustBug.getComments()
+                : new MapdustComment[0];
         commentsPanel = new MapdustCommentsPanel(comments);
 
@@ -195,5 +200,8 @@
             bug = new MapdustServiceHandler().getBug(id, null);
         } catch (MapdustServiceHandlerException e) {
-
+            String errorMessage = "There was a MapDust service error durring ";
+            errorMessage+=" the MapDust bug retrieve process.";
+            JOptionPane.showMessageDialog(Main.parent, tr(errorMessage),
+                    tr("Error"), JOptionPane.ERROR_MESSAGE);
         }
         return bug;
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/panel/MapdustCommentsPanel.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/panel/MapdustCommentsPanel.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/panel/MapdustCommentsPanel.java	(revision 25127)
@@ -100,3 +100,4 @@
         add(sp);
     }
+
 }
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/panel/MapdustPanel.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/panel/MapdustPanel.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/panel/MapdustPanel.java	(revision 25127)
@@ -29,6 +29,6 @@
 
 
-import static org.openstreetmap.josm.tools.I18n.tr;
 import java.awt.BorderLayout;
+import java.awt.Color;
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -39,4 +39,5 @@
 import javax.swing.JPopupMenu;
 import javax.swing.JScrollPane;
+import javax.swing.border.LineBorder;
 import javax.swing.event.ListSelectionEvent;
 import javax.swing.event.ListSelectionListener;
@@ -50,4 +51,5 @@
 import org.openstreetmap.josm.plugins.mapdust.gui.action.show.ShowInvalidateBugAction;
 import org.openstreetmap.josm.plugins.mapdust.gui.action.show.ShowReOpenBugAction;
+import org.openstreetmap.josm.plugins.mapdust.gui.component.renderer.BugListCellRenderer;
 import org.openstreetmap.josm.plugins.mapdust.gui.component.util.ComponentUtil;
 import org.openstreetmap.josm.plugins.mapdust.gui.observer.MapdustBugDetailsObservable;
@@ -102,7 +104,5 @@
      * Builds a <code>MapdustPlugin</code> object
      */
-    public MapdustPanel() {
-
-    }
+    public MapdustPanel() {}
 
     /**
@@ -119,5 +119,5 @@
         setLayout(new BorderLayout(5, 10));
         addComponents(mapdustPlugin);
-        setName(tr(name));
+        setName(name);
     }
 
@@ -134,35 +134,41 @@
             /* add comment item */
             MapdustShowAction action = new ShowCommentBugAction(mapdustPlugin);
-            menuAddComment =
-                    ComponentUtil.createJMenuItem(action, tr("Add comment"),
-                            "dialogs/comment.png");
+            menuAddComment = ComponentUtil.createJMenuItem(action, "Add comment",
+                    "dialogs/comment.png");
             menu.add(menuAddComment);
             /* fix bug item */
             action = new ShowCloseBugAction(mapdustPlugin);
-            menuFixed =
-                    ComponentUtil.createJMenuItem(action, tr("Close bug"),
-                            "dialogs/fixed.png");
+            menuFixed = ComponentUtil.createJMenuItem(action, "Close bug",
+                    "dialogs/fixed.png");
             menu.add(menuFixed);
             /* invalidate bug item */
             action = new ShowInvalidateBugAction(mapdustPlugin);
-            menuInvalidate =
-                    ComponentUtil.createJMenuItem(action, tr("Invalidate bug"),
-                            "dialogs/invalid.png");
+            menuInvalidate = ComponentUtil.createJMenuItem(action,
+                    "Invalidate bug", "dialogs/invalid.png");
             menu.add(menuInvalidate);
             /* re-open bug item */
             action = new ShowReOpenBugAction(mapdustPlugin);
-            menuReopen =
-                    ComponentUtil.createJMenuItem(action, tr("Re-open bug"),
-                            "dialogs/reopen.png");
+            menuReopen = ComponentUtil.createJMenuItem(action, "Re-open bug",
+                    "dialogs/reopen.png");
             menu.add(menuReopen);
         }
         /* create bugs list */
-        listBugs = ComponentUtil.createJList(mapdustBugsList, menu);
-        listBugs.addListSelectionListener(this);
-        DisplayMenu adapter = new DisplayMenu(listBugs, menu);
-        listBugs.addMouseListener(adapter);
-        JScrollPane cmpBugs = ComponentUtil.createJScrollPane(listBugs);
-        /* add components */
-        add(cmpBugs, BorderLayout.CENTER);
+        JScrollPane cmpBugs;
+        if (mapdustBugsList != null && mapdustBugsList.size() == 0) {
+            String text = " No bugs in the current view!";
+            JList l=new JList(new String[]{text});
+            l.setBorder(new LineBorder(Color.black, 1, false));
+            l.setCellRenderer(new BugListCellRenderer());
+            cmpBugs=ComponentUtil.createJScrollPane(l);
+            add(cmpBugs, BorderLayout.CENTER);
+        } else {
+            listBugs = ComponentUtil.createJList(mapdustBugsList, menu);
+            listBugs.addListSelectionListener(this);
+            DisplayMenu adapter = new DisplayMenu(listBugs, menu);
+            listBugs.addMouseListener(adapter);
+            cmpBugs = ComponentUtil.createJScrollPane(getListBugs());
+            add(cmpBugs, BorderLayout.CENTER);
+        }
+        /* add button panel */
         add(btnPanel, BorderLayout.SOUTH);
     }
@@ -203,4 +209,5 @@
             getMenuFixed().setEnabled(false);
         }
+        /* re-paint */
         Main.map.mapView.repaint();
         mapdustGUI.repaint();
@@ -213,5 +220,8 @@
      */
     public MapdustBug getSelectedBug() {
-        MapdustBug selectedBug = (MapdustBug) getListBugs().getSelectedValue();
+        MapdustBug selectedBug=null;
+        if (getListBugs()!=null) {
+            selectedBug = (MapdustBug) getListBugs().getSelectedValue();
+        }
         return selectedBug;
     }
@@ -348,3 +358,4 @@
         }
     }
+
 }
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/renderer/BugListCellRenderer.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/renderer/BugListCellRenderer.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/renderer/BugListCellRenderer.java	(revision 25127)
@@ -63,8 +63,8 @@
     public Component getListCellRendererComponent(JList list, Object value,
             int index, boolean isSelected, boolean hasFocus) {
-        JLabel label =
-                (JLabel) super.getListCellRendererComponent(list, value, index,
-                        isSelected, hasFocus);
+        JLabel label =(JLabel) super.getListCellRendererComponent(list, value,
+                index,isSelected, hasFocus);
         if (value instanceof MapdustBug) {
+            /* show the MapdustBug in the list */
             MapdustBug mapdustBug = (MapdustBug) value;
             String iconPath = "bugs/normal/";
@@ -87,4 +87,10 @@
             label.setFont(new Font("Times New Roman", Font.BOLD, 12));
         }
+        if (value instanceof String){
+            /* show default text in the list */
+            String text=(String)value;
+            label.setText(text);
+            label.setFont(new Font("Times New Roman", Font.BOLD, 12));
+        }
         return (label);
     }
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/observer/MapdustInitialUpdateObserver.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/observer/MapdustInitialUpdateObserver.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/observer/MapdustInitialUpdateObserver.java	(revision 25127)
@@ -42,3 +42,4 @@
      */
     public void initialUpdate();
+
 }
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/observer/MapdustRefreshObserver.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/observer/MapdustRefreshObserver.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/observer/MapdustRefreshObserver.java	(revision 25127)
@@ -39,6 +39,7 @@
 
     /**
-     * Updates the data of the MapDust plugin data.
+     * Refreshes the MapDust data. Downloads the bugs from the current view, and
+     * updates the plugin with the new data.
      */
-    public void updateData();
+    public void refreshData();
 }
Index: /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/util/retry/RetrySetup.java
===================================================================
--- /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/util/retry/RetrySetup.java	(revision 25126)
+++ /applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/util/retry/RetrySetup.java	(revision 25127)
@@ -38,5 +38,5 @@
     /** A default configuration for the {@link RetryAgent} */
     public static final RetrySetup DEFAULT = new RetrySetup(RetryMode.COUNTED,
-            3, 500);
+            1, 500);
 
     /** The retry mode */
