Last month, the message of idea's usage beyond eclipse swept through the IT community, where is idea. the most intelligent IDE
The biggest advantage of idea over eclipse is that it is smarter than eclipse. How clever is that? Let's look at a few simple examples first. Smart Tips Refactoring code
If the code you're writing is too complex, or there's a better way to replace the code you're writing, then idea will give you a hint that you can have a better way. The following figure:
This is to say that you use unnecessary boxing operations (what is boxing and unpacking can be self-Baidu, also can see me before the article), compared to the two add operation can be seen, idea in helping us optimize the code.
A second example:
When we learned Java, we learned about the enhanced for loop, in fact its scientific name is called a foreach statement, the above code I used a normal for loop, idea tells me that using a foreach statement is better. more user-friendly code hinting features
Use eclipse should be clear, if you want to enter the StringBuffer, then you have to enter in order, directly to lose SB is not, but in idea you can enter.
Not only that, see the next example
You can also prompt this.
These are just some simple examples, but they are strong enough. what's called Intelligence.
The above is actually a very basic function, the idea is really smart place is that it will continue to analyze your code, and intelligent feedback. Let's look at a simple example.
This is an ordinary structs program. An action is defined in the configuration file and two different return values are set. Open our action and we can see that you can find the shortcut button to jump to the corresponding profile right from the left side of the code. If one of your methods is overriding the parent class method, you can also view the parent class method directly. More humane, idea can analyze which interfaces your action method can jump to. Do you have a bit of a heartbeat too? powerful error-correcting capability
We always make some low-level mistakes, such as an inattentive to the wrong letter, may have been looking for a long time can not find the error, idea of error correction ability may be able to help you, look at an example.
We created only two JSPs, and when you have a file that you didn't create in your return, idea will prompt you for errors, which will prevent you from making mistakes by writing the wrong words.
There's a lot of idea's power, and I can't say it all in an article, if you're interested in ideas, look down, we'll learn from the basics.
Of course, before we do that, we have to install idea.
IDEA official Download Address:
https://www.jetbrains.com/idea/
1 1
JetBrains all of the IDE for students are free to use, click on the link below, use Edu mailbox to register an account, after the audit can use the genuine jerbrains tools.
https://www.jetbrains.com/student/
1 1
If you do not have an Edu mailbox, then please support the genuine.
The specific installation process I will not elaborate, normal people know. Idea 's basic configuration
Download good idea and avoid some configuration and personal settings. Some setup issues and actions I put at the end, because it doesn't affect our use. Let's talk about the configuration of JDK and Tomcat. the configuration of the JDK.
On the home page click Configure, find project structure, open. Go to the project directory, add the SDK, choose Add JDK, select the directory where you installed the JDK.
the configuration of Tomcat.
We do the Tomcat configuration in the following project. Idea creates a structs project
Next we formally create a structs project.
1) Click Create New Project.
In the process of downloading Structsjar package, may fail, belong to the normal situation, more than a few times just fine. You can also use your own jar package. After the first download, I saved the downloaded jar package for the next direct use (in fact, idea will automatically help you to save, the second time after the success of the download will be very fast).
2) Next name, select the path, click Finish to do it.
3) Add the jar package to the appropriate path. Right-click on the project name, Open Module Settings->artifacts
Right-click on the structs Jar package and select put Into/web-inf/lib
Click OK.
4) Configure Tomcat
Create a Tomcat service
Configuration related Information
If you have not configured Tomcat, configure it here.
So you can run it and click on the green triangle in the top right corner. The system will start, and automatically open the browser to access the default address (just configured, if the default is not changed, will enter the index interface). Next, you can write the code happily.
One of the big differences between idea and Eclipse is that without workspace, project is the workspace in Eclipse, and the module in idea is project in Eclipse. The person who just transferred from eclipse to idea may not be used to it. But it doesn't matter, you can also not create a module, you can write in project. Want to know more about module and multi-module programming can own Baidu, I will not elaborate. Idea 's personal configuration and common operations the personal configuration of idea
Modifying the Code Editor
The new idea defaults to using the Vim editor (a tool under Linux), although proficiency can improve productivity, but the learning cost is very high, not used to choose to close.
Modify theme and font size
This is a complete look at a person's liking.
Setting code hints is case insensitive
Case sensitivity: For example, we enter StringBuffer in the Java code file IntelliJ idea will not help us hint or code to add, but it is inconvenient if we enter StringBuffer to prompt and supplement the code.
Set code Check level
This is in the bottom right corner of the interface, an old man icon (open code file to see). The control that can be dragged is the set code check level. inspections for the highest level check, you can check the spelling of words, syntax errors, variables used, calls between methods and so on. Syntax can check the spelling of the words, simple grammatical errors. None does not set the check.
set up automatic guide packages
As shown in the figure 1 and 2 above, the default IntelliJ idea is that there is no automatic import package enabled. Tick the label 1 option, IntelliJ idea will automatically help us optimize the imported package when we write the code, such as automatically removing some unused packages. Tick the label 2 option, IntelliJ idea will automatically help us to import the required packages when we write the code. However, for those packages with the same name, or you need to manually ALT + Enter for import, IntelliJ idea is not smart enough to make judgments for us.
Power Saving Mode
IntelliJ idea has a state called power-down mode that IntelliJ idea turns off code checking and code hinting when this mode is turned on. So in general I would also think that this is a reading mode, if you encounter the development process of sudden code files can not be checked and prompted to see if there is a way to turn on this feature.
slicing Windows
Idea supports vertical or horizontal grouping of code. Generally in the large file modification, some changes in the file, some content under the file, if the back and forth operation may be very inefficient, this method can be much better. Of course, the premise is that your browser resolution is high enough.
spell Check
Idea by default is to turn on the word spell check, some people may have OCD do not like to see the word below the wavy line, you can remove the tick. But I personally suggest that this should not be closed, because spell checking is a good feature, when everyone's name is standard, this can be handy to help us find the code because of the spelling error caused by the bug.
tab Menu Multi-line display
When many files are open, IntelliJ idea defaults to displaying all open file name Tab lines. But my personal habit is to use multiple lines, more efficient than a single line, because the single line will hide more than the interface part of the Tab, so find files inconvenient.
Open Idea Settings
When this option is checked, the last used item is opened by default when you start IntelliJ idea. This is good if you have only one project, but if you have more than one project, it is advisable to close it, so when you start IntelliJ idea you can choose a project that you recently opened.
The following option is set when we have opened a project window, and then open a Project window is the choice of how to open the way. The Open Project in New window is opened each time by using a newer one. The open project in the same window replaces the currently open project each time, so that there is only one Project window on the desktop. Confirm window to open project in each pop-up prompt, let's choose to open or replace the current project window with a new window.
Adjust code font size
You can check this setting by adding Ctrl + mouse wheel shortcuts to control the display of code font size. common actions for Idea (shortcut keys)
ALT + ENTER Import package, auto fix
CTRL + N Find class
ctrl+shift+n Finding files
ctrl+alt+l Formatting code
ctrl+alt+o Optimizing imported classes and Packages
alt+insert Generate code (such as Get,set method, constructor, etc.)
ctrl+e or alt+shift+c recently changed code
ctrl+r replacing text
ctrl+f Finding text
ctrl+shift+space Auto-complete code
Ctrl + Space code hints
Ctrl+alt+space class name or interface name hint
ctrl+p Method parameter hints
Ctrl+shift+alt+n Find a method or variable in a class
Alt+shift+c vs. recently modified code
Shift+f6 Refactoring-Renaming
ctrl+x Deleting rows
ctrl+d Copying rows
ctrl+/or ctrl+shift+/ Comments (//or/.../)
ctrl+j Automatic Code
ctrl+e recently opened files
ctrl+h Display class structure diagram
ctrl+q displaying comment documents
alt+f1 Find where the code is located
alt+1 quickly open or hide the engineering panel
ctrl+alt+ Left/right back to the last viewed location
ALT + Left/right Toggle Code View
ALT + Up/down fast move location between methods
The ctrl+shift+up/down code moves up/down.
F2 or shift+f2 highlighting error or warning quick location
When the code tag is entered, press TAB to generate the code.
Select the text, press CTRL+SHIFT+F7, highlight all the text, and press ESC to highlight the disappear.
Ctrl+w selected code, continuous press will have other effects
Select the text, press ALT+F3, look down the same text, and highlight it.
Ctrl+up/down cursor jumps to the first or last line
Ctrl+b quickly open the class or method at the cursor
IDEA has integrated a number of plugins, including the front end artifact Emmet, which is basic enough not to be required to install additional plugins. Emmet recommend you learn, easy to use.
For the time being, we will continue to add, hungry and eat.
References:
http://lavasoft.blog.51cto.com/62575/97730/
Http://www.phperz.com/article/15/0923/159043.html