aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@tipit.to>2009-06-15 20:58:33 +0200
committerReinier Zwitserloot <reinier@tipit.to>2009-06-15 20:58:33 +0200
commitc4cd04b7d2ebf39821466bcd5d2285fdd25b221f (patch)
treee8c3574004c9d62896bbb2f9efe2be936e172147
parentd7e5537b9e5afd299bd88aa4566ca343ba12edd7 (diff)
downloadlombok-c4cd04b7d2ebf39821466bcd5d2285fdd25b221f.tar.gz
lombok-c4cd04b7d2ebf39821466bcd5d2285fdd25b221f.tar.bz2
lombok-c4cd04b7d2ebf39821466bcd5d2285fdd25b221f.zip
Just in case people run lombok.jar as a java app (e.g. by double-clicking it), open a browser window with info, and print some useful help to the console.
-rw-r--r--build.xml6
-rw-r--r--src/lombok/core/ShowUserHelp.java31
2 files changed, 36 insertions, 1 deletions
diff --git a/build.xml b/build.xml
index 25657d12..6f44f40c 100644
--- a/build.xml
+++ b/build.xml
@@ -71,7 +71,11 @@
<target name="dist" depends="clean, compile, getVersion, unpackLibs">
<mkdir dir="dist" />
- <jar basedir="build/lombok" destfile="dist/lombok-${lombok.version}.jar" />
+ <jar basedir="build/lombok" destfile="dist/lombok-${lombok.version}.jar">
+ <manifest>
+ <attribute name="Main-Class" value="lombok.core.ShowUserHelp" />
+ </manifest>
+ </jar>
<jar basedir="build/eclipse.agent" destfile="dist/lombok.eclipse.agent-${lombok.version}.jar">
<manifest>
<attribute name="Premain-Class" value="lombok.agent.eclipse.EclipseParserPatcher" />
diff --git a/src/lombok/core/ShowUserHelp.java b/src/lombok/core/ShowUserHelp.java
new file mode 100644
index 00000000..0596dcc4
--- /dev/null
+++ b/src/lombok/core/ShowUserHelp.java
@@ -0,0 +1,31 @@
+package lombok.core;
+
+import java.awt.Desktop;
+import java.net.URI;
+
+/**
+ * This class is used as main class for the lombok jar; this way, if the jar is run as java app, the user is pointed
+ * at documentation about lombok.
+ */
+public class ShowUserHelp {
+ private static final URI ABOUT_LOMBOK_URL = URI.create("http://wiki.github.com/rzwitserloot/lombok");
+
+ public static void main(String[] args) {
+ boolean browserOpened = false;
+ try {
+ Desktop.getDesktop().browse(ABOUT_LOMBOK_URL);
+ browserOpened = true;
+ } catch ( Exception ignore ) {}
+
+ String version = Version.getVersion();
+ final String nextStep = browserOpened ? "See your browser window" :
+ String.format("Browse to %s", ABOUT_LOMBOK_URL);
+
+ System.out.printf("About lombok v%s\n" +
+ "Lombok makes java better by providing very spicy additions to the Java programming language," +
+ "such as using @Getter to automatically generate a getter method for any field.\n\n%s" +
+ " for more information about the lombok project, and how to" +
+ "install it into your programming environment. If you are just using javac (the java compiler)," +
+ "just use this jar, no further steps needed.", version, nextStep);
+ }
+}