• Save
Compare framework
Upcoming SlideShare
Loading in...5
×
 

Compare framework

on

  • 246 views

 

Statistics

Views

Total Views
246
Views on SlideShare
246
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Tomasz Zarna, IBM KSL since 2 years, 1 year eclipse committer in Compare, Team, CVS
  • The Compare Framework allows to compare alternate states of a file system, or in the simplest case: two files or two different versions of the same file. In some cases we’re comparing 3 files at the same time but I’ll talk about it in a minute. What does the framework provide? It gives us the API to define the input to a comparison because we need a way to point what to compare. It gives as extensions for associating viewers with input types because sometimes we want to compare different types of inputs in a different way (using different viewers). And finally it gives us containers to display the result in the UI, so we don’t need to the UI part from the scratch. Diff engine: For tree or range based differences , API and action: Compare with Each Other, Local History, Apply Patch
  • Here is a quick view on the compare architecture. As I said we usually compare two states of a file, named „left” and „right” here. If there is a third one it’s treated as a common ancestor of the previous two. Comparison result is displayed in compare viewers, which can support specific model providers like JDT or EMF. There are many clients of the compare framework, some of the are shown at the top.
  • What do we need to create the simplest compare editor? First we will need a CompareItem that represents a resource we are going to compare. Then we will need a CompareEditorInput class that manages the panes of the comparison. Diff nodes are used as the compare result of the differencing engine. With CompareConfiguration we can set details of the comparison, like which of the panes is editable or set lables for panes.
  • Let’s take a look at the code. As mentioned before we need to subclass the CompareEditorInput. In the simplest example we will only implement the prepareInput method. Inside we will create 3 CompareItems, set lables for compare panes and create the DiffNode. In the action class all we need to do is open a compare editor and pass our compare input as an argument.
  • Now let’s have a look at the CompareItem class. It implements 3 interfaces, but because we want to keep it as simple as possible the implementation is rather straightforward. Definition of the popupMenus extension point is also trivial.
  • And here is the result!
  • Here you can see how structure viewers can be used. This is a result of comparing two zip archives. There is a change in the Three.java file. We can see where is it located by looking at the „Zip Archive Compare” pane, on the right in the „Java Structure Compare” pane we can see what parts of the java files has been changed. Below we can see what exactly happened.
  • Some of you have probably noticed that when comparing Java files, the Compare Editor doesn’t give us many Java Editor editor as it could. We’re working on making these diffs less visible, by adding more Java features to Compare Editor. Some of the bugs are even 7 years old, but that’s a good thing because if the bug is older more people will be happy when it’s finally fixed :)

