minor
authorn.hoffmann <n.hoffmann@localhost>
Thu, 21 Apr 2011 15:02:23 +0000 (15:02 +0000)
committern.hoffmann <n.hoffmann@localhost>
Thu, 21 Apr 2011 15:02:23 +0000 (15:02 +0000)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/TaxonNameEditor.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java

index fc11c445660c8b638621a70542d0c88dd4467df7..37b99454db074d2f364026a7a36dc14884051b3c 100644 (file)
@@ -1,11 +1,11 @@
 /**
 /**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
-* http://www.e-taxonomy.eu
-* 
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy 
+ * http://www.e-taxonomy.eu
+ 
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
 
 package eu.etaxonomy.taxeditor.editor.name;
 
 
 package eu.etaxonomy.taxeditor.editor.name;
 
@@ -72,31 +72,35 @@ import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 import eu.etaxonomy.taxeditor.preference.Resources;
 
 /**
 import eu.etaxonomy.taxeditor.preference.Resources;
 
 /**
- * <p>TaxonNameEditor class.</p>
- *
+ * <p>
+ * TaxonNameEditor class.
+ * </p>
+ * 
  * @author p.ciardelli
  * @author n.hoffmann
  * @created 15.05.2008
  * @version 1.0
  */
  * @author p.ciardelli
  * @author n.hoffmann
  * @created 15.05.2008
  * @version 1.0
  */
