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);