Bug 226694 - Provide an extension point to plug your own CompareEditorInput implementation in Compare Action
Summary: Provide an extension point to plug your own CompareEditorInput implementation...
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Compare (show other bugs)
Version: 3.3.2   Edit
Hardware: All All
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform-Compare-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-11 10:32 EDT by David Michonneau CLA
Modified: 2019-09-06 15:35 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Michonneau CLA 2008-04-11 10:32:36 EDT
Currently the Compare Action class hardcodes the implementation of CompareEditorInput to be ResourceCompareInput (see below -1). This prevents to create a custom implementation of CompareEditorInput that could be pluggable for certain content types, using the existing compare action.

The compare framework already allows to open the compare editor programmatically with a custom CompareEditorInput (see below -2).

So it would be nice to have a new extension point that allows to register a CompareEditorInput for specific content types, extension which would be used by the existing Compare Action. Even better if there was a way to extend the Compare Action to do some custom logic based on the selection (in that case use the CompareEditorInput or even open the diff result in a dialog or a view rather than an editor)


Appendix
1- Hardcoded input in compare action

	protected boolean isEnabled(ISelection selection) {
		if (fInput == null) {
			CompareConfiguration cc= new CompareConfiguration();
			// buffered merge mode: don't ask for confirmation
			// when switching between modified resources
			cc.setProperty(CompareEditor.CONFIRM_SAVE_PROPERTY, new Boolean(false));
			
			// uncomment following line to have separate outline view
			//cc.setProperty(CompareConfiguration.USE_OUTLINE_VIEW, new Boolean(true));
						
			fInput= new ResourceCompareInput(cc);
		}
		return fInput.isEnabled(selection);
	}

2- calling the editor with a custom input:

	/**
	 * Performs the comparison described by the given input and opens a
	 * compare editor on the result in the currently active workbench page.
	 *
	 * @param input the input on which to open the compare editor
	 */
	public static void openCompareEditor(CompareEditorInput input) {
		openCompareEditorOnPage(input, null);
	}
Comment 1 Eclipse Webmaster CLA 2019-09-06 15:35:35 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.