Me gustaría hacer lo anterior mediante programación.
Miré en How to get cursor position in an eclipse TextEditor y Eclipse-plugin how to get current text editor corsor position así que sé cómo obtener el desplazamiento del cursor desde el actual editor abierto. Sin embargo, estoy tratando de establecer el desplazamiento del cursor en un nuevo editor que se abre programáticamente por mí.
Cómo abrir un nuevo editor de eclipse con una posición de desplazamiento de cursor específica
La forma en que actualmente estoy abierto mi nuevo editor es el siguiente:
IWorkbenchWindow win = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage page = win.getActivePage();
if (page != null) {
IEditorPart editor = page.getActiveEditor();
if (editor != null) {
IEditorInput input = editor.getEditorInput();
if (input instanceof IFileEditorInput) {
String fileLocation = ((IFileEditorInput) input).getFile().getLocation().toOSString();
String newFileLocartion = generateNewFileLocation(fileLocation);
File file = new File(newFileLocartion);
IFileStore fileStore = EFS.getLocalFileSystem().getStore(file.toURI());
try {
IDE.openEditorOnFileStore(page, fileStore);
} catch (PartInitException e) {
// TODO error handling
}
}
}
}
¿Hay una manera de abrir establecer el nuevo editor para abrir en un desplazamiento específico (suponiendo que ya conoce el desplazamiento en avanzar)?
Gracias!