-public class TaxonNameEditor extends EditorPart implements IMultiPageTaxonEditorPage, IAdaptable, IConversationEnabled, IPostOperationEnabled, IPartContentHasDetails, IPartChangeListener
-               , ISelectionListener, IDropTargetable {
-       
+public class TaxonNameEditor extends EditorPart implements
+               IMultiPageTaxonEditorPage, IAdaptable, IConversationEnabled,
+               IPostOperationEnabled, IPartContentHasDetails, IPartChangeListener,
+               ISelectionListener, IDropTargetable {
+
        /** Constant <code>ID="eu.etaxonomy.taxeditor.editor.taxon.name"</code> */
        public static final String ID = "eu.etaxonomy.taxeditor.editor.taxon.name";
        /** Constant <code>ID="eu.etaxonomy.taxeditor.editor.taxon.name"</code> */
        public static final String ID = "eu.etaxonomy.taxeditor.editor.taxon.name";
-       
+
        private Taxon taxon;
        private Taxon taxon;
-       
+
        private ManagedForm managedForm;
        private ManagedForm managedForm;
-       private ScrolledForm scrolledForm; 
+       private ScrolledForm scrolledForm;
        private Composite parent;
        private ISelectionProvider provider;
        private Composite parent;
        private ISelectionProvider provider;
-       
-       private MultiPageTaxonEditor editor;
-       
+
+       private final MultiPageTaxonEditor editor;
+
        private TaxonBase selection;
        private TaxonBase selection;
-               
-       private ConversationHolder conversation;
+
+       private final ConversationHolder conversation;
 
        private MenuManager menuManager;
 
 
        private MenuManager menuManager;
 
@@ -106,451 +110,516 @@ public class TaxonNameEditor extends EditorPart implements IMultiPageTaxonEditor
 
        private ConceptGroup conceptGroup;
 
 
        private ConceptGroup conceptGroup;
 
-       private List<HomotypicalSynonymGroup> heterotypicSynonymGroups = new ArrayList<HomotypicalSynonymGroup>();
-       
+       private final List<HomotypicalSynonymGroup> heterotypicSynonymGroups = new ArrayList<HomotypicalSynonymGroup>();
+
        private DropTarget target;
        private DropTarget target;
-       
+
        private ISelectionService selectionService;
 
        private AcceptedGroup acceptedGroup;
 
        private TaxonBase objectAffectedByLastOperation;
        private ISelectionService selectionService;
 
        private AcceptedGroup acceptedGroup;
 
        private TaxonBase objectAffectedByLastOperation;
-       
+
        /**
        /**
-        * <p>Constructor for TaxonNameEditor.</p>
-        *
-        * @param editor a {@link eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor} object.
+        * <p>
+        * Constructor for TaxonNameEditor.
+        * </p>
+        * 
+        * @param editor
+        *            a {@link eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor}
+        *            object.
         */
         */
-       public TaxonNameEditor(MultiPageTaxonEditor editor){
+       public TaxonNameEditor(MultiPageTaxonEditor editor) {
                this.editor = editor;
                conversation = editor.getConversationHolder();
        }
 
                this.editor = editor;
                conversation = editor.getConversationHolder();
        }
 
-       
-       
        /**
        /**
-        * <p>getUndoContext</p>
-        *
-        * @return a {@link org.eclipse.core.commands.operations.IUndoContext} object.
+        * <p>
+        * getUndoContext
+        * </p>
+        * 
+        * @return a {@link org.eclipse.core.commands.operations.IUndoContext}
+        *         object.
         */
        public IUndoContext getUndoContext() {
                return editor.getUndoContext();
        }
 
         */
        public IUndoContext getUndoContext() {
                return editor.getUndoContext();
        }
 
-       /* (non-Javadoc)
-        * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets
+        * .Composite)
         */
        /** {@inheritDoc} */
         */
        /** {@inheritDoc} */
+       @Override
        public void createPartControl(Composite composite) {
                selectionService = getSite().getWorkbenchWindow().getSelectionService();
                selectionService.addSelectionListener(this);
        public void createPartControl(Composite composite) {
                selectionService = getSite().getWorkbenchWindow().getSelectionService();
                selectionService.addSelectionListener(this);
-               
+
                createManagedForm(composite);
                createManagedForm(composite);
-               
-               TaxeditorPartService.getInstance().addListener(TaxeditorPartService.PART_ACTIVATED, this);
+
+               TaxeditorPartService.getInstance().addListener(
+                               TaxeditorPartService.PART_ACTIVATED, this);
        }
        }
-       
+
        /**
        /**
-        * <p>createManagedForm</p>
-        *
-        * @param composite a {@link org.eclipse.swt.widgets.Composite} object.
+        * <p>
+        * createManagedForm
+        * </p>
+        * 
+        * @param composite
+        *            a {@link org.eclipse.swt.widgets.Composite} object.
         */
        protected void createManagedForm(Composite composite) {
         */
        protected void createManagedForm(Composite composite) {
-                               
+
                managedForm = new ManagedForm(composite) {
                managedForm = new ManagedForm(composite) {
-                       
+
+                       @Override
                        public void dirtyStateChanged() {
                                firePropertyChange(PROP_DIRTY);
                        }
                        public void dirtyStateChanged() {
                                firePropertyChange(PROP_DIRTY);
                        }
+
+                       @Override
                        public boolean setInput(Object input) {
                                if (input instanceof AbstractGroupedContainer) {
                                        selection = ((AbstractGroupedContainer) input).getData();
                                        provider.setSelection(new StructuredSelection(selection));
                                }
                        public boolean setInput(Object input) {
                                if (input instanceof AbstractGroupedContainer) {
                                        selection = ((AbstractGroupedContainer) input).getData();
                                        provider.setSelection(new StructuredSelection(selection));
                                }
-                               return super.setInput(input); 
+                               return super.setInput(input);
                        }
                };
                        }
                };
-               
-               
+
                scrolledForm = managedForm.getForm();
                parent = scrolledForm.getBody();
                scrolledForm = managedForm.getForm();
                parent = scrolledForm.getBody();
-               
+
                // register the context menu
                menuManager = new MenuManager();
                ISelectionProvider selectionProvider = getSite().getSelectionProvider();
                // register the context menu
                menuManager = new MenuManager();
                ISelectionProvider selectionProvider = getSite().getSelectionProvider();
-               getSite().registerContextMenu(TaxonNameEditor.ID, menuManager, selectionProvider);
-                               
+               getSite().registerContextMenu(TaxonNameEditor.ID, menuManager,
+                               selectionProvider);
+
                parent.setData(taxon);
                parent.setData(taxon);
-               
+
                TableWrapLayout layout = new TableWrapLayout();
                layout.leftMargin = 0;
                layout.rightMargin = 0;
                layout.topMargin = 0;
                layout.bottomMargin = 0;
                TableWrapLayout layout = new TableWrapLayout();
                layout.leftMargin = 0;
                layout.rightMargin = 0;
                layout.topMargin = 0;
                layout.bottomMargin = 0;
-               
+
                layout.verticalSpacing = 0;
                layout.horizontalSpacing = 0;
                layout.verticalSpacing = 0;
                layout.horizontalSpacing = 0;
-               
-               parent.setLayout(layout);       
-               parent.setBackground(EditorUtil.getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
-               
+
+               parent.setLayout(layout);
+               parent.setBackground(EditorUtil
+                               .getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
+
                createOrUpdateNameComposites();
                createOrUpdateNameComposites();
-               
+
                createDragSupport();
                createDragSupport();
-               
+
                setFocus();
        }
                setFocus();
        }
-       
+
        /**
        /**
-        * <p>createNameComposites</p>
+        * <p>
+        * createNameComposites
+        * </p>
         */
         */
-       public void createOrUpdateNameComposites(){
-               
+       public void createOrUpdateNameComposites() {
+
                ContainerFactory.createOrUpdateAcceptedTaxonsHomotypicGroup(this);
                ContainerFactory.createOrUpdateHeterotypicSynonymyGroups(this);
                ContainerFactory.createOrUpdateMisapplicationsGroup(this);
                ContainerFactory.createOrUpdateConceptGroup(this);
                ContainerFactory.createOrUpdateAcceptedTaxonsHomotypicGroup(this);
                ContainerFactory.createOrUpdateHeterotypicSynonymyGroups(this);
                ContainerFactory.createOrUpdateMisapplicationsGroup(this);
                ContainerFactory.createOrUpdateConceptGroup(this);
-                               
+
                // Redraw composite
                managedForm.reflow(true);
        }
 
                // Redraw composite
                managedForm.reflow(true);
        }
 
-
-
-
        /**
        /**
-        * <p>Getter for the field <code>taxon</code>.</p>
-        *
+        * <p>
+        * Getter for the field <code>taxon</code>.
+        * </p>
+        * 
         * @return a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
         */
        public Taxon getTaxon() {
                return (Taxon) HibernateProxyHelper.deproxy(taxon);
        }
         * @return a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
         */
        public Taxon getTaxon() {
                return (Taxon) HibernateProxyHelper.deproxy(taxon);
        }
-       
+
        /**
        /**
-        * <p>setDirty</p>
+        * <p>
+        * setDirty
+        * </p>
         */
        public void setDirty() {
                managedForm.dirtyStateChanged();
        }
         */
        public void setDirty() {
                managedForm.dirtyStateChanged();
        }
-       
-       
+
        /*
         * (non-Javadoc)
        /*
         * (non-Javadoc)
+        * 
         * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
         */
        /** {@inheritDoc} */
        @Override
         * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
         */
        /** {@inheritDoc} */
        @Override
-       public void setFocus(){
-               if(getSelectedContainer() == null){
-                       throw new IllegalStateException("There should always be a selected object.");
+       public void setFocus() {
+               if (getSelectedContainer() == null) {
+                       throw new IllegalStateException(
+                                       "There should always be a selected object.");
                }
                getSelectedContainer().setSelected();
        }
                }
                getSelectedContainer().setSelected();
        }
-       
+
        /** {@inheritDoc} */
        /** {@inheritDoc} */
-       public void setInput(IEditorInput input){
+       @Override
+       public void setInput(IEditorInput input) {
                this.setInputWithNotify(input);
        }
                this.setInputWithNotify(input);
        }
-       
+
        /*
         * (non-Javadoc)
        /*
         * (non-Javadoc)
-        * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder()
+        * 
+        * @see
+        * eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder
+        * ()
         */
        /**
         */
        /**
-        * <p>getConversationHolder</p>
-        *
-        * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
+        * <p>
+        * getConversationHolder
+        * </p>
+        * 
+        * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
+        *         object.
         */
         */
-       public ConversationHolder getConversationHolder(){
+       public ConversationHolder getConversationHolder() {
                return conversation;
        }
                return conversation;
        }
-       
+
        /*
         * (non-Javadoc)
        /*
         * (non-Javadoc)
-        * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostCrudObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmCrudEvent)
+        * 
+        * @see
+        * eu.etaxonomy.cdm.persistence.hibernate.ICdmPostCrudObserver#update(eu
+        * .etaxonomy.cdm.persistence.hibernate.CdmCrudEvent)
         */
        /** {@inheritDoc} */
        public void update(CdmDataChangeMap events) {
         */
        /** {@inheritDoc} */
        public void update(CdmDataChangeMap events) {
-               //redraw();
+               // redraw();
        }
        }
-       
+
        /**
        /**
-        * Redraws this editor
-        * return true on success
-        *
+        * Redraws this editor return true on success
+        * 
         * @return a boolean.
         */
         * @return a boolean.
         */
-       public boolean redraw(){
+       public boolean redraw() {
                return redraw(true);
        }
                return redraw(true);
        }
-       
+
        /**
         * {@inheritDoc}
        /**
         * {@inheritDoc}
-        *
+        * 
         * Redraws the editor controls
         */
        public boolean redraw(boolean focus) {
         * Redraws the editor controls
         */
        public boolean redraw(boolean focus) {
-               
+
                createOrUpdateNameComposites();
                createOrUpdateNameComposites();
-               
-               if(focus){
+
+               if (focus) {
                        setFocus();
                }
                        setFocus();
                }
-               
-               return true;            
+
+               return true;
        }
 
        }
 
-       
        /**
        /**
-        * <p>getMultiPageTaxonEditor</p>
-        *
-        * @return a {@link eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor} object.
+        * <p>
+        * getMultiPageTaxonEditor
+        * </p>
+        * 
+        * @return a {@link eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor}
+        *         object.
         */
        public MultiPageTaxonEditor getMultiPageTaxonEditor() {
                return editor;
        }
 
         */
        public MultiPageTaxonEditor getMultiPageTaxonEditor() {
                return editor;
        }
 
-
        /*
         * (non-Javadoc)
        /*
         * (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.store.operations.IPostOperationEnabled#postOperation()
+        * 
+        * @see
+        * eu.etaxonomy.taxeditor.store.operations.IPostOperationEnabled#postOperation
+        * ()
         */
        /** {@inheritDoc} */
        public boolean postOperation(CdmBase objectAffectedByOperation) {
         */
        /** {@inheritDoc} */
        public boolean postOperation(CdmBase objectAffectedByOperation) {
-               
+
                editor.changed(objectAffectedByOperation);
                editor.changed(objectAffectedByOperation);
-               
+
                redraw(false);
                redraw(false);
-               
-               if(objectAffectedByOperation instanceof TaxonBase){
+
+               if (objectAffectedByOperation instanceof TaxonBase) {
                        objectAffectedByLastOperation = (TaxonBase) objectAffectedByOperation;
                }
                        objectAffectedByLastOperation = (TaxonBase) objectAffectedByOperation;
                }
-               
+
                return true;
        }
                return true;
        }
-       
+
        /**
        /**
-        * <p>Getter for the field <code>managedForm</code>.</p>
-        *
+        * <p>
+        * Getter for the field <code>managedForm</code>.
+        * </p>
+        * 
         * @return the managedForm
         */
        public ManagedForm getManagedForm() {
                return managedForm;
        }
         * @return the managedForm
         */
        public ManagedForm getManagedForm() {
                return managedForm;
        }
-       
+
        /**
        /**
-        * <p>getControl</p>
-        *
+        * <p>
+        * getControl
+        * </p>
+        * 
         * @return a {@link org.eclipse.swt.widgets.Composite} object.
         */
        public Composite getControl() {
                return this.getManagedForm().getForm().getBody();
        }
         * @return a {@link org.eclipse.swt.widgets.Composite} object.
         */
        public Composite getControl() {
                return this.getManagedForm().getForm().getBody();
        }
-       
 
        /**
 
        /**
-        * <p>Getter for the field <code>menu</code>.</p>
-        *
+        * <p>
+        * Getter for the field <code>menu</code>.
+        * </p>
+        * 
         * @return the menu
         */
        public Menu getMenu() {
         * @return the menu
         */
        public Menu getMenu() {
-               if(menu == null || menu.isDisposed()){
-                       // Creating the menu because it was either not initialised or disposed while refreshing the editor 
+               if (menu == null || menu.isDisposed()) {
+                       // Creating the menu because it was either not initialised or
+                       // disposed while refreshing the editor
                        menu = menuManager.createContextMenu(parent);
                }
                return menu;
        }
 
        /**
                        menu = menuManager.createContextMenu(parent);
                }
                return menu;
        }
 
        /**
-        * <p>checkForEmptyNames</p>
-        *
+        * <p>
+        * checkForEmptyNames
+        * </p>
+        * 
         * @return true if there are empty names
         */
        public boolean checkForEmptyNames() {
         * @return true if there are empty names
         */
        public boolean checkForEmptyNames() {
-               for(AbstractGroupedContainer container : getGroupedContainers()){
-                       if(container.getName() == null || StringUtils.isEmpty(container.getName().getTitleCache())){
+               for (AbstractGroupedContainer container : getGroupedContainers()) {
+                       if (container.getName() == null
+                                       || StringUtils.isEmpty(container.getName().getTitleCache())) {
                                return true;
                        }
                }
                return false;
        }
                                return true;
                        }
                }
                return false;
        }
-    
 
 
-       public Set<AbstractGroupedContainer> getEmptyContainers(){
+       public Set<AbstractGroupedContainer> getEmptyContainers() {
                Set<AbstractGroupedContainer> containersWithEmptyNames = new HashSet<AbstractGroupedContainer>();
                Set<AbstractGroupedContainer> containersWithEmptyNames = new HashSet<AbstractGroupedContainer>();
-               
-               for(AbstractGroupedContainer container : getGroupedContainers()){
-                       if(container.getName() == null || StringUtils.isEmpty(container.getName().getTitleCache())){
+
+               for (AbstractGroupedContainer container : getGroupedContainers()) {
+                       if (container.getName() == null
+                                       || StringUtils.isEmpty(container.getName().getTitleCache())) {
                                containersWithEmptyNames.add(container);
                        }
                }
                                containersWithEmptyNames.add(container);
                        }
                }
-               
+
                return containersWithEmptyNames;
        }
                return containersWithEmptyNames;
        }
-       
+
        /** {@inheritDoc} */
        @Override
        public void doSave(IProgressMonitor monitor) {
 
                monitor.beginTask("Saving names", getGroupedContainers().size());
 
        /** {@inheritDoc} */
        @Override
        public void doSave(IProgressMonitor monitor) {
 
                monitor.beginTask("Saving names", getGroupedContainers().size());
 
-        try {
+               try {
                        // check for empty names
                        // check for empty names
-                       for(AbstractGroupedContainer container : getGroupedContainers()){
-                               
-                               monitor.subTask("Saving composite: " + container.getTaxonBase().getTitleCache());
+                       for (AbstractGroupedContainer container : getGroupedContainers()) {
+
+                               monitor.subTask("Saving composite: "
+                                               + container.getTaxonBase().getTitleCache());
                                container.persistName();
                                container.persistName();
-                               
+
                                // In case the progress monitor was canceled throw an exception.
                                if (monitor.isCanceled()) {
                                // In case the progress monitor was canceled throw an exception.
                                if (monitor.isCanceled()) {
-                       throw new OperationCanceledException();
-                   }
-                               
+                                       throw new OperationCanceledException();
+                               }
+
                                // Otherwise declare this step as done.
                                monitor.worked(1);
                        }
                                // Otherwise declare this step as done.
                                monitor.worked(1);
                        }
-        }
-        finally {
-               
-               // Stop the progress monitor.
-               monitor.done();
-        }
-               
+               } finally {
+
+                       // Stop the progress monitor.
+                       monitor.done();
+               }
+
        }
 
        /** {@inheritDoc} */
        @Override
        }
 
        /** {@inheritDoc} */
        @Override
-       public void doSaveAs() {}
+       public void doSaveAs() {
+       }
 
        /** {@inheritDoc} */
        @Override
        public void init(IEditorSite site, IEditorInput input)
                        throws PartInitException {
 
        /** {@inheritDoc} */
        @Override
        public void init(IEditorSite site, IEditorInput input)
                        throws PartInitException {
-                               
+
                if (!(input instanceof IEditorInput))
                if (!(input instanceof IEditorInput))
-                       throw new PartInitException(
-                               "Invalid Input: Must be IEditorInput");
-               
+                       throw new PartInitException("Invalid Input: Must be IEditorInput");
+
                if (input.getAdapter(Taxon.class) != null) {
                        taxon = (Taxon) input.getAdapter(Taxon.class);
                } else {
                if (input.getAdapter(Taxon.class) != null) {
                        taxon = (Taxon) input.getAdapter(Taxon.class);
                } else {
-                       throw new PartInitException(
-                               "Invalid Input: Taxon cannot be null");
+                       throw new PartInitException("Invalid Input: Taxon cannot be null");
                }
 
                setSite(site);
                setInput(input);
                }
 
                setSite(site);
                setInput(input);
-               
+
                provider = new SimpleSelectionProvider();
                getSite().setSelectionProvider(provider);
        }
                provider = new SimpleSelectionProvider();
                getSite().setSelectionProvider(provider);
        }
-               
+
        /**
         * 
         */
        private void createDragSupport() {
                // Listen for names being dragged outside of existing homotypic groups -
        /**
         * 
         */
        private void createDragSupport() {
                // Listen for names being dragged outside of existing homotypic groups -
-               //  user wants to create a new group
-               Transfer[] types = new Transfer[] {CdmDataTransfer.getInstance()};
+               // user wants to create a new group
+               Transfer[] types = new Transfer[] { CdmDataTransfer.getInstance() };
                int operations = DND.DROP_MOVE;
                int operations = DND.DROP_MOVE;
-               if(target == null){
+               if (target == null) {
                        target = new DropTarget(parent, operations);
                        target.setTransfer(types);
                        target.addDropListener(new NameEditorDropTargetListener(this));
                        target = new DropTarget(parent, operations);
                        target.setTransfer(types);
                        target.addDropListener(new NameEditorDropTargetListener(this));
-               }               
+               }
        }
 
        /**
        }
 
        /**
-        * <p>Getter for the field <code>acceptedNameContainer</code>.</p>
-        *
-        * @return a {@link eu.etaxonomy.taxeditor.editor.name.container.AcceptedNameContainer} object.
+        * <p>
+        * Getter for the field <code>acceptedNameContainer</code>.
+        * </p>
+        * 
+        * @return a
+        *         {@link eu.etaxonomy.taxeditor.editor.name.container.AcceptedNameContainer}
+        *         object.
         */
        public AcceptedNameContainer getAcceptedNameContainer() {
                return getAcceptedGroup().getAcceptedNameContainer();
        }
         */
        public AcceptedNameContainer getAcceptedNameContainer() {
                return getAcceptedGroup().getAcceptedNameContainer();
        }
-       
+
        /**
        /**
-        * <p>getSynonymGroup</p>
-        *
-        * @param homotypicalGroup a {@link eu.etaxonomy.cdm.model.name.HomotypicalGroup} object.
-        * @return a {@link eu.etaxonomy.taxeditor.editor.name.container.HomotypicalSynonymGroup} object.
-        */
-       public HomotypicalSynonymGroup getHomotypicalGroupContainer(HomotypicalGroup homotypicalGroup) {
-               for(HomotypicalSynonymGroup group : getHeterotypicSynonymGroups()){
-                       if(group.getGroup().equals(homotypicalGroup)){
+        * <p>
+        * getSynonymGroup
+        * </p>
+        * 
+        * @param homotypicalGroup
+        *            a {@link eu.etaxonomy.cdm.model.name.HomotypicalGroup} object.
+        * @return a
+        *         {@link eu.etaxonomy.taxeditor.editor.name.container.HomotypicalSynonymGroup}
+        *         object.
+        */
+       public HomotypicalSynonymGroup getHomotypicalGroupContainer(
+                       HomotypicalGroup homotypicalGroup) {
+               for (HomotypicalSynonymGroup group : getHeterotypicSynonymGroups()) {
+                       if (group.getGroup().equals(homotypicalGroup)) {
                                return group;
                        }
                }
                                return group;
                        }
                }
-               
+
                return null;
        }
                return null;
        }
-       
+
        /**
        /**
-        * <p>Getter for the field <code>conceptGroup</code>.</p>
-        *
-        * @return a {@link eu.etaxonomy.taxeditor.editor.name.container.ConceptGroup} object.
+        * <p>
+        * Getter for the field <code>conceptGroup</code>.
+        * </p>
+        * 
+        * @return a
+        *         {@link eu.etaxonomy.taxeditor.editor.name.container.ConceptGroup}
+        *         object.
         */
        public ConceptGroup getConceptGroup() {
                return conceptGroup;
        }
         */
        public ConceptGroup getConceptGroup() {
                return conceptGroup;
        }
-       
+
        /**
        /**
-        * <p>getDirtyNames</p>
-        *
+        * <p>
+        * getDirtyNames
+        * </p>
+        * 
         * @return a Set containing all composites that have been edited
         */
         * @return a Set containing all composites that have been edited
         */
-       public Set<AbstractGroupedContainer> getDirtyNames(){
+       public Set<AbstractGroupedContainer> getDirtyNames() {
                Set<AbstractGroupedContainer> dirtyNames = new HashSet<AbstractGroupedContainer>();
                Set<AbstractGroupedContainer> dirtyNames = new HashSet<AbstractGroupedContainer>();
-               
-               for(AbstractGroupedContainer composite : getGroupedContainers()){
-                       if(composite.isDirty()){
+
+               for (AbstractGroupedContainer composite : getGroupedContainers()) {
+                       if (composite.isDirty()) {
                                dirtyNames.add(composite);
                        }
                }
                                dirtyNames.add(composite);
                        }
                }
-               
+
                return dirtyNames;
        }
                return dirtyNames;
        }
-       
+
        /**
        /**
-        * <p>getGroupedContainers</p>
-        *
+        * <p>
+        * getGroupedContainers
+        * </p>
+        * 
         * @return a {@link java.util.List} object.
         */
         * @return a {@link java.util.List} object.
         */
-       public List<AbstractGroupedContainer> getGroupedContainers(){
+       public List<AbstractGroupedContainer> getGroupedContainers() {
                List<AbstractGroupedContainer> groupedComposites = new ArrayList<AbstractGroupedContainer>();
                List<AbstractGroupedContainer> groupedComposites = new ArrayList<AbstractGroupedContainer>();
-               
-               for(AbstractGroup group : getAllGroups()){
+
+               for (AbstractGroup group : getAllGroups()) {
                        groupedComposites.addAll(group.getGroupedContainers());
                }
                        groupedComposites.addAll(group.getGroupedContainers());
                }
-               
+
                return groupedComposites;
        }
                return groupedComposites;
        }
-       
+
        /**
        /**
-        * <p>getAllGroups</p>
-        *
+        * <p>
+        * getAllGroups
+        * </p>
+        * 
         * @return a {@link java.util.List} object.
         */
         * @return a {@link java.util.List} object.
         */
-       public List<AbstractGroup> getAllGroups(){
+       public List<AbstractGroup> getAllGroups() {
                List<AbstractGroup> allGroups = new ArrayList<AbstractGroup>();
                List<AbstractGroup> allGroups = new ArrayList<AbstractGroup>();
-               
+
                allGroups.add(getAcceptedGroup());
                allGroups.add(getAcceptedGroup());
-               
+
                allGroups.addAll(getHeterotypicSynonymGroups());
                allGroups.addAll(getHeterotypicSynonymGroups());
-                               
-               if(misappliedGroup != null){
+
+               if (misappliedGroup != null) {
                        allGroups.add(misappliedGroup);
                }
                        allGroups.add(misappliedGroup);
                }
-               
-               if(conceptGroup != null){
+
+               if (conceptGroup != null) {
                        allGroups.add(conceptGroup);
                }
                        allGroups.add(conceptGroup);
                }
-               
+
                return allGroups;
        }
 
                return allGroups;
        }
 
-       /* (non-Javadoc)
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.eclipse.ui.part.EditorPart#isDirty()
         */
        /** {@inheritDoc} */
         * @see org.eclipse.ui.part.EditorPart#isDirty()
         */
        /** {@inheritDoc} */
@@ -558,8 +627,10 @@ public class TaxonNameEditor extends EditorPart implements IMultiPageTaxonEditor
        public boolean isDirty() {
                return editor.isDirty();
        }
        public boolean isDirty() {
                return editor.isDirty();
        }
-       
-       /* (non-Javadoc)
+
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.eclipse.ui.part.WorkbenchPart#dispose()
         */
        /** {@inheritDoc} */
         * @see org.eclipse.ui.part.WorkbenchPart#dispose()
         */
        /** {@inheritDoc} */
@@ -568,7 +639,9 @@ public class TaxonNameEditor extends EditorPart implements IMultiPageTaxonEditor
                super.dispose();
        }
 
                super.dispose();
        }
 
-       /* (non-Javadoc)
+       /*
+        * (non-Javadoc)
+        * 
         * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
         */
        /** {@inheritDoc} */
         * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
         */
        /** {@inheritDoc} */
@@ -576,74 +649,100 @@ public class TaxonNameEditor extends EditorPart implements IMultiPageTaxonEditor
        public boolean isSaveAsAllowed() {
                return false;
        }
        public boolean isSaveAsAllowed() {
                return false;
        }
-       
+
        /*
         * (non-Javadoc)
        /*
         * (non-Javadoc)
-        * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+        * 
+        * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.
+        * IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
         */
        /** {@inheritDoc} */
        public void selectionChanged(IWorkbenchPart part, ISelection selection) {
         */
        /** {@inheritDoc} */
        public void selectionChanged(IWorkbenchPart part, ISelection selection) {
-               
+
        }
 
        /**
        }
 
        /**
-        * <p>getNameEditor</p>
-        *
-        * @return a {@link eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor} object.
+        * <p>
+        * getNameEditor
+        * </p>
+        * 
+        * @return a {@link eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor}
+        *         object.
         */
        public TaxonNameEditor getEditor() {
                return this;
        }
 
        /**
         */
        public TaxonNameEditor getEditor() {
                return this;
        }
 
        /**
-        * <p>Getter for the field <code>selectedObject</code>.</p>
-        *
-        * @return a {@link eu.etaxonomy.taxeditor.editor.name.container.AbstractGroupedContainer} object.
+        * <p>
+        * Getter for the field <code>selectedObject</code>.
+        * </p>
+        * 
+        * @return a
+        *         {@link eu.etaxonomy.taxeditor.editor.name.container.AbstractGroupedContainer}
+        *         object.
         */
         */
-       public AbstractGroupedContainer getSelectedContainer(){
-               
+       public AbstractGroupedContainer getSelectedContainer() {
+
                TaxonBase selectedTaxonBase = null;
                TaxonBase selectedTaxonBase = null;
-               
+
                TaxonEditorInput input = (TaxonEditorInput) editor.getEditorInput();
                TaxonEditorInput input = (TaxonEditorInput) editor.getEditorInput();
-               if(input.getInitiallySelectedTaxonBase() != null){
+               if (input.getInitiallySelectedTaxonBase() != null) {
                        selectedTaxonBase = input.getInitiallySelectedTaxonBase();
                        selectedTaxonBase = input.getInitiallySelectedTaxonBase();
-               }else{
-                       if(selection != null){
+               } else {
+                       if (selection != null) {
                                selectedTaxonBase = selection;
                        }
                }
                                selectedTaxonBase = selection;
                        }
                }
-                               
-               return (selectedTaxonBase != null) ? getContainer(selectedTaxonBase) : getAcceptedNameContainer();
+
+               return (selectedTaxonBase != null) ? getContainer(selectedTaxonBase)
+                               : getAcceptedNameContainer();
        }
        }
-       
+
        /**
        /**
-        * <p>dragEntered</p>
+        * <p>
+        * dragEntered
+        * </p>
         */
        public void dragEntered() {
                // TODO change this
         */
        public void dragEntered() {
                // TODO change this
-               getControl().setBackground(EditorUtil.getColor(Resources.COLOR_DRAG_ENTER));
+               getControl().setBackground(
+                               EditorUtil.getColor(Resources.COLOR_DRAG_ENTER));
        }
 
        /**
        }
 
        /**
-        * <p>dragLeft</p>
+        * <p>
+        * dragLeft
+        * </p>
         */
        public void dragLeft() {
         */
        public void dragLeft() {
-               getControl().setBackground(EditorUtil.getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
+               getControl().setBackground(
+                               EditorUtil.getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
        }
 
        /**
        }
 
        /**
-        * <p>Setter for the field <code>conceptGroup</code>.</p>
-        *
-        * @param conceptGroup a {@link eu.etaxonomy.taxeditor.editor.name.container.ConceptGroup} object.
+        * <p>
+        * Setter for the field <code>conceptGroup</code>.
+        * </p>
+        * 
+        * @param conceptGroup
+        *            a
+        *            {@link eu.etaxonomy.taxeditor.editor.name.container.ConceptGroup}
+        *            object.
         */
        public void setConceptGroup(ConceptGroup conceptGroup) {
                this.conceptGroup = conceptGroup;
        }
 
        /**
         */
        public void setConceptGroup(ConceptGroup conceptGroup) {
                this.conceptGroup = conceptGroup;
        }
 
        /**
-        * <p>setMisapplicationsGroup</p>
-        *
-        * @param misappliedGroup a {@link eu.etaxonomy.taxeditor.editor.name.container.MisappliedGroup} object.
+        * <p>
+        * setMisapplicationsGroup
+        * </p>
+        * 
+        * @param misappliedGroup
+        *            a
+        *            {@link eu.etaxonomy.taxeditor.editor.name.container.MisappliedGroup}
+        *            object.
         */
        public void setMisapplicationsGroup(MisappliedGroup misappliedGroup) {
                this.misappliedGroup = misappliedGroup;
         */
        public void setMisapplicationsGroup(MisappliedGroup misappliedGroup) {
                this.misappliedGroup = misappliedGroup;
@@ -651,11 +750,15 @@ public class TaxonNameEditor extends EditorPart implements IMultiPageTaxonEditor
 
        /*
         * (non-Javadoc)
 
        /*
         * (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.editor.IMultiPageTaxonEditorPage#isRedrawing()
+        * 
+        * @see
+        * eu.etaxonomy.taxeditor.editor.IMultiPageTaxonEditorPage#isRedrawing()
         */
        /**
         */
        /**
-        * <p>isRedrawing</p>
-        *
+        * <p>
+        * isRedrawing
+        * </p>
+        * 
         * @return a boolean.
         */
        public boolean isRedrawing() {
         * @return a boolean.
         */
        public boolean isRedrawing() {
@@ -663,8 +766,10 @@ public class TaxonNameEditor extends EditorPart implements IMultiPageTaxonEditor
        }
 
        /**
        }
 
        /**
-        * <p>getToolkit</p>
-        *
+        * <p>
+        * getToolkit
+        * </p>
+        * 
         * @return a {@link org.eclipse.ui.forms.widgets.FormToolkit} object.
         */
        public FormToolkit getToolkit() {
         * @return a {@link org.eclipse.ui.forms.widgets.FormToolkit} object.
         */
        public FormToolkit getToolkit() {
@@ -672,48 +777,59 @@ public class TaxonNameEditor extends EditorPart implements IMultiPageTaxonEditor
        }
 
        /**
        }
 
        /**
-        * <p>getHeterotypicSynonymGroups</p>
-        *
+        * <p>
+        * getHeterotypicSynonymGroups
+        * </p>
+        * 
         * @return a {@link java.util.List} object.
         */
         * @return a {@link java.util.List} object.
         */
-       public List<HomotypicalSynonymGroup> getHeterotypicSynonymGroups(){
+       public List<HomotypicalSynonymGroup> getHeterotypicSynonymGroups() {
                return heterotypicSynonymGroups;
        }
                return heterotypicSynonymGroups;
        }
-       
 
        /**
 
        /**
-        * <p>addHeterotypicSynonymGroup</p>
-        *
-        * @param group a {@link eu.etaxonomy.taxeditor.editor.name.container.HomotypicalSynonymGroup} object.
+        * <p>
+        * addHeterotypicSynonymGroup
+        * </p>
+        * 
+        * @param group
+        *            a
+        *            {@link eu.etaxonomy.taxeditor.editor.name.container.HomotypicalSynonymGroup}
+        *            object.
         */
        public void addHeterotypicSynonymGroup(HomotypicalSynonymGroup group) {
                heterotypicSynonymGroups.add(group);
        }
         */
        public void addHeterotypicSynonymGroup(HomotypicalSynonymGroup group) {
                heterotypicSynonymGroups.add(group);
        }
-       
+
        /**
        /**
-        * <p>getHomotypicSynonymGroup</p>
-        *
-        * @return a {@link eu.etaxonomy.taxeditor.editor.name.container.HomotypicalSynonymGroup} object.
+        * <p>
+        * getHomotypicSynonymGroup
+        * </p>
+        * 
+        * @return a
+        *         {@link eu.etaxonomy.taxeditor.editor.name.container.HomotypicalSynonymGroup}
+        *         object.
         */
        public AcceptedGroup getAcceptedGroup() {
                return acceptedGroup;
        }
 
         */
        public AcceptedGroup getAcceptedGroup() {
                return acceptedGroup;
        }
 
-
-
        /**
         * 
         * @param acceptedGroup
         */
        /**
         * 
         * @param acceptedGroup
         */
-       public void setAcceptedGroup(
-                       AcceptedGroup acceptedGroup) {
+       public void setAcceptedGroup(AcceptedGroup acceptedGroup) {
                this.acceptedGroup = acceptedGroup;
        }
 
        /**
                this.acceptedGroup = acceptedGroup;
        }
 
        /**
-        * <p>Getter for the field <code>misappliedGroup</code>.</p>
-        *
-        * @return a {@link eu.etaxonomy.taxeditor.editor.name.container.MisappliedGroup} object.
+        * <p>
+        * Getter for the field <code>misappliedGroup</code>.
+        * </p>
+        * 
+        * @return a
+        *         {@link eu.etaxonomy.taxeditor.editor.name.container.MisappliedGroup}
+        *         object.
         */
        public MisappliedGroup getMisappliedGroup() {
                return misappliedGroup;
         */
        public MisappliedGroup getMisappliedGroup() {
                return misappliedGroup;
@@ -721,18 +837,22 @@ public class TaxonNameEditor extends EditorPart implements IMultiPageTaxonEditor
 
        // TODO not very useful at the moment
        /**
 
        // TODO not very useful at the moment
        /**
-        * <p>isActive</p>
-        *
+        * <p>
+        * isActive
+        * </p>
+        * 
         * @return a boolean.
         */
         * @return a boolean.
         */
-       public boolean isActive(){
+       public boolean isActive() {
                IWorkbenchPart activePart = EditorUtil.getActivePart();
                return editor.equals(activePart);
        }
 
        /**
                IWorkbenchPart activePart = EditorUtil.getActivePart();
                return editor.equals(activePart);
        }
 
        /**
-        * <p>onComplete</p>
-        *
+        * <p>
+        * onComplete
+        * </p>
+        * 
         * @return a boolean.
         */
        public boolean onComplete() {
         * @return a boolean.
         */
        public boolean onComplete() {
@@ -740,22 +860,18 @@ public class TaxonNameEditor extends EditorPart implements IMultiPageTaxonEditor
                return true;
        }
 
                return true;
        }
 
-
-
        /** {@inheritDoc} */
        public void partChanged(Integer eventType, IWorkbenchPartReference partRef) {
        /** {@inheritDoc} */
        public void partChanged(Integer eventType, IWorkbenchPartReference partRef) {
-               if(! partRef.getPart(false).equals(editor)){
-//                     getSelectedObject().colorSelected(AbstractGroupedContainer.SELECTED_NO_FOCUS);
+               if (!partRef.getPart(false).equals(editor)) {
+                       // getSelectedObject().colorSelected(AbstractGroupedContainer.SELECTED_NO_FOCUS);
                }
        }
 
                }
        }
 
-
-
        /**
         * @param retainedGroup
         */
        public void removeGroup(AbstractGroup group) {
        /**
         * @param retainedGroup
         */
        public void removeGroup(AbstractGroup group) {
-               if(group != null){
+               if (group != null) {
                        group.dispose();
                        getHeterotypicSynonymGroups().remove(group);
                }
                        group.dispose();
                        getHeterotypicSynonymGroups().remove(group);
                }
@@ -767,8 +883,9 @@ public class TaxonNameEditor extends EditorPart implements IMultiPageTaxonEditor
         */
        public AbstractGroupedContainer getContainer(TaxonBase taxonBase) {
                List<AbstractGroupedContainer> groupedContainers = getGroupedContainers();
         */
        public AbstractGroupedContainer getContainer(TaxonBase taxonBase) {
                List<AbstractGroupedContainer> groupedContainers = getGroupedContainers();
-               for(AbstractGroupedContainer container : groupedContainers){
-                       if(container.getData().equals(taxonBase) && container.getNameViewer().getTextWidget() != null){
+               for (AbstractGroupedContainer container : groupedContainers) {
+                       if (container.getData().equals(taxonBase)
+                                       && container.getNameViewer().getTextWidget() != null) {
                                return container;
                        }
                }
                                return container;
                        }
                }
index 36f2d5197aa68b51e79a0825460cc44e5da36d9e..99ea66efd06745e00588070de05bb7c50c291c4a 100644 (file)
@@ -1,12 +1,12 @@
 // $Id$
 /**
 // $Id$
 /**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
-* http://www.e-taxonomy.eu
-* 
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy 
+ * http://www.e-taxonomy.eu
+ 
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
 
 package eu.etaxonomy.taxeditor.model;
 
 
 package eu.etaxonomy.taxeditor.model;
 
@@ -57,311 +57,392 @@ import eu.etaxonomy.taxeditor.view.detail.DetailsViewPart;
 import eu.etaxonomy.taxeditor.view.supplementaldata.SupplementalDataViewPart;
 
 /**
 import eu.etaxonomy.taxeditor.view.supplementaldata.SupplementalDataViewPart;
 
 /**
- * <p>Abstract AbstractUtility class.</p>
- *
+ * <p>
+ * Abstract AbstractUtility class.
+ * </p>
+ * 
  * @author n.hoffmann
  * @created 11.05.2009
  * @version 1.0
  */
 public abstract class AbstractUtility {
  * @author n.hoffmann
  * @created 11.05.2009
  * @version 1.0
  */
 public abstract class AbstractUtility {
-       
+
        /** Constant <code>statusLineManager</code> */
        protected static IStatusLineManager statusLineManager;
        /** Constant <code>statusLineManager</code> */
        protected static IStatusLineManager statusLineManager;
-       
-       
+
        /**
        /**
-        * <p>closeAll</p>
-        *
+        * <p>
+        * closeAll
+        * </p>
+        * 
         * @return a boolean.
         */
        public static boolean closeAll() {
                return getActivePage().closeAllEditors(true);
        }
         * @return a boolean.
         */
        public static boolean closeAll() {
                return getActivePage().closeAllEditors(true);
        }
-       
+
        /**
         * Close the given editor.
        /**
         * Close the given editor.
-        *
-        * @param editor The <tt>MultipageTaxonEditor</tt> to close.
+        * 
+        * @param editor
+        *            The <tt>MultipageTaxonEditor</tt> to close.
         * @return <tt>true</tt> on success
         */
        public static boolean close(EditorPart editor) {
                return getActivePage().closeEditor(editor, true);
        }
         * @return <tt>true</tt> on success
         */
        public static boolean close(EditorPart editor) {
                return getActivePage().closeEditor(editor, true);
        }
-       
+
        /**
        /**
-        * <p>getShell</p>
-        *
+        * <p>
+        * getShell
+        * </p>
+        * 
         * @return a {@link org.eclipse.swt.widgets.Shell} object.
         */
        public static Shell getShell() {
         * @return a {@link org.eclipse.swt.widgets.Shell} object.
         */
        public static Shell getShell() {
-               
+
                return TaxeditorStorePlugin.getDefault().getWorkbench()
                                .getActiveWorkbenchWindow().getShell();
        }
                return TaxeditorStorePlugin.getDefault().getWorkbench()
                                .getActiveWorkbenchWindow().getShell();
        }
-       
+
        /**
        /**
-        * <p>getActivePage</p>
-        *
+        * <p>
+        * getActivePage
+        * </p>
+        * 
         * @return a {@link org.eclipse.ui.IWorkbenchPage} object.
         */
         * @return a {@link org.eclipse.ui.IWorkbenchPage} object.
         */
-       public static IWorkbenchPage getActivePage(){
-               
+       public static IWorkbenchPage getActivePage() {
+
                return TaxeditorStorePlugin.getDefault().getWorkbench()
                return TaxeditorStorePlugin.getDefault().getWorkbench()
-                       .getActiveWorkbenchWindow().getActivePage();
+                               .getActiveWorkbenchWindow().getActivePage();
        }
        }
-       
+
        /**
        /**
-        * <p>getActivePart</p>
-        *
+        * <p>
+        * getActivePart
+        * </p>
+        * 
         * @return a {@link org.eclipse.ui.IWorkbenchPart} object.
         */
         * @return a {@link org.eclipse.ui.IWorkbenchPart} object.
         */
-       public static IWorkbenchPart getActivePart(){
+       public static IWorkbenchPart getActivePart() {
                return getActivePage() != null ? getActivePage().getActivePart() : null;
        }
                return getActivePage() != null ? getActivePage().getActivePart() : null;
        }
-       
-       public static IWorkbench getWorkbench(){
+
+       public static IWorkbench getWorkbench() {
                return TaxeditorStorePlugin.getDefault().getWorkbench();
        }
                return TaxeditorStorePlugin.getDefault().getWorkbench();
        }
-       
+
        /**
        /**
-        * <p>getWorkbenchWindow</p>
-        *
+        * <p>
+        * getWorkbenchWindow
+        * </p>
+        * 
         * @return a {@link org.eclipse.jface.window.ApplicationWindow} object.
         */
         * @return a {@link org.eclipse.jface.window.ApplicationWindow} object.
         */
-       public static ApplicationWindow getWorkbenchWindow(){
-               if(getWorkbench().getWorkbenchWindowCount() > 1){
+       public static ApplicationWindow getWorkbenchWindow() {
+               if (getWorkbench().getWorkbenchWindowCount() > 1) {
                        throw new IllegalStateException("More than one workbench window");
                }
                return (ApplicationWindow) getWorkbench().getWorkbenchWindows()[0];
        }
                        throw new IllegalStateException("More than one workbench window");
                }
                return (ApplicationWindow) getWorkbench().getWorkbenchWindows()[0];
        }
-       
+
        /**
        /**
-        * <p>showView</p>
-        *
-        * @param id a {@link java.lang.String} object.
+        * <p>
+        * showView
+        * </p>
+        * 
+        * @param id
+        *            a {@link java.lang.String} object.
         * @return a {@link org.eclipse.ui.IViewPart} object.
         */
         * @return a {@link org.eclipse.ui.IViewPart} object.
         */
-       public static IViewPart showView(String id){
+       public static IViewPart showView(String id) {
                try {
                try {
-                       return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(id, null, IWorkbenchPage.VIEW_VISIBLE);
+                       return PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+                                       .getActivePage()
+                                       .showView(id, null, IWorkbenchPage.VIEW_VISIBLE);
                } catch (PartInitException e) {
                        error(AbstractUtility.class, "Could not open view: " + id, e);
                        throw new RuntimeException(e);
                }
        }
                } catch (PartInitException e) {
                        error(AbstractUtility.class, "Could not open view: " + id, e);
                        throw new RuntimeException(e);
                }
        }
-       
+
        /**
        /**
-        * <p>hideView</p>
-        *
-        * @param view a {@link org.eclipse.ui.IViewPart} object.
+        * <p>
+        * hideView
+        * </p>
+        * 
+        * @param view
+        *            a {@link org.eclipse.ui.IViewPart} object.
         */
         */
-       public static void hideView(IViewPart view){
-               PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().hideView(view);
+       public static void hideView(IViewPart view) {
+               PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+                               .hideView(view);
        }
        }
-       
-       
+
        /**
        /**
-        * <p>getView</p>
-        *
-        * @param id a {@link java.lang.String} object.
-        * @param restore a boolean.
+        * <p>
+        * getView
+        * </p>
+        * 
+        * @param id
+        *            a {@link java.lang.String} object.
+        * @param restore
+        *            a boolean.
         * @return a {@link org.eclipse.ui.IViewPart} object.
         */
         * @return a {@link org.eclipse.ui.IViewPart} object.
         */
-       public static IViewPart getView(String id, boolean restore){
-               IViewReference[] references = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences();
-               for (IViewReference reference : references){
-                       if(reference.getId().equals(id)){
+       public static IViewPart getView(String id, boolean restore) {
+               IViewReference[] references = PlatformUI.getWorkbench()
+                               .getActiveWorkbenchWindow().getActivePage().getViewReferences();
+               for (IViewReference reference : references) {
+                       if (reference.getId().equals(id)) {
                                return reference.getView(restore);
                        }
                }
                return null;
        }
                                return reference.getView(restore);
                        }
                }
                return null;
        }
-       
+
        /**
        /**
-        * <p>getService</p>
-        *
-        * @param api a {@link java.lang.Class} object.
+        * <p>
+        * getService
+        * </p>
+        * 
+        * @param api
+        *            a {@link java.lang.Class} object.
         * @return a {@link java.lang.Object} object.
         */
         * @return a {@link java.lang.Object} object.
         */
-       public static Object getService(Class api){
+       public static Object getService(Class api) {
                return TaxeditorStorePlugin.getDefault().getWorkbench().getService(api);
        }
                return TaxeditorStorePlugin.getDefault().getWorkbench().getService(api);
        }
-       
+
        /**
        /**
-        * <p>getCurrentTheme</p>
-        *
+        * <p>
+        * getCurrentTheme
+        * </p>
+        * 
         * @return a {@link org.eclipse.ui.themes.ITheme} object.
         */
         * @return a {@link org.eclipse.ui.themes.ITheme} object.
         */
-       public static ITheme getCurrentTheme(){
-               IThemeManager themeManager = TaxeditorStorePlugin.getDefault().getWorkbench().getThemeManager();
+       public static ITheme getCurrentTheme() {
+               IThemeManager themeManager = TaxeditorStorePlugin.getDefault()
+                               .getWorkbench().getThemeManager();
                return themeManager.getCurrentTheme();
        }
                return themeManager.getCurrentTheme();
        }
-       
+
        /**
        /**
-        * Fonts registered to the plugin may be obtained with the Eclipse themeing functionality.
-        * Thus fonts are chooseable by the user via Preferences->General->Appearance->Colors and Fonts
-        *
+        * Fonts registered to the plugin may be obtained with the Eclipse themeing
+        * functionality. Thus fonts are chooseable by the user via
+        * Preferences->General->Appearance->Colors and Fonts
+        * 
         * @return the FontRegistry for the current theme
         */
         * @return the FontRegistry for the current theme
         */
-       public static FontRegistry getFontRegistry(){
+       public static FontRegistry getFontRegistry() {
                return getCurrentTheme().getFontRegistry();
        }
                return getCurrentTheme().getFontRegistry();
        }
-       
+
        /**
        /**
-        * <p>getFont</p>
-        *
-        * @param symbolicName a {@link java.lang.String} object.
+        * <p>
+        * getFont
+        * </p>
+        * 
+        * @param symbolicName
+        *            a {@link java.lang.String} object.
         * @return a {@link org.eclipse.swt.graphics.Font} object.
         */
         * @return a {@link org.eclipse.swt.graphics.Font} object.
         */
-       public static Font getFont(String symbolicName){
+       public static Font getFont(String symbolicName) {
                return getFontRegistry().get(symbolicName);
        }
                return getFontRegistry().get(symbolicName);
        }
-       
+
        /**
        /**
-        * Color registered to the plugin may be obtained with the Eclipse themeing functionality.
-        * Thus colors are editable by the user via Preferences->General->Appearance->Colors and Fonts
-        *
+        * Color registered to the plugin may be obtained with the Eclipse themeing
+        * functionality. Thus colors are editable by the user via
+        * Preferences->General->Appearance->Colors and Fonts
+        * 
         * @return the ColorRegistry for the current theme
         */
         * @return the ColorRegistry for the current theme
         */
-       public static ColorRegistry getColorRegistry(){
+       public static ColorRegistry getColorRegistry() {
                return getCurrentTheme().getColorRegistry();
        }
                return getCurrentTheme().getColorRegistry();
        }
-       
+
        /**
        /**
-        * <p>getColor</p>
-        *
-        * @param symbolicName a {@link java.lang.String} object.
+        * <p>
+        * getColor
+        * </p>
+        * 
+        * @param symbolicName
+        *            a {@link java.lang.String} object.
         * @return a {@link org.eclipse.swt.graphics.Color} object.
         */
         * @return a {@link org.eclipse.swt.graphics.Color} object.
         */
-       public static Color getColor(String symbolicName){
+       public static Color getColor(String symbolicName) {
                return getColorRegistry().get(symbolicName);
        }
                return getColorRegistry().get(symbolicName);
        }
-       
+
        /**
        /**
-        * Open a message box that informs the user about unimplemented functionality.
-        * This method is for developer convenience.
-        *
-        * @param source a {@link java.lang.Object} object.
+        * Open a message box that informs the user about unimplemented
+        * functionality. This method is for developer convenience.
+        * 
+        * @param source
+        *            a {@link java.lang.Object} object.
         */
         */
-       public static void notImplementedMessage(Object source){
-               warningDialog("Not yet implemented", source, "This functionality is not yet implemented.");
+       public static void notImplementedMessage(Object source) {
+               warningDialog("Not yet implemented", source,
+                               "This functionality is not yet implemented.");
        }
        }
-       
+
        /**
        /**
-        * <p>informationDialog</p>
-        *
-        * @param title a {@link java.lang.String} object.
-        * @param message a {@link java.lang.String} object.
-        */
-       public static void informationDialog(final String title, final String message){
-               Display.getDefault().asyncExec(new Runnable(){
+        * <p>
+        * informationDialog
+        * </p>
+        * 
+        * @param title
+        *            a {@link java.lang.String} object.
+        * @param message
+        *            a {@link java.lang.String} object.
+        */
+       public static void informationDialog(final String title,
+                       final String message) {
+               Display.getDefault().asyncExec(new Runnable() {
 
                        public void run() {
                                MessageDialog.openInformation(getShell(), title, message);
                        }
                });
        }
 
                        public void run() {
                                MessageDialog.openInformation(getShell(), title, message);
                        }
                });
        }
-       
+
        /**
        /**
-        * <p>warningDialog</p>
-        *
-        * @param title The dialogs title
-        * @param source The object where the warning was generated (used by log4j)
-        * @param message An informative String to be presented to the user
-        */
-       public static void warningDialog(final String title, final Object source, final String message){
-               Display.getDefault().asyncExec(new Runnable(){
+        * <p>
+        * warningDialog
+        * </p>
+        * 
+        * @param title
+        *            The dialogs title
+        * @param source
+        *            The object where the warning was generated (used by log4j)
+        * @param message
+        *            An informative String to be presented to the user
+        */
+       public static void warningDialog(final String title, final Object source,
+                       final String message) {
+               Display.getDefault().asyncExec(new Runnable() {
 
                        public void run() {
                                MessageDialog.openWarning(getShell(), title, message);
 
                        public void run() {
                                MessageDialog.openWarning(getShell(), title, message);
-                               Class<? extends Object> clazz = source != null ? source.getClass() : AbstractUtility.class;
+                               Class<? extends Object> clazz = source != null ? source
+                                               .getClass() : AbstractUtility.class;
                                warn(clazz, message);
                        }
                });
        }
                                warn(clazz, message);
                        }
                });
        }
-       
+
        /**
        /**
-        * <p>errorDialog</p>
-        *
-        * @param title The dialogs title
-        * @param source The object where the warning was generated (used by log4j)
-        * @param message An informative String to be presented to the user
-        * @param title The dialogs title
-        * @param t a Throwable if one exists or null
-        */
-       public static void errorDialog(final String title, final Object source, final String message, final Throwable t){
-               Display.getDefault().asyncExec(new Runnable(){
+        * <p>
+        * errorDialog
+        * </p>
+        * 
+        * @param title
+        *            The dialogs title
+        * @param source
+        *            The object where the warning was generated (used by log4j)
+        * @param message
+        *            An informative String to be presented to the user
+        * @param title
+        *            The dialogs title
+        * @param t
+        *            a Throwable if one exists or null
+        */
+       public static void errorDialog(final String title, final Object source,
+                       final String message, final Throwable t) {
+               Display.getDefault().asyncExec(new Runnable() {
 
                        public void run() {
                                MessageDialog.openError(getShell(), title, message);
 
                        public void run() {
                                MessageDialog.openError(getShell(), title, message);
-                               Class<? extends Object> clazz = source != null ? source.getClass() : this.getClass();
+                               Class<? extends Object> clazz = source != null ? source
+                                               .getClass() : this.getClass();
                                error(clazz, message, t);
                        }
                });
        }
                                error(clazz, message, t);
                        }
                });
        }
-       
+
        /**
        /**
-        * <p>errorDialog</p>
-        *
-        * @param title a {@link java.lang.String} object.
-        * @param source a {@link java.lang.Object} object.
-        * @param status a {@link org.eclipse.core.runtime.IStatus} object.
+        * <p>
+        * errorDialog
+        * </p>
+        * 
+        * @param title
+        *            a {@link java.lang.String} object.
+        * @param source
+        *            a {@link java.lang.Object} object.
+        * @param status
+        *            a {@link org.eclipse.core.runtime.IStatus} object.
         */
         */
-       public static void errorDialog(final String title, final Object source, final IStatus status){
-               Display.getDefault().asyncExec(new Runnable(){
+       public static void errorDialog(final String title, final Object source,
+                       final IStatus status) {
+               Display.getDefault().asyncExec(new Runnable() {
 
                        public void run() {
                                MessageDialog.openError(getShell(), title, status.getMessage());
 
                        public void run() {
                                MessageDialog.openError(getShell(), title, status.getMessage());
-                               Class<? extends Object> clazz = source != null ? source.getClass() : this.getClass();
+                               Class<? extends Object> clazz = source != null ? source
+                                               .getClass() : this.getClass();
                                error(clazz, status.getMessage(), status.getException());
                        }
                });
        }
 
        /**
                                error(clazz, status.getMessage(), status.getException());
                        }
                });
        }
 
        /**
-        * <p>confirmDialog</p>
-        *
-        * @param title a {@link java.lang.String} object.
-        * @param message a {@link java.lang.String} object.
+        * <p>
+        * confirmDialog
+        * </p>
+        * 
+        * @param title
+        *            a {@link java.lang.String} object.
+        * @param message
+        *            a {@link java.lang.String} object.
         * @return a boolean.
         */
        public static boolean confirmDialog(String title, String message) {
                return MessageDialog.openQuestion(getShell(), title, message);
        }
         * @return a boolean.
         */
        public static boolean confirmDialog(String title, String message) {
                return MessageDialog.openQuestion(getShell(), title, message);
        }
-       
+
        /**
        /**
-        * <p>executeOperation</p>
-        *
-        * @param operation a {@link eu.etaxonomy.taxeditor.operation.AbstractPostOperation} object.
+        * <p>
+        * executeOperation
+        * </p>
+        * 
+        * @param operation
+        *            a
+        *            {@link eu.etaxonomy.taxeditor.operation.AbstractPostOperation}
+        *            object.
         * @return a {@link org.eclipse.core.runtime.IStatus} object.
         */
         * @return a {@link org.eclipse.core.runtime.IStatus} object.
         */
-       public static IStatus executeOperation(final AbstractPostOperation operation){
-               if(getOperationHistory() == null){
-                       throw new IllegalArgumentException("There is no operation history for this context");
+       public static IStatus executeOperation(final AbstractPostOperation operation) {
+               if (getOperationHistory() == null) {
+                       throw new IllegalArgumentException(
+                                       "There is no operation history for this context");
                }
                }
-               
-               final IAdaptable uiInfoAdapter = WorkspaceUndoUtil.getUIInfoAdapter(getShell());
-               
-               
-               
+
+               final IAdaptable uiInfoAdapter = WorkspaceUndoUtil
+                               .getUIInfoAdapter(getShell());
+
                IRunnableWithProgress runnable = new IRunnableWithProgress() {
                IRunnableWithProgress runnable = new IRunnableWithProgress() {
-                       
-                       public void run(IProgressMonitor monitor) throws InvocationTargetException,
-                                       InterruptedException {
+
+                       public void run(IProgressMonitor monitor)
+                                       throws InvocationTargetException, InterruptedException {
                                monitor.beginTask(operation.getLabel(), 100);
                                IStatus status;
                                try {
                                monitor.beginTask(operation.getLabel(), 100);
                                IStatus status;
                                try {
-                                       status = getOperationHistory().execute(operation, monitor, uiInfoAdapter);
+                                       operation.addContext(IOperationHistory.GLOBAL_UNDO_CONTEXT);
+                                       status = getOperationHistory().execute(operation, monitor,
+                                                       uiInfoAdapter);
                                } catch (ExecutionException e) {
                                        throw new RuntimeException(e);
                                }
                                monitor.done();
                                } catch (ExecutionException e) {
                                        throw new RuntimeException(e);
                                }
                                monitor.done();
-                       String statusString = status.equals(Status.OK_STATUS) ? "completed" : "cancelled";
+                               String statusString = status.equals(Status.OK_STATUS) ? "completed"
+                                               : "cancelled";
                                setStatusLine(operation.getLabel() + " " + statusString + ".");
                                setStatusLine(operation.getLabel() + " " + statusString + ".");
-                               
+
                        }
                };
                        }
                };
-               
+
                try {
                        runInUI(runnable, null);
                } catch (InvocationTargetException e) {
                try {
                        runInUI(runnable, null);
                } catch (InvocationTargetException e) {
@@ -369,118 +450,147 @@ public abstract class AbstractUtility {
                } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                }
                } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                }
-               
-//             // Start the main progress monitor.
-//        IProgressMonitor newMonitor = startMainMonitor(getMonitor(),operation.getLabel(), 100);
-//
-//             // Check whether operation was canceled and do some steps.
-//        workedChecked(newMonitor, 10);
-//
-//        try {
-//                     IStatus status = getOperationHistory().execute(operation, newMonitor,
-//                                     WorkspaceUndoUtil.getUIInfoAdapter(getShell()));
-//
-//                     // Check whether operation was canceled and do some steps.
-//                     workedChecked(newMonitor, 30);
-//
-//             String statusString = status.equals(Status.OK_STATUS) ? "completed" : "cancelled";
-//                     setStatusLine(operation.getLabel() + " " + statusString + ".");
-//
-//             return status;
-//             } catch (ExecutionException e) {
-//                     logger.error("Error executing operation: " + operation.getLabel(), e);
-//                     errorDialog("Error executing operation: " + operation.getLabel(), "Please refer to the error log.");
-//             }
-//        finally {
-//             
-//             // Stop the progress monitor.
-//            newMonitor.done();
-//        }
-               
-               IPostOperationEnabled postOperationEnabled = operation.getPostOperationEnabled();
-               if(postOperationEnabled != null){
+
+               // // Start the main progress monitor.
+               // IProgressMonitor newMonitor =
+               // startMainMonitor(getMonitor(),operation.getLabel(), 100);
+               //
+               // // Check whether operation was canceled and do some steps.
+               // workedChecked(newMonitor, 10);
+               //
+               // try {
+               // IStatus status = getOperationHistory().execute(operation, newMonitor,
+               // WorkspaceUndoUtil.getUIInfoAdapter(getShell()));
+               //
+               // // Check whether operation was canceled and do some steps.
+               // workedChecked(newMonitor, 30);
+               //
+               // String statusString = status.equals(Status.OK_STATUS) ? "completed" :
+               // "cancelled";
+               // setStatusLine(operation.getLabel() + " " + statusString + ".");
+               //
+               // return status;
+               // } catch (ExecutionException e) {
+               // logger.error("Error executing operation: " + operation.getLabel(),
+               // e);
+               // errorDialog("Error executing operation: " + operation.getLabel(),
+               // "Please refer to the error log.");
+               // }
+               // finally {
+               //
+               // // Stop the progress monitor.
+               // newMonitor.done();
+               // }
+
+               IPostOperationEnabled postOperationEnabled = operation
+                               .getPostOperationEnabled();
+               if (postOperationEnabled != null) {
                        postOperationEnabled.onComplete();
                }
                return Status.OK_STATUS;
        }
                        postOperationEnabled.onComplete();
                }
                return Status.OK_STATUS;
        }
-       
+
        /**
        /**
-        * <p>getOperationHistory</p>
-        *
-        * @return a {@link org.eclipse.core.commands.operations.IOperationHistory} object.
+        * <p>
+        * getOperationHistory
+        * </p>
+        * 
+        * @return a {@link org.eclipse.core.commands.operations.IOperationHistory}
+        *         object.
         */
         */
-       public static IOperationHistory getOperationHistory(){
-               return TaxeditorStorePlugin.getDefault().getWorkbench().
-                                                       getOperationSupport().getOperationHistory();
+       public static IOperationHistory getOperationHistory() {
+               return getWorkbench().getOperationSupport().getOperationHistory();
        }
        }
-       
+
        /**
        /**
-        * <p>setStatusLine</p>
-        *
-        * @param message a {@link java.lang.String} object.
+        * <p>
+        * setStatusLine
+        * </p>
+        * 
+        * @param message
+        *            a {@link java.lang.String} object.
         */
        public static void setStatusLine(final String message) {
         */
        public static void setStatusLine(final String message) {
-               Display.getDefault().asyncExec(new Runnable(){
+               Display.getDefault().asyncExec(new Runnable() {
 
                        public void run() {
                                statusLineManager.setMessage(message);
                        }
 
                        public void run() {
                                statusLineManager.setMessage(message);
                        }
-                       
+
                });
                });
-               
+
        }
        }
-       
+
        /**
        /**
-        * <p>getMonitor</p>
-        *
+        * <p>
+        * getMonitor
+        * </p>
+        * 
         * @return a {@link org.eclipse.core.runtime.IProgressMonitor} object.
         */
        public static IProgressMonitor getMonitor() {
                statusLineManager.setCancelEnabled(false);
                return statusLineManager.getProgressMonitor();
        }
         * @return a {@link org.eclipse.core.runtime.IProgressMonitor} object.
         */
        public static IProgressMonitor getMonitor() {
                statusLineManager.setCancelEnabled(false);
                return statusLineManager.getProgressMonitor();
        }
-       
-    /**
-     * Starts either the given {@link IProgressMonitor} if it's not <code>null</code> or a new {@link NullProgressMonitor}.
-     *
-     * @param progressMonitor The {@link IProgressMonitor} or <code>null</code> if no progress should be reported.
-     * @param taskName The name of the main task.
-     * @param steps The number of steps this task is subdivided into.
-     * @return The {@link IProgressMonitor}.
-     */
-    public static IProgressMonitor startMainMonitor(IProgressMonitor progressMonitor, String taskName, int steps) {
-        IProgressMonitor newMonitor = progressMonitor;
-        if (newMonitor == null) {
-            newMonitor = new NullProgressMonitor();
-        }
-        newMonitor.beginTask(taskName == null ? "" : taskName, steps);
-        newMonitor.subTask(" ");
-        return newMonitor;
-    }
-
-    /**
-     * Creates a {@link SubProgressMonitor} if the given {@link IProgressMonitor} is not <code>null</code> and not a {@link NullProgressMonitor}.
-     *
-     * @param progressMonitor The parent {@link IProgressMonitor} of the {@link SubProgressMonitor} to be created.
-     * @param ticks The number of steps this subtask is subdivided into. Must be a positive number and must not be {@link IProgressMonitor#UNKNOWN}.
-     * @return The {@link IProgressMonitor}.
-     */
-    public static IProgressMonitor getSubProgressMonitor(IProgressMonitor progressMonitor, int ticks) {
-        if (progressMonitor == null) {
-            return new NullProgressMonitor();
-        }
-        if (progressMonitor instanceof NullProgressMonitor) {
-            return progressMonitor;
-        }
-        
-        return new SubProgressMonitor(progressMonitor, ticks);
-    }
-    
-       /**
-        * Checks whether the user canceled this operation. If not canceled, the given number of steps are declared as done.
-        *
-        * @param newMonitor a {@link org.eclipse.core.runtime.IProgressMonitor} object.
-        * @param steps a int.
+
+       /**
+        * Starts either the given {@link IProgressMonitor} if it's not
+        * <code>null</code> or a new {@link NullProgressMonitor}.
+        * 
+        * @param progressMonitor
+        *            The {@link IProgressMonitor} or <code>null</code> if no
+        *            progress should be reported.
+        * @param taskName
+        *            The name of the main task.
+        * @param steps
+        *            The number of steps this task is subdivided into.
+        * @return The {@link IProgressMonitor}.
+        */
+       public static IProgressMonitor startMainMonitor(
+                       IProgressMonitor progressMonitor, String taskName, int steps) {
+               IProgressMonitor newMonitor = progressMonitor;
+               if (newMonitor == null) {
+                       newMonitor = new NullProgressMonitor();
+               }
+               newMonitor.beginTask(taskName == null ? "" : taskName, steps);
+               newMonitor.subTask(" ");
+               return newMonitor;
+       }
+
+       /**
+        * Creates a {@link SubProgressMonitor} if the given
+        * {@link IProgressMonitor} is not <code>null</code> and not a
+        * {@link NullProgressMonitor}.
+        * 
+        * @param progressMonitor
+        *            The parent {@link IProgressMonitor} of the
+        *            {@link SubProgressMonitor} to be created.
+        * @param ticks
+        *            The number of steps this subtask is subdivided into. Must be a
+        *            positive number and must not be
+        *            {@link IProgressMonitor#UNKNOWN}.
+        * @return The {@link IProgressMonitor}.
+        */
+       public static IProgressMonitor getSubProgressMonitor(
+                       IProgressMonitor progressMonitor, int ticks) {
+               if (progressMonitor == null) {
+                       return new NullProgressMonitor();
+               }
+               if (progressMonitor instanceof NullProgressMonitor) {
+                       return progressMonitor;
+               }
+
+               return new SubProgressMonitor(progressMonitor, ticks);
+       }
+
+       /**
+        * Checks whether the user canceled this operation. If not canceled, the
+        * given number of steps are declared as done.
+        * 
+        * @param newMonitor
+        *            a {@link org.eclipse.core.runtime.IProgressMonitor} object.
+        * @param steps
+        *            a int.
         */
        public static void workedChecked(IProgressMonitor newMonitor, int steps) {
                // In case the progress monitor was canceled throw an exception.
         */
        public static void workedChecked(IProgressMonitor newMonitor, int steps) {
                // In case the progress monitor was canceled throw an exception.
@@ -493,197 +603,265 @@ public abstract class AbstractUtility {
 
        /**
         * Present a progress dialog to the user. This dialog will block the UI
 
        /**
         * Present a progress dialog to the user. This dialog will block the UI
-        *
-        * @param runnable an implementation of {@link IRunnableWithProgress}
-        * @throws java.lang.InterruptedException if any.
-        * @throws java.lang.reflect.InvocationTargetException if any.
-        */
-       public static void busyCursorWhile(IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException{
+        * 
+        * @param runnable
+        *            an implementation of {@link IRunnableWithProgress}
+        * @throws java.lang.InterruptedException
+        *             if any.
+        * @throws java.lang.reflect.InvocationTargetException
+        *             if any.
+        */
+       public static void busyCursorWhile(IRunnableWithProgress runnable)
+                       throws InvocationTargetException, InterruptedException {
                getProgressService().busyCursorWhile(runnable);
        }
                getProgressService().busyCursorWhile(runnable);
        }
-       
+
        /**
        /**
-        * <p>runInUI</p>
-        *
+        * <p>
+        * runInUI
+        * </p>
+        * 
         * @see {@link IProgressService#runInUI(org.eclipse.jface.operation.IRunnableContext, IRunnableWithProgress, ISchedulingRule)}
         * @see {@link IProgressService#runInUI(org.eclipse.jface.operation.IRunnableContext, IRunnableWithProgress, ISchedulingRule)}
-        * @param runnable a {@link org.eclipse.jface.operation.IRunnableWithProgress} object.
-        * @param rule a {@link org.eclipse.core.runtime.jobs.ISchedulingRule} object.
-        * @throws java.lang.reflect.InvocationTargetException if any.
-        * @throws java.lang.InterruptedException if any.
-        */
-       public static void runInUI(IRunnableWithProgress runnable, ISchedulingRule rule) throws InvocationTargetException, InterruptedException{
-               getProgressService().runInUI(getWorkbenchWindow(), runnable, rule);             
+        * @param runnable
+        *            a {@link org.eclipse.jface.operation.IRunnableWithProgress}
+        *            object.
+        * @param rule
+        *            a {@link org.eclipse.core.runtime.jobs.ISchedulingRule}
+        *            object.
+        * @throws java.lang.reflect.InvocationTargetException
+        *             if any.
+        * @throws java.lang.InterruptedException
+        *             if any.
+        */
+       public static void runInUI(IRunnableWithProgress runnable,
+                       ISchedulingRule rule) throws InvocationTargetException,
+                       InterruptedException {
+               getProgressService().runInUI(getWorkbenchWindow(), runnable, rule);
        }
        }
-       
+
        /**
        /**
-        * <p>run</p>
-        *
-        * @param fork a boolean.
-        * @param cancelable a boolean.
-        * @param runnable a {@link org.eclipse.jface.operation.IRunnableWithProgress} object.
-        * @throws java.lang.reflect.InvocationTargetException if any.
-        * @throws java.lang.InterruptedException if any.
-        */
-       public static void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException{
+        * <p>
+        * run
+        * </p>
+        * 
+        * @param fork
+        *            a boolean.
+        * @param cancelable
+        *            a boolean.
+        * @param runnable
+        *            a {@link org.eclipse.jface.operation.IRunnableWithProgress}
+        *            object.
+        * @throws java.lang.reflect.InvocationTargetException
+        *             if any.
+        * @throws java.lang.InterruptedException
+        *             if any.
+        */
+       public static void run(boolean fork, boolean cancelable,
+                       IRunnableWithProgress runnable) throws InvocationTargetException,
+                       InterruptedException {
                getProgressService().run(fork, cancelable, runnable);
        }
                getProgressService().run(fork, cancelable, runnable);
        }
-       
+
        /**
        /**
-        * <p>getProgressService</p>
-        *
+        * <p>
+        * getProgressService
+        * </p>
+        * 
         * @return a {@link org.eclipse.ui.progress.IProgressService} object.
         */
         * @return a {@link org.eclipse.ui.progress.IProgressService} object.
         */
-       public static IProgressService getProgressService(){
+       public static IProgressService getProgressService() {
                IWorkbench workbench = PlatformUI.getWorkbench();
                return workbench.getProgressService();
        }
                IWorkbench workbench = PlatformUI.getWorkbench();
                return workbench.getProgressService();
        }
-       
+
        /**
        /**
-        * <p>getProgressService2</p>
-        *
-        * @return a {@link org.eclipse.ui.progress.IWorkbenchSiteProgressService} object.
+        * <p>
+        * getProgressService2
+        * </p>
+        * 
+        * @return a {@link org.eclipse.ui.progress.IWorkbenchSiteProgressService}
+        *         object.
         */
         */
-       public static IWorkbenchSiteProgressService getProgressService2(){
+       public static IWorkbenchSiteProgressService getProgressService2() {
                return (IWorkbenchSiteProgressService) getService(IWorkbenchSiteProgressService.class);
        }
                return (IWorkbenchSiteProgressService) getService(IWorkbenchSiteProgressService.class);
        }
-               
+
        /**
        /**
-        * <p>info</p>
-        *
-        * @param message a {@link java.lang.String} object.
+        * <p>
+        * info
+        * </p>
+        * 
+        * @param message
+        *            a {@link java.lang.String} object.
         */
         */
-       public static void info(String message){
+       public static void info(String message) {
                IStatus status = new Status(IStatus.INFO, getPluginId(), message);
                info(status);
        }
                IStatus status = new Status(IStatus.INFO, getPluginId(), message);
                info(status);
        }
-       
+
        /**
        /**
-        * <p>info</p>
-        *
-        * @param status a {@link org.eclipse.core.runtime.IStatus} object.
+        * <p>
+        * info
+        * </p>
+        * 
+        * @param status
+        *            a {@link org.eclipse.core.runtime.IStatus} object.
         */
         */
-       public static void info(IStatus status){
+       public static void info(IStatus status) {
                log(status);
        }
                log(status);
        }
-       
+
        /**
        /**
-        * <p>warn</p>
-        *
-        * @param source a {@link java.lang.Class} object.
-        * @param message a {@link java.lang.String} object.
+        * <p>
+        * warn
+        * </p>
+        * 
+        * @param source
+        *            a {@link java.lang.Class} object.
+        * @param message
+        *            a {@link java.lang.String} object.
         */
         */
-       public static void warn(Class source, String message){
+       public static void warn(Class source, String message) {
                IStatus status = new Status(IStatus.WARNING, getPluginId(), message);
                getLog4JLogger(source).warn(message);
                log(status);
        }
                IStatus status = new Status(IStatus.WARNING, getPluginId(), message);
                getLog4JLogger(source).warn(message);
                log(status);
        }
-       
+
        /**
        /**
-        * <p>error</p>
-        *
-        * @param source a {@link java.lang.Class} object.
-        * @param t a {@link java.lang.Throwable} object.
+        * <p>
+        * error
+        * </p>
+        * 
+        * @param source
+        *            a {@link java.lang.Class} object.
+        * @param t
+        *            a {@link java.lang.Throwable} object.
         */
         */
-       public static void error(Class source, Throwable t){
+       public static void error(Class source, Throwable t) {
                error(source.getClass(), t.getMessage(), t);
        }
                error(source.getClass(), t.getMessage(), t);
        }
-       
+
        /**
        /**
-        * <p>error</p>
-        *
-        * @param source a {@link java.lang.Class} object.
-        * @param message a {@link java.lang.String} object.
-        * @param t a {@link java.lang.Throwable} object.
-        */
-       public static void error(Class source, String message, Throwable t){
+        * <p>
+        * error
+        * </p>
+        * 
+        * @param source
+        *            a {@link java.lang.Class} object.
+        * @param message
+        *            a {@link java.lang.String} object.
+        * @param t
+        *            a {@link java.lang.Throwable} object.
+        */
+       public static void error(Class source, String message, Throwable t) {
                IStatus status = new Status(IStatus.ERROR, getPluginId(), message, t);
                error(source, status);
        }
                IStatus status = new Status(IStatus.ERROR, getPluginId(), message, t);
                error(source, status);
        }
-       
+
        /**
        /**
-        * <p>error</p>
-        *
-        * @param source a {@link java.lang.Class} object.
-        * @param status a {@link org.eclipse.core.runtime.IStatus} object.
+        * <p>
+        * error
+        * </p>
+        * 
+        * @param source
+        *            a {@link java.lang.Class} object.
+        * @param status
+        *            a {@link org.eclipse.core.runtime.IStatus} object.
         */
         */
-       public static void error(Class source, IStatus status){
-               getLog4JLogger(source).error(status.getMessage(), status.getException());
+       public static void error(Class source, IStatus status) {
+               getLog4JLogger(source)
+                               .error(status.getMessage(), status.getException());
                log(status);
        }
                log(status);
        }
-       
 
        /**
 
        /**
-        * <p>getLog4JLogger</p>
-        *
-        * @param clazz a {@link java.lang.Class} object.
+        * <p>
+        * getLog4JLogger
+        * </p>
+        * 
+        * @param clazz
+        *            a {@link java.lang.Class} object.
         * @return a {@link org.apache.log4j.Logger} object.
         */
         * @return a {@link org.apache.log4j.Logger} object.
         */
-       public static Logger getLog4JLogger(
-                       Class clazz) {
+       public static Logger getLog4JLogger(Class clazz) {
                return Logger.getLogger(clazz);
        }
                return Logger.getLogger(clazz);
        }
-       
+
        /**
         * @see {@link ILog#log(IStatus)}
         * 
         * @param status
         */
        /**
         * @see {@link ILog#log(IStatus)}
         * 
         * @param status
         */
-       private static void log(IStatus status){
+       private static void log(IStatus status) {
                TaxeditorStorePlugin.getDefault().getLog().log(status);
        }
                TaxeditorStorePlugin.getDefault().getLog().log(status);
        }
-       
+
        /**
        /**
-        * <p>getPluginId</p>
-        *
+        * <p>
+        * getPluginId
+        * </p>
+        * 
         * @return a {@link java.lang.String} object.
         */
         * @return a {@link java.lang.String} object.
         */
-       protected static String getPluginId(){
+       protected static String getPluginId() {
                return "eu.taxeditor";
        }
                return "eu.taxeditor";
        }
-       
+
        /**
        /**
-        * <p>getActiveEditor</p>
-        *
+        * <p>
+        * getActiveEditor
+        * </p>
+        * 
         * @return a {@link org.eclipse.ui.IEditorPart} object.
         */
         * @return a {@link org.eclipse.ui.IEditorPart} object.
         */
-       public static IEditorPart getActiveEditor(){
-               return getActivePage() != null ? getActivePage().getActiveEditor() : null;
+       public static IEditorPart getActiveEditor() {
+               return getActivePage() != null ? getActivePage().getActiveEditor()
+                               : null;
        }
        }
-       
+
        /**
        /**
-        * <p>getDetailsView</p>
-        *
-        * @return a {@link eu.etaxonomy.taxeditor.view.detail.DetailsViewPart} object.
+        * <p>
+        * getDetailsView
+        * </p>
+        * 
+        * @return a {@link eu.etaxonomy.taxeditor.view.detail.DetailsViewPart}
+        *         object.
         */
         */
-       public static DetailsViewPart getDetailsView(){
-               return  (DetailsViewPart) getView(DetailsViewPart.ID, false);
+       public static DetailsViewPart getDetailsView() {
+               return (DetailsViewPart) getView(DetailsViewPart.ID, false);
        }
        }
-       
+
        /**
        /**
-        * <p>refreshDetailsViewer</p>
+        * <p>
+        * refreshDetailsViewer
+        * </p>
         */
         */
-       public static void refreshDetailsViewer(){
-               if(getDetailsView() != null){
+       public static void refreshDetailsViewer() {
+               if (getDetailsView() != null) {
                        ((AbstractCdmDataViewer) getDetailsView().getViewer()).refresh();
                }
        }
                        ((AbstractCdmDataViewer) getDetailsView().getViewer()).refresh();
                }
        }
-       
+
        /**
        /**
-        * <p>reflowDetailsViewer</p>
+        * <p>
+        * reflowDetailsViewer
+        * </p>
         */
         */
-       public static void reflowDetailsViewer(){
-               if(getDetailsView() != null){
+       public static void reflowDetailsViewer() {
+               if (getDetailsView() != null) {
                        ((AbstractCdmDataViewer) getDetailsView().getViewer()).reflow();
                }
        }
                        ((AbstractCdmDataViewer) getDetailsView().getViewer()).reflow();
                }
        }
-       
-       public static SupplementalDataViewPart getSupplementalDataView(){
-               return (SupplementalDataViewPart) getView(SupplementalDataViewPart.ID, false);
+
+       public static SupplementalDataViewPart getSupplementalDataView() {
+               return (SupplementalDataViewPart) getView(SupplementalDataViewPart.ID,
+                               false);
        }
        }
-       
-       public static void reflowSupplementalViewer(){
-               if(getSupplementalDataView() != null){
-                       ((AbstractCdmDataViewer) getSupplementalDataView().getViewer()).reflow();
+
+       public static void reflowSupplementalViewer() {
+               if (getSupplementalDataView() != null) {
+                       ((AbstractCdmDataViewer) getSupplementalDataView().getViewer())
+                                       .reflow();
                }
        }
 }
                }
        }
 }