在JBuilder5中增加注释与反注释工具 (转)

本文介绍如何在JBuilder5中实现代码注释与反注释功能,通过自定义工具增强IDE功能,方便开发者快速对选定代码进行注释操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在JBuilder5中增加注释与反注释工具 (转)[@more@]

看了levin_zhang写的注释与反注释Comment/Uncomment selected code in Visual C++ 文章, 也想到在JBuilder5中没有这样的功能, 于是也写了一个Comment/Uncomment工具.

JBuilder5提供了一个Open Tools开发工具给使用者来增强JBuilder5的功能。更多的这样的Open tools工具请看www.borland.com  的community中的code contral.

实现comment/uncomment的功能代码如下:

  private boolean CreateComment()
  {
  String selection = target.getSelectedText();
  String newSelection;
  if ( (selection.trim().startsWith("/*") && selection.trim().endsWith("*/")))
  {
  StringBuffer sb = new StringBuffer(selection);
  newSelection = sb.substring(2,selection.length()-2);
  }else
  {
  newSelection = "/*" + selection + "*/";
  }
  target.replaceSelection(newSelection);
  return true;

  }

感谢.NET">Christopher Fitch,  我的这个程式参考了他的JavaDocCreator.

这个工具的名字是JavaCommentCreator.jar,使用时将其放到jbuilder5/lib/ext/目录中,重新启动jbuilder即可.

使用方法,选取一段文字,点右键出现菜单,选 Comment/Uncomment Selection即可。在所选 文字的两端加上的/*和*/, Uncomment时从/*选到*/再点Comment/Uncomment Selection菜单即可.

下载地址:

ASP?id=856">http://www.youkuaiyun.com/filebbs/read_topic.asp?id=856


 


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10752043/viewspace-990271/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10752043/viewspace-990271/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值