org.eclipse.ohf.stem.ui.ge
Class GELog

java.lang.Object
  extended by org.eclipse.ohf.stem.ui.ge.GELog

public class GELog
extends java.lang.Object

debug Utility methods for GoogleEarth Interface

* The main use of this class is to provide additional debugging output when in debug mode on the primary eclipse console and still provide logging of exceptions to the eclipse ILog error log facility. Although Eclipse provides an Error log facility in the application workbench being tested, it is more convienent to get your debug messages and unexpected exception in the Eclipse Console that is controling the test environment.

Typical use of this class:

   // early in startup. 
   // in view constructor or junit test class
   GELog.DEBUG = true; 
   ...
   GELog.debug(this,"Current simulation: "+simulation);
   try {
     ...
   } catch (Exception e) {
      GELOG.error("strange failure",e);
   }
   
When DEBUG is true then both the Eclipse console and the Eclipse log will get the debug msg and the exception stacktrace but if DEBUG is false then the debug message will not appear anywhere and the Exception stacktrace will only appear in the eclipse log.


Field Summary
static boolean DEBUG
          if true then GElog methods produces output It would be set true normally in the GEView constructor based on the PrefereencePage setting.
 
Constructor Summary
GELog()
           
 
Method Summary
static void debug(java.lang.Object where, java.lang.String msg)
          temporary debug statements.
static void debug(java.lang.String msg)
          temporary debug statements.
static void error(java.lang.String msg, java.lang.Throwable t)
          handler for exceptions that occur
static void info(java.lang.Class current, java.lang.String msg)
          handler for exceptions that occur
static void info(java.lang.String msg)
          Handler for info messages.
static void main(java.lang.String[] args)
          main() method for testing.
static void memory()
          Call garbage collect and display memory stats
static boolean memoryCheck(double percent)
          test if percent of used memory is greater than specified percent.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static boolean DEBUG
if true then GElog methods produces output It would be set true normally in the GEView constructor based on the PrefereencePage setting. It could be also set in any junit tests where we want to have additional debug output. This could be changed to "static final" to compile out the execution of the if (DEBUG) statement.

Constructor Detail

GELog

public GELog()
Method Detail

debug

public static void debug(java.lang.String msg)
temporary debug statements. Calls to this method are intended for debugging and could be removed before publishing the code. They are displayed on the Eclipse Console only if the DEBUG variable is true.

Parameters:
msg - The string to be displayed.

debug

public static void debug(java.lang.Object where,
                         java.lang.String msg)
temporary debug statements. Calls to this method are intended for debugging and could be removed before publishing the code. They are displayed on the Eclipse Console only if the DEBUG variable is true. Example: GELog.debug(this,"a msg to help debugging"); -->> System.out.println("AclassName: a msg to help debugging");

Parameters:
where - - Indicator of class where msg generated Can be String, class or instance
msg - The string to be displayed.

info

public static void info(java.lang.Class current,
                        java.lang.String msg)
handler for exceptions that occur

Parameters:
current - Class that produced msg
msg - Messsage to be displayed (if not null)

info

public static void info(java.lang.String msg)
Handler for info messages. Will be produced even if debug option not on

Parameters:
msg -

error

public static void error(java.lang.String msg,
                         java.lang.Throwable t)
handler for exceptions that occur

Parameters:
msg - Messsage to be displayed (if not null)
t - Exception that caused this if not null

memory

public static void memory()
Call garbage collect and display memory stats


memoryCheck

public static boolean memoryCheck(double percent)
test if percent of used memory is greater than specified percent.

Parameters:
percent - to check against. Example: 0.9 = 90%
Returns:
true if % memeory used is greater than specified percent.

main

public static void main(java.lang.String[] args)
main() method for testing.

Parameters:
args -