1 11 package org.eclipse.jdt.internal.debug.ui.console; 12 13 14 import org.eclipse.debug.ui.console.IConsole; 15 import org.eclipse.debug.ui.console.IConsoleHyperlink; 16 import org.eclipse.debug.ui.console.IConsoleLineTracker; 17 import org.eclipse.jface.text.BadLocationException; 18 import org.eclipse.jface.text.IRegion; 19 20 23 public class J9ConsoleTracker implements IConsoleLineTracker { 24 25 28 private IConsole fConsole; 29 30 private StringMatcher fJ9Matcher; 31 32 35 public void init(IConsole console) { 36 fConsole = console; 37 fJ9Matcher = new StringMatcher("*.*(*)*", false, false); } 39 40 43 public void lineAppended(IRegion line) { 44 try { 45 int offset = line.getOffset(); 46 int length = line.getLength(); 47 String text = fConsole.getDocument().get(offset, length); 48 int index = -1; 49 if (fJ9Matcher.match(text)) { 50 index = text.lastIndexOf(' '); 52 if (index >= 0) { 53 int linkOffset = offset + index + 1; 54 int linkLength = length - index - 1; 55 IConsoleHyperlink link = null; 56 link = new J9StackTraceHyperlink(fConsole); 57 fConsole.addLink(link, linkOffset, linkLength); 58 } 59 } 60 } catch (BadLocationException e) { 61 } 62 } 63 64 67 public void dispose() { 68 fConsole = null; 69 fJ9Matcher = null; 70 } 71 72 } 73 | Popular Tags |