Merge branch 'develop' into remoting-4.0
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / MultiPageTaxonEditor.java
index 2f49284d4d95d3d7de60b2cc8bd2bc566bc1f6dd..e58a897b2426f9d5d69d82de6188620a37fa4ccf 100644 (file)
@@ -30,14 +30,17 @@ import eu.etaxonomy.cdm.model.name.TaxonNameBase;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
 import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
 import eu.etaxonomy.taxeditor.editor.name.container.AbstractGroupedContainer;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.DataChangeBridge;
 import eu.etaxonomy.taxeditor.model.IDataChangeBehavior;
-import eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider;
+import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
 import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
 import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData;
+import eu.etaxonomy.taxeditor.model.IPartContentHasMedia;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 
 /**
@@ -51,77 +54,79 @@ import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
  * @version 1.0
  */
 public class MultiPageTaxonEditor extends FormEditor implements
-        IPartContentHasFactualData, IConversationEnabled, IPostOperationEnabled,
-               IDirtyMarkableSelectionProvider, IPartContentHasDetails, ISecuredEditor {
-
-       /** Constant <code>ID="eu.etaxonomy.taxeditor.editor.taxon"{trunked}</code> */
-       public static final String ID = "eu.etaxonomy.taxeditor.editor.taxon";
-
-       private boolean dirty;
-
-       private ConversationHolder conversation;
-       private IDataChangeBehavior dataChangeBehavior;
-       private IUndoContext undoContext;
-
-       private TaxonEditorInput input;
-
-       /**
-        * <p>
-        * Constructor for MultiPageTaxonEditor.
-        * </p>
-        */
-       public MultiPageTaxonEditor() {
-               super();
-               undoContext = new UndoContext();
-       }
-
-       /** {@inheritDoc} */
-       @Override
-       public void dispose() {
-               conversation.unregisterForDataStoreChanges(this);
-               conversation.close();
-               super.dispose();
-       }
-
-       /*
-        * (non-Javadoc)
-        *
-        * @see org.eclipse.ui.forms.editor.FormEditor#addPages()
-        */
-       /** {@inheritDoc} */
-       @Override
-       protected void addPages() {
-               input = (TaxonEditorInput) getEditorInput();
-               conversation = input.getConversationHolder();
-               conversation.registerForDataStoreChanges(this);
-
-               try {
-                       addPage(Page.NAME.getIndex(), new TaxonNameEditor(this),
-                                       getEditorInput());
-                       // setPageText(Page.NAME.getIndex(), Page.NAME.getTitle());
-
-                       // TODO lazy create
-                       // addPage(Page.DESCRIPTIVE.getIndex(), new
-                       // TaxonDescriptionTreeEditor(this), getEditorInput());
-                       // setPageText(Page.DESCRIPTIVE.getIndex(),
-                       // Page.DESCRIPTIVE.getTitle());
-
-                       // EditorUtil.showPropertySheet();
-
-               } catch (PartInitException e) {
-                       AbstractUtility.error(getClass(), e);
-               }
-       }
-
-       /** {@inheritDoc} */
-       @Override
-       public void doSave(IProgressMonitor monitor) {
-               monitor.beginTask("Saving Editor", 4);
-               try {
-                       if (!conversation.isBound()) {
-                               conversation.bind();
-                       }
-                       monitor.worked(1);
+IPartContentHasFactualData, IConversationEnabled, IPostOperationEnabled,
+IDirtyMarkable, IPartContentHasDetails, ISecuredEditor, IPartContentHasMedia {
+
+    /** Constant <code>ID="eu.etaxonomy.taxeditor.editor.taxon"{trunked}</code> */
+    public static final String ID = "eu.etaxonomy.taxeditor.editor.taxon";
+
+    private boolean dirty;
+
+    private ConversationHolder conversation;
+    private IDataChangeBehavior dataChangeBehavior;
+    private IUndoContext undoContext;
+
+    private TaxonEditorInput input;
+
+    /**
+     * <p>
+     * Constructor for MultiPageTaxonEditor.
+     * </p>
+     */
+    public MultiPageTaxonEditor() {
+        super();
+        undoContext = new UndoContext();
+
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void dispose() {
+        input.dispose();
+        conversation.unregisterForDataStoreChanges(this);
+        conversation.close();
+        super.dispose();
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.eclipse.ui.forms.editor.FormEditor#addPages()
+     */
+    /** {@inheritDoc} */
+    @Override
+    protected void addPages() {
+        input = (TaxonEditorInput) getEditorInput();
+        conversation = input.getConversationHolder();
+        conversation.registerForDataStoreChanges(this);
+
+        try {
+            addPage(Page.NAME.getIndex(), new TaxonNameEditor(this),
+                    getEditorInput());
+            // setPageText(Page.NAME.getIndex(), Page.NAME.getTitle());
+
+            // TODO lazy create
+            // addPage(Page.DESCRIPTIVE.getIndex(), new
+            // TaxonDescriptionTreeEditor(this), getEditorInput());
+            // setPageText(Page.DESCRIPTIVE.getIndex(),
+            // Page.DESCRIPTIVE.getTitle());
+
+            // EditorUtil.showPropertySheet();
+
+        } catch (PartInitException e) {
+            MessagingUtils.error(getClass(), e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void doSave(IProgressMonitor monitor) {
+        monitor.beginTask("Saving Editor", 4);
+        try {
+            if (!conversation.isBound()) {
+                conversation.bind();
+            }
+            monitor.worked(1);
 
             for (IEditorPart editorPage : getPages()) {
                 if (editorPage instanceof TaxonNameEditor) {
@@ -137,155 +142,158 @@ public class MultiPageTaxonEditor extends FormEditor implements
                 monitor.worked(1);
             }
 
-                       // commit the conversation and start a new transaction immediately
-                       conversation.commit(true);
-                       monitor.worked(1);
+            // commit the conversation and start a new transaction immediately
+
+            input.merge();
+            conversation.commit(true);
+            monitor.worked(1);
 
             this.setDirty(false);
             monitor.worked(1);
         } catch (Exception e) {
             setFocus();
-            AbstractUtility.errorDialog("An error occurred while saving", getClass(),
-                    "An error occurred while saving the editor. Please close and reopen the taxon again.", e);
+            MessagingUtils.operationDialog(this, e, TaxeditorEditorPlugin.PLUGIN_ID,"saving a taxon", " Please close and reopen the taxon again.");
             disableEditor(true);
         } finally {
             monitor.done();
         }
-       }
-
-       private void disableEditor(boolean isOnError) {
-               for (IMultiPageTaxonEditorPage editorPage : getPages()) {
-                       if(isOnError){
-                               editorPage.setOnError();
-                       }else {
-                               editorPage.setDisabled();
-                       }
-               }
-               conversation.unregisterForDataStoreChanges(this);
-               conversation.close();
-               setDirty(false);
-       }
-
-       private void setDirty(boolean dirty) {
-               this.dirty = dirty;
-               firePropertyChange(PROP_DIRTY);
-       }
-
-       /*
-        * (non-Javadoc)
-        *
-        * @see org.eclipse.ui.part.MultiPageEditorPart#isDirty()
-        */
-       /**
-        * <p>
-        * isDirty
-        * </p>
-        *
-        * @return a boolean.
-        */
-       @Override
+    }
+
+    private void disableEditor(boolean isOnError) {
+        for (IMultiPageTaxonEditorPage editorPage : getPages()) {
+            if(isOnError){
+                editorPage.setOnError();
+            }else {
+                editorPage.setDisabled();
+            }
+        }
+
+        conversation.unregisterForDataStoreChanges(this);
+        conversation.close();
+        setDirty(false);
+    }
+
+    private void setDirty(boolean dirty) {
+        this.dirty = dirty;
+        firePropertyChange(PROP_DIRTY);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.eclipse.ui.part.MultiPageEditorPart#isDirty()
+     */
+    /**
+     * <p>
+     * isDirty
+     * </p>
+     *
+     * @return a boolean.
+     */
+    @Override
     public boolean isDirty() {
-               return dirty;
-       }
-
-       /*
-        * (non-Javadoc)
-        *
-        * @see org.eclipse.ui.forms.editor.FormEditor#editorDirtyStateChanged()
-        */
-       /** {@inheritDoc} */
-       @Override
-       public void editorDirtyStateChanged() {
-               dirty = true;
-               super.editorDirtyStateChanged();
-       }
-
-       /**
-        * {@inheritDoc}
-        *
-        * Checks whether nested editors are calling
-        * <code>firePropertyChange(PROP_DIRTY)</code> to signal an edit has taken
-        * place before passing property change along to
-        * <code>super.handlePropertyChange(int propertyId)</code>.
-        */
-       /*
-        * (non-Javadoc)
-        *
-        * @see org.eclipse.ui.part.MultiPageEditorPart#handlePropertyChange(int)
-        */
-       @Override
+        return dirty;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.eclipse.ui.forms.editor.FormEditor#editorDirtyStateChanged()
+     */
+    /** {@inheritDoc} */
+    @Override
+    public void editorDirtyStateChanged() {
+        dirty = true;
+        super.editorDirtyStateChanged();
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * Checks whether nested editors are calling
+     * <code>firePropertyChange(PROP_DIRTY)</code> to signal an edit has taken
+     * place before passing property change along to
+     * <code>super.handlePropertyChange(int propertyId)</code>.
+     */
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.eclipse.ui.part.MultiPageEditorPart#handlePropertyChange(int)
+     */
+    @Override
     protected void handlePropertyChange(int propertyId) {
-               if (propertyId == PROP_DIRTY) {
-                       setDirty(true);
-               }
-               super.handlePropertyChange(propertyId);
-       }
-
-       /** {@inheritDoc} */
-       @Override
-       public void doSaveAs() {
-       }
-
-       /** {@inheritDoc} */
-       @Override
-       public boolean isSaveAsAllowed() {
-               return false;
-       }
-
-       /** {@inheritDoc} */
-       @Override
-       public void init(IEditorSite site, IEditorInput input)
-                       throws PartInitException {
-
-               if (!(input instanceof TaxonEditorInput)) {
+        if (propertyId == PROP_DIRTY) {
+            setDirty(true);
+        }
+        super.handlePropertyChange(propertyId);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void doSaveAs() {
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public boolean isSaveAsAllowed() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void init(IEditorSite site, IEditorInput input)
+            throws PartInitException {
+
+        if (!(input instanceof TaxonEditorInput)) {
             throw new PartInitException(
-                                       "Invalid Input: Must be TaxonEditorInput");
+                    "Invalid Input: Must be TaxonEditorInput");
         }
 
-               this.input = (TaxonEditorInput) input;
-
-               // try {
-               // // Listen for name changes,
-               // // change tab for this taxon editor accordingly
-               // getTaxon().addPropertyChangeListener("name",
-               // new PropertyChangeListener() {
-               // public void propertyChange(PropertyChangeEvent e) {
-               // setPartName();
-               // }
-               // });
-               // } catch (NullPointerException e) {
-               // EditorUtil.warn(getClass(),
-               // "Caught an NPE while initing an editor. This is most " +
-               // "likely due to the unsuccesful attempt to restore the former " +
-               // "state of the application. We ignore this because the workbench " +
-               // "will simply be reset.");
-               // }
-               setPartName();
-
-               super.init(site, input);
-       }
-
-       /**
-        * Calls <code>MultiPageEditorPart.setPartName(String partName)</code> with
-        * text appropriate to the state of the taxon: any taxon that has been saved
-        * will by necessity have a name to display; a new taxon should display
-        * "New taxon" in the editor tab.
-        */
-       protected void setPartName() {
-
-               String partName = null;
-               TaxonNameBase<?, ?> name = getTaxon().getName();
-
-               if (name != null) {
-                       partName = name.getTitleCache();
-               }
-
-               if (partName == null || partName.equals("")) {
-                       partName = ("New taxon");
-               }
-
-               setPartName(partName);
-       }
+        this.input = (TaxonEditorInput) input;
+
+
+        // try {
+        // // Listen for name changes,
+        // // change tab for this taxon editor accordingly
+        // getTaxon().addPropertyChangeListener("name",
+        // new PropertyChangeListener() {
+        // public void propertyChange(PropertyChangeEvent e) {
+        // setPartName();
+        // }
+        // });
+        // } catch (NullPointerException e) {
+        // EditorUtil.warn(getClass(),
+        // "Caught an NPE while initing an editor. This is most " +
+        // "likely due to the unsuccesful attempt to restore the former " +
+        // "state of the application. We ignore this because the workbench " +
+        // "will simply be reset.");
+        // }
+        setPartName();
+
+        super.init(site, input);
+    }
+
+    /**
+     * Calls <code>MultiPageEditorPart.setPartName(String partName)</code> with
+     * text appropriate to the state of the taxon: any taxon that has been saved
+     * will by necessity have a name to display; a new taxon should display
+     * "New taxon" in the editor tab.
+     */
+    protected void setPartName() {
+
+        String partName = null;
+        TaxonNameBase<?, ?> name = getTaxon().getName();
+
+        if (name != null) {
+            partName = name.getTitleCache();
+        }
+
+        if (partName == null || partName.equals("")) {
+            partName = ("New taxon");
+        }
+
+        setPartName(partName);
+    }
 
     /**
      * {@inheritDoc}
@@ -305,84 +313,96 @@ public class MultiPageTaxonEditor extends FormEditor implements
                 container.refresh();
             }
         }
+        //refresh part title
+        //TODO: refresh taxon node in taxon navigator
+        setPartName();
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider#forceDirty()
+     */
+    @Override
+    public void forceDirty() {
+        changed(null);
+    }
+
+    /**
+     * The accepted taxon that is the input for this editor
+     *
+     * @return the accepted taxon
+     */
+    public Taxon getTaxon() {
+        return input.getTaxon();
     }
 
-       /**
-        * The accepted taxon that is the input for this editor
-        *
-        * @return the accepted taxon
-        */
-       public Taxon getTaxon() {
-               return input.getTaxon();
-       }
-
-       /*
-        * (non-Javadoc)
-        *
-        * @see
-        * eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder
-        * ()
-        */
-       /**
-        * <p>
-        * getConversationHolder
-        * </p>
-        *
-        * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
-        *         object.
-        */
-       @Override
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder
+     * ()
+     */
+    /**
+     * <p>
+     * getConversationHolder
+     * </p>
+     *
+     * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
+     *         object.
+     */
+    @Override
     public ConversationHolder getConversationHolder() {
-               return conversation;
-       }
-
-       /**
-        * <p>
-        * setConversationHolder
-        * </p>
-        *
-        * @param conversation
-        *            a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
-        *            object.
-        */
-       public void setConversationHolder(ConversationHolder conversation) {
-               this.conversation = conversation;
-       }
-
-       /**
-        * <p>
-        * Getter for the field <code>undoContext</code>.
-        * </p>
-        *
-        * @return a {@link org.eclipse.core.commands.operations.IUndoContext}
-        *         object.
-        */
-       public IUndoContext getUndoContext() {
-               return undoContext;
-       }
-
-       /**
-        * <p>
-        * Setter for the field <code>undoContext</code>.
-        * </p>
-        *
-        * @param undoContext
-        *            a {@link org.eclipse.core.commands.operations.IUndoContext}
-        *            object.
-        */
-       public void setUndoContext(IUndoContext undoContext) {
-               this.undoContext = undoContext;
-       }
-
-       /** {@inheritDoc} */
-       @Override
-       public void setFocus() {
-               // logger.warn("Setting focus to editor");
-               // bind the conversation
-               getConversationHolder().bind();
-               // pass focus to the active editor page
-               getActiveEditor().setFocus();
-       }
+        return conversation;
+    }
+
+    /**
+     * <p>
+     * setConversationHolder
+     * </p>
+     *
+     * @param conversation
+     *            a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
+     *            object.
+     */
+    public void setConversationHolder(ConversationHolder conversation) {
+        this.conversation = conversation;
+    }
+
+    /**
+     * <p>
+     * Getter for the field <code>undoContext</code>.
+     * </p>
+     *
+     * @return a {@link org.eclipse.core.commands.operations.IUndoContext}
+     *         object.
+     */
+    public IUndoContext getUndoContext() {
+        return undoContext;
+    }
+
+    /**
+     * <p>
+     * Setter for the field <code>undoContext</code>.
+     * </p>
+     *
+     * @param undoContext
+     *            a {@link org.eclipse.core.commands.operations.IUndoContext}
+     *            object.
+     */
+    public void setUndoContext(IUndoContext undoContext) {
+        this.undoContext = undoContext;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void setFocus() {
+        // logger.warn("Setting focus to editor");
+        // bind the conversation
+        getConversationHolder().bind();
+        input.bind();
+        // pass focus to the active editor page
+        getActiveEditor().setFocus();
+    }
 
     /*
      * (non-Javadoc)
@@ -411,96 +431,96 @@ public class MultiPageTaxonEditor extends FormEditor implements
     /** {@inheritDoc} */
     @Override
     public boolean postOperation(CdmBase objectAffectedByOperation) {
-        setDirty(true);
+               setDirty(true);
 
         for (IEditorPart editor : this.getPages()) {
             if (editor instanceof IPostOperationEnabled) {
                 ((IPostOperationEnabled) editor).postOperation(objectAffectedByOperation);
             } else {
-                AbstractUtility.warn(getClass(), "postOperation not enabled for editor " + editor);
+                MessagingUtils.warn(getClass(), "postOperation not enabled for editor " + editor);
             }
         }
-        AbstractUtility.warn(getClass(), "postOperation called on MultiPageTaxonEditor. Can you make it more specific?");
+        MessagingUtils.warn(getClass(), "postOperation called on MultiPageTaxonEditor. Can you make it more specific?");
 
         return false;
     }
 
-       /**
-        * Returns an <code>IEditorPart</code> implementation by type
-        *
-        * @param page
-        *            the page type
-        * @return a {@link eu.etaxonomy.taxeditor.editor.IMultiPageTaxonEditorPage}
-        *         object.
-        */
-       public IMultiPageTaxonEditorPage getPage(Page page) {
-               for (IEditorPart editor : this.getPages()) {
-                       if (editor.getClass().equals(page.getClazz())) {
-                               return (IMultiPageTaxonEditorPage) editor;
-                       }
-               }
-               return null;
-       }
-
-       /**
-        * Return a list of <code>AbstractTaxonEditor</code>s registered with this
-        * <code>MultiPageTaxonEditor</code>.
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public List<IMultiPageTaxonEditorPage> getPages() {
-               ArrayList<IMultiPageTaxonEditorPage> editors = new ArrayList<IMultiPageTaxonEditorPage>();
-               for (int i = 0; i < this.getPageCount(); i++) {
-
-                       editors.add((IMultiPageTaxonEditorPage) this.getEditor(i));
-               }
-               return editors;
-       }
-
-       /**
-        * Refreshes a certain page of the MultipageTaxonEditor
-        *
-        * @param page
-        *            a {@link eu.etaxonomy.taxeditor.editor.Page} object.
-        * @return a boolean.
-        */
-       public boolean redraw(Page page) {
-               return redraw(page, true);
-       }
-
-       /**
-        * Refreshes a certain page of the MultipageTaxonEditor and sets focus to
-        * that page
-        *
-        * @param page
-        *            a {@link eu.etaxonomy.taxeditor.editor.Page} object.
-        * @param focus
-        *            a boolean.
-        * @return a boolean.
-        */
-       public boolean redraw(Page page, boolean focus) {
-               IMultiPageTaxonEditorPage editorPage = getPage(page);
-               return editorPage != null && editorPage.redraw(focus);
-       }
-
-       /**
-        * <p>
-        * onComplete
-        * </p>
-        *
-        * @return a boolean.
-        */
-       @Override
+    /**
+     * Returns an <code>IEditorPart</code> implementation by type
+     *
+     * @param page
+     *            the page type
+     * @return a {@link eu.etaxonomy.taxeditor.editor.IMultiPageTaxonEditorPage}
+     *         object.
+     */
+    public IMultiPageTaxonEditorPage getPage(Page page) {
+        for (IEditorPart editor : this.getPages()) {
+            if (editor.getClass().equals(page.getClazz())) {
+                return (IMultiPageTaxonEditorPage) editor;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Return a list of <code>AbstractTaxonEditor</code>s registered with this
+     * <code>MultiPageTaxonEditor</code>.
+     *
+     * @return a {@link java.util.List} object.
+     */
+    public List<IMultiPageTaxonEditorPage> getPages() {
+        ArrayList<IMultiPageTaxonEditorPage> editors = new ArrayList<IMultiPageTaxonEditorPage>();
+        for (int i = 0; i < this.getPageCount(); i++) {
+
+            editors.add((IMultiPageTaxonEditorPage) this.getEditor(i));
+        }
+        return editors;
+    }
+
+    /**
+     * Refreshes a certain page of the MultipageTaxonEditor
+     *
+     * @param page
+     *            a {@link eu.etaxonomy.taxeditor.editor.Page} object.
+     * @return a boolean.
+     */
+    public boolean redraw(Page page) {
+        return redraw(page, true);
+    }
+
+    /**
+     * Refreshes a certain page of the MultipageTaxonEditor and sets focus to
+     * that page
+     *
+     * @param page
+     *            a {@link eu.etaxonomy.taxeditor.editor.Page} object.
+     * @param focus
+     *            a boolean.
+     * @return a boolean.
+     */
+    public boolean redraw(Page page, boolean focus) {
+        IMultiPageTaxonEditorPage editorPage = getPage(page);
+        return editorPage != null && editorPage.redraw(focus);
+    }
+
+    /**
+     * <p>
+     * onComplete
+     * </p>
+     *
+     * @return a boolean.
+     */
+    @Override
     public boolean onComplete() {
-               return false;
-       }
+        return false;
+    }
 
     /**
      * Reloads the data for this
      */
     public void reload() {
         if (isDirty()) {
-            AbstractUtility.warningDialog("Editor has unsaved data", getClass(), "This editor can not be "
+            MessagingUtils.warningDialog("Editor has unsaved data", getClass(), "This editor can not be "
                     + "refreshed because it contains unsaved data. Refreshing "
                     + "this editor would discard the changes. Please save this editor, "
                     + "close and reopen it manually in order to get the latest content");
@@ -518,22 +538,31 @@ public class MultiPageTaxonEditor extends FormEditor implements
                     editorPart.redraw();
                 }
             } catch (Exception e) {
-                AbstractUtility.errorDialog("Error refreshing editor", getClass(), "Could not refresh this editor", e);
+                MessagingUtils.messageDialog("Error refreshing editor", getClass(), "Could not refresh this editor", e);
             }
         }
     }
 
-       @Override
-       public String toString() {
-               return String.format("%s[%s]", this.getClass().getSimpleName(), getEditorInput());
-       }
+    @Override
+    public String toString() {
+        return String.format("%s[%s]", this.getClass().getSimpleName(), getEditorInput());
+    }
+
+    @Override
+    public boolean permissionsSatisfied() {
+        IEditorPart activeEditor = getActiveEditor();
+        if(activeEditor != null && ISecuredEditor.class.isAssignableFrom(activeEditor.getClass())){
+            return ((ISecuredEditor)activeEditor).permissionsSatisfied();
+        }
+        return true;
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.model.IPartContentHasMedia#canAttachMedia()
+     */
+    @Override
+    public boolean canAttachMedia() {
+        return true;
+    }
 
-       @Override
-       public boolean permissionsSatisfied() {
-               IEditorPart activeEditor = getActiveEditor();
-               if(activeEditor != null && ISecuredEditor.class.isAssignableFrom(activeEditor.getClass())){
-                       return ((ISecuredEditor)activeEditor).permissionsSatisfied();
-               }
-               return true;
-       }
 }