Java 类org.eclipse.ui.console.MessageConsole 实例源码

项目:n4js    文件:ConsoleDisplayMgr.java   
/**
 * Returns console associated with given name. If console with given name doesn't exists will create new one.
 */
public static XpectConsole getOrCreate(String name) {
    XpectConsole console = map.get(name);
    if (console != null) {
        return console;
    } else {
        MessageConsole lkpMessageConsole = findMessageConsole(name);
        if (lkpMessageConsole == null) {
            console = new XpectConsole(createMessageConsoleStream(name));
        } else {
            console = new XpectConsole(lkpMessageConsole);
        }
        map.put(name, console);
    }

    return console;
}
项目:n4js    文件:ConsoleOutputStreamProvider.java   
@Override
public OutputStream getOutputStream(final OutputStreamType type, OutputRedirection redirect) {
    if (!PlatformUI.isWorkbenchRunning()) {
        return DEFAULT.getOutputStream(type, redirect);
    }
    final MessageConsole console = consoleSupplier.get();
    boolean silent = redirect == OutputRedirection.SUPPRESS;
    if (!silent) {
        console.activate();
    }
    ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { console });
    final MessageConsoleStream stream = console.newMessageStream();
    getDisplay().asyncExec(() -> {
        stream.setColor(toColor(type));
        showConsoleView(silent);
    });
    return stream;
}
项目:andmore2    文件:AndroidConsole.java   
public AndroidConsole() {
    console = new MessageConsole("Android", null);
    ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { console });
    out = console.newMessageStream();
    err = console.newMessageStream();

    // set the colors
    final Display display = Display.getDefault();
    display.syncExec(new Runnable() {
        @Override
        public void run() {
            out.setColor(display.getSystemColor(SWT.COLOR_BLACK));
            err.setColor(display.getSystemColor(SWT.COLOR_RED));
        }
    });
}
项目:turnus    文件:EclipseUtils.java   
/**
 * Get the console with the given name. If the console does not exist, then
 * a new one is created.
 * 
 * @param name
 * @return
 */
public static MessageConsole getConsole(String name) {
    ConsolePlugin plugin = ConsolePlugin.getDefault();
    IConsoleManager conMan = plugin.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 console = new MessageConsole(name, null);
    conMan.addConsoles(new IConsole[] { console });

    // create a new logger handler
    Logger.addHandler(new EclipseConsoleHandler(console));

    return console;
}
项目:tlaplus    文件:ConsoleFactory.java   
/**
 * Fins the console with a given name
 * @param name, name of the console
 * @return
 */
private static MessageConsole findConsole(String name)
{
    if (name == null)
    {
        throw new IllegalArgumentException("Console name must be not null");
    }
    IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();

    IConsole[] existing = consoleManager.getConsoles();
    // try to find existing
    for (int i = 0; i < existing.length; i++)
    {
        if (name.equals(existing[i].getName()))
        {
            return (MessageConsole) existing[i];
        }
    }

    // no console found, create a new one
    MessageConsole myConsole = new MessageConsole(name, null);
    consoleManager.addConsoles(new IConsole[] { myConsole });
    return myConsole;
}
项目:tlaplus    文件:TLAPMConsoleFactory.java   
/**
 * Finds the console with a given name.
 * 
 * @param name, name of the console
 * @return
 */
