From: Patric Plitzner Date: Thu, 4 Jun 2015 10:50:56 +0000 (+0000) Subject: - code conventions X-Git-Tag: 3.6.0~12 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/e36729b88c9275420af38da33e724cb3e82c2b08 - code conventions --- diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/AbstractNewEntityWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/AbstractNewEntityWizard.java index f2657aae1..13fefdd17 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/AbstractNewEntityWizard.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/AbstractNewEntityWizard.java @@ -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 extends Wizard implements INewWizard, IConversationEnabled { private ConversationHolder conversation; - + protected CdmFormFactory formFactory; private T entity; @@ -43,7 +44,7 @@ public abstract class AbstractNewEntityWizard extends Wizard implements private IWorkbench workbench; private IStructuredSelection selection; - + /** *

Constructor for AbstractNewEntityWizard.

* @@ -52,10 +53,10 @@ public abstract class AbstractNewEntityWizard 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 extends Wizard implements @Override public boolean performFinish() { saveEntity(); - + conversation.commit(); conversation.close(); return true; } - + /** *

Getter for the field entity.

* @@ -81,7 +82,7 @@ public abstract class AbstractNewEntityWizard extends Wizard implements public T getEntity() { return entity; } - + /** *

Setter for the field entity.

* @@ -90,7 +91,7 @@ public abstract class AbstractNewEntityWizard 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 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(); - + } - + /** *

createNewEntity

* * @return a T object. */ protected abstract T createNewEntity(); - + /** *

getConversationHolder

* * @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