Fix: Outline view clicks ignored in Compare editor#313
Draft
Fix: Outline view clicks ignored in Compare editor#313
Conversation
…w navigation The Compare editor was ignoring clicks in the Outline view when 'Show structure compare in Outline view when possible' was enabled. Root cause: TextMergeViewer.InternalOutlineViewerCreator.selectionChanged() calls findDiff() which checks if the selected element's left/right nodes are DocumentRangeNode instances to get their document position. Since ScenarioPart only implemented IStructureComparator/ITypedElement (not DocumentRangeNode), getPosition() returned null and no navigation occurred. Fix: Make ScenarioPart and ScenarioRoot extend DocumentRangeNode with character offsets pointing to each section's location in the raw scenario file text. This is analogous to how JDT's JavaNode extends DocumentRangeNode to enable the same navigation in the Java compare editor. When the user clicks a node in the Outline view (e.g. 'Script'), the text viewer now scrolls to the first text diff at or after the script section's position in the file, which is the expected behavior consistent with JDT. Agent-Logs-Url: https://github.com/eclipse-rcptt/org.eclipse.rcptt/sessions/d4e9e421-f8a0-4efe-9eb7-bb341bc6657d Co-authored-by: basilevs <650857+basilevs@users.noreply.github.com>
… documentation Agent-Logs-Url: https://github.com/eclipse-rcptt/org.eclipse.rcptt/sessions/d4e9e421-f8a0-4efe-9eb7-bb341bc6657d Co-authored-by: basilevs <650857+basilevs@users.noreply.github.com>
…tions Agent-Logs-Url: https://github.com/eclipse-rcptt/org.eclipse.rcptt/sessions/d4e9e421-f8a0-4efe-9eb7-bb341bc6657d Co-authored-by: basilevs <650857+basilevs@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix Compare editor ignoring double-clicks in Outline view
Fix: Outline view clicks ignored in Compare editor
May 5, 2026
…or Outline view nav
The previous approach of extending DocumentRangeNode broke 5 existing compare
tests because TextMergeViewer.ContributorInfo.setDocument() takes the
IDocumentRange path when the element is a DocumentRangeNode, and then uses a
1-character raw-file slice instead of the extracted field content.
This commit:
1. Reverts ScenarioPart to the original design (extends ScenarioResource, not
DocumentRangeNode) – this restores the structure-pane compare behavior that
the existing tests validate.
2. Adds int fRawOffset / getRawOffset() / setRawOffset() to ScenarioPart,
populated during getStructure() with the character offset of each section in
the raw scenario file (same MIME-boundary search logic as before).
3. Adds ScenarioMergeViewerCreator / ScenarioMergeViewer extends TextMergeViewer
for .test/.scenario files. ScenarioMergeViewer:
- Overrides createSourceViewer() to capture the left and right SourceViewer
references (no reflection needed – createSourceViewer() is protected API).
- Overrides getAdapter(OutlineViewerCreator.class) to return a custom
ScenarioOutlineViewerCreator that, on Outline-view selection of a
ScenarioPart, calls revealOffset(rawOffset) which scrolls both captured
source viewers to the section via ITextViewer.revealRange() (public API).
4. Registers ScenarioMergeViewerCreator for .test/.scenario in plugin.xml.
Agent-Logs-Url: https://github.com/eclipse-rcptt/org.eclipse.rcptt/sessions/713d3095-235f-4429-85a7-ce15a379f95d
Co-authored-by: basilevs <650857+basilevs@users.noreply.github.com>
basilevs
requested changes
May 6, 2026
| return part; | ||
| } | ||
| } | ||
| public static final String STRUCTURE_COMPARE_TITLE = "Test Case Structure Compare"; //$NON-NLS-1$ |
Contributor
There was a problem hiding this comment.
Formatting is broken, no indent. Revert?
Contributor
Author
There was a problem hiding this comment.
Fixed in 2378b5b — the class body was written without indentation due to a heredoc issue. Restored proper tab indentation throughout ScenarioStructureCreator.java.
…eator Agent-Logs-Url: https://github.com/eclipse-rcptt/org.eclipse.rcptt/sessions/58b2a6cf-56b8-4e33-bd5e-e6510ddc1033 Co-authored-by: basilevs <650857+basilevs@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ScenarioPart extends DocumentRangeNodecausesTextMergeViewer.ContributorInfo.setDocument()to take theIDocumentRangepath, showing a 1-character raw-file slice instead of the extracted field content — breaking all structure-pane compare testsScenarioPartto original design (extendsScenarioResource, NOTDocumentRangeNode) — restores structure-pane compare behaviorfRawOffset/getRawOffset()/setRawOffset()toScenarioPart, populated duringgetStructure()with the character offset of each section in the raw scenario fileScenarioMergeViewerCreator/ScenarioMergeViewer extends TextMergeViewerfor.test/.scenariofiles:createSourceViewer()to capture left/rightSourceViewerreferences (protected API, no reflection)getAdapter(OutlineViewerCreator.class)to returnScenarioOutlineViewerCreatorScenarioOutlineViewerCreatoron Outline-view selection of aScenarioPartcallsrevealOffset(rawOffset)→ITextViewer.revealRange()(public API)ScenarioMergeViewerCreatorfor.test/.scenarioinplugin.xml