首页 > 编程知识 正文

手机java代码编辑器,用java编写的代码编辑器

时间:2023-05-03 17:37:17 阅读:173003 作者:1903

以下代码段说明如何使用JavaUI打开Java编辑器以显示Java编译单元的特定成员。

voidshowmethod(Imembermember ) {

icompilationunitcu=member.getcompilationunit (;

ieditorpartjavaeditor=Java ui.open in editor (Cu;

Java ui.revealineditor (Java editor,member );

}

方法openInEditor和revealInEditor也适用于类文件和类文件中包含的成员。

也可以通过以下方式实现:

IJavaElement element=;

boolean activateOnOpen=fEditor!=null? true : open strategy.activateonopen (;

iditorpartpart=editor utility.open in editor (element,activateOnOpen );

if (部件!=nullelementinstanceofijavaelement ) {

JavaUI.revealineditor(part,) IJavaElement (元素);

}

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。