| | import com.scrivenvar.adapters.DocumentAdapter; |
| | import com.scrivenvar.graphics.SvgReplacedElementFactory; |
| | -import com.scrivenvar.util.ProtocolResolver; |
| | import javafx.beans.property.BooleanProperty; |
| | import javafx.beans.property.SimpleBooleanProperty; |
 |
| | import static com.scrivenvar.Constants.*; |
| | import static com.scrivenvar.StatusBarNotifier.alert; |
| | -import static com.scrivenvar.util.ProtocolResolver.*; |
| | +import static com.scrivenvar.util.ProtocolResolver.getProtocol; |
| | import static java.awt.Desktop.Action.BROWSE; |
| | import static java.awt.Desktop.getDesktop; |
 |
| | final var protocol = getProtocol( link ); |
| | |
| | - if( protocol.isHttp() ) { |
| | - final var desktop = getDesktop(); |
| | + switch( protocol ) { |
| | + case HTTP: |
| | + final var desktop = getDesktop(); |
| | |
| | - if( desktop.isSupported( BROWSE ) ) { |
| | - desktop.browse( new URI( link ) ); |
| | - } |
| | - } |
| | - else if( protocol.isFile() ) { |
| | - // TODO: #88 -- publish a message to the event bus. |
| | + if( desktop.isSupported( BROWSE ) ) { |
| | + desktop.browse( new URI( link ) ); |
| | + } |
| | + break; |
| | + case FILE: |
| | + // TODO: #88 -- publish a message to the event bus. |
| | + break; |
| | } |
| | } catch( final Exception e ) { |