Locked History Actions

IntelliJ IDEA/EclipseUsers

IntelliJ IDEA Q&A for Eclipse Users

以下はhttp://www.jetbrains.com/idea/documentation/migration_faq.htmlの訳(予定)

Q: ワークスペースはどうなったの?私のプロジェクトはどこに?

A: 大丈夫。ちょっと違う方法なんだ。

IntelliJ IDEAはprojectを君が扱う「すべてのコードベース」として作成し、moduleを個々のコンポーネントとして作成する。だから、IntelliJ IDEAのmoduleは、Eclipseのプロジェクトのようなもので、projectはEclipseのワークスペースのようなものだ。ただし、君のすべての仕事の入っているEclipseのワークスペースとは完全に同じわけじゃない。複数のフレームを使って、複数のprojectを同時にオープンできるからね。(訳注:Eclipseでは、複数のワークスペースを同時にオープンすることはできない)。

次のテーブルはEclipseとIntelliJ IDEAのコンセプトをマップしたものだ。

Eclipse

IDEA

Workspace

Project

Project

Module

Project-specific JRE

Module JDK

User library

Global library

Classpath variable

Path variable

Project dependency

Module dependency

Library

Module library

Q: 私のEclipseプロジェクトはどうやったらオープンできるの?

A: 簡単だ。インポートするかリンクするかの方法があるよ。

IntelliJ IDEAはEclipseのクラスパスをサポートしている。だから、君のEclipseプロジェクトをIntelliJ IDEAにリンクすればいい。チーム内でIDEがまぜこぜであっても動作するよ。後方互換が不要ならば、EclipseプロジェクトをIntelliJ IDEAのネイティブフォーマットにインポートしてしまってもいい。もしMavenを使っているなら、pom.xmlを直接開けばIntelliJ IDEAは依存をインポートしてくれるし、ライブラリのダウンロードもしてくれる。セットアップは完全だ。

Q: ファセット(Facets)とは何ですか?

A: プロジェクトのコンフィギュレーションを効率化するものだよ。

ファセットはあらゆるフレームワーク、テクノロジー、言語のサポートをカプセル化するものだ。 例えば、君のプロジェクトでSpringを使いたいとしたら、単に関連するファセットを追加するだけだ。 すべてのライブラリがダウンロードされ、構成されるから、フルレンジのコーディングアシスタンスやリファクタリング等を得ることができる。 それどころか「コードモデル」も認識されるから、コンフィギュレーションに伴う問題から完全に開放されるんだ。

In most cases, you can add more than one facet of the same type to your project. For example, you can have multiple Web facets for deploying the application to different servers, or several EJB facets, each for its own EJB version. (See also Project Configuration.)

Q: Where do I configure project JDK?

A: In the Project Settings dialog.

To add a JDK to project, press Ctrl+Alt+Shift+S, under Platform Settings click JDKs and specify JDK path. After that, you can click Project and specify which of JDK you have configured is used in the current projects. Remember that JDKs are configured at IDE level, so when you create another project, you won't need to add the same JDK again.

Q: プロジェクトにファイルを追加するには?

A: 単純にプロジェクトフォルダにコピーしてくれ。

IntelliJ IDEAはプロジェクトファイルの変更を追跡しており、自動で適切なアクションをとる。

Q: How do I share my preferences?

A: Via project-level settings.

In IntelliJ IDEA you have a number of options for sharing code style settings, run configurations and inspection profiles by making them project-level, so that they are stored in the project description file and so are available to all team members.

You can also use settings synchronization via IntelliJ IDEA Server and take favorite settings with you to any computer where you're running IntelliJ IDEA. (See also IDE Settings Synchronization.)

Q: How do I configure code templates?

A: By using the Settings dialog.

In IntelliJ IDEA you have Live Templates — predefined code fragments invoked by typing an associated abbreviation. They may include parameters that are used to automatically adjust them to the insertion context. Click herefor more information about how to use the templates in code. To manage Live Templates, press Ctrl+Alt+S to open the Settings dialog, and then click Live Templates to add. (See also Code Generation.)

Q: How do I make sure all my files are saved?

A: Don't you worry. They are all saved automatically.

With IntelliJ IDEA you never need to worry about saving your files when you switch to another app, compile or run your code, perform a VCS operation, and so on. For extra safety you can enable auto save after specified period of time. In case you need to roll back any unwanted changes, you can use Local History — IntelliJ IDEA built-in VCS.