private static MessageConsole findConsole(String name)
{
    if (name == null)
    {
        throw new IllegalArgumentException("Console name must be not null");
    }
    IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();

    IConsole[] existing = consoleManager.getConsoles();
    // try to find existing
    for (int i = 0; i < existing.length; i++)
    {
        if (name.equals(existing[i].getName()))
        {
            return (MessageConsole) existing[i];
        }
    }

    // no console found, create a new one
    MessageConsole myConsole = new MessageConsole(name, null);
    consoleManager.addConsoles(new IConsole[] { myConsole });
    return myConsole;
}
项目:caml2tosca    文件:C2TRunHandler.java   
private MessageConsole findConsole(String name) {
    ConsolePlugin plugin = ConsolePlugin.getDefault();
    IConsoleManager conMan = plugin.getConsoleManager();

    // search existing consoles
    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 myConsole = new MessageConsole(name, null);
    conMan.addConsoles(new IConsole[]{myConsole});
    conMan.showConsoleView(myConsole);
    return myConsole;
}
项目:cft    文件:ApplicationLogConsoleManager.java   
protected synchronized ApplicationLogConsole getApplicationLogConsole(CloudFoundryServer server,
        CloudFoundryApplicationModule appModule) {
    if (server == null || appModule == null) {
        return null;
    }

    String appUrl = getConsoleId(server.getServer(), appModule);
    ApplicationLogConsole serverLogTail = consoleByUri.get(appUrl);
    if (serverLogTail == null) {

        MessageConsole appConsole = getApplicationConsole(server, appModule);

        serverLogTail = new ApplicationLogConsole(new ConsoleConfig(appConsole, server, appModule));
        consoleByUri.put(getConsoleId(server.getServer(), appModule), serverLogTail);
    }
    return serverLogTail;
}
项目:cft    文件:CloudFoundryConsolePageParticipant.java   
protected boolean isCloudFoundryConsole(IConsole console) {
    if (console instanceof MessageConsole) {
        MessageConsole messageConsole = (MessageConsole) console;
        Object cfServerObj = messageConsole.getAttribute(ApplicationLogConsole.ATTRIBUTE_SERVER);
        Object cfAppModuleObj = messageConsole.getAttribute(ApplicationLogConsole.ATTRIBUTE_APP);
        if (cfServerObj instanceof CloudFoundryServer && cfAppModuleObj instanceof CloudFoundryApplicationModule) {
            CloudFoundryServer cfServer = (CloudFoundryServer) cfServerObj;
            CloudFoundryApplicationModule appModule = (CloudFoundryApplicationModule) cfAppModuleObj;

            CloudConsoleManager manager = ConsoleManagerRegistry.getConsoleManager(cfServer.getServer());
            if (manager != null) {
                MessageConsole existingConsole = manager.findCloudFoundryConsole(cfServer.getServer(), appModule);
                return messageConsole == existingConsole;
            }
        }
    }
    return false;
}
项目:HMM    文件:AbstractConsole.java   
protected void createConsole() {
    Display.getDefault().syncExec(new Runnable() {
    public void run() {
        IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
        console = new MessageConsole(consoleName, null);
        manager.addConsoles(new IConsole[] { console });
        try {
            Font font = new Font(Display.getCurrent(), "simsun", 9, SWT.NORMAL);
            console.setFont(font);
        } catch (SWTError error) {
            error.printStackTrace();
        }
        mcs = console.newMessageStream();
        black = Display.getCurrent().getSystemColor(SWT.COLOR_BLACK);
        red = Display.getCurrent().getSystemColor(SWT.COLOR_RED);
        mcs.setColor(black);
        manager.showConsoleView(console);
    }
});
  }
项目:yang-design-studio    文件:YangToPNG.java   
private static MessageConsole findConsole(String name) {//Find and return console, otherwise make one

        if (ConsolePlugin.getDefault() == null)
            return null;
        ConsolePlugin plugin = ConsolePlugin.getDefault();
        IConsoleManager YangConsole = plugin.getConsoleManager();
        IConsole[] existing = YangConsole.getConsoles();
        for (int i = 0; i < existing.length; i++)
            if (name.equals(existing[i].getName())) {
                YangConsole.showConsoleView(existing[i]);
                return (MessageConsole) existing[i];
            }
        MessageConsole myConsole = new MessageConsole(name, null);
        YangConsole.addConsoles(new IConsole[] { myConsole });
        return myConsole;
    }
