Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apply patch to fix bug in Eclipse?

Tags:

eclipse

ide

I have a bug in Eclipse. When stepping through the code, when it goes to another class, the editor loses focus and I have to click again on the editor to continue debugging with the keyboard shortcuts.

I've found this thread describing the bug, and a patch to fix it. Is there any way I can apply the patch? I'm guessing it involves having the source code.

like image 243
Lescai Ionel Avatar asked Oct 25 '12 09:10

Lescai Ionel


1 Answers

Yes you'd need to recompile the module and install it. These days with git SCM and the use of Maven project layouts and tycho plugin it can be easy to rebuild a module (compared to how it was just a few years ago).

Lets see now:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=372941

Patches:

bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java

We search on google "git org.eclipse.e4.ui.workbench.renderers.swt" we end up at the URL:

https://git.eclipse.org/c/platform/eclipse.platform.ui.git/

This can be used to checkout the 1 module to build.

Git is available for many linux distribution by default, google you ditro name and "install git" terms for best help. On windows there is https://code.google.com/p/msysgit/ and on MacOSX there is https://code.google.com/p/git-osx-installer/ all these provide a command line environment to use git. You can look at EGit/JGit plugins for Eclipse itself to also do the job. But the instruction below are for the command line method.

git clone https://git.eclipse.org/c/platform/eclipse.platform.ui.git

Now you'll want to find the tagged version of the version you are using. So you need to find it in your eclipse/plugins/** folder of the Eclipse install. The version number maybe in the filename or in the MANIFEST.MF or other *.xml file, the version number usually indicate the date of source and/or build in the number.

It may help to browse around the eclipse.org website link above for the GIT tree to find the version. This is to get the tag or version name / commit-id (like 'abc1234':

# List tags (might see it in the list)
git tag -l
# Look through history, maybe you can work on the date
git log
# Finally once you know the version you want 
# checkout the exact version that goes with your eclipse install
git checkout -b mylocalbranch <tag_or_version>

Now you can use Maven to build it.

cd eclipse.platform.ui.git
mvn package
# The full-monty would be: mvn deploy  (or 'mvn install')
# But I am not sure if unit and integration tests will work this easily, using
# the 'mvn package' it enough to get you the JAR you need to install in Eclipse.

Now you can look for a .jar in the build/* subdir, you can shutdown you eclipse and place this JAR into the plugins folder, ensure the version number is newer.

If it works update the bug report. Saying it worked for you.

Also consider trying to push it via the github accounts as a new change, crediting the original author.

..

DISCLAIMER: The above is the principal about how you might achieve what you want. It might take less than 5 minutes to complete. But there maybe complications and you'll need to research those (if you get any) independently.

You can also do much of the above with Eclipse itself, a 'git checkout' and a 'build Eclispe plugin module', although for me for this change it would probably take longer maybe 15 minutes (if there are no complications).

like image 177
Darryl Miles Avatar answered Oct 14 '22 11:10

Darryl Miles