ides.api.utilities
Class GeneralUtils

java.lang.Object
  extended by ides.api.utilities.GeneralUtils

public class GeneralUtils
extends java.lang.Object

A collection of methods and classes of general utility.

Author:
Lenko Grigorov

Nested Class Summary
static class GeneralUtils.JOptionPaneKeyBinder
          This class allows the use of simple keyboard shortcuts for the Yes/No/etc.
 
Constructor Summary
GeneralUtils()
           
 
Method Summary
static boolean launchBrowser(java.lang.String url)
          Attempts to open a browser in the host OS and load the provided URL.
static java.lang.String truncateMessage(java.lang.String msg)
          Truncates to 10 lines and every line to 250 chars.
static java.lang.String XMLTextEscape(java.lang.String s)
          Escapes the ampersand (&) and opening angle bracket (<) as defined in XML.
static java.lang.String XMLTextUnescape(java.lang.String s)
          Unescapes the ampersand (&) and opening angle bracket (<) in XML-escaped text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeneralUtils

public GeneralUtils()
Method Detail

truncateMessage

public static java.lang.String truncateMessage(java.lang.String msg)
Truncates to 10 lines and every line to 250 chars. Ellipses (...) are appended to denote truncation.

Parameters:
msg - original message
Returns:
truncated message

XMLTextEscape

public static java.lang.String XMLTextEscape(java.lang.String s)
Escapes the ampersand (&) and opening angle bracket (<) as defined in XML. Ampersand becomes &amp; and angle bracket becomes &lt;

Parameters:
s - original text
Returns:
text with XML-escaped ampersands and opening angle brackets

XMLTextUnescape

public static java.lang.String XMLTextUnescape(java.lang.String s)
Unescapes the ampersand (&) and opening angle bracket (<) in XML-escaped text. &amp; becomes ampersand and &lt; becomes angle bracket.

Parameters:
s - original text with XML-escaped ampersands and opening angle brackets
Returns:
text with unescaped ampersands and opening angle brackets

launchBrowser

public static boolean launchBrowser(java.lang.String url)
Attempts to open a browser in the host OS and load the provided URL.

contains code written by Dem Pilafian.

Parameters:
url - the URL to be loaded in the browser
Returns:
true if no exceptions were encountered in launching the browser and loading the provided URL; false otherwise