Package tool.editors

Source Code of tool.editors.TextHover

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);

  }

}
TOP

Related Classes of tool.editors.TextHover

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.