Using Rich-Text Copy in IntelliJ IDEA 14.1

IntelliJ IDEA 14 added built-in support (without additional plugins required) for copying text to external rich-text editors such as MS Word, OpenOffice Writer, Gmail, etc. allowing for preserving formatting.

IntelliJ IDEA 14.1 makes it more flexible, allowing you to choose when to use this feature. You can choose to enable this behaviour by default when using the standard Copy action. All that’s need is to enable the following checkbox in Settings:

richTextCopy

With this enabled, if you want the old behaviour of standard copy (i.e. with no additional formatting)
you can use a separate action (Copy as Plain Text or Copy as Rich Text) from the Edit Menu entry or the editor’s context menu:

copyAsAction

These actions do not have default shortcuts assigned, but you define them in Keymap settings if you find yourselves using one of them often.

Try this and other enhancements by downloading IntelliJ IDEA 14.1 EAP build. Share your feedback on the discussion forum and in our issue tracker. Thanks!

Posted in EAP Releases, New Features, Tips & Tricks | Tagged , | 1 Comment

IntelliJ IDEA 14.1 EAP 140.2285.5 is Out

Today we have published a new IDEA 14.1 EAP build. It fixes many bugs found in the first EAP build and also includes new features and improvements. In particular it supports automatic setup of GWT facets for projects imported from Gradle and allows you to view differences in a more compact form:

Compact Diff Viewer

If you experience any problems or want to suggest a new feature, feel free to write to our discussion forum or file issues directly to the issue tracker.

Posted in EAP Releases, New Features | Tagged , | 11 Comments

Interview with Tor Norbye: the Present and the Future of Developer Tools for Android

Two months ago Google rolled out Android Studio, their brand new IDE for Android developers. The new IDE, built on top of IntelliJ IDEA Community Edition, has replaced ADT, a plugin for Eclipse, changing “developer experience” for millions of Android developers. As a member of the IntelliJ IDEA crew, I couldn’t miss a chance to discuss this “small revolution” with one of the Googlers behind it – meet Tor Norbye.

tor-photoAndrey: Before joining the ADT team at Google, where you’re working with Eclipse, you’ve also had quite a lot of experience with NetBeans at Sun Microsystems. I’m sure you know a lot about building tools for developers. Right now you’re working on Android Studio, a new IDE designed for Android developers, which is based on IntelliJ IDEA Community Edition.

Tor: That’s right – I’ve worked on developer tools for the last twenty years!

Andrey: Can you please share your impressions of Android Studio: what do you like about it, and what do you think makes it special and different from Eclipse and other IDEs? And, of course, we’d all like to hear your version of why IntelliJ IDEA became the final choice for building Android Studio on?

Continue reading

Posted in Interviews | Tagged , , , | 9 Comments

IntelliJ IDEA 14.1 Introduces Extract Functional Parameter Refactoring

              Extract Surrounding Method: You have two methods that contain nearly identical code. The variance is in the middle of the method. Extract the duplication into a method that accepts a block and yields back to the caller to execute the unique code.

Jay Fields, Shane Harvie

In Java, if we want to replace a block inside a method, the block should have a ‘known shape’ for surrounding code to be able to call it. Let’s perform a code transformation with the following example, step by step:

  1. Call Extract Method from the block to see the signature (make sure you cancel it afterwards). In our case the signature is  (int i) -> void

  1. Find an interface I, which could be implemented with this method

In our case, java.util.function.Consumer<Integer> with a shape (Integer) -> void will do.

  1. Wrap the code block with an anonymous class based on I:

  1. Extract the anonymous class as parameter.

The result will be:

Now we can pass different implementations of I to the surrounding method, though everything else remains the same. The only tricky part here is to find the interface I. This is how the new Extract Functional Parameter refactoring was born.

When you call this refactoring, it asks you to choose one of the available applicable functional interfaces, and then performs the rest automatically:

Screen Shot 2015-01-23 at 11.55.56.png

With the introduction of lambdas and method references, many functional interfaces were added. To distinguish them from sporadic single-method interfaces that could evolve, IntelliJ IDEA requires them to be marked with @FunctionalInterface or belong to well-known libraries (e.g. Guava, Apache Collections, etc.).

Extract Functional Parameter is already available in IntelliJ IDEA 14.1 EAP. Do give it a try and tell us what you think. Share your feedback on the discussion forum and in our issue tracker.

Develop with Pleasure!

Posted in EAP Releases, New Features | Tagged , | 5 Comments

Java Annotated Monthly – February 2015

In February’s edition of the Java Annotated, we’ll cover the latest JVM research, new developments from GWT and resources for mobile developers. On the Java Annotated Monthly, we travel far and wide to bring you the latest news from around the Java community. If you are interested in contributing, or would like to continue reading these stories in the future, let us know! Thanks for reading, and develop with pleasure.

jam_pic

Continue reading

Posted in News & Events | 5 Comments

Extract Method Refactoring Improved in IntelliJ IDEA 14.1

