Eclipse评论/取消注释快捷方式? [英] Eclipse comment/uncomment shortcut?

查看:142
本文介绍了Eclipse评论/取消注释快捷方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为这很容易实现,但到目前为止,我还没有在 Java类编辑器 jsf faceted webapp XHTML文件编辑器:


  1. 快速注释/取消注释一行(如 ctrl + d 用于删除单行)

  2. 能够选择多行并注释/取消注释






例如:



单行java代码,来自:

  private String name; 

into

  // private String name; 





多行java代码,from:

  private String name; 
private int age;

into

  / * private String name; 
private int age; * /






单行xhtml代码,来自:

 < h:inputText ... /> 

into

 <! -  h:inputText ... /  - > 






多行xhtml代码,from:

 < h:inputTextarea 
rows =xx
cols =yy
...
/>

into

 <! -  h:inputTextarea 
rows =xx
cols =yy
...
/ - >





解决方案

对于单行注释,您可以使用 Ctrl + / ,对于多行注释,您可以使用 Ctrl + Shift +



在Mac / OS X上,您可以使用选择要在Java编辑器中注释的行。 > + / 注释掉单行或所选块。


I thought this would be easy to achieve, but so far I haven't found solutions for comment/uncomment shortcut on both Java class editor and jsf faceted webapp XHTML file editor :

  1. to quickly comment/uncomment a line (like ctrl + d is for removing single line)
  2. being able to choose multiple lines and comment/uncomment it


For example :

single line java code, from :

private String name;

into

//private String name;


multiple line java code, from :

private String name;
private int age;

into

/*private String name;
private int age;*/


single line xhtml code, from :

<h:inputText ... />

into

<!-- h:inputText ... / -->


multiple line xhtml code, from :

<h:inputTextarea
  rows="xx"
  cols="yy"
  ...
/>

into

<!-- h:inputTextarea
  rows="xx"
  cols="yy"
  ...
/ -->


解决方案

For single line comment you can use Ctrl + / and for multiple line comment you can use Ctrl + Shift + / after selecting the lines you want to comment in java editor.

On Mac/OS X you can use + / to comment out single lines or selected blocks.

这篇关于Eclipse评论/取消注释快捷方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