Eclipse FAQ

From IntelliJ-Wiki

Jump to: navigation, search


What happened to my Workspace? Where are all my projects?

They're OK, but in a slightly different way.

IntelliJ IDEA creates a project for the entire code base you work with, and a module for each of its individual components. So, IntelliJ IDEA module is more like an Eclipse project, and project is roughly similar to Eclipse workspace. There's no exact equivalent to Eclipse's workspace that contains all your work, but you can open multiple projects in multiple frames at the same time.

This table can help you see how Eclipse and IntelliJ IDEA concepts map to each other:

Eclipse IntelliJ IDEA
A number of projects, a workspace Project
Project Module
User library Global library
Classpath variable Path variable
Project dependency Module dependency
Library Module library

How do I open my Eclipse projects now?

That's very easy. You have an option to either import, or link them.

IntelliJ IDEA supports Eclipse classpath module dependencies, so you can link your Eclipse projects to IntelliJ IDEA and work even in a mixed IDE team. Alternatively, you can import an Eclipse project to IntelliJ IDEA native format if you don't need any backward compatibility. If you're using Maven, you can directly open a pom.xml file and IntelliJ IDEA will import all dependencies, download the libraries if needed, and do all the setup completely.

Facets — what they are for?

To streamline the project configuration.

Facets encapsulate support for a variety of frameworks, technologies and languages. For example, to enable Spring in your project, you only have to add the corresponding facet. All libraries are downloaded and configured, you get the full range of coding assistance, refactorings, etc. Moreover, the code model is also recognized, so you are completely free from worrying about any configuration issues.

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 and Configuring Project Structure.)

Where do I configure project JDK?

In the Project Structure dialog.

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

Refer to Configuring Project SDKfor details.

How do I add files to my project?

Just copy them to the project folder. IntelliJ IDEA tracks all changes to project files and automatically takes an appropriate action.

How do I share my preferences?

Via project-level settings.

IntelliJ IDEA enables you share your code style settings, run configurations, inspection profiles, and more, 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.)

How do I configure code templates ?

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 here for more information about how to use the templates in code. To manage Live Templates, press Ctrl+Alt+S to open the Settings dialog, and under the IDE Settings, click Live Templates. (See also Code Generation.)

How do I make sure all my files are saved?

Don't 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. Refer to the section Saving and Reverting Changes for details.

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.

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

It's there, but works slightly other way.

By default, IntelliJ IDEA compiles files only "when asked". That is, to compile your project, you should use the Make, Compile or Rebuild command from the Build menu. Similarly, when you run your app and the corresponding run configuration has the Make option in its Before launch task list, your project will also be compiled.

The compilation is almost always incremental. That is, when you use Build | Make or Build | Compile, or run your app, only the changes are compiled. However, in the case of Build | Rebuild Project, your entire project is totally recompiled.

Files with compilation errors are highlighted, and so are the folders containing them. So you can easily analyze them in the Project tool window.

To see a list of all files with compilation errors, click Project on the title bar of the Project tool window and, under Scopes, select Problems. The other alternative is to use the Problems tool window (View | Tool Windows | Problems).

IntelliJ IDEA constantly performs background code analysis on files with errors, and removes the red highlighting automatically when you've fixed them.

You can enable automatic compilation on every save (or autosave). To do that, turn on the Make project automatically option on the Compiler page in the Settings / Preferences dialog (File | Settings | Compiler on Windows or Linux, or IntelliJ IDEA | Preferences | Compiler on Mac OS X).

To be able to run code with errors, you should select the Eclipse compiler and turn on the Proceed on errors option on the Compiler | Java Compiler page in the Settings / Preferences dialog. You should also make sure that the Make, no error check option (rather than the Make option) is included in the Before launch task list for the corresponding run configuration.

Which options are available for configuring code inspections?

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.

Where are my old favorite keyboard shortcuts?

IntelliJ IDEA includes a bundled Eclipse keymap, so you can select it in the Keymap page of the Settings dialog, 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.

Refer to the Configuring Keyboard Shortcuts section for additional information.

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

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 the Editor page of the Settings dialog, 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 the option 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.

Why are there three ways to invoke Code Completion?

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.)

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

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 put a project under version control, simply map its root folder to the VCS you are using.

Refer to the section Enabling Version Control for details.

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

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 the Changes tool window, where 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 learn how to work with differences in IntelliJ IDEA, refer to the section Handling Differences.

How do I check out a project from VCS?

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.

Related links.

Personal tools