0
我正在编写一个intellij插件。在我创建一个Java类之后,我想在编辑器中打开新创建的文件。我应该怎么做呢?Intellij插件在创建后在编辑器中打开新类
我正在编写一个intellij插件。在我创建一个Java类之后,我想在编辑器中打开新创建的文件。我应该怎么做呢?Intellij插件在创建后在编辑器中打开新类
溶液如下:
// we create the actual class
final VirtualFile newFile = JavaDirectoryService.getInstance().createClass(directory, className, templateName).getContainingFile().getVirtualFile();
// open to the new file in the editor
FileEditorManager.getInstance(project).openFile(newFile, true, true);