1 11 package org.eclipse.jdt.internal.debug.ui.console; 12 13 import org.eclipse.ui.console.ConsolePlugin; 14 import org.eclipse.ui.console.IConsole; 15 import org.eclipse.ui.console.IConsoleFactory; 16 import org.eclipse.ui.console.IConsoleListener; 17 import org.eclipse.ui.console.IConsoleManager; 18 19 25 public class JavaStackTraceConsoleFactory implements IConsoleFactory { 26 private IConsoleManager fConsoleManager = null; 27 private JavaStackTraceConsole fConsole = null; 28 29 public JavaStackTraceConsoleFactory() { 30 fConsoleManager = ConsolePlugin.getDefault().getConsoleManager(); 31 fConsoleManager.addConsoleListener(new IConsoleListener() { 32 public void consolesAdded(IConsole[] consoles) { 33 } 34 35 public void consolesRemoved(IConsole[] consoles) { 36 for (int i = 0; i < consoles.length; i++) { 37 if(consoles[i] == fConsole) { 38 fConsole.saveDocument(); 39 fConsole = null; 40 } 41 } 42 } 43 44 }); 45 } 46 49 public void openConsole() { 50 if (fConsole == null) { 51 fConsole = new JavaStackTraceConsole(); 52 fConsole.initializeDocument(); 53 fConsoleManager.addConsoles(new IConsole[]{fConsole}); 54 } 55 fConsoleManager.showConsoleView(fConsole); 56 } 57 } 58 | Popular Tags |