Class EclipseConsole
- java.lang.Object
-
- net.ssehub.easy.producer.ui.productline_editor.EclipseConsole
-
public class EclipseConsole extends java.lang.ObjectRetrieve the MessageConsole of the currently running Elcipse-instance.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringCONSOLE_NAMEstatic EclipseConsoleINSTANCEStores the singleton instance of the Eclipse console.private org.eclipse.ui.console.MessageConsolemsgConsoleThe MessageConsole of the currently running Eclipse-instance.
-
Constructor Summary
Constructors Modifier Constructor Description privateEclipseConsole()The private constructor of this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearConsole()Clears the console.booleandisplayConsole()Tries to show the console inside the GUI.private org.eclipse.ui.IWorkbenchPagegetActiveWorkbenchPage()Returns the currently active page for this workbench window.private org.eclipse.ui.console.MessageConsolegetMessageConsole(java.lang.String consoleName)This method searches for and returns a specific instance of the MessageConsole of the currently running Eclipse-instance by name.booleanwriteToConsole(java.lang.String text, boolean lineBreak)Displays the specified text at the console, followed by a line separator string.
-
-
-
Field Detail
-
INSTANCE
public static final EclipseConsole INSTANCE
Stores the singleton instance of the Eclipse console.
-
CONSOLE_NAME
private static final java.lang.String CONSOLE_NAME
- See Also:
- Constant Field Values
-
msgConsole
private org.eclipse.ui.console.MessageConsole msgConsole
The MessageConsole of the currently running Eclipse-instance.
-
-
Method Detail
-
getMessageConsole
private org.eclipse.ui.console.MessageConsole getMessageConsole(java.lang.String consoleName)
This method searches for and returns a specific instance of the MessageConsole of the currently running Eclipse-instance by name. If the console with the given name does not exist, a new console-instance will be created and returned. Please note that this code is taken from: http://wiki.eclipse.org/FAQ_How_do_I_write_to_the_console_from_a_plug-in%3F- Parameters:
consoleName- the name of the MessageConsole-instance that should be returned.- Returns:
- the MessageConsole with the given name or a new instance of the MessageConsole if the instance with the given name does not exist.
-
writeToConsole
public boolean writeToConsole(java.lang.String text, boolean lineBreak)Displays the specified text at the console, followed by a line separator string.- Parameters:
text- message to displaylineBreak- true if a linebreak shall be inserted after the message.- Returns:
- true if the message was successfully displayed inside the console.
-
clearConsole
public void clearConsole()
Clears the console.Since a console may or may not support direct manipulation of its document's contents, this method should be called to clear a text console's document. The default implementation sets this console's document content to the empty string directly. Subclasses should override as required.
-
displayConsole
public boolean displayConsole()
Tries to show the console inside the GUI.- Returns:
- true if the console could be displayed inside the GUI.
-
getActiveWorkbenchPage
private org.eclipse.ui.IWorkbenchPage getActiveWorkbenchPage()
Returns the currently active page for this workbench window.- Returns:
- the active page, or
nullif none
-
-