Skip to content

CodesAway/BEXCodeCompare

Repository files navigation

BEX Code Compare

BEX Code Compare

BEX Code Compare is a library and Eclipse plugin, which uses Patience sort / Myers diff and some post diff processing to yield an enhanced code compare

The library has no dependency on Eclipse and can be used in commercial or private projects.

Maven Dependency

Tip: you only need to specify one of the following. For example, if you include becr.examples, it has a transitive dependency for bex and becr.

<dependency>
    <groupId>info.codesaway</groupId>
    <artifactId>bex</artifactId>
    <version>0.13.0</version>
</dependency>
<dependency>
    <groupId>info.codesaway</groupId>
    <artifactId>becr</artifactId>
    <version>0.13.0</version>
</dependency>

<dependency>
    <groupId>info.codesaway</groupId>
    <artifactId>becr.examples</artifactId>
    <version>0.11.0</version>
</dependency>

Screenshots of Eclipse plugin

Select BEX Code Compare
Select BEX Code Compare

BEX Code Compare View
BEX Code Compare View

Use enhanced compare (enabled by default)
Use enhanced compare setting

Ignore comments (disabled by default)
Ignore comments setting

Show both sides of substitution in BEX View (disabled by default)
Show both sides of substitution setting in BEX View

What is BEX Code Compare?

BEX Code Compare is Be Enhanced ϽC Code Compare

What is BECR?

BECR, pronounced Beccer, is Be Enhanced Code Refactoring

How does it work?

BEX Code Compare

First we use Patience sort / Myers diff (similar to how GitHub does a compare). Then, we take the resulting diff and do some post diff processing to group the differences into groups of changes.

BEX Code Matching

BEX Matching performs structured code matching to offer an enhanced find and replace for your code

For example, match an if branch with a simple pattern.

if (:[condition]) { :[stuff] }

BEX will ensure the parentheses and braces are balanced, and that you're not looking at commented out code. I like to think of it as a code friendly regular expression. Of course, if you want to mix regex in your pattern, that's supported too.

BEX Code Refactoring

BECR uses BEX and Eclipe's JDT to parse Java code and provide parsing and refactoring functionality. There are examples available to show how BECR could be used.

Learn more on the wiki

Check out the Wiki to learn more

How does the Eclipse plugin work?

  • We start with the BEX library and the functionality it provides outside of an IDE
  • Then, the BEX Eclipse plugin identifies important versus non important changes (such as a line being split across multiple lines if ignoring whitespace differences)
  • Finally, BEX shows an Eclipse view with the changes

Update Site

codesaway.info/eclipse

Stable

Beta

Installation

  1. Open Eclipse and under the Help menu, select Install New Software...
  2. Click Add... to add a new site
  3. Check the box next to BEX Code Compare to install the plugin
  4. Click Next
  5. Accept the license agreement and click Finish
  6. When prompted, install the plugin even though it's not digitally signed
  7. Restart Eclipse when asked
  8. Start your enhanced compare! BEX Code Compare
    • When you do a compare on Java files, select BEX Code Compare from the dropdown of available compare editors