项目:yang-design-studio    文件:YangToSkelxml.java   
private static MessageConsole findConsole(String name) {//Find and return console, otherwise make one

   if (ConsolePlugin.getDefault() == null)
        return null;
   ConsolePlugin plugin = ConsolePlugin.getDefault();
   IConsoleManager YangConsole = plugin.getConsoleManager();
   IConsole[] existing = YangConsole.getConsoles();
   for (int i = 0; i < existing.length; i++)
      if (name.equals(existing[i].getName())) {
        YangConsole.showConsoleView(existing[i]);
        return (MessageConsole) existing[i];
      }
   MessageConsole myConsole = new MessageConsole(name, null);
   YangConsole.addConsoles(new IConsole[] { myConsole });
   return myConsole;
}
项目:yang-design-studio    文件:YangToDsdl.java   
private static MessageConsole findConsole(String name) {//Find and return console, otherwise make one

   if (ConsolePlugin.getDefault() == null)
        return null;
   ConsolePlugin plugin = ConsolePlugin.getDefault();
   IConsoleManager YangConsole = plugin.getConsoleManager();
   IConsole[] existing = YangConsole.getConsoles();
   for (int i = 0; i < existing.length; i++)
      if (name.equals(existing[i].getName())) {
        YangConsole.showConsoleView(existing[i]);
        return (MessageConsole) existing[i];
      }
   // no console found, so create a new one
   MessageConsole myConsole = new MessageConsole(name, null);
   YangConsole.addConsoles(new IConsole[] { myConsole });
   return myConsole;
}
项目:yang-design-studio    文件:YangToTree.java   
private static MessageConsole findConsole(String name) {//Find and return console, otherwise make one

                    if (ConsolePlugin.getDefault() == null)
                        return null;
                    ConsolePlugin plugin = ConsolePlugin.getDefault();
                    IConsoleManager YangConsole = plugin.getConsoleManager();
                    IConsole[] existing = YangConsole.getConsoles();
                    for (int i = 0; i < existing.length; i++)
                        if (name.equals(existing[i].getName())) {
                            YangConsole.showConsoleView(existing[i]);
                            return (MessageConsole) existing[i];
                        }
                    MessageConsole myConsole = new MessageConsole(name, null);
                    YangConsole.addConsoles(new IConsole[] { myConsole });
                    return myConsole;
                }
项目:yang-design-studio    文件:YangToXSD.java   
private static MessageConsole findConsole(String name) {//Find and return console, otherwise make one

   if (ConsolePlugin.getDefault() == null)
        return null;
   ConsolePlugin plugin = ConsolePlugin.getDefault();
   IConsoleManager YangConsole = plugin.getConsoleManager();
   IConsole[] existing = YangConsole.getConsoles();
   for (int i = 0; i < existing.length; i++)
      if (name.equals(existing[i].getName())) {
        YangConsole.showConsoleView(existing[i]);
        return (MessageConsole) existing[i];
      }
   MessageConsole myConsole = new MessageConsole(name, null);
   YangConsole.addConsoles(new IConsole[] { myConsole });
   return myConsole;
}
项目:yang-design-studio    文件:YangToXslt.java   
private static MessageConsole findConsole(String name) {//Find and return console, otherwise make one

   if (ConsolePlugin.getDefault() == null)
        return null;
   ConsolePlugin plugin = ConsolePlugin.getDefault();
   IConsoleManager YangConsole = plugin.getConsoleManager();
   IConsole[] existing = YangConsole.getConsoles();
   for (int i = 0; i < existing.length; i++)
      if (name.equals(existing[i].getName())) {
        YangConsole.showConsoleView(existing[i]);
        return (MessageConsole) existing[i];
      }
   MessageConsole myConsole = new MessageConsole(name, null);
   YangConsole.addConsoles(new IConsole[] { myConsole });
   return myConsole;
}
项目:yang-design-studio    文件:YangToJSTREE.java   
private static MessageConsole findConsole(String name) {//Find and return console, otherwise make one

   if (ConsolePlugin.getDefault() == null)
        return null;
   ConsolePlugin plugin = ConsolePlugin.getDefault();
   IConsoleManager YangConsole = plugin.getConsoleManager();
   IConsole[] existing = YangConsole.getConsoles();
   for (int i = 0; i < existing.length; i++)
      if (name.equals(existing[i].getName())) {
        YangConsole.showConsoleView(existing[i]);
        return (MessageConsole) existing[i];
      }
   // no console found, so create a new one
   MessageConsole myConsole = new MessageConsole(name, null);
   YangConsole.addConsoles(new IConsole[] { myConsole });
   return myConsole;
}
项目:yang-design-studio    文件:YangToUML.java   
private static MessageConsole findConsole(String name) {//Find and return console, otherwise make one

                    if (ConsolePlugin.getDefault() == null)
                        return null;
                    ConsolePlugin plugin = ConsolePlugin.getDefault();
                    IConsoleManager YangConsole = plugin.getConsoleManager();
                    IConsole[] existing = YangConsole.getConsoles();
                    for (int i = 0; i < existing.length; i++)
                        if (name.equals(existing[i].getName())) {
                            YangConsole.showConsoleView(existing[i]);
                            return (MessageConsole) existing[i];
                        }
                    MessageConsole myConsole = new MessageConsole(name, null);
                    YangConsole.addConsoles(new IConsole[] { myConsole });
                    return myConsole;
                }
