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 24820)
+++ applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/MapdustPlugin.java	(revision 24821)
@@ -79,4 +79,7 @@
     private List<MapdustBug> mapdustBugList;
     
+    /** Flag indicating if the list of bugs was empty or not */
+    private boolean wasEmpty;
+    
     /**
      * Builds a new <code>MapDustPlugin</code> object based on the given
@@ -106,6 +109,6 @@
         } else {
             /* add MapDust dialog window */
-            Shortcut shortcut = Shortcut.registerShortcut("mapdust",
-                    tr("Toggle: {0}", tr("Open MapDust")), KeyEvent.VK_0, 
+            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";
@@ -116,6 +119,6 @@
             mapdustGUI.addObserver(this);
             newMapFrame.addToggleDialog(mapdustGUI);
+            MapView.addZoomChangeListener(this);
             MapView.addLayerChangeListener(this);
-            MapView.addZoomChangeListener(this);
             Main.map.mapView.addMouseListener(this);
         }
@@ -135,13 +138,16 @@
                 if (getMapdustGUI().isDialogShowing()) {
                     /* updates the views */
-                    updateView();
-                    /* show message if there is not bug in the given area */
-                    if (this.mapdustBugList == null
-                            || this.mapdustBugList.size() == 0) {
-                        String waringMessage = "There is no MapDust bug ";
-                        waringMessage += "in your visible area.";
+                    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;
                     }
                 }
@@ -215,4 +221,5 @@
             }
             mapdustLayer = null;
+            wasEmpty = false;
         }
     }
@@ -223,39 +230,47 @@
                 && Main.map.mapView.getActiveLayer() == getMapdustLayer()) {
             /* show add bug dialog */
-            if (event.getClickCount() == 2) {
-                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());
+            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");
+                    }
+                    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("selectedBug.status", "create");
+                    Main.pref.put("mapdust.addBug", false);
                 }
-                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);
-                return;
             }
             if (event.getButton() == MouseEvent.BUTTON1) {
@@ -280,9 +295,13 @@
         /* update the dialog with the new data */
         mapdustGUI.update(mapdustBugList, this);
+        mapdustGUI.revalidate();
         if (mapdustLayer == null) {
             /* create and add the layer */
-            mapdustLayer = new MapdustLayer("MapDust", mapdustGUI, mapdustBugList);
+            mapdustLayer =
+                    new MapdustLayer("MapDust", mapdustGUI, mapdustBugList);
             Main.main.addLayer(mapdustLayer);
             Main.map.mapView.moveLayer(mapdustLayer, 0);
+            ;
+            Main.map.mapView.addMouseListener(this);
             MapView.addLayerChangeListener(this);
             MapView.addZoomChangeListener(this);
@@ -295,20 +314,6 @@
         }
         /* repaint */
-        Main.map.mapView.invalidate();
+        Main.map.mapView.revalidate();
         Main.map.repaint();
-        Main.map.mapView.repaint();
-    }
-    
-    /**
-     * Returns the bounds of the current map view.
-     * 
-     * @return A <code>Bounds</code> object
-     */
-    private Bounds getBounds() {
-        MapView mapView = Main.map.mapView;
-        Bounds bounds =
-                new Bounds(mapView.getLatLon(0, mapView.getHeight()),
-                        mapView.getLatLon(mapView.getWidth(), 0));
-        return bounds;
     }
     
