Fixes #2740
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / vocabulary / TermVocabularyDetailElement.java
index a4dabeef1fadf34d5a5c969a6ccae933e53a2fbd..1cbaa5c96e88c2427c7729ddb493154e9da2711b 100644 (file)
 package eu.etaxonomy.taxeditor.ui.section.vocabulary;\r
 \r
 import java.net.URISyntaxException;\r
-import java.util.HashSet;\r
-import java.util.Set;\r
 \r
 import eu.etaxonomy.cdm.model.common.Language;\r
-import eu.etaxonomy.cdm.model.common.Marker;\r
 import eu.etaxonomy.cdm.model.common.Representation;\r
 import eu.etaxonomy.cdm.model.common.TermVocabulary;\r
+import eu.etaxonomy.taxeditor.store.CdmStore;\r
+import eu.etaxonomy.taxeditor.store.StoreUtil;\r
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;\r
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;\r
 import eu.etaxonomy.taxeditor.ui.element.UriWithLabelElement;\r
@@ -46,7 +45,7 @@ public class TermVocabularyDetailElement extends AbstractTermBaseDetailElement<T
                        TermVocabulary entity, int style) {\r
                \r
                super.createControls(formElement, entity, style);\r
-               uri_uriTermSource = formFactory.createUriWithLabelElement(formElement, "URI Term Source", getEntity().getTermSourceUri(), style);\r
+               uri_uriTermSource = formFactory.createUriWithLabelElement(formElement, "Term Source URI", getEntity().getTermSourceUri(), style);\r
        }\r
 \r
        /* (non-Javadoc)\r
@@ -55,27 +54,19 @@ public class TermVocabularyDetailElement extends AbstractTermBaseDetailElement<T
        @Override\r
        public void handleEvent(Object eventSource) {\r
                \r
-               if (eventSource == text_label) {\r
-                       getEntity().setLabel(text_label.getText());\r
-                       getEntity().setTitleCache(null);\r
-               } else if (eventSource == text_description) {\r
-                       \r
-                       Representation representation = getEntity().getRepresentation(Language.DEFAULT());\r
-                       representation.setText(text_description.getText());\r
-               } else if (eventSource == uri_uri) {\r
-                       \r
+               handleRepresentation(eventSource);\r
+               \r
+               if (eventSource == uri_uri) {\r
                        try {\r
                                getEntity().setUri(uri_uri.getUri());\r
                        } catch (URISyntaxException e) {\r
-                               \r
-                               e.printStackTrace();\r
+                               StoreUtil.errorDialog("Not a URI", getClass(), "You have to provide a valid URI");\r
                        }\r
                } else if (eventSource == uri_uriTermSource) {\r
                        try {\r
                                getEntity().setTermSourceUri(uri_uriTermSource.getUri());\r
                        } catch (URISyntaxException e) {\r
-                               // TODO Auto-generated catch block\r
-                               e.printStackTrace();\r
+                               StoreUtil.errorDialog("Not a URI", getClass(), "You have to provide a valid URI");\r
                        }\r
                }\r
        }\r