()
| 1205 | boolean pinned = false; |
| 1206 | |
| 1207 | protected boolean update() { |
| 1208 | |
| 1209 | if (selectionHasChanged && !pinned) { |
| 1210 | |
| 1211 | selectionHasChanged = false; |
| 1212 | lastCh = completionHelp.get(); |
| 1213 | |
| 1214 | Set<Box> selection = this.breadthFirst(both()) |
| 1215 | .filter(x -> x.properties.isTrue(Mouse.isSelected, false)) |
| 1216 | .filter(x -> !(x instanceof TextEditor)) |
| 1217 | .collect(Collectors.toSet()); |
| 1218 | |
| 1219 | if (selection.size() != 1) { |
| 1220 | changeSelection(null, currentlyEditing); |
| 1221 | } else { |
| 1222 | Box target = selection.iterator() |
| 1223 | .next(); |
| 1224 | |
| 1225 | Dict.Prop objectProp; |
| 1226 | |
| 1227 | if (currentlyEditing != null && target.properties.has(currentlyEditing)) { |
| 1228 | objectProp = currentlyEditing; |
| 1229 | } else objectProp = target.find(defaultEditorProperty, target.upwards()) |
| 1230 | .findFirst() |
| 1231 | .map(x -> (Dict.Prop) new Dict.Prop<String>(x).toCanon()) |
| 1232 | .orElseGet(() -> (Dict.Prop) Execution.code); |
| 1233 | |
| 1234 | |
| 1235 | Log.log("remoteeditor", |
| 1236 | () -> " looking for a defaultEditorProperty on <" + target + "> <" + target.properties.get(defaultEditorProperty) + ">, got <" + objectProp + ">"); |
| 1237 | |
| 1238 | if (!(target == currentSelection && objectProp.equals(currentlyEditing))) |
| 1239 | changeSelection(target, objectProp); |
| 1240 | } |
| 1241 | } |
| 1242 | |
| 1243 | String ch = completionHelp.get(); |
| 1244 | if (!ch.equals(lastCh)) { |
| 1245 | JSONStringer h = new JSONStringer(); |
| 1246 | h.object().key("message").value(ch).endObject(); |
| 1247 | server.send(socketName, "_messageBus.publish('extra.help', " + h + ")"); |
| 1248 | lastCh = ch; |
| 1249 | } |
| 1250 | |
| 1251 | |
| 1252 | return true; |
| 1253 | } |
| 1254 | |
| 1255 | static public Execution getExecution(Box box, Dict.Prop<String> prop) { |
| 1256 |
nothing calls this directly
no test coverage detected