Search in sources :

Example 36 with IConsole

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

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

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

Example 39 with IConsole

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

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

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