Add reference-safe FXML rename, subtree copy and delete

This commit is contained in:
2026-11-13 16:13:03 +01:00
parent 5462f480a4
commit 910a8b0e85
13 changed files with 1191 additions and 7 deletions
+31
View File
@@ -0,0 +1,31 @@
# Reference-safe structural editing
Both hosts expose **Bindings → Structure** in the shared Kit UI. Select a source object in the list or canvas, then rename its identifier, copy its subtree, paste into a selected standard Pane, or delete the subtree. Copy captures immutable source and associated declarations; it does not change the document. Each rename, paste or delete is one host-owned source transaction with exact Undo/Redo. Read-only documents and stale selections cannot be modified.
Rename changes `fx:id` and associated root BindingList `DirectBinding.control`, `ComputedBinding.control` and `Repeat.pane` references. Attribute targets and simple nested target elements are supported. A single identifier rename proposed by Kit's own inspector uses the same reference-aware transaction. Anonymous objects can receive an identifier without persisting a synthetic projection identity. Duplicate identifiers and collisions are rejected.
Copy/paste assigns fresh identifiers to every identified descendant and clones its associated bindings, including Model paths, directions, Converters and Computed methods. Internal references are remapped; references to objects outside the subtree are retained. Delete removes the selected subtree and the bindings targeting any removed descendant. Table removal through the Table inspector also uses this cleanup. Other dependencies remain visible for validation; no separate Component or Row source file is rewritten.
Supported ordinary FXML references include `$id`, simple `${id.property}` expressions and `fx:reference`/`fx:copy` source attributes. Missing simple references are displayed and block a new preview while the document remains saveable. Model paths and literal strings are not identifier references. Complex expressions mentioning an affected identifier, scripts and detected unfamiliar target declarations require Source review rather than speculative rewrites. Java Controller fields and other external Java references are not refactored.
## Source ownership and cross-View paste
Edits retain unrelated source characters, comments, processing instructions, declaration order and unknown attributes. Copied fragments retain their lexical form, with identifier/reference substitutions and any required inherited namespace declarations. Missing imports are added; conflicting simple names and ambiguous wildcard combinations require explicit Source resolution.
The immutable clipboard is shared between open designers in the same host process, including separate standalone windows and IntelliJ editor panes. It is not the operating-system clipboard or a transfer between host processes. Cross-View paste preserves the destination Model and Controller declarations and automatically runs destination binding validation. Context differences are reported, unresolved paths/methods remain editable, and known binding errors block new previews. Java changes still require Build and Refresh. Without a usable snapshot, target validation remains unavailable rather than being reported as successful.
Paste supports the children of standard VBox, HBox, Pane, AnchorPane, StackPane, FlowPane, TilePane and GridPane containers, including an explicit children wrapper and a compatible fx:root. Copying/deleting the document root, copying includes/scripts, cross-View relative resource references and unsupported child properties require Source editing. Native Kit structural clipboard/delete/reparenting proposals remain rejected; use the shared Structure actions. This slice does not infer arbitrary application reference conventions or rewrite Java source.
## Automated qualification
Regression tests exercise lexical preservation, nested binding targets, collision handling, unsupported cases, internal and external references, fresh identifiers, destination context preservation and Kit identifier rename. The shared live host scenario checks rename, subtree copy/paste/delete, exact single-command Undo/Redo, save/load, valid interactive preview and cross-View paste with automatic destination diagnostics and preview blocking. It runs in native standalone and registered IntelliJ for classpath and module-path applications. No manual testing is required.
Run the bootstrap and registered IDE commands in the [README](../README.md). Generated metadata and IDE Problems integration remain subsequent work.
### Qualification — 2026-11-13
The final full bootstrap gate passed: 126 unit/adapter tests (119 Maven and seven IntelliJ), no failures/errors/skips, 36 target processes with 512 fixture checks, 48 worker lifecycle cycles, both native standalone modes, connected adapters, plugin packaging and documentation checks. Registered IntelliJ classpath and module-path qualification passed the shared structural scenario, exclusive JavaFX 26 native-library checks and worker shutdown. No manual testing was used; previously skipped manual checks remain skipped.
The first registered IntelliJ attempt stopped at the older DirectBinding scenario's immediate exact-disk assertion, `Invalid binding could not be saved`, before the structural tests. The saved file subsequently contained the invalid declaration; the assertion did not capture an exact expected/actual diagnostic. The unchanged rerun passed both modes. This resembles the previously recorded intermittent persistence-check failure but does not establish its cause or a fix. No save implementation or exact-source assertion was weakened; persistence-check reliability remains a follow-up.
Local evidence: `/tmp/structure-bootstrap-final.log`, `/tmp/structure-registered-ide.log`, `/tmp/structure-registered-ide-retry.log`, `target/connected-workflow/` and `target/ide-workflow/`. Generated qualification artifacts are not repository inputs.
+4
View File
@@ -133,3 +133,7 @@ The [Table/Column authoring slice](table-column-inspector.md) adds Table and ord
## Table-specific compatibility and Row alignment
The [Table discovery slice](table-compatibility.md) adds collection/Row/Attribute choices, Table-specific bean rules and conservative positional Row-binding diagnostics in both hosts. Binding discovery includes captured open Row drafts and rejects changed revisions. Known type errors block preview; mismatches and uncertain alignment offer explicit Row navigation without rearranging shared layouts. Generated metadata, structural reference repair and Problems integration remain open.
## Reference-safe rename, copy and delete
The [shared Structure editor](reference-safe-structure.md) adds source-preserving identifier rename, subtree copy/paste with fresh identifiers, associated binding cleanup on delete and destination validation for cross-View paste. Both hosts own each operation as one undo command. Simple FXML references are remapped; unfamiliar expressions and external Java references retain explicit boundaries. Generated metadata and Problems integration remain open.
+5 -1
View File
@@ -67,6 +67,10 @@ The user subsequently passed the physical corner retest for both Components in b
## Remaining boundaries
This stage preserves arbitrary source, but does not make arbitrary structure visually editable. Insert/delete/reparent, binding-aware renames and subtree copy/paste require later structural transactions. Application wildcard imports, `fx:include`, scripts and unrepresentable roots retain source fallback. Arbitrary target properties use declared FXML text editing until shared discovery supplies typed metadata. Anonymous identities are local to a projection revision, not the persistent occurrence identities needed for repeated/Table Components. Target node lookup still uses the initial CSS-ID route; separate CSS IDs and repeated/internal scopes need stage 3's occurrence identity work.
This stage preserves arbitrary source, but does not make arbitrary structure visually editable. Binding-aware renames and subtree copy/paste/delete are now available through the [Structure editor](reference-safe-structure.md). Arbitrary insertion/reparenting still requires Source editing. Application wildcard imports, `fx:include`, scripts and unrepresentable roots retain source fallback. Arbitrary target properties use declared FXML text editing until shared discovery supplies typed metadata. Anonymous identities are local to a projection revision, not the persistent occurrence identities needed for repeated/Table Components. Target node lookup still uses the initial CSS-ID route; separate CSS IDs and repeated/internal scopes need stage 3's occurrence identity work.
Qualification remains scoped to the recorded macOS arm64 / IntelliJ 263.7307.200 / JavaFX and Kit 26 host baseline and Java 21 / JavaFX 21.0.7 application fixtures. Product packaging, a broader platform matrix, lossless structural editing and wider input qualification are not implied. The stage-2 physical input gate is closed on the tested baseline. The following [target-runtime stage](target-runtime-sessions.md) implements retained sessions, sizing and navigation; its new actions have a separate human review.
## Reference-aware structural actions
The [shared Structure editor](reference-safe-structure.md) now supports explicit rename, subtree copy/paste and delete with binding-reference updates. Single native Kit identifier renames use this transaction too; other native structural proposals still require the explicit Structure actions or Source editing.