File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
notesolver/src/main/java/org/openstreetmap/josm/plugins/notesolver Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -405,7 +405,7 @@ private List<JMenuItem> mainMenuEntries(Enum<menuTypes> menuType) {
405405 returnList .add (
406406 createMenuItem (
407407 NoteText .noteShortText (note ),
408- note .getFirstComment (). toString (),
408+ ( note .getFirstComment () != null ? note . getFirstComment (). toString () : "" ),
409409 new ActionListener () {
410410 @ Override
411411 public void actionPerformed (ActionEvent ev ) {
Original file line number Diff line number Diff line change 11package org .openstreetmap .josm .plugins .notesolver ;
22
3+ import org .openstreetmap .josm .tools .I18n ;
34import org .openstreetmap .josm .data .notes .*;
45
56public class NoteText {
67 private static int maxMenuItemLen = 50 ;
78 public static String noteShortText (Note n ) {
8- String firstComment = n .getFirstComment ().toString ();
9- if (firstComment .length () > maxMenuItemLen ) firstComment = firstComment .substring (0 , maxMenuItemLen ) + "..." ;
9+ String firstComment = "" ;
10+ String firstUser = "" ;
11+ if (n .getFirstComment () != null ) {
12+ firstUser = n .getFirstComment ().getUser ().getName ().toString ();
13+ firstComment = n .getFirstComment ().toString ();
14+ if (firstComment .length () > maxMenuItemLen ) firstComment = firstComment .substring (0 , maxMenuItemLen ) + "..." ;
15+ } else {
16+ firstUser = I18n .tr ("Deleted user" );
17+ firstComment = I18n .tr ("Deleted comment" );
18+ }
1019 String menuItemText =
1120 "* " + Long .toString (n .getId ()) + " " +
12- "[" + n . getFirstComment (). getUser (). getName (). toString () +
21+ "[" + firstUser +
1322 ": " + firstComment +
1423 "]" ;
1524 return menuItemText ;
You can’t perform that action at this time.
0 commit comments