Does anybody have any idea why this wouldn’t work?
VirtualFile file = getVirtualFile();
int textOffset = getTextOffset();
final FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);
Editor editor = null;
editor = fileEditorManager.getSelectedTextEditor();
logger.debug("File is open cursor moved to: "+textOffset);
It actually opens the file the first time around (but doesn't move the caret), then subsequent calls have no effect. I have tried shutting the file down before re-opening but this didn’t work either.
Basically I have added a toolbar component that displays a list when the user clicks on an item, the relevant file is opened (supposedly:). After this is called once and the file closed there is no way to open the file again, even with the project explorer!
Any ideas or does anyone have any code that will open a virtual file correctly??
And if you have time then why doesn't the caret move??
Thanks in advance.