Posts Tagged ‘Productivity’

IntelliJ IDEA Productivity Tips. Part 1

Wednesday, October 31st, 2012

People unfamiliar with IntelliJ IDEA keep always asking me, why it’s better than other products. Today we have decided to make a short overview of some very basic features, that let developers be more productive every day.

In this episode we will show you some of the basic shortcuts for test-driven development. The video comes with transcription in subtitles. Check it out. See if you know and use all these basic features.


(more…)

Creating live templates from… templates

Tuesday, December 22nd, 2009

Sometimes I find myself writing repetitive code constructs without being able to extract common code due to Java syntax hmm… let’s call them peculiarities. ‘Sounds like a job for a live template’, I think, and I simply create it. Here’s how. The documentation has it too, but a good example never hurts.

Let’s suppose you have read/write synchronization in your project, and from time to time you need to wrap a bunch of statements in, say, a read action. This involves putting them into a Runnable and giving the latter to some runReadAction method. Do you still do this manually? You don’t need to, IntelliJ IDEA will help you!

First, find an existing code which already invokes the read action and select it:

Go to Tools menu and choose Save as Live Template there:

You’ll see a typical Edit Live Template dialog with the text you’ve selected. Note that all the class references are qualified there and Shorten FQ names checkbox is on, so the mentioned classes will remain the same no matter where you choose to insert it.

What we want to keep is the external syntax: the method call and the runnable. So remove everything inside the run() method braces and replace it with a $SELECTION$ on a single line. It means that you may select something and it’ll be wrapped in this particular construct.

Enter some abbreviation to easily invoke it each time, and some description (optional, but useful). Finally, the formatting looks not quite pretty, so turn on the Reformat according to style checkbox.

That’s all! Click OK and start using it. Find a fragment you want to wrap into a read-action, select it and invoke Surround With… action (Ctrl+Alt+T). You’ll see the read action template in the list:

Select it and the read action is in there:

Quick Lists to Group Your Favorite Actions

Thursday, October 1st, 2009

There’s a lot of useful actions in IntelliJ IDEA that don’t have shortcuts for many different reasons: they’re not used too often or there’s simply no more convenient key combinations left.

For example, I often want to get access to VCS actions like Compare with latest repository version or Revert current file or even submit a single file with a quick NPE fix without opening a menu or going to Changes view.

So how can I call any of these actions with a single shortcut? That’s really easy: I just need to define my own Quick List and map it to a shortcut (Control-X in my case). After I’ve done that, every time I press Control-X I will get a pop-up like this:

Quick List in action

Quick List in action

Now I can press 5 to quickly commit the current file or 2 to revert all my changes. OK, now let’s see how to create a Quick List and assign it a shortcut.

(more…)

Second Smart Completion for Array Elements

Sunday, April 19th, 2009

Do you use second smart completion feature? Did you know that it also can help you when you have an array and want an element of it? Just press Ctrl+Shift+Space two times when completing:

Create a Class Really Quickly

Tuesday, March 31st, 2009

To quickly create a new class I press Alt+Home and then Alt+Ins. And you?

Quick Create with Alt-Home Alt-Ins

Quick Navigation to Project Structure

Friday, March 27th, 2009

To change settings of a module that hosts the file you are currently editing, just press Alt+F1, 7 or open the View menu, select Select In and click Project Structure.



IntelliJ IDEA will open the Project Structure dialog and jump to the required module.



This action works for files from libraries and JDK, too, and is available in every view that lists files — Project View, Changes tool window and so on.