X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Futil%2FPlatform.java;h=f5953bf06085d9fc56b246cf2406e92e49cb042f;hb=3acfdb3ddd5e3b785fd0880bcebc9e267a717bbe;hp=573e2d584db09e7deac6c36abee5ec239a3cf53f;hpb=57738a1f3c19b1c3a00bd3ac5108f8cd0af32f99;p=jalview.git diff --git a/src/jalview/util/Platform.java b/src/jalview/util/Platform.java index 573e2d5..f5953bf 100644 --- a/src/jalview/util/Platform.java +++ b/src/jalview/util/Platform.java @@ -20,8 +20,6 @@ */ package jalview.util; -import jalview.javascript.json.JSON; - import java.awt.Toolkit; import java.awt.event.MouseEvent; import java.io.BufferedReader; @@ -40,6 +38,8 @@ import javax.swing.SwingUtilities; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; +import jalview.javascript.json.JSON; + /** * System platform information used by Applet and Application * @@ -56,6 +56,27 @@ public class Platform private static Boolean isHeadless = null; + // If launched from CLI with launcher script then -DCOLUMNWIDTH is set + private static final int CONSOLEWIDTH; + + private static final String CONSOLEWIDTHPROPERTY = "CONSOLEWIDTH"; + + static + { + int cw = 80; + if (System.getProperty(CONSOLEWIDTHPROPERTY) != null + && System.getProperty(CONSOLEWIDTHPROPERTY).length() > 0) + { + try + { + cw = Integer.parseInt(System.getProperty(CONSOLEWIDTHPROPERTY)); + } catch (NumberFormatException e) + { + } + } + CONSOLEWIDTH = cw; + } + /** * added to group mouse events into Windows and nonWindows (mac, unix, linux) * @@ -657,4 +678,12 @@ public class Platform String p2 = path2.replace('\\', '/'); return p1.equals(p2); } + + /** + * If started on command line using launch script, return the console width + */ + public static int consoleWidth() + { + return CONSOLEWIDTH; + } }