content: /**
   *  Copyright (c) 2015-2016 Angelo ZERR.
   *  All rights reserved. This program and the accompanying materials
   *  are made available under the terms of the Eclipse Public License v1.0
   *  which accompanies this distribution, and is available at
   *  http://www.eclipse.org/legal/epl-v10.html
   *
   *  Contributors:
   *  Angelo Zerr <angelo.zerr@gmail.com> - initial API and implementation
   */
  package ts.eclipse.ide.internal.ui.console;
  
  import org.eclipse.ui.console.ConsolePlugin;
  import org.eclipse.ui.console.IConsole;
  import org.eclipse.ui.console.IConsoleManager;
  
  public class TypeScriptConsoleHelper {
  
  	public static void showConsole(IConsole console) {
  		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;
  				}
  			}
  			if (!exists) {
  				manager.addConsoles(new IConsole[] { console });
  			}
  			manager.showConsoleView(console);
  		}
  	}
  
  	public static void closeConsole(IConsole console) {
  		IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
  		if (console != null) {
  			manager.removeConsoles(new IConsole[] { console });
  			// ConsolePlugin.getDefault().getConsoleManager()
  			// .addConsoleListener(console.new MyLifecycle());
  		}
  	}
  
  }