- /**
- * Returns a set of all currently open <code>MultiPageTaxonEditor</code>s.
- *
- * @return a {@link java.util.Set} object.
- */
- public static Set<IEditorPart> getOpenEditors() {
- Set<IEditorPart> taxonEditors = new HashSet<IEditorPart>();
-
- if (getActivePage() != null) {
- for (IEditorReference reference : getActivePage()
- .getEditorReferences()) {
- IEditorPart editor = reference.getEditor(false);
- if (editor instanceof MultiPageTaxonEditor) {
- taxonEditors.add(editor);
- }
- }
- }
-
- return taxonEditors;
- }
-
- /**
- * Returns the currently active taxon editor
- *
- * @return the taxon editor that has focus
- */
- public static MultiPageTaxonEditor getActiveMultiPageTaxonEditor() {
- IEditorPart editorPart = getActiveEditor();
- if (editorPart != null && editorPart instanceof MultiPageTaxonEditor) {
- MultiPageTaxonEditor editor = (MultiPageTaxonEditor) editorPart;
- editor.getConversationHolder().bind();
- return editor;
- }
- return null;
- }
-
- /**
- * <p>
- * getActiveEditorPage
- * </p>
- *
- * @param page
- * a {@link eu.etaxonomy.taxeditor.editor.Page} object.
- * @return a {@link org.eclipse.ui.IEditorPart} object.
- */
- public static IEditorPart getActiveEditorPage(Page page) {
- MultiPageTaxonEditor editor = getActiveMultiPageTaxonEditor();
-
- return editor != null ? editor.getPage(page) : null;
- }
-
- /**
- * Returns the selection of the currently active taxon editor
- *
- * @return a {@link org.eclipse.jface.viewers.ISelection} object.
- */
- public static ISelection getCurrentSelection() {
- if (getActiveMultiPageTaxonEditor() == null) {
- return null;
- } else {
- return getActiveMultiPageTaxonEditor().getSite()
- .getSelectionProvider().getSelection();
- }
- }
-
- /**
- * <p>
- * getUndoContext
- * </p>
- *
- * @param editor
- * a {@link eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor}
- * object.
- * @return a {@link org.eclipse.core.commands.operations.IUndoContext}
- * object.
- */
- public static IUndoContext getUndoContext(MultiPageTaxonEditor editor) {
- return editor.getUndoContext();
- }
-