7

I have been using Eclipse for a long time, the feature that is less known but very useful is the Scrapbook Page, that allows you to execute sections of the Java code without having them to be complete classes. For example, if I need to execute this simple for-loop I can do this by creating a scrap page (File->New->Other->Scrapbook Page) and then typing the following and they pressing the "Execute the Selected Text" or Ctrl-U will execute the code directly

for (int i=0; i < 10; ++i)
{
    System.out.println("Here is the scrapbook page line: " + i);
}

Please post other less known but useful features that are available with eclipse. I know that there are entries in SO that mention the useful shortcuts available in eclipse, however this one is about forgotten or less known features

Prabhu R
  • 13,836
  • 21
  • 78
  • 112

2 Answers2

7

The plugin Spy (Alt+Shift+F1) is certainly one not very advertised.
Yet if you have any question about "how I develop a feature X looking like the one in eclipse", it can be very useful to quickly locate the right eclipse java source which does implement that feature!

alt text
(source: willianmitsuda.com)

See also this Guide to eclipse3.5:

The Plugin Spy gives you easily information about the running UI.
Press Alt+Shift+F1 to get information about the current running Eclipse plugin / data types / screen.
This way you can get immediately access to the plugin which is currently running.

alt text
(source: vogella.de)

Eclipse 3.5 introduced the possibility to check which plugin contributed a menu. Press "Alt+Shift+F2" and select a menu to see who is contributing this menu

alt text
(source: vogella.de)

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Very interesting. But I cant manage to activate it :(. [Version: Helios Service Release 1, Build id: 20100917-0705], OSX. Anybody know how? Tried all the modifier combinations I could think of. – Jonas N Oct 04 '12 at 16:18
  • @JonasN try command shift L to see if any shortcut exists referencing the PlugIn Spy. It depends on the context though. – VonC Oct 04 '12 at 16:45
  • Searched bindings for '[p]lug' and 'spy', found ⇧⌥F3 (Shift-Alt-F3): Show Plug-in Contributor. Not as cool though... – Jonas N Oct 04 '12 at 17:05
  • @JonasN is this linked to https://bugs.eclipse.org/bugs/show_bug.cgi?id=227949#c21 ? – VonC Oct 04 '12 at 17:53
  • I don't know. Problem seems to be I can't find any "Plugin Spy" in "Keys" preference. – Jonas N Oct 04 '12 at 18:56
  • @JonasN which eclipse do you have: there are many "packages" available for Helios: http://www.eclipse.org/downloads/moreinfo/compare.php, more precisely: http://www.eclipse.org/downloads/packages/release/helios/sr2 (can you check also if the issue persists with Indigo or the latest Juno?) – VonC Oct 04 '12 at 20:14
  • Aha, are you saying that the 'Spy' shortcut comes with some sort of Eclipse-developer package? That makes sense. -- Trying the Alt-Shift-F1 (Scout's salute, middle finger barely reaches F1, phew) in a Juno installation I have but don't use (Juno Release, Build id: 20120614-1722). It seems to work there, although not always, but that's probably me not understanding exactly what GUI elements that can be inspected. Anyhow, I can now find the OpenTypeSelectionDialog that I am interested in, and perhaps find out why it's getting slow. – Jonas N Oct 05 '12 at 16:26
  • Oh, and the Eclipse where it seems not to work: Helios Service Release 1, Build id: 20100917-0705 – Jonas N Oct 05 '12 at 16:33
  • @Jonas Indeed, the availability of this feature is both a question of "distro" (or "package"), and a question of context within the application. – VonC Oct 05 '12 at 20:15
1

I like the fact, that you don't necessarily need to create a new class by using New->Class, when having the class source somewhere in the clipboard. You can simply select the destination package and paste the clipboard content.