Intellj Idea Usage Guide

Source: Internet
Author: User

have been accustomed to using eclipse, just beginning to contact IDEAIU there will always be a lot of unaccustomed places, but the use of more than two weeks of time, found that the development tool development efficiency is much higher than eclipse, really do the liberation of hands, the amount ~ wrong, is the liberation of the mouse. should be Wang Dashin requirements, here to make a strategy (some things are I use, there are many not commonly used to be learned to sell), I hope interested students can try, really good yo ~

1. What does idea look like? Directly above the picture.


Idea said goodbye to Eclipse's single-theme era, with the high-force black theme cool to No friends, but also to protect the eyes, of course, the theme is not the only one. If your installation succeeds and the white theme is the default, then you can modify it like this:

---> Toolbar wrench icon or open the Settings window with Ctrl+alt+s, on the left side of the open window, find appearance>theme select Darcula Theme App


Attention: If there is a garbled Chinese language should be changed:

---àappearance>overridedefault fonts by (not recommended) Check the Name drop-down box below this time to find the optional status name:dialoginput.plain-size : 12 Application is OK


2. How to install, please own Baidu. (You should take the first step, but for the sake of visualization, take the second step.)

3. How to create a project and use it.


The small partners clearly see the option to create project, but here project and Eclipse are different, similar to the workspace in Eclipse, which is the working space. This is exactly what it looks like (see picture). Click to see a lot of options, select the first Java, and then choose the Web Application,next under Java EE. Here my work space is called JSD1504. While creating workspaces, click the box below to create the first project.



Long like this (module is what.) Right now, just click Finish to create the OK.



Then it pops up this dialog box, ideaiu a workspace, and clicking this window will hide the current workspace. When you need to open more than one workspace, click New Window. And then grow like this ↓↓


In the front we create another project called Laowang, and then create a project called Laozheng below. File->new->module ... Note that this guy (Module) is the same as project under Eclipse.


The same as the above to choose the Web application, renamed OK, under the JSD1504 there are two projects


At this point, the project is created over.

4. Actual development

① Creating a first class



Once you've created your class, you're writing code, and here's where the focus begins: the use of shortcut keys and the smart hints of code, which is the key to idea freeing the mouse.

We use an example to refer to frequently used shortcut keys and smart hints:

② Smart tips:

1) Instant generation (example: Eclipse inside Main and SYSO)

A) The following figure appears PSVM is the public static void main full spell sout is a shortcut to System.out.println (), and then click Enter or tab to automatically generate. The rest of me will not be tired of the statement. A separate list will be described later.


Automatic naming: As long as the first letter of the class can be prompted to establish a reference name, and then long class names are not afraid of, this is the automatic hint, if there is no automatic prompt, this time how to do it. You'll be prompted with a shortcut key later.

Of course we can do that. ↓, smart tips really smart to No, all the keywords, including the parameters you write, classes are can be prompted. So, I ask you to be very inefficient.


b) One step, in the development of the class and interface between the conversion is also very inconvenient. Ever since the idea was used, there's no need to worry about finding a problem. Tips are in place


Click on the green little thing in the picture and go to his interface. After you return, click on the button in the same place on the interface.

③ only shortcut keys (this is great, but too much too good, I can only copy and then organize), shortcut keys I knock you also can't see, so you have to follow the instructions of the shortcut keys to know.

a) If you don't have your own smart tips, then you do it ↓

Basic code hints with Ctrl+space, and more intelligently ctrl+shift+space by type information. Move to the wrong code with F2/SHIFT+F2, Alt+enter quick fix (that is, the quick fix feature in Eclipse ctrl+1). When the smart prompt for our auto-completion method name, we usually have to make up the end of the back bracket and semicolon, when the parentheses nesting many layers will be very troublesome, when we just knock Ctrl+shift+enter can automatically fill the end of the character. And not just parentheses, for example, you can automatically fill in {} curly braces when you finish if/for.

Finally, idea is able to intelligently perceive the profiles and classes of mainstream frameworks such as spring, hibernate, and statically brake to intelligently scan and understand how your project is structured and configured under seemingly "static" appearances.

b) refactoring

Idea Refactoring is another burst of eclipse's ability to be incredibly intelligent, such as automatically checking for all matches and extracting them as a variable when extracting variables. In particular, after seeing refactoring-improving existing code design, having idea is a big call. It is also the powerful intelligence and refactoring capabilities that make TDD development very smooth under idea.

Cut to the chase, first say an invincible refactoring function big Summary shortcut key ctrl+shift+alt+t, called refactor this. The method is a bit complicated, but it also conforms to the idea style, a lot of shortcuts have to be done with both hands, and unlike many of Eclipse's most useful shortcuts can be a single hand to complete (do not know that is a big advantage of Eclipse). In addition, there are some of the most commonly used refactoring techniques, because it is too often used, if you choose the Refactor this menu is a bit inefficient. For example Shift+f6 is renamed directly, CTRL+ALT+V is the extraction variable.

c) Code generation

This is similar to eclipse, although not unique, but because of the frequency of daily use is very high, so it is listed in front of the list. Fori/sout/psvm+tab can be used to generate loops, System.out, main methods, such as boilerplate boilerplate code, with ctrl+j to view all templates. In the "Auxiliary" section later, you'll talk about Alt+insert, which you can click in the edit window to generate constructors, toString, Getter/setter, override parent methods, and so on. These two techniques are too common to generate a bunch of main, System.out, and Getter/setter almost every day.

In addition, the suffix auto-completion feature (Postfix completion) is added to Idea idea 13, which is more flexible and powerful than template generation. For example, to enter a for (User user:users), simply enter User.for+tab. For example, to enter date birthday = User.getbirthday (), just enter User.getbirthday (). Var+tab.

