- code conventions
authorPatric Plitzner <p.plitzner@bgbm.org>
Thu, 4 Jun 2015 10:50:56 +0000 (10:50 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Thu, 4 Jun 2015 10:50:56 +0000 (10:50 +0000)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/AbstractNewEntityWizard.java

index f2657aae1f13b8d4400d0e925b477cc3d0f1a9f9..13fefdd17483456b9c1e2b4ffa80b21845e99a25 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* 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.
 */
@@ -20,6 +20,7 @@ import org.eclipse.ui.IWorkbench;
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.store.StoreUtil;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
@@ -35,7 +36,7 @@ public abstract class AbstractNewEntityWizard<T> extends Wizard implements
                INewWizard, IConversationEnabled {
 
        private ConversationHolder conversation;
-       
+
        protected CdmFormFactory formFactory;
 
        private T entity;
@@ -43,7 +44,7 @@ public abstract class AbstractNewEntityWizard<T> extends Wizard implements
        private IWorkbench workbench;
 
        private IStructuredSelection selection;
-       
+
        /**
         * <p>Constructor for AbstractNewEntityWizard.</p>
         *
@@ -52,10 +53,10 @@ public abstract class AbstractNewEntityWizard<T> extends Wizard implements
        public AbstractNewEntityWizard(){
                setWindowTitle(String.format("New %s", getEntityName()));
        }
-       
+
        /**
         * FIXME there might be a smarter way to do this,
-        * 
+        *
         * @return
         */
        protected abstract String getEntityName();
@@ -67,12 +68,12 @@ public abstract class AbstractNewEntityWizard<T> extends Wizard implements
        @Override
        public boolean performFinish() {
                saveEntity();
-               
+
                conversation.commit();
                conversation.close();
                return true;
        }
-       
+
        /**
         * <p>Getter for the field <code>entity</code>.</p>
         *
@@ -81,7 +82,7 @@ public abstract class AbstractNewEntityWizard<T> extends Wizard implements
        public T getEntity() {
                return entity;
        }
-       
+
        /**
         * <p>Setter for the field <code>entity</code>.</p>
         *
@@ -90,7 +91,7 @@ public abstract class AbstractNewEntityWizard<T> extends Wizard implements
        public void setEntity(T entity){
                this.entity = entity;
        }
-       
+
        /**
         * Adds the entity to the current persistence context
         */
@@ -102,40 +103,42 @@ public abstract class AbstractNewEntityWizard<T> extends Wizard implements
        /** {@inheritDoc} */
        @Override
        public void init(IWorkbench workbench, IStructuredSelection selection) {
-               this.workbench = workbench != null ? workbench : StoreUtil.getWorkbench();
-               
+               this.workbench = workbench != null ? workbench : AbstractUtility.getWorkbench();
+
                if(selection == null){
-                       ISelectionService service = (ISelectionService) this.workbench.getActiveWorkbenchWindow().getSelectionService();
+                       ISelectionService service = this.workbench.getActiveWorkbenchWindow().getSelectionService();
                        if(service.getSelection() instanceof IStructuredSelection){
                                selection = (IStructuredSelection) service.getSelection();
                        }
                }
                this.selection = selection;
-               
+
                formFactory = new CdmFormFactory(Display.getCurrent(), null);
                conversation = CdmStore.createConversation();
                entity = createNewEntity();
-               
+
        }
-       
+
        /**
         * <p>createNewEntity</p>
         *
         * @return a T object.
         */
        protected abstract T createNewEntity();
-       
+
        /**
         * <p>getConversationHolder</p>
         *
         * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
         */
-       public ConversationHolder getConversationHolder() {
+       @Override
+    public ConversationHolder getConversationHolder() {
                return conversation;
        }
-       
+
        /** {@inheritDoc} */
-       public void update(CdmDataChangeMap changeEvents) {}
+       @Override
+    public void update(CdmDataChangeMap changeEvents) {}
 
        /**
         * @return the workbench