Skip to content

Commit 2989f6d

Browse files
brychcyiloveeclipse
authored andcommitted
Make "Compare with Clipboard" work in active editor of FormEditor
e.g. m2e's MavenPomEditor or PDE's ManifestEditor Signed-off-by: Till Brychcy <[email protected]>
1 parent c4f892a commit 2989f6d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

team/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ClipboardCompare.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import org.eclipse.ui.IWorkbenchPage;
4444
import org.eclipse.ui.IWorkbenchPart;
4545
import org.eclipse.ui.PlatformUI;
46+
import org.eclipse.ui.forms.editor.FormEditor;
4647
import org.eclipse.ui.texteditor.ITextEditor;
4748

4849
public class ClipboardCompare extends BaseCompareAction implements IObjectActionDelegate {
@@ -88,6 +89,9 @@ private void processComparison(IFile file, Shell parentShell) throws IOException
8889
return;
8990
}
9091
final String selectionContents;
92+
if (editor instanceof FormEditor fromEditor) {
93+
editor = fromEditor.getActiveEditor();
94+
}
9195
if (editor instanceof ITextEditor txtEditor) {
9296
ISelection selection = txtEditor.getSelectionProvider().getSelection();
9397
if (selection instanceof ITextSelection textSelection) {

0 commit comments

Comments
 (0)