Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 364876

Summary: [Compare]Add more options in compare widget and diff provider.
Product: [ECD] Orion Reporter: libing wang <libingw>
Component: ClientAssignee: libing wang <libingw>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: evan_hughes, Szymon.Brandys
Version: 0.3   
Target Milestone: 1.0 RC1   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description libing wang CLA 2011-11-25 18:24:36 EST
We need to add onSave and setTitle call back in the compare widget construction so that the consumer of it will know how to save a file and display proper tilte.
Also in the diff provider we should provide more flexible way for the consumer to resolve all the parameters we may need.
Comment 1 libing wang CLA 2011-11-25 18:27:46 EST
checked in first draft with 1be1a8bbe7573887f1ba4738c05ebf29d9a0a45c.
Need some more options on the widget construction.
Comment 2 Szymon Brandys CLA 2011-11-28 08:17:37 EST
With your recent changes my compare in RTC integration stopped working. Moreover I'm not sure how GitDiffProvider which is a Git-specific thing may be part of compare-container.js which is a generic thing.

I used to use the compare in the following way:
_inlineCompareContainer = new mCompareContainer.InlineCompareContainer(new mDiffProvider.DiffProvider(this._registry), this._registry, this._parent.id);
and then 
this._inlineCompareContainer.resolveDiff(diffURI, callbacks...)

What should I do now? Use GitDiffProvider?
Comment 3 libing wang CLA 2011-11-28 10:00:14 EST
(In reply to comment #2)
> With your recent changes my compare in RTC integration stopped working.
> Moreover I'm not sure how GitDiffProvider which is a Git-specific thing may be
> part of compare-container.js which is a generic thing.
> 
> I used to use the compare in the following way:
> _inlineCompareContainer = new mCompareContainer.InlineCompareContainer(new
> mDiffProvider.DiffProvider(this._registry), this._registry, this._parent.id);
> and then 
> this._inlineCompareContainer.resolveDiff(diffURI, callbacks...)
> 
> What should I do now? Use GitDiffProvider?
Yes, you have to use GitDiffProvider, which is wrapper of the existing APIs from gitClient.
You should also construct the widget from options and use .startup(). e.g:

var diffProvider = new mCompareContainer.GitDiffProvider(serviceRegistry);
var options = {
		readonly: true,
		diffProvider: diffProvider
	};
_inlineCompareContainer = new mCompareContainer.InlineCompareContainer(serviceRegistry, "inline-compare-viewer", options);
_inlineCompareContainer.setOptions({hasConflicts: this._model.isConflict(itemModel.type),									 complexURL: itemModel.diffURI});
			
_inlineCompareContainer.startup();



I've been improving the diff provider for better consumability so that it is not restricted to the order where we called the provider APIs.
Your code is not in the repo so I did not know you are using the inline widget directly.
The new approach of the diff provider is to provide all the diff pararmeters(diff contetnt, 2 sets of file URI, file Name and file type)
By this, other consumers(e.g. RTC) can easily provide theirs.
I will add documentation on those APIs when it is finalized but for now please follow the usage inside git-status-table.js.
Comment 4 libing wang CLA 2012-10-04 17:10:56 EDT
We have now inline, side-by-side and toggle-able compare widgets widely used in different places.
All the options are there.