- Format: This is a very convenient operation that I've always recommended. For example, if you write a poorly formatted piece of code and it's messy, then you choose this one. You will find, wow~~, how my code looks beautiful all at once, if you don't believe you can try it, the shortcut key is "Ctrl+Shift+F". So I've got into the habit of writing code for a while, just c+s+f, heh, it's very convenient.
- Sort Member: This isn't very common, but if you think the code is too long and you can't always find a function, you can try it. It will help you reorder the functions and variables you write
- Organize Import: This function is also an uncomfortable function. For example, if you make a project, you find that many imports are not used, or you refer to a class, but you don't import, and the result can't be compiled, that's okay. With this, all the problems will be solved. At least after I use this,You've never written a statement like import before. The shortcut is "Ctrl+Shift+O (the letter O, not the number 0)".
I often use this with c+s+f, huh, people are also lazy
- Override/Implement Method: This example is when you write a class that implements an interface, but you have not yet implemented a function of that interface. If you use this, it will automatically search for methods of the parent class and interface, and you can choose which functions to override or implement.
- Generate Delegating Method: If a field wants to generate a proxy function, with this handle, select ok
- Add Javadoc Comment: Point one of the functions or classes or variables that you want to add javadoc to, and then select this option, it will automatically help you add javadoc headers, including those you use param or return
- surround with try/catch block: If you have a piece of code to handle some exceptions, and you forget to write with try/catch again, take your time, select that piece of code, and then choose this one, you will find that it will automatically pinpoint which exceptions are thrown in your code, and automatically generate all the code
- externalize string: This is used for internationalization, simply to package strings in the resource bundle, which is also a solution for i18n. I think I'll cover this in more detail later.
open a menu
- Rename: If you write a class and you find that the name of a class variable of this class doesn't sound good to you, you don't feel comfortable. So you want to change the name. What can you do? Change the name of that variable? Heh, it's not that simple, because if you've already referenced this variable in some functions, the compilation will be wrong and you don't know where you referenced it.Having written so much code, my mind is dizzy. Isn't that a dead dish? Take it easy. This rename can help you solve all your problems.
Not only can it help you change the name of the variable, but it also automatically searches for all the places that the variable is referenced and then changes those places together. That's great. It saves you a lot of work.
- Move: Similarly, to move an implemented static function or variable to another class, use this move to ensure no error
- Modify Method Signature: It is impossible to design a function that will be fixed in a flash. For example, if you have a parameter for this function at the beginning and later find out that it is incorrect to use two, then you need to use this to change it. It will also search for all references to this function and change the places where these applications are applied, otherwise it will compile as well
To make a mistake
- Extract Interface: It can help you abstract a class into an interface and standardize your code
- Extract Method: If you write a long function, but some of the code in this function is reusable, you can split it up, select that code, and select this one. The system asks you for the definition of the function you extracted, and then it generates this function, pulling the implementation out of the original function.And write a reference to the new function from the original function to keep the program unchanged.
- Extract Local Variable: If you find that some of the values in your function are derived from the same expression, you can make this expression into a variable by using this and replace this variable with the one you refer to
- Extract Constant: Extract a constant, such as a string="eclipse". If you think there are many places to use it, then pull it out and make it a constant ECLIPSE. It's that simple
- convert local variable to field: you know by name, let alone say
- encapsulate field: This is a bit similar to generating getters and setters, but the difference is that if you have a constant var of public s that you've already referenced elsewhere, you'll have problems generating getters with setters, because the references haven't changed. With this, not only will getters be generated,
setter, but also removes all references, such as var =...Change to setvar(...), put...= var to...= getvar();