-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed pom, fixed about text, refactored hyperlink listener
- Loading branch information
1 parent
3dcaf0a
commit e73041a
Showing
4 changed files
with
47 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/main/java/de/marza/firstspirit/modules/logging/console/HyperlinkExecutor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package de.marza.firstspirit.modules.logging.console; | ||
|
||
import javax.swing.event.HyperlinkEvent; | ||
import javax.swing.event.HyperlinkListener; | ||
import java.awt.*; | ||
import java.io.IOException; | ||
import java.net.URI; | ||
import java.net.URISyntaxException; | ||
|
||
public class HyperlinkExecutor implements HyperlinkListener { | ||
|
||
@Override | ||
public void hyperlinkUpdate(final HyperlinkEvent e) { | ||
URI uri = null; | ||
try { | ||
uri = e.getURL().toURI(); | ||
} catch (final URISyntaxException exception) { | ||
System.err.println("An error occurred while retrieving URI:" + exception.toString()); | ||
exception.printStackTrace(System.err); | ||
} | ||
browseTo(e, uri); | ||
} | ||
|
||
private void browseTo(final HyperlinkEvent e, final URI uri) { | ||
if (uri != null && Desktop.isDesktopSupported() && isClicked(e)) { | ||
try { | ||
Desktop.getDesktop().browse(uri); | ||
} catch (final IOException exception) { | ||
System.err.println("An error occurred while browse to '" + uri.toString() + "':" + exception.toString()); | ||
exception.printStackTrace(System.err); | ||
} | ||
} | ||
} | ||
|
||
private static boolean isClicked(final HyperlinkEvent e) { | ||
return e.getEventType() == HyperlinkEvent.EventType.ACTIVATED; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
<html> | ||
<h1>The Second-Hand Log</h2> | ||
<h1>The Second-Hand Log version ${project.version}</h2> | ||
<p> | ||
<a href="https://github.com/zaplatynski/second-hand-log">Fork me on GitHub!</a> | ||
</p> | ||
<p> | ||
Please file any <a href="https://github.com/zaplatynski/second-hand-log/issues">issues like bugs or feature requests</a> at GitHub. Thanks! | ||
</p> | ||
<br> | ||
</html> |