ref #6694 Improve UI and feature tree creation
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / dialog / selection / FeatureTreeSelectionDialog.java
index 47b10fc3ef42abb401d5d72929bdabe7fa965224..96d531927ce07ea964fa10dd2b75b15fa4c9d84a 100644 (file)
@@ -14,6 +14,7 @@ import java.util.List;
 import java.util.UUID;
 
 import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.InputDialog;
 import org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Composite;
@@ -110,12 +111,17 @@ public class FeatureTreeSelectionDialog extends
                        @Override
             public void handleEvent(Event event) {
 
-                               FeatureTreeEditorWizard wizard = new FeatureTreeEditorWizard();
-                               WizardDialog dialog = new WizardDialog(getShell(), wizard);
-                               int status = dialog.open();
-
+                           InputDialog input = new InputDialog(getShell(), "New feature tree", "Enter label for new feature tree", null, null);
+                               int status = input.open();
                                if (status == IStatus.OK) {
-                                       refresh();
+                                   String label = input.getValue();
+                                   if(label!=null){
+                                       FeatureTree featureTree = FeatureTree.NewInstance();
+                                       featureTree.setTitleCache(label, false);
+                                       CdmStore.getService(IFeatureTreeService.class).save(featureTree);
+                                   UuidAndTitleCache<FeatureTree> uuidAndTitleCache = new UuidAndTitleCache<FeatureTree>(FeatureTree.class, featureTree.getUuid(),featureTree.getId(), featureTree.getTitleCache());
+                                   model.add(uuidAndTitleCache);
+                                   }
                                }
                        }
                });