private static StructuredTextEditor selectEditorPage(IEditorPart part) { if (part == null) { return null; } if (part instanceof FormEditor) { FormEditor ed = (FormEditor) part; ed.setActivePage(null); // null means source, always or just in the case of MavenPomEditor? if (ed.getActiveEditor() instanceof StructuredTextEditor) { return (StructuredTextEditor) ed.getActiveEditor(); } } return null; }
/** Switches focus in the editor to the page where this required body block is. */ private void switchFocus(ArtifactKeyBuilder select) { FormEditor editor = m_formPage.getEditor(); IFormPage currentPage = editor.getActivePageInstance(); if (!m_formPage.getId().equals(currentPage.getId())) editor.setActivePage(m_formPage.getId()); if (select != null) m_viewer.setSelection(new StructuredSelection(select), true); }