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
.dialogs
;
14 import java
.net
.URISyntaxException
;
16 import org
.eclipse
.jface
.dialogs
.IInputValidator
;
17 import org
.eclipse
.jface
.dialogs
.InputDialog
;
18 import org
.eclipse
.jface
.window
.Window
;
19 import org
.eclipse
.swt
.widgets
.Shell
;
20 import org
.eclipse
.ui
.editors
.text
.EditorsUI
;
22 import eu
.etaxonomy
.taxeditor
.store
.StoreUtil
;
25 * <p>UriDialog class.</p>
31 * TODO make this extend TitleAreaDialog
33 public class UriDialog
extends InputDialog
{
38 * @param dialogMessage
42 private UriDialog(Shell parentShell
, String dialogTitle
,
43 String dialogMessage
) {
44 super(parentShell
, dialogTitle
,
45 dialogMessage
, "http://", new IInputValidator() {
47 public String
isValid(String text
) {
51 } catch (URISyntaxException e
) {
52 return "URL not correctly formed.";
56 if (text
.length() <= "http://".length()) {
65 private URI
getUri() {
68 uri
= new URI(getValue());
69 } catch (URISyntaxException e
) {
70 StoreUtil
.error(getClass(), e
);
78 * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
79 * @param dialogTitle a {@link java.lang.String} object.
80 * @param dialogMessage a {@link java.lang.String} object.
81 * @return a {@link java.net.URI} object.
83 public static URI
getUri(Shell shell
, String dialogTitle
,
84 String dialogMessage
) {
85 UriDialog dialog
= new UriDialog(shell
,
88 if (dialog
.open() == Window
.CANCEL
) {
91 return dialog
.getUri();