在JBuilder5中增加注释与反注释工具

王朝java/jsp·作者佚名  2006-01-08
宽屏版  字体: |||超大  

看了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;

}

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

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

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

下载地址:

http://www.csdn.net/filebbs/read_topic.asp?id=856

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有