Search in sources :

Example 1 with IConsole

use of org.eclipse.ui.console.IConsole 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 IConsole

use of org.eclipse.ui.console.IConsole 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 IConsole

use of org.eclipse.ui.console.IConsole 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 4 with IConsole

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

the class RunConsole method findConsole.

/**
 * Returns a reference to the console that is for the given container id. If
 * such a console does not yet exist, it will be created.
 *
 * @param containerId
 *            The container this console will be for. Must not be
 *            <code>null</code>.
 * @param id
 *            The secondary id used to identify consoles belonging to
 *            various owners.
 * @param name
 *            the name of the console to create if it did not already exist
 * @return A console instance.
 */
public static RunConsole findConsole(String containerId, String id, String name) {
    RunConsole ret = null;
    for (IConsole cons : ConsolePlugin.getDefault().getConsoleManager().getConsoles()) {
        if (cons instanceof RunConsole && ((RunConsole) cons).containerId.equals(containerId) && ((RunConsole) cons).id.equals(id)) {
            ret = (RunConsole) cons;
        }
    }
    // no existing console, create new one
    if (ret == null) {
        ret = new RunConsole(containerId, id, name);
        ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { ret });
    }
    return ret;
}
Also used : IConsole(org.eclipse.ui.console.IConsole)

Example 5 with IConsole

use of org.eclipse.ui.console.IConsole 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

IConsole (org.eclipse.ui.console.IConsole)50 IConsoleManager (org.eclipse.ui.console.IConsoleManager)32 ConsolePlugin (org.eclipse.ui.console.ConsolePlugin)28 MessageConsole (org.eclipse.ui.console.MessageConsole)22 IOConsole (org.eclipse.ui.console.IOConsole)6 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)4 PartInitException (org.eclipse.ui.PartInitException)4 IOException (java.io.IOException)3 CoreException (org.eclipse.core.runtime.CoreException)3 IProcess (org.eclipse.debug.core.model.IProcess)3 IConsoleView (org.eclipse.ui.console.IConsoleView)3 TextConsole (org.eclipse.ui.console.TextConsole)3 ArrayList (java.util.ArrayList)2 Matcher (java.util.regex.Matcher)2 Pattern (java.util.regex.Pattern)2 IProcessTerminationListener (net.vtst.eclipse.easyxtext.ui.launching.EasyLaunchConfigurationDelegateUtils.IProcessTerminationListener)2 EasyPatternMatchListener (net.vtst.eclipse.easyxtext.ui.launching.EasyPatternMatchListener)2 IMarker (org.eclipse.core.resources.IMarker)2 BadLocationException (org.eclipse.jface.text.BadLocationException)2 IOConsoleOutputStream (org.eclipse.ui.console.IOConsoleOutputStream)2