601847e640683910a6522636389fd46bfe7d07dc
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
;
21 import eu
.etaxonomy
.taxeditor
.store
.StoreUtil
;
24 * <p>UriDialog class.</p>
30 * TODO make this extend TitleAreaDialog
32 public class UriDialog
extends InputDialog
{
37 * @param dialogMessage
41 private UriDialog(Shell parentShell
, String dialogTitle
,
42 String dialogMessage
) {
43 super(parentShell
, dialogTitle
,
44 dialogMessage
, "http://", new IInputValidator() {
46 public String
isValid(String text
) {
50 } catch (URISyntaxException e
) {
51 return "URL not correctly formed.";
55 if (text
.length() <= "http://".length()) {
64 private URI
getUri() {
67 uri
= new URI(getValue());
68 } catch (URISyntaxException e
) {
69 StoreUtil
.error(getClass(), e
);
77 * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
78 * @param dialogTitle a {@link java.lang.String} object.
79 * @param dialogMessage a {@link java.lang.String} object.
80 * @return a {@link java.net.URI} object.
82 public static URI
getUri(Shell shell
, String dialogTitle
,
83 String dialogMessage
) {
84 UriDialog dialog
= new UriDialog(shell
,
87 if (dialog
.open() == Window
.CANCEL
) {
90 return dialog
.getUri();