项目:yang-design-studio    文件:YangToYin.java   
private static MessageConsole findConsole(String name) {//Find and return console, otherwise make one

                        if (ConsolePlugin.getDefault() == null)
                            return null;
                        ConsolePlugin plugin = ConsolePlugin.getDefault();
                        IConsoleManager YangConsole = plugin.getConsoleManager();
                        IConsole[] existing = YangConsole.getConsoles();
                        for (int i = 0; i < existing.length; i++)
                            if (name.equals(existing[i].getName())) {
                                YangConsole.showConsoleView(existing[i]);
                                return (MessageConsole) existing[i];
                            }
                        MessageConsole myConsole = new MessageConsole(name, null);
                        YangConsole.addConsoles(new IConsole[] { myConsole });
                        return myConsole;
                    }
项目:sadlos2    文件:SadlConsole.java   
public static void displayMessages(SadlModelManager manager) {
    MessageConsole mc = findOrCreateConsole();
    IDocument doc = mc.getDocument();
    int startingOffset = doc.getLength();
    HashMap<String, HyperlinkInfo> links = new HashMap<String, HyperlinkInfo>();
    SadlConsoleListener scl = new SadlConsoleListener(links, startingOffset);
    doc.addDocumentListener(scl);
    SadlMessage msg;
    while ((msg = manager.getNextMessage()) != null) {
        HyperlinkInfo info = msg.getLinkInfo();
        if (info != null) {
            links.put(msg.getMessage(), msg.getLinkInfo());
        }
        String txt = msg.getMessage();
        if (!txt.endsWith(System.getProperty("line.separator"))) {
            txt += System.getProperty("line.separator");
        }
        writeToConsole(msg.getType(), txt);
    }
}
项目:checker-framework    文件:CheckerPlugin.java   
/**
 * Get the MessageConsole for the plugin
 * 
 * @return a MessageConsole (will create if it doesn't exist)
 */
public static MessageConsole findConsole()
{
    ConsolePlugin plugin = ConsolePlugin.getDefault();
    IConsoleManager conMan = plugin.getConsoleManager();
    IConsole[] existing = conMan.getConsoles();
    for (IConsole element : existing)
    {
        if (consoleName.equals(element.getName()))
        {
            return (MessageConsole) element;
        }
    }
    // no console found, so create a new one
    MessageConsole myConsole = new MessageConsole(consoleName, null);
    conMan.addConsoles(new IConsole[] { myConsole });
    return myConsole;
}
项目:checker-framework    文件:JavacRunner.java   
/**
 * Runs the compiler on the selected files using the given processor
 * 
 * @param fileNames
 *            files that need to be type-checked
 * @param processors
 *            Type processors to run
 * @param classpath
 *            The classpath to reference in compilation
 */

