Пример #1
0
 public void createConsoleStream() {
   // 出力コンソールの用意
   console = new MessageConsole("キーワードプログラミング", null);
   consoleManager = ConsolePlugin.getDefault().getConsoleManager();
   consoleManager.addConsoles(new IConsole[] {console});
   consoleStream = console.newMessageStream();
 }
Пример #2
0
 private static MessageConsole findConsole(String name) {
   ConsolePlugin conPlugin = ConsolePlugin.getDefault();
   IConsoleManager conManager = conPlugin.getConsoleManager();
   IConsole[] consAll = conManager.getConsoles();
   for (int i = 0; i < consAll.length; i++)
     if (name.equals(consAll[i].getName())) return (MessageConsole) consAll[i];
   // no console found, so we create a new one
   MessageConsole console = new MessageConsole(name, null);
   conManager.addConsoles(new IConsole[] {console});
   return console;
 }
Пример #3
0
 @Override
 public void start(BundleContext context) throws Exception {
   console = new MessageConsole("Terracotta build system", null);
   final Device device = console.getFont() != null ? console.getFont().getDevice() : null;
   initStream(ConsoleStream.DEFAULT, device, BLACK);
   initStream(ConsoleStream.STDOUT, device, BLUE);
   initStream(ConsoleStream.STDERR, device, RED);
   final IConsoleManager mgr = ConsolePlugin.getDefault().getConsoleManager();
   mgr.addConsoles(new IConsole[] {console});
   super.start(context);
 }
  /*
   * Busca la consola de eclipse para poder escribir los log
   */
  private MessageConsole findConsole(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];

    MessageConsole myConsole = new MessageConsole(name, null);
    conMan.addConsoles(new IConsole[] {myConsole});
    return myConsole;
  }
Пример #5
0
 public static PVSConsole getConsole() {
   ConsolePlugin plugin = ConsolePlugin.getDefault();
   IConsoleManager conMan = plugin.getConsoleManager();
   for (IConsole c : conMan.getConsoles()) {
     if (name.equals(c.getName())) {
       return (PVSConsole) c;
     }
   }
   PVSConsole console = new PVSConsole();
   conMan.addConsoles(new IConsole[] {console});
   conMan.showConsoleView(console);
   return console;
 }
Пример #6
0
  public static MessageConsole getConsole() {
    ConsolePlugin plugin = ConsolePlugin.getDefault();
    IConsoleManager conMan = plugin.getConsoleManager();
    IConsole[] existing = conMan.getConsoles();
    for (int i = 0; i < existing.length; i++)
      if (ConsoleHelper.CONSOLE_ID.equals(existing[i].getName()))
        return (MessageConsole) existing[i];
    // no console found, so create a new one
    MessageConsole myConsole = ARESUI.getDefault().getConsole();

    conMan.addConsoles(new IConsole[] {myConsole});
    return myConsole;
  }
  // print to stream, lazily instantiating and opening console if necessary
  private void print(final LoggingEvent event) {
    // ensure in UI thread
    assert Display.getCurrent() != null;

    // ensure console view is open
    if (WorkbenchUtil.getView(IConsoleConstants.ID_CONSOLE_VIEW) == null) {
      try {
        IWorkbenchPage activePage = WorkbenchUtil.getActivePage();
        if (activePage != null) {
          activePage.showView(IConsoleConstants.ID_CONSOLE_VIEW);
        }
      } catch (PartInitException pie) {
        // ignore for now
      }
    }

    // lazily instantiate console if necessary
    if (_consoleStream == null) {
      IConsoleManager mgr = ConsolePlugin.getDefault().getConsoleManager();
      MessageConsole logConsole =
          new MessageConsole(
              Activator.getResourceString("MessageConsoleAppender.Log"), // $NON-NLS-1$
              null);
      mgr.addConsoles(new IConsole[] {logConsole});
      mgr.showConsoleView(logConsole);
      _consoleStream = logConsole.newMessageStream();
    }

    // print message
    _consoleStream.print(getLayout().format(event));
    if (getLayout().ignoresThrowable()) {
      String[] lines = event.getThrowableStrRep();
      if (lines != null) {
        for (String line : lines) {
          _consoleStream.println(line);
        }
      }
    }
  }
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.ui.console.IConsoleFactory#openConsole()
  */
 public void openConsole() {
   IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
   final TangoSpecConsole console = createConsole();
   manager.addConsoles(new IConsole[] {console});
   manager.showConsoleView(console);
 }
Пример #9
0
 private GenericConsole createConsole() {
   GenericConsole result = new GenericConsole(getConsoleConfigurer());
   consoleManager.addConsoles(new IConsole[] {result});
   return result;
 }