zoukankan      html  css  js  c++  java
  • Eclipse Photon 小技巧(tips)

    本文内容:

    Eclipse 4.8版本 代号 photon  光量子 ,感觉更像ide了,虽然这些技巧广为认知,但是作为eclipse来说,也是很重要的、


    Code completion allows you to quickly complete statements in your code. For example, start typing a part of a method name and press CTRL+Space to complete it. Multiple choices are presents to you via a popup.

    The 'new' Template

    Use the 'new' template for quick object creation.  (通过键入new 快速选择类)

    Extract class refactoring (Alt+Shift+T)

    The 'Extract class...' refactoring (from Alt+Shift+T) extracts a group of fields into a separate class and replaces all occurrences to fit the new structure.  

    Add Module

    You don't need to know which module contains a class in Java9. Ctrl-1 can identify the module and add it for you.  

    The 'ifnull' Template

    Use the 'ifnull' template to quickly create an if null check.  

    Block Selection

    Use the Edit -> Block Selection (Alt+Shift+A) while working with Java9.  

    Use CSV as Parameter Source

    You can directly use a CSV file as a parameter source in JUnit5 parameterised tests for a large number of cases.

    CSV in Parameterised Tests

    In JUnit5 parameterised tests also accept CSV literals (and files) as a source of parameters. Quite handy to feed your tests!

    Streams as Test Parameters 

    You can use methods returning Java streams as a source of parameters in JUnit5 tests. Use @MethodSource as shown below(推荐使用)

    Jump to Javadoc on Web

    Put your cursor on a class name (or method) and press Shift+F2 to jump to the web version of your library's Javadoc.  ()

    CTRL+3 - The Master Shortcut

    Use the 'Quick Access' box (Ctrl+3) to be more productive. Just type what you want and you'll probably find it.  

    Private Methods in Interfaces

    Private methods in interfaces are allowed in Java9. Here's an example use case with a shared 'worker' method.  ]

    Invert Equals

    Always safer to 'Invert equals' on literal strings in order to avoid a NullPointerException! Ctrl+1 does it for you.  

    'Show in' for more Details

    Whatever element you have selected, code or item, 'Show in...' (Alt+Shift+W) command pops up useful views for various details.  

    Alt+Up and Alt+Down

    Press Alt+Up/Dn to move the selected lines along with the cursor. Indenting is corrected for you. Alt+Shift+Up/Down copies the selection.  

    Toggle Block Selection

    Edit -> Toggle Block Selection tool (or just hit Shift+Alt+A) is demonstrated below.  

    Inspect Variable Declaration

    If you want to see where and how a variable was declared press Shift while hovering and you'll see it in-place.  

    Show Implementation In-place

    Press Shift while hovering a method and it will show implementation in-place.  

    Select Enclosing Structure

    The 'enclosing' selection (Alt+Shift+Up/Dn) shortcut selects the enclosing structure, e.g. var->if->method->class  

    Java 10 'var'

    Use Java 10 and the new 'var' statement in Eclipse with its quick assists (Ctrl+1). Install Java 10 support from Eclipse Marketplace first.  

     

  • 相关阅读:
    近期文章与教程和其他情况说明
    Python从入门到精通--课程目录
    第四天:创建型模式--原型模式
    python api链接数据库
    Delphi 实现简易语音发音(基于TTS方式)
    delphi下运行vbscript脚本
    使用PaxScript为Delphi应用增加对脚本的支持
    delphi与javascript互通
    奇技淫巧之Delphi和JavaScript互通
    在delphi中执行javascript代码
  • 原文地址:https://www.cnblogs.com/dgwblog/p/9353108.html
Copyright © 2011-2022 走看看