d) Edit

The editor has to say that a big God key is the ability to automatically check the code by the syntax of the ctrl+w and reverse ctrl+shift+w. In addition, Ctrl+left/right moves the cursor to the front/rear word, ctrl+[/] moves to the front/back code block, these types of vim-style cursor movement is also a big highlight. Above ctrl+left/right/[] plus shift, you can select the code within the jump range. Alt+forward/backward move to the front/rear method. There are some very common like ctrl+y delete rows, ctrl+d copy lines, ctrl+</> folding code is not much to say.

With regard to cursor movement and a little bit more, we can install Ideavim or Emacsideas to enjoy the fast movement of vim and the Acejump function of Emacs (super Cool), in addition to the functions provided by idea itself. )。 In addition, the bookmark function of idea is also good, define 1-10 bookmarks with ctrl+shift+num (Press this group shortcut again to delete bookmark), then jump through Ctrl+num. This avoids the hassle of using the front/next edit location Ctrl+left/right to jump back and forth, and this shortcut will default to Windows Hotkey conflict (default is more ALT, and Windows changes the display direction of the display conflict, accidentally the display becomes inverted explicit, 冏 AH).

e) Find open

Eclipse,idea-like ctrl+n/ctrl+shift+n can open classes or resources, but idea is smarter, and any characters we enter will be considered fuzzy matches, eliminating the hassle of having input * in eclipse. The latest version of Idea also includes the Searcheverywhere feature, which simply presses shift+shift to search for anything in a pop-up box, including classes, resources, configuration items, methods, and so on.

The inheritance of the class can be ctrl+h open the Class hierarchy window, jumps on the inheritance level with ctrl+b/ctrl+alt+b respectively corresponding to the parent class or the parent method definition and subclass or child method implementation, view all methods of the current class with CTRL+F12.

It is also very simple to find the use of a class or method, Alt+f7. To find where the text appears, use Ctrl+f/ctrl+shift+f to find it in the current window or the whole project, and then move to the next match before and after the F3/SHIFT+F3.

Another proof of idea's intelligence is that in any menu or display window, you can directly enter the word you are looking for, and idea will automatically filter for you.

f) Other auxiliary

Above these divine keys with some auxiliary shortcut keys, you can let your hands more than 90% of the time to get rid of the mouse, focus on the keyboard as if performing a piano. These obscure but crucial pieces of the last puzzle are:

Ø command: Ctrl+shift+a can find commands for all idea, and there are shortcut keys behind each command. So it's not just a big divine key, it's also a tool for finding learning shortcuts.

Ø NEW: Alt+insert can create new classes, methods, and anything else.

Ø Format code: Format Import list ctrl+alt+o, format code ctrl+alt+l.

Ø Switch window: alt+num, commonly used there are 1-project structure, 3-search results, 4/5-run debugging. Ctrl+tab Toggle Tabs, Ctrl+e/ctrl+shift+e Open recently opened or edited files.

Ø Unit Test: ctrl+alt+t Create unit Test cases.

Ø Run: ALT+SHIFT+F10 Run program, shift+f9 start debugging, Ctrl+f2 stop.

Ø Commissioning: f7/f8/f9 for Step into,step over,continue respectively.

In addition to some of my custom, such as horizontal split screen ctrl+|, and some magical small features ctrl+shift+v paste has been copied long ago, alt+shift+insert into the column mode to select by column.

7 Final List

The list is so luxurious that the latter are so useful that they are not in the slightest weakness.

Øtop #10切来切去: Ctrl+tab

Øtop #9选你所想: Ctrl+w

Øtop #8代码生成: Template/postfix +tab

Øtop #7发号施令: Ctrl+shift+a

Øtop #6无处藏身: Shift+shift

Øtop #5自动完成: Ctrl+shift+enter

Øtop #4创造万物: Alt+insert

Common TOP3

Øtop #1智能补全: Ctrl+shift+space

Øtop #1自我修复: Alt+enter

Øtop #1重构一切: Ctrl+shift+alt+t

④jar Package Reference, program run, project deployment

Fileàproject structure into the jar (of course, the actual project is managed directly with Maven and does not need to be referenced by itself) as follows


The program is deployed as follows:

So click, if you can't find this line toolbar, you can click View--->toolbar







Here I pack the old king to deploy, point to the lower left corner of OK on the line

Publishing with the war avoids damage to the document, and idea is different from eclipse, and is not found in the Tomcat WebApps folder after he deploys the file.

⑤ Show you the interface (starting from the top left corner)

Structure can see the class structure


Default display Mavenproject DataBase antbuild on the right


The bottom length so, not so much very normal, I opened a lot of services, so so much

Including run debug has been found here


Included : Company Great God (5S encryption level file) first, see the Efficiency guide

The Efficiency Guide lists all the ways you can improve your development efficiency. Second, view the recently opened file

You can see which files you have recently opened, and click them to reopen them.


Third, open the source code according to the class name

There are three menu items under the Navigate menu to quickly open the source code.


Four, quickly go back to the previous edit location

Sometimes you just close a file and want to reopen the edit, and you just need to go back to the previous location.


v. Quickly open the folder in Explorer ("My Computer")

Click "FilePath" to see the full path of the current file and click to open it in Explorer. vi. fast definition of variables

Select an expression and then select Refactor-extract-variable in the menu to extract the expression as a variable. Similarly, you can extract members, parameters, constants, and so on.


Seven, fast operation code block

The menu Code-surround with allows you to easily wrap blocks of code with TRY-CATCH,FOR,IF.


Eight, fast optimization statements

IntelliJ can help you quickly refine your statements. In the following example, IntelliJ detects that the user is copying an array through a loop, so it is recommended that the user use a simpler system.arraycopy () method.


 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.