}
@Override
public void matchFound(PatternMatchEvent event) {
if (event.getSource() instanceof TextConsole) {
TextConsole console = (TextConsole) event.getSource();
IDocument doc = console.getDocument();
int off = event.getOffset();
int lenght = event.getLength();
String fn = null;
int ln = 1;
try {
String str = doc.get(off,lenght);
Matcher m = _p.matcher(str);
m.matches();
fn = m.group(1);
ln = Integer.parseInt(m.group(2));
} catch (BadLocationException e1) {
e1.printStackTrace();
}
IWorkspace ws = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = ws.getRoot();
String active_prj_name = null;
try {
active_prj_name = root.getPersistentProperty(QN_PREFERENCES_ACTIVE_PRJ);
} catch (CoreException e1) {
e1.printStackTrace();
return;
}
if(active_prj_name == null)
return;
IHyperlink link = null;
IProject p = root.getProject(active_prj_name);
File f = new File(fn);
if(f.exists())
link = (IHyperlink) new URLLink(f.toURI(), ln);
else
link = new FileLink(p.getFile(fn), null, -1, -1, ln);
try {
console.addHyperlink(link, event.getOffset(), event.getLength());
} catch (BadLocationException e) {
e.printStackTrace();
}
}
}