-// $Id$\r
-/**\r
-* Copyright (C) 2007 EDIT\r
-* European Distributed Institute of Taxonomy \r
-* http://www.e-taxonomy.eu\r
-* \r
-* The contents of this file are subject to the Mozilla Public License Version 1.1\r
-* See LICENSE.TXT at the top of this package for the full license terms.\r
-*/\r
-\r
-package eu.etaxonomy.taxeditor.dialogs;\r
-\r
-import java.net.URI;\r
-import java.net.URISyntaxException;\r
-\r
-import org.eclipse.jface.dialogs.IInputValidator;\r
-import org.eclipse.jface.dialogs.InputDialog;\r
-import org.eclipse.jface.window.Window;\r
-import org.eclipse.swt.widgets.Shell;\r
-\r
-/**\r
- * @author p.ciardelli\r
- * @created 31.03.2009\r
- * @version 1.0\r
- * \r
- * TODO make this extend TitleAreaDialog\r
- */\r
-public class UriDialog extends InputDialog {\r
- \r
- /**\r
- * @param parentShell\r
- * @param dialogTitle\r
- * @param dialogMessage\r
- * @param initialValue\r
- * @param validator\r
- */\r
- private UriDialog(Shell parentShell, String dialogTitle,\r
- String dialogMessage) {\r
- super(parentShell, dialogTitle, \r
- dialogMessage, "http://", new IInputValidator() {\r
-\r
- public String isValid(String text) {\r
- \r
- try {\r
- new URI(text);\r
- } catch (URISyntaxException e) {\r
- return "URL not correctly formed.";\r
- }\r
- \r
- \r
- if (text.length() <= "http://".length()) {\r
- return "";\r
- }\r
- return null;\r
- }\r
- \r
- });\r
- }\r
-\r
- private URI getUri() {\r
- URI uri = null;\r
- try {\r
- uri = new URI(getValue());\r
- } catch (URISyntaxException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- return uri;\r
- }\r
- \r
- public static URI getUri(Shell shell, String dialogTitle,\r
- String dialogMessage) {\r
- UriDialog dialog = new UriDialog(shell, \r
- dialogTitle, \r
- dialogMessage);\r
- if (dialog.open() == Window.CANCEL) {\r
- return null;\r
- }\r
- return dialog.getUri();\r
- }\r
-}\r
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.dialogs;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * <p>UriDialog class.</p>
+ *
+ * @author p.ciardelli
+ * @created 31.03.2009
+ * @version 1.0
+ *
+ * TODO make this extend TitleAreaDialog
+ */
+public class UriDialog extends InputDialog {
+
+ /**
+ * @param parentShell
+ * @param dialogTitle
+ * @param dialogMessage
+ * @param initialValue
+ * @param validator
+ */
+ private UriDialog(Shell parentShell, String dialogTitle,
+ String dialogMessage) {
+ super(parentShell, dialogTitle,
+ dialogMessage, "http://", new IInputValidator() {
+
+ public String isValid(String text) {
+
+ try {
+ new URI(text);
+ } catch (URISyntaxException e) {
+ return "URL not correctly formed.";
+ }
+
+
+ if (text.length() <= "http://".length()) {
+ return "";
+ }
+ return null;
+ }
+
+ });
+ }
+
+ private URI getUri() {
+ URI uri = null;
+ try {
+ uri = new URI(getValue());
+ } catch (URISyntaxException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return uri;
+ }
+
+ /**
+ * <p>getUri</p>
+ *
+ * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
+ * @param dialogTitle a {@link java.lang.String} object.
+ * @param dialogMessage a {@link java.lang.String} object.
+ * @return a {@link java.net.URI} object.
+ */
+ public static URI getUri(Shell shell, String dialogTitle,
+ String dialogMessage) {
+ UriDialog dialog = new UriDialog(shell,
+ dialogTitle,
+ dialogMessage);
+ if (dialog.open() == Window.CANCEL) {
+ return null;
+ }
+ return dialog.getUri();
+ }
+}