blob: 372f6ebee4a8aaab4953140d7f79c7a9cb7c7d86 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2005, 2016 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;
@Override
public void connect(TextConsole console) {
fConsole = console;
}
@Override
public void disconnect() {
fConsole = null;
}
protected TextConsole getConsole() {
return fConsole;
}
@Override
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) {
}
}
}