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
.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
;
22 * <p>UriDialog class.</p>
28 * TODO make this extend TitleAreaDialog
30 public class UriDialog
extends InputDialog
{
35 * @param dialogMessage
39 private UriDialog(Shell parentShell
, String dialogTitle
,
40 String dialogMessage
) {
41 super(parentShell
, dialogTitle
,
42 dialogMessage
, "http://", new IInputValidator() {
44 public String
isValid(String text
) {
48 } catch (URISyntaxException e
) {
49 return "URL not correctly formed.";
53 if (text
.length() <= "http://".length()) {
62 private URI
getUri() {
65 uri
= new URI(getValue());
66 } catch (URISyntaxException e
) {
67 // TODO Auto-generated catch block
76 * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
77 * @param dialogTitle a {@link java.lang.String} object.
78 * @param dialogMessage a {@link java.lang.String} object.
79 * @return a {@link java.net.URI} object.
81 public static URI
getUri(Shell shell
, String dialogTitle
,
82 String dialogMessage
) {
83 UriDialog dialog
= new UriDialog(shell
,
86 if (dialog
.open() == Window
.CANCEL
) {
89 return dialog
.getUri();