Changeset 35160 in osm for applications
- Timestamp:
- 2019-09-29T22:03:18+02:00 (5 years ago)
- Location:
- applications/editors/josm/plugins/geochat/src/geochat
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/geochat/src/geochat/ChatPaneManager.java
r34512 r35160 102 102 final String nline = line.startsWith("\n") ? line : "\n" + line; 103 103 final JTextPane thepane = chatPanes.get(userName).pane; 104 GuiHelper.runInEDT(new Runnable() { 105 @Override 106 public void run() { 107 Document doc = thepane.getDocument(); 108 try { 109 SimpleAttributeSet attrs = null; 110 if (messageType != MESSAGE_TYPE_DEFAULT) { 111 attrs = new SimpleAttributeSet(); 112 if (messageType == MESSAGE_TYPE_INFORMATION) 113 StyleConstants.setItalic(attrs, true); 114 else if (messageType == MESSAGE_TYPE_ATTENTION) 115 StyleConstants.setForeground(attrs, COLOR_ATTENTION); 116 } 117 doc.insertString(doc.getLength(), nline, attrs); 118 } catch (BadLocationException ex) { 119 Logging.warn(ex); 104 GuiHelper.runInEDT(() -> { 105 Document doc = thepane.getDocument(); 106 try { 107 SimpleAttributeSet attrs = null; 108 if (messageType != MESSAGE_TYPE_DEFAULT) { 109 attrs = new SimpleAttributeSet(); 110 if (messageType == MESSAGE_TYPE_INFORMATION) 111 StyleConstants.setItalic(attrs, true); 112 else if (messageType == MESSAGE_TYPE_ATTENTION) 113 StyleConstants.setForeground(attrs, COLOR_ATTENTION); 120 114 } 121 thepane.setCaretPosition(doc.getLength()); 115 doc.insertString(doc.getLength(), nline, attrs); 116 } catch (BadLocationException ex) { 117 Logging.warn(ex); 122 118 } 119 thepane.setCaretPosition(doc.getLength()); 123 120 }); 124 121 } -
applications/editors/josm/plugins/geochat/src/geochat/ChatServerConnection.java
r34512 r35160 116 116 return; 117 117 } 118 new Thread(new Runnable() { 119 @Override 120 public void run() { 121 try { 122 int cnt = 10; 123 while (getPosition() == null && cnt-- > 0) { 124 Thread.sleep(200); 125 } 126 } catch (InterruptedException e) { 127 Logging.warn(e); 128 } 129 autoLogin(userName); 130 } 118 new Thread(() -> { 119 try { 120 int cnt = 10; 121 while (getPosition() == null && cnt-- > 0) { 122 Thread.sleep(200); 123 } 124 } catch (InterruptedException e) { 125 Logging.warn(e); 126 } 127 autoLogin(userName); 131 128 }).start(); 132 129 } -
applications/editors/josm/plugins/geochat/src/geochat/GeoChatPanel.java
r34512 r35160 235 235 title = title + " (" + comment + ")"; 236 236 final String alarm = (alarmLevel <= 0 ? "" : alarmLevel == 1 ? "* " : "!!! ") + title; 237 GuiHelper.runInEDT(new Runnable() { 238 @Override 239 public void run() { 240 setTitle(alarm); 241 } 242 }); 237 GuiHelper.runInEDT(() -> setTitle(alarm)); 243 238 } 244 239 … … 259 254 Config.getPref().put("geochat.username", userName); 260 255 if (gcPanel.getComponentCount() == 1) { 261 GuiHelper.runInEDTAndWait(new Runnable() { 262 @Override 263 public void run() { 264 gcPanel.remove(0); 265 gcPanel.add(tabs, BorderLayout.CENTER); 266 gcPanel.add(input, BorderLayout.SOUTH); 267 } 256 GuiHelper.runInEDTAndWait(() -> { 257 gcPanel.remove(0); 258 gcPanel.add(tabs, BorderLayout.CENTER); 259 gcPanel.add(input, BorderLayout.SOUTH); 268 260 }); 269 261 } … … 274 266 public void notLoggedIn(final String reason) { 275 267 if (reason != null) { 276 GuiHelper.runInEDT(new Runnable() { 277 @Override 278 public void run() { 279 new Notification(tr("Failed to log in to GeoChat:") + "\n" + reason).show(); 280 } 281 }); 268 GuiHelper.runInEDT(() -> new Notification(tr("Failed to log in to GeoChat:") + '\n' + reason).show()); 282 269 } else { 283 270 // regular logout … … 292 279 @Override 293 280 public void messageSendFailed(final String reason) { 294 GuiHelper.runInEDT(new Runnable() { 295 @Override 296 public void run() { 297 new Notification(tr("Failed to send message:") + "\n" + reason).show(); 298 } 299 }); 281 GuiHelper.runInEDT(() -> new Notification(tr("Failed to send message:") + '\n' + reason).show()); 300 282 } 301 283 -
applications/editors/josm/plugins/geochat/src/geochat/JsonQueryUtil.java
r34512 r35160 90 90 public void run() { 91 91 if (EventQueue.isDispatchThread()) { 92 new Thread(new Runnable() { 93 @Override 94 public void run() { 95 doRealRun(); 96 } 97 }).start(); 92 new Thread(this::doRealRun).start(); 98 93 } else { 99 94 doRealRun();
Note:
See TracChangeset
for help on using the changeset viewer.