Search in sources :

Example 31 with IConsoleManager

use of org.eclipse.ui.console.IConsoleManager in project usbdm-eclipse-plugins by podonoghue.

the class Activator method getConsole.

public MessageConsole getConsole(String sName) {
    IConsoleManager oConMan = ConsolePlugin.getDefault().getConsoleManager();
    IConsole[] aoConsoles = (IConsole[]) oConMan.getConsoles();
    for (IConsole oConsole : aoConsoles) {
        if (oConsole.getName().equals(sName)) {
            return (MessageConsole) oConsole;
        }
    }
    MessageConsole oNewConsole = new MessageConsole(sName, null);
    oConMan.addConsoles(new IConsole[] { oNewConsole });
    return oNewConsole;
}
Also used : IConsoleManager(org.eclipse.ui.console.IConsoleManager) MessageConsole(org.eclipse.ui.console.MessageConsole) IConsole(org.eclipse.ui.console.IConsole)

Example 32 with IConsoleManager

use of org.eclipse.ui.console.IConsoleManager in project usbdm-eclipse-plugins by podonoghue.

the class MyConsoleInterface method closeConsole.

/**
 * Closes TTY console for given port number.
 *
 * @return console found
 */
public static void closeConsole(int ttyPortNum) {
    Server server = servers.get(ttyPortNum);
    if (server != null) {
        server.stopServer();
    }
    String consoleName = String.format(CONSOLE_NAME, ttyPortNum);
    ConsolePlugin plugin = ConsolePlugin.getDefault();
    IConsoleManager conMan = plugin.getConsoleManager();
    IConsole[] existing = conMan.getConsoles();
    for (int i = 0; i < existing.length; i++) {
        if (existing[i].getName().equals(consoleName)) {
            conMan.removeConsoles(new IConsole[] { existing[i] });
        }
    }
}
Also used : IConsoleManager(org.eclipse.ui.console.IConsoleManager) ConsolePlugin(org.eclipse.ui.console.ConsolePlugin) IConsole(org.eclipse.ui.console.IConsole)

Example 33 with IConsoleManager

use of org.eclipse.ui.console.IConsoleManager in project abstools by abstools.

the class ConsoleHandler method findCostabsConsole.

public static MessageConsole findCostabsConsole() {
    ConsolePlugin plugin = ConsolePlugin.getDefault();
    IConsoleManager conMan = plugin.getConsoleManager();
    IConsole[] existing = conMan.getConsoles();
    for (int i = 0; i < existing.length; i++) if (ID_CONSOLE_VIEW.equals(existing[i].getName()))
        return (MessageConsole) existing[i];
    // no console found, so create a new one
    MessageConsole myConsole = new MessageConsole(ID_CONSOLE_VIEW, null);
    conMan.addConsoles(new IConsole[] { myConsole });
    return myConsole;
}
Also used : IConsoleManager(org.eclipse.ui.console.IConsoleManager) MessageConsole(org.eclipse.ui.console.MessageConsole) ConsolePlugin(org.eclipse.ui.console.ConsolePlugin) IConsole(org.eclipse.ui.console.IConsole)

Example 34 with IConsoleManager

use of org.eclipse.ui.console.IConsoleManager in project azure-tools-for-java by Microsoft.

the class Activator method findConsole.

public static MessageConsole findConsole(String name) {
    ConsolePlugin consolePlugin = ConsolePlugin.getDefault();
    IConsoleManager conMan = consolePlugin.getConsoleManager();
    IConsole[] existing = conMan.getConsoles();
    for (int i = 0; i < existing.length; i++) {
        if (name.equals(existing[i].getName())) {
            return (MessageConsole) existing[i];
        }
    }
    // no console found, so create a new one
    MessageConsole messageConsole = new MessageConsole(name, null);
    conMan.addConsoles(new IConsole[] { messageConsole });
    return messageConsole;
}
Also used : IConsoleManager(org.eclipse.ui.console.IConsoleManager) MessageConsole(org.eclipse.ui.console.MessageConsole) ConsolePlugin(org.eclipse.ui.console.ConsolePlugin) IConsole(org.eclipse.ui.console.IConsole)

Example 35 with IConsoleManager

use of org.eclipse.ui.console.IConsoleManager in project titan.EclipsePlug-ins by eclipse.

the class ConsoleWriter method findConsole.

/**
 * Try to get a console with a given name. If a Console is not found
 * a new console will be created
 * @param name of the given console
 * @return The Console
 */
private MessageConsole findConsole(final String name) {
    ConsolePlugin plugin = ConsolePlugin.getDefault();
    // Protection, Activator.stop exception...
    if (plugin == null) {
        return null;
    }
    IConsoleManager conMan = plugin.getConsoleManager();
    IConsole[] existing = conMan.getConsoles();
    for (IConsole anExisting : existing) {
        if (name.equals(anExisting.getName())) {
            return (MessageConsole) anExisting;
        }
    }
    // no console found, so create a new one
    MessageConsole myConsole = new MessageConsole(name, null);
    conMan.addConsoles(new IConsole[] { myConsole });
    return myConsole;
}
Also used : IConsoleManager(org.eclipse.ui.console.IConsoleManager) MessageConsole(org.eclipse.ui.console.MessageConsole) ConsolePlugin(org.eclipse.ui.console.ConsolePlugin) IConsole(org.eclipse.ui.console.IConsole)

Aggregations

IConsoleManager (org.eclipse.ui.console.IConsoleManager)41 IConsole (org.eclipse.ui.console.IConsole)32 ConsolePlugin (org.eclipse.ui.console.ConsolePlugin)31 MessageConsole (org.eclipse.ui.console.MessageConsole)25 IOConsole (org.eclipse.ui.console.IOConsole)4 MessageConsoleStream (org.eclipse.ui.console.MessageConsoleStream)4 IOException (java.io.IOException)2 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)2 BufferedReader (java.io.BufferedReader)1 InputStreamReader (java.io.InputStreamReader)1 OutputStream (java.io.OutputStream)1 PrintStream (java.io.PrintStream)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 IFileInfo (org.eclipse.core.filesystem.IFileInfo)1 IFileStore (org.eclipse.core.filesystem.IFileStore)1 CoreException (org.eclipse.core.runtime.CoreException)1 IStatus (org.eclipse.core.runtime.IStatus)1