简体   繁体   中英

How to generate getters and setters in NetBeans 11.0

I am trying to generate getters and setters or constructor or even methods that come from implemented interface, but I do not get anything. I have tried Alt + Enter, but nothing happens. Tried Alt + i, but when I did that I get only three options like: Connection to Database, Database Table and Action and/or Render Method. I feel like I use cutted version, although I got it from the official site of.netbeans. What should I do? I got this only because I thought it will have improvements compared to the stable 8.2, but I get this and not all the plugins I got in 8.2. Should I install something else too to it or? I installed the binary version not the source version.

Link to the image when I press Alt + Ins: https://pasteboard.co/IlbSMDv.png Link to the image of the plugins tab(most of them are activated, all php related are activated): https://pasteboard.co/IlbUolB.png

To get the context menu working for a PHP class in Apache NetBeans 11.0:

  • Activate all the PHP plugins:

    • Tools > Plugins > Installed .
    • Click Show details then sort by Category .
    • Scroll down, check all the plugins for the PHP category and click Activate . (Obviously you don't need to activate all the plugins; I just used that approach for simplicity.)

      php插件

  • Create a PHP project using the project wizard.

  • Create a class for the PHP project using the project wizard.
  • Postion the cursor anywhere within the class, and press ALT+INSERT. You will still see the problem you described in the OP: no getter/setter menu options are presented.
  • Restart NetBeans, and try again. The menu options are now available:

    phpContextMenu

If you just restart NetBeans I think your context menu should be fine.

Alt+Insert opens the context menu you are looking for.

Note : Alt+Insert where you would put the new code (ie Alt+Insert on empty line of the code inside the class)

So don't put Alt+Insert when you are on attribute because "getters and setters" won't be shown

Alt+Insert opens the context menu you are looking for.

Note:

Push Alt+Insert where you would put the new code (ie on empty line of the code inside the class)

So don't push Alt+Insert when you are on attribute because "getters and setters" won't be shown

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM