Skip to content

Support for modifying source in compare clipboard editor#2007

Open
SougandhS wants to merge 1 commit intoeclipse-platform:masterfrom
SougandhS:compareClipboardModify
Open

Support for modifying source in compare clipboard editor#2007
SougandhS wants to merge 1 commit intoeclipse-platform:masterfrom
SougandhS:compareClipboardModify

Conversation

@SougandhS
Copy link
Copy Markdown
Contributor

For #1862 (comment)

follow-up to #1862

Supports modifying the source from compare editor itself

My.Movie.mp4

@SougandhS SougandhS marked this pull request as draft July 3, 2025 04:32
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jul 3, 2025

Test Results

 1 977 files  ±0   1 977 suites  ±0   1h 37m 12s ⏱️ + 8m 29s
 4 743 tests ±0   4 719 ✅ ±0   24 💤 ±0  0 ❌ ±0 
14 229 runs  ±0  14 047 ✅ ±0  182 💤 ±0  0 ❌ ±0 

Results for commit 9663a82. ± Comparison against base commit c905608.

♻️ This comment has been updated with latest results.

@SougandhS
Copy link
Copy Markdown
Contributor Author

One more thing I have to handle

@SougandhS
Copy link
Copy Markdown
Contributor Author

My.Movie2.mp4

@SougandhS SougandhS force-pushed the compareClipboardModify branch from ac391fe to 37ce6af Compare July 3, 2025 06:05
@SougandhS SougandhS marked this pull request as ready for review July 3, 2025 06:05
@SougandhS
Copy link
Copy Markdown
Contributor Author

Hi @iloveeclipse, I have added the missing modify functionality 👍

@SougandhS SougandhS force-pushed the compareClipboardModify branch 3 times, most recently from a0b6cee to a089065 Compare July 9, 2025 01:55
@vogella
Copy link
Copy Markdown
Contributor

vogella commented Jul 31, 2025

@iloveeclipse I think you suggest that @SougandhS adds this. Can you review?

@SougandhS SougandhS force-pushed the compareClipboardModify branch from cf4f3d5 to 443d921 Compare August 4, 2025 01:40
@vogella
Copy link
Copy Markdown
Contributor

vogella commented Dec 19, 2025

@SougandhS can you solve the merge conflict?

@SougandhS SougandhS force-pushed the compareClipboardModify branch from 443d921 to 28295b4 Compare December 19, 2025 08:39
@SougandhS
Copy link
Copy Markdown
Contributor Author

@SougandhS can you solve the merge conflict?

Done 👍

Support for modifying source in compare clipboard editor and Use
MultiPageEditorPart for getting active editor and in ClipboardReplace &
Clipboard Compare
@vogella vogella force-pushed the compareClipboardModify branch from 28295b4 to 9663a82 Compare January 12, 2026 10:29
Copy link
Copy Markdown
Contributor

@vogella vogella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few review notes (haven't pulled the branch, just read the diff):

  1. Likely bug in setContent (around line 218): the branch if (selectionLength <= 1) overwrites the entire file with newContent. With a 1‑character partial selection, this silently replaces the whole file with just the edited char. The condition should be if (!partialSelection), mirroring how getContents decides.

  2. Mutable per-action state on a singleton delegate: currentResouce, offSet, len, partialSelection are now instance fields mutated inside the per-file loop and later read by EditableFileNode#setContent after the compare editor is open. A later invocation can flip behavior of an already-open compare editor. Pass these as parameters / capture them in the node instead.

  3. Sentinel mixed with Integer.MAX_VALUE: offSet/len use -1 as "no selection", and the else branch then constructs new EditableFileNode(currentResouce, 0, Integer.MAX_VALUE). It only works because getContents clamps via Math.min. A single boolean inside the node would be cleaner.

  4. Dialogs from model code: EditableFileNode#getContents and setContent call MessageDialog.openError(...) directly; these can be invoked off the UI thread by the compare framework. Prefer ILog.of(getClass()).error(...) and rethrow / return, so the framework surfaces the error.

  5. Cosmetics: typo currentResouce (should be currentResource), field offSet (should be offset), variable name page2, and ClipboardCompare.java is missing a trailing newline. Pre-existing typo "Comparision Failed" could be fixed in passing.

  6. No tests added; given the offset/length math, a test that opens a clipboard compare on a partial selection and writes back would be valuable.

  7. Edge case: captured selectionOffset/selectionLength become stale if the underlying file is modified between opening the compare and saving.

@SougandhS
Copy link
Copy Markdown
Contributor Author

A few review notes (haven't pulled the branch, just read the diff):

Thanks, will check this comments 👍

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.

3 participants