Intellij IDEA usage skills (transfer)

[align=center][align=center][size=medium][/size]
[/align][/align]
1. When writing code, you can use Alt-Insert (Code|Generate…) to create getter and setter methods for any field in the class.
2. Right-click on the breakpoint marker (in the left column of the text) to activate the quick-check menu, where you can quickly set the enable/disable breakpoint or condition its properties.
3. A special variable in the CodeCompletion property is that activating Ctrl-Alt-Space can complete class names in or not in the current file. The import flag is automatically created if the class is not imported.
4. Use the Ctrl-Shift-V shortcut to insert the most recently used clipboard content selection into the text. When using, the system will pop up a dialog box containing clipping content, from which you can select the part you want to paste.
5. Use the CodeCompletion (code completion) property to quickly complete various statements in the code by typing the first few letters of a class name and then using Ctrl-Space to complete the full name. If there are multiple options, they are listed in the cheat list.
6. Use Ctrl-/ and Ctrl-Shift-/ to comment/uncomment lines and blocks of code.
-/Comment/uncomment the current line or select block of code with a single-line comment marker ("//..."). Ctrl-Shift-/, on the other hand, encloses the selected block with block comment markers (""). To uncomment a block of code just press Ctrl-Shift-/ anywhere in the block.
7. Press Alt-Q (View|Context Info) to view the declaration of the current method without moving the code. Press twice in succession to display the currently edited class name.
8. Use Refactor|Copy Class... to create a "copy" of the selected class. This is useful, for example, when you want to create a class that is mostly identical to an existing class.
9. Ctrl-D in the editor can copy the selected block or the current line without the selected block.
10. The function of Ctrl-W (select word) in the editor is to first select the word at the caret, and then select the extension area of ​​the source code. For example, choose a method name, then the expression that calls the method, then the entire statement, then the containing block, and so on.
11. If you don't want the "bright ball" icon indicating event details to be displayed in the editor, you can set the bright ball attached to the event text to non by pressing the Alt-Enter key combination to open the list of all events and clicking it with the mouse. Active status.
This way there won't be a bright ball to indicate a special event later, but you can still use it with the Alt-Enter shortcut.
12. When using CodeCompletion, you can use the comma (.) character, comma (,) semicolon (;), space and other characters to enter the currently highlighted part in the popup list. The selected name is automatically entered into the editor along with the characters entered.
13. Use the Escape key in any tool window to move the focus to the editor.
Shift-Escape not only moves the focus to the editor but also hides the current (or last active) tool window.
The F12 key moves the focus from the editor to the most recently used tool window.
14. An easy way to see the value of any expression while debugging a program is to select the text in the editor (you can do this more efficiently by pressing Ctrl-W a few times) and then press Alt-F8.
15. To open the browser for the Java documentation of the class or method used at the editor's caret, press Shift-F1 (External JavaDoc in the right-click menu).
To use this feature, you need to add the path to the browser, set it in the "General" option (Options | IDE Settings), and add the created Java document to the project (File | Project Properties).
16. With the Ctrl-F12 (View | File Structure Popup) keys you can quickly navigate in the currently edited file.
At this point it will display a list of members of the current class. Highlight an element to navigate and press Enter or F4. To easily navigate to an entry in the list, just type its name.
17. Put the cursor on the marker or its checkpoint in the code and press Alt-F7 (Find Usages... in the right-click menu) to quickly find a class, method or variable used in the entire project s position.
18. Press Ctrl-N (Go to | Class…) and then type the name of the class to quickly open any class in the editor. Select the class from the drop-down list that appears.
In the same way you can open non-Java files in a project by using Ctrl-Shift-N (Go to | File…).
19. To navigate the declarations of classes, methods, or variables used in some places in the code, place the cursor on the view item and press Ctrl-B. You can also navigate to the declaration by pressing the Ctrl key and clicking the mouse button on the viewing point.
20. Put the cursor on the view point and press Ctrl-Alt-B to navigate to the implementation code of an abstract method.
21. To see the inheritance hierarchy of a selected class, press Ctrl-H (Browse Type Hierarchy). You can also activate the inheritance relationship view in the editor to view the inheritance relationship of the currently edited class.
22. Use Ctrl-Shift-F7 (Search | Highlight Usages in File) to quickly highlight the usage of a variable in the current file. Press Escape to clear the highlight.
23. Use Alt-F3 (Search | Incremental Search) to implement quick search function in the editor.
Enter characters in the "Search for:" tooltip and use the arrow keys to search forward and backward. Press Escape to exit.
24. Press Ctrl-J to execute some Live Template abbreviations you can't remember. For example, key "it" and then press Ctrl-J to see what happens.
25. Introduce Variable integration helps you simplify complex declarations in your code. For example, in the following code snippet, select an expression in the code:
Then press Ctrl-Alt-V (Refactor | Introduce Variable) and the following result will appear:
26. Ctrl-Shift-J shortcut Lines are combined into one line and unnecessary spaces are stripped to match your code format.
27. Ctrl-Shift-Backspace (Go to | Last Edit Location) lets you go to the last place where changes were made in the code.
Press Ctrl-Shift-Backspace several times to see a deeper revision history.
28. Use Tools | Reformat Code... to format the code according to your code style reference (see Options | IDE Setting | Code Style).
Use Tools | Optimize Imports... to automatically "optimize" imports (clean out useless imports, etc.) based on settings (see Options | IDE Setting | Code Style | Imports).
29. Use IDEA's Live Templates | Live Templates lets you create a lot of typical code in the blink of an eye. For example, type in a method and
press Tab key to see what happens.
Use the Tab key to move through the different template fields. See Options | Live Templates for more details.
30. To view the local history of modifications in a file, activate Local VCS | Show History… in the context menu. Maybe you can navigate the different file versions, see how they differ and roll back to any previous version.
The history of modifications in a directory can also be viewed using the same right-click menu item. With this feature you won't lose any code.
31. If you want to understand the purpose of each item in the main menu, it may be helpful for you to move the mouse pointer over the menu items and display some brief descriptions of them in the status bar at the bottom of the application frame.
32. To display the separators between methods in the editor, open Options | IDE Settings | Editor and select the "Show method separators" checkbox.
33. Use the Alt-Up and Alt-Down keys to quickly move between different methods in the editor.
34. Use F2/Shift-F2 to jump between highlighted syntax errors.
Use the Ctrl-Alt-Down/Ctrl-Alt-Up shortcuts to jump between compiler error messages or search results.
35. You can easily override basic class methods by pressing Ctrl-O (Code | Override Methods…).
To implement the methods of the interface of the current class implements (or of the abstract base class), use Ctrl-I (Code | Implement Methods…).
36. If the cursor is placed between the parentheses of a method call, pressing Ctrl-P displays a list of available parameters.
37. To quickly view the Java documentation for the class or method used at the editor's caret, press Ctrl-Q (in the Show Quick JavaDoc in the popup menu).
38. Like Ctrl-Q (Show Quick JavaDoc to display concise Java documentation), Ctrl-P (Show Parameter Info to display parameter information), Ctrl-B (Go to Declaration), Shift-F1 (External JavaDoc external Java documentation) ) and some other shortcuts can be used not only in the editor, but also in the code completion right-click list.
39. Ctrl-E (View | Recent Files) pops up a right-click list of recently accessed files. Select the file and press Enter to open it.
40. In IDEA you can easily rename your classes, methods and variables and automatically correct them everywhere you use them.
To try it out, place the editor caret on any variable name and press Shift-F6 (Refactor | Rename…). Type the new name you want to display in the dialog box and press Enter. You will browse to all places where this variable is used and press the "Do Refactor" button to end the rename operation.
41. To quickly
select , press Alt-F1 (View | Select in…).
42. When instantiating an object of a known type after the "new" character, you may use SmartType code to accomplish this feature. For example, type and press Ctrl-Shift-Space:
3. By using SmartType code completion, it is also very easy to create the entire anonymous implementation of the interface in IDEA, for example, for some listeners, you can type
  Component component;
  component.addMouseListener(
    new <caret is here>
  );