Compare framework Compare framework Presentation Transcript

  • Compare Framework | Copyright © IBM Corp., 2008. All rights reserved. Source code in this presentation is made available underthe EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license. | 2008-11-15Eclipse Demo Camp 2008Compare Framework BasicsTomasz ZarnaIBM Krakow Software Labtomasz.zarna@pl.ibm.com
  • Compare Framework | Copyright © IBM Corp., 2008. All rights reserved. Source code in this presentation is made available underthe EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license. | 2008-11-15Eclipse Demo Camp 20082Agenda• Quick introduction• Simple editor• News• Links• Questions
  • Compare Framework | Copyright © IBM Corp., 2008. All rights reserved. Source code in this presentation is made available underthe EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license. | 2008-11-15Eclipse Demo Camp 20083The Compare Framework• What is the purpose of the Compare framework? Support comparison of alternate states of a file system ordata store• What does the Compare framework provide? API to define the input to a comparison Extensions for associating viewers with input types Containers to host comparisons in the UI A differencing engine API and actions related to file system resources
  • Compare Framework | Copyright © IBM Corp., 2008. All rights reserved. Source code in this presentation is made available underthe EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license. | 2008-11-15Eclipse Demo Camp 20084Overview of Compare ArchitectureCompare ContainerFile System Repository DatabaseCompare InputCompare ViewersJDTrightleftancestorClientsEMFModel Providers
  • Compare Framework | Copyright © IBM Corp., 2008. All rights reserved. Source code in this presentation is made available underthe EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license. | 2008-11-15Eclipse Demo Camp 20085Compare/Merge viewers• A simple text merge viewer and the JDT merge viewer
  • Compare Framework | Copyright © IBM Corp., 2008. All rights reserved. Source code in this presentation is made available underthe EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license. | 2008-11-15Eclipse Demo Camp 20086How to create the simplest Compare Editor?• Ingredients: A CompareItem that implements ITypedElement for name, image and content type of the object IModificationDate for timestamp IStreamContentAccessor to supply the content CompareEditorInput subclass DiffNode computed in a CompareEditorInput subclass To specify which of the panes is editable useCompareConfiguration An action to open the editor A contribution in org.eclipse.ui.popupMenus extension point
  • Compare Framework | Copyright © IBM Corp., 2008. All rights reserved. Source code in this presentation is made available underthe EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license. | 2008-11-15Eclipse Demo Camp 20087The input and the item© Copyright 2008 IBM Corp. All rights reserved. This source code ismade available under the terms of the Eclipse Public License, v1.0.
  • Compare Framework | Copyright © IBM Corp., 2008. All rights reserved. Source code in this presentation is made available underthe EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license. | 2008-11-15Eclipse Demo Camp 20088The action and the popup menu entry© Copyright 2008 IBM Corp. All rights reserved. This source code ismade available under the terms of the Eclipse Public License, v1.0.
  • Compare Framework | Copyright © IBM Corp., 2008. All rights reserved. Source code in this presentation is made available underthe EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license. | 2008-11-15Eclipse Demo Camp 20089The result
  • Compare Framework | Copyright © IBM Corp., 2008. All rights reserved. Source code in this presentation is made available underthe EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license. | 2008-11-15Eclipse Demo Camp 200810The panes of a Compare EditorcontentMergeViewers JavaContentViewerCreatorstructureCreatorsstructureMergeViewersZipFileStructureCreatorJavaStructureDiffViewerCreator
  • Compare Framework | Copyright © IBM Corp., 2008. All rights reserved. Source code in this presentation is made available underthe EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license. | 2008-11-15Eclipse Demo Camp 200811News• Richer Compare Editor• Local diff
  • Compare Framework | Copyright © IBM Corp., 2008. All rights reserved. Source code in this presentation is made available underthe EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license. | 2008-11-15Eclipse Demo Camp 200812IRC, newsgroups and bugzilla• IRC: Freenode: irc.freenode.net #eclipse, #eclipse-dev SzymonB, z4z4 http://wiki.eclipse.org/IRC• Newsgroups eclipse.platform More info: http://www.eclipse.org/newsgroups/• Bugzilla https://bugs.eclipse.org
  • Compare Framework | Copyright © IBM Corp., 2008. All rights reserved. Source code in this presentation is made available underthe EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license. | 2008-11-15Eclipse Demo Camp 200813Web and mail• Web http://www.eclipse.org http://wiki.eclipse.org/Workspace_Team http://planeteclipse.org http://polishineclipse.blogspot.com• Mail Tomasz.Zarna@pl.ibm.com Szymon.Brandys@pl.ibm.com Pawel.Pogorzelski@pl.ibm.com
  • Compare Framework | Copyright © IBM Corp., 2008. All rights reserved. Source code in this presentation is made available underthe EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license. | 2008-11-15Eclipse Demo Camp 200814Questions
  • Compare Framework | Copyright © IBM Corp., 2008. All rights reserved. Source code in this presentation is made available underthe EPL, v1.0, remainder of the presentation is licensed under Creative Commons Att. Nc Nd 2.5 license. | 2008-11-15Eclipse Demo Camp 200815Legal Notices• Java and all Java-based trademarks are trademarksof Sun Microsystems, Inc. in the United States, othercountries, or both• Other company, product, or service names may betrademarks or service marks of others• Question mark graphic is taken from WikimediaCommons and is part of the public domain