Search in sources :

Example 1 with IConsoleManager

use of org.eclipse.ui.console.IConsoleManager in project tesb-studio-se by Talend.

the class RuntimeConsoleUtil method findConsole.

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

Example 2 with IConsoleManager

use of org.eclipse.ui.console.IConsoleManager in project tesb-studio-se by Talend.

the class RuntimeConsoleUtil method clearConsole.

public static void clearConsole() {
    ConsolePlugin plugin = ConsolePlugin.getDefault();
    IConsoleManager conMan = plugin.getConsoleManager();
    IConsole[] existing = conMan.getConsoles();
    for (int i = 0; i < existing.length; i++) {
        if (KARAF_CONSOLE.equals(existing[i].getName())) {
            ((IOConsole) existing[i]).destroy();
            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) IOConsole(org.eclipse.ui.console.IOConsole)

Example 3 with IConsoleManager

use of org.eclipse.ui.console.IConsoleManager in project sling by apache.

the class SlingConsoleFactory method openConsole.

@Override
public void openConsole() {
    IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
    initConsole(consoleManager);
    consoleManager.showConsoleView(console);
}
Also used : IConsoleManager(org.eclipse.ui.console.IConsoleManager)

Example 4 with IConsoleManager

use of org.eclipse.ui.console.IConsoleManager in project sling by apache.

the class SlingConsoleEventListener method handleEvent.

@Override
public void handleEvent(Event event) {
    synchronized (sync) {
        initSlingConsole();
        if (slingConsole != null) {
            logEvent(event, slingConsole);
            return;
        }
        delayedEvents.add(event);
        final IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
        if (listener == null) {
            listener = new IConsoleListener() {

                @Override
                public void consolesRemoved(IConsole[] consoles) {
                    synchronized (sync) {
                        for (IConsole console : consoles) {
                            if (console.equals(slingConsole)) {
                                slingConsole = null;
                            }
                        }
                    }
                }

                @Override
                public void consolesAdded(IConsole[] consoles) {
                    synchronized (sync) {
                        for (IConsole console : consoles) {
                            if (console.getType().equals(SlingConsoleFactory.CONSOLE_TYPE_SLING)) {
                                slingConsole = (MessageConsole) console;
                                synchronized (delayedEvents) {
                                    for (Iterator<Event> it = delayedEvents.iterator(); it.hasNext(); ) {
                                        logEvent(it.next(), slingConsole);
                                        it.remove();
                                    }
                                }
                                consoleManager.removeConsoleListener(listener);
                                listener = null;
                                break;
                            }
                        }
                    }
                }
            };
            consoleManager.addConsoleListener(listener);
        }
    }
}
Also used : IConsoleManager(org.eclipse.ui.console.IConsoleManager) MessageConsole(org.eclipse.ui.console.MessageConsole) IConsoleListener(org.eclipse.ui.console.IConsoleListener) Iterator(java.util.Iterator) IConsole(org.eclipse.ui.console.IConsole)

Example 5 with IConsoleManager

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

the class SpecfileEditorPrepareSourcesActionDelegate method getConsole.

/**
 * Get the console.
 *
 * @param packageName
 *            The name of the package(RPM) this console will be for.
 * @return A console instance.
 */
public MessageConsole getConsole(String packageName) {
    ConsolePlugin plugin = ConsolePlugin.getDefault();
    IConsoleManager conMan = plugin.getConsoleManager();
    String projectConsoleName = NLS.bind(Messages.PrepareSources_consoleName, packageName);
    MessageConsole ret = null;
    for (IConsole cons : ConsolePlugin.getDefault().getConsoleManager().getConsoles()) {
        if (cons.getName().equals(projectConsoleName)) {
            ret = (MessageConsole) cons;
        }
    }
    // no existing console, create new one
    if (ret == null) {
        ret = new MessageConsole(projectConsoleName, null, null, true);
    }
    conMan.addConsoles(new IConsole[] { ret });
    ret.clearConsole();
    ret.activate();
    return ret;
}
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