Runtime

## org.eclipse.gmf.runtime.common.ui.util
Class ConsoleUtil

    java.lang.Object
      org.eclipse.gmf.runtime.common.ui.util.ConsoleUtil

public class ConsoleUtil
extends java.lang.Object

A Util Class: provides convinient api to write to the Eclipse Console View The client of printXXXX(String name, String msg) methods does not need to do any housekeeping work to use this method. All pre-work for example registering the console with the Eclipse console manager if neccessary, creating the message stream, setting the default color are handled ny the method if neccesary. However once they are done printing all there messages and have no more requirement for the console and know that the console is not shared by others they can call unregisterConsole(String name) to dispose of the console Also if the client wants to have more control over the console and streams or want to display addititional message types in different colors (other than error:red, info:blue and warning:yellow) they can call registerConsole(String name, ImageDescriptor image) to create/register/get the console and then use standard eclipse api to do what they want.

Field Summary
`static Color` `DEFAULT_ERROR` Default color used for logging error messages to the console.
`static Color` `DEFAULT_INFO` Default color used for logging info messages to the console.
`static Color` `DEFAULT_WARNING` Default color used for logging warning messages to the console.

Constructor Summary
`ConsoleUtil()`

Method Summary
`static void` `printError(java.lang.String name, java.lang.String errMsg)` Convinient static method to print an error string on the specified console.
`static void` `printInfo(java.lang.String name, java.lang.String infoMsg)` Convinient static method to print an info string on the specified console.
`static void` `println(java.lang.String name, java.lang.String msg)` Convinient static method to print an string on the specified console.
`static void` `printWarning(java.lang.String name, java.lang.String warnMsg)` Convinient static method to print an warning string on the specified console.
`static MessageConsole` `registerConsole(java.lang.String name)` Registers the console with the Eclipse Console Manager
`static MessageConsole` `registerConsole(java.lang.String name, ImageDescriptor image)` Registers the console with the Eclipse Console Manager.
`static void` `showConsole(java.lang.String name)` Shows the Eclipse console view and brings on top the specified console.
`static void` `unregisterConsole(java.lang.String name)` Unregisters the console with the Eclipse Console Manager

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_ERROR

    public static final Color DEFAULT_ERROR

  Default color used for logging error messages to the console.

### DEFAULT_INFO

    public static final Color DEFAULT_INFO

  Default color used for logging info messages to the console.

### DEFAULT_WARNING

    public static final Color DEFAULT_WARNING

  Default color used for logging warning messages to the console.

Constructor Detail

### ConsoleUtil

    public ConsoleUtil()

Method Detail

### registerConsole

    public static MessageConsole registerConsole(java.lang.String name,
                                                 ImageDescriptor image)

  Registers the console with the Eclipse Console Manager.

  Parameters:
    `name` - - the name for the console
    `image` - - the image associated with the console
  Returns:
    the message console

### registerConsole

    public static MessageConsole registerConsole(java.lang.String name)

  Registers the console with the Eclipse Console Manager

  Parameters:
    `name` - - the name name for the console
  Returns:
    message console

### unregisterConsole

    public static void unregisterConsole(java.lang.String name)

  Unregisters the console with the Eclipse Console Manager

  Parameters:
    `name` - - the name name for the console

### printError

    public static void printError(java.lang.String name,
                                  java.lang.String errMsg)

  Convinient static method to print an error string on the specified console. The color of the error message printed is by red. The client of this method does not need to do any housekeeping work to use this method. All pre-work for example registering the console with the Eclipse console manager if neccessary, creating the message stream, setting the color are handled by the method if neccesary.

  Parameters:
    `name` - - specifies the console
    `errMsg` - - the error message

### printInfo

    public static void printInfo(java.lang.String name,
                                 java.lang.String infoMsg)

  Convinient static method to print an info string on the specified console. The color of the info message printed is by blue. The client of this method does not need to do any housekeeping work to use this method. All pre-work for example registering the console with the Eclipse console manager if neccessary, creating the message stream, setting the color are handled by the method if neccesary.

  Parameters:
    `name` - - specifies the console
    `infoMsg` - - the info message

### printWarning

    public static void printWarning(java.lang.String name,
                                    java.lang.String warnMsg)

  Convinient static method to print an warning string on the specified console. The color of the warning message printed is by yellow. The client of this method does not need to do any housekeeping work to use this method. All pre-work for example registering the console with the Eclipse console manager if neccessary, creating the message stream, setting the color are handled by the method if neccesary.

  Parameters:
    `name` - - specifies the console
    `warnMsg` - - the warning message

### println

    public static void println(java.lang.String name,
                               java.lang.String msg)

  Convinient static method to print an string on the specified console. The color of the message printed is by black. The client of this method does not need to do any housekeeping work to use this method. All pre-work for example registering the console with the Eclipse console manager if neccessary, creating the message stream, setting the color are handled by the method if neccesary.

  Parameters:
    `name` - - specifies the console
    `msg` - - the warning message

### showConsole

    public static void showConsole(java.lang.String name)

  Shows the Eclipse console view and brings on top the specified console. Also creates and registers the console with the Eclipse console manager if necessary.

  Parameters:
    `name` - - specifies the console

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.