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
*/
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{
- if(super.getText()!=null){
- return new URI(super.getText());
- }
- return null;
+ public URI getUri(){
+ try {
+ labelException.setText("");
+ return new URI(super.getText());
+ } catch (Exception e) {
+ labelException.setText(e.getMessage());
+ return null;
+ }
}
}