Skip to content

Commit

Permalink
Minor simplifications and doc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gabortim committed Dec 9, 2023
1 parent 79bebe4 commit 6f71082
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ protected boolean isResponseLoadable(Map<String, List<String>> headers, int stat

private boolean isNotImage(Map<String, List<String>> headers, int statusCode) {
if (statusCode == 200 && headers.containsKey("Content-Type") && !headers.get("Content-Type").isEmpty()) {
String contentType = headers.get("Content-Type").stream().findAny().get();
String contentType = headers.get("Content-Type").stream().findAny().orElse(null);
if (contentType != null && !contentType.startsWith("image") && !MVTFile.MIMETYPE.contains(contentType.toLowerCase(Locale.ROOT))) {
Logging.warn("Image not returned for tile: " + url + " content type was: " + contentType);
// not an image - do not store response in cache, so next time it will be queried again from the server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public PropertiesDialog() {
setupBlankSpaceMenu();
setupKeyboardShortcuts();

// Let the actions know when selection in the tables change
// Let the actions know when selection in the tables changes
tagTable.getSelectionModel().addListSelectionListener(editAction);
membershipTable.getSelectionModel().addListSelectionListener(editAction);
tagTable.getSelectionModel().addListSelectionListener(deleteAction);
Expand Down
18 changes: 10 additions & 8 deletions src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

/**
* This is the model used by the history browser.
*
* <p>
* The model state consists of the following elements:
* <ul>
* <li>the {@link History} of a specific {@link OsmPrimitive}</li>
Expand All @@ -58,7 +58,7 @@
* </ul>
* {@link HistoryBrowser} always compares the {@link PointInTimeType#REFERENCE_POINT_IN_TIME} with the
* {@link PointInTimeType#CURRENT_POINT_IN_TIME}.
* <p>
* This model provides various {@link TableModel}s for {@link JTable}s used in {@link HistoryBrowser}, for
* instance:
* <ul>
Expand Down Expand Up @@ -174,10 +174,13 @@ private boolean canShowAsLatest(OsmPrimitive primitive) {
public void setHistory(History history) {
boolean samePrimitive = isSamePrimitive(history); // needs to be before `this.history = history`
this.history = history;
if (samePrimitive && history.getNumVersions() > 0) {
reference = history.getByVersion(reference.getVersion());
current = history.getByVersion(current.getVersion());
} else if (history.getNumVersions() > 0) {

if (!history.isEmpty()) {
if (samePrimitive) {
reference = history.getByVersion(reference.getVersion());
current = history.getByVersion(current.getVersion());
}

HistoryOsmPrimitive newLatest = null;
DataSet ds = MainApplication.getLayerManager().getActiveDataSet();
if (ds != null) {
Expand All @@ -195,8 +198,7 @@ public void setHistory(History history) {
current = newLatest;
}
setLatest(newLatest);
}
if (!history.isEmpty()) {

this.dateScale.setRange(
history.getEarliest().getInstant().toEpochMilli(),
history.getLatest().getInstant().toEpochMilli());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public abstract class KeyedItem extends TextItem {
public String key; // NOSONAR
/**
* Allows to change the matching process, i.e., determining whether the tags of an OSM object fit into this preset.
* If a preset fits then it is linked in the Tags/Membership dialog.<ul>
* If a preset fits then it is linked in the Tags/Memberships dialog.<ul>
* <li>none: neutral, i.e., do not consider this item for matching</li>
* <li>key: positive if key matches, neutral otherwise</li>
* <li>key!: positive if key matches, negative otherwise</li>
Expand Down

0 comments on commit 6f71082

Please sign in to comment.