1 11 package org.eclipse.team.internal.ccvs.ui.console; 12 13 import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin; 14 import org.eclipse.ui.console.*; 17 18 25 public class CVSConsoleFactory implements IConsoleFactory { 26 27 public CVSConsoleFactory() { 28 } 29 30 public void openConsole() { 31 showConsole(); 32 } 33 34 public static void showConsole() { 35 CVSOutputConsole console = CVSUIPlugin.getPlugin().getConsole(); 36 if (console != null) { 37 IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager(); 38 IConsole[] existing = manager.getConsoles(); 39 boolean exists = false; 40 for (int i = 0; i < existing.length; i++) { 41 if(console == existing[i]) 42 exists = true; 43 } 44 if(! exists) 45 manager.addConsoles(new IConsole[] {console}); 46 manager.showConsoleView(console); 47 } 48 } 49 50 public static void closeConsole() { 51 IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager(); 52 CVSOutputConsole console = CVSUIPlugin.getPlugin().getConsole(); 53 if (console != null) { 54 manager.removeConsoles(new IConsole[] {console}); 55 ConsolePlugin.getDefault().getConsoleManager().addConsoleListener(console.new MyLifecycle()); 56 } 57 } 58 } 59 | Popular Tags |