Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 21, 2025

Issue Summary

This PR documents the investigation of issue #1169: "[e4][editor] refactoring produces garbage in fragment.e4xmi"

Investigation Findings

After extensive investigation of the eclipse.platform.ui repository, I've determined that this issue cannot be fixed in this repository. The problem requires changes in the eclipse.jdt.ui repository instead.

Root Cause

When refactoring Java class names in Eclipse, JDT's rename refactoring updates references in e4xmi files. However, it appears to use simple text search-and-replace without understanding the structure of bundleclass URIs or inner class references.

For example, when renaming a class MyPart to NewPart, the following e4xmi entries exist:

<element contributionURI="bundleclass://my.bundle/com.example.MyPart"/>
<handler contributionURI="bundleclass://my.bundle/com.example.MyPart$MyHandler"/>

The text-based replacement can produce "garbage" results because:

  1. It doesn't understand that MyPart$MyHandler is an inner class reference
  2. Multiple occurrences of the class name in the same file can lead to incorrect replacements
  3. The bundleclass URI structure bundleclass://bundle/fully.qualified.ClassName requires special handling

Evidence from Investigation

  1. No e4-aware rename participant exists in platform.ui: Searched the entire codebase for any code that updates e4xmi files during refactoring - none found
  2. JDT owns Java refactoring: The rename participant that handles Java type renames is in eclipse.jdt.ui, not eclipse.platform.ui
  3. Similar patterns exist: Found NLSAccessorFieldRenameParticipant in JDT that handles NLS field renames, indicating the pattern to follow

Required Solution

The fix needs to be implemented in eclipse.jdt.ui by creating a rename participant that:

  • Parses bundleclass URIs correctly (bundleclass://bundle.name/fully.qualified.ClassName)
  • Handles inner class references (e.g., ClassName$InnerClass)
  • Updates only the appropriate parts of the class name
  • Validates that replacements maintain valid bundleclass URI syntax

Repository Context

This PR is being closed as the work cannot be completed in eclipse.platform.ui. A new issue should be opened in the eclipse.jdt.ui repository to implement the required rename participant.

References

Original prompt

This section details on the original issue you should resolve

<issue_title>[e4][editor] refactoring produces garbage in fragment.e4xmi</issue_title>
<issue_description>If I have a class (e.g. in a shared class) in fragment.e4xmi and refactor the classname this results in a wild mixture of old and new name somewhere in the middle.

This seem to happen mostly if more than one reference is in the fragment.e4xmi, e.g. if I have MyPart and a Handler that is an inner class (e.g.MyPart$MyHandler) in a toolbar.
</issue_description>

<agent_instructions>This is likely somewhere in the refactoring participant of e4</agent_instructions>

Comments on the Issue (you are @copilot in this section)

Fixes #1169


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix garbage output during refactoring in fragment.e4xmi Investigation: e4xmi refactoring issue requires fix in eclipse.jdt.ui repository Oct 21, 2025
Copilot AI requested a review from laeubi October 21, 2025 04:50
Copilot finished work on behalf of laeubi October 21, 2025 04:50
@laeubi
Copy link
Contributor

laeubi commented Oct 21, 2025

Need to check if refactoring of e4 actually happen in platform repository :-\

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[e4][editor] refactoring produces garbage in fragment.e4xmi

2 participants