<Extract method refactoring> turns a fragment into a method whose name explains the purpose of the method.

Martin Fowler

When we select a block of code, IntelliJ IDEA’s data flow analysis engine is able to deduce all local variables and parameters that are used inside, but are declared outside of it. These variables form the initial set from which a parameter list of the extracted method is be constructed:

Initial set is {i}, and the extracted method will have a signature such as newMethod(int i) .

So far, so good. Now, what if some parameters are always grouped together inside the code block?

We could derive a new parameter set {str} from an initial one {args, i}, where str = args[i]. IntelliJ IDEA does this under the hood, and the resulting set is configurable via the “Fold parameters” check-box:

extract_refactoring

The same result may be achieved by following these steps:

  1. Extract the method with parameters (args, i).

  2. Apply “Extract parameter” to args[i], accept the suggestion to replace all occurrences, and delete the unused parameters args and i.

These exact steps (possibly in reverse order) are performed on replacing duplicates when the initial selection does not contain the necessary variables:

At first step the selection is replaced with a newMethod() call, whose initial parameter set is empty. Then after “Hello, ” string is extracted as a parameter, the remaining line System.out.println(“World”) may be replaced with the newMethod(“World”) call.

This observation was inspiring. What if IntelliJ IDEA could do it automatically in the same way it detects that parameters could be folded together? You asked and we’ve delivered: IntelliJ IDEA 14.1 EAP detects duplicates in the code that may accept different values as parameters and shows this suggestion:

Continue reading

Posted in EAP Releases, New Features | Tagged , | Leave a comment

Simultaneous Tag Editing in IntelliJ IDEA 14.1

If you’re involved in web development and, for some reason, you haven’t given a ride to IntelliJ IDEA 14.1 yet, this will talk you into doing it right away.

Has it happened to you that you changed an HTML or an XML tag in your code and broke it because of forgetting to change both the opening and the closing tag? Of course it has, it happens once in a while time and drives you really crazy. That’s why we let IntelliJ IDEA provide a little bit of a help with this:

simultaneous_tag_editing_2

The new option is called Simultaneous <tag></tag> editing and is available in Preferences/SettingsEditorGeneralSmart Keys. We hope this small enhancement will make your everyday life easier.

Don’t forget to write back to us in our discussion forum and to the issue tracker to share your feedback on this feature.

Develop with Pleasure!

Posted in New Features | Tagged , , , | 7 Comments

Debug Decompiled Code with IntelliJ IDEA 14.1

Earlier this week we’ve announced the start of IntelliJ IDEA 14.1 EAP. Among the new features available in the preview build, this one you’re going to especially like: the built-in decompiler (introduced in IntelliJ IDEA 14) now has debugging capabilities.

This means that now you can use breakpoints anywhere in the decompiled code, with almost the same experience that you’d normally have when debugging with actual sources:

decompiler_and_debugger

With IntelliJ IDEA 14.1 missing library sources is not a problem anymore, well, provided that it comes with the line number attributes.

Download the EAP build right away and tell us what you think in our discussion forum, or, in case you find a bug, in the issue tracker.

Develop with Pleasure!

Posted in EAP Releases, New Features | Tagged , | 4 Comments

IntelliJ IDEA Workshop at The JetBrains BASH – Belfast, February 16th

The afternoon of February 16th, we will be holding an IntelliJ IDEA workshop with Hadi Hariri at The MAC in Belfast.

The JetBrains BASH

In this workshop we’ll discover how to work effectively with IntelliJ IDEA. Get first-hand tips and tricks and learn to be more productive, all while seeing the hottest new features in action. There will be plenty of time for your questions and conversation.

For more information and to register for the workshop, email enquiries@instil.co with your name and address. To cover expenses a £25 fee will be charged at the door and for corporate bookings an invoice can be made.

In the evening there will be a free and open talk for all with Hadi. He will share his thoughts on developing for developers, what makes for a killer IDE and how to continuously roll out new products and the challenges around it. The evening will be very informal with plenty of time reserved for questions and conversation.

Workshop attendees are guaranteed a place at the evening event and the remaining spots are first come, first served. To register now for the evening event only, click on the link “Join and RSVP” from The BASH meetup page. Act fast or miss out!

Posted in News & Events | Tagged , , | Leave a comment

IntelliJ IDEA 14.1 EAP is Available!

Great news, everyone! It’s time to reveal what we’ve been working on since December and what new features the next update will bring to you. Today we’re officially announcing the start of IntelliJ IDEA 14.1 EAP (Early Access Program), which means you can not only see the list of new features, but also give them a try and share your feedback!

The following new features are available in the current EAP build:

Quite a list this is, and more is to come yet! Stay tuned and read our blog for more details on these and other new features.

Download the IntelliJ IDEA 14.1 EAP build right away, and share your feedback with us at the discussion forum and in our issue tracker. We’re eager to know what you think!

Develop with pleasure, and spread the word!

Posted in EAP Releases, New Features | Tagged , | 35 Comments