private void openUnclosedMapLastSession(File statusFile, final IWorkbenchPage page) throws FileNotFoundException, UnsupportedEncodingException, WorkbenchException, CoreException, PartInitException { FileInputStream input = new FileInputStream(statusFile); BufferedReader reader = new BufferedReader(new InputStreamReader(input, "utf-8")); // $NON-NLS-1$ IMemento memento = XMLMemento.createReadRoot(reader); IMemento childMem = memento.getChild(IWorkbenchConstants.TAG_EDITORS); // ((WorkbenchPage) page).getEditorManager().restoreState(childMem); IMemento[] childrenEditor = childMem.getChildren("editor"); // $NON-NLS-1$ IEditorPart activeEditorPart = null; for (IMemento childEditor : childrenEditor) { IMemento childInput = childEditor.getChild("input"); // $NON-NLS-1$ String path = childInput.getString("path"); // $NON-NLS-1$ if (path != null) { IEditorInput editorInput = MME.createFileEditorInput(path); IEditorPart editorPart = page.openEditor(editorInput, MindMapUI.MINDMAP_EDITOR_ID); if ("true".equals(childEditor.getString("activePart"))) { // $NON-NLS-1$ //$NON-NLS-2$ activeEditorPart = editorPart; } } } if (activeEditorPart != null) { page.activate(activeEditorPart); } }
private IEditorPart openBlankMap() { return openEditor(MME.createNonExistingEditorInput()); }