Forum Controls
Spotlight Features

The Rich Engineering Heritage Behind Dependency Injection

Andrew McVeigh takes us on a tour of the rich heritage behind dependency injection, what it represents, and tells us why its here to stay.

NetBeans 6: Matisse Updates

NetBeans 6 delivers great updates to the Matisse GUI builder. Spend a few minutes with Roman Strobl and get an expert briefing on what's new and what has changed.

Introduction to Groovy Part 3

In this, the third and final installation of Andres' Introduction to Groovy series, you learn about how Groovy handles variable numbers of arguments, named parameters, currying, and more about Groovy operators. Including, some new operators.

Easier Custom Components with Swing Fuse

Swing Fuse (actually just Fuse), is a framework designed to make it easier to create your own custom desktop components. In this article, Daniel Spiewak shows you how to get started and provides sample source code you can download.

Benchmark Analysis: Guice vs Spring

Willam Louth shows how he uses JXInsight Probes to investigate probable performance issues with code bases that he is not familiar with. He also highlights possible pitfalls in creating a benchmark, as well as in the analysis of results.
Replies: 5 - Pages: 1  
Threads: [ Previous | Next ]
  Click to reply to this thread Reply

IntelliJ IDEA: Smart Line Join

At 10:20 AM on Mar 2, 2007, Rob Harwood DeveloperZone Top 100 wrote:

Here's a handy feature for those times when you want to clean up your code a little. When you want to condense two or more lines into one, you would normally use Home or End and then Delete or Backspace. But not all Java statements can be so easily combined, and joining lines manually can become a tedious time-waster. Thankfully, IntelliJ IDEA adds a little extra intelligence by providing the Smart Line Join editor command.

For example, when a String concatenation expression spans multiple lines, it can be a pain to delete the quotes and plus signs, but Smart Line Join will handle this with just one shortcut.

With the cursor on the first line, press Ctrl-Shift-J and the String literals on both lines are joined together, removing the redundant concatenation:

Likewise, when a declaration and initialization of the same variable are split onto two lines, they are quickly joined into one line.

Press Ctrl-Shift-J and the initialization is embedded into the declaration:

The Smart Line Join feature is also able to handle other not-so-simple joins, like joining several line-comments (//) joined into a single line-comment, etc.

1 . At 11:06 AM on Mar 2, 2007, James wrote:
  Click to reply to this thread Reply

Re: IntelliJ IDEA: Smart Line Join

Idea is really a great product. I've been using it for years and but was not aware of this stuff!
2 . At 11:30 AM on Mar 2, 2007, Rob Harwood DeveloperZone Top 100 wrote:
  Click to reply to this thread Reply

Re: IntelliJ IDEA: Smart Line Join

Hey, even I found an extra hidden feature in it just after I posted this tip: You can also select multiple lines and join them all into one line with this command. A minor addition to the basic functionality, but I can see it being quite useful to quickly clean up several lines at once.
3 . At 12:38 PM on Mar 2, 2007, Romain Guy DeveloperZone Top 100 wrote:
  Click to reply to this thread Reply

Re: IntelliJ IDEA: Smart Line Join

You can also do the opposite with Ctrl-Enter (if I remember correctly) which splits the line in a smart way.
Romain Guy
Romain Guy's Java Weblog, #ProgX, Jext
4 . At 1:04 PM on Mar 2, 2007, sumit kishore wrote:
  Click to reply to this thread Reply

Re: IntelliJ IDEA: Smart Line Join

> You can also do the opposite with Ctrl-Enter (if I
> remember correctly) which splits the line in a smart
> way.

I think you can do that with just an Enter. IDEA does the right thing the first time, just like iPod.

Is there a similar trick in Eclipse?
5 . At 5:45 PM on Mar 2, 2007, Yury Litvinenko wrote:
  Click to reply to this thread Reply

Re: IntelliJ IDEA: Smart Line Join

I'm not sure about line join, but smart split of Strings is performed in Eclipse by Enter

thread.rss_message