then Press Ctrl-Shift-Space again to see what happens.
44. SmartType code completion is also helpful when you need to set the value of an expression of a known type. For example, type
String s = (<caret is here>
and press Ctrl-Shift-Space to see what will appear.
45. Quick reference is provided in all views: just type characters in the tree to quickly locate 46.
​​When you want to use a code snippet to catch exceptions, select the snippet in the editor, press Ctrl-Alt-T (Code | Surround with...) and select "try/catch". It will automatically generate the code Catch block for all exceptions thrown in the fragment. In the Options | File Templates | Code tab you can also customize the template that generates the catch block.
Use other items in the list to surround some other structures.

47. When using code completion , the highlighted portion of the popup list can be entered with the Tab key.
Unlike the Enter key to accept input, the selected name overwrites the rest of the name to the right of the caret. This replaces one method or variable name with another one is especially useful.
48. The code completion feature will show you a suggested name when declaring a variable. For example, start typing "private FileOutputStream" and then press Ctrl-Space
intellij idea tutorial
First of all, let me say something, in IntelliJ IDEA "new Project" is equivalent to our eclipse "workspace", and "new Module" is to create a project , which is a point to note.

This excerpt from Yifeng's blog
is correct, but in my development experience using IDEA in the past 2 years, I think IDEA wants you to have one project per "workspace". When I used ecipse in college, most people had many projects in a "workspace", all of which were closed and only one was opened. These two excellent IDEs are very different in this regard.

    In IDEA "new Project", it will automatically build a project (if you have been creating it according to the standard procedure), the name is the same as your workspace (first), if you build an additional project in this space (second), then the root directory of seconde's project will be in the same directory as first's web, src, and out. It seems very messy, although this is also correct, so I strongly recommend that there is only one project in a space (also the IDEA standard construction method).

    In the project built by IDEA, you can't see the output directory, you can only see src, web, and classes and lib under WEB-INF are not available. But if you open it on the disk, you can find that in out, there are 3 directories exploded, production, test,
exploded: it is the output directory of your real web, IDEA gives you an alias, called xxxxweb, here everyone is Familiar with everything.
production: the output of all .class files is in this
test: test class and resource file output directory.

    IDEA construction skills
1. The first is new project--->create project from scratch--->get a name--->next--->next---->check box web application, of course You need to tick everything else ----->finish,
which is basically everyone can

2. Now you have a standard directory, configure tomcat, there is a down arrow on it, click Edit Configurations,------ >The "+" sign in the upper left corner ------>TomcatServer--->local---->Name---->In Application Server----->configure---->Select tomcat path---->kill the check box of start browser---->kill the check box in the lower left corner, select fix----->apply-->ok in the lower right corner

3. Go to your disk , open your new project, find E:\test\web\WEB-INF (assuming the project is called test), and manually create two folders in WEB-INF, named classes and lib.

4. Go back to idea, Right click on your space---->Module Settings----select test in the second vertical column--->select Paths----->Use module compile output path----->output path select you The classes just created on disk.

5. Or the second vertical column---->web----->select Java EE Bulid Settings---->Create web module exploded directory path on the right to select the web path of your program (E:\ test\web)
The checkbox of Exclude from module content below needs to be removed a little, if you don't kill your web, it will be gone in idea.

6. Add lib, or the second vertical column---->web----->Select Dependencies--->add---->Module Library
---->Attach Jar Directories--->Directory on the right Select the lib that was manually built before.
In the process of using InelliJ IDEA, through finding information and some own exploration, I found that there are many tips worth mentioning in this IDE that many Java programmers like. If you can skillfully apply them to the actual development process, I believe It will save you a lot of development time, and there will be a little sense of achievement that comes with it :) Try it!
1. When writing code, use Alt-Insert (Code|Generate...) to create getter and setter methods for any field in the class.
2. Right-click on the breakpoint marker (in the left column of the text) to activate the quick-check menu, where you can quickly set the enable/disable breakpoint or condition its properties.
3. A special variable in the CodeCompletion property is that activating Ctrl-Alt-Space can complete class names in or not in the current file. The import flag is automatically created if the class is not imported.
4. Use the Ctrl-Shift-V shortcut to insert the most recently used clipboard content selection into the text. When using, the system will pop up a dialog box containing clipping content, from which you can select the part you want to paste.
5. Use the CodeCompletion (code completion) property to quickly complete various statements in the code by typing the first few letters of a class name and then using Ctrl-Space to complete the full name. If there are multiple options, they are listed in the cheat list.
6. Use Ctrl-/ and Ctrl-Shift-/ to comment/uncomment lines and blocks of code.
-/Comment/uncomment the current line or select block of code with a single-line comment marker ("//..."). Ctrl-Shift-/, on the other hand, encloses the selected block with block comment markers (""). To uncomment a block of code just press Ctrl-Shift-/ anywhere in the block.
7. Press Alt-Q (View|Context Info) to view the declaration of the current method without moving the code. Press twice in succession to display the currently edited class name.
8. Use Refactor|Copy Class... to create a "copy" of the selected class. This is useful, for example, when you want to create a class that is mostly identical to an existing class.
9. Ctrl-D in the editor can copy the selected block or the current line without the selected block.
10. The function of Ctrl-W (select word) in the editor is to first select the word at the caret, and then select the extension area of ​​the source code. For example, choose a method name, then the expression that calls the method, then the entire statement, then the containing block, and so on.
11. If you don't want the "bright ball" icon indicating event details to be displayed in the editor, you can set the bright ball attached to the event text to non by pressing the Alt-Enter key combination to open the list of all events and clicking it with the mouse. Active status.
This way there won't be a bright ball to indicate a special event later, but you can still use it with the Alt-Enter shortcut.
12. When using CodeCompletion, you can use the comma (.) character, comma (,) semicolon (;), space and other characters to enter the currently highlighted part in the popup list. The selected name is automatically entered into the editor along with the characters entered.
13. Use the Escape key in any tool window to move the focus to the editor.
Shift-Escape not only moves the focus to the editor but also hides the current (or last active) tool window.
The F12 key moves the focus from the editor to the most recently used tool window.
14. An easy way to see the value of any expression while debugging a program is to select the text in the editor (you can do this more efficiently by pressing Ctrl-W a few times) and then press Alt-F8.
15. To open the browser for the Java documentation of the class or method used at the editor's caret, press Shift-F1 (External JavaDoc in the right-click menu).
To use this feature, you need to add the path to the browser, set it in the "General" option (Options | IDE Settings), and add the created Java document to the project (File | Project Properties).
16. With the Ctrl-F12 (View | File Structure Popup) keys you can quickly navigate in the currently edited file.
At this point it will display a list of members of the current class. Highlight an element to navigate and press Enter or F4. To easily navigate to an entry in the list, just type its name.
17. Put the cursor on the marker or its checkpoint in the code and press Alt-F7 (Find Usages... in the right-click menu) to quickly find a class, method or variable used in the entire project s position.
18. Press Ctrl-N (Go to | Class…) and then type the name of the class to quickly open any class in the editor. Select the class from the drop-down list that appears.
In the same way you can open non-Java files in a project by using Ctrl-Shift-N (Go to | File…).
19. To navigate the declarations of classes, methods, or variables used in some places in the code, place the cursor on the view item and press Ctrl-B. You can also navigate to the declaration by pressing the Ctrl key and clicking the mouse button on the viewing point.
20. Put the cursor on the view point and press Ctrl-Alt-B to navigate to the implementation code of an abstract method.
21. To see the inheritance hierarchy of a selected class, press Ctrl-H (Browse Type Hierarchy). You can also activate the inheritance relationship view in the editor to view the inheritance relationship of the currently edited class.
22. Use Ctrl-Shift-F7 (Search | Highlight Usages in File) to quickly highlight the usage of a variable in the current file. Press Escape to clear the highlight.
23. Use Alt-F3 (Search | Incremental Search) to implement quick search function in the editor.
Enter characters in the "Search for:" tooltip and use the arrow keys to search forward and backward. Press Escape to exit.
24. Press Ctrl-J to execute some Live Template abbreviations you can't remember. For example, key "it" and then press Ctrl-J to see what happens.
25. Introduce Variable integration helps you simplify complex declarations in your code. For example, in the following code snippet, select an expression in the code:
then press Ctrl-Alt-V (Refactor | Introduce Variable) and the following result will appear:
26. The Ctrl-Shift-J shortcut combines two lines into one line and removes unnecessary spaces to match your code format.
27. Ctrl-Shift-Backspace (Go to | Last Edit Location) lets you go to the last place where changes were made in the code.
Press Ctrl-Shift-Backspace several times to see a deeper revision history.
28. Use Tools | Reformat Code... to format the code according to your code style reference (see Options | IDE Setting | Code Style).
Use Tools | Optimize Imports... to automatically "optimize" imports (clean out useless imports, etc.) based on settings (see Options | IDE Setting | Code Style | Imports).
29. Use IDEA's Live Templates | Live Templates lets you create a lot of typical code in the blink of an eye. For example, type in a method and
press Tab key to see what happens.
Use the Tab key to move through the different template fields. See Options | Live Templates for more details.
30. To view the local history of modifications in a file, activate Local VCS | Show History… in the context menu. Maybe you can navigate the different file versions, see how they differ and roll back to any previous version.
The history of modifications in a directory can also be viewed using the same right-click menu item. With this feature you won't lose any code.
31. If you want to understand the purpose of each item in the main menu, it may be helpful for you to move the mouse pointer over the menu items and display some brief descriptions of them in the status bar at the bottom of the application frame.
32. To display the separators between methods in the editor, open Options | IDE Settings | Editor and select the "Show method separators" checkbox.
33. Use the Alt-Up and Alt-Down keys to quickly move between different methods in the editor.
34. Use F2/Shift-F2 to jump between highlighted syntax errors.
Use the Ctrl-Alt-Down/Ctrl-Alt-Up shortcuts to jump between compiler error messages or search results.
35. You can easily override basic class methods by pressing Ctrl-O (Code | Override Methods…).
To implement the methods of the interface of the current class implements (or of the abstract base class), use Ctrl-I (Code | Implement Methods…).
36. If the cursor is placed between the parentheses of a method call, pressing Ctrl-P displays a list of available parameters.
37. To quickly view the Java documentation for the class or method used at the editor's caret, press Ctrl-Q (in the Show Quick JavaDoc in the popup menu).
38. Like Ctrl-Q (Show Quick JavaDoc to display concise Java documentation), Ctrl-P (Show Parameter Info to display parameter information), Ctrl-B (Go to Declaration), Shift-F1 (External JavaDoc external Java documentation) ) and some other shortcuts can be used not only in the editor, but also in the code completion right-click list.
39. Ctrl-E (View | Recent Files) pops up a right-click list of recently accessed files. Select the file and press Enter to open it.
40. In IDEA you can easily rename your classes, methods and variables and automatically correct them everywhere you use them.
To try it out, place the editor caret on any variable name and press Shift-F6 (Refactor | Rename…). Type the new name you want to display in the dialog box and press Enter. You will browse to all places where this variable is used and press the "Do Refactor" button to end the rename operation.
41. To quickly
select , press Alt-F1 (View | Select in…).
42. When instantiating an object of a known type after the "new" character, you may use SmartType code to accomplish this feature. For example, type and press Ctrl-Shift-Space:
3. By using SmartType code completion, it is also very easy to create the entire anonymous implementation of the interface in IDEA. For example, for some listeners, you can type
  Component component;
  component. addMouseListener(
    new <caret is here>
  );
