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 25651)
+++ applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/MapdustLayer.java	(revision 25656)
@@ -44,5 +44,4 @@
 import javax.swing.ImageIcon;
 import javax.swing.JToolTip;
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.actions.RenameLayerAction;
 import org.openstreetmap.josm.data.Bounds;
@@ -170,5 +169,5 @@
     public void paint(Graphics2D g, MapView mv, Bounds bounds) {
         JToolTip tooltip = new JToolTip();
-        if (mapdustBugList != null) {
+        if (mapdustBugList != null && mapdustBugList.size()>0) {
             /* draw the current visible bugs */
             for (MapdustBug bug : mapdustBugList) {
@@ -200,11 +199,9 @@
             /* draw the selected bug description */
             /* selected by clicking */
-            MapdustBug bug1 = getBugSelected();
+            MapdustBug clickedBug = getBugSelected();
             /* selected from the list */
             MapdustBug bugSelected = getMapdustGUI().getSelectedBug();
             if (bugSelected == null) {
-                if (Main.map.mapView.getActiveLayer() == this) {
-                    bugSelected = bug1;
-                }
+                    bugSelected = clickedBug;
             }
             setBugSelected(bugSelected);
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 25651)
+++ applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/MapdustPlugin.java	(revision 25656)
@@ -126,5 +126,5 @@
         String longTxt = tr("Toggle: {0}", tr("Open MapDust"));
         Shortcut shortcut = Shortcut.registerShortcut(shortTxt, longTxt,
-                KeyEvent.VK_0, Shortcut.GROUP_MENU, Shortcut.SHIFT_DEFAULT);
+                KeyEvent.VK_0, Shortcut.GROUP_LAYER, Shortcut.SHIFT_DEFAULT);
         String name = "MapDust bug reports";
         String tooltip = "Activates the MapDust bug reporter plugin";
@@ -132,5 +132,6 @@
                 shortcut, 150, this);
         /* add default values for static variables */
-        Main.pref.put("mapdust.pluginState", MapdustPluginState.ONLINE.getValue());
+        Main.pref.put("mapdust.pluginState",
+                MapdustPluginState.ONLINE.getValue());
         Main.pref.put("mapdust.nickname", "");
         Main.pref.put("mapdust.showError", true);
@@ -294,6 +295,9 @@
             }
             if (filter.getDescr() != null && filter.getDescr()) {
-                if (!mapdustBug.getIsDefaultDescription()) {
+                /* show only bugs with isDefaultDescription = false */
+                if (mapdustBug.getIsDefaultDescription()) {
                     result = false;
+                } else {
+                    result = containsStatus && containsType;
                 }
             } else {
@@ -436,11 +440,8 @@
             Main.pref.put("mapdust.pluginState",
                     MapdustPluginState.ONLINE.getValue());
-            MapView.removeLayerChangeListener(this);
             NavigatableComponent.removeZoomChangeListener(this);
             Main.map.mapView.removeLayer(layer);
             Main.map.remove(mapdustGUI);
             if (mapdustGUI != null) {
-                mapdustGUI.update(new ArrayList<MapdustBug>(), this);
-                mapdustGUI.setVisible(false);
                 mapdustGUI.destroy();
             }
@@ -576,5 +577,4 @@
             Main.map.mapView.moveLayer(this.mapdustLayer, 0);
             Main.map.mapView.addMouseListener(this);
-            MapView.addLayerChangeListener(this);
             NavigatableComponent.addZoomChangeListener(this);
         } else {
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 25651)
+++ applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/MapdustGUI.java	(revision 25656)
@@ -96,4 +96,7 @@
     private boolean downloaded = false;
 
+    /** Specifies if the MapDust layer was or not before deleted */
+    boolean wasDeleted = false;
+
     /**
      * Builds a <code>MapdustGUi</code> based on the given parameters.
@@ -114,7 +117,6 @@
     /**
      * 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.
+     * the MapDust data was not downloaded yet or the MapDust layer was added
+     * after a previous deletion, then the bug reports data will be deleted.
      */
     @Override
@@ -124,5 +126,33 @@
             downloaded = true;
         }
+        if (wasDeleted) {
+            notifyObservers(null, true);
+            wasDeleted = false;
+        }
         super.showDialog();
+    }
+
+    /**
+     * Destroys the <code>MapdustGUI</code> dialog window.
+     */
+    @Override
+    public void destroy() {
+        setVisible(false);
+        /* remove panels */
+        if (tabbedPane != null) {
+            /* from offline to online */
+            remove(mainPanel);
+            tabbedPane = null;
+            actionPanel = null;
+            mainPanel = null;
+            panel = null;
+        } else {
+            /* from online to offline */
+            remove(mainPanel);
+            mainPanel = null;
+            panel = null;
+        }
+        wasDeleted = true;
+        super.destroy();
     }
 
