use of org.eclipse.ui.console.IHyperlink in project erlide_eclipse by erlang.
the class ErlPatternMatchListenerDelegate method matchFound.
@Override
public void matchFound(final PatternMatchEvent event) {
if (fConsole == null) {
return;
}
try {
final String txt = fConsole.getDocument().get(event.getOffset(), event.getLength());
final String[] v = txt.split(":");
final IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
IResource res = null;
for (final IProject prj : projects) {
if (!prj.isOpen()) {
continue;
}
try {
res = ErlPatternMatchListenerDelegate.recursiveFindNamedResourceWithReferences(prj, v[0]);
if (res != null) {
break;
}
} catch (final CoreException e) {
ErlLogger.warn(e);
}
}
IFile file = null;
if (res instanceof IFile) {
file = (IFile) res;
}
final IHyperlink link = new FileLink(file, null, -1, -1, Integer.parseInt(v[1]));
fConsole.addHyperlink(link, event.getOffset(), event.getLength());
} catch (final BadLocationException e) {
ErlLogger.warn(e);
}
}
Aggregations