mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-26 20:54:22 +01:00
Extend UpdatableBoardsLibsFakeURLsHandler to handle real links
This commit is contained in:
parent
97fd81ac0c
commit
58eeaafde1
@ -34,6 +34,10 @@ import processing.app.Base;
|
||||
import javax.swing.event.HyperlinkEvent;
|
||||
import javax.swing.event.HyperlinkListener;
|
||||
import java.net.URL;
|
||||
import java.net.URI;
|
||||
import java.awt.Desktop;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
public class UpdatableBoardsLibsFakeURLsHandler implements HyperlinkListener {
|
||||
|
||||
@ -71,6 +75,18 @@ public class UpdatableBoardsLibsFakeURLsHandler implements HyperlinkListener {
|
||||
return;
|
||||
}
|
||||
|
||||
if(Desktop.isDesktopSupported())
|
||||
{
|
||||
try {
|
||||
Desktop.getDesktop().browse(url.toURI());
|
||||
return;
|
||||
} catch (IOException e) {
|
||||
throw new IllegalArgumentException(url.getHost() + " is invalid");
|
||||
} catch (URISyntaxException e) {
|
||||
throw new IllegalArgumentException(url.getHost() + " is invalid");
|
||||
}
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(url.getHost() + " is invalid");
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user