Skip to content

Commit

Permalink
Formatted the code
Browse files Browse the repository at this point in the history
  • Loading branch information
Omar122 committed Sep 12, 2023
1 parent 0f86ed8 commit 4a90a55
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions jsplot/src/main/java/tech/tablesaw/plotly/display/Browser.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,24 @@

public class Browser {

public static void main(String[] args) throws Exception {
public static void main(String[] args) throws Exception {

if (Desktop.isDesktopSupported()) {
Desktop.getDesktop().browse(new URI("http://www.example.com"));
if (Desktop.isDesktopSupported()) {
Desktop.getDesktop().browse(new URI("http://www.example.com"));
}
}
}

public void browse(File file) throws IOException {
if (Desktop.isDesktopSupported()) {
if(Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)){
Desktop.getDesktop().browse(file.toURI());}
else if (Desktop.getDesktop().isSupported(Desktop.Action.OPEN)){
Desktop.getDesktop().open(file);
}else{
throw new UnsupportedOperationException("Neither open nor browse are supported");
}
public void browse(File file) throws IOException {
if (Desktop.isDesktopSupported()) {
if (Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
Desktop.getDesktop().browse(file.toURI());
} else if (Desktop.getDesktop().isSupported(Desktop.Action.OPEN)) {
Desktop.getDesktop().open(file);
} else {
throw new UnsupportedOperationException("Neither open nor browse are supported");
}
} else {
throw new UnsupportedOperationException("Browser not supported.");
}
}
else {
throw new UnsupportedOperationException("Browser not supported.");
}
}
}

0 comments on commit 4a90a55

Please sign in to comment.