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
;
26 * TODO make this extend TitleAreaDialog
28 public class UriDialog
extends InputDialog
{
33 * @param dialogMessage
37 private UriDialog(Shell parentShell
, String dialogTitle
,
38 String dialogMessage
) {
39 super(parentShell
, dialogTitle
,
40 dialogMessage
, "http://", new IInputValidator() {
42 public String
isValid(String text
) {
46 } catch (URISyntaxException e
) {
47 return "URL not correctly formed.";
51 if (text
.length() <= "http://".length()) {
60 private URI
getUri() {
63 uri
= new URI(getValue());
64 } catch (URISyntaxException e
) {
65 // TODO Auto-generated catch block
71 public static URI
getUri(Shell shell
, String dialogTitle
,
72 String dialogMessage
) {
73 UriDialog dialog
= new UriDialog(shell
,
76 if (dialog
.open() == Window
.CANCEL
) {
79 return dialog
.getUri();