00001 package edu.stanford.hci.r3.actions.types;
00002
00003 import java.awt.Desktop;
00004 import java.io.IOException;
00005 import java.net.URI;
00006 import java.net.URISyntaxException;
00007 import java.net.URL;
00008
00009 import edu.stanford.hci.r3.actions.R3Action;
00010
00030 public class OpenURLAction implements R3Action {
00031
00032 private URL url;
00033
00037 public OpenURLAction(URL theURL) {
00038 url = theURL;
00039 }
00040
00044 public void invoke() {
00045 try {
00046 System.out.println();
00047 final URI toURI = url.toURI();
00048 System.out.println("Got the URI");
00049 Desktop.getDesktop().browse(toURI);
00050 } catch (IOException e) {
00051 e.printStackTrace();
00052 } catch (URISyntaxException e) {
00053 e.printStackTrace();
00054 }
00055 }
00056
00057 }