davsclaus opened a new pull request, #27253: URL: https://github.com/apache/camel/pull/27253
Fixes [CAMEL-25256](https://issues.apache.org/jira/browse/CAMEL-25256). The source editor's refactoring menu (Ctrl+R in edit mode) worked in YAML routes only. Now in Java and XML routes too: | Refactoring | Java | XML | |---|---|---| | **Replace URI** | the string of `from`/`to`/`toD`/`wireTap`/`enrich`/`pollEnrich`/`poll` on the line, escaped | the `uri` attribute of those elements, `&` handled | | **Extract to property** | the string literal **at the cursor** → `"{{key}}"` | the attribute value at the cursor (or on its name) → `"{{key}}"` | | **Extract to new file** | — | the step block at the cursor → a route `from direct:name` in `name.camel.xml` (added to it when it exists), `<to uri="direct:name"/>` in its place | - The property goes to `application.properties`, in `src/main/resources` for a Maven or Gradle layout (the YAML refactoring wrote next to the file, which for `src/main/java/...` is not where it is read). - Extract to property works on the value at the cursor, because a Java line has several strings (`setHeader("region", constant("EU"))`). - Java has no extract to file: a step of a fluent chain is no block with clear edges. - With nothing to refactor on the line, the editor says what to put the cursor on.  ### Changes - `RouteRefactorings`: the endpoint URI of a line, the value at the cursor (Java literal with escapes, XML attribute with entities), the XML step block (tag balance per line, inside a route, not the route/from/branches/expressions), the new route file, the properties file of a route file. - `SourceViewer`: Ctrl+R in every route file; the Java/XML menu and actions next to the YAML ones (unchanged). - Docs (source editor page: Ctrl+R, keyboard table, known limitations), help, a screenshot. ### Testing - `RouteRefactoringsTest`: URIs (Java, XML with `&`), values at the cursor (escaped quotes, comments, attribute names), the properties file of a Maven layout, XML step blocks and what is no step, the new file; end to end Ctrl+R: a Java value to a property in `src/main/resources`, an XML step to a new file. - The `camel-jbang-plugin-tui` suite passes (1594 tests). - Tried live in the TUI; the screenshot is from that run. _Claude Code on behalf of davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
