Friday, September 29, 2006

OK, so editing JSPs is slow (it's worse in Eclipse).

This will help a little:

Settings -> Editor. In the Virtual Space box, uncheck Allow placement of caret after end of line.

Now edit a JSP, and click somewhere far to the right, well after the last char: your cursor will appear right after the last char!

That's better than in the white space, from which you have to jerkily left-arrow repeatedly to get to the same place.
What to javadoc: the setter, the getter, or the private var?

Solution: the private var. Then to the setter and getter empty javadocs, add @see for the private var.

Now, if you Ctrl-Q the getter or setter, you can click the link under "See also", and the private var's javadoc appears.
Want to see a Javadoc fast?

Click on any method, var, class, etc, and press Ctrl-Q.
Tired of having to turn linked Ant tasks on and off, depending on what you are doing?

So am I.

Vote for my issue:
Tired of having to close panels?

For example, you double-click a line in the Find panel, and the cursor jumps to the main text window -- but the Find panel is still hogging half the screen, and you have to close it manually (or do Ctrl-F12)?

Click the Undock icon of an open panel (top right corner, hover over the icons for the tooltip that says "Undock"). Now, whenever the focus leaves the panel, it will automatically close.

To reopen, press Alt and the underlined number in the panel's tab.
Ctrl-B works in Javadocs too: if you see eg {@link MyClass#foo}, Ctrl-B on MyClass#foo will take you to it.
Files change color in the Project panel as you use Perforce, but what do the colors mean?

Actually, that's undocumented in 5.1. Here's their meaning:

  • Deleted
  • Modified
  • Added
  • Merged
  • Merged with conflicts
  • Deleted from file system
  • Ignored
  • Unknown
In version 6 you can change these colors, but not in 5.1.
Highlight all occurrences of a variable or method: do Ctrl+Shift+F7 while the cursor is in it.

To turn off the highlighting, press Esc.

This feature actually has two "modes".

If you press Alt-F7 with:
  • a method, class, or variable unselected, cursor in it:
    • then all occurrences of in the current scope are highlighted.
    • If a variable, then any initializations are highlighted in a different color (so you can see where the variable's value is getting set).
  • method, class,variable, String literal, or xml element/attribute etc selected :
    • any occurrence of that text in the file, regardless of scope, is highlighted, even text in comment blocks or String literals.

Why? Since highlighted text accumulates until you hit "Esc" to clear all highlighted text from the buffer, IntelliJ uses different colors to distinguish between "highlight this symbol in scope" and "highlight any matching text in file" modes.

Both of these modes will put markers in the right-hand gutter to to show you at a glance wherever these occurrences may be.
Alt-F7 shows occurrences in the whole project, but you just want them in the current file? Or package? Or...? Note the Scope menu in the Alt-F7 dialog: just choose your search scope.

For a single file, Ctrl-F followed by Alt-A (find all) is usually faster: it will show a nice list of all occurrences.
This is a little slow, but try: Ctrl+Shift+Alt+N, then type the name of a method or variable. IntelliJ will show you all occurrences of it!
Keep landing in an interface when you Ctrl+B a method? Use Ctrl+Shift+B instead. And in an interface, this will also pop up a menu of all implementations.

Thursday, September 28, 2006

Expand/collapse editing window: Ctrl+Shift+F12. You may have to press Esc first, which always returns focus to the frontmost editing window.
What are those underlined numbers in every panel's tab? Hold down alt, then type the number to expand that panel.
Collapse and expand in JSP, Java, Xml, anything: do Ctrl+Numpad + or Ctrl+Numpad -. Want more? Right-click and select Folding from the menu.
Quickly create getters and/or setters: click where you want them, then press Alt-Insert.
Get an HTML outline of your JSP: click the Structure panel on the left, then click the HTML tab. Click any element to jump to it.
Open a JSP, then open the Structure panel on the left. The tree of all jsp (incl. struts) and jstl tags appears, making it easy, say, to jump to the Barges section of the SDV.
In a JSP tag like , click on eg foo, and do ctrl-Q. You will get a tool-tip explaining what the !@#% foo is for -- assuming, that is, that someone added that info to the .tld file (I always do).
Close windows in one click by shift-clicking their tab. Or do ctrl-F4 from the keyboard.
Note: the RSS feed of this blog is updated every 30 minutes.