Search in sources :

Example 26 with IConsoleManager

use of org.eclipse.ui.console.IConsoleManager in project knime-core by knime.

the class ConsoleViewAppender method findConsole.

/**
 * Looks up the console view that is responsible for the given event, does
 * not activate the view.
 *
 * @param consoleName The name of the console to look up
 */
private MessageConsole findConsole(final String consoleName) {
    ConsolePlugin plugin = ConsolePlugin.getDefault();
    IConsoleManager conMan = plugin.getConsoleManager();
    IConsole[] existing = conMan.getConsoles();
    for (int i = 0; i < existing.length; i++) {
        if (consoleName.equals(existing[i].getName())) {
            return (MessageConsole) existing[i];
        }
    }
    // no console found, so create a new one
    MessageConsole myConsole = new MessageConsole(consoleName, 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 27 with IConsoleManager

use of org.eclipse.ui.console.IConsoleManager in project ch.hsr.ifs.cdttesting by IFS-HSR.

the class Console method findConsole.

private static MessageConsole findConsole(String name) {
    ConsolePlugin plugin = ConsolePlugin.getDefault();
    IConsoleManager consoleManager = plugin.getConsoleManager();
    IConsole[] existing = consoleManager.getConsoles();
    for (int i = 0; i < existing.length; i++) {
        if (name.equals(existing[i].getName())) {
            return (MessageConsole) existing[i];
        }
    }
    return createNewConsole(name, consoleManager);
}
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 28 with IConsoleManager

use of org.eclipse.ui.console.IConsoleManager in project liferay-ide by liferay.

the class ConsoleContentCondition method test.

@Override
public boolean test() throws Exception {
    ConsolePlugin plugin = ConsolePlugin.getDefault();
    IConsoleManager manager = plugin.getConsoleManager();
    IConsole[] consoles = manager.getConsoles();
    for (IConsole console : consoles) {
        if (console.getName().contains(_consoleName) && console instanceof TextConsole) {
            IDocument content = ((TextConsole) console).getDocument();
            _lastContent = content.get();
            return _lastContent.contains(_content);
        }
    }
    return false;
}
Also used : IConsoleManager(org.eclipse.ui.console.IConsoleManager) ConsolePlugin(org.eclipse.ui.console.ConsolePlugin) TextConsole(org.eclipse.ui.console.TextConsole) IConsole(org.eclipse.ui.console.IConsole) IDocument(org.eclipse.jface.text.IDocument)

Example 29 with IConsoleManager

use of org.eclipse.ui.console.IConsoleManager in project mdw-designer by CenturyLinkCloud.

the class MessageConsole method findConsole.

public static MessageConsole findConsole(String name, ImageDescriptor icon, Display display) {
    IConsoleManager conMan = ConsolePlugin.getDefault().getConsoleManager();
    IConsole[] existingConsoles = conMan.getConsoles();
    for (IConsole existingConsole : existingConsoles) {
        if (existingConsole.getName().startsWith(name))
            return (MessageConsole) existingConsole;
    }
    // no console found, so create a new one
    MessageConsole messageConsole = new MessageConsole(name, icon, display);
    conMan.addConsoles(new IConsole[] { messageConsole });
    return messageConsole;
}
Also used : IConsoleManager(org.eclipse.ui.console.IConsoleManager) IConsole(org.eclipse.ui.console.IConsole)

Example 30 with IConsoleManager

use of org.eclipse.ui.console.IConsoleManager in project mdw-designer by CenturyLinkCloud.

the class WorkflowLaunchConfiguration method writeToConsole.

protected void writeToConsole(String name, String toWrite) throws IOException {
    ConsolePlugin plugin = ConsolePlugin.getDefault();
    IConsoleManager conMgr = plugin.getConsoleManager();
    IConsole[] existing = conMgr.getConsoles();
    for (int i = 0; i < existing.length; i++) {
        if (name.equals(existing[i].getName()))
            console = (org.eclipse.ui.console.MessageConsole) existing[i];
    }
    if (console == null) {
        console = new org.eclipse.ui.console.MessageConsole(name, MdwPlugin.getImageDescriptor("icons/extevent.gif"));
        conMgr.addConsoles(new IConsole[] { console });
    }
    console.newMessageStream().write(toWrite);
    MdwPlugin.getDisplay().asyncExec(new Runnable() {

        public void run() {
            IWorkbenchPage page = MdwPlugin.getActivePage();
            if (page != null) {
                try {
                    IConsoleView view = (IConsoleView) page.showView(IConsoleConstants.ID_CONSOLE_VIEW);
                    if (view != null)
                        view.display(console);
                } catch (PartInitException ex) {
                    PluginMessages.log(ex);
                }
            }
        }
    });
}
Also used : ConsolePlugin(org.eclipse.ui.console.ConsolePlugin) IConsole(org.eclipse.ui.console.IConsole) IConsoleManager(org.eclipse.ui.console.IConsoleManager) IConsoleView(org.eclipse.ui.console.IConsoleView) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) PartInitException(org.eclipse.ui.PartInitException)

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