@@ -320,15 +325,11 @@
     public void initialUpdate() {
         if (containsOsmDataLayer()) {
-            Main.worker.execute(new Runnable() {
-                
-                @Override
-                public void run() {
-                    updateData();
-                    
-                }
-            });
-        }
-    }
-    
+            updateData();
+        }
+    }
+    
+    /**
+     * If the zoom was changed, download the bugs from the current map view.
+     */
     @Override
     public void zoomChanged() {
@@ -388,5 +389,8 @@
             throws MapdustServiceHandlerException {
         /* get the bounding box */
-        Bounds bounds = getBounds();
+        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();
@@ -425,5 +429,7 @@
     
     @Override
-    public void mouseEntered(MouseEvent arg0) {}
+    public void mouseEntered(MouseEvent event) {
+
+    }
     
     @Override
@@ -431,5 +437,7 @@
     
     @Override
-    public void mousePressed(MouseEvent arg0) {}
+    public void mousePressed(MouseEvent event) {
+
+    }
     
     @Override
@@ -473,4 +481,6 @@
     
     /**
+     * Returns the list of <code>MapdustBug</code> objects
+     * 
      * @return the mapdustBugList
      */
@@ -480,4 +490,6 @@
     
     /**
+     * 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/gui/MapdustGUI.java
===================================================================
--- applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/MapdustGUI.java	(revision 24820)
+++ applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/MapdustGUI.java	(revision 24821)
@@ -56,5 +56,5 @@
 /**
  * This class is the main graphical user interface class.
- *
+ * 
  * @author Bea
  */
@@ -62,34 +62,34 @@
         MapdustActionListObserver, MapdustBugDetailsObservable,
         MapdustInitialUpdateObservable {
-
+    
     /** The serial version UID */
     private static final long serialVersionUID = 1L;
-
+    
     /** The list of MapDust bug details observers */
     private final ArrayList<MapdustBugDetailsObserver> bugDetailsObservers =
             new ArrayList<MapdustBugDetailsObserver>();
-
+    
     /** The list of MapDust initial update observers */
     private final ArrayList<MapdustInitialUpdateObserver> initialUpdateObservers =
             new ArrayList<MapdustInitialUpdateObserver>();
-
+    
     /** The <code>MapdustPanel</code> object */
     private MapdustPanel panel;
-
+    
     /** The <code>MapdustActionPanel</code> object */
     private MapdustActionPanel queuePanel;
-
+    
     /** The <code>JTabbedPanel</code> object */
     private JTabbedPane tabbedPane;
-
+    
     /** The <code>MapdustPlugin</code> plugin */
     private MapdustPlugin mapdustPlugin;
-
+    
     /** The <code>MapdustBugPropertiesPanel</code> */
     private final MapdustBugPropertiesPanel detailsPanel;
-
+    
     /** The <code>JPanel</code> */
     private JPanel mainPanel;
-
+    
     /**
      * Flag indicating if the MapDust data was downloaded and the view was
@@ -97,8 +97,8 @@
      */
     private boolean initialUpdate = false;
-
+    
     /**
      * Builds a <code>MapdustGUi</code> based on the given parameters.
-     *
+     * 
      * @param name The name of the GUI
      * @param iconName The name of the icon
@@ -149,9 +149,9 @@
         }
     }
-
+    
     /**
      * Updates the MapDust GUI with the given list of <code>MapdustBug</code>
      * objects.
-     *
+     * 
      * @param mapdustBugs The list of <code>MapdustBug</code> objects
      * @param mapdustPlugin The <code>MapdustPlugin</code> object
@@ -178,9 +178,9 @@
             /* add panels with updated data */
             panel = new MapdustPanel(mapdustBugs, "Bug reports", mapdustPlugin);
-            panel.addObserver(detailsPanel);
             MapdustBug selectedBug =
                     (mapdustBugs != null && mapdustBugs.size() > 0) ? mapdustBugs
                             .get(0) : null;
             notifyObservers(selectedBug);
+            panel.addObserver(detailsPanel);
             mainPanel = new JPanel();
             mainPanel.setAutoscrolls(true);
@@ -210,8 +210,7 @@
             tabbedPane = new JTabbedPane();
             queuePanel = new MapdustActionPanel(list, "Offline Contribution",
-                            mapdustPlugin);
+                    mapdustPlugin);
             panel = new MapdustPanel(mapdustBugs, "Bug reports (offline)",
-                            mapdustPlugin);
-            panel.addObserver(detailsPanel);
+                    mapdustPlugin);
             mainPanel = new JPanel();
             mainPanel.setAutoscrolls(true);
@@ -226,8 +225,8 @@
         }
     }
-
+    
     /**
      * Adds the given <code>MapdustAction</code> object to the list of actions.
-     *
+     * 
      * @param action The <code>MapdustAction</code> object
      */