then press Ctrl-Shift-Space again to see what happens.
44. SmartType code completion is also helpful when you need to set the value of an expression of a known type. For example, type
String s = (<caret is here>
and press Ctrl-Shift-Space to see what comes up.
45. Quick lookup function is provided in all views: just type characters in the tree to quickly locate an item.
46. ​​When you want to use a code snippet to catch exceptions, select the snippet in the editor, press Ctrl-Alt-T (Code | Surround with...) and select "try/catch". It automatically generates catch blocks for all exceptions thrown in the snippet. In the Options | File Templates | Code tab you can also customize the templates for generating capture blocks.
Other structures can be surrounded by other items in the list.

47. When using code completion, use the Tab key to enter the highlighted part in the pop-up list.
Unlike the Enter key to accept input, the selected name overwrites the rest of the name to the right of the caret. This is especially useful when substituting one method or variable name for another.
48. The code completion feature will show you a suggested name when declaring a variable. For example, start typing "private FileOutputStream" and then press Ctrl-Space
intellij idea tutorial
First of all, let me say something, in IntelliJ IDEA "new Project" is equivalent to our eclipse "workspace", and "new Module" is to create a project , which is a point to note.

This excerpt from Yifeng's blog
is correct, but in my development experience using IDEA in the past 2 years, I think IDEA wants you to have one project per "workspace". When I used ecipse in college, most people had many projects in a "workspace", all of which were closed and only one was opened. These two excellent IDEs are very different in this regard.

    In IDEA "new Project", it will automatically build a project (if you have been creating it according to the standard procedure), the name is the same as your workspace (first), if you build an additional project in this space (second), then the root directory of seconde's project will be in the same directory as first's web, src, and out. It seems very messy, although this is also correct, so I strongly recommend that there is only one project in a space (also the IDEA standard construction method).

    In the project built by IDEA, you can't see the output directory, you can only see src, web, and classes and lib under WEB-INF are not available. But if you open it on the disk, you can find that in out, there are 3 directories exploded, production, test,
exploded: it is the output directory of your real web, IDEA gives you an alias, called xxxxweb, here everyone is Familiar with everything.
production: the output of all .class files is in this
test: test class and resource file output directory.

    IDEA construction skills
1. The first is new project--->create project from scratch--->get a name--->next--->next---->check box web application, of course You need to tick everything else ----->finish
is basically everyone.

2. Now you have a standard directory, configure tomcat, there is a downward arrow on it, click Edit Configurations,------>the "+" sign in the upper left corner------>TomcatServer--- >local---->name it---->in Application Server----->configure---->select the tomcat path---->kill the check box of start browser----> Remove the check box in the lower left corner and select fix----->apply-->ok in the lower right corner

3. Go to your disk, open your newly created project, and find E:\test\web\WEB-INF (Assuming the project is called test), manually create two folders in WEB-INF, named classes and lib.

4. Go back to idea, right-click on your space---->Module Settings----the second vertical Column select test--->Paths----->Use module compile output path----->output path select the classes you just created in the disk.

5. Or the second vertical column---->web----->select Java EE Bulid Settings---->Create web module exploded directory path on the right to select the web path of your program (E:\ test\web)
The checkbox of Exclude from module content below needs to be removed a little, if you don't kill your web, it will be gone in idea.

6. Add lib, or the second vertical column---->web----->Select Dependencies--->add---->Module Library
----> on the right Attach Jar Directories--->Directory select the lib that was manually built before.
Like 0 Dislike 0

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326677425&siteId=291194637