Quick source Inside Eclipse

Posted by veenasv on Tue, 03 Mar 2020 02:55:08 +0100

+source
- 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
+ Refactor
- 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();



                        <li class="tool-item tool-active is-like "><a href="javascript:;"><svg class="icon" aria-hidden="true">
                            <use xlink:href="#csdnc-thumbsup"></use>
                        </svg><span class="name">Give the thumbs-up</span>
                        <span class="count"></span>
                        </a></li>
                        <li class="tool-item tool-active is-collection "><a href="javascript:;" data-report-click="{&quot;mod&quot;:&quot;popu_824&quot;}"><svg class="icon" aria-hidden="true">
                            <use xlink:href="#icon-csdnc-Collection-G"></use>
                        </svg><span class="name">Collection</span></a></li>
                        <li class="tool-item tool-active is-share"><a href="javascript:;" data-report-click="{&quot;mod&quot;:&quot;1582594662_002&quot;}"><svg class="icon" aria-hidden="true">
                            <use xlink:href="#icon-csdnc-fenxiang"></use>
                        </svg>share</a></li>
                        <!--Start rewarding-->
                                                <!--End of reward-->
                                                <li class="tool-item tool-more">
                            <a>
                            <svg t="1575545411852" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5717" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M179.176 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5718"></path><path d="M509.684 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5719"></path><path d="M846.175 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5720"></path></svg>
                            </a>
                            <ul class="more-box">
                                <li class="item"><a class="article-report">Article Report</a></li>
                            </ul>
                        </li>
                                            </ul>
                </div>
                            </div>
            <div class="person-messagebox">
                <div class="left-message"><a href="https://blog.csdn.net/well386">
                    <img src="https://profile.csdnimg.cn/A/9/5/3_well386" class="avatar_pic" username="well386">
                                            <img src="https://g.csdnimg.cn/static/user-reg-year/2x/3.png" class="user-years">
                                    </a></div>
                <div class="middle-message">
                                        <div class="title"><span class="tit"><a href="https://blog.csdn.net/well386" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;}" target="_blank">well386</a></span>
                                            </div>
                    <div class="text"><span>18 original articles published</span> · <span>Approved 15</span> · <span>140,000 visits+</span></div>
                </div>
                                <div class="right-message">
                                            <a href="https://Im.csdn.net/im/main.html? UserName=well386 "target="_blank "class=" BTN btn-sm btn-red-hollow bt-button personal-letter ">private
                        </a>
                                                            <a class="btn btn-sm  bt-button personal-watch" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;}">follow</a>
                                    </div>
                            </div>
                    </div>
    
    69 original articles were published, 58 were praised, 30,000 visits+
    Private letter follow

    Topics: Javascript Eclipse