カスタム テキスト エディタを使用して Eclipse プラグインを開発しています。
このカスタム エディター内でプログラムによってファイルを開く必要があります。Eclipse の DefaultTextEditor を使用して開くと、ファイルが開き、テキストなどを編集できます。
しかし、エディターを使用してファイルを開こうとすると、エディターが空白になり、編集できなくなります。使用しているソースはこちら。
File file = new File(filename);
IFileStore fileOnLocalDisk = EFS.getLocalFileSystem().getStore(file.toURI());
FileStoreEditorInput editorInput = new FileStoreEditorInput(fileOnLocalDisk);
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage page = window.getActivePage();
try {
// this works fine
page.openEditor(editorInput, "org.eclipse.ui.DefaultTextEditor");
// this is where the issue is
page.openEditor(editorInput, "MyEditor.editor");
} catch (PartInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ありがとう