2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.newWizard
;
12 import org
.eclipse
.e4
.ui
.workbench
.IWorkbench
;
13 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
14 import org
.eclipse
.jface
.wizard
.Wizard
;
15 import org
.eclipse
.swt
.widgets
.Display
;
17 import eu
.etaxonomy
.cdm
.persistence
.hibernate
.CdmDataChangeMap
;
18 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
19 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
24 * @created Jun 1, 2010
27 public abstract class AbstractNewEntityWizardParentChild
<T
> extends Wizard
{
29 protected CdmFormFactory formFactory
;
31 private T parentEntity
;
33 private boolean finished
= false;
36 private IStructuredSelection selection
;
38 public AbstractNewEntityWizardParentChild(){
39 setWindowTitle(String
.format("New %s", getEntityName()));
43 * FIXME there might be a smarter way to do this,
47 protected abstract String
getEntityName();
51 public boolean performFinish() {
60 public T
getParentEntity() {
64 public void setParentEntity(T entity
){
65 this.parentEntity
= entity
;
68 public T
getEntity() {
72 public void setEntity(T entity
){
78 * Adds the entity to the current persistence context
80 protected abstract void saveEntity();
83 public void init(IWorkbench workbench
, IStructuredSelection selection
) {
84 formFactory
= new CdmFormFactory(Display
.getCurrent(), null);
85 this.selection
= selection
;
92 protected abstract void createParentEntity();
94 public IStructuredSelection
getSelection() {