Salve a tutti, sto lavorando su un plugin di eclipse che permette di aprire un file con il suo relativo editor. In rete ho cercato questa soluzione:
[/FONT]il problema sta nel fatto che quando mando in run il plugin, mi dice che
[/FONT]è null quindi mi causa errore...perchè? non riesco proprio a capire...
- - - Updated - - -
non mi sa aiutare nessuno?
Codice:
public void openFile(Path filepath) throws Exception {
File fileToOpen = new File(filepath.toString());
if (fileToOpen.exists() && fileToOpen.isFile()) {
IFileStore fileStore = EFS.getLocalFileSystem().getStore(fileToOpen.toURI());
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
try {
IDE.openEditorOnFileStore( page, fileStore );
} catch ( PartInitException e ) {
//Put your exception handler here if you wish to
}
} else {
//Do something if the file does not exist
}
}
[FONT=Lato]
Codice:
[FONT=Lato] IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();[/FONT][FONT=Lato]
- - - Updated - - -
non mi sa aiutare nessuno?