当用户切换到其视角时,如何使 Eclipse 插件在主视图中打开新生成的文档(类似于 hello.txt 文件)?
最佳答案
类似这样的代码是此任务的典型代码:
String fileContents = ...;
IFile file = ...;
file.create(new ByteArrayInputStream(fileContents.getBytes()), true, null);
FileEditorInput input = new FileEditorInput(file);
PlatformUI.getWorkbench().getActiveWorkbenchWindow().
getActivePage().openEditor(input, THE_EDITOR_ID);
关于java - 简单的 Eclipse 插件打开新文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5640976/