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
;
20 import eu
.etaxonomy
.taxeditor
.Messages
;
24 * @created Dec 20, 2010
27 public class UriWithLabelElement
extends TextWithLabelElement
{
29 private final Label labelException
;
31 protected UriWithLabelElement(CdmFormFactory formFactory
,
32 ICdmFormElement parentElement
, String labelString
,
33 URI initialUri
, Integer textHeight
, int style
) {
34 super(formFactory
, parentElement
, labelString
, null, textHeight
, style
);
36 labelException
= formFactory
.createLabel(getLayoutComposite(), "", SWT
.WRAP
); //$NON-NLS-1$
37 labelException
.setLayoutData(LayoutConstants
.FILL_HORIZONTALLY(2, 1));
38 addControl(labelException
);
42 public void setUri(URI uri
) {
44 super.setText(uri
.toString());
50 labelException
.setFont(JFaceResources
.getFontRegistry().get(JFaceResources
.DEFAULT_FONT
));
51 labelException
.setForeground(getPersistentBackground());
52 labelException
.setText(""); //$NON-NLS-1$
53 return new URI(super.getText());
54 } catch (Exception e
) {
55 labelException
.setFont(JFaceResources
.getFontRegistry().getBold(JFaceResources
.DEFAULT_FONT
));
56 labelException
.setForeground(Display
.getCurrent().getSystemColor(SWT
.COLOR_RED
));
57 labelException
.setText(Messages
.UriWithLabelElement_URL_NOT_SAVED
+e
.getMessage());