public void run()
{
    Iterable<String> opts;

    opts = getOptions(processors, classpath);

    // The following code uses the compiler's internal APIs, which are
    // volatile. (see warning in JavacTool source)
    JavacTool tool = JavacTool.create();
    JavacFileManager manager = tool.getStandardFileManager(collector, null, null);

    Iterable<? extends JavaFileObject> fileObjs = manager.getJavaFileObjectsFromStrings(fileNames);

    CheckerPlugin.getDefault();
    MessageConsole console = CheckerPlugin.findConsole();
    MessageConsoleStream stream = console.newMessageStream();
    Writer writer = new OutputStreamWriter(stream);

    JavacTask task = tool.getTask(writer, manager, collector, opts, null, fileObjs);

    task.call();
    manager.close();
}
项目:fernflower-eclipse-plugin    文件:DecompileDialog.java   
private MessageConsole getConsole(String name) {
    Activator plugin = Activator.getDefault();
    IConsoleManager consoleManager = plugin.getConsoleManager();
    IConsole[] existing = consoleManager.getConsoles();
    LoggerUtil.logDebug("Consoles returned from ConsoleManager: " + existing.length);
    for (int i = 0; i < existing.length; i++) {
        if (name.equals(existing[i].getName())) {
            LoggerUtil.logDebug("Found console with name: " + name);
            MessageConsole messageConsole = (MessageConsole) existing[i];
            messageConsole.clearConsole();
            return messageConsole;
        }
    }
    LoggerUtil.logDebug("No console with name " + name + " was found, creating such..");
    MessageConsole decompilerConsole = new MessageConsole(name, null);
    consoleManager.addConsoles(new IConsole[] { decompilerConsole });
    return decompilerConsole;
}
项目:Pydev    文件:MessageConsoles.java   
public static IOConsoleOutputStream getConsoleOutputStream(String name, String iconPath) {
    synchronized (lock) {
        IOConsoleOutputStream outputStream = consoleOutputs.get(name);
        if (outputStream == null) {
            MessageConsole console = getConsole(name, iconPath);

            HashMap<IOConsoleOutputStream, String> themeConsoleStreamToColor = new HashMap<IOConsoleOutputStream, String>();
            outputStream = console.newOutputStream();
            themeConsoleStreamToColor.put(outputStream, "console.output");
            console.setAttribute("themeConsoleStreamToColor", themeConsoleStreamToColor);
            ConsoleColorCache.getDefault().keepConsoleColorsSynched(console);
            consoles.put(name, console);
            consoleOutputs.put(name, outputStream);
        }
        return outputStream;
    }
}
项目:smaccm    文件:TestCaseGeneratorMenuListener.java   
private Action createWriteConsoleAction(String actionName, final String consoleName, final Object content) {
    return new Action(actionName) {
        @Override
        public void run() {
            final MessageConsole console = findConsole(consoleName);
            showConsole(console);
            console.clearConsole();

            /*
             * From the Eclipse API: "Clients should avoid writing large
             * amounts of output to this stream in the UI thread. The
             * console needs to process the output in the UI thread and if
             * the client hogs the UI thread writing output to the console,
             * the console will not be able to process the output."
             */
            new Thread(new Runnable() {
                @Override
                public void run() {
                    console.newMessageStream().println(content.toString());
                }
            }).start();
        }
    };
}
项目:smaccm    文件:TestSuiteMenuListener.java   
private Action createWriteConsoleAction(String actionName, final String consoleName, final Object content) {
    return new Action(actionName) {
        @Override
        public void run() {
            final MessageConsole console = findConsole(consoleName);
            showConsole(console);
            console.clearConsole();

            /*
             * From the Eclipse API: "Clients should avoid writing large
             * amounts of output to this stream in the UI thread. The
             * console needs to process the output in the UI thread and if
             * the client hogs the UI thread writing output to the console,
             * the console will not be able to process the output."
             */
            new Thread(new Runnable() {
                @Override
                public void run() {
                    console.newMessageStream().println(content.toString());
                }
            }).start();
        }
    };
}
项目:smaccm    文件:AgreeMenuListener.java   
private Action createWriteConsoleAction(String actionName, final String consoleName,
        final Object content) {
    return new Action(actionName) {
        @Override
        public void run() {
            final MessageConsole console = findConsole(consoleName);
            showConsole(console);
            console.clearConsole();

            /*
             * From the Eclipse API: "Clients should avoid writing large
             * amounts of output to this stream in the UI thread. The
             * console needs to process the output in the UI thread and if
             * the client hogs the UI thread writing output to the console,
             * the console will not be able to process the output."
             */
            new Thread(new Runnable() {
                @Override
                public void run() {
                    console.newMessageStream().println(content.toString());
                }
            }).start();
        }
    };
}
项目:mule-tooling-incubator    文件:GradleRunner.java   
public static void run(final BuildLauncher build, final IProgressMonitor monitor, String... runArgs) {
    monitor.beginTask("Running gradle build", IProgressMonitor.UNKNOWN);
    MessageConsole messageConsole = UiUtils.getMessageConsole("Gradle run");
    final IOConsoleOutputStream consoleStream = messageConsole.newOutputStream();
    build.setStandardOutput(consoleStream);
    build.setStandardError(consoleStream);
    GradlePluginUtils.setBuildLoggingOptions(build, runArgs);
    UiUtils.showConsoleView();
    // STUDIO-2676 - bring new console to front
    ConsolePlugin.getDefault().getConsoleManager().showConsoleView(messageConsole);

    build.addProgressListener(new ProgressListener() {

        @Override
        public void statusChanged(ProgressEvent progressEvent) {
            monitor.beginTask(progressEvent.getDescription(), IProgressMonitor.UNKNOWN);
        }
    });

    build.run();
    monitor.done();
}
项目:mule-tooling-incubator    文件:LifeCycleJob.java   
private void redirectOutputToConsole(PipedOutputStream nextOutput) {
    MessageConsole messageConsole = MavenUIPlugin.getDefault().getGenericOutputConsole();
    final IOConsoleOutputStream consoleStream = messageConsole.newOutputStream();
    PipedInputStream inputStream = null;
    try {
        inputStream = new PipedInputStream(nextOutput);
    } catch (IOException e) {
        throw new RuntimeException("IO exception creating piped streams (should not happen)", e);
    }
    redirectOutputToConsoleThread = new OutputRedirectorThread(inputStream, consoleStream, RunnableUtils.newRunnableClosing(inputStream, consoleStream));

    UiUtils.showConsoleView();
    // STUDIO-2676 - bring new console to front
    ConsolePlugin.getDefault().getConsoleManager().showConsoleView(messageConsole);
    redirectOutputToConsoleThread.start();
}
项目:mule-tooling-incubator    文件:InstallJar.java   
private void redirectOutputToConsole(PipedOutputStream nextOutput) {
    MessageConsole messageConsole = MavenUIPlugin.getDefault().getGenericOutputConsole();
    final IOConsoleOutputStream consoleStream = messageConsole.newOutputStream();
    PipedInputStream inputStream = null;
    try {
        inputStream = new PipedInputStream(nextOutput);
    } catch (IOException e) {
        throw new RuntimeException("IO exception creating piped streams (should not happen)", e);
    }
    redirectOutputToConsoleThread = new OutputRedirectorThread(inputStream, consoleStream, RunnableUtils.newRunnableClosing(inputStream, consoleStream));

    UiUtils.showConsoleView();
    // STUDIO-2676 - bring new console to front
    ConsolePlugin.getDefault().getConsoleManager().showConsoleView(messageConsole);
    redirectOutputToConsoleThread.start();
}
项目:n4js    文件:ConsoleDisplayMgr.java   
private static MessageConsole findMessageConsole(String title) {
    IConsole[] consoles = ConsolePlugin.getDefault().getConsoleManager().getConsoles();
    for (IConsole iConsole : consoles) {
        if (iConsole.getName().equals(title)) {
            return (MessageConsole) iConsole;
        }
    }
    return null;
}
项目:EclipseMinifyBuilder    文件:MinifyBuilder.java   
public MessageConsole minifierConsole() {
    IConsoleManager conMan = ConsolePlugin.getDefault().getConsoleManager();
    IConsole[] existing = conMan.getConsoles();
    for (int i = 0; i < existing.length; i++)
        if ("Minifier".equals(existing[i].getName()))
            return (MessageConsole) existing[i];
    //no console found, so create a new one
    MessageConsole myConsole = new MessageConsole("Minifier", null);
    conMan.addConsoles(new IConsole[] { myConsole });
    return myConsole;
}
项目:neoscada    文件:SymbolController.java   
private ConsoleContext createOrGetConsole ()
{
    if ( this.parentController != null && this.parentController.getConsole () != null )
    {
        return this.parentController.getConsole ();
    }

    final IConsoleManager manager = ConsolePlugin.getDefault ().getConsoleManager ();
    final MessageConsole messageConsole = new MessageConsole ( String.format ( "Symbol Debug Console: %s", this.symbolInfoName ), null, null, true );
    manager.addConsoles ( new IConsole[] { messageConsole } );
    this.createdConsole = messageConsole;
    return new ConsoleContext ( messageConsole );
}
项目:neoscada    文件:ConsoleContext.java   
public ConsoleContext ( final MessageConsole messageConsole )
{
    this.writerStream = messageConsole.newMessageStream ();

    final MessageConsoleStream errorStream = messageConsole.newMessageStream ();
    errorStream.setColor ( Display.getDefault ().getSystemColor ( SWT.COLOR_RED ) );
    this.errorPrintWriter = new PrintWriter ( new OutputStreamWriter ( errorStream ) );

    this.logStream = messageConsole.newMessageStream ();
    this.logStream.setColor ( Display.getDefault ().getSystemColor ( SWT.COLOR_GRAY ) );
}
项目:neoscada    文件:OscarValidatorHandler.java   
@Override
protected void runFile ( final IFile file, final IProgressMonitor monitor ) throws Exception
{

    final MessageConsole mc = new MessageConsole ( String.format ( "OSCAR Validation: %s", file ), "org.eclipse.scada.configuration.oscar.validation", null, true );

    ConsolePlugin.getDefault ().getConsoleManager ().addConsoles ( new IConsole[] { mc } );
    mc.activate ();

    final File dataFile = file.getLocation ().toFile ();

    Map<String, Map<String, Map<String, String>>> data;

    if ( OscarLoader.isOscar ( dataFile ) )
    {
        data = new OscarLoader ( dataFile ).getData ();
    }
    else
    {
        try (FileInputStream stream = new FileInputStream ( dataFile ))
        {
            data = OscarLoader.loadJsonData ( stream );
        }
    }

    final PrintStream consoleStream = new PrintStream ( mc.newOutputStream () );
    try
    {
        new LoopValidator ( data, consoleStream ).validate ();
    }
    finally
    {
        consoleStream.close ();
    }
}
项目:convertigo-eclipse    文件:ConvertigoPlugin.java   
private void createConsoles() {
    ConsolePlugin consolePlugin = ConsolePlugin.getDefault();
    IConsoleManager consoleManager = consolePlugin.getConsoleManager();

    stdoutConsole = new MessageConsole("Stdout", ImageDescriptor.createFromFile(getClass(), "/consoles/stdout.gif"));
    stdoutConsole.setTabWidth(TAB_WIDTH);
    stdoutConsoleStream = stdoutConsole.newMessageStream();
    stderrConsoleStream = stdoutConsole.newMessageStream();
    stderrConsoleStream.setColor(stderrConsoleStreamColor);

    engineConsole = new MessageConsole("Engine", ImageDescriptor.createFromFile(getClass(), "/consoles/engine.gif"));
    engineConsole.setTabWidth(TAB_WIDTH);
    engineConsoleStream = engineConsole.newMessageStream();

    consoleManager.addConsoles(new IConsole[] {
        engineConsole,
        stdoutConsole
    });

    consolePipes = new ConsolePipes();

    debugConsoleStream = new MessageConsoleStream(engineConsole) {

        @Override
        public void write(String str) throws IOException {
            if (str.endsWith("\n")) {
                str = str.substring(0, str.length() - 1);
            }
            Engine.logStudio.info("[debug] " + str);
        }

    };
}
项目:Hydrograph    文件:ConsoleLogger.java   
/**
 * Find console using name if exist or create new.
 *
 * @param name            the console name
 * @return console
 */
