Package com.dubture.symfony.ui.console

Source Code of com.dubture.symfony.ui.console.SymfonyConsoleFactory

/*******************************************************************************
* This file is part of the Symfony eclipse plugin.
*
* (c) Robert Gruendler <r.gruendler@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
******************************************************************************/
package com.dubture.symfony.ui.console;

import org.eclipse.ui.console.ConsolePlugin;
import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.console.IConsoleFactory;
import org.eclipse.ui.console.IConsoleManager;
import org.eclipse.ui.console.MessageConsole;

public class SymfonyConsoleFactory implements IConsoleFactory {

  private static MessageConsole console;


  @Override
  public void openConsole() {

    MessageConsole console = getConsole();
   
    if (console != null) {
     
      IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
      IConsole[] existing = manager.getConsoles();
      boolean exists = false;
     
      for (int i = 0; i < existing.length; i++) {
        if (console == existing[i]) {
          exists = true;
          break;
        }       
      }
     
      if (!exists) {
        manager.addConsoles(new IConsole[] {console});
        manager.showConsoleView(console);
       
      }
    }

  }
 
 
  public static MessageConsole getConsole() {
   
   
    if (console == null) {
      console = new MessageConsole("Symfony", null);
    }
   
   
    return console;
   
  }

}
TOP

Related Classes of com.dubture.symfony.ui.console.SymfonyConsoleFactory

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.