Download the pdf keymap: eclipse-ganymede-keymap.pdf
In office I work with IDEA and Microsoft Visual Studio C++ on Windows. At home I use Eclipse on Debian Lenny/Sid (Desktops managed by Compiz-fusion B-) ). These programs have very different key bindings, I want cheatsheets for quick look-ups. IDEA ships with a pdf keymap. There are keymaps for Visual Studio products to download from MSDN website. But I could not find any pretty-formatted keymaps for Eclipse. Days ago I downloaded Ganymede and made a pdf keymap during the weekend. The keymap can be downloaded here.
Ganymede provides the csv format of the keymap. I tried the OpenOffice Calc to format the csv file. But failed to figure out how to conditionally fill the row background colours after half hour of exploring the Calc GUI. Out of frustration with OpenOffice Calc, I rolled out a tex template and used a groovy script to pull the data out of the csv and filled the tex template with sorted data.
Here is the code for reading and processing the csv data:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | File file = new File("eclipse-keymap.csv"); List<List<String>> rows = new ArrayList<List<String>>(); file.splitEachLine('\",') { // there are keybindings using ',', so we cannot use ',' as spliter cells -> rows.add(cells.collect{ it -> it.replaceAll("\"", ""); // remove all "s in the String }) }; assert rows.get(0).get(0) == 'Navigate'; int maxColumns = rows.collect{ it -> it.size() }.max(); assert maxColumns == 4; // check whether lines are correctly splited rows = rows.sort(new EclipseKeyMapRowComparator()); |
Here is the EclipseKeyMapComparator class:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | package org.ningning.tex; import java.util.*; class EclipseKeyMapRowComparator<List> implements Comparator<List>{ public int compare(List row1, List row2){ String category1 = row1.get(0); String category2 = row2.get(0); if (category1 > category2){ return 1; } else if (category1 < category2){ return -1; } else { String when1 = row1.get(3); String when2 = row2.get(3); if (when1 > when2){ return 1; } else if (when1 < when2){ return -1; } else { String command1 = row1.get(1); String command2 = row2.get(1); if (command1 > command2){ return 1; } else if (command1 < command2){ return -1; } else { String binding1 = row1.get(2); String binding2 = row2.get(2); if (binding1 > binding2){ return 1; } else if (binding1 < binding2){ return -1; } else{ return 0; } } } } } } |
The tex template look like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | \documentclass[twoside, a4paper, 10pt, openright, oldfontcommands]{memoir} \usepackage{a4wide, array, colortbl, supertabular, underscore} \usepackage[font=sl, labelfont=bf]{caption} \usepackage[T1]{fontenc} \usepackage{cmbright} \begin{document} \definecolor{oddRow}{rgb}{1.0, 0.9333, 0.6667} \definecolor{evenRow}{rgb}{1.0, 0.965, 0.8353} \tablecaption{Eclipse Keymap} \tablefirsthead{\bfseries Category & \bfseries Command & \bfseries Binding & \bfseries When\\ \hline} \tablehead{ \multicolumn{4}{l}{\emph{Eclipse keymap, continued}} \\ \bfseries Category & \bfseries Command & \bfseries Binding & \bfseries When\\ \hline} \tabletail{\hline \multicolumn{4}{r}{\emph{Continued on next page}}\\} \tablelasttail{\hline \hline} \centering \setlength\extrarowheight{1pt} \begin{mpsupertabular}% {>{\centering\hspace{0pt}\arraybackslash}m{20mm}% >{\centering\hspace{0pt}\arraybackslash}m{50mm}% >{\centering\hspace{0pt}\arraybackslash}m{45mm}% >{\centering\hspace{0pt}\arraybackslash}m{25mm}} % the tex code for rows is what we need to generate using Groovy, result please see below \end{mpsupertabular} \end{document} |
Having the processed data in a list, a nested for-loop is all that we need to construct the tex code for row contents. Here are several lines in the final result:
1 2 3 4 5 6 7 | \rowcolor{evenRow} \color{black} Edit & Restore Last Selection & Shift+Alt+Down & Editing Java Source \\ \rowcolor{oddRow} \color{black} Edit & Select Enclosing Element & Shift+Alt+Up & Editing Java Source \\ \rowcolor{evenRow} \color{black} Edit & Select Next Element & Shift+Alt+Right & Editing Java Source \\ \rowcolor{oddRow} \color{black} Edit & Select Previous Element & Shift+Alt+Left & Editing Java Source \\ \rowcolor{evenRow} \color{black} Edit & Find Next & Ctrl+K & Editing Text \\ \rowcolor{oddRow} \color{black} Edit & Find Previous & Shift+Ctrl+K & Editing Text \\ \rowcolor{evenRow} \color{black} Edit & Incremental Find & Ctrl+J & Editing Text \\ |
Finally pdftex was called to generate the pdf file. The small project was developed on Eclipse Ganymede with Groovy plugin and Texlipse plugin. Everything worked like a charm.
In fact I tried quite a few other ways to get the tex code. First of all, I tried to write a package of classes that maps the latex objects, but quickly found out that the scope of the Latex is so big that this cannot be a single-weekend project. Then tried the groovy NodeBuilder, still seemed a lot of work for getting my small job done. Then, I tried to write a TexTemplateFactory, but encountered two problems. First, there were so incredibly many escapes in the inline template, the latex code did not look like latex code anymore, difficult to decipher. Second, how to write the conditional code for oddRow/evenRow in the GString? I must be missing something here. Anyway, the quickest solution is that first write a tex file as template and then simply groovy out all the tex code for row contents in another tex file (table.tex). In the template tex file, include the table.tex.
By the way, Compiz fusion is really cool, my hat off to the developers. It’s not just eye candy, but boosts my productivity. Who would want to go back to Windows or Mac, if she/he has ever tried out Compiz fusion?




I’m sorry for the inconvenience! I purged my file server a while ago and that file was dumped by mistake. I’ll upload it again when I find it but cannot tell when it will happen. Doing my best though.
-Ellen
The link http://www.ningning.org/sd/ide/eclipse-ganymede-keymap.pdf does not work anymore. Could you please reaupload the document?
Found the keymap here:
http://eclipse-tools.sourceforge.net/Keyboard_shortcuts_(3.0).pdf
Hello,
the download link isnt working anymore, can you fix it please ?
Kind regards for your work!
…
int[4] columnorder = new int[]{ 0,3,1,2 };
public int compare(List row1, List row2){
int step=0;
for (step=0;step value2)
{
return 1;
}
else if (value1 < valeu2)
{
return -1;
}
}
return 0;
}