Support for modifying source in compare clipboard editor#2007
Support for modifying source in compare clipboard editor#2007SougandhS wants to merge 1 commit intoeclipse-platform:masterfrom
Conversation
|
One more thing I have to handle |
My.Movie2.mp4 |
ac391fe to
37ce6af
Compare
|
Hi @iloveeclipse, I have added the missing modify functionality 👍 |
a0b6cee to
a089065
Compare
|
@iloveeclipse I think you suggest that @SougandhS adds this. Can you review? |
a089065 to
cf4f3d5
Compare
cf4f3d5 to
443d921
Compare
|
@SougandhS can you solve the merge conflict? |
443d921 to
28295b4
Compare
Done 👍 |
Support for modifying source in compare clipboard editor and Use MultiPageEditorPart for getting active editor and in ClipboardReplace & Clipboard Compare
28295b4 to
9663a82
Compare
vogella
left a comment
There was a problem hiding this comment.
A few review notes (haven't pulled the branch, just read the diff):
-
Likely bug in
setContent(around line 218): the branchif (selectionLength <= 1)overwrites the entire file withnewContent. With a 1‑character partial selection, this silently replaces the whole file with just the edited char. The condition should beif (!partialSelection), mirroring howgetContentsdecides. -
Mutable per-action state on a singleton delegate:
currentResouce,offSet,len,partialSelectionare now instance fields mutated inside the per-file loop and later read byEditableFileNode#setContentafter 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. -
Sentinel mixed with
Integer.MAX_VALUE:offSet/lenuse-1as "no selection", and the else branch then constructsnew EditableFileNode(currentResouce, 0, Integer.MAX_VALUE). It only works becausegetContentsclamps viaMath.min. A single boolean inside the node would be cleaner. -
Dialogs from model code:
EditableFileNode#getContentsandsetContentcallMessageDialog.openError(...)directly; these can be invoked off the UI thread by the compare framework. PreferILog.of(getClass()).error(...)and rethrow / return, so the framework surfaces the error. -
Cosmetics: typo
currentResouce(should becurrentResource), fieldoffSet(should beoffset), variable namepage2, andClipboardCompare.javais missing a trailing newline. Pre-existing typo"Comparision Failed"could be fixed in passing. -
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.
-
Edge case: captured
selectionOffset/selectionLengthbecome stale if the underlying file is modified between opening the compare and saving.
Thanks, will check this comments 👍 |
For #1862 (comment)
follow-up to #1862
Supports modifying the source from compare editor itself
My.Movie.mp4