3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.taxeditor
.ui
.element
;
15 import org
.eclipse
.jface
.resource
.JFaceResources
;
16 import org
.eclipse
.swt
.SWT
;
17 import org
.eclipse
.swt
.widgets
.Display
;
18 import org
.eclipse
.swt
.widgets
.Label
;
22 * @created Dec 20, 2010
25 public class UriWithLabelElement
extends TextWithLabelElement
{
27 private final Label labelException
;
29 protected UriWithLabelElement(CdmFormFactory formFactory
,
30 ICdmFormElement parentElement
, String labelString
,
31 URI initialUri
, Integer textHeight
, int style
) {
32 super(formFactory
, parentElement
, labelString
, null, textHeight
, style
);
34 labelException
= formFactory
.createLabel(getLayoutComposite(), "", SWT
.WRAP
);
35 labelException
.setLayoutData(LayoutConstants
.FILL_HORIZONTALLY(2, 1));
36 addControl(labelException
);
40 public void setUri(URI uri
) {
42 super.setText(uri
.toString());
48 labelException
.setFont(JFaceResources
.getFontRegistry().get(JFaceResources
.DEFAULT_FONT
));
49 labelException
.setForeground(getPersistentBackground());
50 labelException
.setText("");
51 return new URI(super.getText());
52 } catch (Exception e
) {
53 labelException
.setFont(JFaceResources
.getFontRegistry().getBold(JFaceResources
.DEFAULT_FONT
));
54 labelException
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_RED
));
55 labelException
.setText("URL won't be saved! "+e
.getMessage());