Index: trunk/src/org/openstreetmap/josm/actions/mapmode/AddNoteAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/mapmode/AddNoteAction.java	(revision 7850)
+++ trunk/src/org/openstreetmap/josm/actions/mapmode/AddNoteAction.java	(revision 7852)
@@ -14,5 +14,5 @@
 import org.openstreetmap.josm.gui.NoteInputDialog;
 import org.openstreetmap.josm.gui.Notification;
-import org.openstreetmap.josm.gui.dialogs.NoteDialog;
+import org.openstreetmap.josm.gui.dialogs.NotesDialog;
 import org.openstreetmap.josm.tools.ImageProvider;
 
@@ -63,5 +63,5 @@
 
         NoteInputDialog dialog = new NoteInputDialog(Main.parent, tr("Create new note"), tr("Create note"));
-        dialog.showNoteDialog(tr("Enter a detailed comment to create a note"), NoteDialog.ICON_NEW);
+        dialog.showNoteDialog(tr("Enter a detailed comment to create a note"), NotesDialog.ICON_NEW);
 
         if (dialog.getValue() != 1) {
Index: trunk/src/org/openstreetmap/josm/gui/MapFrame.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/MapFrame.java	(revision 7850)
+++ trunk/src/org/openstreetmap/josm/gui/MapFrame.java	(revision 7852)
@@ -66,5 +66,5 @@
 import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
 import org.openstreetmap.josm.gui.dialogs.MapPaintDialog;
-import org.openstreetmap.josm.gui.dialogs.NoteDialog;
+import org.openstreetmap.josm.gui.dialogs.NotesDialog;
 import org.openstreetmap.josm.gui.dialogs.RelationListDialog;
 import org.openstreetmap.josm.gui.dialogs.SelectionListDialog;
@@ -133,5 +133,5 @@
     public SelectionListDialog selectionListDialog;
     public PropertiesDialog propertiesDialog;
-    public NoteDialog noteDialog;
+    public NotesDialog noteDialog;
 
     // Map modes
@@ -245,5 +245,5 @@
         //TODO: remove this if statement once note support is complete
         if(Main.pref.getBoolean("osm.notes.enableDownload", false)) {
-            addToggleDialog(noteDialog = new NoteDialog());
+            addToggleDialog(noteDialog = new NotesDialog());
         }
         toolBarToggle.setFloatable(false);
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/NoteDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/NoteDialog.java	(revision 7850)
+++ 	(revision )
@@ -1,386 +1,0 @@
-// License: GPL. For details, see LICENSE file.
-package org.openstreetmap.josm.gui.dialogs;
-
-import static org.openstreetmap.josm.tools.I18n.tr;
-
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.Image;
-import java.awt.event.ActionEvent;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.AbstractListModel;
-import javax.swing.DefaultListCellRenderer;
-import javax.swing.ImageIcon;
-import javax.swing.JLabel;
-import javax.swing.JList;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.ListCellRenderer;
-import javax.swing.ListSelectionModel;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-
-import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.actions.UploadNotesAction;
-import org.openstreetmap.josm.actions.mapmode.AddNoteAction;
-import org.openstreetmap.josm.data.notes.Note;
-import org.openstreetmap.josm.data.notes.Note.State;
-import org.openstreetmap.josm.data.osm.NoteData;
-import org.openstreetmap.josm.gui.MapView;
-import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
-import org.openstreetmap.josm.gui.NoteInputDialog;
-import org.openstreetmap.josm.gui.NoteSortDialog;
-import org.openstreetmap.josm.gui.SideButton;
-import org.openstreetmap.josm.gui.layer.Layer;
-import org.openstreetmap.josm.gui.layer.NoteLayer;
-import org.openstreetmap.josm.tools.ImageProvider;
-
-/**
- * Dialog to display and manipulate notes
- */
-public class NoteDialog extends ToggleDialog implements LayerChangeListener {
-
-
-    /** Small icon size for use in graphics calculations */
-    public static final int ICON_SMALL_SIZE = 16;
-    /** Large icon size for use in graphics calculations */
-    public static final int ICON_LARGE_SIZE = 24;
-    /** 24x24 icon for unresolved notes */
-    public static final ImageIcon ICON_OPEN = ImageProvider.get("dialogs/notes", "note_open.png");
-    /** 16x16 icon for unresolved notes */
-    public static final ImageIcon ICON_OPEN_SMALL =
-            new ImageIcon(ICON_OPEN.getImage().getScaledInstance(ICON_SMALL_SIZE, ICON_SMALL_SIZE, Image.SCALE_SMOOTH));
-    /** 24x24 icon for resolved notes */
-    public static final ImageIcon ICON_CLOSED = ImageProvider.get("dialogs/notes", "note_closed.png");
-    /** 16x16 icon for resolved notes */
-    public static final ImageIcon ICON_CLOSED_SMALL =
-            new ImageIcon(ICON_CLOSED.getImage().getScaledInstance(ICON_SMALL_SIZE, ICON_SMALL_SIZE, Image.SCALE_SMOOTH));
-    /** 24x24 icon for new notes */
-    public static final ImageIcon ICON_NEW = ImageProvider.get("dialogs/notes", "note_new.png");
-    /** 16x16 icon for new notes */
-    public static final ImageIcon ICON_NEW_SMALL =
-            new ImageIcon(ICON_NEW.getImage().getScaledInstance(ICON_SMALL_SIZE, ICON_SMALL_SIZE, Image.SCALE_SMOOTH));
-    /** Icon for note comments */
-    public static final ImageIcon ICON_COMMENT = ImageProvider.get("dialogs/notes", "note_comment.png");
-
-    private NoteTableModel model;
-    private JList<Note> displayList;
-    private final AddCommentAction addCommentAction;
-    private final CloseAction closeAction;
-    private final NewAction newAction;
-    private final ReopenAction reopenAction;
-    private final SortAction sortAction;
-    private final UploadNotesAction uploadAction;
-
-    private NoteData noteData;
-
-    /** Creates a new toggle dialog for notes */
-    public NoteDialog() {
-        super("Notes", "notes/note_open.png", "List of notes", null, 150);
-        if (Main.isDebugEnabled()) {
-            Main.debug("constructed note dialog");
-        }
-
-        addCommentAction = new AddCommentAction();
-        closeAction = new CloseAction();
-        newAction = new NewAction();
-        reopenAction = new ReopenAction();
-        sortAction = new SortAction();
-        uploadAction = new UploadNotesAction();
-        buildDialog();
-        MapView.addLayerChangeListener(this);
-    }
-
-    @Override
-    public void showDialog() {
-        super.showDialog();
-    }
-
-    private void buildDialog() {
-        model = new NoteTableModel();
-        displayList = new JList<Note>(model);
-        displayList.setCellRenderer(new NoteRenderer());
-        displayList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-        displayList.addListSelectionListener(new ListSelectionListener() {
-            @Override
-            public void valueChanged(ListSelectionEvent e) {
-                if (noteData != null) { //happens when layer is deleted while note selected
-                    noteData.setSelectedNote(displayList.getSelectedValue());
-                }
-                updateButtonStates();
-            }});
-
-        JPanel pane = new JPanel(new BorderLayout());
-        pane.add(new JScrollPane(displayList), BorderLayout.CENTER);
-
-        createLayout(pane, false, Arrays.asList(new SideButton[]{
-                new SideButton(newAction, false),
-                new SideButton(addCommentAction, false),
-                new SideButton(closeAction, false),
-                new SideButton(reopenAction, false),
-                new SideButton(sortAction, false),
-                new SideButton(uploadAction, false)}));
-        updateButtonStates();
-    }
-
-    private void updateButtonStates() {
-        if (noteData == null || noteData.getSelectedNote() == null) {
-            closeAction.setEnabled(false);
-            addCommentAction.setEnabled(false);
-            reopenAction.setEnabled(false);
-        } else if (noteData.getSelectedNote().getState() == State.open){
-            closeAction.setEnabled(true);
-            addCommentAction.setEnabled(true);
-            reopenAction.setEnabled(false);
-        } else { //note is closed
-            closeAction.setEnabled(false);
-            addCommentAction.setEnabled(false);
-            reopenAction.setEnabled(true);
-        }
-        if(noteData == null || !noteData.isModified()) {
-            uploadAction.setEnabled(false);
-        } else {
-            uploadAction.setEnabled(true);
-        }
-        //enable sort button if any notes are loaded
-        if (noteData == null || noteData.getNotes().isEmpty()) {
-            sortAction.setEnabled(false);
-        } else {
-            sortAction.setEnabled(true);
-        }
-    }
-
-    @Override
-    public void showNotify() { }
-
-    @Override
-    public void hideNotify() { }
-
-    @Override
-    public void activeLayerChange(Layer oldLayer, Layer newLayer) { }
-
-    @Override
-    public void layerAdded(Layer newLayer) {
-        if (newLayer instanceof NoteLayer) {
-            noteData = ((NoteLayer)newLayer).getNoteData();
-            model.setData(noteData.getNotes());
-            setNoteList(noteData.getNotes());
-        }
-    }
-
-    @Override
-    public void layerRemoved(Layer oldLayer) {
-        if (oldLayer instanceof NoteLayer) {
-            if (Main.isDebugEnabled()) {
-                Main.debug("note layer removed. Clearing everything");
-            }
-            noteData = null;
-            model.clearData();
-            if (Main.map.mapMode instanceof AddNoteAction) {
-                Main.map.selectMapMode(Main.map.mapModeSelect);
-            }
-        }
-    }
-
-    /**
-     * Sets the list of notes to be displayed in the dialog.
-     * The dialog should match the notes displayed in the note layer.
-     * @param noteList List of notes to display
-     */
-    public void setNoteList(List<Note> noteList) {
-        model.setData(noteList);
-        updateButtonStates();
-        this.repaint();
-    }
-
-    /**
-     * Notify the dialog that the note selection has changed.
-     * Causes it to update or clear its selection in the UI.
-     */
-    public void selectionChanged() {
-        if (noteData == null || noteData.getSelectedNote() == null) {
-            displayList.clearSelection();
-        } else {
-            displayList.setSelectedValue(noteData.getSelectedNote(), true);
-        }
-        updateButtonStates();
-    }
-
-    private class NoteRenderer implements ListCellRenderer<Note> {
-
-        private DefaultListCellRenderer defaultListCellRenderer = new DefaultListCellRenderer();
-        private final SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy kk:mm");
-
-        @Override
-        public Component getListCellRendererComponent(JList<? extends Note> list, Note note, int index,
-                boolean isSelected, boolean cellHasFocus) {
-            Component comp = defaultListCellRenderer.getListCellRendererComponent(list, note, index, isSelected, cellHasFocus);
-            if (note != null && comp instanceof JLabel) {
-                String text = note.getFirstComment().getText();
-                String userName = note.getFirstComment().getUser().getName();
-                if (userName == null || userName.isEmpty()) {
-                    userName = "<Anonymous>";
-                }
-                String toolTipText = userName + " @ " + sdf.format(note.getCreatedAt());
-                JLabel jlabel = (JLabel)comp;
-                jlabel.setText(text);
-                ImageIcon icon;
-                if (note.getId() < 0) {
-                    icon = ICON_NEW_SMALL;
-                } else if (note.getState() == State.closed) {
-                    icon = ICON_CLOSED_SMALL;
-                } else {
-                    icon = ICON_OPEN_SMALL;
-                }
-                jlabel.setIcon(icon);
-                jlabel.setToolTipText(toolTipText);
-            }
-            return comp;
-        }
-    }
-
-    class NoteTableModel extends AbstractListModel<Note> {
-        private List<Note> data;
-
-        public NoteTableModel() {
-            data = new ArrayList<Note>();
-        }
-
-        @Override
-        public int getSize() {
-            if (data == null) {
-                return 0;
-            }
-            return data.size();
-        }
-
-        @Override
-        public Note getElementAt(int index) {
-            return data.get(index);
-        }
-
-        public void setData(List<Note> noteList) {
-            data.clear();
-            data.addAll(noteList);
-            fireContentsChanged(this, 0, noteList.size());
-        }
-
-        public void clearData() {
-            displayList.clearSelection();
-            data.clear();
-            fireIntervalRemoved(this, 0, getSize());
-        }
-    }
-
-    class AddCommentAction extends AbstractAction {
-
-        public AddCommentAction() {
-            putValue(SHORT_DESCRIPTION,tr("Add comment"));
-            putValue(NAME, tr("Comment"));
-            putValue(SMALL_ICON, ICON_COMMENT);
-        }
-
-        @Override
-        public void actionPerformed(ActionEvent e) {
-            Note note = displayList.getSelectedValue();
-            if (note == null) {
-                JOptionPane.showMessageDialog(Main.map,
-                        "You must select a note first",
-                        "No note selected",
-                        JOptionPane.ERROR_MESSAGE);
-                return;
-            }
-            NoteInputDialog dialog = new NoteInputDialog(Main.parent, tr("Comment on note"), tr("Add comment"));
-            dialog.showNoteDialog(tr("Add comment to note:"), NoteDialog.ICON_COMMENT);
-            if (dialog.getValue() != 1) {
-                Main.debug("User aborted note reopening");
-                return;
-            }
-            noteData.addCommentToNote(note, dialog.getInputText());
-        }
-    }
-
-    class CloseAction extends AbstractAction {
-
-        public CloseAction() {
-            putValue(SHORT_DESCRIPTION,tr("Close note"));
-            putValue(NAME, tr("Close"));
-            putValue(SMALL_ICON, ICON_CLOSED);
-        }
-
-        @Override
-        public void actionPerformed(ActionEvent e) {
-            NoteInputDialog dialog = new NoteInputDialog(Main.parent, tr("Close note"), tr("Close note"));
-            dialog.showNoteDialog(tr("Close note with message:"), NoteDialog.ICON_CLOSED);
-            if (dialog.getValue() != 1) {
-                Main.debug("User aborted note closing");
-                return;
-            }
-            Note note = displayList.getSelectedValue();
-            noteData.closeNote(note, dialog.getInputText());
-        }
-    }
-
-    class NewAction extends AbstractAction {
-
-        public NewAction() {
-            putValue(SHORT_DESCRIPTION,tr("Create a new note"));
-            putValue(NAME, tr("Create"));
-            putValue(SMALL_ICON, ICON_NEW);
-        }
-
-        @Override
-        public void actionPerformed(ActionEvent e) {
-            if (noteData == null) { //there is no notes layer. Create one first
-                Main.map.mapView.addLayer(new NoteLayer());
-            }
-            Main.map.selectMapMode(new AddNoteAction(Main.map, noteData));
-        }
-    }
-
-    class ReopenAction extends AbstractAction {
-
-        public ReopenAction() {
-            putValue(SHORT_DESCRIPTION,tr("Reopen note"));
-            putValue(NAME, tr("Reopen"));
-            putValue(SMALL_ICON, ICON_OPEN);
-        }
-
-        @Override
-        public void actionPerformed(ActionEvent e) {
-            NoteInputDialog dialog = new NoteInputDialog(Main.parent, tr("Reopen note"), tr("Reopen note"));
-            dialog.showNoteDialog(tr("Reopen note with message:"), NoteDialog.ICON_OPEN);
-            if (dialog.getValue() != 1) {
-                Main.debug("User aborted note reopening");
-                return;
-            }
-
-            Note note = displayList.getSelectedValue();
-            noteData.reOpenNote(note, dialog.getInputText());
-        }
-    }
-
-    class SortAction extends AbstractAction {
-
-        public SortAction() {
-            putValue(SHORT_DESCRIPTION, tr("Sort notes"));
-            putValue(NAME, tr("Sort"));
-            putValue(SMALL_ICON, ImageProvider.get("dialogs", "sort"));
-        }
-
-        @Override
-        public void actionPerformed(ActionEvent e) {
-            NoteSortDialog sortDialog = new NoteSortDialog(Main.parent, tr("Sort notes"), tr("Apply"));
-            sortDialog.showSortDialog(noteData.getCurrentSortMethod());
-            if (sortDialog.getValue() == 1) {
-                noteData.setSortMethod(sortDialog.getSelectedComparator());
-            }
-        }
-    }
-}
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/NotesDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/NotesDialog.java	(revision 7852)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/NotesDialog.java	(revision 7852)
@@ -0,0 +1,383 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.gui.dialogs;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Image;
+import java.awt.event.ActionEvent;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.AbstractListModel;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.ImageIcon;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.ListCellRenderer;
+import javax.swing.ListSelectionModel;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.actions.UploadNotesAction;
+import org.openstreetmap.josm.actions.mapmode.AddNoteAction;
+import org.openstreetmap.josm.data.notes.Note;
+import org.openstreetmap.josm.data.notes.Note.State;
+import org.openstreetmap.josm.data.osm.NoteData;
+import org.openstreetmap.josm.gui.MapView;
+import org.openstreetmap.josm.gui.MapView.LayerChangeListener;
+import org.openstreetmap.josm.gui.NoteInputDialog;
+import org.openstreetmap.josm.gui.NoteSortDialog;
+import org.openstreetmap.josm.gui.SideButton;
+import org.openstreetmap.josm.gui.layer.Layer;
+import org.openstreetmap.josm.gui.layer.NoteLayer;
+import org.openstreetmap.josm.tools.ImageProvider;
+
+/**
+ * Dialog to display and manipulate notes.
+ * @since 7852 (renaming)
+ * @since 7608 (creation)
+ */
+public class NotesDialog extends ToggleDialog implements LayerChangeListener {
+
+    /** Small icon size for use in graphics calculations */
+    public static final int ICON_SMALL_SIZE = 16;
+    /** Large icon size for use in graphics calculations */
+    public static final int ICON_LARGE_SIZE = 24;
+    /** 24x24 icon for unresolved notes */
+    public static final ImageIcon ICON_OPEN = ImageProvider.get("dialogs/notes", "note_open.png");
+    /** 16x16 icon for unresolved notes */
+    public static final ImageIcon ICON_OPEN_SMALL =
+            new ImageIcon(ICON_OPEN.getImage().getScaledInstance(ICON_SMALL_SIZE, ICON_SMALL_SIZE, Image.SCALE_SMOOTH));
+    /** 24x24 icon for resolved notes */
+    public static final ImageIcon ICON_CLOSED = ImageProvider.get("dialogs/notes", "note_closed.png");
+    /** 16x16 icon for resolved notes */
+    public static final ImageIcon ICON_CLOSED_SMALL =
+            new ImageIcon(ICON_CLOSED.getImage().getScaledInstance(ICON_SMALL_SIZE, ICON_SMALL_SIZE, Image.SCALE_SMOOTH));
+    /** 24x24 icon for new notes */
+    public static final ImageIcon ICON_NEW = ImageProvider.get("dialogs/notes", "note_new.png");
+    /** 16x16 icon for new notes */
+    public static final ImageIcon ICON_NEW_SMALL =
+            new ImageIcon(ICON_NEW.getImage().getScaledInstance(ICON_SMALL_SIZE, ICON_SMALL_SIZE, Image.SCALE_SMOOTH));
+    /** Icon for note comments */
+    public static final ImageIcon ICON_COMMENT = ImageProvider.get("dialogs/notes", "note_comment.png");
+
+    private NoteTableModel model;
+    private JList<Note> displayList;
+    private final AddCommentAction addCommentAction;
+    private final CloseAction closeAction;
+    private final NewAction newAction;
+    private final ReopenAction reopenAction;
+    private final SortAction sortAction;
+    private final UploadNotesAction uploadAction;
+
+    private NoteData noteData;
+
+    /** Creates a new toggle dialog for notes */
+    public NotesDialog() {
+        super("Notes", "notes/note_open.png", "List of notes", null, 150);
+        addCommentAction = new AddCommentAction();
+        closeAction = new CloseAction();
+        newAction = new NewAction();
+        reopenAction = new ReopenAction();
+        sortAction = new SortAction();
+        uploadAction = new UploadNotesAction();
+        buildDialog();
+        MapView.addLayerChangeListener(this);
+    }
+
+    @Override
+    public void showDialog() {
+        super.showDialog();
+    }
+
+    private void buildDialog() {
+        model = new NoteTableModel();
+        displayList = new JList<Note>(model);
+        displayList.setCellRenderer(new NoteRenderer());
+        displayList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+        displayList.addListSelectionListener(new ListSelectionListener() {
+            @Override
+            public void valueChanged(ListSelectionEvent e) {
+                if (noteData != null) { //happens when layer is deleted while note selected
+                    noteData.setSelectedNote(displayList.getSelectedValue());
+                }
+                updateButtonStates();
+            }});
+
+        JPanel pane = new JPanel(new BorderLayout());
+        pane.add(new JScrollPane(displayList), BorderLayout.CENTER);
+
+        createLayout(pane, false, Arrays.asList(new SideButton[]{
+                new SideButton(newAction, false),
+                new SideButton(addCommentAction, false),
+                new SideButton(closeAction, false),
+                new SideButton(reopenAction, false),
+                new SideButton(sortAction, false),
+                new SideButton(uploadAction, false)}));
+        updateButtonStates();
+    }
+
+    private void updateButtonStates() {
+        if (noteData == null || noteData.getSelectedNote() == null) {
+            closeAction.setEnabled(false);
+            addCommentAction.setEnabled(false);
+            reopenAction.setEnabled(false);
+        } else if (noteData.getSelectedNote().getState() == State.open){
+            closeAction.setEnabled(true);
+            addCommentAction.setEnabled(true);
+            reopenAction.setEnabled(false);
+        } else { //note is closed
+            closeAction.setEnabled(false);
+            addCommentAction.setEnabled(false);
+            reopenAction.setEnabled(true);
+        }
+        if(noteData == null || !noteData.isModified()) {
+            uploadAction.setEnabled(false);
+        } else {
+            uploadAction.setEnabled(true);
+        }
+        //enable sort button if any notes are loaded
+        if (noteData == null || noteData.getNotes().isEmpty()) {
+            sortAction.setEnabled(false);
+        } else {
+            sortAction.setEnabled(true);
+        }
+    }
+
+    @Override
+    public void showNotify() { }
+
+    @Override
+    public void hideNotify() { }
+
+    @Override
+    public void activeLayerChange(Layer oldLayer, Layer newLayer) { }
+
+    @Override
+    public void layerAdded(Layer newLayer) {
+        if (newLayer instanceof NoteLayer) {
+            noteData = ((NoteLayer)newLayer).getNoteData();
+            model.setData(noteData.getNotes());
+            setNoteList(noteData.getNotes());
+        }
+    }
+
+    @Override
+    public void layerRemoved(Layer oldLayer) {
+        if (oldLayer instanceof NoteLayer) {
+            if (Main.isDebugEnabled()) {
+                Main.debug("note layer removed. Clearing everything");
+            }
+            noteData = null;
+            model.clearData();
+            if (Main.map.mapMode instanceof AddNoteAction) {
+                Main.map.selectMapMode(Main.map.mapModeSelect);
+            }
+        }
+    }
+
+    /**
+     * Sets the list of notes to be displayed in the dialog.
+     * The dialog should match the notes displayed in the note layer.
+     * @param noteList List of notes to display
+     */
+    public void setNoteList(List<Note> noteList) {
+        model.setData(noteList);
+        updateButtonStates();
+        this.repaint();
+    }
+
+    /**
+     * Notify the dialog that the note selection has changed.
+     * Causes it to update or clear its selection in the UI.
+     */
+    public void selectionChanged() {
+        if (noteData == null || noteData.getSelectedNote() == null) {
+            displayList.clearSelection();
+        } else {
+            displayList.setSelectedValue(noteData.getSelectedNote(), true);
+        }
+        updateButtonStates();
+    }
+
+    private class NoteRenderer implements ListCellRenderer<Note> {
+
+        private DefaultListCellRenderer defaultListCellRenderer = new DefaultListCellRenderer();
+        private final SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy kk:mm");
+
+        @Override
+        public Component getListCellRendererComponent(JList<? extends Note> list, Note note, int index,
+                boolean isSelected, boolean cellHasFocus) {
+            Component comp = defaultListCellRenderer.getListCellRendererComponent(list, note, index, isSelected, cellHasFocus);
+            if (note != null && comp instanceof JLabel) {
+                String text = note.getFirstComment().getText();
+                String userName = note.getFirstComment().getUser().getName();
+                if (userName == null || userName.isEmpty()) {
+                    userName = "<Anonymous>";
+                }
+                String toolTipText = userName + " @ " + sdf.format(note.getCreatedAt());
+                JLabel jlabel = (JLabel)comp;
+                jlabel.setText(text);
+                ImageIcon icon;
+                if (note.getId() < 0) {
+                    icon = ICON_NEW_SMALL;
+                } else if (note.getState() == State.closed) {
+                    icon = ICON_CLOSED_SMALL;
+                } else {
+                    icon = ICON_OPEN_SMALL;
+                }
+                jlabel.setIcon(icon);
+                jlabel.setToolTipText(toolTipText);
+            }
+            return comp;
+        }
+    }
+
+    class NoteTableModel extends AbstractListModel<Note> {
+        private List<Note> data;
+
+        public NoteTableModel() {
+            data = new ArrayList<Note>();
+        }
+
+        @Override
+        public int getSize() {
+            if (data == null) {
+                return 0;
+            }
+            return data.size();
+        }
+
+        @Override
+        public Note getElementAt(int index) {
+            return data.get(index);
+        }
+
+        public void setData(List<Note> noteList) {
+            data.clear();
+            data.addAll(noteList);
+            fireContentsChanged(this, 0, noteList.size());
+        }
+
+        public void clearData() {
+            displayList.clearSelection();
+            data.clear();
+            fireIntervalRemoved(this, 0, getSize());
+        }
+    }
+
+    class AddCommentAction extends AbstractAction {
+
+        public AddCommentAction() {
+            putValue(SHORT_DESCRIPTION,tr("Add comment"));
+            putValue(NAME, tr("Comment"));
+            putValue(SMALL_ICON, ICON_COMMENT);
+        }
+
+        @Override
+        public void actionPerformed(ActionEvent e) {
+            Note note = displayList.getSelectedValue();
+            if (note == null) {
+                JOptionPane.showMessageDialog(Main.map,
+                        "You must select a note first",
+                        "No note selected",
+                        JOptionPane.ERROR_MESSAGE);
+                return;
+            }
+            NoteInputDialog dialog = new NoteInputDialog(Main.parent, tr("Comment on note"), tr("Add comment"));
+            dialog.showNoteDialog(tr("Add comment to note:"), NotesDialog.ICON_COMMENT);
+            if (dialog.getValue() != 1) {
+                Main.debug("User aborted note reopening");
+                return;
+            }
+            noteData.addCommentToNote(note, dialog.getInputText());
+        }
+    }
+
+    class CloseAction extends AbstractAction {
+
+        public CloseAction() {
+            putValue(SHORT_DESCRIPTION,tr("Close note"));
+            putValue(NAME, tr("Close"));
+            putValue(SMALL_ICON, ICON_CLOSED);
+        }
+
+        @Override
+        public void actionPerformed(ActionEvent e) {
+            NoteInputDialog dialog = new NoteInputDialog(Main.parent, tr("Close note"), tr("Close note"));
+            dialog.showNoteDialog(tr("Close note with message:"), NotesDialog.ICON_CLOSED);
+            if (dialog.getValue() != 1) {
+                Main.debug("User aborted note closing");
+                return;
+            }
+            Note note = displayList.getSelectedValue();
+            noteData.closeNote(note, dialog.getInputText());
+        }
+    }
+
+    class NewAction extends AbstractAction {
+
+        public NewAction() {
+            putValue(SHORT_DESCRIPTION,tr("Create a new note"));
+            putValue(NAME, tr("Create"));
+            putValue(SMALL_ICON, ICON_NEW);
+        }
+
+        @Override
+        public void actionPerformed(ActionEvent e) {
+            if (noteData == null) { //there is no notes layer. Create one first
+                Main.map.mapView.addLayer(new NoteLayer());
+            }
+            Main.map.selectMapMode(new AddNoteAction(Main.map, noteData));
+        }
+    }
+
+    class ReopenAction extends AbstractAction {
+
+        public ReopenAction() {
+            putValue(SHORT_DESCRIPTION,tr("Reopen note"));
+            putValue(NAME, tr("Reopen"));
+            putValue(SMALL_ICON, ICON_OPEN);
+        }
+
+        @Override
+        public void actionPerformed(ActionEvent e) {
+            NoteInputDialog dialog = new NoteInputDialog(Main.parent, tr("Reopen note"), tr("Reopen note"));
+            dialog.showNoteDialog(tr("Reopen note with message:"), NotesDialog.ICON_OPEN);
+            if (dialog.getValue() != 1) {
+                Main.debug("User aborted note reopening");
+                return;
+            }
+
+            Note note = displayList.getSelectedValue();
+            noteData.reOpenNote(note, dialog.getInputText());
+        }
+    }
+
+    class SortAction extends AbstractAction {
+
+        public SortAction() {
+            putValue(SHORT_DESCRIPTION, tr("Sort notes"));
+            putValue(NAME, tr("Sort"));
+            putValue(SMALL_ICON, ImageProvider.get("dialogs", "sort"));
+        }
+
+        @Override
+        public void actionPerformed(ActionEvent e) {
+            NoteSortDialog sortDialog = new NoteSortDialog(Main.parent, tr("Sort notes"), tr("Apply"));
+            sortDialog.showSortDialog(noteData.getCurrentSortMethod());
+            if (sortDialog.getValue() == 1) {
+                noteData.setSortMethod(sortDialog.getSelectedComparator());
+            }
+        }
+    }
+}
Index: trunk/src/org/openstreetmap/josm/gui/layer/NoteLayer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/NoteLayer.java	(revision 7850)
+++ trunk/src/org/openstreetmap/josm/gui/layer/NoteLayer.java	(revision 7852)
@@ -30,5 +30,5 @@
 import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
 import org.openstreetmap.josm.gui.dialogs.LayerListPopup;
-import org.openstreetmap.josm.gui.dialogs.NoteDialog;
+import org.openstreetmap.josm.gui.dialogs.NotesDialog;
 import org.openstreetmap.josm.io.NoteExporter;
 import org.openstreetmap.josm.io.XmlWriter;
@@ -99,9 +99,9 @@
             ImageIcon icon = null;
             if (note.getId() < 0) {
-                icon = NoteDialog.ICON_NEW_SMALL;
+                icon = NotesDialog.ICON_NEW_SMALL;
             } else if (note.getState() == State.closed) {
-                icon = NoteDialog.ICON_CLOSED_SMALL;
+                icon = NotesDialog.ICON_CLOSED_SMALL;
             } else {
-                icon = NoteDialog.ICON_OPEN_SMALL;
+                icon = NotesDialog.ICON_OPEN_SMALL;
             }
             int width = icon.getIconWidth();
@@ -139,8 +139,8 @@
 
             g.setColor(ColorHelper.html2color(Main.pref.get("color.selected")));
-            g.drawRect(p.x - (NoteDialog.ICON_SMALL_SIZE / 2), p.y - NoteDialog.ICON_SMALL_SIZE, NoteDialog.ICON_SMALL_SIZE - 1, NoteDialog.ICON_SMALL_SIZE - 1);
-
-            int tx = p.x + (NoteDialog.ICON_SMALL_SIZE / 2) + 5;
-            int ty = p.y - NoteDialog.ICON_SMALL_SIZE - 1;
+            g.drawRect(p.x - (NotesDialog.ICON_SMALL_SIZE / 2), p.y - NotesDialog.ICON_SMALL_SIZE, NotesDialog.ICON_SMALL_SIZE - 1, NotesDialog.ICON_SMALL_SIZE - 1);
+
+            int tx = p.x + (NotesDialog.ICON_SMALL_SIZE / 2) + 5;
+            int ty = p.y - NotesDialog.ICON_SMALL_SIZE - 1;
             g.translate(tx, ty);
 
@@ -159,5 +159,5 @@
     @Override
     public Icon getIcon() {
-        return NoteDialog.ICON_OPEN_SMALL;
+        return NotesDialog.ICON_OPEN_SMALL;
     }
 
@@ -219,5 +219,5 @@
             Point notePoint = Main.map.mapView.getPoint(note.getLatLon());
             //move the note point to the center of the icon where users are most likely to click when selecting
-            notePoint.setLocation(notePoint.getX(), notePoint.getY() - NoteDialog.ICON_SMALL_SIZE / 2);
+            notePoint.setLocation(notePoint.getX(), notePoint.getY() - NotesDialog.ICON_SMALL_SIZE / 2);
             double dist = clickPoint.distanceSq(notePoint);
             if (minDistance > dist && clickPoint.distance(notePoint) < snapDistance ) {