@@ -238,5 +237,5 @@
         List<MapdustBug> mapdustBugs = panel.getMapdustBugsList();
         mapdustBugs = modifyBug(mapdustBugs, action.getMapdustBug());
-
+        
         /* remove panels */
         mainPanel.remove(detailsPanel);
@@ -260,9 +259,7 @@
         mainPanel.add(tabbedPane, BorderLayout.CENTER);
         add(mainPanel, BorderLayout.CENTER);
-        /* invalidate and repaint */
-        invalidate();
-        repaint();
-    }
-
+        revalidate();
+    }
+    
     /**
      * Shows the MapDust main dialog. In the case if the plugin was not updated
@@ -270,5 +267,5 @@
      * download the MapDust data from the current view, and update the plugin
      * with the new data.
-     *
+     * 
      */
     @Override
@@ -281,10 +278,10 @@
         }
     }
-
+    
     /**
      * Modifies the given <code>MapdustBug</code> in the given list of
      * <code>MapdustBug</code> objects. Returns the list of bugs containing the
      * modified bug.
-     *
+     * 
      * @param mapdustBugs The list of <code>MapdustBug</code> objects
      * @param modifiedBug The <code>MapdustBug</code> object
@@ -308,8 +305,8 @@
         return mapdustBugs;
     }
-
+    
     /**
      * Adds a new MapDust bug details observer to the list of observers.
-     *
+     * 
      * @param observer The <code>MapdustBugDetailsObserver</code> object
      */
@@ -320,8 +317,8 @@
         }
     }
-
+    
     /**
      * Adds a new MapDust initial update observer to the list of observers.
-     *
+     * 
      * @param observer The <code>MapdustInitialUpdateObserver</code> object
      */
@@ -332,9 +329,9 @@
         }
     }
-
+    
     /**
      * Removes the given MapDust bug details observer from the list of
      * observers.
-     *
+     * 
      * @param observer The <code>MapdustBugDetailsObserver</code> object
      */
@@ -342,11 +339,11 @@
     public void removeObserver(MapdustBugDetailsObserver observer) {
         this.bugDetailsObservers.remove(observer);
-
-    }
-
+        
+    }
+    
     /**
      * Removes the given MapDust initial update observer from the list of
      * observers.
-     *
+     * 
      * @param observer The <code>MapdustInitialUpdateObserver</code> object
      */
@@ -354,7 +351,7 @@
     public void removeObserver(MapdustInitialUpdateObserver observer) {
         this.initialUpdateObservers.remove(observer);
-
-    }
-
+        
+    }
+    
     /**
      * Notifies the <code>MapdustBugDetailsObserver</code> objects observing the
@@ -369,5 +366,5 @@
         }
     }
-
+    
     /**
      * Notifies the <code>MapdustInitialUpdateObserver</code> objects waiting
@@ -382,8 +379,8 @@
         }
     }
-
+    
     /**
      * Returns the <code>MapdustPanel</code> object
-     *
+     * 
      * @return the panel
      */
@@ -391,8 +388,8 @@
         return panel;
     }
-
+    
     /**
      * Returns the <code>MapdustActionPanel</code> object
-     *
+     * 
      * @return the queuePanel
      */
@@ -400,4 +397,4 @@
         return queuePanel;
     }
-
+    
 }
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 24820)
+++ applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/adapter/WindowClose.java	(revision 24821)
@@ -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,7 +128,9 @@
         }
         /* 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/ExecuteCancel.java
===================================================================
--- applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteCancel.java	(revision 24820)
+++ applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/action/execute/ExecuteCancel.java	(revision 24821)
@@ -65,4 +65,5 @@
     }
 
+
     @Override
     public void actionPerformed(ActionEvent event) {
@@ -116,9 +117,12 @@
                 btnPanel.getBtnReOpenBugReport().setSelected(false);
             }
-            /* dispose dialog */
-            Main.pref.put("mapdust.modify", false);
-            getDialog().dispose();
         }
+
+        Main.pref.put("mapdust.addBug", true);
+        Main.pref.put("mapdust.modify", false);
+        /* dispose dialog */
+        getDialog().setVisible(false);
+        getDialog().dispose();
     }
-
+    
 }
