blob: 3ecee0f2f464908acc1f127c0b009c7a67977f96 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2005, 2007 IBM Corporation and others.
* 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
*
*******************************************************************************/
package org.eclipse.dltk.python.internal.debug.ui.console;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.ui.console.IHyperlink;
import org.eclipse.ui.console.IPatternMatchListenerDelegate;
import org.eclipse.ui.console.PatternMatchEvent;
import org.eclipse.ui.console.TextConsole;
/**
* Provides links for stack traces
*/
public class PythonConsoleTracker implements IPatternMatchListenerDelegate {
/**
* The console associated with this line tracker
*/
private TextConsole fConsole;
/* (non-Javadoc)
* @see org.eclipse.ui.console.IPatternMatchListenerDelegate#connect(org.eclipse.ui.console.IConsole)
*/
public void connect(TextConsole console) {
fConsole = console;
}
/* (non-Javadoc)
* @see org.eclipse.ui.console.IPatternMatchListenerDelegate#disconnect()
*/
public void disconnect() {
fConsole = null;
}
protected TextConsole getConsole() {
return fConsole;
}
/* (non-Javadoc)
* @see org.eclipse.ui.console.IPatternMatchListenerDelegate#matchFound(org.eclipse.ui.console.PatternMatchEvent)
*/
public void matchFound(PatternMatchEvent event) {
try {
int offset = event.getOffset();
int length = event.getLength();
IHyperlink link = new PythonFileHyperlink(fConsole);
fConsole.addHyperlink(link, offset, length);
} catch (BadLocationException e) {
}
}
}