Merge branch 'release/3.7.0'
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / element / UriWithLabelElement.java
index f4307ea87a4572da4b8f8f6e1df83c973e184556..ee6867db2b3a57827f7e4f552affc3713903b1bc 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.
 */
@@ -11,8 +11,9 @@
 package eu.etaxonomy.taxeditor.ui.element;
 
 import java.net.URI;
-import java.net.URISyntaxException;
 
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Label;
 
 /**
  * @author n.hoffmann
@@ -21,32 +22,33 @@ import java.net.URISyntaxException;
  */
 public class UriWithLabelElement extends TextWithLabelElement {
 
-       /**
-        * @param formFactory
-        * @param parentElement
-        * @param labelString
-        * @param initialText
-        * @param textHeight
-        * @param style
-        */
+    private final Label labelException;
+
        protected UriWithLabelElement(CdmFormFactory formFactory,
                        ICdmFormElement parentElement, String labelString,
                        URI initialUri, Integer textHeight, int style) {
                super(formFactory, parentElement, labelString, null, textHeight, style);
+
+               labelException = formFactory.createLabel(getLayoutComposite(), "", SWT.WRAP);
+               labelException.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+               addControl(labelException);
                setUri(initialUri);
        }
-       
-       /**
-        * 
-        */
+
        public void setUri(URI uri) {
                if(uri != null){
                        super.setText(uri.toString());
                }
        }
-       
-       public URI getUri() throws URISyntaxException{
-               return new URI(super.getText());
+
+       public URI getUri(){
+        try {
+            labelException.setText("");
+            return new URI(super.getText());
+        } catch (Exception e) {
+            labelException.setText(e.getMessage());
+            return null;
+        }
        }
-       
+
 }