private void initConsoleStream() {
    MessageConsole messageConsole = getMessageConsole();
    messageConsole.clearConsole();
    messageConsoleStream=messageConsole.newMessageStream();
    logger.debug("Created message console stream");
    messageConsoleStream.getConsole().addPropertyChangeListener(new IPropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent event) {
            ((ConsoleView)event.getSource()).setScrollLock(true);
        }
    });

}
项目:Hydrograph    文件:ConsoleLogger.java   
/**
 * get message console object
 * 
 * @param messageConsole
 * @return
 */
private MessageConsole getMessageConsole() {
    IConsoleManager conMan = getConsoleManager();   
    MessageConsole messageConsole = getConsoleFromExistingConsoles(conMan);     
    if(messageConsole == null){
        messageConsole = createNewMessageConsole(conMan);
        logger.debug("No existing console found, created new one");
    }

    int lowWaterMark = getConsoleBufferSize();
    messageConsole.setWaterMarks(lowWaterMark, lowWaterMark + DEFAULT_CONSOLE_HIGH_WATER_MARK_OFFSET);
    return messageConsole;
}
项目:Tarski    文件:LaunchModel.java   
private MessageConsole findConsole(final String name) {
  final ConsolePlugin plugin = ConsolePlugin.getDefault();
  final IConsoleManager conMan = plugin.getConsoleManager();
  final 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
  final MessageConsole myConsole = new MessageConsole(name, null);
  conMan.addConsoles(new IConsole[] {myConsole});
  return myConsole;
}
项目:Tarski    文件:RunModel.java   
private MessageConsole findConsole(final String name) {
  final ConsolePlugin plugin = ConsolePlugin.getDefault();
  final IConsoleManager conMan = plugin.getConsoleManager();
  final 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
  final MessageConsole myConsole = new MessageConsole(name, null);
  conMan.addConsoles(new IConsole[] {myConsole});
  return myConsole;
}