Bug 263943 - Make core.compare independent of core.resource - was: Provide RangeDifferencer API in the compare core plug-in
Summary: Make core.compare independent of core.resource - was: Provide RangeDifference...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Compare (show other bugs)
Version: 3.4   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.5 M6   Edit
Assignee: Szymon Brandys CLA
QA Contact:
URL:
Whiteboard: hasPatch
Keywords: api
Depends on: 250419 264327
Blocks: 249981
  Show dependency tree
 
Reported: 2009-02-06 08:53 EST by Dani Megert CLA
Modified: 2009-02-16 06:45 EST (History)
2 users (show)

See Also:


Attachments
Fix v01 (compare and compare.core) (71.90 KB, patch)
2009-02-09 09:13 EST, Szymon Brandys CLA
no flags Details | Diff
Fix v01 (new compare.rangedifferencer) (42.21 KB, application/zip)
2009-02-09 09:14 EST, Szymon Brandys CLA
no flags Details
Fix v02 (68.19 KB, patch)
2009-02-13 07:23 EST, Szymon Brandys CLA
no flags Details | Diff
Fix v03 (73.72 KB, patch)
2009-02-16 05:13 EST, Szymon Brandys CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2009-02-06 08:53:20 EST
+++ This bug was initially created as a clone of Bug #250419 +++

See bug 249981, comment 0 for details.

While in compare.core we and other RCP plug-ins cannot use the range differencer as the plug-in depends on core.resources.

It would be great to have the core plug-in be independent of core.resources because otherwise it would be of no use for us.
Comment 1 Michael Valenta CLA 2009-02-06 09:39:36 EST
Another possibility is to make the plug-in optionally depend on core.resources. This means you would still need the core.resources bundle to build core.compare but the plug-in would still work without resources. If this approach was taken, you would need to isolate the use of IResource, IStorage and other API that came from the resources bundle to classes that were not required for RCP use.
Comment 2 Szymon Brandys CLA 2009-02-06 10:05:35 EST
Creating a separate plugin sounds like a good idea for me. I don't like these optional dependencies.
Comment 3 Szymon Brandys CLA 2009-02-06 10:08:31 EST
BTW, why does RCP app have to take whole compare.core plug-in, if it just needs RangeDifferencer API.
Comment 4 Dani Megert CLA 2009-02-06 11:35:22 EST
>BTW, why does RCP app have to take whole compare.core plug-in
Because there is currently no alternative ;-)
Comment 5 Szymon Brandys CLA 2009-02-09 09:13:22 EST
Created attachment 125131 [details]
Fix v01 (compare and compare.core)
Comment 6 Szymon Brandys CLA 2009-02-09 09:14:57 EST
Created attachment 125132 [details]
Fix v01 (new compare.rangedifferencer)
Comment 7 Szymon Brandys CLA 2009-02-09 09:16:39 EST
Fix v01 is the first step. The second would be to rename compare.core into compare.patch.
Comment 8 Michael Valenta CLA 2009-02-09 09:32:55 EST
Szymon, I wonder if it would be worth it to push much of the patching code into a non-resource based plug-in as well. In the patch API, there are only two places where IStorage is used:

1) The PatchParser class uses IStorage as the input
2) IFilePath#apply uses IStorage as the input

You could define the equivalent of IStorage and IEncodedStorage in the Compare/Core plug-in and use these in the Core patching support. The tricky part is how to deal with IFilePath#apply. You would probably need to define a new super interface with no dependencies on IStorage and have IFilePatch extend that and define the IStorage based apply.

I mention this because we, Jazz SCM, are moving away, as much as possible, from depending on the Eclipse resource layer so we can provide better support form non-Eclipse based client like Visual Studio. Any work you do in decoupling Compare functionality from Resources would be helpful in this respect. Ideally, there would be a Compare/Core and a Compare/UI that did not depend on the Resource layer at all.

P.S. Another approach to this would be to push IStorage/IEncodedStorage down into a more RCP accessible bundle.
Comment 9 Szymon Brandys CLA 2009-02-10 07:18:53 EST
(In reply to comment #8)
I'm going to create a separate compare.rangedifferencer plug-in anyway. 

I raised a bug for moving IStorage down to runtime/equinox plug-in (bug 264327). Depending on that I'll try to remove core.resources dependency in compare.core too.

Comment 10 Dani Megert CLA 2009-02-10 08:24:30 EST
I like the approach that Michael suggested in comment 8 better. Creating a new bundle for just the range differencer sounds like overkill to me.
Comment 11 Szymon Brandys CLA 2009-02-10 08:56:29 EST
(In reply to comment #10)
> I like the approach that Michael suggested in comment 8 better. Creating a new
> bundle for just the range differencer sounds like overkill to me.
> 

Only if we move IStorage down, the approach from the comment 8 is ok for me. Creating an interface similar to IStorage in the compare doesn't look like a good idea.

Comment 12 Dani Megert CLA 2009-02-10 09:03:29 EST
What about using EFS API like IFileStore?
Comment 13 Szymon Brandys CLA 2009-02-10 09:14:20 EST
(In reply to comment #12)
> What about using EFS API like IFileStore?

I assume that we don't want to make a dependency to core.filesystem. Ideally, compare.core would depend only on core.runtime.

Comment 14 Dani Megert CLA 2009-02-10 09:23:52 EST
>I assume that we don't want to make a dependency to core.filesystem
Yes, you are right.
Comment 15 Szymon Brandys CLA 2009-02-13 07:23:42 EST
Created attachment 125622 [details]
Fix v02
Comment 16 Szymon Brandys CLA 2009-02-13 07:24:50 EST
I got rid of core.resources in compare.core.
Comment 17 Michael Valenta CLA 2009-02-13 08:18:39 EST
So, just to summarize, you have pushed IFilePath and ParsePatcher back up to org.eclipse.compare and created an IFilePatch2 and ParsePatcher2 in org.eclipse.compare.core? I believe that PatchParser is new in 3.5 so you should not need to make a PatchParser2 for that class. You could just change PatchParser to take a ReaderFactory. Also, IFilePatch is not implementable by clients so technically, IFilePatch could extend IFilePatch2 and just define the one method that takes IStorage. Similarly, FileDiffWrapper in org.eclipse.compare could extend FileDiff and define the apply method that takes an IStorage.
Comment 18 Szymon Brandys CLA 2009-02-13 09:29:50 EST
(In reply to comment #17)
Yes. PatchParser could be removed and IFilePatch can extend IFilePatch2. I'm going to release it before next IBuild.
Comment 19 Szymon Brandys CLA 2009-02-16 05:13:11 EST
Created attachment 125766 [details]
Fix v03
Comment 20 Tomasz Zarna CLA 2009-02-16 06:45:37 EST
Fix v03 released to HEAD with some minor mods (e.g. Utilities.createReader is used more often).