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:
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
        }            
        
    }
il problema sta nel fatto che quando mando in run il plugin, mi dice che
codice:
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
è null quindi mi causa errore...perchè? non riesco proprio a capire...