Changeset 35162 in osm
- Timestamp:
- 2019-09-29T23:01:11+02:00 (5 years ago)
- Location:
- applications/editors/josm/plugins/geochat
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/geochat/.settings/org.eclipse.jdt.core.prefs
r32699 r35162 9 9 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 10 10 org.eclipse.jdt.core.compiler.compliance=1.8 11 org.eclipse.jdt.core.compiler.doc.comment.support=enabled 11 12 org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning 12 13 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error … … 32 33 org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning 33 34 org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore 35 org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning 36 org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled 37 org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled 38 org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled 39 org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected 34 40 org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore 35 41 org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning … … 38 44 org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled 39 45 org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore 46 org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore 47 org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled 48 org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public 49 org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags 50 org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning 51 org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled 52 org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled 53 org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected 40 54 org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore 41 55 org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -
applications/editors/josm/plugins/geochat/build.xml
r34512 r35162 5 5 <property name="commit.message" value="[josm_geochat] copypaste from keyboard, font size advanced parameters"/> 6 6 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 7 <property name="plugin.main.version" value="1 4153"/>7 <property name="plugin.main.version" value="15389"/> 8 8 9 9 <property name="plugin.author" value="Ilya Zverev"/> -
applications/editors/josm/plugins/geochat/src/geochat/ChatMessage.java
r35161 r35162 11 11 * @author zverik 12 12 */ 13 public class ChatMessage implements Comparable<ChatMessage> { 13 public final class ChatMessage implements Comparable<ChatMessage> { 14 14 private LatLon pos; 15 15 private Date time; … … 46 46 /** 47 47 * Is only set when the message is not incoming, that is, author is the current user. 48 * @return recipient 48 49 */ 49 50 public String getRecipient() { -
applications/editors/josm/plugins/geochat/src/geochat/ChatPaneManager.java
r35161 r35162 80 80 int idx = tabs.indexOfComponent(entry.component); 81 81 if (idx >= 0) 82 ((ChatTabTitleComponent) tabs.getTabComponentAt(idx)).updateAlarm(); 82 GuiHelper.runInEDT(() -> ((ChatTabTitleComponent) tabs.getTabComponentAt(idx)).updateAlarm()); 83 83 } 84 84 … … 171 171 * Returns key in chatPanes hash map for the currently active 172 172 * chat pane, or null in case of an error. 173 * @return key in chatPanes hash map for the currently active chat pane 173 174 */ 174 175 public String getActiveChatPane() { -
applications/editors/josm/plugins/geochat/src/geochat/ChatServerConnection.java
r35161 r35162 87 87 * Test that userId is still active, if not, tries to login with given user name. 88 88 * Does not autologin, if userName is null, obviously. 89 * @param userName user name 89 90 */ 90 91 public void autoLogin(final String userName) { … … 107 108 * Waits until {@link #getPosition()} is not null, then calls {@link #autoLogin(java.lang.String)}. 108 109 * If two seconds have passed, stops the waiting. Doesn't wait if userName is empty. 110 * @param userName user name 109 111 */ 110 112 public void autoLoginWithDelay(final String userName) { … … 203 205 * Unregister the current user and do not call listeners. 204 206 * Makes synchronous request to the server. 207 * @throws IOException There was a problem connecting to the server or parsing JSON. 205 208 */ 206 209 public void bruteLogout() throws IOException { … … 260 263 /** 261 264 * Returns current coordinates or null if there is no map, or zoom is too low. 265 * @return current coordinates or null 262 266 */ 263 267 private static LatLon getPosition() { … … 360 364 JsonObject json; 361 365 try { 362 json = JsonQueryUtil.query(query); 366 json = JsonQueryUtil.query(query, true); 363 367 } catch (IOException ex) { 364 368 json = null; // ? -
applications/editors/josm/plugins/geochat/src/geochat/JsonQueryUtil.java
r35160 r35162 5 5 import java.io.IOException; 6 6 import java.io.InputStream; 7 import java.net.HttpURLConnection;8 import java.net.MalformedURLException;9 7 import java.net.URL; 10 8 … … 15 13 import org.openstreetmap.josm.gui.MainApplication; 16 14 import org.openstreetmap.josm.spi.preferences.Config; 15 import org.openstreetmap.josm.tools.HttpClient; 16 import org.openstreetmap.josm.tools.HttpClient.Response; 17 17 import org.openstreetmap.josm.tools.Logging; 18 18 … … 26 26 /** 27 27 * Query the server synchronously. 28 * @param query Query string, starting with action. Example: <tt>get& lat=1.0&lon=-2.0&uid=12345</tt>28 * @param query Query string, starting with action. Example: <tt>get&lat=1.0&lon=-2.0&uid=12345</tt> 29 29 * @return Parsed JsonObject if the query was successful, <tt>null</tt> otherwise. 30 30 * @throws IOException There was a problem connecting to the server or parsing JSON. 31 31 */ 32 32 public static JsonObject query(String query) throws IOException { 33 return query(query, false); 34 } 35 36 /** 37 * Query the server synchronously. 38 * @param query Query string, starting with action. Example: <tt>get&lat=1.0&lon=-2.0&uid=12345</tt> 39 * @param logAtDebug {@code true} to set http client connection log at DEBUG level instead of default INFO level 40 * @return Parsed JsonObject if the query was successful, <tt>null</tt> otherwise. 41 * @throws IOException There was a problem connecting to the server or parsing JSON. 42 */ 43 public static JsonObject query(String query, boolean logAtDebug) throws IOException { 44 String serverURL = Config.getPref().get("geochat.server", "https://zverik.dev.openstreetmap.org/osmochat.php?action="); 45 URL url = new URL(serverURL + query); 46 Response connection = HttpClient.create(url).setLogAtDebug(logAtDebug).connect(); 47 if (connection.getResponseCode() != 200) { 48 throw new IOException("HTTP Response code " + connection.getResponseCode() + " (" + connection.getResponseMessage() + ")"); 49 } 50 InputStream inp = connection.getContent(); 51 if (inp == null) 52 throw new IOException("Empty response"); 33 53 try { 34 String serverURL = Config.getPref().get("geochat.server", "https://zverik.dev.openstreetmap.org/osmochat.php?action="); 35 URL url = new URL(serverURL + query); 36 HttpURLConnection connection = (HttpURLConnection) url.openConnection(); 37 connection.connect(); 38 if (connection.getResponseCode() != 200) { 39 throw new IOException("HTTP Response code " + connection.getResponseCode() + " (" + connection.getResponseMessage() + ")"); 40 } 41 InputStream inp = connection.getInputStream(); 42 if (inp == null) 43 throw new IOException("Empty response"); 44 try { 45 return Json.createReader(inp).readObject(); 46 } catch (JsonException e) { 47 throw new IOException("Failed to parse JSON: " + e.getMessage()); 48 } finally { 49 connection.disconnect(); 50 } 51 } catch (MalformedURLException ex) { 52 throw new IOException("Malformed URL: " + ex.getMessage()); 54 return Json.createReader(inp).readObject(); 55 } catch (JsonException e) { 56 throw new IOException("Failed to parse JSON: " + e.getMessage(), e); 57 } finally { 58 connection.disconnect(); 53 59 } 54 60 }
Note:
See TracChangeset
for help on using the changeset viewer.