@@ -138,6 +168,6 @@
         actionList.add(action);
         List<MapdustBug> mapdustBugs = panel.getMapdustBugsList();
-        boolean showBug = shouldDisplay(action.getMapdustBug(),
-                mapdustPlugin.getFilter());
+        boolean showBug =
+                shouldDisplay(action.getMapdustBug(), mapdustPlugin.getFilter());
         mapdustBugs = modifyBug(mapdustBugs, action.getMapdustBug(), showBug);
 
@@ -145,6 +175,6 @@
         updateMapdustPanel(mapdustBugs);
         updateMapdustActionPanel(actionList);
-        if (showBug &&
-                !action.getCommand().equals(MapdustServiceCommand.ADD_BUG)) {
+        if (showBug
+                && !action.getCommand().equals(MapdustServiceCommand.ADD_BUG)) {
             panel.resetSelectedBug(0);
         } else {
@@ -242,6 +272,7 @@
         }
         if (panel == null) {
-            panel = new MapdustBugListPanel(mapdustBugs, "Bug reports",
-                    mapdustPlugin);
+            panel =
+                    new MapdustBugListPanel(mapdustBugs, "Bug reports",
+                            mapdustPlugin);
             panel.addObserver(detailsPanel);
         } else {
@@ -258,6 +289,7 @@
     private void updateMapdustActionPanel(List<MapdustAction> actionList) {
         if (actionPanel == null) {
-            actionPanel = new MapdustActionPanel(actionList,
-                    "Offline Contribution", mapdustPlugin);
+            actionPanel =
+                    new MapdustActionPanel(actionList, "Offline Contribution",
+                            mapdustPlugin);
         } else {
             actionPanel.updateComponents(actionList);
Index: applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/panel/MapdustBugListPanel.java
===================================================================
--- applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/panel/MapdustBugListPanel.java	(revision 25651)
+++ applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/panel/MapdustBugListPanel.java	(revision 25656)
@@ -250,4 +250,9 @@
                     getMenuFixed().setEnabled(false);
                 }
+
+                btnPanel.getBtnAddComment().setSelected(false);
+                btnPanel.getBtnReOpenBugReport().setSelected(false);
+                btnPanel.getBtnFixBugReport().setSelected(false);
+                btnPanel.getBtnInvalidateBugReport().setSelected(false);
                 notifyObservers(selectedBug);
             } else {
Index: applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/panel/MapdustButtonPanel.java
===================================================================
--- applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/panel/MapdustButtonPanel.java	(revision 25651)
+++ applications/editors/josm/plugins/mapdust/src/org/openstreetmap/josm/plugins/mapdust/gui/component/panel/MapdustButtonPanel.java	(revision 25656)
@@ -245,6 +245,9 @@
     public void enableBasicComponents(boolean onlyBasic) {
         btnWorkOffline.setEnabled(true);
+        btnWorkOffline.setSelected(false);
         btnFilter.setEnabled(true);
+        btnFilter.setSelected(false);
         btnRefresh.setEnabled(true);
+        btnRefresh.setSelected(false);
         if (onlyBasic) {
             btnAddComment.setEnabled(false);
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 25651)
+++ 	(revision )
@@ -1,361 +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.gui.component.panel;
-
-
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import javax.swing.JList;
-import javax.swing.JMenuItem;
-import javax.swing.JPanel;
-import javax.swing.JPopupMenu;
-import javax.swing.JScrollPane;
-import javax.swing.border.LineBorder;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.plugins.mapdust.MapdustPlugin;
-import org.openstreetmap.josm.plugins.mapdust.gui.MapdustGUI;
-import org.openstreetmap.josm.plugins.mapdust.gui.action.adapter.DisplayMenu;
-import org.openstreetmap.josm.plugins.mapdust.gui.action.show.MapdustShowAction;
-import org.openstreetmap.josm.plugins.mapdust.gui.action.show.ShowCloseBugAction;
-import org.openstreetmap.josm.plugins.mapdust.gui.action.show.ShowCommentBugAction;
-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;
-import org.openstreetmap.josm.plugins.mapdust.gui.observer.MapdustBugDetailsObserver;
-import org.openstreetmap.josm.plugins.mapdust.service.value.MapdustBug;
-
-
-/**
- * Defines the components of the MapDust panel
- *
- * @author Bea
- * @version $Revision$
- */
-public class MapdustPanel extends JPanel implements ListSelectionListener,
-        MapdustBugDetailsObservable {
-
-    /** The list of observers */
-    private final ArrayList<MapdustBugDetailsObserver> observers =
-            new ArrayList<MapdustBugDetailsObserver>();
-
-    /** The serial version UID */
-    private static final long serialVersionUID = 1L;
-
-    /** The list of <code>MapdustBug</code> objects */
-    private List<MapdustBug> mapdustBugsList;
-
-    /** The list of bugs */
-    private JList listBugs;
-
-    /** The button panel */
-    private MapdustButtonPanel btnPanel;
-
-    /** The <code>MapdustGUI</code> */
-    private MapdustGUI mapdustGUI;
-
-    /** The pop-up menu */
-    private JPopupMenu menu;
-
-    /** The add comment menu item */
-    private JMenuItem menuAddComment;
-
-    /** The fixed menu item */
-    private JMenuItem menuFixed;
-
-    /** The invalidate menu item */
-    private JMenuItem menuInvalidate;
-
-    /** The re-open menu item */
-    private JMenuItem menuReopen;
-
-    /**
-     * Builds a <code>MapdustPlugin</code> object
-     */
-    public MapdustPanel() {}
-
-    /**
-     * Builds a <code>MapdustPlugin</code> object with the given parameters.
-     *
-     * @param mapdustBugsList The list of <code>MapdustBug</code> objects
-     * @param name The name of the panel
-     * @param mapdustPlugin The <code>MapdustPlugin</code> object
-     */
-    public MapdustPanel(List<MapdustBug> mapdustBugsList, String name,
-            MapdustPlugin mapdustPlugin) {
-        this.mapdustGUI = mapdustPlugin.getMapdustGUI();
-        this.mapdustBugsList = mapdustBugsList;
-        setLayout(new BorderLayout(5, 10));
-        addComponents(mapdustPlugin);
-        setName(name);
-    }
-
-    /**
-     * Adds the components to the MapDust panel.
-     *
-     * @param mapdustPlugin The <code>MapdustPlugin</code> object
-     */
-    private void addComponents(MapdustPlugin mapdustPlugin) {
-        /* create components */
-        btnPanel = new MapdustButtonPanel(mapdustPlugin);
-        if (menu == null) {
-            menu = new JPopupMenu();
-            /* add comment item */
-            MapdustShowAction action = new ShowCommentBugAction(mapdustPlugin);
-            menuAddComment = ComponentUtil.createJMenuItem(action, "Add comment",
-                    "dialogs/comment.png");
-            menu.add(menuAddComment);
-            /* fix bug item */
-            action = new ShowCloseBugAction(mapdustPlugin);
-            menuFixed = ComponentUtil.createJMenuItem(action, "Close bug",
-                    "dialogs/fixed.png");
-            menu.add(menuFixed);
-            /* invalidate bug item */
-            action = new ShowInvalidateBugAction(mapdustPlugin);
-            menuInvalidate = ComponentUtil.createJMenuItem(action,
-                    "Invalidate bug", "dialogs/invalid.png");
-            menu.add(menuInvalidate);
-            /* re-open bug item */
-            action = new ShowReOpenBugAction(mapdustPlugin);
-            menuReopen = ComponentUtil.createJMenuItem(action, "Re-open bug",
-                    "dialogs/reopen.png");
-            menu.add(menuReopen);
-        }
-        /* create bugs list */
-        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);
-    }
-
-    @Override
-    public void valueChanged(ListSelectionEvent event) {
-        MapdustBug selectedBug = (MapdustBug) listBugs.getSelectedValue();
-        Main.pref.put("selectedBug.status", selectedBug.getStatus().getValue());
-        notifyObservers(selectedBug);
-        if (selectedBug.getStatus().getKey().equals(1)) {
-            /* status fixed */
-            btnPanel.getBtnAddComment().setEnabled(true);
-            btnPanel.getBtnReOpenBugReport().setEnabled(false);
-            btnPanel.getBtnInvalidateBugReport().setEnabled(true);
-            btnPanel.getBtnFixBugReport().setEnabled(true);
-            getMenuReopen().setEnabled(false);
-            getMenuInvalidate().setEnabled(true);
-            getMenuFixed().setEnabled(true);
-        }
-        if (selectedBug.getStatus().getKey().equals(2)) {
-            /* status fixed */
-            btnPanel.getBtnAddComment().setEnabled(true);
-            btnPanel.getBtnReOpenBugReport().setEnabled(true);
-            btnPanel.getBtnInvalidateBugReport().setEnabled(false);
-            btnPanel.getBtnFixBugReport().setEnabled(false);
-            getMenuReopen().setEnabled(true);
-            getMenuInvalidate().setEnabled(false);
-            getMenuFixed().setEnabled(false);
-        }
-        if (selectedBug.getStatus().getKey().equals(3)) {
-            /* status invalid */
-            btnPanel.getBtnAddComment().setEnabled(true);
-            btnPanel.getBtnReOpenBugReport().setEnabled(true);
-            btnPanel.getBtnInvalidateBugReport().setEnabled(false);
-            btnPanel.getBtnFixBugReport().setEnabled(false);
-            getMenuReopen().setEnabled(true);
-            getMenuInvalidate().setEnabled(false);
-            getMenuFixed().setEnabled(false);
-        }
-        /* re-paint */
-        Main.map.mapView.repaint();
-        mapdustGUI.repaint();
-    }
-
-    /**
-     * Returns the selected bug from the list of MapDust bugs.
-     *
-     * @return a <code>MapdustBug</code> object
-     */
-    public MapdustBug getSelectedBug() {
-        MapdustBug selectedBug=null;
-        if (getListBugs()!=null) {
-            selectedBug = (MapdustBug) getListBugs().getSelectedValue();
-        }
-        return selectedBug;
-    }
-
-    /**
-     * Returns the index of the selected MapDust bug.
-     *
-     * @return index
-     */
-    public int getSelectedIndex() {
-        return getListBugs().getSelectedIndex();
-    }
-
-    /**
-     * Sets the <code>MapdustBug</code> which will be selected from the list of
-     * MapDust bug.
-     *
-     * @param mapdustBug The <code>MapdustBug</code> object
-     */
-    public void setSelectedBug(MapdustBug mapdustBug) {
-        getListBugs().setSelectedValue(mapdustBug, false);
-        int index = getSelectedIndex();
-        getListBugs().ensureIndexIsVisible(index);
-    }
-
-    /**
-     * Returns the list of bugs
-     *
-     * @return the listBugs
-     */
-    public JList getListBugs() {
-        return listBugs;
-    }
-
-    /**
-     * Return the menu
-     *
-     * @return the menu
-     */
-    public JPopupMenu getMenu() {
-        return menu;
-    }
-
-    /**
-     * Returns the button panel
-     *
-     * @return the btnPanel
-     */
-    public MapdustButtonPanel getBtnPanel() {
-        return btnPanel;
-    }
-
-    /**
-     * Returns the 'add comment' menu item
-     *
-     * @return the menuAddComment
-     */
-    public JMenuItem getMenuAddComment() {
-        return menuAddComment;
-    }
-
-    /**
-     * Returns the 'fixed' menu item
-     *
-     * @return the menuFixed
-     */
-    public JMenuItem getMenuFixed() {
-        return menuFixed;
-    }
-
-    /**
-     * Returns the 'invalidate' menu item
-     *
-     * @return the menuInvalidate
-     */
-    public JMenuItem getMenuInvalidate() {
-        return menuInvalidate;
-    }
-
-    /**
-     * Returns the 're-open' menu item
-     *
-     * @return the menuReopen
-     */
-    public JMenuItem getMenuReopen() {
-        return menuReopen;
-    }
-
-    /**
-     * Returns the list of <code>MapdustBug</code> objects
-     *
-     * @return the mapdustBugsList
-     */
-    public List<MapdustBug> getMapdustBugsList() {
-        return mapdustBugsList;
-    }
-
-    /**
-     * Adds a new MapDust bug details observer to the list of observers.
-     *
-     * @param observer The <code>MapdustBugDetailsObserver</code> object
-     */
-    @Override
-    public void addObserver(MapdustBugDetailsObserver observer) {
-        if (!this.observers.contains(observer)) {
-            this.observers.add(observer);
-        }
-    }
-
-    /**
-     * Removes the given MapDust bug details observer from the list of
-     * observers.
-     *
-     * @param observer The <code>MapdustBugDetailsObserver</code> object
-     */
-    @Override
-    public void removeObserver(MapdustBugDetailsObserver observer) {
-        this.observers.remove(observer);
-
-    }
-
-    /**
-     * Notifies the MapDust bug details observers observing the given
-     * <code>MapdustBug</code> object.
-     *
-     * @param mapdustBug The <code>MapdustBug</code> object
-     */
-    @Override
-    public void notifyObservers(MapdustBug mapdustBug) {
-        Iterator<MapdustBugDetailsObserver> elements =
-                this.observers.iterator();
-        while (elements.hasNext()) {
-            (elements.next()).showDetails(mapdustBug);
-        }
-    }
-
-}