Q: What happened to incremental compilation? How do I compile my project?

A: It's there, but works slightly other way.

By default IntelliJ IDEA compiles files only when it's needed (when you run your app or explicily invoke the Make action), and so saves system resources for other tasks that can be more important at the moment. The compilation is incremental: IntelliJ IDEA keeps track of dependencies between source files and recompiles only if a file has been changed.

Files with compilation errors are highlighted, and so are the folders containing them — so you can easily analyze them via Project view. To see a list of all files with compilation errors, select Scope | Problems from the View As combobox of the Project view. After each compilation, IntelliJ IDEA constantly performs background code analysis on files with errors, and removes the red highlighting automatically when you've fixed them.

To enable compiling files on every save, you can use the EclipseMode plugin: http://plugins.intellij.net/plugin/?id=3822 (third-party development, not bundled).

To be able to run code with errors, you can select the Eclipse compiler in Settings dialog, Compiler, Java Compiler and add the -proceedOnError option to the Additional command line parameters for the compiler.

Q: What options are available for configuring code inspections?

A: IDE and project-level profiles, plus per-file inspection settings.

With IntelliJ IDEA you can define a set of active code inspections — a profile. IDE level profiles are available in all projects on current machine, project level profiles can be used by all team members. Here you can find some more information about inspecting the source code.

To configure inspection profiles either open the Settings dialog, or click the Hector icon in the toolbar.

You can also configure inspections individually — every time a bulb pops up, telling you about a problem, press Alt+Enter, Right Arrow to open menu where you can configure or suppress this inspection for the current file or even entire project.

Q: Where are my old favorite keyboard shortcuts?

A: Right here with you.

IntelliJ IDEA includes a bundled Eclipse keymap, so you can select it in Settings dialog, Keymap if you prefer using shortcuts you're accustomed to.

If you want to learn the IntelliJ IDEA keyboard shortcuts, you can read or print out the Default Keymap Reference from Help menu.

Q: I feel that the editor behaves differently. Am I right?

A: Yes, you are.

In Eclipse, virtual space (the possibility to place the caret after the end of a line) is disabled by default, which is contrary to IntelliJ IDEA default setting. To alter it, go to Settings dialog, Editor and clear the Allow placement of caret after end of line option.

By default Eclipse highlights the usages of the identifier at caret. To enable this behavior in IntelliJ IDEA, select Highlight usages of element at caret on in the same place as above.

Also note that there's a maximum number of editor tabs (adjustable via Settings dialog), so if you are opening a new file when a maximum number of editors is already reached, the oldest one will be automatically closed.

Q: Why there are three ways to invoke Code Completion?

A: Because there are different things to complete.

In IntelliJ IDEA you have three types of completion, that work differently so that you can always pick what's best for the code you're working with.

For example, when you just need to quickly complete an obvious statement, you can press Ctrl+Space and it's done. It's called Basic Completion. It also comes in handy when you want to look at the complete list of available choices in the current context, or need to complete a keyword.

If you need more precision and don't want to scroll through an endless list of selections, use Ctrl+Shift+Space to narrow the selection down by the expression type. Smart Completion that is invoked this way will filter the list for you, letting you get what you need quicker. Moreover, if you press it once again it will even show you the symbols that can be reached through a chained method call.

Finally, the Class Names Completion (Ctrl+Alt+Space) lets you quickly complete a class name, and insert an import statement if it's not referenced yet. (See also Intelligent Coding Assistance.)

Q: How do I configure VCS integrations? How do I add my project to VCS?

A: Via Settings dialog, Version Control.

In IntelliJ IDEA you first configure a VCS by selecting its type and specifying the connection settings like server name and access credentials, and then map project folders to VCS you have configured.

To add an project to a VCS, simply map its root folder to that VCS.

Q: How do I work with VCS? Where to inspect the diffs?

A: In a dedicated Changes view.

In Eclipse you have Sync perspective that shows the difference between your local version of the code and that of VCS server. In IntelliJ IDEA this functionality is a small part of Changes view, where you have the Local tab shows the changes you've done locally, the Incoming tab shows the changes that were checked in to the VCS server by other team members and not yet synced, and so on.

To enable incoming changes tracking, you need to go to Changes, open Incoming tab, click Refresh button and specify the cache settings.

Q: How do I check out a project from VCS?

A: From the Welcome screen.

It's the easiest way of creating a project from sources that you're checking out from VCS. Just click Check out from Version Control.