09.06.07

difficult choices

Posted in Hacking at 5:03 pm by ducky

I’m working on making a version of Eclipse that has different tabbing behaviour. If someone does the following in the PackageExplorer, I want the following to happen:

  • double click on file – open file in the same tab
  • single click on file – deselect (dehighlight) previously selected files, select (highlight) that file
  • shift-control-click – deselect previously selected files, select the file, and open it in a new tab
  • control-click – add file to selected files

Right now, I can’t get both control-click and shift-control click working this way. Either I don’t get control-click at all, or shift-control-click adds the clicked-upon file to the selection list. The latter is not only visually wrong, but causes problems — when I try to open the selection, it opens ALL the selected (highlighted) files.

I can instead tell Eclipse that the PackageExplorer doesn’t support multi-select, in which case control-click will act just like a single click.

I went looking for where the control+click is examined, to put in a line that says “if shift is down, do a single selection and not a multi-selection”. Unfortunately, I had to go all the way down into the bowels of GTK. It looks like the place I want is in gtktreeview.c, in gtk_tree_view_button_press(), in the vicinity of line 2573 in GTK+-2.10 (which is probably not the exact same version as is in the Eclipse I’m running).

Now I have a dilemma. Do I go through the pain and agony of building my own GTK, then building my own Eclipse, in order to get the “right” behaviour? Or do I bail and give up the control-click multiple-selection functionality?

Neither. I go home and think about it.

Comments are closed.