Thursday, December 07, 2006

What method am I in? Do Alt-Q to find out.

Tuesday, November 21, 2006

Camelback shortcuts: Let's say you have a class named DealCommitmentTypeBuilder. Sure, you can type the beginning and then do ctrl-space or ctrl-shift-space to get the name to pop up.

But did you know you can just type DCTB and ctrl-(shift)-space? Just type the capital letters.

Bonus tip: this works in the Ctrl-N and Ctrl-Shift-N windows as well.

Wednesday, November 15, 2006

What's the difference between Make and Rebuild? Answer: it's a known unknown, and the documentation is wrong: see this bug.
Change a Perfoce comment without submitting the changelist! Right-click on it and select Rename Changelist. (I've already filed a bug with IDEA to rename that command Modify Changelist.)

Tuesday, October 31, 2006

Tired of the 80-character margin?
  • File -> Settings -> Project Code Style -> General Tab
  • At bottom left there's a Right Margin (columns) box: just type in a bigger number.
Maintain multiple search results!

When you do Ctrl-F, or Alt-F7, or any search, look on the right for a small checkbox "Open in new tab." It will be grayed out on the first search, but not on subsequent searches.

If you check it, each new search will appear in its own tab instead of overwriting the previous search results!

Thursday, October 12, 2006

Project tree always expanded? That's irritating. Click the right-most icon atop the Project panel to collapse all the trees.

Monday, October 02, 2006

Ctrl+Q. Do it often, do it everywhere:

It brings up the Javadoc, nicely formatted -- and with clickable links.

Javadoc not available? So just download the jar with the relevant Javadoc, and add it to one of your libraries.

Here's an example. Assume you have struts.jar in a library (a library is just a named collection of jars, which can contain source code, binary code, or javadocs).
  • File->Settings->Modules
  • Click on your module in the left pane.
  • Click Libraries (Classpath).
  • Click on the library in the left pane which contains struts.jar.
  • Click Edit.
  • Click either Attach Javadoc... (if you've downloaded it (you need to unzip it)), or Specify Javadoc URL.. if you just have an url of it on the Web.
Voila: after doing this, Ctrl-Q will bring up the javadoc of any method, class, var, what-have-you.

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.