package tool.editors;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextHover;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.Region;
import tool.model.ToolModel;
public class TextHover implements ITextHover {
@Override
public String getHoverInfo(ITextViewer tv, IRegion r) {
try {
IDocument doc = tv.getDocument();
ToolModel em = ToolModel.getModel(doc, null);
return em.getElementAt(r.getOffset()).
getHoverHelp();
}
catch (Exception e) {
return "";
}
}
@Override
public IRegion getHoverRegion(ITextViewer tv, int off) {
return new Region(off, 0);
}
}